如果存在这样的顶点,是否可以使用 Gremlincoalesce
步骤按 id(或属性)选择顶点,否则插入顶点?我尝试使用以下方法执行此操作,但出现'list' object has no attribute 'coalesce'
错误,我可以看到这是由.fold().next()
返回 python 列表对象引起的:
my_vertex = g.V(1).fold().next().coalesce(__.unfold(), g.addV(
'my_label'
).property(
T.id,
1
).property(
'test', 'foo'
).property(
'name', 'my_vertex_name'
).property(
'created_timestamp', 1575480467
).next()
)
这样做有什么性能优势,还是我应该简单地将其分解为初始顶点查询的 hasNext() 上的 if/else?