1

是否可以在 Jena 中添加定义个人类型的规则?

例如

String r;
r = "[rule1: (?a example:drives ?b), (?b rdf:type example:Truck) -> 
        (?a rdf:type example:TruckDriver)]";
//then parse and send to reasoner...etc

我在网上找到的所有示例和文档都使用自定义规则来分配个人(对象属性)之间的关系,而不是用于将个人分配给类的此规则。

4

1 回答 1

0

我在网上找到的所有示例和文档都使用自定义规则来分配个人(对象属性)之间的关系,而不是用于将个人分配给类的此规则。

实际上,文档Reasoners and rule engine: Jena inference support给出了一些引入三元组的规则示例,其属性为rdf:type. 例如(来自该文档),RDFS 推理有一条规则说,“当与具有域的属性?x相关时,则具有类型:”?y?p?c?X?c

[rdfs2: (?x ?p ?y), (?p rdfs:domain ?c) -> (?x rdf:type ?c)]

在同一个示例块中,还有另外两个规则,其头部具有三元组,使用rdf:type

[rdfs3: (?x ?p ?y), (?p rdfs:range ?c) -> (?y rdf:type ?c)]
[rdfs9: (?x rdfs:subClassOf ?y), (?a rdf :type ?x) -> (?a rdf:type ?y)]

于 2014-03-02T21:30:46.360 回答