OWLOntology ontology = ontologyManager.loadOntologyFromOntologyDocument(inputStream);OWLReasoner reasoner = new ElkReasonerFactory().createNonBufferingReasoner(ontology);
reasoner.precomputeInferences(InferenceType.CLASS_ASSERTIONS);
List<InferredAxiomGenerator<? extends OWLAxiom>> axiomGenerators = new ArrayList<InferredAxiomGenerator<? extends OWLAxiom>>();
axiomGenerators.add(new InferredClassAssertionAxiomGenerator());
InferredOntologyGenerator inferredOntologyGenerator = new InferredOntologyGenerator(reasoner, axiomGenerators);
OWLOntologyManager outputOntologyManager = OWLManager.createOWLOntologyManager();
OWLOntology outputOntology = outputOntologyManager.createOntology();
inferredOntologyGenerator.fillOntology(outputOntologyManager, outputOntology);
PrintWriter output = PrintWriter(System.out);
outputOntologyManager.saveOntology(outputOntology, new RDFXMLOntologyFormat(), output);
reasoner.dispose();
1. The problem appears only with ELK, i.e., other reasoners (e.g.,
HermiT) used with the same code generate all axioms correctly?
2. The problem is caused by datatypes, i.e., the code works correctly
for ontologies without datatypes?
3. You use the (unreleased) version of ELK from the branch
elk-parent-datatypes both in Protege and in your program?
In this case, it would be really helpful if you could provide a small
example ontology for which the problem takes place.
Attached.
Protegè (using ELK from that branch) inferred Test is of class EquivalentClazz, while Java code did not.
Any update on that? Did you manage to reproduce the problem?
Did you try to do it like in this example:
https://code.google.com/p/elk-reasoner/wiki/IncrementalReasoning
I can't switch to OWL XML because Jena doesn't support it, but merging the class/properties I need into the individuals ontology fixed it.
Thank you very much! Really :-)
BTW, could I help in testing the elk-parent-datatypes branch so it get merged? Any specific test you need?