W3C
TF home

RDF in XHTML Taskforce - RDF/A Examples


This document presents a number of RDF/A Examples from which we should be able to extract strict rules and specifications.

Simple Textual Metadata About the Current Document

This document was written by <span property="http://purl.org/dc/elements/1.1/creator">Ben Adida</span>

alternatively, with CURI:

This document was written by <span xmlns:dc="http://purl.org/dc/elements/1.1/" property="[dc:creator]">Ben Adida</span>.

Both of the above are serializations of the following RDF:

<> <http://purl.org/dc/elements/1.1/creator> "Ben Adida".

Simple Clickable Links made Semantic

This document is available under a <a rel="http://web.resource.org/cc/license" href="http://creativecommons.org/licenses/by-nc-nd/2.5/">Creative Commons License</a>.

making the REL a CURI:

This document is available under a <a xmlns:cc="http://web.resource.org/cc/" rel="[cc:license]" href="http://creativecommons.org/licenses/by-nc-nd/2.5/">Creative Commons License</a>.

making the HREF a CURI (who knows what the browser will do here):

This document is available under a <a xmlns:cc="http://web.resource.org/cc/" xmlns:cclicenses="http://creativecommons.org/licenses/" rel="[cc:license]" href="cclicenses:by-nc-nd/2.5/">Creative Commons License</a>.

all of which are serializations of the following RDF:

<> <http://web.resource.org/cc/license> <http://creativecommons.org/licenses/by-nc-nd/2.5/> .

Metadata About Other Documents

In a number of cases, the document wishes to make metadata statements about other documents, for example, inline images:

A bunch of photos: <ul> <li > <img src="photo1.jpg" /> taken by photographer <span about="photo1.jpg" xmlns:dc="http://purl.org/dc/elements/1.1/" property="[dc:creator]">Mark Birbeck</span></li> <li > <img src="photo2.jpg" /> taken by photographer <span about="photo2.jpg" xmlns:dc="http://purl.org/dc/elements/1.1/" property="[dc:creator]">Steven Pemberton</span></li> </ul>

which is a serialization of:

<photo1.jpg> dc:creator "Mark Birbeck" . <photo2.jpg> dc:creator "Steven Pemberton" .

Note that the about attribute is inherited from parent elements:

<li about="photo1.jpg"> <img src="photo1.jpg" />, taken by photographer <span xmlns:dc="http://purl.org/dc/elements/1.1/" property="[dc:creator]">Mark Birbeck</span>, licensed under a <a rel="http://web.resource.org/cc/license" href="http://creativecommons.org/licenses/by-nc-nd/2.5/"> Creative Commons License</a>.</li>

yields the following triples:

<photo1.jpg> dc:creator "Mark Birbeck" ; cc:license <http://creativecommons.org/licenses/by-nc-nd/2.5/> .

Metadata About Chunks of the Current Document

In certain cases, one wants to include multiple RDF elements in a given document, each with their own type and metadata. It's also important to be able to relate them. The prime example of this is FOAF.

For this purpose, we use link and meta which are special: they apply to their immediate parent element.

<section id="person"> <link rel="[rdf:type]" href="[foaf:Person]" /> <h1 property="[foaf:name]">Dan Brickley</h1> <link rel="[foaf:homepage]" href="" /> </section>

which yields:

<#person> rdf:type foaf:Person ; foaf:name "Dan Brickley" ; foaf:homepage <> .

Alternatively, if one wishes to express this same metadata about #person without actually having that chunk of HTML represent the person in question, then one can write:

<section about="#person"> <link rel="[rdf:type]" href="[foaf:Person]" /> <meta property="[foaf:name]" content="Dan Brickley" /> <link rel="[foaf:homepage]" href="" /> </section>

This yields the exact same triples. Note how the meta and link apply to the parent node's about if that about exists.

Bnodes

The progression to bnodes is thus natural. If one wants the same metadata as above, but expressed about a bnode, the HTML changes slightly: simply take away the id on the parent node:

<section> <link rel="[rdf:type]" href="[foaf:Person]" /> <h1 property="[foaf:name]">Dan Brickley</h1> <link rel="[foaf:homepage]" href="" /> </section>

Alternatively, make the about an explicit bnode:

<section about="[_:person]"> <link rel="[rdf:type]" href="[foaf:Person]" /> <h1 property="[foaf:name]">Dan Brickley</h1> <link rel="[foaf:homepage]" href="" /> </section>

Both of these yield:

_:person rdf:type foaf:Person ; foaf:name "Dan Brickley" ; foaf:homepage <> .

Reification

When a meta or link is used within another meta or link, the internal triple has, as subject, the external triple. This is reification.

<link about="" rel="[cc:license]" href="http://creativecommons.org/licenses/by-nc-nd/2.5/"> <meta property="dc:date" content="2005-10-18" /> </link>

which yields:

[ rdf:subject <>; rdf:predicate cc:license ; rdf:object <http://creativecommons.org/licenses/by-nc-nd/2.5/> ] dc:date "2005-10-18" .

$Revision: 1.8 $ of $Date: 2005/10/19 13:12:14 $