Find what creates the inconsistency using OWLAPI

24 views Asked by At

I am currently trying to learn how to use HermiT reasoner from the OWLAPI library. To understand more about it, I have created this INCONSISTENT to experiment on. If you are interested, I have upload the ontology here: drive.

To get started, I am working on this code:

  public void loadReasoner(){
        
        this.ontology = ontology;
        System.out.println("*** Applying Reasoning on: " + ontology.getOntologyID().getOntologyIRI().get());
        long startTime = System.currentTimeMillis();

        reasonerFactory = new ReasonerFactory();
        config = new Configuration();
        reasoner = reasonerFactory.createReasoner(ontology, config);

        long endTime = System.currentTimeMillis();
        long duration = endTime - startTime;
        
        System.out.println("Time taken for Reasoning: " + duration + " milliseconds");
        
        if(!reasoner.isConsistent()){
            Set<OWLClass> unsat_classes = reasoner.getUnsatisfiableClasses().getEntitiesMinusBottom();
        }
    }

However this code will throw an error in the part of Set unsat_classes = reasoner.getUnsatisfiableClasses().getEntitiesMinusBottom();`, indicating my ontology is INCONSISTENT thus it can not perform this action. I really don't understand why, since this line of code is used to the inconsistencies of an ontology... The exception is this:

Exception in thread "main" org.semanticweb.owlapi.reasoner.InconsistentOntologyException: Inconsistent ontology
    at org.semanticweb.HermiT.Reasoner.throwInconsistentOntologyExceptionIfNecessary(Reasoner.java:2225)
    at org.semanticweb.HermiT.Reasoner.checkPreConditions(Reasoner.java:2217)
    at org.semanticweb.HermiT.Reasoner.classifyClasses(Reasoner.java:749)
    at org.semanticweb.HermiT.Reasoner.getUnsatisfiableClasses(Reasoner.java:873)
...

I have uploaded me ontology in protégé as well and the reasoner find the inconsistencies with their explanations though...

Can somebody explain to me why is this happening?

Thank you in advance

0

There are 0 answers