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

Re: [Turtle] Grammar ambiguity?

From: Nathan <nathan@webr3.org>
Date: Mon, 28 Feb 2011 10:12:13 +0000
Message-ID: <4D6B74FD.5040609@webr3.org>
To: Yves Raimond <Yves.Raimond@bbc.co.uk>
CC: public-rdf-wg@w3.org
Hi Yves,

Integer in your example, given that the EBNF should match the statement 
first thus removing the .

  statement ::=  directive '.' | triples '.' | ws+

and in this example:

   @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>.
   @prefix : <http://localhost#>.

   :Person
       :age 18.;
       rdf:type :Person.

it'd match decimal

decimal ::= ('-' | '+')? ( [0-9]+ '.' [0-9]* | '.' ([0-9])+ | ([0-9])+ )

afaict,

cheers nathan

Yves Raimond wrote:
> Hello!
> 
> I just noticed a potentially ambiguous point in the Tutle grammar at [1].
> 
> Considering the following document:
> 
> @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>.
> @prefix : <http://localhost#>.
> 
> :Person
>        rdf:type :Person;
>        :age 18.
> 
> seems to be allowed by the grammar (resource resource integer.) But there's a potential ambiguity there (is the value of 'age' supposed to be parsed as a float or as an integer?)
> 
> Some Turtle parsers seems to reject this document (e.g. SWI-Prolog), rapper makes a best guess (parsing 18 as an xsd:decimal), but throws a syntax error, and the SemWeb.NET library [2] parses it as an xsd:integer without any errors or warnings.
> 
> Best,
> y
> 
> [1] http://www.w3.org/TeamSubmission/turtle/#sec-grammar
> [2] http://www.rdfabout.com/demo/validator/
> 
> 
> 
Received on Monday, 28 February 2011 10:13:58 GMT

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