Package org.jrdf.graph

Examples of org.jrdf.graph.PredicateNode


    }

    // 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


        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

        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 (PredicateNode.class.isAssignableFrom(node.getClass()) &&
            PredicateNode.class.isAssignableFrom(newNode.getClass())) {
            final PredicateNode oldONode = (PredicateNode) createNewNode(node);
            ClosableIterable<Triple> triples = graph.find(ANY_SUBJECT_NODE, oldONode, ANY_OBJECT_NODE);
            for (Triple triple : triples) {
                Triple newTriple =
                    tripleFactory.createTriple(triple.getSubject(), (PredicateNode) newNode, triple.getObject());
                triplesToAdd.add(newTriple);
View Full Code Here

    }

    // 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

        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

    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

        return moleculeFactory.createMolecule(triples);
    }

    private Triple convertTriple(Triple triple) {
        SubjectNode subject = triple.getSubject();
        PredicateNode predicate = triple.getPredicate();
        ObjectNode object = triple.getObject();
        if (map.containsKey(subject)) {
            subject = map.get(subject);
        }
        if (map.containsKey(object)) {
View Full Code Here

    }

    private void init() {
        try {
            GraphElementFactory elementFactory = graph.getElementFactory();
            PredicateNode type = elementFactory.createURIReference(RDF.TYPE);
            ObjectNode graphName = elementFactory.createURIReference(GRAPH);
            for (Triple triple : graph.find(ANY_SUBJECT_NODE, type, graphName)) {
                addResource(elementFactory, triple);
            }
        } catch (Exception e) {
View Full Code Here

    public PredicateNode next() {
        if (null == currentBytes) {
            throw new NoSuchElementException();
        }
        PredicateNode predicateNode = currentPredicate;
        getNextUniquePredicate();
        return predicateNode;
    }
View Full Code Here

TOP

Related Classes of org.jrdf.graph.PredicateNode

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.