Skip to content
This repository was archived by the owner on Sep 17, 2025. It is now read-only.

Console

Horacio Hoyos Rodriguez edited this page Oct 30, 2018 · 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.0-SNAPSHOT

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. The easiest way to have this is to load a properties file with the configuration values. 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 = TinkerPop Graph
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(c)

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

Note: The same conditions on the ArangoDB graph apply as if using the provider from Java, that is, if the graph does not exist a new one will be created, if the vertex and edge information is empty the default "vertex" and "edge" collections will be used (with fully connected graph), etc.

Clone this wiki locally