The Benefits of Gremlin

jbmusso edited this page Jul 11, 2016 · 34 revisions

Attention: this Wiki hosts an outdated version of the TinkerPop framework and Gremlin language documentation.

Please visit the Apache TinkerPop website and latest documentation.

Before diving into the specifics of Gremlin, its good to know what you are getting yourself into. Moreover, it’s important to know if Gremlin can be of use to you. Below is a list of a few key reasons to use Gremlin.

  • Gremlin is useful for manually working with your graph: You can use the Gremlin console like a file system prompt (see Basic Graph Traversals). You can navigate the graph, update vertex properties, add an edge, remove a vertex, etc. Gremlin is handy for graph maintenance and ensuring the integrity of your data. There is nothing worse than realizing that it’s not your code, but your data that is bugged.
  • Gremlin allows you to query a graph: As you work with Gremlin, you will notice that many types of queries can be expressed in Gremlin in a much more succinct and understandable manner than with traditional programming languages. If you are building an application that requires a graph query, then it might be best to use the Gremlin evaluator in your application.
  • Gremlin can express complex graph traversals succinctly: Similar to what was stated previously, Gremlin can express in a few lines of code what it would take many, many lines of code in Java to express (see User Defined Steps). Moreover, Gremlin was designed to represent complex graph traversals. Even today’s graph databases, frameworks, and packages lack the ability to express complex graph traversals — something Gremlin can do very elegantly.
  • Gremlin is useful for exploring and learning about graphs: There are many add-ons/connectors for Gremlin that make it a unique environment for playing with graphs. Gremlin comes with a connector to the JUNG algorithms package, to the SPARQL query language, etc.
  • Gremlin allows you to explore the Semantic Web/Web of Data: Gremlin can be used with RDF graphs. Moreover, Gremlin has a connector to LinkedData Sail which allows you to work with the Semantic Web/Web of Data in real-time.
  • Gremlin ensures that you are not tied to a particular graph backend: Gremlin can be used over various graph databases. Thus, you can make use of your same Gremlin code even when you change your graph database backend (see Blueprints).
  • Gremlin allows for universal path-based computations: Gremlin allows you to control, to the utmost degree, the execution of a traversal within a graph. This provides the flexibility to create sophisticated ways in which to analyze, query, and manipulate a graph.
  • Gremlin is extensible and can be oriented to your particular use case: It is possible to extend Gremlin with new methods and steps defined natively in Gremlin or in Java (see User Defined Steps). Moreover, it’s possible to add other graph backends by implementing the graph interfaces provided by Blueprints.
  • Gremlin uses the Java API: The host virtual machine for Gremlin is the Java Virtual Machine. Gremlin code can take advantage of the Java API. In this way, Gremlin and Java work seamlessly together.
  • Gremlin is embedded in various JVM languages: The core of Gremlin is written in Java. However, Gremlin distributes with native language constructs for the JVM language Groovy. In this way, Gremlin is more a traversal style than a language as other JVM languages can naturally host it.
  • Gremlin is Turing complete: Many graph traversal languages can only recognize regular paths through a graph. Gremlin provides numerous memory and computing constructs to support arbitrary path recognition.