我可能理解错了什么,所以请容忍我。
prefix sys: <http://www.ontotext.com/owlim/system#>
INSERT DATA {
<_:pets> sys:addRuleset
'''Prefices { ex : <http://www.example.com#> }
Axioms {}
Rules
{
Id: custom
a <ex:hasPet> b
------------------------------------
b <ex:hasOwner> a
}'''
}PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX ex: <http://www.example.com#>
PREFIX owl: <http://www.w3.org/2002/07/owl#>
INSERT DATA {
<ex:hasPet> a <owl:ObjectProperty>;
<rdfs:domain> <ex:Human>;
<rdfs:range> <ex:Pet>.
<ex:someHuman> <ex:hasPet> <ex:somePet>.
}PREFIX sys: <http://www.ontotext.com/owlim/system#>
INSERT DATA {
_:b sys:defaultRuleset "pets"
}PREFIX ex: <http://www.example.com#>
select * where {
<ex:somePet> ?p ?o .
} limit 100 若要返回以下推断的三重
但不幸的是,存储库中不存在推断的三元组。
你能帮帮我吗?有一个包含不同步骤的工作示例将帮助我在我的应用程序中获得规则。
提前感谢!亲切的问候
发布于 2022-11-23 08:16:39
规则集中的Prefixes部分中有多个问题,首先是IRIs必须不带尖括号地编写,例如使用ex : http://www.example.com#代替.
另外,您的数据和示例查询不使用前缀ex,而是绝对虹膜,例如,而不是
INSERT DATA {
<ex:hasPet> a <owl:ObjectProperty>;
<rdfs:domain> <ex:Human>;
<rdfs:range> <ex:Pet>.
<ex:someHuman> <ex:hasPet> <ex:somePet>.
}重写到
INSERT DATA {
ex:hasPet a owl:ObjectProperty;
rdfs:domain ex:Human;
rdfs:range ex:Pet.
ex:someHuman ex:hasPet ex:somePet.
}https://stackoverflow.com/questions/74538888
复制相似问题