use of org.vertexium.cypher.executor.utils.MatchConstraintBuilder in project vertexium by visallo.
the class MatchClauseExecutor method execute.
public VertexiumCypherScope execute(VertexiumCypherQueryContext ctx, List<CypherMatchClause> matchClauses, VertexiumCypherScope scope) {
if (LOGGER.isDebugEnabled()) {
LOGGER.debug("execute: %s", matchClauses.stream().map(CypherMatchClause::toString).collect(Collectors.joining("; ")));
}
MatchConstraints matchConstraints = new MatchConstraintBuilder().getMatchConstraints(matchClauses);
Stream<VertexiumCypherScope.Item> results = scope.stream().flatMap(item -> executeMatchConstraints(ctx, matchConstraints, item));
return VertexiumCypherScope.newItemsScope(results, scope);
}
use of org.vertexium.cypher.executor.utils.MatchConstraintBuilder in project vertexium by visallo.
the class MergeClauseExecutor method execute.
public VertexiumCypherScope execute(VertexiumCypherQueryContext ctx, CypherMergeClause clause, VertexiumCypherScope scope) {
LOGGER.debug("execute: %s", clause);
// need to materialize the scope
scope.run();
PatternPartMatchConstraint patternPartConstraint = new MatchConstraintBuilder().patternPartToConstraints(clause.getPatternPart(), false);
Stream<VertexiumCypherScope> results = scope.stream().map(item -> {
Stream<VertexiumCypherScope.Item> patternPartResults = ctx.getMatchClauseExecutor().executePatternPartConstraint(ctx, patternPartConstraint, item);
return StreamUtils.ifEmpty(patternPartResults, () -> {
Stream<VertexiumCypherScope.Item> createResults = executeCreate(ctx, clause, patternPartConstraint, item);
return VertexiumCypherScope.newItemsScope(createResults, scope);
}, (stream) -> executeMatch(ctx, clause, stream, scope));
});
return results.collect(VertexiumCypherScope.concatStreams(scope));
}
Aggregations