线程 "main" com.hp.hpl.jena.query.QueryParseException 中的异常:第 1 行第 176 列的词法错误。遇到:“”(32),之后:"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" 错误,

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)

任何人都可以帮助我解决我用谷歌搜索但没有找到 solution.The 在 vi​​rtuoso SPARQL 端点上运行相同查询的问题,让我在使用 java Jena 时完美 result.but SPARQL 查询我收到此错误。

正如@AKSW 在评论中所建议的那样,答案是

更新为 current Jena (and possibly current Virtuoso server [whether Enterprise or Open Source], Virtuoso Provider for Jena, and/or Virtuoso JDBC driver)