You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@jena.apache.org by bocai <ji...@clas.ac.cn> on 2013/09/02 06:31:24 UTC

Jena error for help

Hello
I want to access remote sparql endpoint throuth JENA API. My program and error is below. I don't know how to deal with this problem.
Can you give me some advice? Thank you very very much !


Exception in thread "main" com.hp.hpl.jena.query.QueryException: Endpoint returned Content-Type: text/html which is not currently supported for SELECT queries
at com.hp.hpl.jena.sparql.engine.http.QueryEngineHTTP.execSelect(QueryEngineHTTP.java:334)
at Dbpedia.GetFromSparql.SearchSparql(GetFromSparql.java:53)
at Dbpedia.GetFromSparql.main(GetFromSparql.java:71)

***************************************************************************************
public static void SearchSparql(){
String query=
"PREFIX foaf: <http://xmlns.com/foaf/0.1/>" +
"other PRERIX...... " +

"SELECT ?s ?p ?o WHERE { ?s ?p ?o } LIMIT 10";

Query query1 = QueryFactory.create(query);
QueryExecution qexec = QueryExecutionFactory.sparqlService("http://dbtune.org/musicbrainz/snorql/", query1);
try 
{
  ResultSet results = qexec.execSelect();
}
catch (QueryExceptionHTTP e) {
e.getResponseMessage();
} 
finally {
   qexec.close();
}
}


―BoCai



----------------------------------------------------------------------

Re: Jena error for help

Posted by Dave Reynolds <da...@gmail.com>.
On 02/09/13 05:31, bocai wrote:
> Hello

Please ask questions like this on the jena-users list.

> I want to access remote sparql endpoint throuth JENA API. My program and error is below. I don't know how to deal with this problem.
> Can you give me some advice? Thank you very very much !

The exception is because you are pointing at the human readable web
front end rather than the actual sparql service. That web page suggests
that the sparql service itself is at:
   http://dbtune.org/musicbrainz/sparql

Dave


> Exception in thread "main" com.hp.hpl.jena.query.QueryException: Endpoint returned Content-Type: text/html which is not currently supported for SELECT queries
> at com.hp.hpl.jena.sparql.engine.http.QueryEngineHTTP.execSelect(QueryEngineHTTP.java:334)
> at Dbpedia.GetFromSparql.SearchSparql(GetFromSparql.java:53)
> at Dbpedia.GetFromSparql.main(GetFromSparql.java:71)
> 
> ***************************************************************************************
> public static void SearchSparql(){
> String query=
> "PREFIX foaf: <http://xmlns.com/foaf/0.1/>" +
> "other PRERIX...... " +
> 
> "SELECT ?s ?p ?o WHERE { ?s ?p ?o } LIMIT 10";
> 
> Query query1 = QueryFactory.create(query);
> QueryExecution qexec = QueryExecutionFactory.sparqlService("http://dbtune.org/musicbrainz/snorql/", query1);
> try
> {
>    ResultSet results = qexec.execSelect();
> }
> catch (QueryExceptionHTTP e) {
> e.getResponseMessage();
> }
> finally {
>     qexec.close();
> }
> }
> 
> 
> ―BoCai
> 
> 
> 
> ----------------------------------------------------------------------
>