0

I have an ontology with one individual a and 6 classes (A, B, C, D, E, F). Individual belongs to the following disjunctions: (A or B; C or D; E or F).

There is some way how can I infer that an individual has to be in one of the two classes from each disjunction? I tried to create one state in which all assertions from ontology will be satisfied. For example that a belongs to A, C, F. But with function getTypes for reasoner from owlapi it is not possible, because it returns empty NodeSet.

ontologyManager = OWLManager.createOWLOntologyManager();
ontology = ontologyManager.loadOntologyFromOntologyDocument(new File(Configuration.ONTOLOGY));
OWLReasonerFactory reasonerFactory = new OpenlletReasonerFactory();
reasoner = reasonerFactory.createReasoner(ontology);
reasoner.getTypes(ind, false).getNodes()

I tried also Hermit (ReasonerFactory()) and jFact (JFactFactory()).

I tried the following too:

Set<OWLClassExpression> ontologyTypes = EntitySearcher.getTypes(ind, ontology).collect(toSet());

But this returns me only ClassExpression in form ObjectUnionOf which doesn't help because I need atomic classes.

I understand that reasoner infers in this function just classes to which individual always belongs. But is there some way how to decide to which classes from the disjunction it should belong? I need to build some model for any ontology but I can't find any function in reasoner which should do this or something similar.

IvetX
  • 1
  • 3
  • For the reasoner to infer anything, some information needs to be present in the ontology that makes it possible to derive the desired inference. Eg, if `H` is a subclass of `A`, `C` and `F` and `a` belongs to `H`, the reasoner will able to infer that `a` is also a member of `A`, `C` and `F`. – Henriette Harmse Jan 05 '22 at 18:03
  • Yes, I understand. But there is some way how to extract model from ontology only by using reasoner? (Model means that I decide about each individual if it belongs to each class from ontology or not, and assertions in this model will satisfy all axioms in ontology). – IvetX Jan 06 '22 at 15:29

1 Answers1

0

Set ontologyTypes = EntitySearcher.getTypes(ind, ontology).collect(toSet());

The OWLObjectUnionOf elements returned correspond to the (A or B) disjunctions mentioned in your question. The class names are available by visiting the elements with an OWLObjectVisitor or by calling getSignature() on the elements. Which method is appropriate depends on what you need to do after that.

Ignazio
  • 10,504
  • 1
  • 14
  • 25
  • Thank you for your answer. But I mean a method that can "extract" model from reasoner which was created during checking consistency. Because just from reasoner.getTypes() I don't get all classes for one individual in which it has to be. And from EntitySearcher.getTypes() I get OWLObjectUnionOf but without calling isConsistent function repeatedly I don't know to decide to which class it should belongs to not break consistency. I found OWLKnowledgeExplorerReasoner which should do something similar what I need but it is only for jFact, I think. Does something similar exist for other reasoners? – IvetX Jan 08 '22 at 22:21
  • I'm not clear on what you're trying to achieve. Individual "should" belong to a class, versus, individual always belong to a class - the reasoner can find the classes an individual belongs to, but what does it mean to say individual I should belong to class A? To satisfy which requirement, should it belong to that class? – Ignazio Jan 08 '22 at 23:57
  • When reasoner tells me that ontology is consistent I need to reconstruct a state/model (for example individual a belongs to A, C, E). Axioms from model should be consistent with ontology. I think that this part (building some model) happen during checking consistency. I need to know if it is possible to get this information about model only by using OWL API (because I know that from union it is possible to find out to which classes individual can belongs but I need to call another consistency check when ontology is more complicated and some classes from union can't be assigned to individual). – IvetX Jan 09 '22 at 04:13
  • Ok, if I get it right you're looking for what class intersections are satisfiable (given A or B, C or D, E or F, there are ACE, ACF, etc., some of which might be unsatisfiable, so I cannot belong to them, some of which will). I'm not sure any reasoner exposes that level of access to their model build; I don't believe they'd build those parts at all without a request to do so, but I might be wrong there. No way to do this just with OWLAPI without having to implement most of the necessary reasoning either; best I can think is generate the combinations and check satisfiability of each. – Ignazio Jan 09 '22 at 14:59
  • Yes, this is exactly the issue. Thank you very much for your answer. – IvetX Jan 09 '22 at 17:08