I'm using Titan 1.0 Version and Gremlin Server with REST Api for creating and updating Vertex details. How can I delete the vertex using vertexId?
How can I delete a Vertex in Gremlin Server Titan 1.0
Asked Answered
you can use drop property to delete a vertex like :
g.V(vertexId).drop()
you will find more details about drop property on following link :
Please note that
g.V(vertexId).drop()
without iterating the result will only work in Gremlin console that iterates results automatically. In a Java program, to actually trigger the removal, iteration needs to be requested like this: g.V(vertexId).drop().iterate()
–
Orizaba Also, if the
Vertex
instance you have is a ReferenceVertex
(which seems to be the case when you are working via a remote connection), v.remove()
will not work at all as removal is not supported for ReferenceVertex
. –
Orizaba You can use :
g.V().hasId(vertexId).drop()
In the hasId method pass the id of the vertex you want to delete
© 2022 - 2024 — McMap. All rights reserved.
g.V(vertexId).next().remove()
will also do the trick. If you have the vertex already then simplyv.remove()
. Any of the 3 will serve. – Stereotaxis