10

从我读过的内容来看,Neo4j 实现了 apache tinkerpop,这让我认为我可以使用 gremlin python 而不是连接到 gremlin 服务器,我可以将 python 代码指向 neo4j 服务器并将其视为 gremlin 服务器。

但是我在网上找不到任何信息来说明如何做到这一点,所以我想也许我误解了一些东西。

  • a) 我可以直接将 gremlin python 与 neo4j 数据库实例一起使用吗?
  • b) 如果 (a) 是,那怎么办?

谢谢

亚历克斯

4

1 回答 1

4

You can not connect gremlin-python to Neo4j Server. gremlin-python contains drivers that connect to Gremlin Server so you must have that installed for gremlin-python to work. Given that you need Gremlin Server you must choose one of the following options all of which are just Gremlin Server configurations:

  1. Configure Neo4j in embedded mode within Gremlin Server. An example of this is here where that file points to a Neo4j configuration file. Note that these files are packaged in the Gremlin Server distribution as samples so you can run them directly quite easily.
  2. Modify the aforementioned Neo4j configuration file to run Neo4j in HA mode effectively turning Gremlin Server into a node in the Neo4j cluster.
  3. Configure a neo4j-gremlin-bolt instance which will use the Neo4j Bolt protocol to connect to the running Neo4j Server. While I"m not completely familiar with this implementation, I can see that you would change the gremlin.graph to com.steelbridgelabs.oss.neo4j.structure.Neo4JGraph and that you would discern Bolt configuration options from this class (which instantiates that graph instance).

Once you've chosen one of those configuration options you can then use gremlin-python to work with Neo4j.

于 2017-12-17T14:29:18.213 回答