Oh, I see, that's cool.
mgraph = TinkerFactory.createModern()
//==>tinkergraph[vertices:6 edges:6]
mg = mgraph.traversal()
mg.V().elementMap()
mg.E().elementMap()
cgraph = TinkerFactory.createTheCrew()
//==>tinkergraph[vertices:6 edges:14]
cg = cgraph.traversal()
cg
.V().elementMap()
cg
.E().elementMap()
ngraph = mg.withSideEffect('sg',cgraph).E().hasLabel('knows').subgraph('sg').cap('sg').next()
//==>tinkergraph[vertices:8 edges:16]
ng = ngraph.traversal()
ng.V().elementMap()
ng.E().elementMap()
ngraph == mgraph //==>false
ngraph == cgraph //==>true
Repeated application of...
ngraph = mg.withSideEffect('sg',cgraph).E().hasLabel('knows').subgraph('sg').cap('sg').next()
...produces no errors.
So, the question is, does the repeated insertion of the edges (and their nodes) fail quietly or do they overwrite the previous edges (nodes)?
A quick test shows that the vertex is being overwritten.
cg.V(2).property('age','270').property('foo','bar').iterate()
ngraph = mg.withSideEffect('sg',cgraph).E().hasLabel('knows').subgraph('sg').cap('sg').next()
ng.V().elementMap()
//==>[id:2,label:person,foo:bar,name:vadas,age:270]
This is actually the type of merge behavior I am looking for!
Is this part of the TinkerPop specification? or just a TinkerGraph behavior?
In other words, can I expect other graph engines to behave in the same way? like JanusGraph?