I’m using Gremlin with Java and a Neo4j graph.
I create 3 new vertices and try to set their Ids to 1,2,3 but it does not seem to be working, what am I doing wrong?
Vertex v1 = g.addVertex(1);
v1.setProperty("name","jim");
Vertex v2 = g.addVertex(2);
v2.setProperty("name","bob");
Vertex v3 = g.addVertex(3);
v3.setProperty("name","fred");
//iterate through the vertices and get their id's (shouldn't they be 1,2, and 3 ??
for (Vertex V:GVs)
System.out.println(V.getId());
returns:
15
16
17
Why is this? How can I set the Ids to 1,2,3? Also can I set the Ids to strings instead?
Thanks!
Neo4j is assigning the IDs of new data for you, you can’t set them, except when you use the BatchInserter utility. Gremlin is silently ignoring your IDs.