From: Christian F. <c.f...@un...> - 2011-11-12 09:42:40
|
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.f...@un... www: http://www.unibw.de/ebusiness/ skype: c.fuerber twitter: cfuerber |