[Neo] First external committer?

Viktor Klang viktor.klang at gmail.com
Wed Nov 21 23:42:35 CET 2007


Addendum!

Actually, don't we actually want a Map<RelationshipType,Direction> ?
Or is there any meaning allowing for duplicates when specifying
RelationshipType + Direction pairs?

Best regards
-Viktor

On Nov 21, 2007 11:39 PM, Viktor Klang <viktor.klang at gmail.com> wrote:

>
>
> On Nov 21, 2007 11:31 PM, Emil Eifrem <emil at neotechnology.com> wrote:
>
> > On 11/21/07, Viktor Klang <viktor.klang at gmail.com> wrote:
> > > Okay, now I've made the TraverseSpecification into a standalone class
> > (One
> > > class, One file...)
> > >
> > > Now the syntax looks something like:
> > >
> > >         for(Node node : orderByBreadth()
> > >                         .include(MyRelTypes.FOO)
> > >                         .include( MyRelTypes.BAR, Direction.BOTH)
> > >                         .untilEndOfNetwork()
> > >                         .returnAll()
> > >                         .traverse(root))
> > >         {
> > >             System.err.println ("NodeName: " + node.getProperty
> > ("name"));
> > >         }
> >
> > Looks nice. We can discuss the details more in, uh, detail, later,
> > when we can look at actual API.
> >
> > >
> > >    And this is just the most simplified version, there is also:
> > >
> > >    orderBy(Order)
> > >    until(StopEvaluator)
> > >    returnAll(ReturnableEvaluator)
> > >    include(RelationshipType...)
> >
> > Not sure what you mean with this syntax (RelationshipType...), but
> > just one point: one of the main drawbacks with the node.traverse(...)
> > API is that it uses an Object vararg to express a variable-length list
> > of reltype/direction pairs.
>
>
> Today, the traverser does not enforce a Direction when passed a
> RelationshipType[] and a Direction[]
> when they are both of the same length:
>
> consider:
>
> RelationshipType[] types = {FOO,BAR};
> Direction[]             dirs = { null, INCOMING };
>
> node.traverse(.... types, dirs...) //This runs just fine.
>
> I decided not to break that in TraverseSpecification.
>
>
>
> >
> >
> > That design choice gives the obvious advantage of allowing a very nice
> > syntax for adding an arbitrary number of reltype/direction pairs which
> > works in a single-method (not fluent) world.
>
>
> Yeah, how come there is no java.util.Pair ?
>
>
>
> > The problem is that the
> > only common supertype of those two is Object and using Object varargs
> > is really a big no-no in most cases -- the main for us being that the
> > compiler won't warn you if you add only a reltype (without a
> > direction). Which really sucks.
>
>
> +1
>
>
> >
> >
> > At the end of the day, I decided that the benefits outweighed this
> > problem and went for it, hoping that IDEs would help us sort it out.
> > But if we make a fluent-style traverser config, then in my opinion, we
> > really should have the relationship specification methods use
> > reltype/direction pairs.
> >
> > Don't know if that's what you meant. But just thought I'd point that
> > out.
> >
>
> I recommend using include(RelationshipType,Direction) :)
>
> Cheerios!
>
> -Viktor
>
>
> >
> > Cheers,
> >
> > --
> > Emil Eifrém, CEO [emil at neotechnology.com]
> > Neo Technology, www.neotechnology.com
> > Cell: +46 733 462 271 | US: 206 403 8808
> > _______________________________________________
> > Neo mailing list
> > User at lists.neo4j.org
> > http://lists.neo4j.org/mailman/listinfo/user
> >
>
>


More information about the User mailing list