Hi Christian,

NOT EXISTS is supported already.

E.g., right now at lod.openlinksw.com/sparql

both
SELECT count(*) WHERE {?s ?p "Novosibirsk"  filter not exists { ?s ?p
"Новосибирск" } }
and
SELECT count(*) WHERE { { ?s ?p "Novosibirsk" } minus { ?s ?p
"Новосибирск" } }

return 313,

both
SELECT count(*) WHERE {?s ?p1 "Novosibirsk"  filter not exists { ?s ?p2
"Новосибирск" } }
and
SELECT count(*) WHERE { { ?s ?p1 "Novosibirsk" } minus { ?s ?p2
"Новосибирск" } }

return 309,

plain
SELECT count(*) WHERE { ?s ?p "Novosibirsk" }

returns 314.

Keeping in mind that "Новосибирск" is Russian and "Novosibirsk" is
English transcription for same city, these numbers differ for a good
reason :)

Best Regards,

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


On Sat, 2011-11-12 at 14:02 +0000, Hugh Williams wrote:
> Hi Christian
> 
> Virtuoso does not support “NOT EXIST” but does have its own built in function:
> 
>       FILTER (!bif:exists ((select (1) ...)))
> 
> See the following example on usage:
> 
>       
> http://docs.openlinksw.com/virtuoso/rdfsparqlrule.html#rdfsparqlruleexamples6
> 
> LET is a Jena specific keyword not support in Virtuoso. The SPARQL 1.1 
> standard provides an equivalent called “BIND” it appears which is not 
> currently supported in Virtuoso but is scheduled for the next release.
> 
> 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 12 Nov 2011, at 09:42, Christian Fuerber wrote:
> 
> > Dear all,
> > 
> > I am having trouble using certain keywords of Jena ARQ to query virtuoso
> > over the Virtuoso Jena Provider.
> > 
> > In particular, my queries require the use of the keywords LET, NOT EXISTS,
> > and IRI.
> > For example I tried to execute the following Code:
> > 
> >             VirtGraph set = new VirtGraph
> > ("jdbc:virtuoso://localhost:1111/charset=UTF-8/log_enable=2", "dba", "dba");
> >             Model model = new VirtModel(set);
> > 
> >             String queryString =
> >                             "SELECT ?s ?o ?now " +
> >                             " FROM <http://localhost/mediawiki> " +
> >                             " WHERE{" +
> >                             " ?s ?p ?o . " +
> >                             "LET(?now := true)" +
> >                             "}";
> >             Query query =
> > QueryFactory.create(queryString,Syntax.syntaxARQ);
> >             QueryExecution vqe =
> > VirtuosoQueryExecutionFactory.create(query, model);
> >             ResultSet results = vqe.execSelect();
> >             System.out.print(ResultSetFormatter.asText(results));
> > 
> > Which returns the following error message:
> > 
> > Exception in thread "main" com.hp.hpl.jena.shared.JenaException: Can not
> > create ResultSet.:virtuoso.jdbc3.VirtuosoException: SQ074: Line 12: SP030:
> > SPARQL compiler, line 10: syntax error at 'LET' before '('
> >     at virtuoso.jena.driver.VirtuosoQueryExecution.execSelect(Unknown
> > Source)
> >     at VirtuosoSPARQLExample1.main(VirtuosoSPARQLExample1.java:73)
> > 
> > When I use QueryExecutionFactory instead of VirtuosoQueryExecutionFactory I
> > get the following error message:
> > 
> > Exception in thread "main" com.hp.hpl.jena.shared.JenaException: Can not
> > create QueryIterator.:virtuoso.jdbc3.VirtuosoException: SQ074: Line 12:
> > SP030: SPARQL compiler, line 10: syntax error at 'LET' before '('
> >     at virtuoso.jena.driver.VirtuosoQueryEngine.eval(Unknown Source)
> >     at
> > com.hp.hpl.jena.sparql.engine.QueryEngineBase.evaluate(QueryEngineBase.java:
> > 124)
> >     at
> > com.hp.hpl.jena.sparql.engine.QueryEngineBase.createPlan(QueryEngineBase.jav
> > a:98)
> >     at
> > com.hp.hpl.jena.sparql.engine.QueryEngineBase.getPlan(QueryEngineBase.java:8
> > 6)
> >     at
> > virtuoso.jena.driver.VirtuosoQueryEngine$VirtQueryEngineFactory.create(Unkno
> > wn Source)
> >     at
> > com.hp.hpl.jena.sparql.engine.QueryExecutionBase.getPlan(QueryExecutionBase.
> > java:266)
> >     at
> > com.hp.hpl.jena.sparql.engine.QueryExecutionBase.startQueryIterator(QueryExe
> > cutionBase.java:243)
> >     at
> > com.hp.hpl.jena.sparql.engine.QueryExecutionBase.execResultSet(QueryExecutio
> > nBase.java:248)
> >     at
> > com.hp.hpl.jena.sparql.engine.QueryExecutionBase.execSelect(QueryExecutionBa
> > se.java:94)
> >     at VirtuosoSPARQLExample1.main(VirtuosoSPARQLExample1.java:73)
> > 
> > Simple queries without the use of Jena ARQ specific keywords work fine!
> > 
> > I am using Virtuoso Open Source 6.1.4 and Jena 2.6.2 with ARQ 2.8.3. The
> > virt_jena.jar is for Jena 2.6.2 [Build 1.5].
> > 
> > Thank you for any help!
> > 
> > Christian
> > 
> > ------------------------------------------
> > Dipl.-Kfm. Christian Fürber
> > Professur für Allgemeine BWL, insbesondere E-Business
> > e-business & web science research group
> > Universität der Bundeswehr München
> >  
> > e-mail: c.fuer...@unibw.de
> > www:   http://www.unibw.de/ebusiness/
> > skype: c.fuerber
> > twitter: cfuerber
> > 
> > 
> > 
> > ------------------------------------------------------------------------------
> > RSA(R) Conference 2012
> > Save $700 by Nov 18
> > Register now
> > http://p.sf.net/sfu/rsa-sfdev2dev1
> > _______________________________________________
> > Virtuoso-users mailing list
> > Virtuoso-users@lists.sourceforge.net
> > https://lists.sourceforge.net/lists/listinfo/virtuoso-users
> 
> ------------------------------------------------------------------------------
> RSA(R) Conference 2012
> Save $700 by Nov 18
> Register now
> http://p.sf.net/sfu/rsa-sfdev2dev1
> _______________________________________________ Virtuoso-users mailing list 
> Virtuoso-users@lists.sourceforge.net 
> https://lists.sourceforge.net/lists/listinfo/virtuoso-users



Reply via email to