[Neo] Issues with overloaded methods

Tobias Ivarsson thobes at gmail.com
Mon Apr 9 23:28:46 CEST 2007


On 4/9/07, Johan Svensson <johan at neopersistence.com> wrote:
>
> On 4/9/07, Tobias Ivarsson <thobes at gmail.com> wrote:
> >
> > Hi!
> >
> > I am working on a Python frontend for Neo4J, which I call Neo4J.py, that
> > can
> > be used with either Jython [1] or a Python (CPython [3]) extension
> called
> > JPype [2].
>
>
> Excellent!
>
> However I am experiencing some strange problems when using JPype. When I
> try
> > to iterate over the result of a traverser I get an error message saying
> > that
> > JPype could not determine which, of more than one overloaded, next()
> > methods
> > it should choose. I have never had this problem with any other Iterator
> /
> > Iterable and JPype before, so I am trying to figure out what could be
> > causing this behavior.
> > My current theory is that some where in the type hierarchy of the actual
> > implementation of the Traverser there are two (or more) classes that
> > implement the Iterable interface, which would mean that there are
> several
> > next() methods.
> > Could anyone with access to the source please tell me whether this is
> the
> > case or not. Or send me some sort of preview version of the source so
> that
> > I
> > could investigate the matter on my own.
>
>
> In org.neo4j.impl.traversal package we have:
>
> public interface Traverser extends org.neo4j.api.core.Traverser
>
> abstract class AbstractTraverser implements Traverser,Iterator<Node>



Ah! this is probably the source of the problem. JPype implements ways of
iterating over both Iterator and Iterable via wrapping code. I am guessing
that since the Traverser Iterable is itself its own Iterator the object will
get wrapped twice which leads to the confusion. Now all I have to do is to
find a way to avoid that. Preferably without needing to patch neither JPype
nor Neo...

Thanks!
/Tobias

class BreadthFirstTraverser extends AbstractTraverser
>
> class DepthFirstTraverser extends AbstractTraverser
>
> The first interface (Traverser that extends api.core.Traverser) is just
> old
> stuff that hasn't been removed yet since the recent update of the Neo API.
> Implementation of Iterator interface lies in AbstractTraverser, the two
> concrete classes (that gets instantiated depending on
> BREADTH_FIRST/DEPTH_FIRST traverser) don't override any of the Iterator
> interface methods.
>
> I will submit a link to the source code of my project on this list as soon
> > as a have added some license notes to my files and perhaps written some
> > documentation.
> >
> > best regards
> > Tobias Ivarsson
> >
> > [1] http://www.jython.org/
> > [2] http://jpype.sourceforge.net/
> > [3] http://www.python.org/
> >
>
> Great, as you probably already know we are waiting for the GPLv3 to be
> released before we release the source for Neo. If my description above
> wasn't enough I can send you the source code under a proprietary license.
>
> --
> Johan
> _______________________________________________
> Neo mailing list
> User at lists.neo4j.org
> https://lists.neo4j.org/mailman/listinfo/user
>


More information about the User mailing list