Search in sources :

Example 56 with Direction

use of org.neo4j.graphdb.Direction in project jo-client-platform by jo-source.

the class SyncNeo4JSimpleRelatedReaderServiceImpl method getAllRelatedNodes.

private List<Tuple<Node, Relationship>> getAllRelatedNodes(final List<Tuple<Node, Relationship>> parentNodes, final Tuple<RelationshipType, Direction> relation, final IExecutionCallback executionCallback) {
    final List<Tuple<Node, Relationship>> result = new LinkedList<Tuple<Node, Relationship>>();
    final RelationshipType relationshipType = relation.getFirst();
    final Direction direction = relation.getSecond();
    for (final Tuple<Node, Relationship> parentNodeTuple : parentNodes) {
        CapServiceToolkit.checkCanceled(executionCallback);
        final Node parentNode = parentNodeTuple.getFirst();
        for (final Relationship relationship : parentNode.getRelationships(direction, relationshipType)) {
            CapServiceToolkit.checkCanceled(executionCallback);
            result.add(new Tuple<Node, Relationship>(relationship.getOtherNode(parentNode), relationship));
        }
    }
    return result;
}
Also used : Node(org.neo4j.graphdb.Node) Relationship(org.neo4j.graphdb.Relationship) RelationshipType(org.neo4j.graphdb.RelationshipType) Direction(org.neo4j.graphdb.Direction) Tuple(org.jowidgets.util.Tuple) LinkedList(java.util.LinkedList)

Aggregations

Direction (org.neo4j.graphdb.Direction)56 Relationship (org.neo4j.graphdb.Relationship)28 Test (org.junit.Test)20 RelationshipType (org.neo4j.graphdb.RelationshipType)19 Node (org.neo4j.graphdb.Node)14 HashMap (java.util.HashMap)11 EigenvectorCentrality (org.neo4j.graphalgo.impl.centrality.EigenvectorCentrality)10 Test (org.junit.jupiter.api.Test)8 Map (java.util.Map)7 Transaction (org.neo4j.graphdb.Transaction)7 ArrayList (java.util.ArrayList)6 Dijkstra (org.neo4j.graphalgo.impl.shortestpath.Dijkstra)6 Collection (java.util.Collection)5 HashSet (java.util.HashSet)5 DoubleAdder (org.neo4j.graphalgo.impl.util.DoubleAdder)5 List (java.util.List)4 Neo4jAlgoTestCase (common.Neo4jAlgoTestCase)3 EnumMap (java.util.EnumMap)3 Assertions.assertThat (org.assertj.core.api.Assertions.assertThat)3 Stack (java.util.Stack)2