Reputation: 89
I created a edge called "created" between User vertex and Event vertex
user1(8312) ---created---> event1(1234)
user1(8312) ---created---> event2(4567)
user1(8312) ---created---> event3(7890)
I can delete one edge at a time,but if I want to delete mutiple edges have to loop though and hit multple db calls.Is there any way to delete mutiple edges at once.
Upvotes: 2
Views: 4413
Reputation: 46216
If you want to drop edges between multiple vertices then you could do something like this:
gremlin> g = TinkerFactory.createModern().traversal()
==>graphtraversalsource[tinkergraph[vertices:6 edges:6], standard]
gremlin> g.V(1).outE()
==>e[9][1-created->3]
==>e[7][1-knows->2]
==>e[8][1-knows->4]
gremlin> g.V(1).outE().where(inV().hasId(within(2,3))).drop()
gremlin> g.V(1).outE()
==>e[8][1-knows->4]
You can read more about this in Gremlin Recipes.
Upvotes: 4
Reputation: 2809
I am not sure how you remove the edges, but if you simply want to remove all outgoing created edges from the vertex with the ID 8312, then this should work:
g.V(8312).outE('created').drop().iterate()
Upvotes: 2