opencypher / cypher-for-gremlin

Cypher for Gremlin adds Cypher support to any Gremlin graph database.
Apache License 2.0
359 stars 48 forks source link

Using gremlin-for-cypher over HTTP server #352

Closed cbobed closed 4 years ago

cbobed commented 4 years ago

Hi,

first of all, congrats for the project, a great effort with great results indeed!

I've been using gremlin-for-cypher for two weeks and so far I've been able to configure it in several setups (connecting directly from code, via the console - remotely, using the EmptyGraph + CypherTraversalSource ...). However, I haven't managed to make it work with a gremlin-server (I'm using Janusgraph as provider) via HTTP (I've configure WS+HTTP), which I need as it seems that there is a small bug in the .net websockets driver (apparently this bug also affects other drivers, the connections are not freed on the client side when the server abruptly closes the connection - in our case, this has happened due to timeouts).

Has anybody configured gremlin-for-cypher over HTTP? I've tried exposing a traversal in the groovy init script, but I haven't been able to make it work so far.

Best,

cbobed commented 4 years ago

Exposing a CypherTraversalSource variable through the groovy init script does the job ... I was messing it up with the imports, directly using the whole qualified class name did the magic.

However, can the OpProcessor be configured via HTTP petition? Via WebSocket you can modify the request and select the "cypher" processor.

https://github.com/apache/tinkerpop/blob/45fb0ff53b3eba04a25ef28f208d2d3a7a02dd57/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/handler/HttpGremlinEndpointHandler.java#L351

I answer myself ... no, you can only set up the language of the script. So, for the time being, if anyone wants to use Opencypher over HTTP with gremlin-server, exporting the variable via the init script should be a good solution (and afterwards including the cypher query using the cypher() step).