I'm trying to check an ontology for its consistency. The ontology includes only descriptions of individuals, the class and semantic rules are described by an imported ontology.
I thougt using the isConsistenct method would be the right choice.
OWLReasonerFactory reasonerFactory = new StructuralReasonerFactory();
OWLReasoner reasoner = reasonerFactory.createNonBufferingReasoner(mergedOntology);
if(reasoner.isConsistent()){
return "Merged ontology PASSED the consistency test";
}else{
return "Ontology FAILED the consistency test";
}
What would be the correct approach to check the ontology's consistency, like Protege 5 applies when starting a reasoner?
Code update using Pellet
OWLReasonerFactory reasonerFactory = new PelletReasonerFactory();
OWLReasoner reasoner = reasonerFactory.createNonBufferingReasoner(mergedOntology);
String answer = "";
if(reasoner.isConsistent()){
if(reasoner.getUnsatisfiableClasses().getEntitiesMinusBottom().size()>0){
answer = "Merged ontology FAILED satisfiability test. Unsatisfiable classes detected: " + reasoner.getUnsatisfiableClasses().getEntitiesMinusBottom().size();
}
answer = "Merged ontology PASSED the consistency test";
}else{
answer = "Merged ontology FAILED the consistency test, please review the Axioms or debug using Protege";
//FYI an example how to implement a working debugger can be found on sourceforge's OWL API page under Debugger
}
reasoner.dispose();
return answer;