Re: First attempt at a grammar for SPARQL/query 1.1

On 31 Aug 2009, at 23:24, Seaborne, Andy wrote:
>> -----Original Message-----
>> From: public-rdf-dawg-request@w3.org [mailto:public-rdf-dawg-request@w3.org 
>> ]
>> On Behalf Of Steve Harris
>> Sent: 31 August 2009 22:44
>> To: public-rdf-dawg@w3.org Group
>> Subject: Re: First attempt at a grammar for SPARQL/query 1.1
>>
>> On 28 Aug 2009, at 18:22, Seaborne, Andy wrote:
>>>
>>> In the design pages we have some different proposals for the syntax
>>> of select expressions:  without mandating comma (which would break
>>> backward compatibility), one case to remember is ?x-?y: Is that (? 
>>> x-?
>>> y) or "?x" followed by "-?y"?  This is why expressions get bracketed
>>> a lot in SPARQL.
>>
>> Mandating comma when AS is used wouldn't break back compatibility, as
>> AS was not legal in SPARQL.
>
> Steve,
>
> The three cases I found with syntax rules didn’t mandate commas (or  
> mention them).  I couldn't see what is proposed under SurfaceSyntax  
> exactly but I didn’t see a proposal for mandatory commas in the  
> SELECT clause (meaning SELECT always has commas regardless of any AS  
> or expressions - that breaks compatibility).
>
> The proposal at Feature:SurfaceSyntax#Commas_in_expression_lists  
> does not state mandatory or optional commas.  If the rationale is  
> familiarity, optional commas would be sufficient won't it?  As  
> optional, adding ","? between the terms of the SELECT elements works  
> in the grammar doesn't it?
>
> For Feature:SurfaceSyntax#Commas_in_expression_lists
> Would I now be right in guessing that there would be two syntaxes  
> proposed:
>
> SELECT ?x ?y ?z
>
> SELECT ?x, ?y, (?z+1 AS ?A)
>  Or alternatively
> SELECT ?x, ?y, (?z+1) AS ?A

I was imagining

SELECT ?x ?y ?z
or
SELECT ?x, ?y, ?z+1 AS ?A

Parenthesis are not required if we have commas.

> (aside: which I don't consider to be mandating commas - there's a  
> non-comma form)
>
> It does state that these two are equivalent: "SELECT ?a, ?b, ?c" and  
> "SELECT ?a ?b ?c"
> which I read as meaning that "SELECT ?a ?b ?c" (no commas) is still  
> legal.
>
> What about "SELECT ?x ?y , ?z"?

I would prefer that to not be legal myself, but no strong preference.

> What happens if ?z or (?x+?y) is added to the SELECT with a comma?   
> Does the earlier part now need to have commas added?

That question seems to be about programatic construction.

> (I found the statement "and it also makes the syntax of AS easier to  
> read," too black&white.  I don’t find it easier to read but that is  
> considering only one AS design.)

I guess it's a matter of opinion, but I find both parenthetical forms  
difficult to read - though one is worse than the other. I was never a  
fan of s-expressions either!

- Steve

-- 
Steve Harris
Garlik Limited, 2 Sheen Road, Richmond, TW9 1AE, UK
+44(0)20 8973 2465  http://www.garlik.com/
Registered in England and Wales 535 7233 VAT # 849 0517 11
Registered office: Thames House, Portsmouth Road, Esher, Surrey, KT10  
9AD

Received on Tuesday, 1 September 2009 09:11:47 UTC