Package org.neo4j.graphdb.traversal

Examples of org.neo4j.graphdb.traversal.Traverser


        TraversalDescription traversalDescription = new TraversalDescriptionImpl()
                .order(Traversal.postorderBreadthFirst())
                .prune(Traversal.pruneAfterDepth(MAXIMUM_DEPTH))
                .filter(returnEval)
                .expand(Traversal.expanderForTypes(relType, Direction.BOTH));
        final Traverser traverser = traversalDescription
                .traverse(startNode);
        return traverser.nodes().iterator();
    }
View Full Code Here


    @Test
    public void testTraverseToNeighbour() {
        final Relationship rel = relationship();
        final TraversalDescription traversalDescription = RestTraversal.description().maxDepth(1).breadthFirst();
        System.out.println("traversalDescription = " + traversalDescription);
        final Traverser traverser = traversalDescription.traverse(rel.getStartNode());
        final Iterable<Node> nodes = traverser.nodes();
        Assert.assertEquals(rel.getEndNode(), nodes.iterator().next());
    }
View Full Code Here

                return ( path.endNode().equals( end ) ? Evaluation.INCLUDE_AND_PRUNE
                        : Evaluation.EXCLUDE_AND_CONTINUE );
            }
        };

        final Traverser traverser = TRAVERSAL.expand( expander ).order(
                new SelectorFactory( costEvaluator, time ) ).evaluator(
                evaluator ).traverse( start );

        return new Iterable<WeightedPath>()
        {
            public Iterator<WeightedPath> iterator()
            {
                return new StopAfterWeightIterator( traverser.iterator(), costEvaluator );
            }
        };
    }
View Full Code Here

    @Test
    public void testTraverseToNeighbour() {
        final Relationship rel = relationship();
        final TraversalDescription traversalDescription = RestTraversal.description().maxDepth(1).breadthFirst();
        System.out.println("traversalDescription = " + traversalDescription);
        final Traverser traverser = traversalDescription.traverse(rel.getStartNode());
        final Iterable<Node> nodes = traverser.nodes();
        Assert.assertEquals(rel.getEndNode(), nodes.iterator().next());
    }
View Full Code Here

       */
      @Test
      public void getNeoFriends() throws Exception {
          Node neoNode = restmdg.getNeoNode();
          System.out.println(neoNode.getProperty("name"));
          Traverser friendsTraverser = getFriends( neoNode );        
          int numberOfFriends = 0;             
          for ( Path friendPath : friendsTraverser ) {              
              numberOfFriends++;                
          }
        
View Full Code Here

       * get the number of all heroes that are connected to the heroes collection node
       * @throws Exception
       */
      @Test
      public void checkNumberOfHeroes() throws Exception {                        
          Traverser heroesTraverser = getHeroesViaRest();
          int numberOfHeroes = 0;             
          for ( Path heroPath : heroesTraverser ) {         
            numberOfHeroes++;                
          }
        
View Full Code Here

       * check if different REST Traversals for all heroes return the same
       * @throws Exception
       */
      @Test
      public void checkTraverseByPropertiesRest() throws Exception {       
          Traverser heroesTraverserRest = getHeroesViaRest();
          Traverser heroesTraverserByPropertiesRest = getHeroesByNodePropertiesViaRest();
          assertEquals( heroesTraverserRest.nodes().iterator().next(), heroesTraverserByPropertiesRest.nodes().iterator().next() );
      }
View Full Code Here

       * check if rest traversal and traversal via the collection node return the same result
       * @throws Exception
       */
      @Test
      public void checkTraverseByCollectionNode() throws Exception {       
          Traverser heroesTraverserRest = getHeroesViaRest();
          Traverser heroesTraverserByCollection = getHeroesByCollectionNodeViaRest();
          assertEquals( heroesTraverserRest.nodes().iterator().next(), heroesTraverserByCollection.nodes().iterator().next() );
      }     
View Full Code Here

            * @throws Exception
            */
           @Test
           public void getNeoFriends() throws Exception {
               Node neoNode = mdg.getNeoNode();            
               Traverser friendsTraverser = getFriends( neoNode );
               int numberOfFriends = 0;             
               for ( Path friendPath : friendsTraverser ) {              
                   numberOfFriends++;                
               }
             
View Full Code Here

            * get the number of all heroes that are connected to the heroes collection node
            * @throws Exception
            */
           @Test
           public void checkNumberOfHeroes() throws Exception {                        
               Traverser heroesTraverser = getHeroes();
               int numberOfHeroes = 0;             
               for ( Path heroPath : heroesTraverser ) {              
                 numberOfHeroes++;                
               }
             
View Full Code Here

TOP

Related Classes of org.neo4j.graphdb.traversal.Traverser

Copyright © 2018 www.massapicom. 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.