neo4j-contrib / neo4j-tinkerpop-api-impl

Implementation of Apache Licensed Neo4j API for Tinkerpop3
Other
24 stars 16 forks source link

Enable graph algorithms #16

Closed fourier134949 closed 4 years ago

fourier134949 commented 4 years ago

The driver starts an embedded instance of neo4j and the only way to interact with it is via gremlin APIs. It would be very useful to have the possibility to enable the bolt endpoint for interacting with the embedded instance via the neo4j browser and native drivers. It would also be very useful to register the algo library at driver startup

spmallette commented 4 years ago

A bolt implementation can be found here: https://github.com/SteelBridgeLabs/neo4j-gremlin-bolt

fourier134949 commented 4 years ago

I tested the implementation you are mentioning and it seems it has some concurrency issues. I've also opened an issue to the maintainer but I didn't receive any feedback. Adding the bolt port to this driver seems to me a safer solution

fourier134949 commented 4 years ago

By digging into the code of the driver it is actually possible to enable bolt by simply putting these properties

gremlin.neo4j.conf.dbms.connector.0.type=BOLT gremlin.neo4j.conf.dbms.connector.0.enabled=true gremlin.neo4j.conf.dbms.connector.0.address=your ip:7687

into the tinkerpop configuration (e.g. neo4j-empty.properties)

fourier134949 commented 4 years ago

I've changed the name of the issue by removing the reference to bolt protocol

spmallette commented 4 years ago

whoa?! did that actually work? i never knew that option existed. so what is the difference between this configuration and the SteelBridgeLabs version - any chance you happen to know?

fourier134949 commented 4 years ago

Sure, I'll try to explain the difference. SteelBridgeLabs implementation is essentially a bolt client, it means that the integration between gremlin server and neo4j is performed via bolt: App --> [Gremlin Server (SteelBridge Implementation)] -- [bolt] --> Neo4j

The neo4j tinkerpop implementation doesn't leverage any external Neo4j server. It starts instead an embedded instance of Neo4j. We can say that it is self-sufficient. Like every embedded instance, it is possible to enable the bolt port (see this link).

The purpose of this port is to enable the communication between applications that speak cypher and the embedded instance, it is not used by the gremlin server itself.

App --> [Gremlin Server (Embedded Neo4j)] <--[Bolt]-- Another App

Without this bolt port enabled the embedded instance is "isolated", the only way to communicate with it would be via gremlin server.

spmallette commented 4 years ago

interesting. thank you for explaining and for that link. i think i will include that in the TinkerPop docs as a configuration option. people do want this configuration that you're looking for and that looks like an easy way to make that happen.

fourier134949 commented 4 years ago

Just to clarify a point: the link I pasted explains how to enable it via code by providing some configuration keys/values. Given that tinkerpop neo4j implementation is already able to read automatically neo4j configurations, the tests I did show that it is sufficient to put these properties

gremlin.neo4j.conf.dbms.connector.0.type=BOLT gremlin.neo4j.conf.dbms.connector.0.enabled=true gremlin.neo4j.conf.dbms.connector.0.address=your ip:7687

in neo4j-empty.properties file of gremlin server in order to enable it.

fourier134949 commented 4 years ago

Regarding the graph algorithms it is possible to enable them via configuration:

In neo4j-empty.properties it is sufficient to put this configuration:

gremlin.neo4j.conf.dbms.directories.plugins= The graph algo jar

It actually works. I'm closing the issue

fourier134949 commented 4 years ago

Graph algo feature already available, see the thread

spmallette commented 4 years ago

thanks again - i've tried and documented the config:

https://github.com/apache/tinkerpop/commit/60afcb84e1d50f58b6da60ae798a45a939753c1b

super easy. thanks for digging into that.