Bob Zee
Bob Zee

Reputation: 3

How to use OWLReasoner to update an ontology

I'm new to the OWL API and I was wondering if there was a way to update an ontology with all the new relations picked up by the reasoner (HermiT). I couldn't find a tutorial or much documentation, so I assumed calling

    reasoner.classifyClasses();
    reasoner.classifyDataProperties();
    reasoner.classifyObjectProperties();
    reasoner.precomputeInferences();
    reasoner.flush();

would classify the new relations. Then, I'm not sure how to translate these new relations to create an updated ontology. I have an idea of how I could manually iterate through new relations and add them if they aren't present in the ontology, but I'm looking for an easier way to do this. Also, I'm not entirely sure if the above code reasons all the new relations for me, so let me know if I should make any corrections.

Upvotes: 0

Views: 206

Answers (1)

Ignazio
Ignazio

Reputation: 10659

You can use InferredOntologyGenerator for that purpose. The class can be created with a reasoner as input and the InferredOntologyGenerator::fillOntology method to add all the axioms that can be inferred to a new ontology.

Note that axiom generation can be a very slow operation. Try with a small ontology at first, to see whether the result is what you need.

Upvotes: 1

Related Questions