简体   繁体   English

Get Inferred Object Property Assertions Hermit Reasoner

[英]Get Inferred Object Property Assertions Hermit Reasoner

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

设备类“Email_Server”的个体,具有对象属性“实现”

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:现在,当我打开 Reasoner (Hermit) 时,我会为同一个人获得以下断言对象属性:

单个 Email_server 的推断对象属性

When I click in the explanations for the inferred object property "dependsUp" customer, I get:当我点击推断对象属性“dependsUp”客户的解释时,我得到:

推断对象属性“dependsUp”客户的说明

My question is how can I generate this using Java?我的问题是如何使用 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?
                            }
                        }
                    }
                }

            }
        }

You can use InferredObjectPropertyAxiomGenerator :您可以使用InferredObjectPropertyAxiomGenerator

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM