Skip to content

Consider a mechanism for including content from surrounding document  #498

Open
@danbri

Description

@danbri

This is a "what do you think about this" enquiry rather than a fully polished proposal.

At Google we have come to recommend JSON-LD within HTML, for structured data (schema.org etc.) use especially around search features, in (mild) preference over Microdata and RDFa.

All these formats have different strengths. JSON-LD is very self-contained, which can make publication/maintenance easier. However sometimes we want to have the JSON-LD say things about chunks of markup from the surrounding document that contains the JSON-LD. Extracting those pieces of document is also (we suggest) likely to be a common task, and perhaps worth some kind of standardization support.

Our in-house experiments in this direction use the draft SpeakableSpecification type from schema.org, which defines 3 ways of pointing into the surrounding document content: IDs, 'xpath' and 'cssSelector' properties. While the type name comes from a particular application domain, the selection mechanism is very cross-domain and we thought potentially something a future JSON-LD version might define.

Although downstream processors can use these to extract from the page and (in some sense) attach to the JSON-LD data, we think it might be useful for the JSON-LD specification to talk about the details of this rather than leave it entirely to applications.

There are a few different ways this could be handled, but the rough idea is that vocabularies defining types like SpeakableSpecification might mention some well known datatypes corresponding to something like 'Xpath', 'CssSelector', and the extraction of the corresponding content could be an optional extra service provided by JSON-LD 1.x parsers. Thanks for any thoughts on this.

(working assumptions: some paths would never match, or match multiple times; and that we are only talking about the current containing document)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions