Discussion:
got exception on specific query
Zen 98052
2016-06-21 15:00:37 UTC
Permalink
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
Zen 98052
2016-06-21 15:11:09 UTC
Permalink
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 <***@outlook.com>
Sent: Tuesday, June 21, 2016 11:00:37 AM
To: ***@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
Andy Seaborne
2016-06-21 19:19:17 UTC
Permalink
Which version are you using?
Post by Zen 98052
com.hp.hpl.jena.
Jena2, not Jena3.

Andy
Post by Zen 98052
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..
________________________________
Sent: Tuesday, June 21, 2016 11:00:37 AM
Subject: got exception on specific query
Hi,
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" .
}
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
Zen 98052
2016-06-21 20:02:25 UTC
Permalink
Yes, still using Jena 2, to be precise, v2.13.0

________________________________
From: Andy Seaborne <***@apache.org>
Sent: Tuesday, June 21, 2016 3:19:17 PM
To: ***@jena.apache.org
Subject: Re: got exception on specific query

Which version are you using?
Post by Zen 98052
com.hp.hpl.jena.
Jena2, not Jena3.

Andy
Post by Zen 98052
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..
________________________________
Sent: Tuesday, June 21, 2016 11:00:37 AM
Subject: got exception on specific query
Hi,
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" .
}
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
Andy Seaborne
2016-06-21 20:55:28 UTC
Permalink
Post by Zen 98052
Yes, still using Jena 2, to be precise, v2.13.0
I tried the query in various versions (3.x, 2.13.0, 2.11) and they all
work. My test was to run "qparse" on the query which calls
QueryFactory.parse

Andy
Post by Zen 98052
________________________________
Sent: Tuesday, June 21, 2016 3:19:17 PM
Subject: Re: got exception on specific query
Which version are you using?
Post by Zen 98052
com.hp.hpl.jena.
Jena2, not Jena3.
Andy
Post by Zen 98052
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..
________________________________
Sent: Tuesday, June 21, 2016 11:00:37 AM
Subject: got exception on specific query
Hi,
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" .
}
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
Zen 98052
2016-06-21 21:09:12 UTC
Permalink
Yes, that's really weird. It works fine on previous deployment (using same version of Jena, and same call to QueryFactory.create)

Do you see any problem if I pass Syntax.syntaxARQ?



Thanks,

Z

________________________________
From: Andy Seaborne <***@apache.org>
Sent: Tuesday, June 21, 2016 4:55:28 PM
To: ***@jena.apache.org
Subject: Re: got exception on specific query
Post by Zen 98052
Yes, still using Jena 2, to be precise, v2.13.0
I tried the query in various versions (3.x, 2.13.0, 2.11) and they all
work. My test was to run "qparse" on the query which calls
QueryFactory.parse

Andy
Post by Zen 98052
________________________________
Sent: Tuesday, June 21, 2016 3:19:17 PM
Subject: Re: got exception on specific query
Which version are you using?
Post by Zen 98052
com.hp.hpl.jena.
Jena2, not Jena3.
Andy
Post by Zen 98052
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..
________________________________
Sent: Tuesday, June 21, 2016 11:00:37 AM
Subject: got exception on specific query
Hi,
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" .
}
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
Andy Seaborne
2016-06-21 22:00:29 UTC
Permalink
Post by Zen 98052
Yes, that's really weird. It works fine on previous deployment (using same version of Jena, and same call to QueryFactory.create)
Do you see any problem if I pass Syntax.syntaxARQ?
Yes - the underlying fault is still there! The exception message is as
far as I can tell, due to catching a java.lang.Error which does not come
from the parser. Such java.lang.Error are a sign of a low-level problem
- the fact you see in some places and not others is also a bad sign (tm).

FWIW My best guess, with little evidence, is a corrupt class file or
something of that kind.

Andy
Post by Zen 98052
Thanks,
Z
________________________________
Sent: Tuesday, June 21, 2016 4:55:28 PM
Subject: Re: got exception on specific query
Post by Zen 98052
Yes, still using Jena 2, to be precise, v2.13.0
I tried the query in various versions (3.x, 2.13.0, 2.11) and they all
work. My test was to run "qparse" on the query which calls
QueryFactory.parse
Andy
Post by Zen 98052
________________________________
Sent: Tuesday, June 21, 2016 3:19:17 PM
Subject: Re: got exception on specific query
Which version are you using?
Post by Zen 98052
com.hp.hpl.jena.
Jena2, not Jena3.
Andy
Post by Zen 98052
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..
________________________________
Sent: Tuesday, June 21, 2016 11:00:37 AM
Subject: got exception on specific query
Hi,
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" .
}
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
Zen 98052
2016-06-21 23:11:08 UTC
Permalink
Thanks Andy!

Aside from this bizarre issue, i'd think passing syntaxARQ is fine, because it's an extension of syntaxSPARQL_11, right?

________________________________
From: Andy Seaborne <***@apache.org>
Sent: Tuesday, June 21, 2016 6:00:29 PM
To: ***@jena.apache.org
Subject: Re: got exception on specific query
Post by Zen 98052
Yes, that's really weird. It works fine on previous deployment (using same version of Jena, and same call to QueryFactory.create)
Do you see any problem if I pass Syntax.syntaxARQ?
Yes - the underlying fault is still there! The exception message is as
far as I can tell, due to catching a java.lang.Error which does not come
from the parser. Such java.lang.Error are a sign of a low-level problem
- the fact you see in some places and not others is also a bad sign (tm).

FWIW My best guess, with little evidence, is a corrupt class file or
something of that kind.

Andy
Post by Zen 98052
Thanks,
Z
________________________________
Sent: Tuesday, June 21, 2016 4:55:28 PM
Subject: Re: got exception on specific query
Post by Zen 98052
Yes, still using Jena 2, to be precise, v2.13.0
I tried the query in various versions (3.x, 2.13.0, 2.11) and they all
work. My test was to run "qparse" on the query which calls
QueryFactory.parse
Andy
Post by Zen 98052
________________________________
Sent: Tuesday, June 21, 2016 3:19:17 PM
Subject: Re: got exception on specific query
Which version are you using?
Post by Zen 98052
com.hp.hpl.jena.
Jena2, not Jena3.
Andy
Post by Zen 98052
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..
________________________________
Sent: Tuesday, June 21, 2016 11:00:37 AM
Subject: got exception on specific query
Hi,
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" .
}
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
Andy Seaborne
2016-06-22 10:07:30 UTC
Permalink
Post by Zen 98052
Thanks Andy!
Aside from this bizarre issue, i'd think passing syntaxARQ is fine, because it's an extension of syntaxSPARQL_11, right?
Yes.

(Ssh! - don't tell anyone but Fuseki uses Syntax.syntaxARQ)

Andy
Post by Zen 98052
________________________________
Sent: Tuesday, June 21, 2016 6:00:29 PM
Subject: Re: got exception on specific query
Post by Zen 98052
Yes, that's really weird. It works fine on previous deployment (using same version of Jena, and same call to QueryFactory.create)
Do you see any problem if I pass Syntax.syntaxARQ?
Yes - the underlying fault is still there! The exception message is as
far as I can tell, due to catching a java.lang.Error which does not come
from the parser. Such java.lang.Error are a sign of a low-level problem
- the fact you see in some places and not others is also a bad sign (tm).
FWIW My best guess, with little evidence, is a corrupt class file or
something of that kind.
Andy
Post by Zen 98052
Thanks,
Z
________________________________
Sent: Tuesday, June 21, 2016 4:55:28 PM
Subject: Re: got exception on specific query
Post by Zen 98052
Yes, still using Jena 2, to be precise, v2.13.0
I tried the query in various versions (3.x, 2.13.0, 2.11) and they all
work. My test was to run "qparse" on the query which calls
QueryFactory.parse
Andy
Post by Zen 98052
________________________________
Sent: Tuesday, June 21, 2016 3:19:17 PM
Subject: Re: got exception on specific query
Which version are you using?
Post by Zen 98052
com.hp.hpl.jena.
Jena2, not Jena3.
Andy
Post by Zen 98052
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..
________________________________
Sent: Tuesday, June 21, 2016 11:00:37 AM
Subject: got exception on specific query
Hi,
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" .
}
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
Loading...