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

Re: rq25 aggregate functions

From: Andy Seaborne <andy.seaborne@talis.com>
Date: Tue, 22 Dec 2009 08:52:24 +0000
Message-ID: <4B3088C8.2060707@talis.com>
To: Steve Harris <steve.harris@garlik.com>
CC: "public-rdf-dawg@w3.org Group" <public-rdf-dawg@w3.org>


On 21/12/2009 23:48, Steve Harris wrote:
> On 21 Dec 2009, at 18:10, Andy Seaborne wrote:
>> On 20/12/2009 19:59, Steve Harris wrote:
>>> Hi all,
>>>
>>> I've just added the text on aggregate functions to
>>> http://www.w3.org/2009/sparql/docs/query-1.1/rq25.xml#aggregateFunctions
>>>
>>> The main new content is a new definition of Aggregation, to match the
>>> groups intentions for the use of aggregate functions, and definitions
>>> for COUNT, SUM, MIN, MAX, AVG, GROUP_CONCAT, and SAMPLE.
>>>
>>> The notation around “exp · μ'” in Aggregation is questionable, so if
>>> anyone has a better suggestion I'm all ears.
>>>
>>> I'm hoping to put the definitions for sub-select in rq25 on Monday.
>>>
>>> - Steve
>>>
>>
>> [[
>> Definition: GroupConcat
>>
>> The multiset of values passed as an argument is converted to a
>> sequence S.
>>
>> GroupConcat(S) = fn:string-join(S, " ")
>>
>> @@ do we want space as the seperator? It's annoying in names for
>> example. Other reasonable choices include ",", "\n", or "\t".
>> ]]
>>
>> All reasonable, none always right. I suggest that GroupConcat take an
>> optional separator defaulting to a single space.
>>
>> If the elements are "a" "b" "c"
>>
>> CONCAT(?x) -> "a b c"
>> CONCAT(?x, "/") -> "a/b/c"
>>
>> If the elements are integers 1 2 3
>>
>> CONCAT(str(?x)+1) -> "2 3 4"
>> CONCAT(str(?x)+1, "+") -> "2+3+4"
>
> I did consider that, but it conflicts with the semantics of aggregates
> (both in SQL, and what's currently in the SPARQL draft).
>
> One option would be a keyword, like GROUP_CONCAT(str(?x) SEPARATOR "+"),
> this is what MySQL does, but it means some special case syntax.

I don't see it does necessarily.  The "str(?x)+1" is an expression, 
which is passed, as an expression, to the aggregation operation.  The 
aggregator applies it to each partition so it's not being evaluated 
where used, which I agree would be confusing.

We already have count(*).

	Andy

>
> - Steve
>
> ______________________________________________________________________
> This email has been scanned by the MessageLabs Email Security System.
> For more information please visit
> http://www.messagelabs.com/email______________________________________________________________________
>
Received on Tuesday, 22 December 2009 08:52:42 GMT

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