7

我需要推断一个人是另一个人的兄弟,如果他们有同一个父亲。

所以,如果我有这个:

巴特有霍默神父。

丽莎有荷马神父。

因为BartLisa有同一个父亲,我想推断:

丽莎有巴特哥哥。

有没有使用任何属性特征的方法来做到这一点?

4

4 回答 4

9

使用属性链和转换

Antoine Zimmermann 的回答是这个问题的一个很好的开端,并触及了解决此类任务所需的要点:

x到 x 的每个兄弟,都有一条hasFather o hasFather -1形式的路径。

但是,现在,这实际上并非仅适用于兄弟。对于所有兄弟姐妹和x本身都是如此。这意味着您将拥有hasSibling的以下定义:

hasSibling ≡ hasFather o hasFather -1

(实际上,这实际上只是hasPaternalSibling;更精确的定义将使用hasParent。)现在,使用它,您可以通过如下查询询问兄弟,他们只是男性的兄弟姐妹

(hasSibling 值 x) 和 Man

但是,最好定义一个适当的hasBrother属性。如果你有一个特殊的属性将每个Man与他自己联系起来,并且只将男性与他们自己联系起来,你可以使用属性链和hasSibling来做到这一点:

hasBrother ≡ hasSibling o specialProperty

事实上,这样的属性是我们从一种称为rolification的技术中得到的,该技术在一个问题OWL 2 rolification及其答案中得到了更多的描述。这个想法是,对于类Man,我们创建一个新属性r Man并添加等价:

Man ≡ r Man some Self

它说每个Man都通过r Man属性与他自己相关,并且只有Man的实例是这样连接的。这正是我们在上面的specialProperty中需要的属性。因此,我们最终得到了ManhasSiblinghasBrother的以下定义:

人的定义 hasSibling 的定义 hasBrother的定义

现在我们可以通过如下查询询问x的兄弟:

hasBrother -1值 x

例如,我们可以询问Greg的兄弟姐妹,并得到PeterGreg(他自己)和Bobby

查询示例

样本本体

这是 Turtle 中的本体:

@prefix :      <http://www.example.org/brady#> .
@prefix rdfs:  <http://www.w3.org/2000/01/rdf-schema#> .
@prefix brady: <http://www.example.org/brady#> .
@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#> .

brady:hasSibling  a             owl:ObjectProperty ;
        owl:propertyChainAxiom  ( brady:hasFather [ owl:inverseOf
                          brady:hasFather ] ) .

brady:Carol  a  owl:NamedIndividual , brady:Woman .

brady:hasBrother  a             owl:ObjectProperty ;
        owl:propertyChainAxiom  ( brady:hasSibling brady:r_Man ) .

<http://www.example.org/brady>
        a       owl:Ontology .

brady:Woman  a               owl:Class ;
        rdfs:subClassOf      brady:Person ;
        owl:equivalentClass  [ a               owl:Restriction ;
                               owl:hasSelf     true ;
                               owl:onProperty  brady:r_Woman
                             ] .

brady:hasFather  a  owl:ObjectProperty .

brady:Person  a  owl:Class .

brady:Man  a                 owl:Class ;
        rdfs:subClassOf      brady:Person ;
        owl:equivalentClass  [ a               owl:Restriction ;
                               owl:hasSelf     true ;
                               owl:onProperty  brady:r_Man
                             ] .

brady:r_Woman  a  owl:ObjectProperty .

brady:r_Man  a  owl:ObjectProperty .

brady:Marcia  a          owl:NamedIndividual , brady:Woman ;
        brady:hasFather  brady:Mike .

brady:Peter  a           owl:NamedIndividual , brady:Man ;
        brady:hasFather  brady:Mike .

brady:Jan  a             owl:NamedIndividual , brady:Woman ;
        brady:hasFather  brady:Mike .

brady:Cindy  a           owl:NamedIndividual , brady:Woman ;
        brady:hasFather  brady:Mike .

brady:Bobby  a           owl:NamedIndividual , brady:Man ;
        brady:hasFather  brady:Mike .

brady:Greg  a            owl:NamedIndividual , brady:Man ;
        brady:hasFather  brady:Mike .

brady:Mike  a   owl:NamedIndividual , brady:Man .
于 2013-10-24T13:31:05.330 回答
2

假设每个人都是自己的兄弟,姐妹也是兄弟:

:hasBrother  owl:propertyChainAxiom  (:hasFather [ owl:inverseOf :hasFather ]) .

几乎不可能更准确地定义 :hasBrother,不包括女性兄弟和自兄弟。但是你可以推断出 Lisa 的所有兄弟如下:

:Female  a  owl:Class .
:Male  a  owl:Class;
  owl:disjointWith  :Female .
:Lisa  a  :Female .
:Bart  a  :Male .
:Homer a  :Male .
:hasFather  a  owl:ObjectProperty;
  rdfs:range  :Male .
:hasBrother a  owl:ObjectProperty;
  rdfs:range  :Male .
:hasSiblingOrSelf  owl:propertyChainAxiom  ( :hasFather [ :hasFather ] ) .
:LisaBrother  owl:equivalentClass  [
    a  owl:Restriction;
    owl:onProperty  [ owl:inverseOf  :hasBrother ];
    owl:hasValue  :Lisa
  ], [
    a  owl:Class;
    owl:intersectionOf  (
      [ a owl:Restriction; owl:onProperty :hasSiblingOrSelf; owl:hasValue :Lisa ]
      :Male
    )
  ] .
于 2013-10-24T11:50:46.997 回答
1

一种方法是使用 SWRL 规则。

关于门徒:

  1. 去窗口
  2. 点击标签
  3. 单击“漩涡”选项卡
  4. 按“新建”按钮并编写以下规则

写规则:

isChildOf(?x,?y)^FatherOf(?y,?z)^differentFrom(?z,?x)->isBrotherOf(?x,?z)

这意味着如果“x 是 y 的子代”,并且“y 也是 z 的父代”并且“z 和 x 不同”,则“z 和 x 是兄弟”。

于 2020-05-11T23:17:20.433 回答
0

兄弟是男性兄弟姐妹。因此,我们应该同时定义“男性”和兄弟姐妹。但由于兄弟姐妹本身是同一父母的不同孩子,因此也应该定义为孩子。为简单起见,我们将同父异母的兄弟姐妹视为兄弟姐妹,将领域限制为人类,并将相关概念(如母性和父性)的明确定义放在一边。

1 定义人

  1. 创建一个Human
  2. 创建一个Gender与类不相交的Human类。创建malefemale作为个体实例化Gender类型(还有其他方法可以做到这一点,但这是一个非常简单的方法)。
  3. 创建一个hasGender对象属性,Human作为域Gender及其范围
  4. 创建一个Man类作为Human. 使其等价于Human and (hasGender value male).

2 定义孩子

  1. isChildOf使用 Human 为其域和范围创建一个Object 属性(可选:将Child类定义为等效于 的人类的子类型isChildOf some Human。以类似的方式,您还可以创建对象属性,然后为MotherParentDaughter等创建类)。

3 在 SWRL 的帮助下定义同级

  1. isSiblingOf首先,在 ProtegeHuman中为其域和范围创建一个非自反的对称对象属性。
  2. 在 Protege 顶部的菜单栏中,确保选中 Window -> tabs -> SWRLTab,然后找到并单击 SWRLTab 选项卡。
  3. 单击新建以创建新规则并添加规则:isChildOf(?sibling1, ?parent) ^ isChildOf(?sibling2, ?parent) ^ differentFrom(?sibling1, ?sibling2) -> isSiblingOf(?sibling1, ?sibling2) 您可能还想为您希望能够从兄弟关系中推断出的内容添加规则,例如isSiblingOf(?x, ?y) ^ isChildOf(?x, z?) -> isChildOf(?y, ?z)

4 定义为兄弟

  1. 使用域和范围isBrotherOf在 Protege 中创建对象属性ManHuman
  2. 在 SWRLTab 上,添加以下规则: Man(?x) ^ isSiblingOf(?x, ?y) -> isBrotherOf(?x, ?y)

isBrotherOf(?x, ?y) -> Man(?x)

isBrotherOf(?x, ?y) -> isSiblingOf(?x, ?y)

第一条规则规定任何男性兄弟姐妹都是兄弟。第二个和第三个从兄弟情谊中推断出男性和兄弟情谊。

  1. 可以选择创建一个Brother等效于的类isBrotherOf some Human来完成滚动过程。
于 2020-11-03T04:28:38.760 回答