用OWL表示if-then语句? [英] Representing if-then sentence using OWL?

查看:78
本文介绍了用OWL表示if-then语句?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用基本的OWL,并且很容易表示一些简单的句子,例如"Songoku是一名讲师,他在教数学".

I am working with basic OWL, and it's quite easy to represent some simple sentence like "Songoku is a lecturer, he teaches Maths".

例如:

<owl:Class rdf:ID="Lecturer"></owl:Class>
<owl:Class rdf:ID="Subject"></owl:Class>
<owl:Property rdf:ID="teach">
   <rdfs:domain rdf:resource="#Lecturer"/>
   <rdfs:range rdf:resource="#Subject"/>
</owl:Property>

<Subject rdf:ID="Maths"></Subject>
<Lecturer rdf:ID="Songoku">
    <teach>
        <Subject rdf:about="#Maths"></Subject>
    </teach>
</Lecturer>

但是当我尝试代表这句话时,我遇到了一个问题:鲍勃是一名学生,如果鲍勃有5条狗,那么他至少有1只猫..

But I faced a problem when I tried to represent this sentence: Bob is a Student, If Bob has 5 dogs, then he has at least 1 cat..

你能告诉我一些建议吗?

Can you tell me some suggestion?

推荐答案

您可以使用通用子类公理在OWL中表示一些相当复杂的条件语句.让我们看几个例子.如果您尝试一些简单的事情,请说

You can represent some fairly complicated conditional sentences in OWL using general subclass axioms. Let's look at a few examples. If you were trying something a little bit simpler, say

Students with at least five dogs have at least one cat.

是量化条件的缩写:对于所有x,如果 x是至少有五只狗的学生,而然后 x至少有一只猫,则可以使用

which is shorthand for the quantified conditional "For all x, if x is a student with at least five dogs, then x has at least one cat, you can do this in OWL with

(Student and hasPet min 5 Dog) subClassOf (hasPet some Cat)

这两个都是匿名类表达式,但是您可以定义一些等效的类来简化一些事情:

Those are both anonymous class expressions, but you could define some equivalent classes to make some things simpler:

StudentWithAtLeastFiveDogs equivalentClass (Student and hasPet min 5 Dogs)
CatOwner equivalentClass (hasPet some Cat)
StudentWithAtLeastFiveDogs subClassOf CatOwner

现在,您的示例是 Bob是一名学生,如果Bob有5条狗,那么他至少有1只猫.那里有两个句子.第一个很容易被

Now, your example was Bob is a Student, If Bob has 5 dogs, then he has at least 1 cat. There are two sentences there. The first is easily encoded by

Bob a Student

第二个要复杂一些.您是说鲍勃是其中一员,如果他们至少有五只狗,那么他们至少有一只猫. (重要的)条件如果P那么Q"在逻辑上等同于析取词(不是P)或Q".因此,我们要说鲍勃是其中没有至少有五个点或 do 至少有一只猫的事物的成员.该类的表达式是

The second is a bit more complicated. You're saying that Bob is a member of the class of things which, if they have at least five dogs, they have at least one cat. A (material) conditional "If P then Q" is logically equivalent to the disjunction "(not P) or Q". So we're saying that Bob is a member of the class of things that either do not have at least five dots or that do have at least one cat. The class expression for that is

(not (hasPet min 5 Dog)) or (hasPet some Cat)

现在我们对鲍勃的了解是

Now our knowledge about Bob is that

Bob a Student
Bob a (not (hasPet min 5 Dog)) or (hasPet some Cat)

您可以为该匿名类表达式定义一个等效的类,但是我怀疑它将在大多数语言中非常自然地呈现.包含关于Bob的知识的本体是这样的( N3格式):

You could define an equivalent class for that anonymous class expression, but I doubt it will be rendered very naturally in most languages. Here's what an ontology containing that knowledge about Bob looks like (in the N3 format):

@prefix :        <http://www.example.com/example#> .
@prefix rdfs:    <http://www.w3.org/2000/01/rdf-schema#> .
@prefix owl:     <http://www.w3.org/2002/07/owl#> .
@prefix xsd:     <http://www.w3.org/2001/XMLSchema#> .
@prefix rdf:     <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .

<http://www.example.com/example>
      a       owl:Ontology .
:Cat  a       owl:Class .
:Student
      a       owl:Class .
:Dog  a       owl:Class .
:hasPet
      a       owl:ObjectProperty .
:Bob  a       :Student , owl:NamedIndividual ;
      a       [ a       owl:Class ;
                owl:unionOf ([ a       owl:Class ;
                            owl:complementOf
                                    [ a       owl:Restriction ;
                                      owl:minQualifiedCardinality
                                              "5"^^xsd:nonNegativeInteger ;
                                      owl:onClass :Dog ;
                                      owl:onProperty :hasPet
                                    ]
                          ] [ a       owl:Restriction ;
                            owl:onProperty :hasPet ;
                            owl:someValuesFrom :Cat
                          ])
              ] .

此方法可用于数据类型属性及其值的限制.例如,说如果鲍勃体重至少60公斤,那么他至少高180厘米",我们可以说鲍勃是一类事物的元素,如果体重至少60公斤,那么他们至少高度不超过180厘米或不超过60公斤或高度至少为180厘米的一类东西.在曼彻斯特语法中,类表达式看起来像

This same approach can be used for datatype properties and restrictions on their values. For instance, to say that "if Bob weighs at least 60kg, then he is at least 180cm tall," we can say that Bob is an element of the class of things that, if they weight at least 60kg, then they are at least 180cm tall, or equivalently, the class of things that either do not weight at least 60kg, or that are at least 180 cm tall. In the Manchester syntax, the class expression looks like

(not (hasWeight some int[>= 60])) or (hasHeight some int[>= 180])

本体的N3序列化的相关部分是:

The relevant portion from the N3 serialization of the ontology is:

:Bob  a       [ a       owl:Class ;
                owl:unionOf ([ a       owl:Class ;
                            owl:complementOf
                                    [ a       owl:Restriction ;
                                      owl:onProperty :hasWeight ;
                                      owl:someValuesFrom
                                              [ a       rdfs:Datatype ;
                                                owl:onDatatype xsd:int ;
                                                owl:withRestrictions
                                                        ([ xsd:minInclusive 60
                                                          ])
                                              ]
                                    ]
                          ] [ a       owl:Restriction ;
                            owl:onProperty :hasHeight ;
                            owl:someValuesFrom
                                    [ a       rdfs:Datatype ;
                                      owl:onDatatype xsd:int ;
                                      owl:withRestrictions
                                              ([ xsd:minInclusive 180
                                                ])
                                    ]
                          ])
              ] .

这篇关于用OWL表示if-then语句?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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