private DBObject translateUnaryLogicalExpression(FieldTreeNode context, UnaryLogicalExpression expr) { List<DBObject> l=new ArrayList<>(1); l.add(translate(context,expr.getQuery())); return new BasicDBObject(UNARY_LOGICAL_OPERATOR_MAP.get(expr.getOp()), l); }
private DBObject translateUnaryLogicalExpression(FieldTreeNode context, EntityMetadata md, UnaryLogicalExpression expr, EntityMetadata emd, MutablePath fullPath) { List<DBObject> l = new ArrayList<>(1); l.add(translate(context, expr.getQuery(), emd, fullPath)); return new BasicDBObject(UNARY_LOGICAL_OPERATOR_MAP.get(expr.getOp()), l); }
public UnaryLogicalExpressionEvaluator(UnaryLogicalExpression expr, FieldTreeNode context) { evaluator = QueryEvaluator.getInstance(expr.getQuery(), context); operator = expr.getOp(); }
public UnaryLogicalExpressionEvaluator(UnaryLogicalExpression expr, FieldTreeNode context) { evaluator = QueryEvaluator.getInstance(expr.getQuery(), context); operator = expr.getOp(); }
@Override public QueryExpression rewrite(QueryExpression q) { UnaryLogicalExpression le = dyncast(UnaryLogicalExpression.class, q); if (le != null && le.getOp() == UnaryLogicalOperator._not) { UnaryLogicalExpression oreq = dyncast(UnaryLogicalExpression.class, le.getQuery()); if (oreq != null && oreq.getOp() == UnaryLogicalOperator._not) { return oreq.getQuery(); } } return q; } }
public UnaryLogicalExpressionEvaluator(UnaryLogicalExpression expr, FieldTreeNode context) { evaluator = QueryEvaluator.getInstance(expr.getQuery(), context); operator = expr.getOp(); }
@Override public QueryExpression rewrite(QueryExpression q) { UnaryLogicalExpression le = dyncast(UnaryLogicalExpression.class, q); if (le != null && le.getOp() == UnaryLogicalOperator._not) { UnaryLogicalExpression oreq = dyncast(UnaryLogicalExpression.class, le.getQuery()); if (oreq != null && oreq.getOp() == UnaryLogicalOperator._not) { return oreq.getQuery(); } } return q; } }
@Override public QueryExpression rewrite(QueryExpression q) { UnaryLogicalExpression le=dyncast(UnaryLogicalExpression.class,q); if(le!=null&&le.getOp()==UnaryLogicalOperator._not) { UnaryLogicalExpression oreq=dyncast(UnaryLogicalExpression.class,le.getQuery()); if(oreq!=null&&oreq.getOp()==UnaryLogicalOperator._not) { return oreq.getQuery(); } } return q; } }
@Override public QueryExpression rewrite(QueryExpression q) { UnaryLogicalExpression le=dyncast(UnaryLogicalExpression.class,q); if(le!=null&&le.getOp()==UnaryLogicalOperator._not) { NaryLogicalExpression oreq=dyncast(NaryLogicalExpression.class,le.getQuery()); if(oreq!=null&&oreq.getOp()==NaryLogicalOperator._or) { List<QueryExpression> newList=new ArrayList<>(oreq.getQueries().size()); for(QueryExpression x:oreq.getQueries()) newList.add(new UnaryLogicalExpression(UnaryLogicalOperator._not,x)); return new NaryLogicalExpression(NaryLogicalOperator._and,newList); } } return q; } }
/** * Default behavior is to recursively iterate the nested query. If nested * processing returns an object different from the original nested query, * this method creates a new unary logical expression using the new query * expression, and returns that. */ protected QueryExpression itrUnaryLogicalExpression(UnaryLogicalExpression q, Path context) { QueryExpression newq = iterate(q.getQuery(), context); if (newq != q.getQuery()) { return new UnaryLogicalExpression(q.getOp(), newq); } else { return q; } }
/** * Default behavior is to recursively iterate the nested query. If nested * processing returns an object different from the original nested query, * this method creates a new unary logical expression using the new query * expression, and returns that. */ protected QueryExpression itrUnaryLogicalExpression(UnaryLogicalExpression q, Path context) { QueryExpression newq = iterate(q.getQuery(), context); if (newq != q.getQuery()) { return new UnaryLogicalExpression(q.getOp(), newq); } else { return q; } }
@Override public QueryExpression rewrite(QueryExpression q) { UnaryLogicalExpression le = dyncast(UnaryLogicalExpression.class, q); if (le != null && le.getOp() == UnaryLogicalOperator._not) { NaryLogicalExpression oreq = dyncast(NaryLogicalExpression.class, le.getQuery()); if (oreq != null && oreq.getOp() == NaryLogicalOperator._or) { List<QueryExpression> newList = new ArrayList<>(oreq.getQueries().size()); for (QueryExpression x : oreq.getQueries()) { newList.add(new UnaryLogicalExpression(UnaryLogicalOperator._not, x)); } return new NaryLogicalExpression(NaryLogicalOperator._and, newList); } } return q; } }
@Override public QueryExpression rewrite(QueryExpression q) { UnaryLogicalExpression le = dyncast(UnaryLogicalExpression.class, q); if (le != null && le.getOp() == UnaryLogicalOperator._not) { NaryLogicalExpression oreq = dyncast(NaryLogicalExpression.class, le.getQuery()); if (oreq != null && oreq.getOp() == NaryLogicalOperator._or) { List<QueryExpression> newList = new ArrayList<>(oreq.getQueries().size()); for (QueryExpression x : oreq.getQueries()) { newList.add(new UnaryLogicalExpression(UnaryLogicalOperator._not, x)); } return new NaryLogicalExpression(NaryLogicalOperator._and, newList); } } return q; } }
LOGGER.debug("Rewritten nested query={}",newNestedq); if(newNestedq!=nestedq) newq=new UnaryLogicalExpression( ((UnaryLogicalExpression)q).getOp(), newNestedq); } else if (q instanceof NaryLogicalExpression) { LOGGER.debug("q is a n-ary logical expression, rewriting nested terms");
LOGGER.debug("Rewritten nested query={}", newNestedq); if (newNestedq != nestedq) { newq = new UnaryLogicalExpression(((UnaryLogicalExpression) q).getOp(), newNestedq);
LOGGER.debug("Rewritten nested query={}", newNestedq); if (newNestedq != nestedq) { newq = new UnaryLogicalExpression(((UnaryLogicalExpression) q).getOp(), newNestedq);
@Override public QueryExpression rewrite(QueryExpression q) { UnaryLogicalExpression le=dyncast(UnaryLogicalExpression.class,q); if(le!=null&&le.getOp()==UnaryLogicalOperator._not) { ValueComparisonExpression vce=dyncast(ValueComparisonExpression.class,le.getQuery()); if(vce!=null) { return new ValueComparisonExpression(vce.getField(),vce.getOp().negate(),vce.getRvalue()); } else { FieldComparisonExpression fce=dyncast(FieldComparisonExpression.class,le.getQuery()); if(fce!=null) { return new FieldComparisonExpression(fce.getField(),fce.getOp().negate(),fce.getRfield()); } else { NaryRelationalExpression nre=dyncast(NaryRelationalExpression.class,le.getQuery()); if(nre!=null) { return new NaryRelationalExpression(nre.getField(),nre.getOp().negate(),nre.getValues()); } } } } return q; } }
@Override public QueryExpression rewrite(QueryExpression q) { UnaryLogicalExpression le = dyncast(UnaryLogicalExpression.class, q); if (le != null && le.getOp() == UnaryLogicalOperator._not) { ValueComparisonExpression vce = dyncast(ValueComparisonExpression.class, le.getQuery()); if (vce != null) { return new ValueComparisonExpression(vce.getField(), vce.getOp().negate(), vce.getRvalue()); } else { FieldComparisonExpression fce = dyncast(FieldComparisonExpression.class, le.getQuery()); if (fce != null) { return new FieldComparisonExpression(fce.getField(), fce.getOp().negate(), fce.getRfield()); } else { NaryValueRelationalExpression nre = dyncast(NaryValueRelationalExpression.class, le.getQuery()); if (nre != null) { return new NaryValueRelationalExpression(nre.getField(), nre.getOp().negate(), nre.getValues()); } else { NaryFieldRelationalExpression nfe = dyncast(NaryFieldRelationalExpression.class, le.getQuery()); if (nfe != null) { return new NaryFieldRelationalExpression(nfe.getField(), nfe.getOp().negate(), nfe.getRfield()); } } } } } return q; } }
@Override public QueryExpression rewrite(QueryExpression q) { UnaryLogicalExpression le = dyncast(UnaryLogicalExpression.class, q); if (le != null && le.getOp() == UnaryLogicalOperator._not) { ValueComparisonExpression vce = dyncast(ValueComparisonExpression.class, le.getQuery()); if (vce != null) { return new ValueComparisonExpression(vce.getField(), vce.getOp().negate(), vce.getRvalue()); } else { FieldComparisonExpression fce = dyncast(FieldComparisonExpression.class, le.getQuery()); if (fce != null) { return new FieldComparisonExpression(fce.getField(), fce.getOp().negate(), fce.getRfield()); } else { NaryValueRelationalExpression nre = dyncast(NaryValueRelationalExpression.class, le.getQuery()); if (nre != null) { return new NaryValueRelationalExpression(nre.getField(), nre.getOp().negate(), nre.getValues()); } else { NaryFieldRelationalExpression nfe = dyncast(NaryFieldRelationalExpression.class, le.getQuery()); if (nfe != null) { return new NaryFieldRelationalExpression(nfe.getField(), nfe.getOp().negate(), nfe.getRfield()); } } } } } return q; } }