W3C home > Mailing lists > Public > public-rdf-comments@w3.org > May 2013

Re: Collection / Grammar Issue

From: Eric Prud'hommeaux <eric@w3.org>
Date: Fri, 17 May 2013 10:32:46 -0400
To: Richard Cyganiak <richard@cyganiak.de>
Cc: Andy Seaborne <andy.seaborne@epimorphics.com>, "public-rdf-comments@w3.org" <public-rdf-comments@w3.org>
Message-ID: <20130517143245.GG13487@w3.org>
* Richard Cyganiak <richard@cyganiak.de> [2013-05-16 13:55+0100]
> On 16 May 2013, at 13:41, Andy Seaborne <andy.seaborne@epimorphics.com> wrote:
> > On 16/05/13 10:24, Richard Cyganiak wrote:
> > 
> >> For the record, I believe this limitation in the grammar is there
> >> because the Turtle grammar was derived from the SPARQL grammar, and
> >> SPARQL doesn't support such “naked lists” in triple patterns, because in
> >> a query they really wouldn't make sense.
> > 
> > (Another unofficial reply)
> > 
> > SPARQL does allow just lists:
> > 
> > ASK { ( 1 ?var 3 4 ) }
> > 
> > but does not allow:
> > 
> > ASK { ( ) }
> 
> Ok, thanks Andy, I misremembered.

It's a little odd that we allow
  [ :p :o ] . --> _:b1 :p :o .
and not
  ( 1 ) . --> _:b1 rdf:first 1 ; rdf:rest rdf:nil .
The former is enabled by blankNodePropertyList in:
  [6] triples ::= subject predicateObjectList
                | blankNodePropertyList predicateObjectList?

We could enable the latter by changing that to:
  [6] triples ::= subject predicateObjectList
                | blankNodePropertyList predicateObjectList?
                | nonEmptyCollection predicateObjectList?

, adding the referenced production:
[15b] nonEmptyCollection ::= '(' object+ ')'

, adding a Term Constructur below Collection
  <http://www.w3.org/TR/turtle/#handle-collection>
  ┌──────────────┬──────────────┬────────────────────────────────────────────┐
  │ production   │ type         │ procedure                                  │
  │ "collection" │ "blank node" │ "A blank node is generated. Note the       │
  │              │              │ rules for collection in the next section." │
  └──────────────┴──────────────┴────────────────────────────────────────────┘

, changing Triple Constructors to include nonEmptyCollection
  <http://www.w3.org/TR/turtle/#collection>

adding some tests, and going through another LC.


> Richard
> 
> 
> 
> > 
> > To make this work (SPARQL 1.0), there is a certain amount of jumping through hoops.  It makes the treatment of argument lists in function have to have special grammar rules for ().
> > 
> >    Andy
> > 
> > Unofficial:
> > http://www.sparql.org/query-validator.html
> > 
> > (does W3C want to take this and support it c.f. http://www.w3.org/RDF/Validator/)
> > 
> >> I don't see this limitation in Turtle as a big problem, because there
> >> are workarounds such as spelling out the list in rdf:first and rdf:rest
> >> triples. So just changing the example is fine with me. Adding a note
> >> about it might be appropriate.
> >> 
> >> Richard
> >> 
> >> 
> >> 
> >>> How would you use that?
> >>> 
> >>>        -- Sandro
> >>> 
> >>>> The production for triples in section 6.5 is:
> >>>> 
> >>>> [6]triples::=subject predicateObjectList | blankNodePropertyList
> >>>> predicateObjectList?
> >>>> [7]predicateObjectList::=verb objectList (';' (verb objectList)?)*
> >>>> [10]subject::=iri | BlankNode | collection
> >>>> 
> >>>> According to these productions, the example is invalid.  The subject
> >>>> reduces to the collection and must be followed by a verb.  Yet, the
> >>>> example does not have a following predicate object list.
> >>>> 
> >>>> If this is truly suppose to be valid, I think the productions need to be:
> >>>> 
> >>>>   triples::=subject predicateObjectList |
> >>>>                        collection predicateObjectList? |
> >>>>                        blankNodePropertyList predicateObjectList?
> >>>>   subject ::= iri | BlankNode
> >>>> 
> >>>> BTW, it would be a wonderful editorial change to number the examples.
> >>>> 
> >>>> [1] http://www.w3.org/TR/2013/CR-turtle-20130219/
> >>>> 
> >>>> --
> >>>> --Alex Milowski
> >>>> "The excellence of grammar as a guide is proportional to the paucity
> >>>> of the
> >>>> inflexions, i.e. to the degree of analysis effected by the language
> >>>> considered."
> >>>> 
> >>>> Bertrand Russell in a footnote of Principles of Mathematics
> >>> 
> > 
> 

-- 
-ericP
Received on Friday, 17 May 2013 14:33:21 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 6 January 2015 20:29:56 UTC