Skip to content

The Benefits of Gremlin

okram edited this page Sep 13, 2010 · 34 revisions

Before diving into the specifics of Gremlin, its good to know what you are getting yourself into. Moreover, its 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 a vertex’s properties, add an edge, remove a vertex, etc. This is handy for graph maintenance and ensuring the integrity of your data. There is nothing worse that realizing that its 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 Paths). Moreover, Gremlin’s language 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.1
  • 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 (see Working with JUNG Algorithms), to the SPARQL query language (see Sesame SAIL Quad Store), 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 is useful to ensure 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 regardless of changing you graph database (see Blueprints). 2
  • Gremlin is extensible and can be oriented to your particular use case: It is possible to extend Gremlin with new functions and paths defined natively in Gremlin or in Java (see User Defined Functions and User Defined Paths). Moreover, its possible to add other graph backends by implementing the graph interfaces provided by Blueprints.

1 Gremlin naturally expresses the operations of the path algebra presented in the article below. This algebra provides a unified means by which graph-based algorithms, knowledge-based reasoning, graph querying, etc. can be expressed for multi-relational graphs (see Defining a Property Graph).

Rodriguez M.A., Shinavier, J., Exposing Multi-Relational Networks to Single-Relational Network Analysis Algorithms, Journal of Informetrics, volume 4, number 1, pages 29-41, ISSN:1751-1577, Elsevier, doi:10.1016/j.joi.2009.06.004, LA-UR-08-03931, December 2009.

2 This is not completely true. There are a few tweaks here and there you may have to do to make sure your same Gremlin code will work identically over different backends. For example, each graph database has its own unique open() function to create a connection to the graph.