amazon-web-servicesamazon-dynamodbtitangremlinrexster

How to populate Titan with example data sets?


I am following the AWS docs on how to run Titan with DynamoDB as a storage backend. There seem to be a lot of ways to query my graphs (Gremlin CLI, Rexster via JSON and Web UI). My rexster.xml configuration file references a graph-name called "v054".

But how do I actually persist a graph to the storage layer and update it?

From my rexster.xml:

<graph-name>v054</graph-name>
<graph-type>com.thinkaurelius.titan.tinkerpop.rexster.TitanGraphConfiguration</graph-type>
<graph-location>/tmp/titan</graph-location>
<graph-read-only>false</graph-read-only>

Rexster Web UI:

Screenshot from Rexster

Update 1

To see the DynamoDB tables created to store the Titan graphs, ensure DynamoDB local is started using the -sharedDb flag (see documentation). This is not enforced by the start-dynamodb-local profile yet. Replace the -inMemory flag by -shared in your pom.xml.

    <profile>
        <id>start-dynamodb-local</id>
        <build>
            <plugins>
                <plugin>
                    <groupId>org.codehaus.mojo</groupId>
                    <artifactId>exec-maven-plugin</artifactId>
                    <version>${exec.maven.plugin.version}</version>
                    <executions>
                        <execution>
                            <phase>initialize</phase>
                            <configuration>
                                <executable>java</executable>
                                <arguments>
                                    <!-- left out other arguments for brevity .. -->
                                    <argument>-sharedDb</argument>
                                </arguments>
                            </configuration>

Once you run DynamoDB Local with -sharedDb, you will see the following tables created:

{
  "TableNames": [
    "v054_edgestore",
    "v054_graphindex",
    "v054_system_properties",
    "v054_systemlog",
    "v054_titan_ids",
    "v054_txlog"
  ]
}

Update 2

I am able to obtain a reference to my graph by running the commands mentioned under step 5 in the docs. However, I had to use the fully-qualified name of TitanFactory.open() (see below). See this Github issue for more information.

gremlin> conf = new BaseConfiguration()
gremlin> conf.setProperty("storage.backend", "com.amazon.titan.diskstorage.dynamodb.DynamoDBStoreManager")
gremlin> conf.setProperty("storage.dynamodb.client.endpoint", "http://localhost:4567")
gremlin> conf.setProperty("index.search.backend", "elasticsearch")
gremlin> conf.setProperty("index.search.directory", "/tmp/searchindex")
gremlin> conf.setProperty("index.search.elasticsearch.client-only", "false")
gremlin> conf.setProperty("index.search.elasticsearch.local-mode", "true")
gremlin> conf.setProperty("index.search.elasticsearch.interface", "NODE")
gremlin> g = TitanFactory.open(conf)
==>javax.script.ScriptException: groovy.lang.MissingPropertyException: No such property: TitanFactory for class: Script12
gremlin> g = com.thinkaurelius.titan.core.TitanFactory.open(conf)
==>titangraph[com.amazon.titan.diskstorage.dynamodb.DynamoDBStoreManager:[127.0.0.1]]

Solution

  • You posted a screenshot of the Rexster Doghouse. It embeds a Gremlin Shell. Click on the Gremlin button on the top, and start modifying your new graph with Gremlin scripts. See the project readme for examples of gremlin commands to add graph data, and the gremlin docs here for more examples. Remember to call g.commit() when creating your own graph data (not using the sample graph data like the Marvel data set or the graph of the gods.