Hi Silvia, What is the version of your Virtuoso server (virtuoso-t -?), such that it can be compared with Rumi's ? I presume you are running the latest 06.01.3127 builds available for download ?
Best Regards Hugh Williams Professional Services OpenLink Software Web: http://www.openlinksw.com Support: http://support.openlinksw.com Forums: http://boards.openlinksw.com/support Twitter: http://twitter.com/OpenLink On 2 Jul 2010, at 13:27, Silvia Stefanova wrote: > Hi Rumi, > > Yes, I have a very similar set of triples. >> >> >> Suppose you have the following: >> >> >> sparql clear graph <http://mygraph.person>; >> >> SPARQL insert in graph <http://mygraph.person> >> { <http://mygraph/person/book1> <http://mygraph/person/books> 1 . >> <http://mygraph/person/book2> <http://mygraph/person/books> 2 . >> <http://mygraph/person/book3> <http://mygraph/person/books> 1 . >> <http://mygraph/person/book3> <http://mygraph/person/books> 3 . >> <http://mygraph/person/book2> <http://mygraph/person/books> 5 }; >> >> >> >> > I am trying to run this query but I still get the error: > > SQLState: 37000 > > Message: SQ074: Line 8: SP030: SPARQL compiler, line 8: syntax error at > 'HAVING' before '(' > >> >> SQL>SPARQL >> SELECT ?s SUM(?books) as ?total >> FROM <http://mygraph.person> >> WHERE >> { >> ?s <http://mygraph/person/books> ?books . >> } >> HAVING (SUM(?books) > 2); >> >> >> >> > Which can be the reason? Without the 'having' clause it works pretty well. > > Regards, > Silvia >> s >> total >> VARCHAR >> VARCHAR >> _______________________________________________________________________________ >> >> http://mygraph/person/book3 >> 4 >> http://mygraph/person/book2 >> 7 >> >> 2 Rows. -- 16 msec. >> >> >> >> Best Regards, >> Rumi >> >> >> >> >> >> >>> 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 >>>> >>>> >>> ------------------------------------------------------------------------------ >>> 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 >> > > > ------------------------------------------------------------------------------ > 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
