CosmosDB Gremlin - 没有特定类型的边缘的筛选器节点



在CosmosDB Graph集合中,我试图找到所有类型为typeA具有任何指向typeB类型节点的"活动"边的节点。

某些边可能被"软删除"(即g.E().has('softDeleted', true)(。这些边应该被忽略。

这就是我尝试的:

g.V().hasLabel('typeA')
-> returns 10 nodes of type "typeA", as expected
g.V().hasLabel('typeA')
.outE().not(has('softDelete', true))
.inV().hasLabel('typeB')
-> returns 2 nodes of type "typeB", as expected
g.V().hasLabel('typeA')
.where( // same condition as above, inside a 'where' clause
outE().not(has('softDelete', true))
.inV().hasLabel('typeB')
.count().is(eq(0))   // " where there are no such edges"
)
-> returns all 10 nodes of type "typeA" again ?!

在上面的查询中,应用where子句似乎不会过滤任何内容。

以下查询将查找所有与typeB顶点没有边的typeA顶点。只有不具有softDelete属性的边或softDelete设置为false的边才会被考虑,其他边将被忽略。

g.V().hasLabel('typeA').
not(outE().or(hasNot('softDelete'),
has   ('softDelete', false)).
inV().hasLabel('typeB'))

最新更新