I am working on ontology reconciliation between two ontologies. I apply the jena/pellet platform, locally, and apply sparql rules as much as possible. For inserts this is successful, for deletes it is not, no matter what I try. This raises the question whether sparql deletes are supported at all with jena/pellet. Please advise!
Please find the related code snippets below. First the code, then the sparql DELETE query.
public void executeDelete(String mySparqlFile, OntModel o ) {
UpdateRequest updateObj = null;
UpdateProcessor up = null;
GraphStore graphStore = GraphStoreFactory.create();
graphStore.setDefaultGraph( o.getGraph() );
updateObj = UpdateFactory.read( mySparqlFile );
up = UpdateExecutionFactory.create(updateObj, graphStore);
up.execute();
}
public static void main() {
static OntModel ontModel = ModelFactory.createOntologyModel(PelletReasonerFactory.THE_SPEC, rawModel);
static OntModel stanfordModel = ModelFactory.createOntologyModel(PelletReasonerFactory.THE_SPEC);
stanfordModel.read("path/to/modelA.owl");
ontModel.addSubModel(stanfordModel);
executeDelete("path/to/delQuery.sparql", ontModel);
}
the file "delQuery.sparql"
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX owl: <http://www.w3.org/2002/07/owl#>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX stfd: <http://www.semanticweb.org/brandtp/ontologies/2014/6/Goose-stanford-metamodel.owl#>
DELETE { ?c a stfd:Token . }
WHERE {
?c stfd:hasFeature stfd:Determiner .
}