假设我在Protege中创建了一些本体,并且有一个具有一些对象属性的类的实例,以及一个对象属性列表,如下图所示:

对象属性的层次结构如下:

现在,当我打开推理器(Hermit)时,我得到了这个人的以下断言对象属性:

当我单击推断的对象属性"dependsUp“customer的解释时,我得到:

我的问题是,我如何使用Java生成它?我已经可以用下面的代码获得某些个体的推断对象属性(为了简化,这里不完整,但它的工作方式与我测试的一样):
for (OWLNamedIndividual namedIndividual : this.ontology.getIndividualsInSignature()) {
if (subjectName.equals(namedIndividual.getIRI().getFragment())) {
OWLObjectProperty objectProperty = fac.getOWLObjectProperty(IRI.create(propertyIRI));
NodeSet<OWLNamedIndividual> namedIndividualSet = reasoner.getObjectPropertyValues(namedIndividual ,objectProperty);
for (Node<OWLNamedIndividual> namedIndividualsInObjectPropertySet : namedIndividualSet) {
for (OWLNamedIndividual namedIndividualForObjectPropertySet : namedIndividualsInObjectPropertySet) {
for (OWLClassExpression owlClass : namedIndividualForObjectPropertySet.getTypes(this.ontology)){
if (owlClass.toString().split("#")[1].replace(">", "").equals(archiClass)) {
result.add(OWLOntologyUtils.getHumanInstanceName(this.ontology, namedIndividualForObjectPropertySet.getIRI().getFragment()));
// Result contains all the inferred object properties shown in the above pictures, so this code works. How can I access the explanation for one of the inferred object properties by the reasoner here?
}
}
}
}
}
}发布于 2016-05-28 17:50:45
您可以使用InferredObjectPropertyAxiomGenerator
InferredObjectPropertyAxiomGenerator generator = new InferredObjectPropertyAxiomGenerator();
generator.createAxioms(owldatafactory, reasoner);https://stackoverflow.com/questions/37463589
复制相似问题