0

I have an ontology created in Protege, with classes and properties and related instances for them. Considering one object property I want to find all the instances in the ontology sharing the same object property - to do that I did iterate through abject properties and got the value of each of them and got the individual sharing same properties.

The problem I'm facing in is by this method I can not get the values for the inferred properties.

To make it more clear, in the following image; For the property isFrom I can get the value of 761 which is fine, however for the property immediateRelationI was expecting to get GroupOfPeople2 but I got empty. So for participant and immediateRelation which are inferred relation, I can not get any value.

Can you please help me with any method that let me go through the values of inferred properties as well ?

Following is part of the code I used for getting values.

The part of result I got when I turn the reasoner on

for (OWLObjectProperty ax: listObjectProperty) {
  TreeSet < OWLNamedIndividual > finalInd_sameOProperty = new
  TreeSet < OWLNamedIndividual > ();
  for (OWLNamedIndividual i:
    individualsameProperty) {
    Set < OWLNamedIndividual > objectValue = reasoner.getObjectPropertyValues(i, ax).getFlattened();
    if (objectValue.size() > 0) {
      finalInd_sameOProperty.add(i);

    }

  }
faro.L
  • 1
  • 3
  • Are the properties `immediateRelation` and `Participant` contained in the list of properties `listObjectProperty`? – UninformedUser Oct 19 '17 at 12:32
  • Yes of course. This list contains all the object properties in the ontology. – faro.L Oct 19 '17 at 13:26
  • Then the code should work. Which reasoner do you use? Can you share the ontology? Which OWL API version? – UninformedUser Oct 19 '17 at 14:24
  • I'm using owlapi version 4.2.3. I want to use Hermit reasoner and for that, using the following; 'OWLReasonerFactory reasonerFactory = new StructuralReasonerFactory(); OWLReasonerConfiguration config = new SimpleConfiguration(); OWLReasoner reasoner = reasonerFactory.createReasoner(ontology, config); ' – faro.L Oct 19 '17 at 15:24
  • 1
    Ehm, that's indeed wrong. `StructuralReasonerFactory` is **not** the HermiT reasoner nor any other OWL DL reasoner. It's just an OWL API internal implementation of the `OWLReasoner` interface that works on the asserted axioms + some light-weight transitive closure of the class and property hierarchy. The HermiT reasoner factory is `org.semanticweb.HermiT.ReasonerFactory` – UninformedUser Oct 19 '17 at 19:52
  • Thanks a lot. For using the pellet I used the following code , OWLReasonerFactory reasonerFactory = PelletReasonerFactory.getInstance(); Is it same for Hermit? WLReasonerFactory reasonerFactory = HermiT.ReasonerFactory.getInstance(); – faro.L Oct 20 '17 at 09:28
  • If it doesn't compile, obviously not ... you resp. your IDE should be able to determine whether there is a static method or not. Otherwise, it's the usual Java way to use the `new` operator, right? Each reasoner just implements the `OWLReasoner` interface and maybe provides a factory. How this factory is created is not fixed as there are several ways in Java. For HermiT this one should work: `new Reasoner.ReasonerFactory();` with the import `import org.semanticweb.HermiT.Reasoner;` – UninformedUser Oct 20 '17 at 09:39

0 Answers0