This problem has a simple solution:

Remove neo4j-commons-1.0 from your classpath, it conflicts with the commons
classes in 1.1-SNAPSHOT (that have now moved into kernel).

Cheers,
Tobias

On Wed, Jun 30, 2010 at 12:24 PM, Christian Morgner <
[email protected]> wrote:

> Hi all,
>
> I encountered a problem with the new TraversalDescription API in
> 1.1-SNAPSHOT (1.1-20100628.145423-131), using neo4j-commons-1.0.
>
> The code
>
> TraversalDescription descr = TraversalFactory.createTraversalDescription()
>
>    .breadthFirst()
>    .expand(TraversalFactory.expanderForType(RelTypes.HAS_CHILD,
> Direction.OUTGOING))
>    .filter(getPredicateForTest(nodeTest))
> ;
>
>
> throws
>
> java.lang.InstantiationError: org.neo4j.commons.iterator.FilteringIterator
>        at
>
> org.neo4j.kernel.StandardExpander$RegularExpander.doExpand(StandardExpander.java:523)
>        at
>
> org.neo4j.kernel.StandardExpander$RelationsipExpansion.iterator(StandardExpander.java:145)
>        at
>
> org.neo4j.kernel.impl.traversal.ExpansionSourceImpl.expandRelationships(ExpansionSourceImpl.java:54)
>        at
>
> org.neo4j.kernel.impl.traversal.StartNodeExpansionSource.next(StartNodeExpansionSource.java:24)
>        at
>
> org.neo4j.kernel.PreorderBreadthFirstSelector.nextPosition(PreorderBreadthFirstSelector.java:29)
>        at
>
> org.neo4j.kernel.impl.traversal.TraverserImpl$TraverserIterator.fetchNextOrNull(TraverserImpl.java:139)
>        at
>
> org.neo4j.kernel.impl.traversal.TraverserImpl$TraverserIterator.fetchNextOrNull(TraverserImpl.java:75)
>        at
>
> org.neo4j.commons.iterator.PrefetchingIterator.hasNext(PrefetchingIterator.java:36)
>        at
> org.neo4j.commons.iterator.IteratorWrapper.hasNext(IteratorWrapper.java:23)
>
>
> on me when trying to iterate over the resulting Iterable<Node>, however
> with a simple inline implementation of the RelationshipExpander
>
> TraversalDescription descr = TraversalFactory.createTraversalDescription()
>
>    .breadthFirst()
>
>    .expand(new RelationshipExpander()
>    {
>            public Iterable<Relationship> expand(Node node)
>            {
>                return(node.getRelationships(RelTypes.HAS_CHILD,
> Direction.OUTGOING));
>            }
>
>            public RelationshipExpander reversed()
>            {
>                return(null);
>            }
>    }
>    )
>
>    .filter(getPredicateForTest(nodeTest))
> ;
>
>
> it works. Maybe this is a problem with
> TraversalFactory.expanderForTypes(RelationshipType t, Direction d), but
> I can't figure it out.. Am I missing something here? What is the best
> practice to create such a TraversalDescription?
>
> I also tried
>
> TraversalDescription descr = TraversalFactory.createTraversalDescription()
>
>    .breadthFirst()
>    .relationships(RelTypes.HAS_CHILD, Direction.OUTGOING)
>    .filter(getPredicateForTest(nodeTest))
> ;
>
>
> but got the same InstantiationError.
>
> Thanks,
> Christian
>
>
> _______________________________________________
> Neo4j mailing list
> [email protected]
> https://lists.neo4j.org/mailman/listinfo/user
>



-- 
Tobias Ivarsson <[email protected]>
Hacker, Neo Technology
www.neotechnology.com
Cellphone: +46 706 534857
_______________________________________________
Neo4j mailing list
[email protected]
https://lists.neo4j.org/mailman/listinfo/user

Reply via email to