Yes, FYI that's the exact thing we've been discussing :)

2011/7/29 Niels Hoogeveen <pd_aficion...@hotmail.com>

>
> Great, I would much rather see this become part of the core API than have
> this as part of the Enhanced API.
> To make things work correctly, one important change to core is needed: The
> Node interface needs to extends Traverser (the interface in
> org.neo4j.graphdb.traversal, not the one in org.neo4j.graphdb).
> This is actually not a big deal. There Traverser interface supports three
> methods:
> Iterator<path> iterator() [return 1 path with 1 element in the path, being
> the node itself]Iterable<Node> nodes() [return an iterable over the node
> itself]Iterable<Relationship> relationships() [return an empty iterable]
> With that addition, it's not all too difficult to enhance the current
> implementation of Traverser. It only adds one more iteration level over the
> current implementation. Instead of having one start node, we now have
> multiple start paths. When returning values from the Traverser, the start
> paths and the result paths need to be concatenated.
> In the new scenario, all "old" traverse() methods can remain the same,
> since Node becomes a Traverser, so those methods are just special cases
> where Iterable<Path> consists of 1 path, with just 1 element.
> Niels
> > Date: Fri, 29 Jul 2011 18:36:28 +0200
> > From: matt...@neotechnology.com
> > To: user@lists.neo4j.org
> > Subject: Re: [Neo4j] Composable traversals
> >
> > There have been thoughts a long while to make something like this with
> the
> > traversal framework, but time has never been allocated to evolve it. I'm
> > adding stuff to the framework in a side track and will surely add some
> > aspect of composable traversers also.
> >
> > 2011/7/29 Niels Hoogeveen <pd_aficion...@hotmail.com>
> >
> > >
> > > 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
> > > User@lists.neo4j.org
> > > https://lists.neo4j.org/mailman/listinfo/user
> > >
> >
> >
> >
> > --
> > Mattias Persson, [matt...@neotechnology.com]
> > Hacker, Neo Technology
> > www.neotechnology.com
> > _______________________________________________
> > Neo4j mailing list
> > User@lists.neo4j.org
> > https://lists.neo4j.org/mailman/listinfo/user
>
> _______________________________________________
> Neo4j mailing list
> User@lists.neo4j.org
> https://lists.neo4j.org/mailman/listinfo/user
>



-- 
Mattias Persson, [matt...@neotechnology.com]
Hacker, Neo Technology
www.neotechnology.com
_______________________________________________
Neo4j mailing list
User@lists.neo4j.org
https://lists.neo4j.org/mailman/listinfo/user

Reply via email to