SPARQL 查询中规则的使用
我想在我的本体中使用规则,以便在推理时我可以检索一些在三元组存储中未明确表达的信息。 我创建了一个基本本体,我想添加此规则:
Person(?p) ^ hasSibling(?p, ?s) ^ Man(?s) → hasBrother(?p, ?s)
我想要执行的 SPARQL 查询正在
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#>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
PREFIX prova: <http://www.example.it/prova/>
SELECT ?subject ?object
WHERE { ?subject prova:hasBrother ?object }
运行,但不会返回任何内容。当然,我已经为每个类创建了个体,但我没有创建涉及 hasBrother 的实例,因为这是我希望智能自行检索的内容。 那么,我的问题是:是否可以使用SPARQL查询来实现规则描述的推理?或者这些类型的推论只能通过专用的查询系统才能实现?例如,在 protegè 中,我了解了 SQWRL 选项卡。
我正在使用最新版本的 Protegè (5.5.0) 和最新版本的 SWRL 规则插件 (2.11)。我已经在 SWRL 选项卡中定义了规则。然后我尝试使用 SQWRL 选项卡执行查询,但出现与“无效查询名称”相关的奇怪错误,我不太明白。关于第二点的任何建议都会有所帮助。
I would like to use rules in my ontology so that at the moment of the inference I can retrieve some information not explicitly expressed in the triplestore.
I created a basic ontology and I want to add this rule:
Person(?p) ^ hasSibling(?p, ?s) ^ Man(?s) → hasBrother(?p, ?s)
The SPARQL query I would like to perform is
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#>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
PREFIX prova: <http://www.example.it/prova/>
SELECT ?subject ?object
WHERE { ?subject prova:hasBrother ?object }
Running this does not return anything. Of course, I have created the individuals for each class, but I have not created the instance that involves hasBrother, as this is what I want the intelligence to retrieve by itself.
So, my question is: is it possible to use SPARQL queries to achieve inference described by rules? Or these kind of inferences are only possible with a dedicated query system? In protegè I learn about the SQWRL tab for instance.
I am using the last version of Protegè (5.5.0) and the last version of the SWRL Rules plugin (2.11). I have defined the rule in the SWRL Tab. Then I tried the SQWRL tab to perform the query, but I get a strange error related to "invalid query name", which I don't really understand. Any suggestion about this second point would be helpful.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论