I am seeing different behavior between Tinkergraph and Neo4j-gremlin from the neo4j-gremlin-bolt Neo4j implementation of Tinkerpop3, specifically in this bit of code:
// different Tinkerpop impls
Graph graph = new Neo4JGraph(driver, vertexIdProvider, edgeIdProvider);
// Graph graph = Neo4jGraph.open("C:\\tmp\neo");
// Graph graph = TinkerGraph.open();
GraphTraversalSource g = graph.traversal();
String label = "Person";
for (int i = 0; i < 10; i++) {
System.out.println("Before " + +g.V().toList().size());
graph.addVertex(label);
System.out.println("After " + +g.V().toList().size());
}
// if graph is transactional
graph.tx().commit();
What I expected was that the vertex count increments from 1 to 10 which is what I see for Tinkergraph and Neo4j-gremlin. What I see with neo4j-gremlin-bolt is that the count is always 1 (after the first AddVertex). After the commit, 10 instances appear in the Neo4J db (as expected). Running it a second time, the count is always 11 (after the first addVertex) and 20 instances appear after the commit.
The only way I have gotten this to work as expected with neo4j-gremlin-bolt is to commit() and close() the graph after every addVertex, which doesn't seem right.
This seems like fundamental behavior, so I assume I am missing something obvious.
neo4j-gremlin-bolt - v0.2.18
tinkergraph-gremlin - v3.2.4
neo4j-gremlin - v3.2.4