如何使用示例数据集填充 Titan?

How to populate Titan with example data sets?

我正在关注 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 引用一个名为 "v054" 的 graph-name

但是我实际上如何将图形持久化到存储层并更新它?

来自我的 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:

更新 1

要查看为存储 Titan 图而创建的 DynamoDB 表,请确保使用 -sharedDb 标志启动本地 DynamoDB(请参阅文档)。 start-dynamodb-local 配置文件尚未强制执行此操作。在 pom.xml.

中用 -shared 替换 -inMemory 标志
    <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>

使用 -sharedDb 运行 DynamoDB Local 后,您将看到创建了以下表:

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

更新 2

我可以通过 运行 在 step 5 in the docs. However, I had to use the fully-qualified name of TitanFactory.open() (see below). See this Github issue 下提到的命令获得对我的图表的引用以获取更多信息。

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]]

您发布了 Rexster Doghouse 的屏幕截图。它嵌入了一个 Gremlin Shell。单击顶部的 Gremlin 按钮,然后开始使用 Gremlin 脚本修改新图形。有关更多示例,请参阅 the project readme for examples of gremlin commands to add graph data, and the gremlin docs here。记得在创建自己的图数据时调用g.commit()(不是使用像漫威数据集或众神图那样的示例图数据。