Adding an edge to a non-existent vertex creates a shell vertex
JavaTinkerPop
Hi,
I recently noticed an odd behaviour when using the Java Janusgraph library (version 1.1.0) to add edges.
Adding an edge from an existing vertex S, to a non-existing vertex T, will automatically create an empty shell vertex for T.
Is this an intended and reliable behavior that is documented somewhere?
Simplified example:
var transaction = graph.buildTransaction().start(); // graph is a StandardJanusGraphvar g = transaction.traversal();g.inject(1).addE(edgeLabel).from(V("ExistingVertexId")).to(V("MissingVertexId")).iterate();transaction.commit();
var transaction = graph.buildTransaction().start(); // graph is a StandardJanusGraphvar g = transaction.traversal();g.inject(1).addE(edgeLabel).from(V("ExistingVertexId")).to(V("MissingVertexId")).iterate();transaction.commit();
This creates a shell vertex with the label
vertex
vertex
and no properties, which I can see from the gremlin console:
Other observations: - Trying to add an edge through the gremlin console in the same way fails with an error about the non-existing target vertex - Adding the missing vertex later using the Java library successfully adds the label and properties to the vertex, and preserves the previously-added edge