Conditional check in aggregated query

Hi, I have following query for aggregated results.

select ?par4 (AVG(?par1) as ?avgPar1) (AVG(?par2) as ?avgPar2) (AVG(?par3) as ?avgpar3) where{ ?response survey:par1 ?par1 .
?response survey:par2 ?par2 .
?response survey:par3 ?par3 .
?response survey:par4 ?par4.

where I am getting avg of par1, par2 and par3 for mutiple ?response but par4 is boolean and I want to return true for that if even one of the response contains true else if all value is false then return false. Please let me know how can I do it.

Thanks in advance,
Yashpal Singh

Try the MAX() aggregate function.

could you please let me know how to use this Max aggregate function for this query?

stardog query execute test 'select (max(?x) as ?y) { VALUES (?x) { (true) (false) } }'
|   y   |
| true  |

sorry, it is resolved now thanks a million for your help and saving my core time.:slight_smile:

Without the VALUES clause indeed. This was just an example with dummy
data produces by the VALUES clause to show you that MAX returns true if

Thanks Lorenz for your valuable comment, will keep that in mind in future use.

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