Skip to content
Horacio Hoyos edited this page May 27, 2019 · 3 revisions

Gremlin Console

Gremlin is a domain specific language for traversing property graphs. This language has application in the areas of graph query, analysis, and manipulation.

Using ArangoDB with the Gremlin Console

The ArangoDB TinkerPop Provider includes support for the Gremlin Console out of the box. The console provides an easy way to start learning the Gremlin language, to support your application development, etc.; you can find more information about it here.

Prerequisites

You need to download the Gremlin Console from here. The console is a java application and both Windows (.bat) and Unix(.sh) scripts are provided in the bin folder to start-up the console.

Start Gremlin Console

$ apache-tinkerpop-gremlin-console $ bin/gremlin.sh 

         \,,,/
         (o o)
-----oOOo-(3)-oOOo-----

Installing ArangoDB Provider

The easiest way to use the ArangoDB provider in the console is to install it from maven. For this, you can use the install command and provide the maven coordinates: install <groupId> <artifactId> <version>.

Note: If you want to use the snapshot versions, Gremlin needs to know about the Sonatype repository. For this use case you need to add the repository to your general maven settings.

gremlin> :install org.arangodb arangodb-tinkerpop-provider 2.0.2

To check that the provider was installed we can list the available plugins:

gremlin> :plugin list
==>tinkerpop.server[active]
==>tinkerpop.gephi
==>tinkerpop.utilities[active]
==>tinkerpop.arangodb
==>tinkerpop.sugar
==>tinkerpop.credentials
==>tinkerpop.tinkergraph[active]

If not listed, you need to double check that gremlin can access the Sonatype repository.

To use the provider, we need to activate it:

gremlin> :plugin use tinkerpop.arangodb
==>tinkerpop.arangodb activated

Loading and ArangoDb Graph

To load an ArangoDBGraph you need an Apache Commons Configuration. Details on the configuration options are provided in the Configuration wiki. If we create/have a properties files, e.g. /some/path/arango.properties with the following content (assuming the appropriate DB and user exists in ArangoDB):

gremlin.arangodb.conf.graph.name = tinkergraph
gremlin.arangodb.conf.graph.db = tinkerpop
gremlin.arangodb.conf.arangodb.user = gremlin
gremlin.arangodb.conf.arangodb.password = gremlin

Then we can load the graph like this:

gremlin>import org.apache.commons.configuration.PropertiesConfiguration
gremlin>config = new org.apache.commons.configuration.PropertiesConfiguration("/some/path/arango.properties")  
g = ArangoDBGraph.open(config)

From there you can use the console to query and modify the graph.