Package org.jrdf.query.relation

Examples of org.jrdf.query.relation.Attribute


        this.nodeComparator = newNodeComparator;
    }

    public void mergeJoin(SortedSet<Attribute> headings, SortedSet<Attribute> commonHeadings,
        EvaluatedRelation relation1, EvaluatedRelation relation2, SortedSet<Tuple> result) {
        Attribute attr = chooseACommonHeading(headings, relation1, relation2);
        commonHeadings.remove(attr);
        final PartitionedRelation partRelation1 = new PartitionedRelationImpl(nodeComparator, attr, relation1);
        final PartitionedRelation partRelation2 = new PartitionedRelationImpl(nodeComparator, attr, relation2);
        sortMergeJoin.mergeJoin(headings, commonHeadings, partRelation1, partRelation2, result);
    }
View Full Code Here


        sortMergeJoin.mergeJoin(headings, commonHeadings, partRelation1, partRelation2, result);
    }

    private Attribute chooseACommonHeading(Set<Attribute> headings, EvaluatedRelation rel1, EvaluatedRelation rel2) {
        final Iterator<Attribute> iterator = headings.iterator();
        Attribute attribute = iterator.next();
        Attribute result = attribute;
        long curMin = estimateJoinCost(attribute, rel1, rel2);
        while (iterator.hasNext()) {
            attribute = iterator.next();
            long cost = estimateJoinCost(attribute, rel1, rel2);
            if (curMin > cost) {
View Full Code Here

        return result;
    }

    private Node getNextValue(Operator operator) {
        final Map<Attribute, Node> avp = operator.getValue();
        Attribute attribute = avp.keySet().iterator().next();
        return tuple.getValue(attribute);
    }
View Full Code Here

    }

    @Override
    public Node visitSingleValue(SingleValue singleValue) {
        Map<Attribute, Node> avo = singleValue.getValue();
        Attribute attribute = avo.keySet().iterator().next();
        Node node = avo.get(attribute);
        final Node newValue = tuple.getValue(attribute);
        if (ANY_NODE.equals(node)) {
            if (newValue != null) {
                return newValue;
View Full Code Here

        return new LiteralImpl(Boolean.toString(contradiction), XSD.BOOLEAN);
    }

    private Node getValue(Operator operator) {
        final Map<Attribute, Node> avp = operator.getValue();
        Attribute attribute = avp.keySet().iterator().next();
        return tuple.getValue(attribute);
    }
View Full Code Here

        Set<Attribute> sortedHeading2 = relation2.getSortedHeading();
        Iterator<Attribute> iterator1 = sortedHeading1.iterator();
        Iterator<Attribute> iterator2 = sortedHeading2.iterator();
        boolean equal = true;
        while (iterator1.hasNext() && iterator2.hasNext() && equal) {
            Attribute att1 = iterator1.next();
            Attribute att2 = iterator2.next();
            result = attributeComparator.compare(att1, att2);
            equal = result == 0;
        }
        return result;
    }
View Full Code Here

        Iterator<Attribute> iterator1 = sorted1.iterator();
        Iterator<Attribute> iterator2 = sorted2.iterator();
        int result = 0;
        boolean equal = true;
        while (iterator1.hasNext() && iterator2.hasNext() && equal) {
            Attribute att1 = iterator1.next();
            Attribute att2 = iterator2.next();
            result = attributeComparator.compare(att1, att2);
            equal = result == 0;
        }
        return result;
    }
View Full Code Here

    private TupleBinding<AttributeName> nameBinding = new AttributeNameBinding();
    private TupleBinding<NodeType> typeBinding = new NodeTypeBinding();

    public Attribute entryToObject(TupleInput tupleInput) {
        final byte b = tupleInput.readByte();
        Attribute attribute;
        if (b == NORMAL_ATTRIBUTE) {
            AttributeName name = nameBinding.entryToObject(tupleInput);
            NodeType type = typeBinding.entryToObject(tupleInput);
            attribute = new AttributeImpl(name, type);
        } else if (b == NULLARY_ATTRIBUTE) {
View Full Code Here

    }

    @Override
    public String toString() {
        Map.Entry<Attribute, Node> attributeValue = singleAvp.entrySet().iterator().next();
        Attribute attribute = attributeValue.getKey();
        return BOUND + " (" + attribute + ")";
    }
View Full Code Here

            if (type == null) {
                String literal = variable.getLiteral();
                throw new ParserException(new TIdentifier(literal), "Failed to find variable " +
                    literal + " in where clause. ");
            } else {
                Attribute attribute = new AttributeImpl(variable, type);
                newAttributes.add(attribute);
            }
        }
        return newAttributes;
    }
View Full Code Here

TOP

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

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.