1

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:

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

The hierarchy of object properties is as follows:

Object Property Hierarchy

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

Inferred Object Properties for the individual Email_server

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

Explanation for the inferred Object Property "dependsUp" customer

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

            }
        }
luispcosta
  • 542
  • 1
  • 6
  • 20

1 Answers1

1

You can use InferredObjectPropertyAxiomGenerator:

InferredObjectPropertyAxiomGenerator generator = new InferredObjectPropertyAxiomGenerator();
generator.createAxioms(owldatafactory, reasoner);
Ignazio
  • 10,504
  • 1
  • 14
  • 25
  • 1
    Sounds interesting, don't really know how to use it to get the inferred object properties for a individual though. I see that you are a core contributor to the OWLAPI, could you be kind enough to provide me with an example of how can I get the inferred object properties for some individual using this class? – luispcosta May 28 '16 at 15:48
  • @luispcosta, did you get that? – Sathyamoorthy R Jul 29 '19 at 12:55