RPV Syntax is Ugly

Tim Bray is moaning about the RDF/XML syntax again. I wrote about this last time and even pointed Tim at my experiment. No response so far.

He disingenuously presents two examples of the same set of triples, the first in his cryptic RPV format, the second in RDF/XML. Except that he's changed the rules. In his RPV example he's not using namespace prefixes for his elements. Let's see what RDF/XML looks like if we do the same for the RDF namespace:

<RDF xmlns="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
         xmlns:dc="http://purl.org/dc/elements/1.1/"
         xmlns:ex="http://www.example.com/terms/">

  <Description about="http://www.w3.org/TR/rdf-syntax-grammar"
                   dc:title="RDF/XML Syntax Specification (Revised)">
    <ex:editor>
      <Description ex:fullName="Dave Beckett">
        <ex:homePage resource="http://purl.org/net/dajobe/" />
      </Description>
    </ex:editor>
  </Description>

</RDF>

That looks a little easier to read doesn't it?

I don't like the mixture of attributes and elements, so I'll rewrite it using just elements for the data:

<RDF xmlns="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
         xmlns:dc="http://purl.org/dc/elements/1.1/"
         xmlns:ex="http://www.example.com/terms/">
  <Description about="http://www.w3.org/TR/rdf-syntax-grammar">
    <dc:title>RDF/XML Syntax Specification (Revised)</dc:title>
    <ex:editor>
      <Description>
        <ex:fullName>Dave Beckett</ex:fullName>
        <ex:homePage resource="http://purl.org/net/dajobe/" />
      </Description>
    </ex:editor>
  </Description>
</RDF>

Now, looking at Tim's example again, you can see he's moved the collection of triples about Dave Beckett to a seperate structure. We can do the same:

<RDF xmlns="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
         xmlns:dc="http://purl.org/dc/elements/1.1/"
         xmlns:ex="http://www.example.com/terms/">

  <Description about="#Dave">
    <ex:fullName>Dave Beckett</ex:fullName>
    <ex:homePage resource="http://purl.org/net/dajobe/" />
  </Description>

  <Description about="http://www.w3.org/TR/rdf-syntax-grammar">
    <dc:title>RDF/XML Syntax Specification (Revised)</dc:title>
    <ex:editor resource="#Dave" />
  </Description>
</RDF>

Now compare this to Tim's RPV version and tell me which one is easier to read:

<RPV xmlns="http://www.rdf.net/rpv/">
  <R id="Dave" pbase="http://www.example.com/terms/">
    <PV p="fullName">Dave Beckett</PV>
    <PV p="homePage" v="http://purl.org/net/dajobe" />
  </R>
  <R r="http://www.w3.org/TR/rdf-syntax-grammar">
    <PV p="http://www.example.com/terms/editor" v="#Dave" />
    <PV p="http://purl.org/dc/elements/1.1/title">
    RDF/XML Syntax Specification (Revised)
    </PV>
  </R>
</RPV>

PS It's been suggested to me that Tim's complaint is not that RDF/XML is hard to read but that it's hard to parse with tools like XSLT. I don't buy this. What makes RDF/XML hard to parse with structural based tools like XSLT is the model, not the syntax. Since RPV shares the same model it's no easier to parse.

Permalink: http://blog.iandavis.com/2003/05/rpv-syntax-is-ugly/

Other posts tagged as rdf

Earlier Posts