Sample Graph: Tinker Modern
Query: Find all direct friends (person
Vertex) of Marko and (union) all software
in second hop.
Failed attempts:
Generic Query for first level people:
g.V(1).hasLabel("person").repeat(both()).times(1).emit(hasLabel("person")).hasLabel("person").values("name")
Generic Query for second level/hop software:
g.V(1).hasLabel("person").repeat(both()).times(2).emit(hasLabel("software")).hasLabel("software").values("name")
Attempt to merge above two queries:
g.V(1).hasLabel("person").repeat(both()).times(1).emit(hasLabel("person")).hasLabel("person").repeat(both()).times(2).emit(hasLabel("software")).hasLabel("software").values("name")
I didn't really understand how union works, because its not merging data.
g.V(1).union().V(2)
g.V(1).union(V(2))
Best I got till now is, but I want some ability to do like (marko connected to person AND/OR marko connected to software):
gremlin> g.V(1).store('x').V(2).store('y').cap('x', 'y')
==>[x:[v[1]],y:[v[2]]]