Hi,
> What I am trying to do is:
>
> 1. Find the vertices for 'marko', 'peter', and 'josh'
> 2. Find what they 'created' together.
There are various ways to do this. First, lets get the vertices marko, peter, and josh using the default Vertex index.
marko = g.idx(T.v)[[name:'marko']].next()
peter = g.idx(T.v)[[name:'peter']].next()
josh = g.idx(T.v)[[name:'josh']].next()
-------------------------------------
1. No set intersection
* count the number of times a project is traversed too, if its been traversed to three times, it must have been created by all marko, peter, and josh.
gremlin> [marko, peter, josh]._().out('created').groupCount.cap.scatter.filter{it.value == 3}.transform{it.key}.name
==>lop
2. Set intersection
* intersect the projects that marko, josh, and peter have created --- note that this requires memory.
gremlin> marko.out('created').toList().intersect(peter.out('created').toList()).intersect(josh.out('created').toList()).name
==>lop
I'm sure there are other ways of attacking the problem. However, I believe this provides you the two extremes (data flow vs. set-based). If you come up with some new ways, please post them.
Good luck,
Marko.
http://markorodriguez.com