复杂的 SPARQL 查询构建起来很费力,而且难以阅读。有没有办法在 SPARQL 中“包含”子查询,例如使用“include queryX”行,这样可以避免每次在单独的更复杂的查询中写出重复的简单查询?
最佳答案
SPARQL FAQ提到了以下可能性:
A very limited form of subqueries can be accomplished with SPARQL engines that will perform HTTP GETs upon graphs named in FROM or FROM NAMED clauses by creating a URL consisting of an embedded SPARQL CONSTRUCT query submitted to a SPARQL endpoint and supplying this URL as part of the RDF dataset being queried. In practice, this technique is often inefficient and is subject to possible URL-maximum-length restrictions of the involved software.
W3C wiki还提到了一些其他可能的解决方法。
关于include - 包括来自单独文件的 sparql 子查询,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13198902/