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

Rob Vesse commented on JENA-466:
--------------------------------

The error is appropriate and correct, as Andy points out you are making an ASK 
query using the wrong method and that method is not designed to handle results 
of that type.  Use the appropriate execAsk() method and it should work fine.

Better still follow Andy's suggestion use QueryExecutionFactory.createRemote() 
rather than using primarily internal APIs directly
                
> 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 : 
> {code:title=test.java|borderStyle=solid}
> 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();
>               }
>       }
> }
> {code}
> 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

Reply via email to