Search in sources :

Example 1 with CypherUnwindClause

use of org.vertexium.cypher.ast.model.CypherUnwindClause in project vertexium by visallo.

the class UnwindClauseExecutor method execute.

public VertexiumCypherScope execute(VertexiumCypherQueryContext ctx, List<CypherUnwindClause> clauses, VertexiumCypherScope scope) {
    List<VertexiumCypherScope> allResults = new ArrayList<>();
    VertexiumCypherScope accumulatorScope = scope;
    for (CypherUnwindClause clause : clauses) {
        List<VertexiumCypherScope.Item> clauseResults = new ArrayList<>();
        accumulatorScope.stream().forEach(item -> {
            List<VertexiumCypherScope.Item> items = execute(ctx, clause, item).collect(Collectors.toList());
            clauseResults.addAll(items);
        });
        accumulatorScope = VertexiumCypherScope.newItemsScope(clauseResults, scope);
        allResults.add(accumulatorScope);
    }
    return accumulatorScope;
}
Also used : ArrayList(java.util.ArrayList) CypherUnwindClause(org.vertexium.cypher.ast.model.CypherUnwindClause) VertexiumCypherScope(org.vertexium.cypher.VertexiumCypherScope)

Aggregations

ArrayList (java.util.ArrayList)1 VertexiumCypherScope (org.vertexium.cypher.VertexiumCypherScope)1 CypherUnwindClause (org.vertexium.cypher.ast.model.CypherUnwindClause)1