Support for user-defined SPARQL aggregation functions

2 views
Skip to first unread message

Albert Meroño Peñuela

unread,
Dec 12, 2014, 12:23:36 PM12/12/14
to sta...@clarkparsia.com
Hi all,

I'm following the example at [1] to define my own SPARQL function in Stardog. My specific requirement is that I would like that function to be an aggregation function (i.e. to be used over all variable bindings in the projections). The docs say that the class AbstractFunction implements Extensible Value Testing as in [2], but it's not clear to me if that covers custom aggregation functions. My guess is that the answer is no, but when I try this:

>$ ./stardog query myDB "prefix stardog: <tag:stardog:api:> select ((stardog:myAggFunc(?o)) as ?foo) where {?s eg:myProp ?o} group by ?o"

the query is accepted. The function is executed once per binding though, thus not the expected aggregation behaviour, so my question is whether this is intentional or to what extent custom aggregations are supported.

Thanks for you continued support and great job,
Albert

Mike Grove

unread,
Dec 12, 2014, 1:45:08 PM12/12/14
to stardog
On Fri, Dec 12, 2014 at 12:23 PM, Albert Meroño Peñuela <albert....@gmail.com> wrote:
Hi all,

I'm following the example at [1] to define my own SPARQL function in Stardog. My specific requirement is that I would like that function to be an aggregation function (i.e. to be used over all variable bindings in the projections). The docs say that the class AbstractFunction implements Extensible Value Testing as in [2], but it's not clear to me if that covers custom aggregation functions. My guess is that the answer is no, but when I try this:

>$ ./stardog query myDB "prefix stardog: <tag:stardog:api:> select ((stardog:myAggFunc(?o)) as ?foo) where {?s eg:myProp ?o} group by ?o"

the query is accepted. The function is executed once per binding though, thus not the expected aggregation behaviour, so my question is whether this is intentional or to what extent custom aggregations are supported.

Yeah, it's intentional, custom aggregate functions are not currently supported.  Extensible functions are primarily for use in bind/filter expressions.  Extending this to cover custom aggregates is on the roadmap for sometime in the 3.x release cycle.

Cheers,

Mike
 

--
-- --
You received this message because you are subscribed to the C&P "Stardog" group.
To post to this group, send email to sta...@clarkparsia.com
To unsubscribe from this group, send email to
stardog+u...@clarkparsia.com
For more options, visit this group at
http://groups.google.com/a/clarkparsia.com/group/stardog?hl=en
Reply all
Reply to author
Forward
0 new messages