SPARQL查询传递不同版本的arq
基本上我在下面得到了一个 SPARQL 查询,它适用于 arq 2.8.8,但不适用于 arq2.8.4,因为它无法识别 + 符号。我真的想要一个可以在 arq 2.8.4 版本上运行的查询,该版本与我发布的版本类似。我发布的查询基本上找到了所有彼此相同的项目。例如,如果 a 与 b 相同且 b 与 c 相同,则查询将返回 a 的 b 和 c。
PREFIX owl: <http://www.w3.org/2002/07/owl#> SELECT * WHERE { ?x owl:sameas+ ?y }
Basically I got a SPARQL query below which works with the arq 2.8.8 but doesn't work with arq2.8.4 as it doesnt recognise the + symbol. I really want a query which can work on the arq 2.8.4 version which is similar to the one I posted. The query I posted basically finds all items which are the sameas each other. For eg if a is the sameas b and b is the sameas c, the query returns both b and c for a.
PREFIX owl: <http://www.w3.org/2002/07/owl#> SELECT * WHERE { ?x owl:sameas+ ?y }
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您使用的功能是 SPARQL 1.1,因此早期版本的 ARQ 不支持。编写接近您所做的查询的唯一方法是执行以下操作之一。
不同长度的联合路径
使用客户端代码
发出初始查询,如下所示:
制作
?y
值的列表,然后针对每个值发出以下形式的查询:在其中替换
<每次都使用列表中的一个值作为constant>
,然后将?y
的新值添加到列表中。使用这种方法唯一需要注意的是,您需要跟踪已经发出第二个查询的值,以节省重复查询的次数。
The feature you are using is SPARQL 1.1 and so was not supported by earlier versions of ARQ. The only way you can write a query that gets close to what you do is to do one of the following.
Union paths of different lengths
Use client side code
Issue an initial query as follows:
Make a list of
?y
values, then for each value issue a query of the form:Where you substitute
<constant>
for one of the values from the list each time and then add the new values of?y
to the list.Only thing you need to be careful of with this approach is that you keep track of values for which you've already issued the second query to save you repeating queries.