You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@jena.apache.org by "Andy Seaborne (JIRA)" <ji...@apache.org> on 2013/06/04 12:15:23 UTC

[jira] [Comment Edited] (JENA-466) a QueryEngineHTTP doesn't handle the returned content type after an execModel() call.

    [ https://issues.apache.org/jira/browse/JENA-466?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13674216#comment-13674216 ] 

Andy Seaborne edited comment on JENA-466 at 6/4/13 10:13 AM:
-------------------------------------------------------------

You have created an ASK query but used execDescribe() -- you want execAsk().

The result of an ASK query is not an RDF model but one of the result set formats.  So the remote endpoint is correctly returning application/sparql-results+xml, and you can't treat that as an RDF model.

BTW: You don't have to QueryEngineHTTP directly - the public API of QueryExecutionFactory has createRemote operations.

Similarly, SPARQLResult is mainly an internal class.
                
      was (Author: andy.seaborne):
    You have created an ASK query but used execDescribe() -- you want execASK().

The result of an ASK query is not an RDF model but one of the result set formats.  So the remote endpoint is correctly returning application/sparql-results+xml, and you can't treat that as an RDF model.

BTW: You don't have to QueryEngineHTTP directly - the public API of QueryExecutionFactory has createRemote operations.

Similarly, SPARQLResult is mainly an internal class.
                  
> a QueryEngineHTTP doesn't handle the returned content type after an execModel() call.
> -------------------------------------------------------------------------------------
>
>                 Key: JENA-466
>                 URL: https://issues.apache.org/jira/browse/JENA-466
>             Project: Apache Jena
>          Issue Type: Bug
>          Components: ARQ
>    Affects Versions: Jena 2.10.0
>            Reporter: ArthurVaisse-Lesteven
>              Labels: ASK, Jena-2.10.0, QueryEngineHTTP, content-type
>   Original Estimate: 1h
>  Remaining Estimate: 1h
>
> When executing this simple piece of code : 
> public class test {
> 	public static void main(String[] argv){
> 		String request = "Ask from <http://example.com#graphe> where {<http://example.com#ProofOfConcept> ?p ?o}";
> 		String endpoint = "http://localhost:3030/ds/query";
> 		Query query;
> 		try{
> 		query = QueryFactory.create(request);
> 		}
> 		catch(Exception e){
> 			throw e;
> 		}		
> 		QueryEngineHTTP query_engine = new QueryEngineHTTP(endpoint, query);
> 		try{
> 			SPARQLResult spqlr = new SPARQLResult(query_engine.execDescribe());
> 		}
> 		finally{
> 			query_engine.close();
> 		}
> 	}
> }
> I got the following exception :
> Exception in thread "main" com.hp.hpl.jena.query.QueryException: Endpoint returned Content Type: application/sparql-results+xml which is not a valid RDF Graph syntax
> 	at com.hp.hpl.jena.sparql.engine.http.QueryEngineHTTP.execModel(QueryEngineHTTP.java:275)
> 	at com.hp.hpl.jena.sparql.engine.http.QueryEngineHTTP.execDescribe(QueryEngineHTTP.java:251)
> 	at com.hp.hpl.jena.sparql.engine.http.QueryEngineHTTP.execDescribe(QueryEngineHTTP.java:248)
> 	at test.main(test.java:29)
> The same error occurs when I change the endpoint to a Sesame repository. So I think the problem come from the code who receive the repository response and check content type. He probably wait another content type.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira