gpt4 book ai didi

java - 如何逐步将Gremlin连接到Neo4j数据库?

转载 作者:行者123 更新时间:2023-11-30 08:24:41 36 4
gpt4 key购买 nike

我是 Gremlin 的新手。我想将 Gremlin 连接到 Neo4j 数据库,我已经尝试了连接到 Neo4j 数据库的方法。

gremlin> g = new neo4jgraph[EmbeddedGraphDatabase[C:\Users\Olivia Stella\Documents\Neo4j\default.graphdb]]

在它连接到 Gremlin 之前,显示了一条错误消息:

java.util.prefs.WindowsPreferences <init> Warning: Could not open/create prefs root node Software\JavaSoft\prefs at root 0x80000002. Windows RegCreateKeyEx(...) returned error code 5.

注意:

-Gremlin 2.4.0

-Java SDK 7

-Neo4j 2.0.1

最佳答案

这看起来不像来自 REPL 的有效 Gremlin 语法:

gremlin> g = new Neo4jGraph('/tmp/neo4j')
==>neo4jgraph[EmbeddedGraphDatabase [/tmp/neo4j]]
gremlin> g.addVertex([name:'stephen'])
==>v[0]
gremlin> g.V.map
==>{name=stephen}
gremlin> g.commit()
==>null
gremlin> g.shutdown()
==>null
gremlin> g = new Neo4jGraph('/tmp/neo4j')
==>neo4jgraph[EmbeddedGraphDatabase [/tmp/neo4j]]
gremlin> g.V.map
==>{name=stephen}

或者,如果您有想要使用的现有 org.neo4j.graphdb.GraphDatabaseService 实例,您可以将其传递给 Neo4jGraph 构造函数而不是路径到数据库文件所在的位置(或您希望它们所在的位置)。

关于java - 如何逐步将Gremlin连接到Neo4j数据库?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22801551/

36 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com