Package org.neo4j.graphdb

Examples of org.neo4j.graphdb.Node.traverse()


    }

    public Iterable<Node> getAllNodesAfter( final long timestamp )
    {
        Node startNode = getIndexedStartNode( timestamp );
        return startNode.traverse( Order.DEPTH_FIRST, new StopEvaluator()
        {
            public boolean isStopNode( TraversalPosition position )
            {
                if ( position.lastRelationshipTraversed() != null
                     && position.currentNode().equals( underlyingNode ) )
View Full Code Here


    }

    Iterable<Node> getAllTimeNodesAfter( final long timestamp )
    {
        Node startNode = getIndexedStartNode( timestamp );
        return startNode.traverse( Order.DEPTH_FIRST, new StopEvaluator()
        {
            public boolean isStopNode( TraversalPosition position )
            {
                if ( position.lastRelationshipTraversed() != null
                     && position.currentNode().equals( underlyingNode ) )
View Full Code Here

        {
            throw new IllegalArgumentException(
                    "Start time greater or equal to end time" );
        }
        Node startNode = getIndexedStartNode( startTime );
        return startNode.traverse( Order.DEPTH_FIRST, new StopEvaluator()
        {
            public boolean isStopNode( TraversalPosition position )
            {
                Relationship last = position.lastRelationshipTraversed();
                if ( last != null
View Full Code Here

    // Use a traverser to traverse all specific relationships that ending to
    // a specific node (our goal here is to find all teamate member of
    // Guillaume)
    System.out.println("** Use a traverser to traverse all specific relationships that ending to a specific node (our goal here is to find all teamate member of Guillaume)");
    Node guillaumeNode = graphDatabase.getNodeById(3);
    Traverser teammates = guillaumeNode.traverse(Order.BREADTH_FIRST, StopEvaluator.END_OF_GRAPH, ReturnableEvaluator.ALL_BUT_START_NODE, SocialNetworkRelationship.TEAMMATE, Direction.INCOMING);
    for (Node teammateMember : teammates) {
      System.out.printf("%s (NodeID=%s)\n", teammateMember.getProperty("MemberName"), teammateMember.getId());
    }

    // Finalize transaction
View Full Code Here

  }

  public Geometry decodeGeometry(PropertyContainer container) {
    Node node = testIsNode(container);
    CoordinateList coordinates = new CoordinateList();
    for (Node point : node.traverse(Order.DEPTH_FIRST, StopEvaluator.END_OF_GRAPH, ReturnableEvaluator.ALL_BUT_START_NODE,
            SimpleRelationshipTypes.FIRST, Direction.OUTGOING, SimpleRelationshipTypes.NEXT, Direction.OUTGOING)) {
      coordinates.add(new Coordinate((Double) point.getProperty("x"), (Double) point.getProperty("y"), (Double) point.getProperty("z")), false);
    }
    return getGeometryFactory().createLineString(coordinates.toCoordinateArray());
  }
View Full Code Here

    @Test
    public void testMultiRelDepthTraversal() throws Exception
    {
        Node root = this.buildIseTreePopulation();
        RelationshipType[] traversableRels = new RelationshipType[] { MyRelTypes.TEST };
        Traverser traverser = root.traverse( DEPTH_FIRST,
            StopEvaluator.END_OF_GRAPH, ReturnableEvaluator.ALL,
            traversableRels[0], Direction.BOTH );

        try
        {
View Full Code Here

                return position.depth() >= 2;
            }
        };

        // Create a traverser
        Traverser traverser = root.traverse( BREADTH_FIRST, stopEvaluator,
            ReturnableEvaluator.ALL, traversableRels[0], Direction.BOTH );

        try
        {
            this.assertNextNodeId( traverser, "1" );
View Full Code Here

                return position.returnedNodesCount() < 5;
            }
        };

        // Create a traverser
        Traverser traverser = root.traverse( BREADTH_FIRST, stopEvaluator,
            returnEvaluator, traversableRels[0], Direction.BOTH );

        try
        {
            this.assertLevelsOfNodes( traverser, new String[][] {
View Full Code Here

                return rel != null && rel.isType( MyRelTypes.TEST_TRAVERSAL );
            }
        };

        // Create a traverser
        Traverser traverser = root.traverse( BREADTH_FIRST, stopEvaluator,
            ReturnableEvaluator.ALL, traversableRels[0], Direction.BOTH,
            traversableRels[1], Direction.BOTH );

        try
        {
View Full Code Here

    public void testBruteBreadthTraversal() throws Exception
    {
        Node root = this.buildIseTreePopulation();
        RelationshipType[] traversableRels = new RelationshipType[] {
            MyRelTypes.TEST, MyRelTypes.TEST_TRAVERSAL };
        Traverser traverser = root.traverse( BREADTH_FIRST,
            StopEvaluator.END_OF_GRAPH, ReturnableEvaluator.ALL,
            traversableRels[0], Direction.BOTH, traversableRels[1],
            Direction.BOTH );

        try
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.