Re: ungrouped variables used in projections - Further implications?

On 26/08/10 10:18, Steve Harris wrote:
> On 2010-08-25, at 18:15, Axel Polleres wrote:
>>> Personally, I'd be happy with forbidding the use variables of grouping
>>> expressions:
>>>
>>>   SELECT (1/(1-?o) AS ?o1) { ?s ?p ?o } GROUP BY (1/(1-?o)) # Forbiddable
>>>   SELECT ?o WHERE { ?s ?p ?o } GROUP BY (1/(1-?o)) # Forbiddable
>>
>> Without expressing any strong opinion here: This rules out the new test case agg08, or, resp.,
>> turns it into a negativeSyntaxTest. I had assumed for the current version of agg08 that the
>> former would be allowed whereas the latter wouldn't. That's why I had "*or expressions*" in
>> my rewording proposal.
>>
>> I assume what Andy means here (and which I think holds) is that we could forbid expressions
>> in Grouping alltogether, since they can be always emulated by subqueries, i.e.
>>
>>    SELECT (1/(1-?o) AS ?o1) { ?s ?p ?o } GROUP BY (1/(1-?o))
>>
>> could be written without expression in the GROUP BY clause as:
>>
>>    SELECT ?o1 { SELECT (1/(1-?o) AS ?o1) { ?s ?p ?o } } GROUP BY ?o1 }
>>?x is a shor form of ?x AS ?x?x is a shor form of ?x AS ?x


>> So, why not just doing just that and forbidding expressions in GROUP BY in the grammar already?
>
> We already made a decision to do that I believe.

As I recall (and I can't find the record,maybe more an informal 
discussion with consensus), we agreed not to have AS in GROUP BY to name 
expressions used as grouping. There's no technical reason not to allow this:

   GROUP BY (?o1+?o2 AS ?o3) , ?x

and gives a name to the expression value for the group.  We could be 
consist with SELECT expressions and go so far as to require the AS is an 
expression is used.

It would change the
   Group(ExprList, Ω)
to be
   Group(VarList, Ω)

We could be consistent with SELECT expressions and go so far as to 
require the AS is an expression is used.

>> 4) BTW, what about
>>      SELECT * { ?s ?p ?o } GROUP BY ?s
>> Just to make sure everybody is on the same page here: is this also forbidden?
>
> I seem to remember discussing that previously, but not the outcome. It looks confusing to me, certainly.

Using SELECT * is quite convenient and it's the same calculation to 
check it as calculate the variables for the *.

Same for:

SELECT * { ?x ?y ?o . {SELECT ?o { ?s ?p ?o } LIMIT 1} }

>
> - Steve
>
 Andy

Received on Thursday, 26 August 2010 13:59:55 UTC