Package org.jrdf.query.expression

Examples of org.jrdf.query.expression.Expression


    private void reorderExpressionList(List<Expression> constraintList) {
        sort(constraintList, comparator);
    }

    private void flattenExpression(BiOperandExpression expression, Collection<Expression> set, Class<?> expClass) {
        final Expression lhs = expression.getLhs();
        final Expression rhs = expression.getRhs();
        addExpressionToCollection(lhs, set, expClass);
        addExpressionToCollection(rhs, set, expClass);
    }
View Full Code Here


    @Override
    public EvaluatedRelation visitUnion(org.jrdf.query.expression.Union newUnion) {
        List<Expression> operands = planner.flattenExpression(newUnion);
        clearCacheHandler();
        Expression lhsExp = operands.get(0);
        Expression rhsExp = operands.get(1);
        EvaluatedRelation lhs = getExpression(lhsExp);
        if (shortCircuit) {
            result = (lhs.isEmpty()) ? getExpression(rhsExp) : lhs;
        } else {
            EvaluatedRelation rhs = getExpression(operands.get(1));
View Full Code Here

        return expression;
    }

    public Void visitProjection(Projection projection) {
        declaredVariables = projection.getAttributes();
        Expression next = getNext(projection.getNextExpression());
        projection.setNextExpression(next);
        expression = projection;
        return null;
    }
View Full Code Here

        expression = projection;
        return null;
    }

    public Void visitConjunction(Conjunction conjunction) {
        final Expression lhs = getNext(conjunction.getLhs());
        final Expression rhs = getNext(conjunction.getRhs());
        if (lhs == null && rhs == null) {
            expression = null;
        } else if (lhs == null) {
            expression = rhs;
        } else if (rhs == null) {
View Full Code Here

        }
        return null;
    }

    private Expression constructNewConjunction(Expression lhs, Expression rhs) {
        Expression tmpExpression = constructFilteredConjunction(lhs, rhs);
        if (tmpExpression == null) {
            tmpExpression = constructUnionedConjunction(lhs, rhs);
            if (tmpExpression == null) {
                if (EXPRESSION_COMPARATOR.compare(lhs, rhs) <= 0) {
                    tmpExpression = new Conjunction(lhs, rhs);
View Full Code Here

        }
        return tmpExpression;
    }

    private Expression constructFilteredConjunction(Expression lhs, Expression rhs) {
        Expression tmpExpression = null;
        if (lhs instanceof Filter && rhs instanceof Filter) {
            Expression llhs = ((Filter) lhs).getLhs();
            Expression lrhs = ((Filter) rhs).getLhs();
            tmpExpression = new Conjunction(llhs, lrhs);
            LogicExpression andExp = new LogicAndExpression(((Filter) lhs).getRhs(),
                ((Filter) rhs).getRhs());
            tmpExpression = new Filter(tmpExpression, andExp);
        } else if (lhs instanceof Filter) {
View Full Code Here

        }
        return getNext(tmpExpression);
    }

    private Expression constructConjFilter(Filter lhs, Expression rhs) {
        Expression result;
        Expression llhs = lhs.getLhs();
        result = new Conjunction(llhs, rhs);
        result = new Filter(result, lhs.getRhs());
        return result;
    }
View Full Code Here

        result = new Filter(result, lhs.getRhs());
        return result;
    }

    private Expression constructUnionedConjunction(Expression lhs, Expression rhs) {
        Expression tmpExpression = null;
        if (lhs instanceof Union) {
            tmpExpression = distributeConjunctionWithUnion((Union) lhs, rhs);
        } else if (rhs instanceof Union) {
            tmpExpression = distributeConjunctionWithUnion((Union) rhs, lhs);
        }
View Full Code Here

        }
        return getNext(tmpExpression);
    }

    private Expression distributeConjunctionWithUnion(Union lhs, Expression rhs) {
        Expression uLhs = lhs.getLhs();
        Expression uRhs = lhs.getRhs();
        Expression newConj1 = getNext(new Conjunction(rhs, uLhs));
        Expression newConj2 = getNext(new Conjunction(rhs, uRhs));
        return getNext(new Union(newConj1, newConj2));
    }
View Full Code Here

        Expression newConj2 = getNext(new Conjunction(rhs, uRhs));
        return getNext(new Union(newConj1, newConj2));
    }

    public Void visitUnion(Union conjunction) {
        final Expression lhs = getNext(conjunction.getLhs());
        final Expression rhs = getNext(conjunction.getRhs());
        if (EXPRESSION_COMPARATOR.compare(lhs, rhs) <= 0) {
            expression = new Union(lhs, rhs);
        } else {
            expression = new Union(rhs, lhs);
        }
View Full Code Here

TOP

Related Classes of org.jrdf.query.expression.Expression

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.