W3C home > Mailing lists > Public > public-rdf-dawg@w3.org > July to September 2010

Re: Trailing dot in update grammar

From: Andy Seaborne <andy.seaborne@epimorphics.com>
Date: Tue, 03 Aug 2010 14:10:07 +0100
Message-ID: <4C58152F.2060208@epimorphics.com>
To: Steve Harris <steve.harris@garlik.com>
CC: "public-rdf-dawg@w3.org Group" <public-rdf-dawg@w3.org>


On 03/08/2010 12:24 PM, Steve Harris wrote:
> On 2010-08-03, at 11:22, Andy Seaborne wrote:
>>
>>
>> On 03/08/2010 10:54 AM, Steve Harris wrote:
>>> Apologies if this is a known problem.
>>>
>>> According to our implementation of the Update grammar, you can have a trailing dot in INSERT DATA, so:
>>>     INSERT DATA { GRAPH<G>   {<s>   <p>   <o>   . } }
>>> doesn't match the grammar, as far as we can see.
>>
>> Could you explain the route through the grammar that forbids it? It would be helpful to know how you are going through the grammar rules and where you end up that forbids it.
>>
>> A series of test cases to cover what you expect, and don't expect, would be good too :-)
>>
>>> The goes against the spirit of SPARQL 1.0, and some examples given in the Update document, e.g. the example in 4.1.1 (though that example doesn't use the GRAPH keyword, so it's not exactly the same).
>>>
>>> - Steve
>>>
>>
>> [34] Insert ::= 'INSERT' ( 'DATA' QuadData | .... )
>> [46] QuadData ::= '{' Quads '}'
>> [43] Quads ::= TriplesTemplate?
>>               ( QuadsNotTriples '.'? TriplesTemplate? )*
>> [44] QuadsNotTriples ::= 'GRAPH' VarOrIRIref '{' TriplesTemplate '}'
>> [45] TriplesTemplate  ::= TriplesSameSubject ( '.' TriplesTemplate? )?
>>
>> and
>> ( '.' TriplesTemplate? )?
>>
>> can be a single '.'
>
> OK, I think that makes sense. It hurts my head trying to unravel it though, and I guess our guy who turned it into a Lemon grammar made some mistake as well.

I find reading and debugging LALR harder than thinking about it top-down 
(probably as much due to practice).  The grammar is LL(1) so you can 
also read the parser rules top-down, using only the next token to decide 
which rule to take (that's also why it's recursive : if the lookahead 
were 2+ then some or all of the recursions can be replaced by looping 
constructs - note to implementations wanting to parse long INSERT DATA 
with parser generators that use function calls e.g. JavaCC).

> I'll contribute the syntax tests from our Update tests when I finish them.

Thank you.  The more tests the better.

>
> Thanks Andy.
>
> - Steve

	Andy
Received on Tuesday, 3 August 2010 13:10:47 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 16:15:43 GMT