Query for all triples with the same subject, recursive?

should get you halfway there. We can then build subject level recursion using this information. Feel free to file an issue for the recursion part.