while running following code :
def v1=[];
def p=[];
v.as('x')
.except(v1).sideEffect{v1.add(it)} // step 1
.outE('priority').inV // step 2
.except(p).sideEffect{p.add(it)} // step 3
.inE('priority').outV // step 4
.loop('x'){true} >> -1; // step 5
return [vertices:v1, priorities:p];
m getting this error :
"exception": "java.lang.StackOverflowError",
"stacktrace": [
"java.lang.reflect.InvocationTargetException.(InvocationTargetException.java:72)",
"sun.reflect.GeneratedMethodAccessor259.invoke(Unknown Source)",
"sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)",
"java.lang.reflect.Method.invoke(Method.java:616)",
"org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:90)",
"groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:233)",
"org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:272)",
"groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:883)",
"groovy.lang.Closure.call(Closure.java:410)",
"org.codehaus.groovy.runtime.DefaultGroovyMethods.callClosureForMapEntry(DefaultGroovyMethods.java:3392)",
"org.codehaus.groovy.runtime.DefaultGroovyMethods.collect(DefaultGroovyMethods.java:2188)",
"org.codehaus.groovy.runtime.DefaultGroovyMethods.collect(DefaultGroovyMethods.java:2205)",
"org.codehaus.groovy.runtime.dgm$77.invoke(Unknown Source)",
There is more stack trace .
Please suggest why this error is coming .
I don’t see anything obvious as to why this query is giving you a stack overflow. However, looking at your stack trace, I believe (though not certain), that your problem is with your return statement. You might want to decompose your query into smaller chunks to see where the problem is occurring.
Sidenote: here is a tip to make your query more concise:
If the only thing you are reasoning on on an edge is the label, then you can simply jump between vertices and not touch edges.
Finally, note that Gremlin 1.4, will provide “emit” functionality with the loop() step. In this way, you don’t need to sideEffect{} save elements during a loop into a list, you can simply emit them lazily. Thus, it will be easier to say, “return all things I touch as I loop down this branch.”
Apologies for no direct solution….
Marko.
http://markorodriguez.com