- From: Lee Feigenbaum <lee@thefigtrees.net>
- Date: Thu, 14 Oct 2010 08:21:49 -0400
- To: Andy Seaborne <andy.seaborne@epimorphics.com>
- CC: SPARQL Working Group <public-rdf-dawg@w3.org>
On 10/14/2010 6:06 AM, Andy Seaborne wrote: > Just checking - this going to be legal, isn't it? It's an idiom that > seems natural and people do use it: > > SELECT (SAMPLE(?x) AS ?x) > { > ... ?x ... > } GROUP BY ?groupKey Glitter errors on this just as it errors on SELECT (?x + ?y AS ?x) { ... ?x ... } I do understand the difference and why it's a nice idiom, but I find it more consistent to have both cases be an error. (No strong feeling.) Lee > > > In other words, can I use ?x as a new variable because the inner one is > hidden by the group. It seems a natural thing to write in the SAMPLE case. > > From wiki/Potentially_bound it seems the answer is yes. ?x is not > potentially bound when used at the point "AS ?x" > > The ?x in SAMPLE(?x) is a different ?x because aggregates happen before > select expressions in modifier order. > > The ordering is: > # Grouping > # Aggregates > # Select expressions > # Having > ... > > and so > > # Aggregates > ... at this point only GROUP BY vars + aggregates are visible. [1] > # Select expressions > > [1] minor: and so the aggregates are assigned to temporary vars to be > renamed in the select expressions? Can't see how else it would work. > > Andy > >
Received on Thursday, 14 October 2010 12:22:26 UTC