You can filter in the reduce closure pretty easily so that you don't
have to post-process the outputted map from the groupBy:
gremlin> g.V.out.groupBy{
it.name}{
it.in}{it.unique().findAll{i ->
i.age > 30}.name}.cap
==>{lop=[josh, peter], ripple=[josh], josh=[], vadas=[]}
In this way you can evaluate each item extracted into the grouped
value of the map. I guess you could do some filtering in the value
closure as well:
gremlin> g.V.out.groupBy{
it.name}{it.in.filter{i -> i.age >
30}.name}{it.toList().unique()}.cap
==>{lop=[josh, peter], ripple=[josh], josh=[], vadas=[]}
I think you should spend some time understanding the underpinnings of
groovy/closures a bit and how it relates back to the gremlin. It
sounds like you're attempting to do some less than trivial things in
your work. Consider taking some time away from these very complex
problems and focus on just getting things to work. Once working, then
you can refine and improve. Just a suggestion :)
Stephen
> --
>
>