0

I have one basic question concerning working with OWL API and reasoners.

I have tried JFact Reasoner, successfully ran it and got a lot of axioms (some of them inferred, some of them explicitly stated in the original ontology).

I need to distinguish between them, but I really can't find any method for doing it.

Is there any method in OWLClass or somewhere else?

leppie
  • 115,091
  • 17
  • 196
  • 297
Hawk
  • 392
  • 4
  • 24

1 Answers1

1

Asserted axioms differ from inferred only because they are explicitly present in the ontology.

You can check if an axiom is present in an ontology this way:

OWLOntology o = ...
OWLAxiom ax = ...
boolean asserted = o.containsAxiom(ax);

Note: if an axiom has annotations, it is possible that it will not be matched by theis method: axioms that are semantically equivalent but have different annotations are not equals() to each other (This is W3C specs, not an OWL API decision). In that case, you can find if an axiom is asserted with o.containsAxiomIgnoreAnnotations(ax).

Ignazio
  • 10,504
  • 1
  • 14
  • 25
  • That is what I wanted, though I was hoping for better solution (like some indicating flag)... but mostly I need to check for triples. Is it possible for it to be done this way? – Hawk Nov 26 '14 at 07:40
  • It's not possible to do this easily at the triple level - they're not exposed directly in the OWL API. You would have to render both ontology and axioms as triples and check inclusion, accounting for blank nodes with different identities as well. There is code to stream triples out in the renderer packages, but the rest requires a lot of coding. – Ignazio Nov 26 '14 at 12:05