Package org.jrdf.graph

Examples of org.jrdf.graph.SubjectNode


        return index120.iterator();
    }

    // TODO AN Not tested - can change first and last values and tests still pass.
    public Triple createTriple(Long... nodes) {
        SubjectNode subject = (SubjectNode) nodePool.getNodeById(nodes[2]);
        PredicateNode predicate = (PredicateNode) nodePool.getNodeById(nodes[0]);
        ObjectNode object = (ObjectNode) nodePool.getNodeById(nodes[1]);
        return new TripleImpl(subject, predicate, object);
    }
View Full Code Here


        triplesToRemove.clear();
        triplesToAdd.clear();
    }

    public void addTripleToGraph(Triple triple) throws GraphException {
        SubjectNode subjectNode = elementFactory.createURIReference(((URIReference) triple.getSubject()).getURI());
        PredicateNode predicateNode = elementFactory.createURIReference(
            ((URIReference) triple.getPredicate()).getURI());
        ObjectNode objectNode = createLiteralOrURI(triple.getObject());
        final Triple triple1 = tripleFactory.createTriple(subjectNode, predicateNode, objectNode);
        graph.add(triple1);
View Full Code Here

        final Triple triple1 = tripleFactory.createTriple(subjectNode, predicateNode, objectNode);
        graph.add(triple1);
    }

    public void updateBlankNodes(Triple triple) throws GraphElementFactoryException {
        SubjectNode subjectNode = triple.getSubject();
        long hashcode;
        if (AbstractBlankNode.isBlankNode(subjectNode)) {
            hashcode = (long) subjectNode.hashCode();
            if (!newBNodeMap.containsKey(hashcode)) {
                newBNodeMap.put(hashcode, elementFactory.createBlankNode());
            }
        }
        final ObjectNode objectNode = triple.getObject();
View Full Code Here

        }
        return graph;
    }

    private Triple createNewTriple(Triple triple) throws GraphElementFactoryException {
        SubjectNode subjectNode = triple.getSubject();
        PredicateNode predicateNode = triple.getPredicate();
        ObjectNode objectNode = triple.getObject();
        SubjectNode newSubjectNode = (SubjectNode) createNewNode(subjectNode);
        PredicateNode newPredicateNode = predicateNode;
        ObjectNode newObjectNode = (ObjectNode) createNewNode(objectNode);
        return tripleFactory.createTriple(newSubjectNode, newPredicateNode, newObjectNode);
    }
View Full Code Here

            return;
        }
        // TODO Change to use visitor.
        if (SubjectNode.class.isAssignableFrom(node.getClass()) &&
            SubjectNode.class.isAssignableFrom(newNode.getClass())) {
            final SubjectNode oldSNode = (SubjectNode) createNewNode(node);
            ClosableIterable<Triple> triples = graph.find(oldSNode, ANY_PREDICATE_NODE, ANY_OBJECT_NODE);
            for (Triple triple : triples) {
                Triple newTriple =
                    tripleFactory.createTriple((SubjectNode) newNode, triple.getPredicate(), triple.getObject());
                triplesToAdd.add(newTriple);
View Full Code Here

    private void getAllBNodesForNode1(Node node, Graph graph, Set<BlankNode> bSet) throws GraphException {
        Set<Triple> set = setFactory.createSet(Triple.class);
        addTriplesToSetForSubject(graph, set, node);
        addTriplesToSetForObject(graph, set, node);
        for (Triple triple : set) {
            final SubjectNode sNode = triple.getSubject();
            addBlankNodeToSet(graph, bSet, sNode);
            final ObjectNode oNode = triple.getObject();
            addBlankNodeToSet(graph, bSet, oNode);
        }
        set.clear();
View Full Code Here

        }
        if (ObjectNode.class.isAssignableFrom(node.getClass())) {
            addTriplesToSet(tmpSet, ANY_SUBJECT_NODE, ANY_PREDICATE_NODE, (ObjectNode) node);
        }
        for (Triple triple : tmpSet) {
            final SubjectNode sNode = triple.getSubject();
            addBlankNodeToSet(sNode);
            final ObjectNode oNode = triple.getObject();
            addBlankNodeToSet(oNode);
        }
        tmpSet.clear();
View Full Code Here

        return index201.iterator();
    }

    // TODO AN Not tested - can change first and last values and tests still pass.
    public Triple createTriple(Long... nodes) {
        SubjectNode subject = (SubjectNode) nodePool.getNodeById(nodes[1]);
        PredicateNode predicate = (PredicateNode) nodePool.getNodeById(nodes[2]);
        ObjectNode object = (ObjectNode) nodePool.getNodeById(nodes[0]);
        return new TripleImpl(subject, predicate, object);
    }
View Full Code Here

    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

public class TripleBinding extends TupleBinding<Triple> implements Serializable {
    private static final long serialVersionUID = 6518054866571995110L;
    TupleBinding<Node> nodeBinding = new NodeBinding();

    public Triple entryToObject(TupleInput input) {
        SubjectNode subject = (SubjectNode) nodeBinding.entryToObject(input);
        PredicateNode predicate = (PredicateNode) nodeBinding.entryToObject(input);
        ObjectNode object = (ObjectNode) nodeBinding.entryToObject(input);
        return new TripleImpl(subject, predicate, object);
    }
View Full Code Here

TOP

Related Classes of org.jrdf.graph.SubjectNode

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.