0
votes

Let's say I have a graph like this:

:a :isConnectedTo :b
:b :isConnectedTo :c
:c :isConnectedTo :d

If I run the following query in my Stardog v4.1.3, it returns true

ask {:a :isConnectedTo* :d}

This is great but I would like to know the path between those two resources. Please notice that in my real case, there is potentially multiple paths but I just need one of them, not necessarily the shortest one.

Is there a way to achieve this with sparql ?

1
This has been answered already. - Ivo Velitchkov
fwiw, we're extending SPARQL for supporting paths (blog.stardog.com/a-path-of-our-own) - Michael

1 Answers

0
votes

I think this could work specifically for your case. Let me know if you succeed.

SELECT ?x ?y ?z WHERE {
    :a :isConnectedTo* ?x .
    ?x ?y ?z .
    FILTER(?y = :isConnectedTo)
    ?z :isConnectedTo* :d .
}