You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tinkerpop.apache.org by Michael Marcal <mi...@gmail.com> on 2015/04/10 03:41:47 UTC
Re: [TinkerPop3] No more __ (or, if you want, its there).
Hi Marko:
I'm using the 3.0.0.M7 release on Maven, and seem to have run into the
problem of not having __ available. I think that's to be expected since
that release was dated 1/29, and your post is 1/29. Is there an updated
maven release with this fix?
On Thursday, January 29, 2015 at 7:42:08 AM UTC-5, Marko A. Rodriguez wrote:
>
> Hi,
>
> I was laying awake and thought: "Huh, how does JUnit work with all the
> assertEquals()-stuff? static methods……?" To the computer I go. Sure enough,
> slickery trickery tock, the __ is now knocked.
>
> I removed AnonymousGraphTraversal and its Tokens.__. In its place, there
> is now a class called __ which has all the GraphTraversal methods
> implemented as static methods. Check it out:
>
>
> https://github.com/tinkerpop/tinkerpop3/blob/master/gremlin-core/src/main/java/com/tinkerpop/gremlin/process/graph/__.java
>
> Now, you can choose what you want to do.
>
> gremlin> g.V().repeat(out()).times(2).values("name")
> ==>ripple
> ==>lop
> gremlin> g.V().repeat(__.out()).times(2).values("name")
> ==>ripple
> ==>lop
>
>
> You decide via imports. In fact, you can have both models in the same
> class if you want. Just do:
>
> import com.tinkerpop.gremlin.process.graph.__ // __.out()
> import static com.tinkerpop.gremlin.process.graph.__.* // out()
>
>
> Here is the one crappy thing. In Groovy, "as" and "in" are keywords, thus,
> if you have to start an anonymous traversal with as() or in(), you need
> __.as() or __.in().
>
> gremlin> g.V().repeat(in()).times(2)
> groovysh_parse: 2: unexpected token: in @ line 2, column 14.
> g.V().repeat(in()).times(2)
> gremlin> g.V().repeat(__.in()).times(2)
> ==>v[1]
> ==>v[1]
>
>
> Of course, this "as"/"in"-issue does not effect Gremlin-Java. For once,
> Gremlin-Java has a more elegant look and feel than Gremlin-Groovy!
>
> Docs have been updated accordingly:
> http://www.tinkerpop.com/docs/3.0.0-SNAPSHOT
>
> Enjoy,
> Marko.
>
> http://markorodriguez.com
>
>
Re: [TinkerPop3] No more __ (or, if you want, its there).
Posted by Daniel Kuppitz <me...@gremlin.guru>.
Hi Michael,
__ is available in M7 [1], make sure it's imported.
[1]
https://github.com/apache/incubator-tinkerpop/blob/3.0.0.M7/gremlin-core/src/main/java/com/tinkerpop/gremlin/process/graph/AnonymousGraphTraversal.java#L35
Cheers,
Daniel
On Fri, Apr 10, 2015 at 3:41 AM, Michael Marcal <michael.marcal.sr@gmail.com
> wrote:
> Hi Marko:
>
> I'm using the 3.0.0.M7 release on Maven, and seem to have run into the
> problem of not having __ available. I think that's to be expected since
> that release was dated 1/29, and your post is 1/29. Is there an updated
> maven release with this fix?
>
>
> On Thursday, January 29, 2015 at 7:42:08 AM UTC-5, Marko A. Rodriguez
> wrote:
>>
>> Hi,
>>
>> I was laying awake and thought: "Huh, how does JUnit work with all the
>> assertEquals()-stuff? static methods……?" To the computer I go. Sure enough,
>> slickery trickery tock, the __ is now knocked.
>>
>> I removed AnonymousGraphTraversal and its Tokens.__. In its place, there
>> is now a class called __ which has all the GraphTraversal methods
>> implemented as static methods. Check it out:
>>
>> https://github.com/tinkerpop/tinkerpop3/blob/master/
>> gremlin-core/src/main/java/com/tinkerpop/gremlin/process/graph/__.java
>>
>> Now, you can choose what you want to do.
>>
>> gremlin> g.V().repeat(out()).times(2).values("name")
>> ==>ripple
>> ==>lop
>> gremlin> g.V().repeat(__.out()).times(2).values("name")
>> ==>ripple
>> ==>lop
>>
>>
>> You decide via imports. In fact, you can have both models in the same
>> class if you want. Just do:
>>
>> import com.tinkerpop.gremlin.process.graph.__ // __.out()
>> import static com.tinkerpop.gremlin.process.graph.__.* // out()
>>
>>
>> Here is the one crappy thing. In Groovy, "as" and "in" are keywords,
>> thus, if you have to start an anonymous traversal with as() or in(), you
>> need __.as() or __.in().
>>
>> gremlin> g.V().repeat(in()).times(2)
>> groovysh_parse: 2: unexpected token: in @ line 2, column 14.
>> g.V().repeat(in()).times(2)
>> gremlin> g.V().repeat(__.in()).times(2)
>> ==>v[1]
>> ==>v[1]
>>
>>
>> Of course, this "as"/"in"-issue does not effect Gremlin-Java. For once,
>> Gremlin-Java has a more elegant look and feel than Gremlin-Groovy!
>>
>> Docs have been updated accordingly:
>> http://www.tinkerpop.com/docs/3.0.0-SNAPSHOT
>>
>> Enjoy,
>> Marko.
>>
>> http://markorodriguez.com
>>
>>