Re: Syntax for custom aggregates

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  
9AD

Received on Monday, 31 August 2009 21:34:21 UTC