首页 文章

用 OWL 和 RDF 描述推断属性的正确方法

提问于
浏览
0

我正在尝试使用 OWL 编写推理规则。

鉴于以下内容:

  • 文件被归类为具有类别 - 让我们说“合同法”

  • 有一个父类别“法律”,“合同法”作为 sub-category

  • 我想推断该文件也被归类为“法律”

声明:

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

:Document rdf:type owl:Class .
:Category rdf:type owl:Class .

:documentHasCategory rdf:type owl:ObjectProperty ;
                rdfs:domain :Document ;
                rdfs:range :Category .

:hasSubCategory rdf:type owl:ObjectProperty ;
                rdfs:domain :Category ;
                rdfs:range :Category .

:category1 rdf:type :Category ;
      rdfs:label "Law" ;
      :hasSubCategory :category2 .

:category2 rdf:type :Category ;
      rdfs:label "Contract Law".

:doc1 rdf:type :Document ;
     :documentHasCategory :category2 .

我应该如何编写推理声明以在文档中添加“法律”类别?我试过了:

:inferredCategory rdf:type owl:ObjectProperty ;
                 rdfs:domain :Document ;
                 rdfs:range :Category ;
                 owl:propertyChainAxiom ( :documentHasCategory :hasSubCategory ) .

但我没有看到任何推断语句(我正在使用 GraphDB)。

owl:propertyChainAxiom是接近这个的正确方法吗?我的乌龟语法错了吗?

1 回答

  • 0

    我不尊重hasSubCategory谓词的方向,因此没有任何实际上与 propertyChain 规则相匹配。

    像这样定义推理就可以了:

    :hasParentCategory rdf:type owl:ObjectProperty ;
        owl:inverseOf :hasChildCategory .
    
    :documentHasInferredCategory rdf:type owl:ObjectProperty ;
                    rdfs:domain :Document ;
                    rdfs:range :Category ;
                    owl:propertyChainAxiom ( :documentHasCategory :hasParentCategory ) .
    

相关问题