I am getting Exception in thread "main" com.hp.hpl.jena.query.QueryParseException: Lexical error at line 1, column 176. Encountered: " " (32), after: "BIND"
error while running below query using Jena,
String queryString = "PREFIX ns: <http://example.org/ns#>" +
"SELECT ?title ?price" +
" {" +
" ?x ns:price ?p ." +
" ?x ns:discount ?discount ." +
" ?x <http://purl.org/dc/elements/1.1/title> ?title . " +
" BIND ('12'^^xsd:integer AS ?price)" +
" FILTER( ?price < 20 )" +
" }";
Below is my stack trace,
Exception in thread "main" com.hp.hpl.jena.query.QueryParseException: Lexical error at line 1, column 176. Encountered: " " (32), after : "BIND"
at com.hp.hpl.jena.sparql.lang.ParserSPARQL10.perform(ParserSPARQL10.java:95)
at com.hp.hpl.jena.sparql.lang.ParserSPARQL10.parse(ParserSPARQL10.java:39)
at com.hp.hpl.jena.query.QueryFactory.parse(QueryFactory.java:129)
at com.hp.hpl.jena.query.QueryFactory.create(QueryFactory.java:72)
at com.hp.hpl.jena.query.QueryFactory.create(QueryFactory.java:43)
at com.hp.hpl.jena.query.QueryFactory.create(QueryFactory.java:31)
at com.hp.hpl.jena.query.QueryExecutionFactory.sparqlService(QueryExecutionFactory.java:342)
at com.ifour.testdata.AW317.QuerySampleDataSPARQL.main(QuerySampleDataSPARQL.java:28)
can anybody please help me on an issue I have googled but didn't find the solution.The same query runs on virtuoso SPARQL endpoint giving me perfect result.but while using java Jena SPARQL query I am getting this error.
As suggested in comments by @AKSW, the answer is to
Update to current Jena (and possibly current Virtuoso server [whether Enterprise or Open Source], Virtuoso Provider for Jena, and/or Virtuoso JDBC driver)