In Gremlin, there are many "Gremlin specific pipes." A better term is "Groovy specific pipes" because these pipes make use of Closures. For example,
loop{it.loops < 4}
filter{it.weight > 0.5}
sideEffect{println it}
transform{it.outE.count()}
groupCount(m){key}{value}
...
..
.
In order to generalize this functionality (i.e. these pipes) and make it available to anyone wanting to use these pipes in native Java or any Gremlinesque-clone in another JVM language, I've pushed all these closure-based pipes to Pipes. You might ask,
"Well don't they still depend on Groovy as they require a Groovy Closures?"
The answer is
"No, they now require a PipeClosure which is an interface with a single method:
Object PipeClosure.compute(Object... parameters).
Similar to a Groovy Closure which has:
Object Closure.call(Object... parameters).
Next, now in Gremlin, when a Groovy closure is used in Gremlin, it is wrapped in a ClosurePipeClosure (a class that maps a Groovy closure to a native PipeClosure -- need to find a better name :) ). In this way, there are no longer any Pipes in Gremlin. Pipes has all the pipes with those that require a closure now requiring a PipeClosure. Gremlin is simply a bunch of metaClass loaders. Gremlin is as small as it can possibly be .. its tiny... nothing to it.
I have not committed or deployed this model yet. I'm still going through refactoring and migrating all the test cases for these Groovy/Gremlin-based pipes over to Pipes and writing documentation, etc. I wanted to explain what I'm doing and to get any comments/feedback on the idea before I fully commit.
Finally, note that I'm going to do a package name refactoring of Pipes so that the pipes in Pipes are better organized. Thus, if you use native Pipes in your project, you might have to rename some imports to make your project happy.
Thoughts?,
Marko.
Cheers,
/peter neubauer
GTalk: neubauer.peter
Skype peter.neubauer
Phone +46 704 106975
LinkedIn http://www.linkedin.com/in/neubauer
Twitter http://twitter.com/peterneubauer
http://www.neo4j.org - Your high performance graph database.
http://startupbootcamp.org/ - Öresund - Innovation happens HERE.
http://www.thoughtmade.com - Scandinavia's coolest Bring-a-Thing party.