Can we use apache Gremlin DSL for mutations (CREATE, UPDATE & DELETE)?

76 views Asked by At

Can we use apache Gremlin Domain Specific Language (DSL) for mutations (CREATE, UPDATE & DELETE)?

Gremlin Java DSL

@GremlinDsl(traversalSource = "com.sample.dsl.EmpTraversalSourceDsl")
public interface EmpTraversalDsl<S, E> extends GraphTraversal.Admin<S, E> {
    
    public default Vertex create(Employee employee) {
        return addV("employee");
    }

}

Every time, when I invoke this method, it creates double of what is there in the database.

Ex:

if there is, 2 employee then it become 4. 4 become 8 & so...

1

There are 1 answers

0
Thirumal On

The problem was I tried to create the vertex using the EmpTraversalSourceDsl, so the query ultimately looks like

g.V().hasLabel('employee').addV('employee').property(T.id, 'T12321321R'))

Resolved using coalesce