Re: Evaluation of aggregates (was: Re: isNumeric)

On 20 Sep 2010, at 12:09, Andy Seaborne wrote:

> >> to make the check happen before the aggregate is called.
> > FILTER(false) }
> > What does that change? if X is a string, then ?X + 0 gives an error, doesn't it?
> > (at least it did when I tried it with XQuery)
> 
> It changes where the error occurs.  For "+0" the error occurs the
> aggregation step and that one error is skipped by EvaListE.
> 
> Otherwise it passes to op:numeric-add where it's a propagating error and
> the whole group is an error.
> 
> I find that inconsistent.

ok, got that... your understanding makes sense to me now, though 
I find the ?X+0 still look a bit "hacky".

> Just define:
> Sum(S) = op:numeric-add(S0, Sum(S1..n)) when |S| > 1 if S0 is a number
> Sum(S) = op:numeric-add(0, Sum(S1..n)) when |S| > 1 if S0 is not a number

is not as straightforward as Flatten op:numeric-add, but could be an option.

Axel

Received on Monday, 20 September 2010 10:30:37 UTC