You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jena.apache.org by Konrad Höffner <ko...@uni-leipzig.de> on 2011/06/13 13:04:33 UTC
500 Internal Server Error for http://api.talis.com/stores
Dear Jena Users,
When I manually query the endpoint
http://api.talis.com/stores/airports/services/sparql with the following
query, the following, for me seemingly totally valid, XML is returned.
With Jena however, I always get an http exception. How can I fix this
problem?
The query:
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
select * where
{
?entity rdfs:label ?name.
filter
(
?entity = <http://airports.dataincubator.org/airports/NGUK>
||?entity = <http://airports.dataincubator.org/airports/TQPF>
||?entity = <http://airports.dataincubator.org/airports/SEAM>
||?entity = <http://airports.dataincubator.org/airports/ID-AHI>
||?entity = <http://airports.dataincubator.org/airports/OIZB>
)
}
(whitespaces and newlines inserted for readability)
The resulting xml:
<?xml version="1.0"?>
<sparql xmlns="http://www.w3.org/2005/sparql-results#">
<head>
<variable name="entity"/>
<variable name="name"/>
</head>
<results>
<result>
<binding name="entity">
<uri>http://airports.dataincubator.org/airports/NGUK</uri>
</binding>
<binding name="name">
<literal>Buariki Airport</literal>
</binding>
</result>
<result>
<binding name="entity">
<uri>http://airports.dataincubator.org/airports/TQPF</uri>
</binding>
<binding name="name">
<literal>Wallblake Airport</literal>
</binding>
</result>
<result>
<binding name="entity">
<uri>http://airports.dataincubator.org/airports/SEAM</uri>
</binding>
<binding name="name">
<literal>Chachoán Airport</literal>
</binding>
</result>
<result>
<binding name="entity">
<uri>http://airports.dataincubator.org/airports/ID-AHI</uri>
</binding>
<binding name="name">
<literal>Amahai Airport</literal>
</binding>
</result>
<result>
<binding name="entity">
<uri>http://airports.dataincubator.org/airports/OIZB</uri>
</binding>
<binding name="name">
<literal>Zabol Airport</literal>
</binding>
</result>
</results>
</sparql>
The exception in Jena (newest version used via Maven, 2.6.4 at the moment):
HttpException: HttpException: 500 Internal Server Error: HttpException:
500 Internal Server Error
at
com.hp.hpl.jena.sparql.engine.http.HttpQuery.execCommon(HttpQuery.java:337)
at
com.hp.hpl.jena.sparql.engine.http.HttpQuery.execGet(HttpQuery.java:189)
at
com.hp.hpl.jena.sparql.engine.http.HttpQuery.exec(HttpQuery.java:144)
at
com.hp.hpl.jena.sparql.engine.http.QueryEngineHTTP.execSelect(QueryEngineHTTP.java:133)
The code I use for querying is:
QueryEngineHTTP queryExecution = new
QueryEngineHTTP(sparqlEndpoint, query);
if(graph!=null) {queryExecution.addDefaultGraph(graph);}
return queryExecution.execSelect();
Thank you in advance,
Konrad Höffner
Re: 500 Internal Server Error for http://api.talis.com/stores
Posted by Konrad Höffner <ko...@uni-leipzig.de>.
Hello Rob,
Thank you very much, that indeed fixed my problem!
I made the mistake of calling "query(sparqlEndpoint, "", query)" instead
of "query(sparqlEndpoint, null, query)" which worked fine for other
SPARQL endpoints but not for this one.
Konrad
On 13.06.2011 13:30, Rob Vesse wrote:
> Hi Konrad
>
> I'm not a heavy Jena user myself so can't say whether it is specifically
> Jena that causes this error but I do use the Talis platform quite a bit and
> I think I see what your problem might be:
>
>> if(graph!=null) {queryExecution.addDefaultGraph(graph);}
> This line of your code is adding a default graph to the query request. The
> problem is that the Talis platform is a pure Triple store (i.e. it has no
> notion of named graphs) so it does not support setting the default graph.
> I checked this in the browser and adding the default-graph-uri querysting
> parameter - which I assume it what addDefaultGraph() has the effect of
> doing to the HTTP request to the remote endpoint - causes the endpoint to
> return an error rather than a query result.
>
> So try commenting out this line and then your query should then hopefully
> work fine
>
> Rob
>
>
> On Mon, 13 Jun 2011 13:04:33 +0200, Konrad Höffner
> <ko...@uni-leipzig.de> wrote:
>> Dear Jena Users,
>>
>> When I manually query the endpoint
>> http://api.talis.com/stores/airports/services/sparql with the following
>> query, the following, for me seemingly totally valid, XML is returned.
>> With Jena however, I always get an http exception. How can I fix this
>> problem?
>>
>> The query:
>>
>> PREFIX rdfs:<http://www.w3.org/2000/01/rdf-schema#>
>> select * where
>> {
>> ?entity rdfs:label ?name.
>> filter
>> (
>> ?entity =<http://airports.dataincubator.org/airports/NGUK>
>> ||?entity =<http://airports.dataincubator.org/airports/TQPF>
>> ||?entity =<http://airports.dataincubator.org/airports/SEAM>
>> ||?entity =<http://airports.dataincubator.org/airports/ID-AHI>
>> ||?entity =<http://airports.dataincubator.org/airports/OIZB>
>> )
>> }
>>
>> (whitespaces and newlines inserted for readability)
>>
>> The resulting xml:
>>
>> <?xml version="1.0"?>
>> <sparql xmlns="http://www.w3.org/2005/sparql-results#">
>> <head>
>> <variable name="entity"/>
>> <variable name="name"/>
>> </head>
>> <results>
>> <result>
>> <binding name="entity">
>> <uri>http://airports.dataincubator.org/airports/NGUK</uri>
>>
>> </binding>
>> <binding name="name">
>> <literal>Buariki Airport</literal>
>> </binding>
>> </result>
>> <result>
>> <binding name="entity">
>> <uri>http://airports.dataincubator.org/airports/TQPF</uri>
>>
>> </binding>
>> <binding name="name">
>> <literal>Wallblake Airport</literal>
>> </binding>
>> </result>
>> <result>
>> <binding name="entity">
>> <uri>http://airports.dataincubator.org/airports/SEAM</uri>
>>
>> </binding>
>> <binding name="name">
>> <literal>Chachoán Airport</literal>
>> </binding>
>> </result>
>> <result>
>> <binding name="entity">
>> <uri>http://airports.dataincubator.org/airports/ID-AHI</uri>
>>
>> </binding>
>> <binding name="name">
>> <literal>Amahai Airport</literal>
>> </binding>
>> </result>
>> <result>
>> <binding name="entity">
>> <uri>http://airports.dataincubator.org/airports/OIZB</uri>
>>
>> </binding>
>> <binding name="name">
>> <literal>Zabol Airport</literal>
>> </binding>
>> </result>
>> </results>
>> </sparql>
>>
>> The exception in Jena (newest version used via Maven, 2.6.4 at the
> moment):
>> HttpException: HttpException: 500 Internal Server Error: HttpException:
>> 500 Internal Server Error
>> at
>>
> com.hp.hpl.jena.sparql.engine.http.HttpQuery.execCommon(HttpQuery.java:337)
>> at
>> com.hp.hpl.jena.sparql.engine.http.HttpQuery.execGet(HttpQuery.java:189)
>> at
>> com.hp.hpl.jena.sparql.engine.http.HttpQuery.exec(HttpQuery.java:144)
>> at
>>
> com.hp.hpl.jena.sparql.engine.http.QueryEngineHTTP.execSelect(QueryEngineHTTP.java:133)
>> The code I use for querying is:
>>
>> QueryEngineHTTP queryExecution = new
>> QueryEngineHTTP(sparqlEndpoint, query);
>> if(graph!=null) {queryExecution.addDefaultGraph(graph);}
>> return queryExecution.execSelect();
>>
>> Thank you in advance,
>> Konrad Höffner
Re: 500 Internal Server Error for http://api.talis.com/stores
Posted by Rob Vesse <ra...@ecs.soton.ac.uk>.
Hi Konrad
I'm not a heavy Jena user myself so can't say whether it is specifically
Jena that causes this error but I do use the Talis platform quite a bit and
I think I see what your problem might be:
> if(graph!=null) {queryExecution.addDefaultGraph(graph);}
This line of your code is adding a default graph to the query request. The
problem is that the Talis platform is a pure Triple store (i.e. it has no
notion of named graphs) so it does not support setting the default graph.
I checked this in the browser and adding the default-graph-uri querysting
parameter - which I assume it what addDefaultGraph() has the effect of
doing to the HTTP request to the remote endpoint - causes the endpoint to
return an error rather than a query result.
So try commenting out this line and then your query should then hopefully
work fine
Rob
On Mon, 13 Jun 2011 13:04:33 +0200, Konrad Höffner
<ko...@uni-leipzig.de> wrote:
> Dear Jena Users,
>
> When I manually query the endpoint
> http://api.talis.com/stores/airports/services/sparql with the following
> query, the following, for me seemingly totally valid, XML is returned.
> With Jena however, I always get an http exception. How can I fix this
> problem?
>
> The query:
>
> PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
> select * where
> {
> ?entity rdfs:label ?name.
> filter
> (
> ?entity = <http://airports.dataincubator.org/airports/NGUK>
> ||?entity = <http://airports.dataincubator.org/airports/TQPF>
> ||?entity = <http://airports.dataincubator.org/airports/SEAM>
> ||?entity = <http://airports.dataincubator.org/airports/ID-AHI>
> ||?entity = <http://airports.dataincubator.org/airports/OIZB>
> )
> }
>
> (whitespaces and newlines inserted for readability)
>
> The resulting xml:
>
> <?xml version="1.0"?>
> <sparql xmlns="http://www.w3.org/2005/sparql-results#">
> <head>
> <variable name="entity"/>
> <variable name="name"/>
> </head>
> <results>
> <result>
> <binding name="entity">
> <uri>http://airports.dataincubator.org/airports/NGUK</uri>
>
> </binding>
> <binding name="name">
> <literal>Buariki Airport</literal>
> </binding>
> </result>
> <result>
> <binding name="entity">
> <uri>http://airports.dataincubator.org/airports/TQPF</uri>
>
> </binding>
> <binding name="name">
> <literal>Wallblake Airport</literal>
> </binding>
> </result>
> <result>
> <binding name="entity">
> <uri>http://airports.dataincubator.org/airports/SEAM</uri>
>
> </binding>
> <binding name="name">
> <literal>Chachoán Airport</literal>
> </binding>
> </result>
> <result>
> <binding name="entity">
> <uri>http://airports.dataincubator.org/airports/ID-AHI</uri>
>
> </binding>
> <binding name="name">
> <literal>Amahai Airport</literal>
> </binding>
> </result>
> <result>
> <binding name="entity">
> <uri>http://airports.dataincubator.org/airports/OIZB</uri>
>
> </binding>
> <binding name="name">
> <literal>Zabol Airport</literal>
> </binding>
> </result>
> </results>
> </sparql>
>
> The exception in Jena (newest version used via Maven, 2.6.4 at the
moment):
>
> HttpException: HttpException: 500 Internal Server Error: HttpException:
> 500 Internal Server Error
> at
>
com.hp.hpl.jena.sparql.engine.http.HttpQuery.execCommon(HttpQuery.java:337)
> at
> com.hp.hpl.jena.sparql.engine.http.HttpQuery.execGet(HttpQuery.java:189)
> at
> com.hp.hpl.jena.sparql.engine.http.HttpQuery.exec(HttpQuery.java:144)
> at
>
com.hp.hpl.jena.sparql.engine.http.QueryEngineHTTP.execSelect(QueryEngineHTTP.java:133)
>
> The code I use for querying is:
>
> QueryEngineHTTP queryExecution = new
> QueryEngineHTTP(sparqlEndpoint, query);
> if(graph!=null) {queryExecution.addDefaultGraph(graph);}
> return queryExecution.execSelect();
>
> Thank you in advance,
> Konrad Höffner
--
PhD Student
IAM Group
Bay 20, Room 4027, Building 32
Electronics & Computer Science
University of Southampton