首页 > 解决方案 > 如何在 gremlin 中使用`startsWith()` 进行遍历?

问题描述

如何startsWith()在 gremlin 中遍历使用?

g.V('6b4e7018-a2d1-45fd-a1ce-78efe4c96c33').bothE(startsWith('live_at_'))
.elementMap().toList()

或者

g.V('6b4e7018-a2d1-45fd-a1ce-78efe4c96c33').bothE().hasLabel(startsWith('live_at_'))
.elementMap().toList()

列出所有edges以标签开头的live_at_

标签: graphgremlintinkerpop3gremlinpythontinkerpop

解决方案


知道了,我们需要使用startingWith()而不是startWith()

g.V('6b4e7018-a2d1-45fd-a1ce-78efe4c96c33').outE().hasLabel(startingWith('lives_at_'))
.elementMap().toList()

推荐阅读