所以你想用另一个顶点的属性替换一个顶点的所有属性(至少我是这样理解你的问题和你的评论的)。
要删除所有属性,您只需删除它们:
g.V(vertex_id).properties().drop().iterate()
我们可以看到如何将所有属性从一个顶点复制到另一个顶点in this response by Daniel Kuppitz to a question on how to merge two vertices:
g.V(vertex_with_new_properties).
sideEffect(properties().group("p").by(key).by(value())).
cap("p").unfold().as("kv").
V(vertex_id).
property(select("kv").select(keys), select("kv").select(values)).
iterate()
当我们结合这两个遍历时,我们会得到一个遍历,它会丢弃旧属性并从另一个顶点复制新属性:
g.V(vertex_id).
sideEffect(properties().drop()).
V(vertex_with_new_properties).
sideEffect(properties().group("p").by(key).by(value())).
cap("p").unfold().as("kv").
V(vertex_id).
property(select("kv").select(keys), select("kv").select(values)).
iterate()
现代图表的实际应用:
// properties before for both vertices:
gremlin> g.V(1).valueMap(true)
==>{id=1, label=person, name=[marko], age=[29]}
gremlin> g.V(2).valueMap(true)
==>{id=2, label=person, name=[vadas], age=[27]}
// Replace all properties of v[1]:
gremlin> g.V(1).
sideEffect(properties().drop()).
V(2).
sideEffect(properties().group("p").by(key).by(value())).
cap("p").unfold().as("kv").
V(1).
property(select("kv").select(keys), select("kv").select(values)).
iterate()
// v[1] properties after:
gremlin> g.V(1).valueMap(true)
==>{id=1, label=person, name=[vadas], age=[27]}