如何使用隐士推理器检查ABOX一致性



我正在尝试学习如何正确使用Owlapi,但我遇到了一些麻烦:我有一个结构活动(例如个人和社会活动(的本体论;我的目的是为了与此API一起使用,创建一个简单的示例:我想声明足球是个人活动。 IndividualActivity在Protegè中定义为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());

这是隐士推理器的配置:

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);
}

我创建了个人Paolo和Marco,以创建超过1 PersonSoccerActors,但是isConsistent()方法仍然返回true,而我期望一个错误的值。此外,我打印了Abox内容:

___________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___________

老实说,我不明白我的错误在哪里,有人可以帮我吗?

您需要指定Marco和Paolo是不同的个人。没有这个公理,什么都不会阻止它们成为相同的一个并保持本体一致。

相关内容

  • 没有找到相关文章

最新更新