W3C home > Mailing lists > Public > public-rdf-wg@w3.org > February 2011

Re: [Turtle] Grammar ambiguity?

From: Yves Raimond <Yves.Raimond@bbc.co.uk>
Date: Mon, 28 Feb 2011 12:00:29 +0000
To: Andy Seaborne <andy.seaborne@epimorphics.com>
Cc: nathan@webr3.org, public-rdf-wg@w3.org
Message-ID: <20110228120029.GG12598@dvbstreamer.national.core.bbc.co.uk>
Hello!

Just copying an email from Jan Wielemaker (main developer of SWI-Prolog - he also wrote its Turtle parser), who suggests "18." should be made invalid.

> >> > The below valid N3 file cannot be parsed:
> >> > @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>.
> >> > @prefix : <http://localhost#>.
> >> > :Person
> >> > rdf:type        :Person;
> >> > :age            18.
> >
> > Which is (AFAIK) correct.  Rapper (from the Redland RDF toolkit)
> > agrees.  The problem is ambiguity introduced by the .  That is
> > why many people always put a space before the terminating ..
> >
>
> You're right - although the grammar [1] doesn't seem to forbid it?

This is not so clear.  It says that a decimal is (among others)

       [0-9]+ '.' [0-9]*

so, "18." is decimal.  Then, it says:

White space (production ws) is used to separate two tokens which would
otherwise be (mis-)recognized as one token.

I think that combining these justifies that you MUST write 18 .

Note that the . is similar as in Prolog, but Prolog does not accept
18. as a float.  This MUST be written as 18.0.

> Implementations seem to disagree on how to interpret it as well, e.g.
> http://www.rdfabout.com/demo/validator/ seems to think it is OK.

I think you should resubmit your bug report there :-)

> We're currently working on making the Turtle spec a recommendation in
> the new RDF XG at the W3C, so perhaps something to look into?

The role of the ., is as far as I'm concerned, the main issue about
Turtle.  I would love to be able to use . in local names, just like
SPARQL.  I guess the other topic is the relation to named graphs.

       Cheers --- Jan
Received on Monday, 28 February 2011 13:08:48 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 16:25:39 GMT