【问题标题】:OWL Ontology: how to write a complement class definition?OWL Ontology:如何编写补充类定义?
【发布时间】:2019-02-21 12:07:33
【问题描述】:

推理器未能将类别分类为定义为另一个类别 B 的补充的类别 A。

我在 protege 5 中创建了一个最小的 OWL 本体示例(基于著名的比萨示例)来说明这个问题。

有两种披萨类:Americana 和 Soho,前者有肉馅,后者有蔬菜馅。 然后有两个类别:VegetarianPizza 定义为带有蔬菜配料的比萨饼,NonVegetarianPizza 定义为不是 VegetarianPizza 的比萨饼。 Soho 被正确归类为 VegetarianPizza,但 Americana 没有被归类为 NonVegetarianPizza。

有人能解释一下怎么回事吗?

代码如下:

<?xml version="1.0"?>
<Ontology xmlns="http://www.w3.org/2002/07/owl#"
 xml:base="http://www.pizza.com/ontologies/pizza-minimal.owl"
 xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
 xmlns:xml="http://www.w3.org/XML/1998/namespace"
 xmlns:xsd="http://www.w3.org/2001/XMLSchema#"
 xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
 ontologyIRI="http://www.pizza.com/ontologies/pizza-minimal.owl"
 versionIRI="http://www.pizza.com/ontologies/pizza-minimal.owl/v1.0">
<Prefix name="" IRI="http://www.pizza.com/ontologies/pizza-minimal.owl"/>
<Prefix name="owl" IRI="http://www.w3.org/2002/07/owl#"/>
<Prefix name="rdf" IRI="http://www.w3.org/1999/02/22-rdf-syntax-ns#"/>
<Prefix name="xml" IRI="http://www.w3.org/XML/1998/namespace"/>
<Prefix name="xsd" IRI="http://www.w3.org/2001/XMLSchema#"/>
<Prefix name="rdfs" IRI="http://www.w3.org/2000/01/rdf-schema#"/>
<Declaration>
    <ObjectProperty IRI="#isToppingOf"/>
</Declaration>
<Declaration>
    <ObjectProperty IRI="#hasTopping"/>
</Declaration>
<Declaration>
    <Class IRI="#NonVegetarianPizza"/>
</Declaration>
<Declaration>
    <Class IRI="#SohoPizza"/>
</Declaration>
<Declaration>
    <Class IRI="#VegetableTopping"/>
</Declaration>
<Declaration>
    <Class IRI="#VegetarianPizza"/>
</Declaration>
<Declaration>
    <Class IRI="#Pizza"/>
</Declaration>
<Declaration>
    <Class IRI="#MeatTopping"/>
</Declaration>
<Declaration>
    <Class IRI="#PizzaTopping"/>
</Declaration>
<Declaration>
    <Class IRI="#AmericanaPizza"/>
</Declaration>
<EquivalentClasses>
    <Class IRI="#NonVegetarianPizza"/>
    <ObjectIntersectionOf>
        <Class IRI="#Pizza"/>
        <ObjectComplementOf>
            <Class IRI="#VegetarianPizza"/>
        </ObjectComplementOf>
    </ObjectIntersectionOf>
</EquivalentClasses>
<EquivalentClasses>
    <Class IRI="#VegetarianPizza"/>
    <ObjectIntersectionOf>
        <Class IRI="#Pizza"/>
        <ObjectAllValuesFrom>
            <ObjectProperty IRI="#hasTopping"/>
            <Class IRI="#VegetableTopping"/>
        </ObjectAllValuesFrom>
    </ObjectIntersectionOf>
</EquivalentClasses>
<SubClassOf>
    <Class IRI="#AmericanaPizza"/>
    <Class IRI="#Pizza"/>
</SubClassOf>
<SubClassOf>
    <Class IRI="#AmericanaPizza"/>
    <ObjectSomeValuesFrom>
        <ObjectProperty IRI="#hasTopping"/>
        <Class IRI="#MeatTopping"/>
    </ObjectSomeValuesFrom>
</SubClassOf>
<SubClassOf>
    <Class IRI="#AmericanaPizza"/>
    <ObjectAllValuesFrom>
        <ObjectProperty IRI="#hasTopping"/>
        <Class IRI="#MeatTopping"/>
    </ObjectAllValuesFrom>
</SubClassOf>
<SubClassOf>
    <Class IRI="#MeatTopping"/>
    <Class IRI="#PizzaTopping"/>
</SubClassOf>
<SubClassOf>
    <Class IRI="#SohoPizza"/>
    <Class IRI="#Pizza"/>
</SubClassOf>
<SubClassOf>
    <Class IRI="#SohoPizza"/>
    <ObjectSomeValuesFrom>
        <ObjectProperty IRI="#hasTopping"/>
        <Class IRI="#VegetableTopping"/>
    </ObjectSomeValuesFrom>
</SubClassOf>
<SubClassOf>
    <Class IRI="#SohoPizza"/>
    <ObjectAllValuesFrom>
        <ObjectProperty IRI="#hasTopping"/>
        <Class IRI="#VegetableTopping"/>
    </ObjectAllValuesFrom>
</SubClassOf>
<SubClassOf>
    <Class IRI="#VegetableTopping"/>
    <Class IRI="#PizzaTopping"/>
</SubClassOf>
<InverseObjectProperties>
    <ObjectProperty IRI="#hasTopping"/>
    <ObjectProperty IRI="#isToppingOf"/>
</InverseObjectProperties>
<ObjectPropertyDomain>
    <ObjectProperty IRI="#hasTopping"/>
    <Class IRI="#Pizza"/>
</ObjectPropertyDomain>
<ObjectPropertyRange>
    <ObjectProperty IRI="#hasTopping"/>
    <Class IRI="#PizzaTopping"/>
</ObjectPropertyRange>
</Ontology>

【问题讨论】:

  • 声明 VegetableToppingDisjoint With MeatTopping
  • @StanislavKralin 非常感谢。这解决了问题。如果您将其添加为我会接受的答案。

标签: owl ontology protege complement reasoner


【解决方案1】:

此示例是标准 OWL 教程的一部分,请参阅 here。显然教程有点不一致。

VegetableTopping 声明为Disjoint With MeatTopping 即可解决问题。

【讨论】:

    猜你喜欢
    • 2023-03-20
    • 2023-03-20
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-09-20
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多