N-Quads syntax (was: Re: Making progress on graphs)

On 18 May 2012, at 18:35, Andy Seaborne wrote:
> [I have always found having the graph id last odd but I understand shy it's that way and the original naming was "s p o c" but readability of NQ is not a primary concern.]

Historical explanation: Andreas Harth and Aidan Hogan had a thing called Nx, which extended N-Triples to an arbitrary number of elements, so you could serialize quintuples or septuples or whatever. I joined them to write up a proper spec for that.

As the use case of exchanging SPARQL datasets became more and more important, and we found that we mostly used Nx to exchange quads, we wrote up a spec for N-Quads.

 as a restriction of the “x” in Nx to 3 or 4. Since the “g” element would be optional, the order “s p o g” had the obvious advantage that s, p and o would be always in the same place regardless of default graph or named graph. This is how the graph ended up in the fourth field. This happily coincided with earlier uses of the term “N-Quads”: http://lists.w3.org/Archives/Public/www-rdf-logic/2001Aug/0007.html

“g s p o” could be more convenient for quick-and-dirty parsing because it puts the most variable part (o, with literals) in the end. 

We thought that making it a syntactic extension of N-Triples — so if you only have a default graph, you'd get a valid N-Triples file — was a good idea. These days I concur with SteveH that it is not. One proposal to make N-Triples and N-Quads trivially distinguishable is to use something like “-” as a “graph name” for the default graph. If we did this, then it strengthens the case for moving the g element to the front, which in turn strengthens the case for making it a subset of TriG — “g { s p o }.”. So I'm not entirely opposed to the idea of revisiting the basic syntax. On the other hand it's clear that this shouldn't be called N-Quads any more.

I guess the main case for leaving N-Quads as is: It's already used by quite a few places like DBpedia, and implemented in many tools like Sesame, Apache Any23, Virtuoso, 4store. Getting them all to do some tweaks in order to comply with a minimally changed W3C spec seems easier than getting them all to implement something completely new that competes with the existing N-Quads support.


Received on Friday, 18 May 2012 18:19:43 UTC