OWL 2本体一致性检查

时间:2015-06-24 07:55:21

标签: xml owl ontology business-rules reasoning

我正在尝试将SBVR规则更改为Ontologies(OWL 2),然后使用Hermit Reasoner对它们进行一致性检查。然而,即使在规则不一致且因此本体不一致的情况下,隐士推理器也表明本体是一致的。我在出错的地方感到很茫然。

我得到的本体论(OWL 2)如下:

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

相应的SBVR规则和词汇如下:

词汇

CREDIT_CARD

car_rental

car_rental is_insured_by credit_card

规则

car_rental is_insured_by at_least 3 credit_card;

是必要的

car_rental is_insured_by at_most 2 credit_card;

是必要的

SBVR规则显然是对比的,因此不一致。我想知道Ontology是否也不一致,如果是这样,为什么推理器不工作。在我看来它是,但我不知道隐士推理员为什么会这么说。

我已将Hermit.jar添加到我的java代码并在其上运行推理器。

代码是

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

    }
}

1 个答案:

答案 0 :(得分:2)

所呈现的本体并不矛盾。矛盾的基数限制导致了car_rental课程的不可满足性。 HermiT正确地检测到了这一点,并且Protege显示这个标记为红色的类并将其分类为Nothing的子类。但是,只要此类不包含任何实例,本体就会保持一致。为了使它由于这些相互矛盾的限制而不一致,您必须至少有一个该类的实例。