W3C home > Mailing lists > Public > w3c-rdfcore-wg@w3.org > July 2001

Re: N-Triples: Naming anonnodes

From: Brian McBride <bwm@hplb.hpl.hp.com>
Date: Sun, 22 Jul 2001 11:44:59 +0100
Message-ID: <3B5AAEAB.FD4BFFD@hplb.hpl.hp.com>
To: Aaron Swartz <me@aaronsw.com>
CC: w3c-rdfcore-wg@w3.org


Aaron Swartz wrote:
[...]
> Today I came up with the idea that we could define anonymous
> nodes as having a special representation in the abstract syntax,
> but define the N-Triples conversion from RDF as having a
> well-defined set of names for them. IOW, an algorithm such as
> the one used by SiRPAC or CARA to generate anonymous nodes in
> order could be specified somehow (using XSLT, for example), and
> all RDF/XML parsers which outputted N-Triples could follow this
> specification. That way, comparison of N-Triples documents could
> be reduced to a simple sort/diff operation, while still
> retaining the semantics of anonymous nodes.
> 
> An example:
> <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
> <rdf:Description>
>    <rdf:value>foo</rdf:value>
> </rdf:Description>
> </rdf:RDF>
> 
> could be unambiguously defined as:
> 
> _:g0 rdf:value "foo" .
> 
> as parsers would use anonymous node names in the form of _:gn
> where n begins at zero and increments for each anonymous node
> reached in the XML.
> 
> Obviously this wouldn't work for N-Triples output from a data in
> which ordering information had been lost (I have some ideas on
> that one too, but they are less formed) but it would work for
> any RDF/XML -> N-Triples conversion.

Nice idea.  Basically this would allow easy compare of models that
came from the same RDF/XML serialization.

One thing it wouldn't handle is the following example:

 <rdf:Description>
  <foo:bar>foobar</foo:bar>
 </rdf:Description>
 <rdf:Description>
  <bar:foo>barfoo</bar:foo>
 </rdf:Description>

compared to:

 <rdf:Description>
  <bar:foo>barfoo</bar:foo>
 </rdf:Description>
 <rdf:Description>
  <foo:bar>foobar</foo:bar>
 </rdf:Description>

These are representations of equivalent graphs which graph compare
will find equivalent.

What about:

  <rdf:Description>
    <foo:type rdf:about="http://foo#Class">
    <foo:bar>
      <rdf:Desription/>
    </foo:bar>
  </rdf:Description>

and

  <foo:Class>
    <foo:bar>
      <rdf:Description/>
    </foo:bar>
  </foo:Class>

If they are to compare equivalent, the element number cannot be used.

This approach would also seem to imply that the ordering of the RDF/XML
is significant.  So if two processors were to have an internal
representation of the same model, would they have to write it out in
the same order to ensure that the RDF/XML produced compared equal.
If so, we are back into the complexities of graph theory.

Brian
Received on Sunday, 22 July 2001 06:47:44 EDT

This archive was generated by hypermail pre-2.1.9 : Wednesday, 3 September 2003 09:38:13 EDT