Andy Seaborne commented on JENA-1507:

The SPARQL spec is wrong as well:

In the definition of "Group", 

If the pattern does not match, Ω is empty and so "Group(exprlist, Ω)" is the 
empty set ∅ because it says at the end "| μ in Ω }"; Ω is empty so there is 
for-each evaluation.

Once "Group(exprlist, Ω)" is the empty set, it is identical to "GROUP BY" and 
no match, ending up in no rows.

But, for example, COUNT(*) is supposed to be 0 in the single row. There is 
always a single row when there is no GROUP  BY, even if it is a row of no 
columns (no aggregate functions). (It is not possible to write  that in SPARQL 
- an aggregate is needed to trigger being all-one-group).


> GROUP BY and aggregates when there are no matching of the WHERE pattern.
> ------------------------------------------------------------------------
>                 Key: JENA-1507
>                 URL: https://issues.apache.org/jira/browse/JENA-1507
>             Project: Apache Jena
>          Issue Type: Bug
>          Components: ARQ
>    Affects Versions: Jena 3.6.0
>            Reporter: Andy Seaborne
>            Assignee: Andy Seaborne
>            Priority: Major
> There are two bugs in ARQs handling of grouping when there are no results in 
> the WHERE clause.
> When there is a GROUP BY, the outcome should be no rows. 
>  * JENA-1487
>  * [users list 
> discussion|https://lists.apache.org/thread.html/72c2045e639c589880619443beafec5be963733e0f9f0887e134d467@%3Cusers.jena.apache.org%3E]
> When there is no GROUP BY, no aggregates, and no pattern match, the result 
> should be one row of no columns; when there is no GROUP BY, the result is 
> always one row.  It returns zero rows (v3.6.0 and before).

This message was sent by Atlassian JIRA

Reply via email to