Re: Collection / Grammar Issue

* Andy Seaborne <andy.seaborne@epimorphics.com> [2013-05-19 11:48+0100]
> 
> 
> On 17/05/13 15:51, Richard Cyganiak wrote:
> >On 17 May 2013, at 15:32, Eric Prud'hommeaux <eric@w3.org> wrote:
> >>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
> >
> >To me that would be a sensible change, but not sure if worth another LC.
> >
> >Richard
> >
> >
> >
> >
> >>by changing that to:
> >>  [6] triples ::= subject predicateObjectList
> >>                | blankNodePropertyList predicateObjectList?
> >>                | nonEmptyCollection predicateObjectList?
> >>
> >>, adding the referenced production:
> >>[15b] nonEmptyCollection ::= '(' object+ ')'
> 
> It is incompatible with traditional Turtle.  new data/old software
> => bang.  (Not that this is likely to be a commonly used feature.)
> 
> But doesn't the grammar become ambiguous?

Quite right. I didn't do my homework before writing that guess at what
would have to change. (I usually model such changes but got lazy this
time.) And you would notice, having so effectively wrestled with the
SPARQL grammar.


> You can't tell
> 
> [6] triples ::= subject | ... | nonEmptyCollection ...
> 
> apart for an arbitrary number of tokensas they both start with a
> list of any length.
> 
> Rule: nonEmptyCollection in [6]
> 
> ( "a" "b" "c" ) .
> 
> Rule: subject -> collection
> 
> ( "a" "b" "c" ) :p  (1 2 3 4) .
> 
> Depending on your point of view, the problem is that the lists are
> encoded in triples except in the case of the empty list which is an
> IRI.
> (and no triples - does that make it the empty graph?!)
> 
> All this is to avoid
> 
> ( ) .
> 
> being legal syntax, but meaninglessly no triples.
> 
> That's why its complicated in SPARQL.  To move the arbitrary length
> disambiguation of two collection kinds (possibly empty and required
> not empty), the empty list, which is rdf:nil so a resource and not a
> triple, is a token NIL ::= "(" WS* ")
> 
> Then all function rules need to treat NIL specially.  That makes the
> grammar longer; it does not affect users.  There are probably other,
> better, ways to do this by decomposing the collection rules into
> common start situations, then distinguish immediate ")" from a
> non-empty list. It would localise the complexity, not remove it.
> 
> For Turtle, it at least needs careful consideration of the consequences.
> 
>  Andy
> 
> >>
> >>, 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

-- 
-ericP

Received on Sunday, 19 May 2013 20:34:37 UTC