Re: Fixing error in Turtle and Trig grammars

* Dave Beckett <dave@dajobe.org> [2014-02-12 13:35-0800]
> Could you provide the results of parsing these in N-Triples (2004 REC
> or 2012 PR) which does not have """-encoding so should be unambiguous.
> 
> I offer this fake output based on what my Raptor library made:
>  (fake because <s> and <p> are not absolute IRIs in this pseudo ntriples):
> 
> <s> <p> " ''' " .
> <s> <p> " \"\"\" " .
> <s> <p> " \"\"a " .
> <s> <p> "\"\"\"" .
> <s> <p> "\"\"a" .

That matches letter-for-letter what I got. I'm pretty confident that
the results of parsing will match as there are other tests for all of
the individual featues exhibited in the syntax tests I sent:

<s> <p> ''' ''\' ''' . # long string with single quotes, embedded ''s and \'
  LITERAL_LONG1.ttl:
  <http://a.example/s> <http://a.example/p> '''x''' .
  LITERAL_LONG1_with_2_squotes.ttl:
  <http://a.example/s> <http://a.example/p> '''x''y''' .
  literal_with_REVERSE_SOLIDUS.ttl:
  <http://a.example/s> <http://a.example/p> '\\' .

<s> <p> """ ""\" """ . # long string with double quotes, embedded ""s and \"
  LITERAL_LONG2.ttl:
  <http://a.example/s> <http://a.example/p> """x""" .
  LITERAL_LONG2_with_2_squotes.ttl:1:<http://a.example/s> <http://a.example/p> """x""y""" .
  turtle-subm-21.ttl:
  :a :b """John said: "Hello World!\"""" .
  
<s> <p> """ ""\u0061 """ . # long string with \uHHHH
  turtle-subm-16.ttl:
  :a :b """\nthis \ris a \U00012451long\t
  literal\uABCD
  """ .

These two are the same as tests 2 and 3 but without the spaces:
  
<s> <p> """""\"""" .
  
<s> <p> """""\u0061""" .

The only new feature these should be testing is the sequence of two
quote characters and a backslash within a long string.


> Dave
> 
> 
> [1] http://www.w3.org/TR/2004/REC-rdf-testcases-20040210/#ntriples
> 
> On Wed, 12 Feb 2014, Eric Prud'hommeaux 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.
> >
> >

-- 
-ericP

office: +1.617.599.3509
mobile: +33.6.80.80.35.59

(eric@w3.org)
Feel free to forward this message to any list for any purpose other than
email address distribution.

There are subtle nuances encoded in font variation and clever layout
which can only be seen by printing this message on high-clay paper.

Received on Wednesday, 12 February 2014 22:27:36 UTC