This specification defines a DOM API for accessing RDFa data contained in a structured document, such as SVG, XHTML or HTML. The RDFa DOM API can be used to extract a specific RDF triple, or set of triples, based on a subject query.
RDFa [[!RDFA-SYNTAX]] has seen substantial growth since it became an official W3C Recommendation in October 2008. It has seen wide adoption among search companies, e-commerce sites, governments, and content management systems. There are numerous interoperable implementations and growth is expected to continue to rise.
The RDFa DOM API strives to be a simple set of calls that a developer may use to retrieve triples contained in the document.
This section describes the set of additional methods that must be defined
on the standard
Document interface as defined in
type parameter may be null or an empty string. In both cases,
all subjects from the page should be returned in the array of
getTriplesByType method allows both full URI specification
as well as short-hand specification. A
type may be given by
specifying a complete URI, for example
http://xmlns.com/foaf/0.1/Person, or a short-hand
DOMString such as
To perform a match, a direct string comparison is performed. If the string
comparison fails, the given
type is checked against a subject's
type starting at the last character in each string and moving backwards.
Each character is compared until there is a character mis-match, or all of
the characters in the
type string are exhausted. If all of the
characters in the
type string are exhausted and there were no
character mis-matches, the subject's type must be considered a match.
This section will contain best practices on storing and retrieving triples on a page.
This document has been prepared with the help of the following people (in alphabetical order):