SPARQL recursive parent query

I am stuck in a recursive query in SPARQL, I tilt my head around it. I want to get all the ancestors of the instance " a" ( a hasParent b, b hasParent c, c hasParent d), so the result will be " b, c ,and d" if the instance is " a".

Any ideas on how to build a connected part where the parent has a parent that has another parent? (Depth of recursion unknown)

+4
source share
1 answer

See SPARQL property paths and operator . +

SELECT *
{ <a> <hasParent>+ ?ancestor }
+9
source

Source: https://habr.com/ru/post/1666394/


All Articles