Database Reference
In-Depth Information
Titan provides support for Gremlin shell for graph traversal and mutation using the
Gremlin query language. It's a functional language. Each step outputs an object, and
with “.” (dot), we can access associated functions with it. For example,
gremlin> conf = new BaseConfiguration() // step 1
==>org.apache.commons.configuration.BaseConfiguration@2d3c117a
gremlin> conf.setProperty("storage.backend",
"cassandrathrift") // step 2
Here conf is an object of Configuration created in step 1 whose setProp-
erty function has been invoked in step 2.
Let's discuss Gremlin with an exercise. In this recipe we will be using the same
Twitter example, where users' tweets will be a graph's vertices and the relationship
between a user and its tweets and followers will be edges. In this example we will be
using Cassandra as the backend storage option. You can opt for running a standalone
Cassandra server; otherwise, by default, it would start and connect with an embedded
one.
1.
First we need to connect with Gremlin as in Figure 7-9 .
Figure 7-9 . Connected to the Gremlin shell
2.
Next, we need to initialize a configuration object and set a few
Cassandra-specific properties:
gremlin> conf = new BaseConfiguration()
==>org.apache.commons.configuration.BaseConfiguration@2d3c117a
gremlin> conf.setProperty("storage.backend",
"cassandrathrift")
==>null
gremlin> conf.setProperty("storage.hostname",
"localhost")
 
 
Search WWH ::




Custom Search