コード例 #1
0
 protected List<Node> getRelatedNodes(Node startNode, String type, Direction direction) {
   List<Node> result = new ArrayList<Node>();
   for (Relationship relationship :
       startNode.getRelationships(DynamicRelationshipType.withName(type), direction)) {
     result.add(relationship.getOtherNode(startNode));
   }
   return result;
 }
コード例 #2
0
 protected Relationship makeFriends(Node from, Node to, int years) {
   Relationship friendship = from.createRelationshipTo(to, KNOWS);
   friendship.setProperty("Friendship.years", years);
   return friendship;
 }