Hey, > I've played around a bit more, and this is the query that currently works > best for me... would anyone mind "reviewing" it for me please? Feels a > little like I'm getting the right answer, but the wrong way.... > gremlin> m = [:]; > gremlin> g.v(162).in('R_PartOf').loop(1){m.put(it.object, it.loops); true} > gremlin> m.sort{a -> a.value}._() > > And, that sort tripped me up a few times.... :)
Everything looks good except your m.sort{}, which should be something like this: m.sort{a,b -> a.value <=> b.value} The provided closure is a comparator. For a java.util.Map, the comparison is happening between two Map.Entry objects. Thus, your sort needs two inputs (a,b) and then the value of those Entry objects is a.value and b.value, respectively. Hope that is clear. *** Also, note that if you don't want to see output from your g.v(162)... expression, simply do >> -1 as it will while(expr.hasNext()) and thus, fill the map without burdensome System.out.println()s. *** Enjoy, Marko. _______________________________________________ Neo4j mailing list User@lists.neo4j.org https://lists.neo4j.org/mailman/listinfo/user