您可以遍历顶点属性,然后过滤匹配的值,然后删除这些属性。另请参阅 TinkerPop 文档中的vertex property examples。
gremlin> Gremlin.version()
==>3.2.9
gremlin> // create the vertices
gremlin> g.addV('ACCOUNT').
......1> property(list, 'Value', 'a').
......2> property(list, 'Value', 'b').
......3> property(list, 'Value', 'c').
......4> iterate()
gremlin> g.addV('PERSON').
......1> property('Name', '123').
......2> property(list, 'Value', 'a').
......3> property(list, 'Value', 'b').
......4> property(list, 'Value', 'c').
......5> iterate()
gremlin> // show all properties (before)
gremlin> g.V().or(hasLabel('ACCOUNT'), has('Name', '123')).
......1> project('label', 'props').
......2> by(label()).by(properties().fold())
==>[label:ACCOUNT,props:[vp[Value->a],vp[Value->b],vp[Value->c]]]
==>[label:PERSON,props:[vp[Value->a],vp[Value->b],vp[Value->c],vp[Name->123]]]
gremlin> // drop only the matching property
gremlin> g.V().or(hasLabel('ACCOUNT'), has('Name', '123')).properties('Value').
......1> hasValue('a').
......2> drop().iterate()
gremlin> // show all properties (after)
gremlin> g.V().or(hasLabel('ACCOUNT'), has('Name', '123')).
......1> project('label', 'props').
......2> by(label()).by(properties().fold())
==>[label:ACCOUNT,props:[vp[Value->b],vp[Value->c]]]
==>[label:PERSON,props:[vp[Value->b],vp[Value->c],vp[Name->123]]]