Aggregate Functions in the SPARQLRule Reasoning

Hi All,

Does anyone know how to use an aggregate functions like SELECT (SUM(?Y) AS ?O) WHERE {?X ?Z ?Y } GROUP BY ?X In the SPARQLRule?

I tried it as the following and inserted as SPARQLRule to the database:

	BIND (?O AS ?L )
THEN { ?X :hasNewProperty ?L }

However, when running the following query while the reasoner (SL) is enabled, it does not return any value.

 SELECT ?X WHERE { ?X ?Z ?Y;  :hasNewProperty ?L} 

Many Thanks,

I don’t believe that that is supported. From the documentation at specifically #3

"Rule body (IF) and only rule body may optionally contain UNION, BIND or
FILTER clauses. However, functions EXISTS, NOT EXISTS, or NOW() cannot be
used in rules. User-defined functions (UDF) may be used in rules but if the
UDF is not a pure function
then the results are undefined.

Other SPARQL features are not allowed in rules."

I believe what you’re looking to do would be covered under “Other SPARQL

Thanks for your information

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.