Reputation: 21
I have an entity type Node with recursive relationship called parent (inverse children). Now I want to get all entities which are directly or indirect below a certain node (i.e. branch root node) other entity.
Since I had no better idea, I created a entity type Position with a relationship node to entity type Node holding just one entity which is set to the certain branch root node.
In Node I want to create a Fetched Property isBelowBranchRootNode which should be true if node.parent == position.branchRootNode OR node.parent.isBelowBranchRootNode.
I cannot get it work. Any better ideas are much appreciated, too.
Upvotes: 0
Views: 206
Reputation: 70235
Your data structure is a forest? A set of root nodes with each root node having a tree of children? If so, add a 'root' relationship to each node. When you create a node as a child to parent, take the parent's root and give it to the new child too.
Upvotes: 0