Get Inferred Object Property Assertions Hermit Reasoner

倖福魔咒の 提交于 2019-12-08 04:28:33

问题


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:

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

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?
                            }
                        }
                    }
                }

            }
        }

回答1:


You can use InferredObjectPropertyAxiomGenerator:

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


来源:https://stackoverflow.com/questions/37463589/get-inferred-object-property-assertions-hermit-reasoner

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!