You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jena.apache.org by Willem Broekema <me...@gmail.com> on 2020/07/13 12:08:08 UTC

SPARQL semantics: MAX with unbound value

Here's a query where I'd like to check that ARQ 3.15 does the right thing:

select (min(?x) as ?min) (max(?x) as ?max) {
  values ?x { undef 3 }
}

ARQ returns both as unbound.
I expect: ?min = unbound, ?max = 3.
The ordering between the unbound value and 3 is well defined: unbound
values come first (https://www.w3.org/TR/sparql11-query/#modOrderBy)
so there are no type errors.

Thanks and kind regards
Willem

Re: SPARQL semantics: MAX with unbound value

Posted by Andy Seaborne <an...@apache.org>.
Willem,

The results have unbound because there is error in evaluation, not 
because there is an unbound in the input.

It's not "unbound" in the MIN or MAX ordering because the expression 
(?x) is evaluated and eval(?x) is "error" not undef then ListEval 
retains errors then ToList will be undefined because there is an error 
is the argument. It does not get to the ordering step.

https://www.w3.org/TR/sparql11-query/#aggregateAlgebra

The aggregates AVG, SUM, MIN, MAX are supposed to be the same for this.

COUNT() which does not use ToList and so treats errors differently.

     Andy

See also
  https://www.w3.org/TR/sparql11-query/#aggregateExample2
which is agg-err-01 in the SPARQL 1.1 test suite.

On 13/07/2020 13:08, Willem Broekema wrote:
> Here's a query where I'd like to check that ARQ 3.15 does the right thing:
> 
> select (min(?x) as ?min) (max(?x) as ?max) {
>    values ?x { undef 3 }
> }
> 
> ARQ returns both as unbound.
> I expect: ?min = unbound, ?max = 3.
> The ordering between the unbound value and 3 is well defined: unbound
> values come first (https://www.w3.org/TR/sparql11-query/#modOrderBy)
> so there are no type errors.
> 
> Thanks and kind regards
> Willem
>