Thank you, Ivan fo the answer!
Unfortunately I still can not run this query

select ?s SUM(?books) as ?total
FROM <http://mygraph.person>
WHERE {?s  <http://mygraph/person/books> ?books . }
having (sum(?books) > 2)
I get the following error

SQLState: 37000

Message: SQ074: Line 5: SP030: SPARQL compiler, line 5: syntax error at 
'having' before '('
sparql
select ?s SUM(?books) FROM <http://mygraph.person>
WHERE {?s  <http://mygraph/person/books> ?books . }
having (sum(?books) > 2)

Do you know what the reason is? I suppose I do not use correct syntax for HAVING or ... ?

/Silvia
There's no ?total in the scope of HAVING, but there are bindings
of ?books and the ability of using aggregates.

Best Regards,

Ivan Mikhailov
OpenLink Software
http://virtuoso.openlinksw.com

On Fri, 2010-07-02 at 11:13 +0200, Silvia Stefanova wrote:
Hello,

I would like to make a SPARQL query with aggregation with a condition on the result of the aggregate, e.g.:

select ?s SUM(?books) as ?total
FROM <http://mygraph.person>
WHERE {?s  <http://mygraph/person/books> ?books.}
having (?total > 2) .

Would you please tell me how to make this in Virtuoso?

Regards,
Silvia

------------------------------------------------------------------------------
This SF.net email is sponsored by Sprint
What will you do first with EVO, the first 4G phone?
Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
_______________________________________________
Virtuoso-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/virtuoso-users



------------------------------------------------------------------------------
This SF.net email is sponsored by Sprint
What will you do first with EVO, the first 4G phone?
Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
_______________________________________________
Virtuoso-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/virtuoso-users


Reply via email to