diff --git a/spec/index.html b/spec/index.html index 93922483..be258dcf 100644 --- a/spec/index.html +++ b/spec/index.html @@ -2960,10 +2960,18 @@
In a query level which uses aggregates, only expressions consisting of aggregates and
- constants may be projected, with one exception. When GROUP BY is given with one
- or more simple expressions consisting of just a variable, those variables may be projected
- from the level.
In a query level which uses grouping (either by the explicit use of a GROUP BY clause
+ or through the use of aggregates in projection, HAVING, or ORDER BY clauses),
+ every occurrence of a variable that appears in projection or SELECT expressions of that query level
+ MUST satisfy one of the following conditions:
GROUP BY variable (with the corresponding GROUP BY expression consisting of just the variable V, or having the form (expr AS V))MIN(?v) or AVG(?v+2))
+ If such a variable occurrence does not satisfy one of these conditions, the query is syntactically invalid.
+For example, the following query is legal as ?x is given as a GROUP BY
term.
@@ -2974,12 +2982,11 @@-Aggregate Projection Restrictions
?x :q ?z . } GROUP BY ?x (STR(?z))
Note that it would not be legal to project STR(?z) as this is not a simple
- variable expression. However, with GROUP BY (STR(?z) AS ?strZ) it would be
+
Note that it would not be legal to project STR(?z) as this expression is neither a simple variable,
+ nor a named GROUP BY expression. However, with GROUP BY ?x (STR(?z) AS ?strZ) it would be
possible to project ?strZ.
Other expressions, not using GROUP BY variables, or aggregates may have
- non-deterministic values projected from their groups using the SAMPLE
- aggregate.
Other expressions which use variables not satisfying the above conditions may be
+ projected from their groups using the SAMPLE aggregate.