thrownewIllegalArgumentException(expr.getClass().getName()+" is not a valid range expression - must be an instance of "+RangeExpression.class.getName());
}
}
}
@Override
@Override
...
@@ -195,7 +236,7 @@ public class Gremlin2ExpressionFactory extends GremlinExpressionFactory {
...
@@ -195,7 +236,7 @@ public class Gremlin2ExpressionFactory extends GremlinExpressionFactory {
* __.inject(r as Object[]).as('__tmp').map({((Map)it.get()).get('x')}).as('x').select('__tmp').map({((Map)it.get()).get('x')}).as('y').select('x','y').by('name').by('name')
* </pre>
*
* This is not pretty, but is the best solution we've found so far for supporting expressions that contain aliases in this optimization.
* What ends up happening is that r gets populated with alias->Vertex maps. In the result expression, we make 'x' point
* to a step where the value in the traverser is the vertex for 'x', and we do the same thing for y. The <code>select('_tmp')</code> step in the middle restores the value of
* the traverser back to the map.
* <p/>
* The one known issue with the alias rearrangement is that it breaks loop expressions. As a result, expressions containing loops are currently excluded
* from this optimization.
*
* ExpandOrsOptimization expands the entire expression tree recursively, so it is not invoked
+"__(((r) as Map[])).as('__tmp').map({((Map)it.get()).get('person')}).as('person').select('__tmp').map({((Map)it.get()).get('city')}).as('city').select('__tmp').map({((Map)it.get()).get('__res')}).as('__res').path().toList().collect({it.tail()})";
return"def r=(([]) as Set);def f1={GraphTraversal x->x.has('name',eq('Fred')).as('label').select('label').fill(r)};"
+"f1(g.V().has('__typeName','DataSet'));"
+"f1(g.V().has('__superTypeNames','DataSet'));"
+"g.V('').inject(((r) as Vertex[])).as('label').repeat(__.in('inputTables').out('outputTables')).emit(has('__typeName',eq('string')).or().has('__superTypeNames',eq('string'))).toList()";
+"g.V('').inject(((r) as Vertex[])).range(5,10).as('inst').order().by((({it.get().values('name')}) as Function),{a, b->a.toString().toLowerCase() <=> b.toString().toLowerCase()})";