Consider the following graph:
I want to find all the pairs of people who have a FOLLOWS
relationship between them and have reviewed the same movie. In Cypher, I would do the following:
MATCH (p:Person) -[:REVIEWED]-> (m:Movie)
MATCH (p) -[:FOLLOWS]-> (p2:Person)
MATCH (p2) -[:REVIEWED]-> (m)
RETURN p, p2, m
What I have so far in Gremlin:
g.V().hasLabel('person').as('p')
.out('REVIEWED').as('m')
.in('REVIEWED').as('p2')
.where(in('FOLLOWS').is(select('p'))) // this doesn't work
.select('p', 'm', 'p2')
But this doesn't work. How can I get achieve this in Gremlin?