Zen 98052
2016-06-21 15:00:37 UTC
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
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