您应该更具体地了解您的 Titan 依赖项,这样您就不会引入意外的工件。而不是使用titan-all
,尝试这样的事情:
compile group: 'com.thinkaurelius.titan', name: 'titan-berkeleyje', version: '1.0.0'
compile group: 'com.thinkaurelius.titan', name: 'titan-es', version: '1.0.0'
您不需要包括gremlin-core
明确地因为它是一个依赖项titan-core
,但是如果您添加它,它应该与TinkerPop 版本 https://github.com/thinkaurelius/titan/blob/1.0.0/pom.xml#L62Titan 1.0 使用:
compile group: 'org.apache.tinkerpop', name: 'gremlin-core', version: '3.0.1-incubating'
Updated
您之前失败的尝试可能创建了一个无效的图形实例,存储在DIRECTORY
。您必须递归删除DIRECTORY
在尝试使用同一目录创建新图表之前。
Elasticsearch 索引后端无法与index.search.DIRECTORY
配置(注意大小写)。这是堆栈跟踪的相关部分:
忽略了 index.search.DIRECTORY 的配置条目,因为它没有映射到选项
java.lang.IllegalArgumentException:命名空间 [root.index] 中的未知配置元素:DIRECTORY
您可以阅读有关各种 Elasticsearch 配置选项的更多信息第22章 http://s3.thinkaurelius.com/docs/titan/1.0.0/elasticsearch.html泰坦文档。
考虑使用而不是 ElasticsearchLucene http://s3.thinkaurelius.com/docs/titan/1.0.0/lucene.html。它的配置看起来与 BerkeleyJE 存储类似,两者都非常适合单机 Titan。
TitanFactory.Builder config = TitanFactory.build();
config.set("storage.backend", "berkeleyje");
config.set("storage.directory", DIRECTORY + File.separator + "berkeleyje");
config.set("index." + INDEX_NAME + ".backend", "lucene");
config.set("index." + INDEX_NAME + ".directory", DIRECTORY + File.separator + "lucene");
graph = config.open();
还更新build.gradle
与 lucene 的依赖关系:
compile group: 'com.thinkaurelius.titan', name: 'titan-berkeleyje', version: '1.0.0'
compile group: 'com.thinkaurelius.titan', name: 'titan-lucene', version: '1.0.0'
我还建议首先尝试构建一个没有 Neo4j、OrientDB、Sparksee 和其他非 Titan 依赖项的 Titan 项目,以确保您拥有一个可以在没有任何依赖项冲突的情况下运行的简单项目。