> AVG and SUM should work - the problem is likely the data. Correct.
> Note that AVG and SUM are sensitive to errors: if any one item in the group > is not a number, then AVG/SUM is undefined. This is the spec definition. > > You can use COALESCE, and other ways, to default non-numbers. > > AVG(COALESCE(xsd:double(?x),0)) > > for example. Cast to double (includes strings) and if not use the value 0. "AVG(COALESCE(xsd:double(?x),0))" yields results, finally. However, they are "0.0". So this implies, that something with the data is wrong. And I think I know the reason: For some reason, the values, which I want to calculate the average over, are typed as an URI, even though the value of this URI is a number (e.g. "10"). Obviously, Jena is not capable of calculating the average over URIs. Since I have a whole pre-processing pipeline before I push the triples to Jena, I need to check that in more detail. If I cannot sort it out that way, I'd be happy to ask here again (possibly with a minimal example). If you have some other hint for me in the meantime, please let me know. Thanks for your help already. Best, Peter
