我正在使用以下内容从本体中导出所有推断的公理:
List<InferredAxiomGenerator<? extends OWLAxiom>> gens = new ArrayList<>();
gens.add(new InferredSubClassAxiomGenerator());
gens.add(new InferredClassAssertionAxiomGenerator());
gens.add( new InferredDisjointClassesAxiomGenerator());
gens.add( new InferredEquivalentClassAxiomGenerator());
gens.add( new InferredEquivalentDataPropertiesAxiomGenerator());
gens.add( new InferredEquivalentObjectPropertyAxiomGenerator());
gens.add( new InferredInverseObjectPropertiesAxiomGenerator());
gens.add( new InferredObjectPropertyCharacteristicAxiomGenerator());
gens.add( new InferredPropertyAssertionGenerator());
gens.add( new InferredSubDataPropertyAxiomGenerator());
gens.add(new InferredDataPropertyCharacteristicAxiomGenerator());
gens.add(new InferredObjectPropertyCharacteristicAxiomGenerator());
gens.add( new InferredSubObjectPropertyAxiomGenerator());
reasoner.flush();
reasoner.getKB().realize();
InferredOntologyGenerator iog = new InferredOntologyGenerator(reasoner, gens);
OWLOntology infOnt = manager.createOntology();
iog.fillOntology(reasoner.getManager().getOWLDataFactory(), infOnt);
现在,我想从本体导出所有注释(标签和注释),将它们放在新的注释中。我能怎么做 ?非常感谢。
答案 0 :(得分:1)
我已经解决了将注释公理从本体源复制到目的地的问题:
for(OWLOntology o : manager.getImportsClosure(src)) {
for(OWLAnnotationAssertionAxiom ax : o.getAxioms(AxiomType.ANNOTATION_ASSERTION)) {
manager.applyChange(new AddAxiom(infOnt, ax));
}
}
我不知道是否有更好的方法,但它有效。