concept Gremlin Console in category graphs

appears as: Gremlin Console, Gremlin Console, The Gremlin Console
Graph Databases in Action

This is an excerpt from Manning's book Graph Databases in Action.

  • Connect a Gremlin Console to your Gremlin Server with a session
  • Gremlin Console connected to remote Gremlin Server
    A_04

    A.2.5   Using the Gremlin Console

    Before we fire up the Gremlin Console, there are a few additional options we should discuss. If we would like to see the options available to run on the Gremlin Console, we can type ./gremlin.sh --help.

    Gremlin Executable Options
    A_06

    As depicted, there are a variety of options to use, but the most common ones we will use are ./gremlin.sh --version to see the version of the Gremlin Console we are running:

    Gremlin Console Version
    A_07

    The other commonly used command is ./gremlin.sh -e code.groovy; code.groovy is a valid groovy code file that you would like to have the Gremlin Console run. The syntax above will execute the file and then exit the console. If you would like to run the file and remain in the console in interactive mode, we will do so by changing the -e switch to a -i such as ./gremlin.sh -i code.groovy. We will use this functionality extensively to prepopulate our TinkerGraph graph throughout this book.

    To run the Gremlin Console, we simply use the ./gremlin.sh without any of the switches. Now that we have the Gremlin Console up and running, we should now see the figure below:

    Gremlin Console Running
    A_08

    The Gremlin Console is what is known as a REPL (Read Evaluate Print Loop) terminal. A REPL means that the commands typed are immediately executed, and the results of that evaluation are printed out to the screen. As mentioned before, the Gremlin Console runs on Groovy, which means that you can execute standard Groovy code, such as addition, inside of the Gremlin Console:

    Example Groovy Commands in Gremlin Console
    A_09