W3C home > Mailing lists > Public > public-rdf-dawg@w3.org > October to December 2009

Semantics of SUM

From: Andy Seaborne <andy.seaborne@talis.com>
Date: Tue, 10 Nov 2009 18:25:11 +0000
Message-ID: <4AF9B007.5000707@talis.com>
To: Steve Harris <steve.harris@garlik.com>
CC: RDF Data Access Working Group <public-rdf-dawg@w3.org>


On 10/11/2009 17:57, Steve Harris wrote:
>> > Consensus that SUM/AVG should use same semantics as +
>>
>> Clarification: errors not in a group means that what would be
>>
>> 1 + error + 2 => 3
>>
>> which is not the same as +
>
> Yep, which I think is why they are in the group, and why COALESCE is
> important.

I don't see that COALESCE helps because there isn't an intermediate 
variable representing the sum so far.

If it's the same as + and also the error (I presume as an unbound) is in 
the collection of over which to SUM then one error cause the whole thing 
to be an error, which is not where we got to last time.

I suggest that the SUM is over things that "+" works on but if there is 
a non-addable item, it is simply skipped.

SUM(?x | ?x/{1,unbound,3}) is 4.

which makes AVG = SUM/COUNT for COUNT > 0.

How does COALESCE help?

SUM(?x | ?x/{1,"2",3}) is error or 4?  How is the error handled (we 
don't have errors at the moment - if one branch of a UNION has an error 
of this kind, is the whole thing an error?  What happened to streaming!)

SUM(xsd:integer(?x) | ?x/{1,"2",3}) is 6.

	Andy
Received on Tuesday, 10 November 2009 18:25:29 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 16:15:40 GMT