How to check ABOX consistency using Hermit Reasoner

I am trying to learn how to use properly the OWLAPI but i am getting some troubles: i have an ontology which structures the activities (e.g. individual and social activities); my aim is to create an easy example of inconsistency in order to get used with this API: i want to state that soccer is an individual activity. IndividualActivity is defined in Protegè as Equivalent to (Activity and (hasActor exactly 1 Person)).

/// PIECE OF CODE ///

    OWLDataFactory df = Singleton_Ontologia.getFactory();

    IRI soccerIRI=IRI.create(Singleton_Ontologia.getIribase(),"Soccer");
    IRI paoloIRI = IRI.create(Singleton_Ontologia.getIribase(),"Paolo");
    IRI marcoIRI = IRI.create(Singleton_Ontologia.getIribase(),"Marco");

    OWLNamedIndividual soccer = df.getOWLNamedIndividual(soccerIRI);
    OWLNamedIndividual paolo = df.getOWLNamedIndividual(paoloIRI);
    OWLNamedIndividual marco = df.getOWLNamedIndividual(marcoIRI);

    OWLClass person = df.getOWLClass(
            IRI.create(Singleton_Ontologia.getIribase()+"Person"));

    OWLClass individual_activity = df.getOWLClass(
            IRI.create(Singleton_Ontologia.getIribase()+"IndividualActivity"));

    OWLObjectProperty hasActor = df.getOWLObjectProperty(
            IRI.create(Singleton_Ontologia.getIribase()+"hasActor"));

    OWLClassAssertionAxiom assertionAxiom = df.getOWLClassAssertionAxiom(individual_activity, soccer);
    OWLClassAssertionAxiom assertionAxiom2 = df.getOWLClassAssertionAxiom(person, paolo);
    OWLClassAssertionAxiom assertionAxiom3 = df.getOWLClassAssertionAxiom(person, marco);
    OWLObjectPropertyAssertionAxiom assertionAxiom4 = df.getOWLObjectPropertyAssertionAxiom(hasActor, soccer, paolo);
    OWLObjectPropertyAssertionAxiom assertionAxiom5 = df.getOWLObjectPropertyAssertionAxiom(hasActor, soccer, marco);

    Singleton_Ontologia.getManager().addAxiom(ontologiaattuale,assertionAxiom);
    Singleton_Ontologia.getManager().addAxiom(ontologiaattuale,assertionAxiom2);
    Singleton_Ontologia.getManager().addAxiom(ontologiaattuale,assertionAxiom3);
    Singleton_Ontologia.getManager().addAxiom(ontologiaattuale,assertionAxiom4);
    Singleton_Ontologia.getManager().addAxiom(ontologiaattuale,assertionAxiom5);

/// CONSISTENCY CHECK ///

System.out.println("Consistency:"+Singleton_Ontologia.getReasoner().isConsistent());

and here is the configuration of Hermit reasoner:

public static void configReasoner() {
    iribase = "http://webmind.dico.unimi.it/CARE/locont.owl#";
    Configuration config=new Configuration();
    config.ignoreUnsupportedDatatypes=true; 
    factory = manager.getOWLDataFactory();
    reasonerFactory = new ReasonerFactory();
    reasoner = reasonerFactory.createReasoner(ont,config);
}

I created the individuals Paolo and Marco in order to create more than 1 Person being Actors of Soccer but the isConsistent() method still returns true while i expected a false value. In addition, i printed the ABOX content:

___________ABOX___________


/////////////////////// OBJECT number 1 ///////////////////////
ClassAssertion(<http://webmind.dico.unimi.it/CARE/locont.owl#IndividualActivity> <http://webmind.dico.unimi.it/CARE/locont.owl#Soccer>)

/////////////////////// OBJECT number 2 ///////////////////////
ClassAssertion(<http://webmind.dico.unimi.it/CARE/locont.owl#Person> <http://webmind.dico.unimi.it/CARE/locont.owl#Paolo>)

/////////////////////// OBJECT number 3 ///////////////////////
ObjectPropertyAssertion(<http://webmind.dico.unimi.it/CARE/locont.owl#hasActor> <http://webmind.dico.unimi.it/CARE/locont.owl#Soccer> <http://webmind.dico.unimi.it/CARE/locont.owl#Paolo>)

/////////////////////// OBJECT number 4 ///////////////////////
ObjectPropertyAssertion(<http://webmind.dico.unimi.it/CARE/locont.owl#hasActor > <http://webmind.dico.unimi.it/CARE/locont.owl#Soccer> <http://webmind.dico.unimi.it/CARE/locont.owl#Marco>)

/////////////////////// OBJECT number 5 ///////////////////////
ClassAssertion(<http://webmind.dico.unimi.it/CARE/locont.owl#Person> <http://webmind.dico.unimi.it/CARE/locont.owl#Marco>)

___________END_ABOX___________

Honestly, i can't understand where my error is, may anyone help me?

Upvotes: 0

Views: 230

Answers (1)

Dmitry Tsarkov
Dmitry Tsarkov

Reputation: 768

You need to specify that Marco and Paolo are different individuals. Without this axiom nothing prevents them to be the same one and keep the ontology consistent.

Upvotes: 2

Related Questions