use of org.apache.atlas.groovy.ListExpression in project incubator-atlas by apache.
the class GremlinExpressionFactory method typeTestExpressionUsingInFilter.
private List<GroovyExpression> typeTestExpressionUsingInFilter(GraphPersistenceStrategies s, GroovyExpression parent, final String typeName) throws AtlasException {
List<GroovyExpression> typeNames = new ArrayList<>();
typeNames.add(new LiteralExpression(typeName));
Map<TYPE_FILTER, String> filters = new HashMap<TYPE_FILTER, String>() {
{
put(TYPE_FILTER.SUPERTYPE, typeName);
}
};
ImmutableList<String> subTypes = TypeSystem.getInstance().getTypeNames(filters);
if (!subTypes.isEmpty()) {
for (String subType : subTypes) {
typeNames.add(new LiteralExpression(subType));
}
}
GroovyExpression inFilterExpr = generateHasExpression(s, parent, s.typeAttributeName(), IN_OPERATOR, new ListExpression(typeNames), null);
return Collections.singletonList(inFilterExpr);
}
use of org.apache.atlas.groovy.ListExpression in project incubator-atlas by apache.
the class Gremlin2ExpressionFactory method generateSelectExpression.
@Override
public GroovyExpression generateSelectExpression(GroovyExpression parent, List<LiteralExpression> sourceNames, List<GroovyExpression> srcExprs) {
GroovyExpression srcNamesExpr = new ListExpression(sourceNames);
List<GroovyExpression> selectArgs = new ArrayList<>();
selectArgs.add(srcNamesExpr);
for (GroovyExpression expr : srcExprs) {
selectArgs.add(new ClosureExpression(expr));
}
return new FunctionCallExpression(TraversalStepType.MAP_TO_VALUE, parent, SELECT_METHOD, selectArgs);
}
use of org.apache.atlas.groovy.ListExpression in project incubator-atlas by apache.
the class OptimizationContext method getDefineResultVariableStmt.
public GroovyExpression getDefineResultVariableStmt() {
GroovyExpression castExpression = new TypeCoersionExpression(new ListExpression(), "Set");
GroovyExpression resultVarDef = new VariableAssignmentExpression(RESULT_VARIABLE, castExpression);
return resultVarDef;
}
Aggregations