SPARQL DELETE:在jena / pellet中不可能?

时间:2014-11-25 09:11:26

标签: sparql jena ontology pellet

我正致力于两个本体之间的本体对话。我在本地应用jena / pellet平台,并尽可能地应用sparql规则。对于插入,这是成功的,对于删除它不是,无论我尝试什么。这引发了一个问题,即jena / pellet是否支持sparql删除。请指教!

请在下面找到相关的代码段。首先是代码,然后是sparql DELETE查询。

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);
}

文件" 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 . 
}

0 个答案:

没有答案