当遍历一个图时,我想保存开始的顶点,进一步遍历,并将具有特定边的所有顶点移回这个保存的顶点。
这是我目前的尝试,但显然是不正确的:
g.V().hasLabel('foo')
.as('rule')
.repeat(out('belongs_to')).times(2)
.where(
in('accepts').is(neq('rule'))
)如何在Gremlin中检查顶点相等性?如何过滤掉存在这种相等的所有路径?
发布于 2019-07-24 11:08:58
where()匹配开始标签和结束标签,因此您可以使用where(in('accepts').as('rule'))。由于您希望排除那些与模式匹配的顶点,因此需要使用not()对这一部分进行求反。
g.V().hasLabel('foo').as('rule').
repeat(out('belongs_to')).
times(2).
not(where(__.in('accepts').as('rule')))https://stackoverflow.com/questions/57172388
复制相似问题