在Protege中向OWL Ontology添加知识语句)

时间:2014-03-27 13:18:47

标签: owl ontology protege description-logic

在我的Ontology中,我有三个类, Player Team Competition 。我还有两个对象属性,使用 competesIn 使用的域 Team Player 的范围 competesIn 的域是 Team < / em> 播放器和范围比赛

我希望Ontology推断如果团队使用 Player 并且团队竞争中竞争< / em>然后播放器也参加比赛。是否有任何方法可以将此信息添加到Ontology,而无需为本体中的每个人添加{Player} competesIn {Competition}?

1 个答案:

答案 0 :(得分:9)

首先,如果您提供了最小的本体作为起点,那么回答这个问题会更容易。幸运的是,它非常简单。这是在Turtle序列化中:

@prefix :      <https://stackoverflow.com/q/22688901/1281433/competitions#> .
@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#> .

<https://stackoverflow.com/q/22688901/1281433/competitions>
        a       owl:Ontology .

:Player  a      owl:Class .
:Team   a       owl:Class .
:Competition  a  owl:Class .

:employs  a          owl:ObjectProperty ;
        rdfs:domain  :Team ;
        rdfs:range   :Player .

:competesIn  a       owl:ObjectProperty ;
        rdfs:domain  [ a            owl:Class ;
                       owl:unionOf  ( :Player :Team )
                     ] ;
        rdfs:range   :Competition .

我们实际上并不需要在属性上使用域和范围声明来完成这项工作,但我还是将它们包括在内,因为你提到了它们。你试图表达这样的说法:“如果球队雇佣球员并且球队参加比赛,那么球员将参加比赛。”从逻辑上讲,我们可以将其表示为:

  

雇用(?团队,?玩家)∧竞争(?团队,?竞争)→竞争(?玩家,?竞争)

描绘一下我们所拥有的关系以及我们想要获得的内容是有用的:

enter image description here

实心箭头是我们实际拥有的,虚线箭头是我们想要推断的。我们可以使用OWL中的子属性链来完成此操作。沿着实心箭头,从“玩家”到“竞争者”的路径或属性链。路径的第一条边沿反方向箭头,因此它是一个反向属性(使用 -1 ),第二条边沿着向前方向的箭头,它只是竞争。我们试图说,只要有这样的路径,就会在路径的起点和终点之间产生竞争关系。该链被写成“使用 -1 •competesIn”,我们想断言它是竞争对手的子属性:

  

使用 -1 •竞争激励竞争

在Protégé,这看起来像这样:

enter image description here

这给我们留下了最后的本体论:

@prefix :      <https://stackoverflow.com/q/22688901/1281433/competitions#> .
@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#> .

:Player  a      owl:Class .
:Team   a       owl:Class .
:Competition  a  owl:Class .

<https://stackoverflow.com/q/22688901/1281433/competitions>
        a       owl:Ontology .

:employs  a          owl:ObjectProperty ;
        rdfs:domain  :Team ;
        rdfs:range   :Player .

:competesIn  a                  owl:ObjectProperty ;
        rdfs:domain             [ a            owl:Class ;
                                  owl:unionOf  ( :Player :Team )
                                ] ;
        rdfs:range              :Competition ;
        owl:propertyChainAxiom  ( [ owl:inverseOf
                          :employs ] :competesIn ) .

限制适用于

的主题

在原始问题中没有提及,但在评论中显示,除了玩家之外的其他事情可以由团队使用,并且其中一些事情不应被推断为在竞争中竞争。这仍然可以处理,但它会更完整。诀窍是要意识到你需要一种新形式的公理:

  

p•使用 -1 •竞争激活竞争

其中p是一些特殊属性,将每个玩家与自己联系起来。构建这样的属性称为rolification。该技术已在另一个Stack Overflow问题OWL 2 rolification中进行了详细描述,以及与该问题相关联的学术出版物。还有一些其他answers on Stack Overflow涉及到滚动。还有some on answers.semanticweb.com。无论如何,我们的想法是定义一个新属性,对应于该类的 R Player ,并用公理定义类 Player

  

玩家≡R玩家一些自我

这说x是 Player 当且仅当 R Player (x,x)时,这才是我们的属性需要填写 p 。这为我们提供了以下本体论:

@prefix :      <https://stackoverflow.com/q/22688901/1281433/competitions#> .
@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#> .

<https://stackoverflow.com/q/22688901/1281433/competitions>
        a       owl:Ontology .

:R_Player  a    owl:ObjectProperty .

:employs  a          owl:ObjectProperty ;
        rdfs:domain  :Team ;
        rdfs:range   :Player .

:competesIn  a                  owl:ObjectProperty ;
        rdfs:domain             [ a            owl:Class ;
                                  owl:unionOf  ( :Player :Team )
                                ] ;
        rdfs:range              :Competition ;
        owl:propertyChainAxiom  ( :R_Player [ owl:inverseOf
                          :employs ] :competesIn ) .

:Team   a       owl:Class .

:Competition  a  owl:Class .

:Player  a                   owl:Class ;
        owl:equivalentClass  [ a               owl:Restriction ;
                               owl:hasSelf     true ;
                               owl:onProperty  :R_Player
                             ] .