I'm not fully aware of your domain layout, but maybe add this:

    .uniqueness( Uniqueness.RELATIONSHIP_GLOBAL )

to your traversal description. The default (NODE_GLOBAL) may end up "hiding"
some of your nodes depending on your graph layout.

2011/4/5 Matěj Plch <plchm...@fit.cvut.cz>

> Well so lastRelationship() isnt the right one method I am looking for
> and I have to look for highest id manually.
> But I have problem that if I traverse in the way like Michael suggested:
>              Iterator<Node> i =
> Traversal.description().relationships(RelationshipTypes.TICKET_QUEUE,
> Direction.BOTH).relationships(RelationshipTypes.TICKET_STATUS,
> Direction.BOTH).
>                 relationships(RelationshipTypes.TICKET_TIMETAKEN,
> Direction.BOTH).
>                 traverse(ticketNode).nodes().iterator();
>
> The iterator gives me only 6 ancestors. But in Neoclipse I can see much
> more ancestor nodes which is right. Why this traverse gives me bad
> result? I need all nodes which are directly connected thought
> Relatioshiptypes TICKET_STATUS,TICKET_TIMETAKEN,TICKET_QUEUE with
> ticketNode...
>
> Dne 4.4.2011 13:59, Mattias Persson napsal(a):
> > 2011/4/4 Matěj Plch<plchm...@fit.cvut.cz>
> >
> >> Is it possible to use
> >>
> >> *Path.lastRelationship*()
> >>
> >> ?
> >> How does it take last Relationship? According to id, or how the graph is
> >> traversed?
> >>
> > It returns the last relationships in the current path, i.e. where the
> > traverser is a.t.m. So it already has a reference to it and just returns
> it.
> >
> >> Dne 26.3.2011 19:35, Michael Hunger napsal(a):
> >>> Sure, if the tree from your root node is just a cluster that is not
> >> connected anywhere else (with those 3 relationship-types) it should be
> as
> >> simple as.
> >>> (Just written from my head, so please check the correct syntax).
> >>>
> >>>
> >>
> Traversal.description().relationship(T1,OUTGOING).relationship(T2,OUTGOING).relationship(T3,OUTGOING).traverse(rootNode);
> >>> That returns an iterator of all paths going from your root node.
> >>>
> >>> You can limit the nodes with .uniqueness() and then add the path's
> >> (path.nodes()) to a set to collect all nodes.
> >>> For getting the one with the highest id, you can use
> >> java.util.Collections.max(collection, new Comparator<Node>(){});
> >>> How big is your tree?
> >>>
> >>> Something like that should be in Graph-Algo perhaps as "subgraph" or
> >> "tree".
> >>> HTH
> >>>
> >>> Michael
> >>>
> >>> Am 26.03.2011 um 19:26 schrieb Matěj Plch:
> >>>
> >>>> Thank you for so fast answer.
> >>>> I will look at it. I have milestone tomorrow so dont have a lot of
> >>>> time=) and have never worked with Groovy.
> >>>> Well so there isnt any simple method how to do it in classic neo4j
> Java
> >> API?
> >>>> Dne 26.3.2011 19:16, Saikat Kanjilal napsal(a):
> >>>>> You can do all of these things using gremlin and pipes.  Check out
> >> github for more details.
> >>>>> Sent from my iPhone
> >>>>>
> >>>>> On Mar 26, 2011, at 11:13 AM, Matěj Plch<plchm...@fit.cvut.cz>
> >> wrote:
> >>>>>> Hi, I have some graph and, part of it is a tree. I simple get root
> of
> >>>>>> this tree through id. How to simple tranverse only tree under this
> >> root
> >>>>>> node? From root goes three unique type relationship to three unique
> >>>>>> group type nodes. Under this three nodes are a lot of nodes. And I
> >> need
> >>>>>> to write a method which gives me all nodes under that group node.
> >>>>>> Second question is if its possible ho to get from this group noe
> with
> >>>>>> the highest id (last added).
> >>>>>> Matěj Plch
> >>>>>>
> >>>>>> _______________________________________________
> >>>>>> 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
> >>>> _______________________________________________
> >>>> 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
> >> _______________________________________________
> >> 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