[英]Why this exception occur com.hp.hpl.jena.reasoner.rulesys.Rule$ParserException: In Using Apache Jena Reasoner?
[英]Exception in thread “main” com.hp.hpl.jena.query.QueryParseException: Lexical error at line 1, column 176. Encountered: “ ” (32), after : “BIND”
我Exception in thread "main" com.hp.hpl.jena.query.QueryParseException: Lexical error at line 1, column 176. Encountered: " " (32), after: "BIND"
獲得Exception in thread "main" com.hp.hpl.jena.query.QueryParseException: Lexical error at line 1, column 176. Encountered: " " (32), after: "BIND"
使用Jena在查詢下運行時Exception in thread "main" com.hp.hpl.jena.query.QueryParseException: Lexical error at line 1, column 176. Encountered: " " (32), after: "BIND"
錯誤Exception in thread "main" com.hp.hpl.jena.query.QueryParseException: Lexical error at line 1, column 176. Encountered: " " (32), after: "BIND"
,
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 )" +
" }";
以下是我的堆棧跟蹤,
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)
任何人都可以在我用谷歌搜索但沒有找到解決方案的問題上幫助我。同一查詢在virtuoso SPARQL端點上運行,給我完美的結果。但是在使用Java Jena SPARQL查詢時出現此錯誤。
正如@AKSW在評論中所建議的,答案是
更新到當前的Jena (可能是當前的Virtuoso服務器[無論是企業版還是開放源代碼 ], Jena的Virtuoso Provider和/或Virtuoso JDBC驅動程序 )
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.