Create Vertex If Does Not Exist – Gremlin Query – Titan

Create Vertex If Does Not Exist

Return a vertex with given label and property. If the vertex does not exist, a new vertex is created and returned to vertexObject.

vertexObject = g.V().hasLabel('VERTEX_LABEL').has('property','value').tryNext().orElseGet{
    graph.addVertex(label, 'VERTEX_LABEL', 'property', 'value');

Related Links:

  1. Gremlin Query Language - Create Vertex/Node and Edge/Relationship
  2. Check If Vertex/Edge Exist - Gremlin Query - Titan
  3. Update Properties of Multiple Edges - Gremlin Query - Titan
  4. Update Properties of Multiple Vertices - Gremlin Query - Titan
  5. Create Vertex If Does Not Exist - Gremlin Query - Titan
  6. Query/Access Root Level Properties and Nested Properties of Vertex in Single Query - Gremlin Query - Titan
  7. Update Vertex If Exist - Gremlin Query - Titan
  8. Update Multiple Properties of Vertex - Gremlin Query - Titan
  9. Remove/Delete/Drop a Property Value from a List/Array – Gremlin Query

Leave a Reply