Return
true
iff the expression is an aggregate.
Aggregates may be built out of constants, references to
IVariables which are already defined and which are themselves aggregates, and
IAggregate functions. An
IVariable will be an aggregate
if it appears as a bare variable in a GROUP_BY clause or if it declared
by a prior value expression in a GROUP_BY or SELECT clause. Testing
whether or not an
IValueExpression is an aggregate therefore
depends on access to the set of known aggregates. The value expressions
in the GROUP_BY clause must be processed first (in order) followed by the
value expressions in the SELECT clause (in order).
An aggregate may use a non-aggregate variable only allowed within an
IAggregate function. For example, given:
SUM(?x) as ?y
, ?x
must be a non-aggregate
variable and ?y
will be an aggregate variable.
Aggregate variables may be used both inside and outside of an
IAggregate function as long as the variable was declared before
it was used. For example, the following are legal:
SELECT SUM(?x) as ?y, SUM(?x + ?y) as ?z, SUM(?x)+AVG(?x) as ?z2
SELECT SUM(?x) as ?y, SUM(?x + COUNT(?y)) as ?z
Patterns where an aggregate depends on a prior aggregate prevent certain
optimizations, notably you have to evaluate each aggregate in turn rather
than evaluating them in parallel over the solutions is a group. If any
such patterns are observed in the SELECT clause then this method will set
isSelectDependency := true
as a side-effect.