RDFa
As reported over on semiBlog, I spent this week at ISWC2006 in Athens, GA and presented my blogging tool there during the poster session. I got to present it to a lot of people, among them Dean Allemang of TopQuadrant. He seemed to like it, but immediately gave me a lecture on how I should link the blog posts to the RDF metadata - use RDFa, use RDFa, use RDFa! In fact, he insisted that my life would turn into paradise straight away if I would start using RDFa in semiBlog, and that I would go to hell otherwise. That convinced me! :-)
Anyway, having the metadata embedded in the actual HTML code instead of linking to some file (as I do at the moment) would relieve me of some annoying problems I have with uploading rdf/xml file.
So, here are a few quick notes on how RDFa works. Generally speaking, RDFa encodes RDF triples as attributes to arbitrary XML elements (and is thus strictly speaking a method of embedding RDF in XHTML, not just any HTML).
Encoding Triples with Literal Objects:- The SUBJECT is referenced either by the
id
or theabout
attribute of an XML element.xml:base
is respected. - The PREDICATE is referenced using the
property
attribute of an XML element. - The OBJECT is referenced using either the
content
attribute or the actual content. Thecontent
attribute takes precedence. - Objects can be typed as a specific datataype using the
type
attribute.
<span about="http://semiblog.semanticweb.org/rdfaexamples/posterSession" role="cal:Vevent" xmlns:cal="http://www.w3.org/2002/12/cal/ical#"> <span property="cal:summary">Posters Reception</span> <span property="cal:dtstart" content="2006-11-08T00:00:00+0000" type="xsd:date"/> <span property="cal:dtend" content="2006-11-08T02:00:00+0000" type="xsd:date"/> </span>Encoding Triples with Resource Objects:
- The SUBJECT is referenced either by the
id
or theabout
attribute of an XML element.xml:base
is respected. - The PREDICATE is referenced using the
rel
attribute of an XML element. Usingrev
instead ofrel
inverts the relationship, and turns the subject into the object and vice versa (think of passivization in natural language). - The OBJECT is referenced using either the
href
attribute.
All this is explained in much more detail in the
- RDFa Syntax Specification, and the
- RDFa Primer.
(A sidenote: One aspect that I don't like about the RDFa solution in comparison to linking from the HTML to a SPARQL query is this: when I embed the RDF, it remains static. When I link to a query, I always get the latest, most up-to-date result. However, that's not really an issue at the moment, since I don't actually link to a SPARQL endpoint!)