I'm having a vertex with following details:
http://localhost:8182/?gremlin=g.V(4192)
{
"requestId": "6ce01f3b-f623-41f6-bb03-dd56014e0701",
"status":
{
"message": "",
"code": 200,
"attributes": { }
},
"result":
{
"data":
[
{
"id": 4192,
"label": "person",
"type": "vertex",
"properties":
{
"name":
[
{
"id": "170-38g-sl",
"value": "marko2"
}
],
"age":
[
{
"id": "1l8-38g-28lh",
"value": 29
}
]
}
}
],
"meta": { }
}
}
I want to update the Name of the vertex :
I tried following query :
g.V(4192).setProperty('name','William')
But it is not updating , it is giving error
{
"message": "Error encountered evaluating script: g.V(4192).setProperty('name','William')"
}
remove() will also do the trick. If you have the vertex already then simply v. remove() . Any of the 3 will serve.
In Gremlin nodes are referred to as “Vertexes”. To add a node/vertex to the graph, you simply use the command addV() on your graph traversal source. For consistency, most people use “g” as their default graph traversal source.
There is no method called "setProperty()" on a Traversal
. You would do:
g.V(4192).property('name','William')
Please see the full list of steps in the TinkerPop documentation.
You could also work with the Vertex directly and do:
v = g.V(4192).next()
v.property('name','william')
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With