I'd like to take a stab at implementing traversals in the Enhanced API. One of
the things I'd like to do, is to make traversals composable.
Right now a Traverser is created by either calling the traverse method on Node,
or to call the traverse(Node) method on TraversalDescription.
This makes traversals inherently non-composable, so we can't define a single
traversal that returns the parents of all our friends.
To make Traversers composable we need a function:
Traverser traverse(Traverser, TraversalDescription)
My take on it is to make Element (which is a superinterface of Node) into a
Traverser.
Traverser is basically another name for Iterable<Path>.
Every Node (or more generally every Element) can be seen as an Iterabe<Path>,
returning a single Path, which contains a single path-element, the Node/Element
itself.
Composing traversals would entail the concatenation of the paths returned with
the paths supplied, so when we ask for the parents of all our friends, the
returned paths would take the form:
Node --FRIEND--> Node --> PARENT --> Node
Niels
_______________________________________________
Neo4j mailing list
[email protected]
https://lists.neo4j.org/mailman/listinfo/user