当前位置: 首页 > 知识库问答 >
问题:

Protege标记本体不一致,但Hermit和Pellet Reasoner不一致

陶飞鸿
2023-03-14

我试图在不一致的本体上运行一致性检查,Pellet和Hermit Reasoner没有给出不一致性。然而,Protege成功地标记了不一致的类。具体来说,我正在将SBVR规则更改为OWL2.0。所以我的规则是租车必须至少用3张信用卡投保;租车必须由至少5张信用卡投保;

相应的本体是

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#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" )
ClassAssertion( <ns:s2o#car_rental> <ns:s2o#Car> )
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" )
ClassAssertion( <ns:s2o#credit_card> <ns:s2o#Credit> )
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> ObjectMinCardinality( 5 <ns:s2o#is_insured_by__credit_card> <ns:s2o#credit_card> ) )
)

Hermit和Pellet将本体论标记为一致的,而AsProtege将这两个类标记为不一致的。

现在,如果我把我的SBVR规则如下

租车必须由至多3张信用卡投保;租车必须由至少5张信用卡投保;

相应的本体是

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#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" )
ClassAssertion( <ns:s2o#car_rental> <ns:s2o#Car> )
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" )
ClassAssertion( <ns:s2o#credit_card> <ns:s2o#Credit> )
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( 5 <ns:s2o#is_insured_by__credit_card> <ns:s2o#credit_card> ) )
SubClassOf( <ns:s2o#car_rental> ObjectMaxCardinality( 3 <ns:s2o#is_insured_by__credit_card> <ns:s2o#credit_card> ) )
)

这一次隐士和佩莱都工作得很好,蛋白质也是如此。

我附上我的隐士代码作为参考,

import java.io.File;
import java.util.Set;





import org.semanticweb.HermiT.Configuration;
import org.semanticweb.HermiT.Reasoner;
import org.semanticweb.HermiT.Reasoner.ReasonerFactory;
import org.semanticweb.owlapi.apibinding.OWLManager;
import org.semanticweb.owlapi.model.IRI;
import org.semanticweb.owlapi.model.OWLAxiom;
import org.semanticweb.owlapi.model.OWLClass;
import org.semanticweb.owlapi.model.OWLDataFactory;
import org.semanticweb.owlapi.model.OWLNamedIndividual;
import org.semanticweb.owlapi.model.OWLOntology;
import org.semanticweb.owlapi.model.OWLOntologyCreationException;
import org.semanticweb.owlapi.model.OWLOntologyManager;
import org.semanticweb.owlapi.reasoner.InconsistentOntologyException;
import org.semanticweb.owlapi.reasoner.Node;
import org.semanticweb.owlapi.reasoner.OWLReasoner;
import org.semanticweb.owlapi.reasoner.OWLReasonerFactory;

import com.clarkparsia.owlapi.explanation.BlackBoxExplanation;
import com.clarkparsia.owlapi.explanation.ExplanationGenerator;
import com.clarkparsia.owlapi.explanation.HSTExplanationGenerator;

public class Demo {

    public void reason() throws OWLOntologyCreationException {
        // First, we create an OWLOntologyManager object. The manager will load and save ontologies.
        OWLOntologyManager m = OWLManager.createOWLOntologyManager();
        OWLDataFactory dataFactory=m.getOWLDataFactory();

        File inputOntologyFile = new File("C:\\Users\\1047785\\Desktop\\HermiT\\Input12.owl");
        OWLOntology o=m.loadOntologyFromOntologyDocument(inputOntologyFile);// Now, we instantiate HermiT by creating an instance of the Reasoner class in the package org.semanticweb.HermiT.
        Set<OWLClass> cl = o.getClassesInSignature();
        //System.out.println(cl);




        ReasonerFactory factory = new ReasonerFactory();
        Configuration configuration=new Configuration();
        configuration.throwInconsistentOntologyException = false;
        OWLReasoner reasoner=factory.createReasoner(o, configuration);
        BlackBoxExplanation exp=new BlackBoxExplanation(o, factory, reasoner);
        HSTExplanationGenerator multExplanator=new HSTExplanationGenerator(exp);
        for (OWLClass c : cl) {
            System.out.println(c);
            System.out.println(reasoner.isSatisfiable(c));
            Set<Set<OWLAxiom>> explanations = null;
            try {
            explanations =multExplanator.getExplanations(c);
            }
            catch (Exception e) {
            /*for (Set<OWLAxiom> explanation : explanations) {
                System.out.println("------------------");
                System.out.println("Axioms causing the unsatisfiability: ");
                for (OWLAxiom causingAxiom : explanation) {
                    System.out.println(causingAxiom);
                }
                System.out.println("------------------");
            }*/
                continue;
            }
            for (Set<OWLAxiom> explanation : explanations) {
                System.out.println("------------------");
                System.out.println("Axioms causing the unsatisfiability: ");
                for (OWLAxiom causingAxiom : explanation) {
                    System.out.println(causingAxiom);
                }
                System.out.println("------------------");
            }

        }

我对这种行为感到不知所措。

共有1个答案

孔弘盛
2023-03-14

“工作很好”是指在这三个地方,你都认为租车不满意吗?

在第一个本体中,它不应该是不可满足的:minCardinality 3minCardinality 5不是不兼容的限制:一个属性有五个值的个体将同时满足这两个限制。

minCardinality 5maxCardinality 3(在您的第二个示例中)不兼容:没有多少值同时满足这两个条件。因此,在第二个本体中,car\u rental应该是不可满足的,如果您有属于该类的个人,则本体是不一致的。

 类似资料:
  • 对于我的实验,我需要具体化一个由TBox/模式和ABox/数据组成的dbpedia本体论。 为此,我将dbpedia本体论/TBox/模式(http://downloads.dbpedia.org/2016-04/dbpedia_2016-04.owl)与DBPedia知识图中的ABox/data部分合并(我在http://downloads.dbpedia.org/2016-04/core-i1

  • 按照下面的介绍youtube.com/playlist?list=plea0wjq13cnafcc0azrcyqucn_tpeljn1创建本体。它稍微缩小了http://prntscr.com/bo4l3w,我自己添加了canBeTutor(意思是某人可以成为某人的导师)对象属性。据我理解,我可以添加SWRL规则,然后启动reasoner来创建新的知识。所以我添加了prntscr.com/bo4l

  • 问题内容: 我有以下对象: 我在以下使用它: 现在,树形图用于一个称为的类中,用于存储图形中当前存在的节点以及它们的边集(来自class )。我的问题是当我尝试执行时: 我有时会得到以下信息: 哈希码:true等于:true包含: false N:foo X:foo比较数:0 有人知道我在做什么错吗?我对这一切仍然是陌生的,所以如果我忽略了一些简单的事情,我会事先道歉(我知道这并不重要,但我想我会

  • 我为家庭作业设计了一个OWL本体论,使用关于生物(生物分类)的蛋白质4.1,在与隐士或事实进行推理后,我得到了不一致的本体论,坏的个体,但我对OWL本体论非常陌生,不明白如何解决这些不一致的错误和个人。 编辑1: 以下是解释框中“热点”选项卡中的公理: > skydrive:http://sdrv.ms/11DdHao drive.google:https://docs.google.com/fo

  • 我对卡珊德拉的一致性有疑问。我在集群中有3个Cassandra节点(版本2.0.14.352 ),我使用< b >一致性级别仲裁读取和写入,我的< b >复制因子是3。如果我理解replication_factor " >这个对我来说卡珊德拉应该是一致的,因为2 ^ 2 与相应的表 dataProvider.setValue()内部将给定值放入NavigableMap。dataProvider.s

  • 蒙戈 从这一资源中,我理解了为什么mongo不是基于以下陈述的 MongoDB支持“单主”模型。这意味着您有一个主节点和多个从节点。如果主人倒台,其中一个奴隶被选为主人。这个过程会自动进行,但需要时间,通常为10-40秒。在新领导人选举期间,您的副本集已关闭,无法进行写入 是否出于同样的原因,Mongo被称为(因为写入没有发生,所以返回系统中的最新数据),但不是(不适用于写入)? 在重新选择和写入