Package org.jrdf.graph

Examples of org.jrdf.graph.Node


        }
    }

    @Override
    public Node visitStr(StrOperator str) {
        final Node value = getValue(str);
        if (value != null) {
            Node node = value;
            if (Literal.class.isAssignableFrom(node.getClass())) {
                Literal literal = (Literal) value;
                return new LiteralImpl(literal.getLexicalForm());
            }
        }
        return null;
View Full Code Here


        return null;
    }

    @Override
    public Node visitLang(LangOperator lang) {
        final Node value = getValue(lang);
        if (value != null) {
            Node node = value;
            if (Literal.class.isAssignableFrom(node.getClass())) {
                Literal literal = (Literal) node;
                return new LiteralImpl(literal.getLanguage());
            }
        }
        return null;
View Full Code Here

        return null;
    }

    @Override
    public Node visitBound(BoundOperator bound) {
        final Node value = getValue(bound);
        boolean contradiction = (value == null);
        return new LiteralImpl(Boolean.toString(contradiction), XSD.BOOLEAN);
    }
View Full Code Here

    public ClosableIterator<Long[]> getEntries() {
        return index012.iterator();
    }

    public Triple createTriple(Long... nodes) {
        final Node subNode = nodePool.getNodeById(nodes[0]);
        final Node predNode = nodePool.getNodeById(nodes[1]);
        final Node objNode = nodePool.getNodeById(nodes[2]);

        SubjectNode subject = (SubjectNode) subNode;
        PredicateNode predicate = (PredicateNode) predNode;
        ObjectNode object = (ObjectNode) objNode;
        return new TripleImpl(subject, predicate, object);
View Full Code Here

            //Long index = iterator201.next().getKey();
            final Long nodeId = getNextNodeId(iterator201);

            //check the SPO does not contain the given index and that we haven't reached the end of iterator
            if (nodeId != -1 && !longIndex012.contains(nodeId)) {
                final Node node = nodePool.getNodeById(nodeId);
                //check node is not a literal
                if (!(node instanceof Literal)) {
                    return resourceFactory.createResource(node);
                }
            }
View Full Code Here

     * @return next element in the SPO index.
     */
    private Resource getNextSPOElement() {
        final Long index = getNextNodeId(iterator012);
        if (index != -1) {
            final Node node = nodePool.getNodeById(index);
            return resourceFactory.createResource(node);
        }
        return null;
    }
View Full Code Here

    private int compareAttributeValues(Map<Attribute, Node> attributeValues1,
        Map<Attribute, Node> attributeValues2) {
        int result = 0;
        for (Map.Entry<Attribute, Node> entry : attributeValues1.entrySet()) {
            if (attributeValues2.keySet().contains(entry.getKey())) {
                final Node value1 = entry.getValue();
                final Node value2 = attributeValues2.get(entry.getKey());
                result = nodeComparator.compare(value1, value2);
                if (result != 0) {
                    break;
                }
            } else {
View Full Code Here

    private StringNodeMapper mapper = new StringNodeMapperFactoryImpl().createMapper();
    private TupleOutput tupleOutput;
    private Object node;

    public Node entryToObject(TupleInput tupleInput) {
        Node tmpNode;
        byte b = tupleInput.readByte();
        String str = tupleInput.readString();
        if (b == BLANK_NODE) {
            tmpNode = mapper.convertToBlankNode(str);
        } else if (b == URI_REFERENCE) {
View Full Code Here

        ObjectNode newObjectNode = (ObjectNode) createNewNode(objectNode);
        return tripleFactory.createTriple(newSubjectNode, newPredicateNode, newObjectNode);
    }

    public Node createNewNode(Node node) throws GraphElementFactoryException {
        Node newNode;
        if (AbstractBlankNode.isBlankNode(node)) {
            newNode = newBNodeMap.get((long) node.hashCode());
        } else {
            newNode = createLiteralOrURI((ObjectNode) node);
        }
View Full Code Here

    protected long getNextNodeId(final ClosableIterator<Long[]> iterator) {
        long nextKey = currentValue;
        while (iterator.hasNext() && nextKey == currentValue) {
            final long id = iterator.next()[0];
            if (id != currentValue) {
                final Node node = nodePool.getNodeById(id);
                if (node instanceof URIReference) {
                    nextKey = id;
                }
            }
        }
View Full Code Here

TOP

Related Classes of org.jrdf.graph.Node

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.