1

I have the following sample KB:

(:Ethan, :rel1, :Peter)
(:Ethan, :rel2, :son)
(:Sienna, :rel3, :Josie)
(:Sienna, :rel4, :daughter)
(:Josie, :rel5, :Peter)
(:Josie, :rel6, :wife)

Now I need to find a property path (all related triples) from :son to :wife. What would be the SPARQL query for that?

The result should be like this:

(:Ethan, :rel2, :son)
(:Ethan, :rel1, :Peter)
(:Josie, :rel5, :Peter)
(:Josie, :rel6, :wife)
  • 2
    SPARQL is not the appropriate language for this, luckily you're using GraphDB which recently released a new feature for graph search: https://graphdb.ontotext.com/documentation/free/graph-path-search.html - so, using `path:allPaths` in combination with `path:bidirectional` and source/target will do the trick. Examples are in the link I shared – UninformedUser Jan 04 '22 at 07:33

0 Answers0