Search in sources :

Example 1 with OrFilterPipe

use of com.tinkerpop.pipes.filter.OrFilterPipe in project incubator-atlas by apache.

the class BooleanQueryExpression method asPipe.

@Override
public Pipe asPipe() {
    Map<BooleanClause.Occur, Collection<BooleanClause>> groupedClauses = groupClauses();
    Pipe andPipe = null;
    Collection<Pipe> andPipes = processAndClauses(groupedClauses);
    andPipes.addAll(processNotClauses(groupedClauses));
    if (!andPipes.isEmpty()) {
        andPipe = new AndFilterPipe(andPipes.toArray(new Pipe[andPipes.size()]));
    }
    Collection<Pipe> orPipes = processOrClauses(groupedClauses);
    if (!orPipes.isEmpty()) {
        if (andPipe != null) {
            orPipes.add(andPipe);
        }
        return new OrFilterPipe(orPipes.toArray(new Pipe[orPipes.size()]));
    } else {
        return andPipe;
    }
}
Also used : AndFilterPipe(com.tinkerpop.pipes.filter.AndFilterPipe) Pipe(com.tinkerpop.pipes.Pipe) OrFilterPipe(com.tinkerpop.pipes.filter.OrFilterPipe) AndFilterPipe(com.tinkerpop.pipes.filter.AndFilterPipe) OrFilterPipe(com.tinkerpop.pipes.filter.OrFilterPipe)

Aggregations

Pipe (com.tinkerpop.pipes.Pipe)1 AndFilterPipe (com.tinkerpop.pipes.filter.AndFilterPipe)1 OrFilterPipe (com.tinkerpop.pipes.filter.OrFilterPipe)1