Search code examples
graphgremlintinkerpop3gremlinpythontinkerpop

How to traverse using `startsWith()` in gremlin?


How to traverse using startsWith() in gremlin?

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

or

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

List all edges start with the label live_at_.


Solution

  • Got it, We need to use startingWith() instead of startWith()

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