May 23 2003
RDF Nodes and Arcs Serialization
Since we’re talking about RDF serialization, what’s the most basic XML serialization possible? One answer might be a serialization of the graph itself:
<graph>
<!-- Here's my data -->
<node id="n1" label="http://www.w3.org/TR/rdf-syntax-grammar" />
<node id="n2" label="RDF/XML Syntax Specification (Revised)" />
<node id="n3" />
<node id="n4" label="Dave Beckett"/>
<node id="n5" label="http://purl.org/net/dajobe/"/>
<arc from="#n1" to="#n2" label="http://purl.org/dc/elements/1.1/title" />
<arc from="#n1" to="#n3" label="http://www.example.com/terms/editor" />
<arc from="#n3" to="#n4" label="http://www.example.com/terms/fullName" />
<arc from="#n3" to="#n5" label="http://www.example.com/terms/homePage" />
</graph>
It looks pretty simple and I can see how it would be easy to draw the graph on a piece of paper just by following the instructions. However, it misses out a lot of the implied graph that the standard XML serialization supplies such as which nodes are literals or resources. Here’s the same graph again with the RDF stuff explictly shown:
<graph>
<!-- Here's my data -->
<node id="n1" label="http://www.w3.org/TR/rdf-syntax-grammar" />
<node id="n2" label="RDF/XML Syntax Specification (Revised)" />
<node id="n3" />
<node id="n4" label="Dave Beckett"/>
<node id="n5" label="http://purl.org/net/dajobe/"/>
<arc from="#n1" to="#n2" label="http://purl.org/dc/elements/1.1/title" />
<arc from="#n1" to="#n3" label="http://www.example.com/terms/editor" />
<arc from="#n3" to="#n4" label="http://www.example.com/terms/fullName" />
<arc from="#n3" to="#n5" label="http://www.example.com/terms/homePage" />
<!-- Here's some of the RDF stuff that is inherent in the normal RDF serialization-->
<node id="rdfsResource" label="http://www.w3.org/2000/01/rdf-schema#Resource"/>
<node id="rdfsLiteral" label="http://www.w3.org/2000/01/rdf-schema#Literal"/>
<node id="rdfProperty" label="http://www.w3.org/1999/02/22-rdf-syntax-ns#Property"/>
<node id="rdfType" label="http://www.w3.org/1999/02/22-rdf-syntax-ns#type" />
<arc from="#n1" to="#rdfsResource" label="http://www.w3.org/1999/02/22-rdf-syntax-ns#type"/>
<arc from="#n2" to="#rdfsLiteral" label="http://www.w3.org/1999/02/22-rdf-syntax-ns#type"/>
<arc from="#n3" to="#rdfsResource" label="http://www.w3.org/1999/02/22-rdf-syntax-ns#type"/>
<arc from="#n4" to="#rdfsLiteral" label="http://www.w3.org/1999/02/22-rdf-syntax-ns#type"/>
<arc from="#n5" to="#rdfsResource" label="http://www.w3.org/1999/02/22-rdf-syntax-ns#type"/>
<arc from="#rdfType" to="#rdfProperty" label="http://www.w3.org/1999/02/22-rdf-syntax-ns#type"/>
<node id="n6" label="http://purl.org/dc/elements/1.1/title" />
<node id="n7" label="http://www.example.com/terms/editor" />
<node id="n8" label="http://www.example.com/terms/fullName" />
<node id="n9" label="http://www.example.com/terms/homePage" />
<arc from="#n6" to="#rdfProperty" label="http://www.w3.org/1999/02/22-rdf-syntax-ns#type"/>
<arc from="#n7" to="#rdfProperty" label="http://www.w3.org/1999/02/22-rdf-syntax-ns#type"/>
<arc from="#n8" to="#rdfProperty" label="http://www.w3.org/1999/02/22-rdf-syntax-ns#type"/>
<arc from="#n9" to="#rdfProperty" label="http://www.w3.org/1999/02/22-rdf-syntax-ns#type"/>
</graph>
Still easy to draw, but probably a lot harder to conceptualise. Well I can’t anyway - maybe says something about me. Merging two graph documents is a matter of rewriting all the id, from and to attributes so that they don’t clash. Does it pass the view source test? I don’t think so, but what do you think?
