3

我使用 Protege 创建了一个本体。

课程 -

Person
   Man
   Woman

属性(域/范围)

Knows(Person / Person)
  hasRelationShip(Person / Person)
    hasParent(Person / Person)
      hasFather(Person / Man)
      hasMother(Person / Woman)
    hasChild(Person / Person)
      hasSon(Person / Man)
      hasDaughter(Person / Woman)

现在我在jena fuseki 中导入了这个本体。它使用 OWLMiniFBRuleReasoner 配置,然后创建了一些实例。

我有以下实例三倍

:Ravi rdf:type :Man .
:Anjani rdf:type :Man .
:Indra rdf:type :Woman .
:Ravi :hasFather :Anjani .
:Ravi :hasMother :Indra .

现在如果我查询

SELECT DISTINCT ?a ?b WHERE { 
  ?a :hasParent ?b
}

我得到结果

:Ravi - :Anjani
:Ravi - :Indra

如果我查询 -

SELECT DISTINCT ?a ?b WHERE { 
              ?a :hasChild ?b
            }

我得到结果 -

:Indra - :Ravi
:Anjani - :Ravi

但如果查询 -

SELECT DISTINCT ?a ?b WHERE { 
      ?a :hasSon ?b
    }

由于明显的原因,我没有得到任何结果。

所以问题是,有没有办法告诉推理者——

If (?a :hasChild ?b) and (?b rdf:type :Man)
Then ?a :hasSon ?b
4

1 回答 1

0

就在这里。假设您使用的是简单的 OWL,您可以像这样在 Protege 中对其进行建模:

  • 创建对象属性R_Man
  • 去上课人。部分EquivalentTo添加:

    R_Man some Self

  • 去物业hasSon。部分SuperPropertyOf (Chain),添加:

    hasChild o R_Man

不幸的是,这会给你一个循环依赖错误。我知道这并不理想,但如果你定义hasSonhasDaughter不是 的子属性hasChild,它会给你预期的结果。

于 2016-04-13T12:26:19.890 回答