# Re: Evaluation of aggregates

From: Andy Seaborne <andy.seaborne@epimorphics.com>
Date: Mon, 20 Sep 2010 14:47:47 +0100
Message-ID: <4C976603.6080800@epimorphics.com>
To: Axel Polleres <axel.polleres@deri.org>
CC: SPARQL Working Group <public-rdf-dawg@w3.org>
```

On 20/09/10 14:30, Axel Polleres wrote:
>>>>>   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.
>>> >  >
>> >
>> >  I don't understand that. The flatten operation is independent of the
>> >  specific aggregation - it doesn't remove non-numbers:
> yes, that's what meant to say, the current definition just via flatten and
> then "delegating" directly to op:numeric-add doesn't cover that aspect yet.
> what you write here should work, but it is an extension of the current
> Definition of Sum
>
> Anyways, don't we need to extend Definition of Sum also to cover errors,
> or do you intend this covered by "if S0 is not a number" ?

That was the simplest change I could think of - get sum() to skip things
it can't add.  More precisely, not one of, nor a subtype of or derived
type of, xsd:double, xsd:float or xsd:decimal.  Or

Sum(S) = op:numeric-add(S0, Sum(S1..n)) when |S| > 1 if defined
else Sum(S1..n)

Andy
```
Received on Monday, 20 September 2010 13:48:29 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 7 January 2015 15:01:01 UTC