RDFa can be so simple

Despite claims to the contrary.
You can write simple, parsable RDFa with very little syntax and trouble. Really.

I got so tired of hearing people complain about how confusing RDFa is that while I was on hold during a recent phone call I threw together a demo of just how simple it can be. The document has the two basic kinds of triples: one with a literal for an object, with data typing thrown in for good measure, and one with a resource URI as its object. A View Source of that document will show this in its head element (namespaces are declared earlier):

    <meta about="http://www.snee.com/bob/foaf.rdf#bob"
          property="foaf:givenName"
          content="Bob"
          datatype="xsd:string"/>

    <meta about="http://www.snee.com/bob/foaf.rdf#bob"
          rel="foaf:homePage"
          href="http://www.snee.com/bob"/>

This link will show you the triples as extracted by the W3C's RDFa Distiller and Parser service.

My little demo doesn't take into account all the swirling attempts to innovate, accommodate, and disassociate various ideas about embedding machine-readable markup that are currently out there (if you want to stay on top of this, read Jeni Tennison's blog), but it highlights a principle that is probably older than FORTRAN: parsing data in a particular syntax can be a big job, because the parser must understand the full language, but writing data in a particular language can be simple because you can pick the subset that you prefer to work with.

RDFa gives you many more options for embedding triples—especially if you want to embed metadata about content this is already part of an HTML page, which seems to be a key original use case, or about the page itself—but you can write simple, parsable RDFa with very little syntax and trouble. Really.


(Note on comments: after turning off comments on this blog for a few days because of comment spam, turning them back seems to have no effect. If you send me an email about what I've written at snee.com (bob), I'll add it and any response here.)