'Recursive' queries


Just wondering if it is possible to write ‘recursive’ queries. I have an entity ‘frame’ that can be related to other ‘frame’. And this ‘frame’ to another (something like ‘frameA’ -> ‘frameB’ -> ‘frameC’ -> ‘frameD’) forming a kind of ‘hierarchy’. If I have the id of ‘frameA’ is it possible to recover all the related frames using a single query?


Hi @elymatos

It is possible if you use an inference-rule that makes the relation that links two frame transitive:

say that the relation linking two frames is called linked-frame and has two roles: previous-frame and following-frame. Then, if you

insert $x isa inference rule when {(previous-frame: $f1, following-frame: $f2) isa linked-frame; (previous-frame: $f2, following-frame: $f3) isa linked-frame;} then {(previous-frame: $f1, following-frame: $f3) isa linked-frame;};

And then every following frame will be linked to the previous frame.

Hope that it is clear enough,