Package org.jrdf.query.relation

Examples of org.jrdf.query.relation.EvaluatedRelation


            return new LinkedHashSet<Attribute>(relation.getSortedHeading());
        }
    }

    private EvaluatedRelation getResult(Graph graph, QueryEngine queryEngine) {
        EvaluatedRelation entireGraph = graphRelationFactory.createRelation(graph);
        queryEngine.initialiseBaseRelation(entireGraph);
        ExpressionSimplifier<Void> simplifier = new ExpressionSimplifierImpl();
        expression.accept(simplifier);
        expression = simplifier.getExpression();
        if (simplifier.parseAgain()) {
View Full Code Here


    }

    @Override
    public EvaluatedRelation visitProjection(Projection projection) {
        allVariables = projection.getAllVariables();
        EvaluatedRelation expression = getExpression(projection.getNextExpression());
        LinkedHashSet<Attribute> attributes = projection.getAttributes();
        result = project.include(expression, attributes);
        return result;
    }
View Full Code Here

        return result;
    }

    @Override
    public EvaluatedRelation visitConjunction(Conjunction conjunction) {
        EvaluatedRelation lhs = getExpression(conjunction.getLhs());
        EvaluatedRelation rhs = getExpression(conjunction.getRhs());
        Set<EvaluatedRelation> relations = new HashSet<EvaluatedRelation>();
        relations.add(lhs);
        relations.add(rhs);
        result = naturalJoin.join(relations);
        return result;
View Full Code Here

        return result;
    }

    @Override
    public EvaluatedRelation visitUnion(Union conjunction) {
        EvaluatedRelation lhs = getExpression(conjunction.getLhs());
        EvaluatedRelation rhs = getExpression(conjunction.getRhs());
        result = union.union(lhs, rhs);
        return result;
    }
View Full Code Here

    }

    @Override
    public EvaluatedRelation visitOptional(Optional optional) {
        // TODO (AN) This really should be nadic and just pass in the rhs
        EvaluatedRelation rhs = getExpression(optional.getRhs());
        EvaluatedRelation lhs;
        if (optional.getLhs() != null) {
            lhs = getExpression(optional.getLhs());
        } else {
            lhs = rhs;
        }
View Full Code Here

        return result;
    }

    @Override
    public EvaluatedRelation visitFilter(Filter filter) {
        EvaluatedRelation lhsRelation = getExpression(filter.getLhs());
        result = restrict.restrict(lhsRelation, filter.getRhs());
        return result;
    }
View Full Code Here

    @Override
    public Set<EvaluatedRelation> visitConjunction(Conjunction conjunction) {
        List<EvaluatedRelation> partialResult = new LinkedList<EvaluatedRelation>();
        for (Expression exp : constraintList) {
            EvaluatedRelation tempRelation = engine.getExpression(exp);
            if (tempRelation.isEmpty()) {
                return Collections.singleton(tempRelation);
            }
            partialResult.add(tempRelation);
        }
        engine.clearCacheHandler();
View Full Code Here

        return new LinkedHashSet<EvaluatedRelation>(partialResults);
    }

    // TODO YF join those with common attributes first.
    private void matchAttributes(List<EvaluatedRelation> relations, int pos) {
        EvaluatedRelation first = relations.get(pos);
        int idx, badPos = -1;
        for (idx = pos + 1; idx < relations.size(); idx++) {
            final EvaluatedRelation nextRel = relations.get(idx);
            final Set<Attribute> headings = getCommonHeadings(first, nextRel);
            if (headings.size() >= 1) {
                break;
            } else if (badPos < 0) {
                badPos = idx;
View Full Code Here

    }

    @Override
    public EvaluatedRelation visitConstraint(SingleConstraint constraint) {
        long time = System.currentTimeMillis();
        EvaluatedRelation relation = processConstraint(constraint);
        cacheHandler.addResultToCache(constraint, relation, time);
        return relation;
    }
View Full Code Here

    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));
            result = union.union(lhs, rhs);
        }
        return result;
    }
View Full Code Here

TOP

Related Classes of org.jrdf.query.relation.EvaluatedRelation

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.