You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tinkerpop.apache.org by Marko Rodriguez <ok...@gmail.com> on 2015/01/23 02:27:19 UTC

[TinkerPop3] Branch-Step Redesign -- union() and choose() are simply extension.

Hi,

Daniel and I have been working this afternoon and evening on making BranchStep better. Bob Briody mentioned earlier that as()-based navigation is nearly gutted save for back() and branch(). I was thinking about branch() and now that we can support nested traversals on OLAP, we don't need "teleport" capabilities as we no longer need to linearize traversals -- and we don't want the headache of arbitrary jumping. As such, is there an abstraction to ChooseStep and UnionStep, where ChooseStep == pick one branch and UnionStep == pick all branches, then lets do it --- that generalization is now BranchStep:

	https://github.com/tinkerpop/tinkerpop3/blob/master/gremlin-core/src/main/java/com/tinkerpop/gremlin/process/graph/step/branch/BranchStep.java

And you can see how simple ChooseStep and UnionStep are now:

	https://github.com/tinkerpop/tinkerpop3/blob/master/gremlin-core/src/main/java/com/tinkerpop/gremlin/process/graph/step/branch/ChooseStep.java
	https://github.com/tinkerpop/tinkerpop3/blob/master/gremlin-core/src/main/java/com/tinkerpop/gremlin/process/graph/step/branch/UnionStep.java

Tada! Moreover, notice ForkHolder. What is that all about? I'm glad you asked ---

	https://github.com/tinkerpop/tinkerpop3/blob/master/gremlin-core/src/main/java/com/tinkerpop/gremlin/process/graph/marker/ForkHolder.java

I don't like the name fork(), but now you no longer have to create that lame 'ol Map<M,Traversal> which is ugly in Java… Now you can just choose().fork().fork().fork(). Likewise for branch() and union(), though because union() is a fork on Pick.any, the var args union(traversal…) remains. Again, Daniel and I couldn't come up with a better name for fork(), so if someone has an idea, bust it out.

Here are the docs:
	http://www.tinkerpop.com/docs/3.0.0-SNAPSHOT/#lambda-steps (scroll down to branch() example)
	http://www.tinkerpop.com/docs/3.0.0-SNAPSHOT/#choose-step (lots of change here. notice no more Map<>….schweeeeet)
	http://www.tinkerpop.com/docs/3.0.0-SNAPSHOT/#union-step (nothing changed here because we kept the traversal var args method)

Finally, Daniel did some ballin' work on XOR computations using the new branch() work. We are on the precipice of unifying two seemingly distinction computations islands --- branch() and match().

Stoked. Enjoy!,
Marko.

http://markorodriguez.com


Re: [TinkerPop] Re: [TinkerPop3] Branch-Step Redesign -- union() and choose() are simply extension.

Posted by Daniel Kuppitz <da...@shoproach.com>.
Hi Matt,

it's very important to avoid conflicts with reserved keywords (of JVM 
languages). It can be quite annoying; I bet we already needed every keyword 
that currently exists (for, while, switch, case, to name a few) :)

Cheers,
Daniel


Am Freitag, 23. Januar 2015 19:49:32 UTC+1 schrieb Matt Frantz:
>
> On Friday, January 23, 2015 at 10:19:59 AM UTC-8, Marko A. Rodriguez wrote:
>>
>> Hi Matt,
>>
>> We just changed it to option().
>> branch().option().option().option()
>> choose().option().option().option()
>> The problem with "choice" is that is seems too tied to choose()-step.
>>
>> What do you think of option()?
>>
>>
> Yes, "option" works for me.  After I suggested "choice", I realized I 
> hadn't considered the other use cases (branch, union).  I think "case" also 
> has merit.  How important is it to avoid conflict with reserved words in 
> various languages? 
>

Re: [TinkerPop] Re: [TinkerPop3] Branch-Step Redesign -- union() and choose() are simply extension.

Posted by Matt Frantz <ma...@gmail.com>.
On Friday, January 23, 2015 at 10:19:59 AM UTC-8, Marko A. Rodriguez wrote:
>
> Hi Matt,
>
> We just changed it to option().
> branch().option().option().option()
> choose().option().option().option()
> The problem with "choice" is that is seems too tied to choose()-step.
>
> What do you think of option()?
>
>
Yes, "option" works for me.  After I suggested "choice", I realized I 
hadn't considered the other use cases (branch, union).  I think "case" also 
has merit.  How important is it to avoid conflict with reserved words in 
various languages? 

Re: [TinkerPop] Re: [TinkerPop3] Branch-Step Redesign -- union() and choose() are simply extension.

Posted by Marko Rodriguez <ok...@gmail.com>.
Hi Matt,

We just changed it to option().
	branch().option().option().option()
	choose().option().option().option()
The problem with "choice" is that is seems too tied to choose()-step.

What do you think of option()?

Thanks,
Marko.

http://markorodriguez.com

On Jan 23, 2015, at 11:09 AM, Matt Frantz <ma...@gmail.com> wrote:

> On Thursday, January 22, 2015 at 5:27:24 PM UTC-8, Marko A. Rodriguez wrote:
> [snip]
>  
> I don't like the name fork(), but now you no longer have to create that lame 'ol Map<M,Traversal> which is ugly in Java… Now you can just choose().fork().fork().fork(). Likewise for branch() and union(), though because union() is a fork on Pick.any, the var args union(traversal…) remains. Again, Daniel and I couldn't come up with a better name for fork(), so if someone has an idea, bust it out.
> [snip]
> 
> How about "choice"?  It seems to pair nicely (and grammatically) with "choose". 
> 
> -- 
> You received this message because you are subscribed to the Google Groups "Gremlin-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to gremlin-users+unsubscribe@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/gremlin-users/f99b69c5-3097-45ab-b76b-10c9a0de1ed3%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.