gpt4 book ai didi

java - 获取推断的对象属性断言 Hermit Reasoner

转载 作者:行者123 更新时间:2023-11-30 07:21:41 26 4
gpt4 key购买 nike

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

An individual of the class Device, "Email_Server", with the object property "realizes"

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

Object Property Hierarchy

现在,当我打开 Reasoner(Hermit)时,我会得到同一个人的以下断言对象属性:

Inferred Object Properties for the individual Email_server

当我单击推断对象属性“dependsUp”客户的说明时,我得到:

Explanation for the inferred Object Property "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?
}
}
}
}

}
}

最佳答案

您可以使用InferredObjectPropertyAxiomGenerator:

InferredObjectPropertyAxiomGenerator generator = new InferredObjectPropertyAxiomGenerator();
generator.createAxioms(owldatafactory, reasoner);

关于java - 获取推断的对象属性断言 Hermit Reasoner,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37463589/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com