RDF is part of the W3C’s Semantic Web project, an effort to add meaning to the content of web-pages. It’is a metadata specification so before we go further you might like to read Cory Doctorow’s Metacrap: Putting the torch to seven straw-men of the meta-utopia.
RDF is very often implemented in XML (see below). Don’t imagine for a moment, though, that RDF is XML – XML is only one common way of representing RDF: XML can express a serialisation of RDF. Got that? RDF is not XML but RDF can be written as XML. Mark Pilgrim implausibly claims his partner had an XML serialisation of her shoe collection and pointed out that her shoes were not based on XML.
Anywhere you read about RDF you’ll hear that it’s based on triples of the form : subject-predicate-object. When you look at some XML/RDF, though, it sometimes isn’t clear where the triples are supposed to be. More often it looks like gibberish. To take a real example, the weblogging tool WordPress automatically inserts RDF for trackback into your weblog scribblings. For example, the RDF for this item reads:
<!--
<rdf:RDF xmlns:rdf=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\"
xmlns:dc=\"http://purl.org/dc/elements/1.1/\"
xmlns:trackback=\"http://madskills.com/public/
xml/rss/module/trackback/\">
<rdf:Description rdf:about=\"http://www.cloudsoup.com
/weblog/archives/2004/05
/24/rdf-for-beginners\"
dc:identifier=\"http://www.cloudsoup.com
/weblog/archives/2004/05
/24/rdf-for-beginners\"
dc:title=\"RDF for beginners\"
trackback:ping=\"http://www.cloudsoup.com
/weblog/archives/2004/05/24
/rdf-for-beginners/trackback/\" />
</rdf:RDF>
-->
Hunt the triple : subject-predicate-object
The bit we’re interested in is this:
<rdf:Description
rdf:about=\"http://www.cloudsoup.com
/weblog/archives/2004/05
/24/rdf-for-beginners\"
dc:identifier=\"http://www.cloudsoup.com
/weblog/archives/2004/05
/24/rdf-for-beginners\"
dc:title=\"RDF for beginners\"
trackback:ping=\"http://www.cloudsoup.com
/weblog/archives/2004/05/24
/rdf-for-beginners/trackback/\" />
This snippet of XML/RDF contains three triples:
| Subject | Predicate | Object |
|---|---|---|
| http://www.cloudsoup.com/ weblog/ archives/ 2004/ 05/ 24/ rdf-for-beginners | identifier | http://www.cloudsoup.com/ weblog/ archives/ 2004/ 05/ 24/ rdf-for-beginners |
| http://www.cloudsoup.com/ weblog/ archives/ 2004/ 05/ 24/ rdf-for-beginners | title | RDF for beginners |
| http://www.cloudsoup.com/ weblog/ archives/ 2004/ 05/ 24/ rdf-for-beginners | trackback/ping | http://www.cloudsoup.com/ weblog/ archives/ 2004/ 05/ 24/ rdf-for-beginners/ trackback/ |
They’re all talking about this document, it’s the meaning of the rdf:about tag- hence the repeated URL in the subject column. The first says the document has an identifer, the second that it has a title and the third, that it has a trackback URL.
If you’re ever at a loss to understand this stuff, or can’t spot the triples, or need to validate your own RDF, try the W3C’s RDF validator.