On 04/11/17 13:46, james anderson wrote:
good afternoon;
On 2017-11-04, at 12:18, Andy Seaborne <[email protected]> wrote:
Following on from the thread in October "Problem with MAX when no result expected"
<https://s.apache.org/03Hz> here is an investigation into SPARQL Aggregation, both what
the spec says and what ARQ does.
It would be interesting to get reports about other implementations for these
two queries:
Q1: SELECT (COUNT(*) AS ?C1) { ?s ?p ?o FILTER(false) }
Q2: SELECT (COUNT(*) AS ?C2) { ?s ?p ?o FILTER(false) } GROUP BY ?s
For clarity:
http://dydra.com/jhacker/foaf/@query#q1 : 0
Is that zero rows or one row with single columns with C1 being value 0?
http://dydra.com/jhacker/foaf/@query#q2 : no result
Is that zero rows or execution error/illegal query?
Throughout this, it does not matter if there is a GROUP BY clause or not because
"Group" is the empty set ∅ in both cases.
there is a reading of the recommendation text according to which the two sets
which are empty are not of the same kind.
in one case, the set is that over which the aggregation operations run and in
that case, the result is 0.
in the other case it is the set of groups, in which case, there is no set of
solutions over which to run the aggregation and therefore there is no result.
Maybe, maybe not. Please quote the text that gives the alternative
reading. I don't see reading that mentions kinds.
I missed the fact that when there is no GROUP BY the group key is some
constant like 1.
But that does not change anything because Group() is defined in a way
that uses the rows matching WHERE{} in a foreach and foreach of Ω =
empty set is the empty set.
Group(exprlist, Ω) = { ListEval(exprlist, μ) -> ... | μ in Ω }
so if there are no μ, ListEval is not evaluated and Group() is the empty
set. There is only one empty set. It does not carry any indication of
use of GROUP BY or not.
By the end of Group() the situation is the same so the result will be
the same for what ever reading of the rest of the process (there are
some parts I'm not completely confident with yet).
Specifically, for no GROUP BY the result is not a map of the constant to
the empty multiset {1 -> {}}
is there some way to read the text such that the empty set of groups transforms
into an empty set of solutions?
Not that I can see; it should be covered by {1 -> {}} vs {} butthat
distinction is lost at Group().
Andy
---
james anderson | [email protected] | http://dydra.com