RDF Best Practices

From GetSemantic

Jump to: navigation, search

There are many, many people who don't do RDF right. It's not very hard, but still people screw up. Below are a list of the things you must keep in mind.

[edit] RDF Use Best Practices

  • RDF is not XML. A lot of people will look at the RDF/XML syntax and think "Ah, XML! I know this!" Think again. The RDF/XML syntax should not lead you into thinking that you can parse XML by hand. This is a dangerous presumption. If you do not know about RDF/XML, download a library for your particular language and use it. Avoid XPath, XSLT, XQuery, DOM trees, SAX parsers, 'SimpleXML', 'REXML' or whatever your language's XML parsing library is. They are fine for XML, but you should treat RDF/XML as this thing that is different from XML. Horrible stuff can happen if you do treat it as XML.

[edit] Authoring Best Practices

[edit] Best Practices for those Writing a Parser

  • Follow the specifications. They exist for a reason.
  • RDF is not XML (continued). If you are writing a parser, be sure to read all of the current RDF specifications thoroughly. Know the limitations of your library.
  • Look at other parsers.
  • Don't use the native objects in your language to represent RDF. Be sure to use Literal, Resource, BNode, Statement and Graph models. A Graph is not just a list, a Literal is not just a string.
Personal tools