Sulabh,
if you want to get the property relationships, I would either get
these during the iteration of the nodes you get back (thus in some way
duplicating the Evaluator in the result iteration, but you could
possibly refactor that into one method), or during the traversal build
up a resultset that contains both the nodes and the
relationship(properties) you need. That could possibly lead to memory
problems if the results are very big.

WDYT?

Cheers,

/peter neubauer

GTalk:      neubauer.peter
Skype       peter.neubauer
Phone       +46 704 106975
LinkedIn   http://www.linkedin.com/in/neubauer
Twitter      http://twitter.com/peterneubauer

http://www.neo4j.org               - Your high performance graph database.
http://startupbootcamp.org/    - Öresund - Innovation happens HERE.
http://www.thoughtmade.com - Scandinavia's coolest Bring-a-Thing party.



On Fri, Jul 22, 2011 at 8:37 PM, sulabh choudhury <[email protected]> wrote:
> Hi,
>
> I am trying to create a traverser and I am stuck.
> So my code takes in a startNode, 2 relationshiptypes and 2 directions.
> It will starting from startNode go to nodes with rel1 in dir1 and from all
> those nodes to rel2,dir2.
> The code below (in SCALA) works fine and I get the expected nodes.
>
> The issue is, along with the nodes I also need to get properties from the
> relationships. So all my relationshiptypes have certain properties (key,
> value), what I want is to get a particular property from rel1 and rel2. How
> do I do that?
>
>
>  def traverser(node: Node, rel1: RelationshipType, rel2: RelationshipType,
> dir1: Direction, dir2: Direction) = {
>
>   val q1 =  node.traverse(Order.BREADTH_FIRST, StopEvaluator.DEPTH_ONE,
> ReturnableEvaluator.ALL_BUT_START_NODE, rel1, dir1).iterator()
>
>    while(q1.hasNext){
>      val n = q1.next()
>      val q2 =
> n.traverse(Order.BREADTH_FIRST,StopEvaluator.DEPTH_ONE,ReturnableEvaluator.ALL_BUT_START_NODE,
> rel2, dir2).iterator()
>      while(q2.hasNext)
>           println(q2.next)
>   }
> }
> _______________________________________________
> Neo4j mailing list
> [email protected]
> https://lists.neo4j.org/mailman/listinfo/user
>
_______________________________________________
Neo4j mailing list
[email protected]
https://lists.neo4j.org/mailman/listinfo/user

Reply via email to