Re: blank nodes (once again)

On 3/17/2011 6:34 AM, Hugh Glaser wrote:
> If I take a graph of any kind and use a particular serialisation method, and communicate that somewhere else, and then de-serialise, do I end up with the same graph?
> For most serialisations, the answer will be "no".
(Daring with trepidation to enter these waters... :-) )

I would think the opposite would be true.  I understand that RDF is 
first and foremost a graph model, independent of serialization.  Given 
that, I would expect that for most serializations, the pre-serialized 
and post-serialized versions of the graph (i.e., in memory) would be the 
same.  The *serializations* would not be the same, but shouldn't the 
*logical graph model* be the same?  Isn't that the point of the RDF spec 
separating serialization from logical model?

E.g. with Jena, given this file (test.ttl)

    @prefix : <http://example.com/demo#> .
    :joe :has [ a :dog ] .

I serialize it as RDF-XML:

    C> java jena.rdfcat test.ttl
    <rdf:RDF
         xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
         xmlns="http://example.com/demo#">
    <rdf:Description rdf:about="http://example.com/demo#joe">
    <has>
    <dog/>
    </has>
    </rdf:Description>
    </rdf:RDF>

Or I serialize it as N-Triples:

    C> java jena.rdfcat -out ntriple test.ttl
    <http://example.com/demo#joe> <http://example.com/demo#has>
    _:A113e01ecX3aX12ec4399200X3aXX2dX8000 .
    _:A113e01ecX3aX12ec4399200X3aXX2dX8000
    <http://www.w3.org/1999/02/22-rdf-syntax-ns#type>
    <http://example.com/demo#dog> .


Or I serialize it as N-Triples and then de-serialize that back into 
memory in order to de-serialize it as RDF-XML:

    C> java jena.rdfcat -out ntriple test.ttl | java jena.rdfcat -out
    xml -n -
    <rdf:RDF
         xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
         xmlns:j.0="http://example.com/demo#" >
    <rdf:Description rdf:about="http://example.com/demo#joe">
    <j.0:has rdf:nodeID="A0"/>
    </rdf:Description>
    <rdf:Description rdf:nodeID="A0">
    <rdf:type rdf:resource="http://example.com/demo#dog"/>
    </rdf:Description>
    </rdf:RDF>


I do all that and then pipe it back to N-Triples again:

    C> java jena.rdfcat -out ntriple test.ttl | java jena.rdfcat -out
    xml -n - | java jena.rdfcat -out ntriple -x -
    <http://example.com/demo#joe> <http://example.com/demo#has>
    _:AX2dX59ad73bbX3aX12ec43a94a9X3aXX2dX8000 .
    _:AX2dX59ad73bbX3aX12ec43a94a9X3aXX2dX8000
    <http://www.w3.org/1999/02/22-rdf-syntax-ns#type>
    <http://example.com/demo#dog> .

Yes the serializations all differ, but the graph represented is the 
same.  Right?

  -Mark

Received on Thursday, 17 March 2011 14:38:32 UTC