W3C home > Mailing lists > Public > www-rdf-comments@w3.org > October to December 2007

Re: RDF Test Cases Bug: The N-Triples Grammar is Ambiguous

From: Sean B. Palmer <sean@miscoranda.com>
Date: Thu, 1 Nov 2007 10:56:34 +0000
Message-ID: <b6bb4d890711010356y34ce08aehde4841f23b297ec2@mail.gmail.com>
To: www-rdf-comments@w3.org

On 11/1/07, Sean B. Palmer <sean@miscoranda.com> wrote:

> As far as I can tell, the N-Triples specification does provide a
> means of interpretation.

That was a typo: I meant of course that it *doesn't* provide a means
of interpretation. I've checked the specification of the EBNF grammar
that is used:


And it doesn't way whether productions are greedy or not, but clearly
any interpretation would depend on matters such as that, and the fact
that only valid RDF URI references are allowed in the circumstance.

So my test case was as follows:

<p:> <> <q:> <> <r:> <> "s" .

And there are at least four ways of interpreting this:

[<p:> <> <q:> <> <r:>] [<>] ["s"] .
- Greedy, invalid RDF URI references

[<p:> <> <q:> <>] [<r:> <>] ["s"] .
- Greedy and valid RDF URI references

[<p:>] [<> <q:> <> <r:> <>] ["s"] .
- Non-greedy, invalid RDF URI references

[<p:> <>] [<q:> <> <r:> <>] ["s"] .
- Non-greedy, valid RDF URI references

The stakes here are that depending on what the interpretation is, it
mightn't be possible to express various RDF Graphs using N-Triples,
which, as far as I know, is supposed to be able to represent all
possible RDF Graphs.

For example, say we go with the following interpretation:

[<p:> <>] [<q:> <> <r:> <>] ["s"] .

Then how do you express the following?

[<p:> <> <q:> <>] [<r:> <>] ["s"] .

Whatever the resolution, this will undoubtedly make compliant
N-Triples parsing a lot harder than it prima facie appears if parsing
depends on checking whether potential resulting RDF URI references are

Sean B. Palmer, http://inamidst.com/sbp/
Received on Thursday, 1 November 2007 10:56:45 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 22:44:06 UTC