本文介绍了获取推断的对象属性断言隐士推理程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

Say that I have some ontology created in Protege and there is an instance of a class with some object property, and a list of object properties, has shown in the following pictures:

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

The hierarchy of object properties is as follows:

现在,当我打开(隐士)推理机时,我得到以下针对同一个人的断言对象属性:

Now, when I turn the Reasoner on (Hermit), I get the following assert object properties for this same individual:

当我点击对推断对象属性"dependsUp"客户的解释时,我得到:

When I click in the explanations for the inferred object property "dependsUp" customer, I get:

我的问题是如何使用Java生成它?我已经可以通过以下方式获得某些人的推断对象属性(此处出于缩写不完整,但如我所测试的那样有效):

My question is how can I generate this using Java? I can already get the inferred object properties for some individual with the following (incomplete here for abreviety, but it works as I have tested):

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

这篇关于获取推断的对象属性断言隐士推理程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-15 03:09