You'd have to do the filtering/pruning in an evaluator, but the
sub-pathing afterwards, like:

   for ( Path path : description.traverse(...) )
   {
       path = subPath( path, 2 );
   }

    private Path subPath( Path source, int from )
    {
        if ( source.length() < from )
            throw new IllegalArgumentException( source + " isn't long
enough (" + from + ")" );

        Iterator<Node> nodes = source.nodes().iterator();
        Iterator<Relationship> relationships =
source.relationships().iterator();
        for ( int i = 0; i < from; i++ )
        {
            nodes.next();
            relationships.next();
        }
        PathImpl.Builder builder = new PathImpl.Builder( nodes.next() );
        while ( relationships.hasNext() )
        {
            builder = builder.push( relationships.next() );
        }
        return builder.build();
    }

Such a method should preferably be added to the Path interface,
Path#subPath or similar and it would be implemented much better also
:)

2011/4/7 Brendan Cheng <ccp...@gmail.com>:
> Hi,
>
> I would like to fetch a ending portion of a path where the timestamp
> of the relationship match.  for example:
>
> (Node 1)---<2pm>---->(Node 3)---<3PM>--->(Node 4)----<4PM>--->(Node 64)
>
> from the above , I only want the subpath starting from Node 4 onward
> for the timestamp greater than 3:30PM
>
>
> How could I code evaluator to do it?
>
> Thanks in advance,
>
> Brendan
> _______________________________________________
> Neo4j mailing list
> User@lists.neo4j.org
> https://lists.neo4j.org/mailman/listinfo/user
>



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

Reply via email to