如何在本体的数据类型属性中表示数字间隔? [英] How to express numeric intervals in datatype property in the ontology?

查看:155
本文介绍了如何在本体的数据类型属性中表示数字间隔?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想做的是创建一个数据类型属性,该属性可以接受和识别数字间隔.例如,假设我具有温度"属性.在本体中,我想创建2个子属性"hot"和"cold".炎热的是温度20-30,寒冷的是0-19. 我目前正在做的是将一些属性设置为lowerlim和upperlim.但是,有没有更方便的方法可以直接通过属性来表达间隔呢?这样,当我查询"23"时,它将识别其热".有提示吗?

What I am trying to do is create a datatype property that accepts and recognizes numeric intervals. For example lets say I have the property "temperature". In the ontology I want to create 2 sub properties "hot" and "cold". Hot would be temperatures 20-30 and cold 0-19. What I am doing at the moment is having some properties set as lowerlim and upperlim. But is there a more convenient way to express intervals directly through the property? So that when I query for example "23" it would recognise its "hot". Any tips?

提前谢谢

推荐答案

这在OWL中非常简单,但是您期望的推断可能与我现在要解释的推断有些不同.

This is quite straightforward in OWL, however the kind of inferences you're expecting may be a little different to the ones I'll now explain.

在OWL中,您可以定义对数据类型属性的限制(如我之前显示的 ).

In OWL, you can define restrictions on datatype properties (as I've shown before).

但是,需要数据类型推理才能推断具有特定数据类型值的某些资源/个体属于某个类.请注意,并非所有的推理程序实现都支持此功能,但是我将重点介绍 Pellet .

However, datatype reasoning is required to infer that some resource/individual with a particular datatype value belongs to some class. Note that not all reasoner implementations support this, however I'll focus on Pellet, which does.

为了演示,我将创建一个小的OWL本体.我将以OWL/XML语法将其写出.会很长,但希望会解释它的完成方式.

To demonstrate, I'll create a small OWL ontology. I'll write it out in OWL/XML syntax. It will be long, but hopefully will explain how it's done.

首先,定义名为已修正'类>:

Firstly, define a 'reified' class called Temp:

<Declaration>
    <Class IRI="#Temp"/>
</Declaration>

接下来,两个子类分别称为HotCold:

Next, two sub-classes called Hot and Cold:

<Declaration>
    <Class IRI="#Hot"/>
</Declaration>

<SubClassOf>
    <Class IRI="#Hot"/>
    <Class IRI="#Temp"/>
</SubClassOf>

<Declaration>
    <Class IRI="#Cold"/>
</Declaration>

<SubClassOf>
    <Class IRI="#Cold"/>
    <Class IRI="#Temp"/>
</SubClassOf>

现在,我们可以定义名为tempDegC的数据类型属性:

Now, we can define our datatype property, called tempDegC:

<Declaration>
    <DataProperty IRI="#tempDegC"/>
</Declaration>

我还将创建几个使用此属性的个人,如下所示:

I'll also create a couple of individuals which use this property, as follows:

<Declaration>
    <NamedIndividual IRI="#x"/>
</Declaration>

<DataPropertyAssertion>
    <DataProperty IRI="#tempDegC"/>
    <NamedIndividual IRI="#x"/>
    <Literal datatypeIRI="&xsd;double">13.5</Literal>
</DataPropertyAssertion>

<Declaration>
    <NamedIndividual IRI="#y"/>
</Declaration>

<DataPropertyAssertion>
    <DataProperty IRI="#tempDegC"/>
    <NamedIndividual IRI="#y"/>
    <Literal datatypeIRI="&xsd;double">23.4</Literal>
</DataPropertyAssertion>

请注意,我尚未断言xy属于哪个类,只是它们具有某些xsd:double值的tempDegC.

如果此时我们要求推理机对本体进行分类,我们将看不到任何新的推论.

If we asked a reasoner to classify the ontology at this point, we wouldn't see any new inferences.

我们想要的是让推理机自动推断x属于类Cold,而y属于类Hot.

What we want is for the reasoner to automatically infer that x belongs to class Cold, and that y belongs to class Hot.

我们可以通过根据数据类型属性tempDegC限制类ColdHot定义来实现此目标,如下所示:

We can achieve this by restricting the definition of the classes Cold and Hot in terms of the datatype property tempDegC, as follows:

<EquivalentClasses>
    <Class IRI="#Cold"/>
    <DataSomeValuesFrom>
        <DataProperty IRI="#tempDegC"/>
        <DatatypeRestriction>
            <Datatype abbreviatedIRI="xsd:double"/>
            <FacetRestriction facet="&xsd;maxInclusive">
                <Literal datatypeIRI="&xsd;double">19.0</Literal>
            </FacetRestriction>
        </DatatypeRestriction>
    </DataSomeValuesFrom>
</EquivalentClasses>

在这里,此公理将Cold定义为"任何实例,该实例具有tempDegCxsd:double值为<= 19" .

Here, this axiom defines Cold as "any instance which has a tempDegC with a xsd:double value which is <= 19".

类似地,我们可以对Hot进行如下限制:

Similarly, we can restrict Hot as follows:

<EquivalentClasses>
    <Class IRI="#Hot"/>
    <DataSomeValuesFrom>
        <DataProperty IRI="#tempDegC"/>
        <DatatypeRestriction>
            <Datatype abbreviatedIRI="xsd:double"/>
            <FacetRestriction facet="&xsd;maxInclusive">
                <Literal datatypeIRI="&xsd;double">30.0</Literal>
            </FacetRestriction>
            <FacetRestriction facet="&xsd;minExclusive">
                <Literal datatypeIRI="&xsd;double">19.0</Literal>
            </FacetRestriction>
        </DatatypeRestriction>
    </DataSomeValuesFrom>
</EquivalentClasses>

在这里,此公理将Hot定义为"任何实例,该实例具有tempDegCxsd:double值是> 19<= 30" .

Here, this axiom defines Hot as "any instance which has a tempDegC with a xsd:double value which is > 19 and <= 30".

现在,有了这些定义,要求推理机对本体进行分类,就可以得出两个新的陈述:

Now, with these definitions, asking the reasoner to classify the ontology infers two new statements:

x : Cold

y : Hot

说明

获得这些推断的关键是使用EquivalentClasses来定义对ColdHot类的限制.通过使用EquivalentClasses而不是SubClassOf,我们表示在指定范围内具有tempdegC任何都属于该类.

A key to obtaining these inferences was the use of EquivalentClasses to define the restriction on Cold and Hot classes. By using EquivalentClasses instead of SubClassOf, we're saying that anything with a tempdegC within the specified ranges belongs in the class.

但是,如果我们改用SubClassOf来定义上述对ColdHot类的限制,则这只会限制ColdHot的实例遵守该约束,即所谓的必要条件,因为所有实例都必须遵守该限制.

If, however, we were to instead use SubClassOf in defining the restriction on Cold and Hot classes above, this would only restrict instances of Cold and Hot to abide by the constraint, a so-called necessary condition, in that it is necessary for all instances to abide by the restriction.

相反,EquivalentClasses定义了必要和所谓的 sufficient 条件:不仅所有实例都必须(必须)遵守限制条件,而且足够,如果任何个人(例如xy)满足限制,则他们也是成员.推理程序用来推断x : Coldy : Hot的正是充分条件.

In contrast, EquivalentClasses defines both necessary and so-called sufficient conditions: not only must all instances (necessarily) abide by the restriction, but it is sufficient that if any individual (such as x or y) meet the restrictions, that they are also members. It is this sufficient condition which the reasoner uses to infer that x : Cold and y : Hot.

此处是完整示例本体的链接.尝试将其加载到 Protege 中,并使用

A link to the full example ontology is here. Try loading it into Protege and classify it using the Pellet reasoner plugin.

请注意,我尝试使用 HermiT

Note that I tried classifying this ontology with HermiT and FaCT++ which otherwise failed to produce the inferences, throwing exceptions, indicating they do not support such datatype reasoning.

这篇关于如何在本体的数据类型属性中表示数字间隔?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆