Closed amergin closed 11 years ago
what happens when you format it like this...?
def short() {
return g.v(1234).outE.filter{
return (it.pvalue > 0) || (it.correlation < 0);
};
}
with a one-liner like you said it works. Furthermore, it seems that
return g.v(1234).outE.filter{
works but
return g.v(1234).outE.filter
{
does not. is this a bulbs-related issue? The point was that I should be able to able to define multi-line closures as I can in the console. I often have filter clauses that grow very long and they need to be kept readable by using line splits.
I'm not exactly sure what the rule is on that. Marko wrote Gremlin-Groovy so he may have a better idea of why that's true. I would post it to the Gremlin-Users group for clarification.
According to Marko, there Gremlin shouldn't have a problem with multi-line closures: https://groups.google.com/forum/#!topic/gremlin-users/3m_3Zl0ek6c .
Maybe Bulbs is somehow pushing the wrong kind of syntax of the script to REST API?
Care to comment?
Bulbs is passing the body of the script to Rexster, so Rexster is seeing this:
return g.v(1234).outE.filter
{
return (it.pvalue > 0) ||
(it.correlation < 0);
};
Do these two versions behave differently?
return g.v(1234).outE.filter{
return (it.pvalue > 0) ||
(it.correlation < 0);
};
...and...
return g.v(1234).outE.filter
{
return (it.pvalue > 0) || (it.correlation < 0);
};
Closing -- assuming this has been resolved.
Regular expression fetching the functions seems to be faulty:
This seems to be due to \n between def [functionname] and '{' because removing it will remove the problem:
Seems there's also a problem with closures split to several lines:
The query within the function works on neo4j console.