Error 404
Error 404

Reputation: 115

OpenRDF/Sesame don't delivers an Model

I was using FUSEKI and now changed to OpenRDF/Sesame.

Everything works fine, i have just one problem. In one method i need to get back the complete database of my repositori in a Model. The Method looks like this:

  private static Model getRepositoryModel() throws ResourceRepositoryException{
  String queryString = "DESCRIBE * WHERE {?r ?s ?p}";
  Model currentModel = QueryExecuter.executeSparqlDescribeQuery(queryString);
  return currentModel; }

public static Model executeSparqlDescribeQuery(String queryString) throws ResourceRepositoryException {
Model resultModel = null;
try{
  QueryExecution qe = QueryExecutionFactory.sparqlService(SESAME_SERVICE_QUERY, queryString);
  resultModel = qe.execDescribe();
} catch(QueryExceptionHTTP | QueryParseException e){
  throw new ResourceRepositoryException(e.getMessage());
}
correctNsPrefixes(resultModel);
return resultModel;}

But i don't actually get a Model back. But in SPARQL you have to get one back if you call this method. It also worked with FUSEKI.

Upvotes: 0

Views: 172

Answers (1)

Jeen Broekstra
Jeen Broekstra

Reputation: 22042

From your comments I gather that you are using Jena to query a remote Sesame Server (it wasn't clear earlier that that was what you were doing, I initially thought you had switched your own client code over to use Sesame as well but had posted the wrong/old code). Although this is a slightly unconventional setup (most people using Sesame Server also use the Sesame APIs to actually query/access it), it certainly should be possible.

Apparently, however, you are using something like this as the Sesame SPARQL endpoint URL:

http://localhost:8080/openrdf-workbench/repositories/test 

(assuming your repository is named 'test').

This is not the correct URL to use. It should be:

http://localhost:8080/openrdf-sesame/repositories/test 

Notice the difference: not "openrdf-workbench", but "openrdf-sesame".

The workbench is a client UI for a Sesame Server, it is not intended to be used as the SPARQL endpoint itself. The fact that it apparently works if you use it for SELECT-queries is just an unfortunate side effect. It is not intended to be used as such.

Upvotes: 1

Related Questions