Home | All Posts

[02 Apr 2015] Using Gremlin Java in TinkerPop 2.x

Some organizations are single-minded in their choice of programming language. They are “Java shops” or “Python shops” and there is no room for anything in between. This choice often places developers in a position where they find new technology that would be useful in achieving their goals, but they are unable to use it because it uses a non-approved technology. Gremlin, as it stands in TinkerPop 2.x, is best used in its Groovy form, as the syntatic sugar of Groovy helps form a simple and concise DSL for traversing graphs. Unfortunately, Groovy is not always on the list of approved technology at these organizations that define themselves as a “Java Shop”. As such, developers in these organizations look to use Gremlin in its Java form.

Unfortunately, Gremlin Java is quite verbose, which is largely a function of the way Java itself works. Developers tend to have a hard time understanding the method in which their Gremlin Groovy converts to Java and, as a result, there tend to be many questions about the best way to go about doing this.

I recently provided an answer to this question on StackOverflow where someone was trying to understand just how to do this. I went into some detail on this topic and hopefully provided a nice tutorial for those who have this problem. I think that in many ways, this answer will become the reference that we point people to who have this problem.

Home | All Posts