如何在 Gremlin 中更新 Vertex/Edge ID?

How to update the Vertex/Edge ID in Gremlin?

如何更新vertex/Edge ID?

g.V('jesica@rickandmorty.com').property(T.id, 'jerry@rickandmorty.com')

Gremlin.version() ==>3.4.10.

中出现以下错误
{"detailedMessage":"org.apache.tinkerpop.gremlin.structure.T 
    cannot be cast to java.lang.String","requestId":"ade01b34-8eec-46c4-9901-62dc1034f239",
       "code":"UnsupportedOperationException"}

Vertex(或 Edgeidlabel 是不可变的。如果您想更改 id,则必须删除 Vertex,然后再将其添加回去。在旧版本的 Gremlin 中,错误消息有点误导。从 3.4.11 开始,它现在显示为:

gremlin> g.V(1).property(T.id, 200).iterate();
T.id is immutable on existing elements
Type ':help' or ':h' for help.
Display stack trace? [yN]y
java.lang.IllegalStateException: T.id is immutable on existing elements