Re: SPARQL Update grammar tweak: INSERT ... DATA

Eric,

Thanks for the comments,

On 26/11/11 15:06, Eric Prud'hommeaux wrote:
>    [39]  InsertData  ::=  'INSERT DATA' QuadData
>    [40]  DeleteData  ::=  'DELETE DATA' QuadData
>    [41]  DeleteWhere  ::=  'DELETE WHERE' QuadPattern
> could be liberalized it a bit to:
>    [39]  InsertData  ::=  INSERT_DATA QuadData
>    [40]  DeleteData  ::=  DELETE_DATA QuadData
>    [41]  DeleteWhere  ::=  DELETE_WHERE QuadPattern
>    ...
>    [130] INSERT_DATA  ::= "INSERT" WS+ "DATA"
>    [131] DELETE_DATA  ::= "DELETE" WS+ "DATA"
>    [132] DELETE_WHERE ::= "DELETE" WS+ "WHERE"

This is covered by note 7 in the grammar notes:

[[
7. The tokens INSERT DATA, DELETE DATA, DELETE WHERE allow any amount of
whitespace between the words.  The single space version is used in the 
grammar for clarity.
]]

(aside that includes no whitespace INSERTDATA)

It's a balance in presentation.

>
> Also, we can formalize comments with:
>    [130]<COMMENT>  ::= "#" [^\r\n]*
>    ...
>    [157]<WS>  	::= " " | "\t" | "\r" | "\n" | COMMENT [\r\n]
>    ...
>    PASSED TOKENS   ::= ([ \t\r\n])+ | "#" ([^\r\n])*
>
> You can play at http://www.w3.org/2005/01/yacker/uploads/SPARQL_11?text=INSERT%0D%0A++DATA+{+%3Cs%3E+%3Cp%3E+%3Co%3E+}&action=validate+text

PASSED TOKENS is a reflection of the tool chain you're using and is not 
really BNF (you have <> round tokens and not round PASSED TOKENS yet its 
a tokenizing issue).

Different parser generators have different ways of expressing comments 
and whitespace; some would put explicit mention in the grammar, some 
have ways to express the common idiom of arbitrary whitespace between 
tokens and treating comment forms as whitespace so that the parser 
writer does not have to enumerate every possibility.

By defining them as tokens, I think it creates the expectation that the 
token will be used in the grammar.  Defining it and not using can be 
seen a but confusing.

In SPARQL, the comments do not form part of the parse tree (unlike, say 
XML).

Since SPARQL 1.0 took this approach, I'm not inclined to change in 
change it at this stage.  It just a different way to express the same 
thing and 1.0 approach is in the 1.1 grammar.

	Andy

Received on Saturday, 26 November 2011 17:26:17 UTC