【问题标题】:Class with custom rule in OWL ontologyOWL 本体中具有自定义规则的类
【发布时间】:2016-01-09 17:26:36
【问题描述】:

我已经使用 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

【问题讨论】:

    标签: owl ontology fuseki apache-jena


    【解决方案1】:

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

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

      R_Man some Self

    • 前往hasSon 的属性。部分SuperPropertyOf (Chain),添加:

      hasChild o R_Man

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2017-03-24
      • 2014-02-25
      • 1970-01-01
      • 2019-07-20
      • 2012-08-05
      • 2019-04-30
      • 1970-01-01
      相关资源
      最近更新 更多