-
Notifications
You must be signed in to change notification settings - Fork 2
RDFa DOM API
This design is an alterative to the current W3C RDFa API Note
This API proposes a revised version of the current W3C RDFa API Note. Main differences are:
-
It is based on the principle of being able to navigate across the DOM "surface" by following the RDF linkage structure that RDFa embeds. It does so by giving access to the meaning of the annotations; that is, the contextual interpretation of the properties, values, links and types.
-
The API should not be designed to be driven by extracted triples. While the meaning of each triple is encoded by the annotations, and must be directly extractable, the API should provide a "bottom-up" view of this, with as much (but no more) of the details that RDFa provides as necessary. This enables it to work within the live DOM, providing read/write access and responding to regular DOM manipulation.
-
It should also note where a feature is dependent on advanced RDFa. That is, it should be obvious which parts of the API are necessary for consuming RDFa Lite conformant documents only, and which parts are added to these to enable full RDFa processing.
-
While this API exposes annotation details (and variants), it must do so with simplicity and uniform access as important design goals. There should be a few obvious ways to use the API, and features added only to facilitate clear usage patterns not possible without them.
The current implementation supports the following (rdfa
to be accessed as document.rdfa
in the final version):
rdfa.getElementsByProperty("http://purl.org/dc/terms/title")
rdfa.getElementsByProperty("http://xmlns.com/foaf/0.1/page", "http://example.org/")
rdfa.getElementsBySubject("http://example.org/")
rdfa.getElementsByType("http://schema.org/Person")
There is an rdfa.context
with this interface:
rdfa.context {.vocab, .prefixes, .lang, .base}
.subContext(vocab, prefixes, lang)
.expand(termOrCurie)
.expandCurie(curie)
.resolve(iri)
Each RDFa-annotated element will also have an .rdfa
property, providing the contextual information. The Lite subset consists of:
elem.rdfa
.rdfa.context
.rdfa.types
.rdfa.subject
.rdfa.resource
.rdfa.linkProperties
.rdfa.contentProperties
.rdfa.content
.rdfa.datatype
.rdfa.parentSubjectElement
.rdfa.childPropertyElements
Completed by the following full properties:
.rdfa.listProperties
.rdfa.reverseLinkProperties
.rdfa.parentIncomplete (same as parentIncompleteElement.rdfa)
.rdfa.incompleteSubject (only if this is a completing and property element)
.rdfa.parentIncompleteElement
.rdfa.completingChildElements
For now, see the RDFa DOM usage example.