使用OWL和RDF描述推断属性的正确方法
我正在尝试使用OWL编写一个推理规则 鉴于以下情况:使用OWL和RDF描述推断属性的正确方法,rdf,owl,rdfs,graphdb,Rdf,Owl,Rdfs,Graphdb,我正在尝试使用OWL编写一个推理规则 鉴于以下情况: 一份文件被归类为一个类别——比如说“合同法” 有一个父类“法律”,其中“合同法”是一个子类 我想推断该文件也属于“法律”类别 声明: @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 : <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 .
但我没有看到任何推断语句(我使用的是GraphDB)
owl:propertyChainAxiom
是正确的方法吗?
我的turtle语法错了吗?我没有考虑
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 ) .
将这些类别建模为OWL类或查看(您应该为您的存储库选择OWL-RL GraphDB“规则集”)。很抱歉,我不确定“将这些类别建模为OWL类”是什么意思。不是吗?我的意思是,作为文档类,
doc1a:Document,:Category1
。你得原谅我,我还是不懂。这与使用rdf:type语句定义它们不同吗?请尽可能明确-谢谢!
:hasParentCategory rdf:type owl:ObjectProperty ;
owl:inverseOf :hasChildCategory .
:documentHasInferredCategory rdf:type owl:ObjectProperty ;
rdfs:domain :Document ;
rdfs:range :Category ;
owl:propertyChainAxiom ( :documentHasCategory :hasParentCategory ) .