0

I am trying to change SBVR Rules to Ontologies(OWL 2) and then running a consistency check on them using Hermit Reasoner. However even in case of inconsistent rules and thus inconsistent ontologies, the Hermit Reasoner is showing the ontology to be consistent. I am at a loss at where I am going wrong.

The ontology(OWL 2) I got is as follows:

Prefix( xsd:=<http://www.w3.org/2001/XMLSchema#> )
Prefix( ns:=<http://isd.ktu.lt/semantika/> )
Ontology( <http://isd.ktu.lt/semantika/s2o>
Declaration( AnnotationProperty( <ns:s2o#label_sbvr> ) )
Declaration( AnnotationProperty( <ns:s2o#label_en> ) )
Declaration( Class( <ns:s2o#credit_card> ) )
AnnotationAssertion( <ns:s2o#label_sbvr> <ns:s2o#credit_card> "credit_card"@en )
AnnotationAssertion( <http://www.w3.org/2000/01/rdf-schema#label> <ns:s2o#credit_card> "credit card"@en )
AnnotationAssertion( <ns:s2o#label_en> <ns:s2o#credit_card> "credit card" )
Declaration( Class( <ns:s2o#car_rental> ) )
AnnotationAssertion( <ns:s2o#label_sbvr> <ns:s2o#car_rental> "car_rental"@en )
AnnotationAssertion( <http://www.w3.org/2000/01/rdf-schema#label> <ns:s2o#car_rental> "car rental"@en )
AnnotationAssertion( <ns:s2o#label_en> <ns:s2o#car_rental> "car rental" )
Declaration( ObjectProperty( <ns:s2o#is_insured_by__credit_card> ) )
ObjectPropertyDomain( <ns:s2o#is_insured_by__credit_card> <ns:s2o#car_rental> )
ObjectPropertyRange( <ns:s2o#is_insured_by__credit_card> <ns:s2o#credit_card> )
AnnotationAssertion( <ns:s2o#label_sbvr> <ns:s2o#is_insured_by__credit_card> "car_rental is_insured_by credit_card"@en )
AnnotationAssertion( <http://www.w3.org/2000/01/rdf-schema#label> <ns:s2o#is_insured_by__credit_card> "car rental is insured by credit card"@en )
AnnotationAssertion( <ns:s2o#label_en> <ns:s2o#is_insured_by__credit_card> "car rental is insured by credit card" )
SubClassOf( <ns:s2o#car_rental> ObjectMinCardinality( 3 <ns:s2o#is_insured_by__credit_card> <ns:s2o#credit_card> ) )
SubClassOf( <ns:s2o#car_rental> ObjectMaxCardinality( 2 <ns:s2o#is_insured_by__credit_card> <ns:s2o#credit_card> ) )
)

The corresponding SBVR rules and vocabulary is as follows:

Vocabulary

credit_card

car_rental

car_rental is_insured_by credit_card

Rules

It is necessary that car_rental is_insured_by at_least 3 credit_card;

It is necessary that car_rental is_insured_by at_most 2 credit_card;

The SBVR rules are clearly contrasting and so inconsistent. I would like to know whether the Ontology is inconsistent as well, and if so why is the reasoner not working. It looks to me it is, but I am at a loss as to why the Hermit Reasoner is saying otherwise.

I have added Hermit.jar to my java code and running reasoner on it.

The code for that is

    package com.tcs.HermiT;

import java.io.File;

import org.semanticweb.HermiT.Reasoner;
import org.semanticweb.owlapi.apibinding.OWLManager;
import org.semanticweb.owlapi.model.IRI;
import org.semanticweb.owlapi.model.OWLOntology;
import org.semanticweb.owlapi.model.OWLOntologyManager;

public class Demo {

    public static void main(String[] args) throws Exception {
        // First, we create an OWLOntologyManager object. The manager will load and save ontologies.
        OWLOntologyManager m = OWLManager.createOWLOntologyManager();
        // We use the OWL API to load the Pizza ontology.
        File inputOntologyFile = new File("C:\\Users\\1047785\\Desktop\\HermiT\\Input9.owl");
        OWLOntology o=m.loadOntologyFromOntologyDocument(inputOntologyFile);// Now, we instantiate HermiT by creating an instance of the Reasoner class in the package org.semanticweb.HermiT.
        Reasoner hermit=new Reasoner(o);
        //System.out.println(hermit.getDLOntology());
        // Finally, we output whether the ontology is consistent.
        System.out.println(hermit.isConsistent());
        //System.out.println(hermit.getDLOntology().toString());

    }
}
  • Reducing the problem to the corner case, i.e. an ontology with only the conflicting property assertions (`max 2 credit_card`, `min 3 credit_card`) into Protege and running hermit on the result correctly signals inconsistency for me. Are you sure you are loading the correct ontology and not an older version? – dhke Jun 24 '15 at 08:08
  • No I am loading the correct ontology. Then I guess my Reasoner is a bit faulty. Thank you for that update though. I was correct in suspecting that it might be the problem of the Reasoner. Is it possible that the Hermit Reasoner in Java(as in my case) will act differently as compared to the Reasoner in Protege? I am new at this so sorry if the question sounds dumb. – Sayandeep Mitra Jun 24 '15 at 09:05
  • I'm not too familiar with Hermit, but your code is almost to the letter what [the docs](http://hermit-reasoner.com/java.html) suggest to get you going. You might try running directly [from command line](http://hermit-reasoner.com/command.html) and comparing output. Note that it also may be a simple syntax issue as it is all to easy to get single character errors in ontologies. – dhke Jun 24 '15 at 10:26
  • The reasoner used by protégé is the same jar released by HermiT authors. – Ignazio Jun 25 '15 at 07:57
  • @Ignazio: Yes I just checked that. Thanks for your earlier input about the unsatisfiable method. The problem is that once I get to make my Ontology inconsistent, by instantiating a class the function gives an exception. So I am not being able to pinpoint the class which is causing the inconsistency. Can you possibly help out with that? – Sayandeep Mitra Jun 25 '15 at 11:33
  • I know less about this, but there is an owlexplanation project on GitHub by Matthew Horridge, it provides tools to check inconsistencies and pinpoint the exact source. I'd recommend trying out its examples. – Ignazio Jun 25 '15 at 12:29
  • Could you possibly give me the link? – Sayandeep Mitra Jun 25 '15 at 12:42

1 Answers1

3

The ontology as presented is not inconsistent. The contradicting cardinality restrictions leads to the unsatisfiability of class car_rental. HermiT correctly detects this, and Protege shows this marking that class in red and classifying it as a subclass of Nothing. However, as long as this class contains no instances, the ontology stays consistent.In order to make it inconsistent due to those contradictory restrictions, you must have at least one instance of that class.

Dmitry Tsarkov
  • 768
  • 4
  • 11
  • Thnaks a lot. I have been stuck with this problem for days. – Sayandeep Mitra Jun 25 '15 at 05:42
  • Just a clarification, by an instance of that class, do you mean the Demo Class(in my code) or the OwlOntology Class? – Sayandeep Mitra Jun 25 '15 at 05:49
  • The unsatisfiable class would be car_rental. You can get a list of unsatisfiable classes with OWLReasoner.getUnsatisfiableClasses() – Ignazio Jun 25 '15 at 08:00
  • I mean OWL class, not the Java class. The contradicting restrictions force the class `car_rental` to be empty. If the ontology contains an axiom that makes this class non-empty (e.g., `ClassAssertion( )`, the whole ontology became inconsistent. – Dmitry Tsarkov Jun 25 '15 at 09:15
  • @DmitryTsarkov: Thanks for the help. It worked out exactly like you said. Could you suggest a way where I might be able to print out the OWL Classes which are causing the inconsistency? As earlier, Reasoner.getUnsatisfiableClasses was printing car_rental as the source of the inconsistency. But now even though the answer is coming false, it is giving an exception stating that the ontology is inconsistent. – Sayandeep Mitra Jun 25 '15 at 10:03
  • @DmitryTsarkov Thanks for that clarification. I was under the impression that "consistent" means "nothing but bottom is empty". In this case it is clear, why consistency is still signalled for the incoherent ontology. – dhke Jun 25 '15 at 12:58
  • kindly check http://stackoverflow.com/questions/31103720/should-rif-rules-be-inside-the-ontology – Marco Dinatsoli Jun 28 '15 at 19:10