2011/1/3 Anders Nawroth <[email protected]>

> Hi!
>
> When using TraversalDescription.evaluator(), are there any guarantees
> regarding in which order the evaluators will be executed?
>

In the same order they were added

>
> My use case is that I have a base TraversalDescription which excludes
> the start position using Evaluators.excludeStartPosition(). Then I
> discovered that other TraversalDescriptions built from this one still
> need to take care of evaluating the start position.
>
> This fact was hidden because of that the traversal didn't throw any
> expection when invoking methods on the last relationship traversed, even
> when the last releationship was in fact null. (I checked that my code
> actually throws a NPE ... but the traverser swallows that one.)
>

I just tried it and my exceptions thrown from an Evaluator gets propagated
correctly:

        Evaluator e1 = new Evaluator() {
            public Evaluation evaluate( Path path ) {
                return Evaluation.INCLUDE_AND_CONTINUE;
            }
        };
        Evaluator e2 = new Evaluator() {
            public Evaluation evaluate( Path path ) {
                throw new RuntimeException();
            }
        };
        IteratorUtil.lastOrNull( Traversal.description().evaluator( e1
).evaluator( e2 ).traverse( db.getReferenceNode() ) );

Is there any way you could provide code here to trigger that case?


>
> I just don't like having to take care of the start position special case
> in each evaluator - is there any nice way I can avoid this?
>

I see your point, but if there are multiple evaluators they will be invoked
up until both PRUNE _and_ EXCLUDE have been returned. Then it can be certain
that it doesn't need to ask any other evaluator. Up until then evaluators
have to be invoked.


>
> /anders
> _______________________________________________
> Neo4j mailing list
> [email protected]
> https://lists.neo4j.org/mailman/listinfo/user
>



-- 
Mattias Persson, [[email protected]]
Hacker, Neo Technology
www.neotechnology.com
_______________________________________________
Neo4j mailing list
[email protected]
https://lists.neo4j.org/mailman/listinfo/user

Reply via email to