Package org.neo4j.graphdb.traversal

Examples of org.neo4j.graphdb.traversal.Evaluator


            {
                indexedRelationshipIterator = indexedRelationship.iterator();
            }

            indexedRelationshipDestinationIterator = Traversal.description().depthFirst()
                .evaluator( new Evaluator()
                {
                    @Override
                    public Evaluation evaluate( Path path )
                    {
                        if ( path.length() == 0 )
View Full Code Here


      description = description.evaluator(evaluator);
    }
   
    // add predicates as evaluators
    for (final Predicate<Node> predicate : predicates) {
      description = description.evaluator(new Evaluator() {

        @Override
        public Evaluation evaluate(Path path) {
          Node endNode = path.endNode();
          if (predicate.evaluate(securityContext, endNode)) {
View Full Code Here

    TraversalDescription description = StructrApp.getInstance(securityContext).getGraphDatabaseService().traversalDescription()
      .breadthFirst()
      .uniqueness(Uniqueness.NODE_RECENT)
      .evaluator(Evaluators.excludeStartPosition())
      .evaluator(new Evaluator() {

        @Override
        public Evaluation evaluate(Path path) {

          // prune path at depth maxDepth
View Full Code Here

    return new TraversalDescriptionImpl()
        .breadthFirst()
        .relationships(
            DynamicRelationshipType.withName("HAS_FOLLOWING_INSTANCE"),
            Direction.INCOMING)
        .evaluator(new Evaluator() {
              @Override
              public Evaluation evaluate(Path path) {
               
                if (path.length() == 0) {
                  return Evaluation.EXCLUDE_AND_CONTINUE;
View Full Code Here

        this.time = time;
    }

    public Iterable<WeightedPath> findAllPaths( Node start, final Node end )
    {
        Evaluator evaluator = new Evaluator()
        {
            public Evaluation evaluate( Path path )
            {
                if ( path.length() == 8 ) return Evaluation.EXCLUDE_AND_PRUNE;
                return ( path.endNode().equals( end ) ? Evaluation.INCLUDE_AND_PRUNE
View Full Code Here

    Node geomNode = pipeFlow.getRecord().getGeomNode();
    Node node = geomNode.getSingleRelationship(OSMRelation.GEOM, Direction.INCOMING).getStartNode();

    TraversalDescription td = Traversal
      .description()
      .evaluator(new Evaluator() {
                @Override
                public Evaluation evaluate(Path path) {
                    if (path.length() > 0
                            && !path.relationships().iterator().next().isType(OSMRelation.NEXT)
                            && path.lastRelationship().isType(OSMRelation.NODE)) {
View Full Code Here

    }
   
    @Test
    public void testMaxDepthAndCustomPruneEvaluatorCombined()
    {
        Evaluator lessThanThreeRels = new Evaluator()
        {
            public Evaluation evaluate( Path path )
            {
                return IteratorUtil.count( path.endNode().getRelationships( Direction.OUTGOING ).iterator() ) < 3 ?
                        Evaluation.INCLUDE_AND_PRUNE : Evaluation.INCLUDE_AND_CONTINUE;
View Full Code Here

                new WrappedPruneEvaluator( pruning ) );
    }
   
    public TraversalDescription filter( Predicate<Path> filter )
    {
        Evaluator evaluator = null;
        if ( filter == Traversal.returnAll() )
        {
            evaluator = Evaluators.all();
        }
        else if ( filter == Traversal.returnAllButStartNode() )
View Full Code Here

    }

    @Test
    public void testNarrowingFilters()
    {
        Evaluator mustBeConnectedToK = new MustBeConnectedToNodeFilter( getNodeWithName( "k" ) );
        Evaluator mustNotHaveMoreThanTwoOutRels = new Evaluator()
        {
            public Evaluation evaluate( Path path )
            {
                return Evaluation.ofIncludes( IteratorUtil.count( path.endNode().getRelationships( Direction.OUTGOING ) ) <= 2 );
            }
View Full Code Here

TOP

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

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.