Skip to content

Instantly share code, notes, and snippets.

@phlegx
Created May 7, 2012 16:55
Show Gist options
  • Save phlegx/2628950 to your computer and use it in GitHub Desktop.
Save phlegx/2628950 to your computer and use it in GitHub Desktop.
public void performRollback(String repositoryID, String pdoVersion) {
String server = GeneralOperations.getSesameServer();
Repository myRepository = createRepositoryConnection(server, repositoryID);
String sparqlQuery = "CONSTRUCT { ?s ?p ?o } WHERE {GRAPH <http://example.com/" + repositoryID + "_" + pdoVersion + ".owl> {?s ?p ?o }}";
try {
RepositoryConnection con = myRepository.getConnection();
try {
GraphQuery graphResult = con.prepareGraphQuery(QueryLanguage.SPARQL, sparqlPrefixVersioning + sparqlQuery);
try {
ValueFactory f = myRepository.getValueFactory();
org.openrdf.model.URI context = f.createURI("http://example.com/" + repositoryID + "_" + pdoVersion + ".owl");
GraphQueryResult result = graphResult.evaluate();
con.clear(context);
//con.clear();
}
finally {
graphResult.clearBindings();
}
} finally {
con.close();
}
} catch (Exception ex) {
LOG.error("Exception: ", ex);
}
LOG.debug("END performRollback");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment