On 07/12/12 21:13, Rob Vesse wrote:
My understanding has always been that all errors are grouped together into
a single group.

Yes.

Here's a nice simple query that illustrates this:

SELECT ?groupkey
WHERE
{
   VALUES ( ?a ?b)
   {
    ( 1 2 )
    ( UNDEF 2 )
    ( 1 UNDEF )
    ( UNDEF UNDEF )
   }
}
GROUP BY (?a + ?b AS ?groupkey)

Running this will give two results, one with an unbound value for
?groupkey and one with 3 as the ?groupkey

As the editor of the query specification Andy will likely come along and
explain the mathematica better when he sees this thread

I could waffle about "one point extension of the value space of the expression being grouped"

Or just say that all evaluations yielding 'error' get put into the same group.

If the group key is composite, any error makes the whole key an error ... see below ...


Rob



On 12/7/12 12:17 PM, "Graham Matthews" <[email protected]>
wrote:

Hi

This is kind of a JENA question, kind of a generic SPARQL question.

The SPARQL 1.1 definition says:

----
Note that, although the result of a ListEval can be an error, and errors
may be used to group, solutions containing error values are removed at
projection time.

ListEval((unbound), μ) = (error), as the evaluation of an unbound
expression is an error.

----


I have looked at this many times and cannot figure out what it means to
say that "errors may be used to group". To make sense of this requires
that errors be comparable for equality (otherwise you can't group …),
which I don't see any definition of anywhere in the SPARQL semantics.

I don't even understand how it works in a really simple query grouping
solutions from a basic graph pattern, for example:

    select whatever from ..
    where
    {
            ?a ?b ?c
    }
    group by ?a+1, ?b+2

Suppose:
-) ?a+1 produces a dynamic error but ?b+2 does not for one choice of ?a
and ?b

?a+1 is always an error - can't have literals as subjects!

-) ?a+1 does not produce a dynamic error but ?b+2 does for a different
choice of ?a and ?b

The group key is the pair (?a+1, ?b+2) and if either are an error, then the whole key is an error.



Are these two choices place in the same group?

Yes.


And what happens if for two choices of ?a and ?b, ?a+1 and ?b+2 both
produce produce dynamic errors, but different ones (we we have 4
different kinds of errors)? Are they in the same group? And are they in
the same group as the previous example?

My gut says that what was intended here was SQL style null groupings
(which are horrible, but ..). But the mathematics in the definition isn't
clear.

SQL Null is a bit different - it is a real value [*] you can talk about, whereas SPARQL treats the group key as (A,B) and if either A or B are an error, the whole key for the group is the "error" key.


        Andy

[*] aside from the that fact that "null = null" is false

Any SPARQL gurus know what is meant to happen for grouping here?

thanks
graham



Reply via email to