Skip to content

Learning Dependencies

okram edited this page Nov 16, 2011 · 19 revisions

Gremlin is part of a larger eco-system of technologies. The primary technologies to understand when using Gremlin are itemized below.

  • Blueprints: A library to interact with various graph database vendors.
  • Pipes: A library for computing using data flows.
  • Groovy: The default host language for Gremlin.
  • Scala: Another host language for Gremlin.

Blueprints

Blueprints can be considered the JDBC of the graph database community. It provides a set of interfaces that when implemented, yield a Blueprints-enabled graph database. The TinkerPop graph stack is all predicated on Blueprints and the databases that support Blueprints.

Given that Gremlin is hosted by various JVM languages, it is possible to make use of the Blueprints API from within these other JVM languages. In this way, all the utilities provided in Blueprints are easily accessible. In essence, Gremlin is a shorthand notation for many of the access patterns used when dealing with Blueprints.

Pipes

Pipes is a data flow framework written in Java. Gremlin extends Pipes to support data flow processing of Blueprints-enabled graph databases. Pipes boasts a lazy evaluation model that yields memory efficient graph traversal algorithms. When coding in Pipes, in Java, code can be very verbose. Gremlin simplifies this process by compiling its shorthand notation down to Pipes. In essence, Gremlin is a Pipes compiler for other JVM languages.

Groovy

Groovy is a dynamic language that serves as a superset of Java. It provide metaprogramming facilities through the Java Reflection API and as such, easily supports the creation of domain specific languages.

Gremlin is a particular DSL that manipulates the MetaClass of various objects. Beyond that, Gremlin is full Groovy. All constructs such as variable setting, looping, branching, closures, currying, etc. are all provided to Gremlin through the Groovy language. Finally, Groovy works seamlessly with Java and vice versa. The benefit of this is that Gremlin developers are able to easily use the Java API in their algorithms.

Here is a collection of introductory texts on Groovy that may be helpful:

Scala

Scala is a statically typed functional/object-oriented language that has many features that make it at “Java++”. While the dynamical aspects of JVM languages like Groovy and JRuby slow down the execution of a Gremlin traversal (e.g. when using closures/anonymous functions), in Scala, there are no such speed hinderances. As such, Gremlin Scala is ideal for production quality traversal definitions. Finally, like most JVM languages, Scala and Java can interact with each other and thus, Gremlin Scala can be used within a larger Java application.