gremlin_scala

30 views
Skip to first unread message

Zach Cox

unread,
Sep 11, 2011, 11:33:05 AM9/11/11
to gremli...@googlegroups.com
I just pushed some initial code to the gremlin_scala branch.  The ScalaPipeFunctionTest shows usage & an example with FluentPipeline.filter.

Are there any other specific FluentPipeline methods or PipeFunction implementations to explicitly test & support in Scala?

Thanks,
Zach

Zach Cox

unread,
Sep 11, 2011, 11:35:09 AM9/11/11
to gremli...@googlegroups.com
Woops - that "some initial code" link was supposed to point here:

https://github.com/tinkerpop/gremlin/blob/gremlin_scala/src/main/scala/package.scala

Marko Rodriguez

unread,
Sep 11, 2011, 12:15:00 PM9/11/11
to gremli...@googlegroups.com
Hey,

This looks great.

I got the Oderksy book on Scala. It is very good -- 200 pages in. Now I grock it.

Here is what I would like to see:
1. Using implicit conversions to "boost" graph, vertex, and edge classes with respective helper methods to make pipeline construction more natural. See, for example:
Note how you can do v.outE, v.inE.
Note how you can do g.V
Note how you can do g.v(1)
etc.
2. Make use of currying for those pipes that take both standard arguments and anonymous function arguments to get the nice syntax (see next example).
2. We should think of a single TestSuite that all JVM languages will be able to utilize. This way, we don't repeat the same test cases for each language, but instead, can simply pass in, perhaps:
BaseTest.ensureLooping1("g.v(1).outE.loop(1){it.loops < 2}.name", "groovy")
BaseTest.ensureLooping1("g.v(1) outE loop(1)((loops:Int,object:Any) => loops < 2)).name", "scala")
...
..
.
Perhaps a TestSuite based on JSR 223.

Thanks for your contribution,
Marko.

Zach Cox

unread,
Sep 11, 2011, 12:56:43 PM9/11/11
to gremli...@googlegroups.com
On Sun, Sep 11, 2011 at 11:15 AM, Marko Rodriguez <okram...@gmail.com> wrote:
> Hey,
> This looks great.
> I got the Oderksy book on Scala. It is very good -- 200 pages in. Now I
> grock it.

Glad you like it! Definitely the most comprehensive Scala reference.

> Here is what I would like to see:
> 1. Using implicit conversions to "boost" graph, vertex, and edge classes
> with respective helper methods to make pipeline construction more natural.
> See, for example:
> https://github.com/tinkerpop/gremlin/blob/master/src/main/groovy/com/tinkerpop/gremlin/loaders/TransformPipeLoader.groovy
> Note how you can do v.outE, v.inE.
> Note how you can do g.V
> Note how you can do g.v(1)
> etc.

Should be doable by creating a wrapper class around the Java class
with the new methods and then providing an implicit conversion (also
known as Pimp my Library). I will push some initial wrappers to
gremlin_scala.

> 2. Make use of currying for those pipes that take both standard arguments
> and anonymous function arguments to get the nice syntax (see next example).

Yep currying is the way to accomplish that. I'll also push some of these.

> 2. We should think of a single TestSuite that all JVM languages will be able
> to utilize. This way, we don't repeat the same test cases for each language,
> but instead, can simply pass in, perhaps:
> BaseTest.ensureLooping1("g.v(1).outE.loop(1){it.loops < 2}.name", "groovy")
> BaseTest.ensureLooping1("g.v(1) outE loop(1)((loops:Int,object:Any) => loops
> < 2)).name", "scala")
> ...
> ..
> .
> Perhaps a TestSuite based on JSR 223.

That might be tricky since each language will have slightly different
syntax in certain areas. But if we can find a way to easily test a new
language impl without re-writing all of the tests each time, that
would be very valuable.

Zach Cox

unread,
Sep 11, 2011, 2:48:28 PM9/11/11
to gremli...@googlegroups.com
Just pushed two more commits to gremlin_scala. One has the start of
Graph, Vertex & Edge wrappers that add convenience methods like out,
V, etc along with implicit conversions. The other has an example
curried version of FluentPipeline.loop.

We can flesh these (and their unit tests) out more over time.

Reply all
Reply to author
Forward
0 new messages