cancel
Showing results for 
Search instead for 
Did you mean: 

Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.

Gremlin usage in Neo4j

Hi,

As per the project requirement I want to use Neo4j with gremlin instead of cypher.
I found the documentation on Tinkerpop and also tried to use that. But after exploring it further, I found that the plugin is using very older version of Neo4j.

So is there any other way by which I can use the latest version of Neo4j and use gremlin as the query language.

7 REPLIES 7

some info on that here

Hi Joel,

Thank you for the response.
I have gone through the link that you shared. But still I am confused about the latest release of Tinkerpop.
So do you have any idea when Tinkerpop will release next version of neo4j-tinkerpop-api-impl which will support Neo4j version 4.x?

If you look at the GitHub URL:

You'll see it's actually a Neo4J project. So, I believe it's more of when is Neo4J (or somebody in the Neo4J development community) is going to modify the project to support the latest Neo4J release.

It is a known issue. See:

One possibility to consider is to use Microsoft's Cosmos and Gremlin implementation if you really need Gremlin.

Unfortunately, this is the extent of my understanding (or conjecturing) of the situation. Sorry I can't be of more help.

Thank you so much Clem for the inputs!!
Actually the use of Neo4j is necessary.
So as of now I am exploring cypher instead of Gremlin.
But will wait for the neo4j support in the API.

You may have a long wait for Gremlin. The Git Issue is almost 1 year old.

Out of curiosity why Gremlin? I've looked at it a little and it doesn't seem (to me) as nice as Cypher.

After playing around with Gremlin a bit, I prefer Cypher. I think it looks cleaner. I think it's easier to think in terms of pictures: nodes () and relationships -[]-> than words.

From a semantic point of view, "Relationships" is more natural way of thinking than "Edges". Also,

Also, a big thing going for Cypher is that it is easily extensible with APOC. The APOC libraries are very rich.

Not sure if this helps, but

seems to provide Gremlin-Support.

A short example could be

import static org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.__.*;
...

DatabaseManagementService managementService = new DatabaseManagementServiceBuilder(path)
  .setConfig(BoltConnector.enabled, true)
  .setConfig(BoltConnector.listen_address, new SocketAddress("localhost", 7687))
  .build();

Driver driver = GraphDatabase.driver("bolt://localhost:7687", AuthTokens.basic("admin", "admin"));

Neo4JElementIdProvider<?> vertexIdProvider = new Neo4JNativeElementIdProvider();
Neo4JElementIdProvider<?> edgeIdProvider = new Neo4JNativeElementIdProvider();
try (Graph graph = new Neo4JGraph(driver, null, vertexIdProvider, edgeIdProvider)) {
  GraphTraversalSource g = graph.traversal();
	        
  List<Object> list = g
    .V()
    .has("name", "Bruce Willis")
    .repeat(both().simplePath())
    .until(has("name", "Samuel L. Jackson"))
    .path().limit(1).unfold().toList();

But i am not sure how well it works in extended situations or if it is efficient...
Maybe someone has worked with this library and could share more insights?