W3C home > Mailing lists > Public > public-rdf-comments@w3.org > February 2014

Re: Fixing error in Turtle and Trig grammars

From: Peter Ansell <ansell.peter@gmail.com>
Date: Thu, 13 Feb 2014 10:16:18 +1100
Message-ID: <CAGYFOCSpnXCzSmAn08L3Q+fsaVAxvtEVp+kpZ-+r_Z-78Dt2=A@mail.gmail.com>
To: "Eric Prud'hommeaux" <eric@w3.org>
Cc: "public-rdf-comments@w3.org" <public-rdf-comments@w3.org>, semantic-web@w3.org
On 13 February 2014 07:42, Eric Prud'hommeaux <eric@w3.org> wrote:
> The RDF Working Group recently discovered an error in the grammars for
> Turtle and TriG. They were intened to align with SPARQL, but a pair of
> parentheses was accidentally dropped from the definition for long
> strings resulting in an over-constraint on what's permitted after
> embedded quotes. An example of the error is shown by the text
>
>    """ ""\" """
>
> which is allowed by the SPARQL grammar, but was accidentally
> disallowed by the grammars for Turtle and TriG in their specifications.
> After considering this matter, the acting W3C Director has asked us to
> make sure implementors agree this is an error and will in the coming
> weeks make sure their implementations parse the intended language,
> aligned with SPARQL.
>
> Please let us know by 18 Feb if you intend to implement the following
> grammar and parse the syntax tests below:
>
> change
> [24] STRING_LITERAL_LONG_SINGLE_QUOTE ::= "'''" (("'" | "''")? [^'\] | ECHAR | UCHAR)* "'''"
> [25] STRING_LITERAL_LONG_QUOTE          ::= '"""' (('"' | '""')? [^"\] | ECHAR | UCHAR)* '"""'
> to
> [24] STRING_LITERAL_LONG_SINGLE_QUOTE ::= "'''" (("'" | "''")? ([^'\] | ECHAR | UCHAR))* "'''"
> [25] STRING_LITERAL_LONG_QUOTE          ::= '"""' (('"' | '""')? ([^"\] | ECHAR | UCHAR))* '"""'
>
> and parse these (one-line) turtle documents (with some arbitrary base URI):
>
> <s> <p> ''' ''\' ''' .
>
> <s> <p> """ ""\" """ .
>
> <s> <p> """ ""\u0061 """ .
>
> <s> <p> """""\"""" .
>
> <s> <p> """""\u0061""" .
>
>
> Many thanks for your help and continued support of RDF 1.1.


Hi Eric,

OpenRDF Sesame-2.7.10 failed to parse the first triple due to a bug in
our implementation, related to allowing escaping of single quote
characters, which will be fixed in the next release (2.7.11). After
fixing the bug we get the following expected triples after serialising
to N-Triples (base URI is <http://example.org/>):

<http://example.org/s> <http://example.org/p> " ''' " .
<http://example.org/s> <http://example.org/p> " \"\"\" " .
<http://example.org/s> <http://example.org/p> " \"\"a " .
<http://example.org/s> <http://example.org/p> "\"\"\"" .
<http://example.org/s> <http://example.org/p> "\"\"a" .

For any Sesame users interested in tracking the fix progress, it is
being tracked at: https://openrdf.atlassian.net/browse/SES-2019

Thanks,

Peter
Received on Wednesday, 12 February 2014 23:16:45 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 12 February 2014 23:16:46 UTC