小编Abr*_*man的帖子

使用SPARQL查询查找最短路径

我试图理解SPARQL查询的计算限制,我想知道如何编写一个查询来确定两个对象之间是否存在有向路径.

我知道如何为特定长度的路径执行此操作:

SELECT ?a ?b ?c ?d
WHERE { ?a  <http://graphtheory/hasNeighbor>  ?b . 
        ?b  <http://graphtheory/hasNeighbor>  ?c .
        ?c  <http://graphtheory/hasNeighbor>  ?d .
        FILTER (?a != ?c && ?b != ?d
                && ?a = <http://graphtheory/node/1>
                && ?d = <http://graphtheory/node/2>)
      }
LIMIT 10
Run Code Online (Sandbox Code Playgroud)

有没有办法在单个查询中搜索任何长度路径?这是不可能的SPARQL?

graph sparql shortest-path graph-algorithm

5
推荐指数
2
解决办法
3042
查看次数

标签 统计

graph ×1

graph-algorithm ×1

shortest-path ×1

sparql ×1