首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >OWL Ontology:如何编写补充类定义?

OWL Ontology:如何编写补充类定义?
EN

Stack Overflow用户
提问于 2019-02-21 20:07:33
回答 1查看 371关注 0票数 0

推理机无法将类分类到A类下,A类被定义为另一类B的补集。

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

披萨有两类: Americana和Soho,前者配以肉的配料,后者加蔬菜配料。然后有两类: VegetarianPizza定义为有蔬菜配料的披萨,NonVegetarianPizza定义为不是VegetarianPizza的披萨。Soho被正确地归类为VegetarianPizza,但是Americana没有被归类为NonVegetarianPizza。

有没有人能解释一下出了什么问题?

代码如下:

代码语言:javascript
复制
<?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>
EN

回答 1

Stack Overflow用户

发布于 2019-02-21 22:25:35

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

VegetableTopping声明为Disjoint With MeatTopping解决了这个问题。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/54806697

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档