Re: Bare collections in Turtle and TriG

Peter has written a comprehensive pros/cons discussion of whether \' 
should be an escape sequence in NQ or NT.  It is in the published CR 
versions - I'm not sure why (I suspect an editing mistake but maybe I 
just don't remember a decision).

http://lists.w3.org/Archives/Public/public-rdf-comments/2013Nov/0053.html

ECHAR   ::=     '\' [tbnrf"\]
vs
ECHAR   ::=     '\' [tbnrf'"\]

I am neutral - it's a tradeof of reusing as  much of Turtle tokens as 
possible vs not having two ways to write the same thing + more like 
traditional NT and NQ.

Jena RIOT follow the usual mantra of beign generous in what to accept 
and strict on what to generate.  The syntax parsers accept \'.  The 
syntax writers are strict and do not output \'.

 Andy

On 18/11/13 15:01, Andy Seaborne wrote:
> On 18/11/13 10:22, RDF Working Group Issue Tracker wrote:
>> RDF-ISSUE-173 (TriG Collections): Bare collections in Turtle and TriG
>>
>> http://www.w3.org/2011/rdf-wg/track/issues/173
>>
>> http://lists.w3.org/Archives/Public/public-rdf-comments/2013Nov/0041.html
>>
>>
>>
>
> This is a bug in the TriG grammar.  The fix to align with Turtle is:
>
> [4g]     triples2     ::=
>      (blankNodePropertyList | collection) predicateObjectList? '.'
>
> ==>
>
> [4g]     triples2     ::=
>      blankNodePropertyList predicateObjectList? '.'
>      |
>      collection predicateObjectList '.'
>
> that is, makes predicateObjectList mandatory after a collection.
>
> The biggest problem in the area is that () is a legal 'collection' in
> Turtle/TriG.
>
> We want to allow:
>
> (1 2 3) :p "XYZ" .
> () :p "XYZ" .
>
> but not
>
> () .
>
> It is open as to whether
>
> (1 2 3) .
>
> is allowable (it is not in Turtle, it is in SPARQL - we knew this).
>
> NB  - if you are looking at the SPARQL grammar, the 'collection' rule is
> one or more items, and in Turtle it's zero or more.  SPARQL handles ()
> as a token NIL.
>
> I am inclined to follow Turtle here.
>
> It is too late to add free standing collections -- (1 2 3) . -- to
> Turtle.  It's not a trivial change.
>
> SPARQL, being about patterns, is not quite in the same situation.
>
> The SPARQL collection rule requires at least one element and the case of
> () is handled specially via the token NIL.  This means that the use of
> triplesNode works and still excludes () . as a document.  Directly using
> triplesNode in Turtle/TriG would allow () . The NIL / empty collection
> has repercussions throughout SPARQL 1.1 grammar -- the urtle grammar
> would have to grow to do the same.
>
>      Andy
>
> Proposed response:
>
> -------------------------------------------
>
> Richard,
>
> Thank you for your comment regarding collections in Turtle and TriG. The
> Working Group agrees that it is desirable that Turtle and TriG be
> aligned here and the Working Group wishes to avoid:
>
> () .
>
> being a legal document.
>
> There is a bug in the TriG grammar and the following change has been
> made to rule 4g of TriG:
>
>
> [4g]     triples2     ::=
>       (blankNodePropertyList | collection) predicateObjectList? '.'
>
> ==>
>
> [4g]     triples2     ::=
>       blankNodePropertyList predicateObjectList? '.'
>          |
>          collection predicateObjectList '.'
>
>
> A collection must be followed by a predicate-object-list as in Turtle.
>
> This removes ( 1 2 3 ) . as a legal TriG document.  It also removes () .
>   as a legal document.  The 'collection' in TriG and Turtle rule allows
> the empty collection () which is no triples.
>
> To go further and to keep alignment, requires significant changes to
> Turtle which the working group does not have the time to execute on even
> if there were general agreement it is desirable change to the language.
>
> If this addresses your comment, please reply with the subject prefixed
> by "[RESOLVED]".
>
>      Andy
>      on behalf of the RDF Working Group
>      (also involved in the development of the SPARQL Grammar)

Received on Tuesday, 19 November 2013 14:15:36 UTC