I have RDF like this:
<companyA> <heldBy> "companyB" .
<companyA> <heldBy> "companyC" .
<companyB> <heldBy> "companyD" .
It's a stockholder relation, what I wanna do is to query all holders of companyA
and mark them by level.
For example, companyB
is level 1, companyD
is level 2.
How can I do this with sparql
? Or is it doable with sparql
?
Thanks for the help!
According to the comment section, I think this might be doable with querying all holders with select ?holder where { <companyA> <heldBy>+ ?holder }
.
Then calculate the length of the path to these nodes, sort them into levels.
Might even do this with SPARQL only, working on it.
Thanks again for the help!