Finding shortest path with SPARQL query
问题 I am trying to understand the computational limitations of the SPARQL query, and I would like know how to write a query that will determine if there is a directed path between two objects. I know a way to do it for a path of a specific length: 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>) }