Write custom, user-defined Gremlin steps in Jython or any JVM language.
Java Groovy Python Shell
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.
examples
mogwai
scripts
.gitignore
README

README

mogwai is a library that helps you write custom, user-defined Gremlin steps in 
Jython or any JVM language.  

A Jython example is provided. 

To try the example, download the latest Jython 
(http://www.jython.org/downloads.html) and copy it to 

$ cp jython2.5.2/jython.jar gremlin/target/gremlin-*-standalone/lib/jython.jar

You need modify your environment so that you can run Gremlin scripts from any 
directory. 


Add these lines to your .bash_profile: 

export CLASSPATH=$CLASSPATH:/home/james/projects/mogwai;
export JYTHONPATH=$JYTHONPATH:/home/james/projects/mogwai;

alias jython="/home/james/jython2.5.2/bin/jython"
alias gremlin="/home/james/gremlin/gremlin.sh"

$ source .bash_profile


And you need updated gremlin.sh scripts that will enable you to run gremlin.sh 
from any directory while not overriding your CLASSPATH.

Copy the updated scripts to your Gremlin directory:

$ cp mogwai/scripts/gremlin.sh /home/james/gremlin/gremlin.sh
$ cp mogwai/scripts/gremlin.sh.2 /home/james/gremlin/target/gremlin-*-standalone/bin/gremlin.sh


Compile the Java factory and interface:

$ javac mogwai/factories/JythonFactory.java
$ javac mogwai/interfaces/GizmoType.java


Once that's done, run the example Groovy script:

$ gremlin -e mogwai/examples/gizmo.groovy 
Gizmo

Gremlin steps...
Gizmo
25
marko


If you see the marko, then success -- it works.

- James Thornton, http://jamesthornton.com