Common mistakes in RDF

Created by Stuart Yeates (University of Oxford) on June 07, 2006

I've been tinkering with RDF for a while now, and it's great to see so many sites generating RDF of one kind or another, whether it's RDF/RSS news feeds, RDF/FOAF personal information, RDF/EXIF photo information or RDF/Dublin-core information on documents. Unfortunately there's a little fly in the ointment: people aren't validating the RDF they're creating to ensure that it is valid RDF.

The two most common mistakes are:

  • unescaped "&" characters, which result in output that isn't even XML, let alone RDF. This mistake seems to be found most frequently in RDF generated from content management systems and blogging platforms. The solution is to escape the & as &.
  • missing namespace declarations, which seems most common in hand-edited and small-scale RDF. The most popular namespace to forget appears to be that for the "rdf" prefix, presumably because some tools have a sensible default for this and somehow this default doesn't make it into the final file.

In the last week I've seen literally hundreds of files with each of these errors. 

The solution to the problem, of course, is validation and here there are two options, local validation, using a tools such as rapper and online validation using a tools such as the W3C validator.