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

GROUP question

From: Andy Seaborne <andy.seaborne@epimorphics.com>
Date: Thu, 14 Oct 2010 11:06:59 +0100
Message-ID: <4CB6D643.2010000@epimorphics.com>
To: SPARQL Working Group <public-rdf-dawg@w3.org>
Just checking - this going to be legal, isn't it?  It's an idiom that 
seems natural and people do use it:

   ... ?x ...
} GROUP BY ?groupKey

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.

Received on Thursday, 14 October 2010 10:07:37 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 7 January 2015 15:01:02 UTC