Re: Evaluation of aggregates

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