Copyright © 2010 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C liability, trademark and document use rules apply.
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.
This section describes the status of this document at the time of its publication. Other documents may supersede this document. A list of current W3C publications and the latest revision of this technical report can be found in the W3C technical reports index at http://www.w3.org/TR/.
This document was published by the RDFa Task Force as an Editor's Draft. If you wish to make comments regarding this document, please send them to public-rdf-in-xhtml-tf@w3.org@w3.org (subscribe, archives). All feedback is welcome.
Publication as a Editor's Draft does not imply endorsement by the W3C Membership. This is a draft document and may be updated, replaced or obsoleted by other documents at any time. It is inappropriate to cite this document as other than work in progress.
This document was produced by a group operating under the 5 February 2004 W3C Patent Policy. W3C maintains a public list of any patent disclosures made in connection with the deliverables of the group; that page also includes instructions for disclosing a patent. An individual who has actual knowledge of a patent which the individual believes contains Essential Claim(s) must disclose the information in accordance with section 6 of the W3C Patent Policy.
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.
In an effort to ensure that browser-based applications are able to fully utilize RDFa, this specification outlines a set of routines that are capable of extracting RDFa from web pages for use in Javascript applications, as well as browser extensions. The RDFa DOM API allows a programmer to query the RDF model expressed by a document and then make programmatic decisions based on the semantic data embedded in the page.
The RDFa DOM API strives to be a simple set of calls that a developer may use to retrieve triples contained in the document.
interface Triple {
readonly attribute DOMString subject;
readonly attribute DOMString predicate;
readonly attribute DOMString object;
readonly attribute DOMString datatype;
readonly attribute DOMString language;
readonly attribute Triple
[] children;
};
children
of type array of Triple
, readonlydatatype
of type DOMString, readonlylanguage
of type DOMString, readonlyobject
of type DOMString, readonlypredicate
of type DOMString, readonlysubject
of type DOMString, readonly
This section describes the set of additional methods that must be defined
on the standard Document
interface as defined in
[DOM-LEVEL-2-CORE].
interface Document {
Triple
[] getTriplesByType (in optional DOMString? type);
};
The type
parameter may be null or an empty string. In both cases,
all subjects from the page should be returned in the array of
Triple
objects.
The 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 Person
.
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):
No informative references.