I am trying to find path traversals and explore them by increasing weight, I was able to do this in gremlin and was trying to replicate the code in groovy (using groovyc to compile a groovy file and integrate with my other java code)... Can someone point me to documentation or how to execute the following query in a .groovy file, my understanding is that gremlin is interpreted by groovy but I cannot cache the results of the following pipeline which should return a set of weights and paths:
public static List findAllPaths(Vertex s, Vertex e) {
String targetName = e.getProperty("firstName");
// look at paths that end at target, match on first name, calc weights of these paths
results = s.outE.inV.loop(2){it.object.firstName!=targetName && it.loops < 6}.path.filter{it.last().firstName==targetName}.transform{[it.findAll{it instanceof Edge}.sum{it.weight}, it]};
// how to save results of pipe
}
I've gotten simple gremlin queries to return and pass back a list to java, I could try stringing together gremlin pipelines but I thought the point of having .groovy files was to be able to use/integrate gremlin directly to talk to java, thanks, Sonu