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

Re: Syntax for custom aggregates

From: Steve Harris <steve.harris@garlik.com>
Date: Mon, 31 Aug 2009 22:33:44 +0100
Message-Id: <7E7AAF0A-21D4-4A98-A6F9-ECB5ECCFEAF8@garlik.com>
To: "public-rdf-dawg@w3.org Group" <public-rdf-dawg@w3.org>
On 31 Aug 2009, at 18:58, Seaborne, Andy wrote:

> In the grammar [1], I didnít put in syntax for custom aggregates.   
> I'm assuming that the ability to be able to specify a URI for an  
> aggregate function is a useful extension point.
> An aggregate in SPARQL is a function that takes a set of query  
> solutions and produces one or more values query solutions which  
> include the group by variables and any aggregate variable/values.   
> It's "or more" for the case of MIN() returning an answer for the MIN  
> number, the MIN string, MIN dateTime - it would be one row for each  
> possibility for each group.

The "or more" thing concerns me. I remember the group discussing this,  
but I don't believe that we came to a consensus.

What would be the expected behaviour given
   SELECT min(?x) min(?y) min(?z) { ... }
where x, y, and z each take some subset of numbers, dates etc? Also  
unknown datatypes pose a problem.

> Two options occur to me for the syntax for aggregates:
> 1/ They look just like function calls:
> SELECT my:aggregate(arg1, arg2, ...) { ... } GROUP BY ?x
> The catch is that the prohibition about aggregates not in the  
> pattern filters can't determined merely by parsing.  The parser  
> needs to know if a call is a function or an aggregate at parse time.

That seems like a reasonable price.

- Steve

Steve Harris
Garlik Limited, 2 Sheen Road, Richmond, TW9 1AE, UK
+44(0)20 8973 2465  http://www.garlik.com/
Registered in England and Wales 535 7233 VAT # 849 0517 11
Registered office: Thames House, Portsmouth Road, Esher, Surrey, KT10  
Received on Monday, 31 August 2009 21:34:21 UTC

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