Yes, still using Jena 2, to be precise, v2.13.0 ________________________________ From: Andy Seaborne <a...@apache.org> Sent: Tuesday, June 21, 2016 3:19:17 PM To: users@jena.apache.org Subject: Re: got exception on specific query
Which version are you using? > com.hp.hpl.jena. Jena2, not Jena3. Andy On 21/06/16 16:11, Zen 98052 wrote: > > What puzzling me more, the code currently being deployed actually never > passed that second arg, but it doesn't throw exception. > > The Jena API version is same, I made some changes at other places, but not on > that particular code. This is so weird.. > > > ________________________________ > From: Zen 98052 <z98...@outlook.com> > Sent: Tuesday, June 21, 2016 11:00:37 AM > To: users@jena.apache.org > Subject: got exception on specific query > > Hi, > > I got exception when calling QueryFactory.create(query); where query is > following: > > > PREFIX v: <http://b/dir/> > PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> > > SELECT (COUNT(?idObj) AS ?idCount) WHERE > { > { > SELECT ?person ?idObj WHERE > { > ?person v:hasUniqueID ?idObj . > } > } > ?person v:hasDataContext ?dc . > ?dc v:metadataID "foobar" . > } > > > The exception I got is: > > com.hp.hpl.jena.query.QueryParseException: > com/hp/hpl/jena/sparql/util/PrefixMapping2 > at > com.hp.hpl.jena.sparql.lang.ParserSPARQL11.perform(ParserSPARQL11.java:118) > at > com.hp.hpl.jena.sparql.lang.ParserSPARQL11.parse$(ParserSPARQL11.java:53) > at com.hp.hpl.jena.sparql.lang.SPARQLParser.parse(SPARQLParser.java:34) > at com.hp.hpl.jena.query.QueryFactory.parse(QueryFactory.java:148) > at com.hp.hpl.jena.query.QueryFactory.create(QueryFactory.java:80) > at com.hp.hpl.jena.query.QueryFactory.create(QueryFactory.java:53) > at com.hp.hpl.jena.query.QueryFactory.create(QueryFactory.java:41) > ... > > > However, when I pass the syntax arg, i.e. QueryFactory.create(query, > Syntax.syntaxARQ); then it works fine. > > Without passing syntax, it'd use Syntax.defaultQuerySyntax, which resolves to > Syntax.syntaxSPARQL_11 > > Though it is working now, but I wonder if this is safe option? If not, what > is the workaround? > > > > Thanks, > > Z >