为什么AddEdgeStep没有';t使用Gremlin在同一遍历中的边的DropStep之后工作?
我有这段代码,它本质上更新属性,删除所有旧的为什么AddEdgeStep没有';t使用Gremlin在同一遍历中的边的DropStep之后工作?,gremlin,datastax-enterprise-graph,Gremlin,Datastax Enterprise Graph,我有这段代码,它本质上更新属性,删除所有旧的IsOfType边,并添加新的IsOfType边(如果我删除所有的方法/类抽象并使其内联): 一切正常(即使是现有的IsOfTypeedges)。但是创建新的IsOfType边似乎不会在图上产生新边。如果我注释掉了drop,那么创建工作正常(!)就好像在末尾发生了addEdgeStep之前的DropStep。我甚至试着去除其他类型的边缘,这导致了同样的问题(!)。可能是隐式事务处理决定在发生drop()时提交,就像next()、iterate()和f
IsOfType
边,并添加新的IsOfType
边(如果我删除所有的方法/类抽象并使其内联):
一切正常(即使是现有的
IsOfType
edges)。但是创建新的IsOfType
边似乎不会在图上产生新边。如果我注释掉了drop,那么创建工作正常(!)就好像在末尾发生了addEdgeStep
之前的DropStep
。我甚至试着去除其他类型的边缘,这导致了同样的问题(!)。可能是隐式事务处理决定在发生drop()
时提交,就像next()
、iterate()
和foreachrestaining()
??如果是这种情况,那么使用Fluent API在同一事务中不能进行删除和创建,这使得它对实际应用程序不是很有用:(
以下是在我的运行中删除和添加两条IsOfType
边之后的遍历状态(我尝试了Java和Datastax Studio控制台):
编辑
从我在这里读到的()
drop()-步骤(filter/sideEffect)用于从图中删除元素和属性(即删除)。这是一个过滤步骤,因为遍历不会产生传出对象
没有返回任何对象,因此在删除发生后无法执行任何操作!因此我很好奇如何使用DSE Graph Fluent API在单个事务中执行多个删除/添加操作
谢谢!您可以将您的
放置
包装在副作用
步骤中,例如:
g.V(entity1).as("a").sideEffect(outE().filter(inV().is(entity2)).drop()).
V(entity2).addE("link").from("a")
哇,你太棒了!为什么我找不到任何关于我的用例的文档:(-我想这是因为GremlinAPI刚刚被标准化了。)
traversal after type edges deletion:
[
GraphStep(vertex,[Entity:633471488:519])@[entity],
AddPropertyStep({value=[Entity], key=[atClass]}),
AddPropertyStep({value=[FilmWithSuperCategories aaa], key=[text]}),
AddPropertyStep({value=[dffsdfsd f2313], key=[description]}),
SelectOneStep(entity)@[entity],
VertexStep(OUT,[IsOfType],edge),
DropStep
]
traversal after type edges addition:
[
GraphStep(vertex,[Entity:633471488:519])@[entity],
AddPropertyStep({value=[Entity], key=[atClass]}),
AddPropertyStep({value=[FilmWithSuperCategories aaa], key=[text]}),
AddPropertyStep({value=[dffsdfsd f2313], key=[description]}),
SelectOneStep(entity)@[entity],
VertexStep(OUT,[IsOfType],edge),
DropStep,
GraphStep(vertex,[Entity:996942848:518])@[type-0],
AddEdgeStep({~from=[[SelectOneStep(entity)]], ~to=[[SelectOneStep(type-0)]], label=[IsOfType]}),
GraphStep(vertex,[Entity:1489781376:516])@[type-1],
AddEdgeStep({~from=[[SelectOneStep(entity)]], ~to=[[SelectOneStep(type-1)]], label=[IsOfType]})
]
g.V(entity1).as("a").sideEffect(outE().filter(inV().is(entity2)).drop()).
V(entity2).addE("link").from("a")