Hi, In your current model you have only links from children to parents, but don't from parents to children. However the second one is required for your query.
You can add this relationship as a List<Item> children, but in this case you have to manually support bidirectional relationship. The better way would be use graph api. E.g.: Make Item a vertex type and connect items to its parents by edges. Best regards, Artem Orobets * Orient Technologiesthe Company behind OrientDB* 2014-02-11 8:13 GMT+02:00 BK <[email protected]>: > Given a domain object "Item": > class Item > { > @Id > private String id; > > private Item parent; > // get, set methods > } > > and assuming that a tree of Items (of arbitrary breadth/depth) has been > constructed, what would be the OrientDB query (e.g., traverse command) to > retrieve all Items that are below a particular "root" Item, regardless of > depth? In other words, a query that will return all > children/grandchildren/etc. below a particular "parent" Item. The purpose > is to avoid manual recursion in assembling the collection of all Items with > a particular ancestor. I'm attempting to use the traverse command, but so > far my query is only returning the first-level children. > > -- > > --- > You received this message because you are subscribed to the Google Groups > "OrientDB" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > For more options, visit https://groups.google.com/groups/opt_out. > -- --- You received this message because you are subscribed to the Google Groups "OrientDB" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/groups/opt_out.
