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:

IF{ 
	{
	SELECT (SUM(?Y) AS ?O) WHERE {?X ?Z ?Y } GROUP BY ?X 
	}
	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,
Arsham

I don't believe that that is supported. From the documentation at
Home | Stardog Documentation Latest 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 https://en.wikipedia.org/wiki/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
features".

Thanks for your information