owl:查询中的TransitiveProperty [英] owl:TransitiveProperty in query

查看:180
本文介绍了owl:查询中的TransitiveProperty的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我做了一棵家谱.我还定义了传递属性:childOf.现在,我要进行SPARQL查询,该查询将给我一个家庭成员的所有后代.我该怎么做?谢谢

I have done a family tree. I also defined transitive property: childOf. Now I want to make SPARQL Query which give me all descendants of one of members of family. How can I do it? Thanks

推荐答案

如果您的三元组存储支持OWL推理,并且您已将childOf属性定义为可传递的(不应将其称为descendantOf !),那么它应该直接在所有相关节点之间推断childOf属性.因此,像这样查询它就足够了(为简洁起见,省略了前缀):

If your triple store supports OWL reasoning and you've defined your childOf property to be transitive (shouldn't it be called descendantOf by the way!), then it should infer childOf properties directly between all related nodes. So, it should be enough to query it like this (prefixes omitted for brevity):

SELECT DISTINCT * {
  ?x :childOf ?y
}

但是,如果您的三元组存储不执行OWL推理,则可以通过使用SPARQL 1.1属性路径查询间接关系来实现相同的结果:

However, if your triple store doesn't do OWL reasoning, you can achieve the same result by using SPARQL 1.1 property paths to query for indirect relationships:

SELECT DISTINCT * {
  ?x :childOf+ ?y
}

请注意在childOf之后的'+',这意味着谓词可以匹配1次或更多次.有关SPARQL 1.1属性路径的更多详细信息,请参见 http://www.w3.org/TR /sparql11-property-paths/.

Note the '+' after the childOf, this means that the predicate may be matched 1 or more times. More details about SPARQL 1.1 property paths are at http://www.w3.org/TR/sparql11-property-paths/.

这篇关于owl:查询中的TransitiveProperty的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆