我正在尝试为 Apache Jena 定义以下推理规则。我在混合模式下使用 GeneralRuleReasoner
[ aName:
(?aRelation meta:refersTo meta:SomeOntologyClass)
(?test rdfs:type dummy)
-> (?anotherRelation rdfs:type meta:SomeType)
(?anotherRelation meta:mainLabel "a"@fr)
(?anotherRelation meta:mainLabel "b"@en)
(?anotherRelation meta:mainLabel "c"@de)
(?anotherRelation rdfs:label "a"@fr)
(?anotherRelation rdfs:label "b"@en)
(?anotherRelation rdfs:label "c"@de)
(?test meta:has ?anotherRelation)
]
我也尝试过使用单引号。这失败并出现此错误:
[error] - 2020-01-23 17:10:14,655 [play-dev-mode-akka.actor.default-dispatcher-58] ERROR controllers.IndexController - Triple with 4 nodes!
我也尝试将它定义为
[ aName:
(?aRelation meta:refersTo meta:SomeOntologyClass)
(?test rdfs:type dummy)
-> (?anotherRelation rdfs:type meta:SomeType)
(?anotherRelation meta:mainLabel "a" lang:fr)
(?anotherRelation meta:mainLabel "b" lang:en)
(?anotherRelation meta:mainLabel "c" lang:de)
(?anotherRelation rdfs:label "a" lang:fr)
(?anotherRelation rdfs:label "b" lang:en)
(?anotherRelation rdfs:label "c" lang:de)
(?test meta:has ?anotherRelation)
]
这实际上不起作用,因为显然lang
只适用于查询 DSL。我还尝试执行以下操作:我在本体中定义了另一个类,该类带有我无法在推理规则中定义的标签和主标签,onto:
并向派生类添加属性。
[ aName:
(?aRelation meta:refersTo meta:SomeOntologyClass)
(?test rdfs:type dummy)
-> (?anotherRelation rdfs:type meta:SomeType)
(?anotherRelation meta:refersTo onto:UtilityClassCarryngLabels)
(?test meta:has ?anotherRelation)
]
这在某种意义上是有效的,即在尝试查询(SPARQL)三元组时创建了推理规则,但派生类的标签和主标签都没有出现。不过,我可以看到anotherR
它与test
.
所以我的问题是:在推理规则中定义标签(包括语言规范)的正确方法是什么?