Java and loop relationships

7 views
Skip to first unread message

develope...@gmail.com

unread,
Apr 30, 2018, 2:08:28 PM4/30/18
to Neo4j
i am trying to do :

Node node1= parentNode.getSingleRelationship(RelationshipType.withName("SON"), Direction.OUTGOING).getStartNode();
node1.getRelationships(RelationshipType.withName("SON"),Direction.OUTGOING).forEach(Relationship xxx : yyy){};
the part that i am missing is xxx : yyy

idea?

Michael Hunger

unread,
Apr 30, 2018, 3:55:54 PM4/30/18
to ne...@googlegroups.com
Your startNode is the parent again. You have to access the endNode to get the sons.

and your forEach gets passed in the relationships, then you can access either start/end-nodes, types or properties.

If you're unsure about Java8 streams, there are tons of materials to look up syntax for forEach and the other operations.

Michael

--
You received this message because you are subscribed to the Google Groups "Neo4j" group.
To unsubscribe from this group and stop receiving emails from it, send an email to neo4j+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages