getting match on multiple labels in Amazon Neptune with Gremlin

Viewed 1363
2 Answers

Given Gremlin semantics, this:

g.V().hasLabel('label1').hasLabel('label2')

means that you're doing an "and" operation so the vertices must have "label1" and "label2". If you want an "or" operation where the vertices can have either "label1" or "label2" then you'd probably need to change that to:

g.V().or(hasLabel('label1'),hasLabel('label2'))

Not sure if that solves your problem with Neptune in what you want to query but that's what Gremlin expects.

As an interim measure you could try doing hasLabel('label1').fold().unfold().hasLabel('label2')

Related