Package org.jrdf.graph

Examples of org.jrdf.graph.URIReference


        return node;
    }

    public URIReference createLocalURIReference(URI uri, boolean validate) {
        currentId = nodePool.getNewNodeId();
        URIReference node = new URIReferenceImpl(uri, validate, currentId);
        nodePool.registerURIReference(node);
        return node;
    }
View Full Code Here


    public void load(Graph graph) throws GraphException {
        // check for blank nodes
        ClosableIterable<? extends Node> predicates = graph.findNodes(PREDICATE_TYPE);
        for (Node node : predicates) {
            URIReference uriReference = (URIReference) node;
            String partial = getPartialUri(uriReference.getURI().toString());
            if (!uris.containsKey(partial)) {
                String ns = NS_PREFIX + names.size();
                add(ns, partial);
            }
        }
View Full Code Here

        return getLocalLiteral("\"" + EscapeUtil.escape(lexicalValue) + "\"" + "^^<" + datatypeURI + ">");
    }

    private URIReference getLocalURIReference(URI uri, boolean validate) {
        Long nodeId = nodePool.getNodeIdByString(uri.toString());
        URIReference newURIReference;
        if (null != nodeId) {
            newURIReference = (URIReference) nodePool.getNodeById(nodeId);
        } else {
            newURIReference = localizer.createLocalURIReference(uri, validate);
        }
View Full Code Here

    private void addResult(Set<Molecule> results, Molecule molecule) {
        results.add(molecule);
    }

    private void addGrounded(String predicate) throws Exception {
        URIReference p = elementFactory.createURIReference(URI.create(predicate));
        graph.add(p, p, p);
    }
View Full Code Here

        graph.add(p, p, p);
    }

    private void addTriple(String predicate) throws Exception {
        BlankNode s = elementFactory.createBlankNode();
        URIReference p = elementFactory.createURIReference(URI.create(predicate));
        BlankNode o = elementFactory.createBlankNode();
        graph.add(s, p, o);
    }
View Full Code Here

        BlankNode o = elementFactory.createBlankNode();
        graph.add(s, p, o);
    }

    private void addChain(String predicate) throws Exception {
        URIReference p1 = elementFactory.createURIReference(URI.create(predicate));
        BlankNode thisNode = elementFactory.createBlankNode();
        for (int i = 0; i < CHAIN_SIZE; i++) {
            BlankNode nextNode = elementFactory.createBlankNode();
            graph.add(thisNode, p1, nextNode);
            thisNode = nextNode;
View Full Code Here

            thisNode = nextNode;
        }
    }

    private void addLoop(String predicate) throws Exception {
        URIReference p1 = elementFactory.createURIReference(URI.create(predicate));
        BlankNode firstNode = elementFactory.createBlankNode();
        BlankNode thisNode = firstNode;
        for (int i = 0; i < LOOP_SIZE; i++) {
            BlankNode nextNode = elementFactory.createBlankNode();
            graph.add(thisNode, p1, nextNode);
View Full Code Here

        }
        performance.outputResult(graph, startTime, "Testing Find Performance: " + noFinds);
    }

    private void find1(Graph graph, URI subjectURI) throws GraphException {
        URIReference predicate = graph.getElementFactory().createURIReference(subjectURI);
        ClosableIterable<Triple> triples = findAllPredicates(graph, predicate);
        try {
            for (Triple triple : triples) {
                ObjectNode object = triple.getObject();
                find2(graph, object);
View Full Code Here

        //get the Factories
        GraphElementFactory elementFactory = graph.getElementFactory();
        TripleFactory tripleFactory = graph.getTripleFactory();

        //create a resource to identify the statement
        URIReference statement = elementFactory.createURIReference(new URI("http://example.org/statement#address"));

        //reify the address statement (person, hasAddress, address)
        tripleFactory.reifyTriple(addressStatement, statement);

        //insert a statement about the original statement
        URIReference manager = elementFactory.createURIReference(new URI("http://example.org/managerid#65"));
        URIReference hasConfirmed = elementFactory.createURIReference(new URI("http://example.org/terms#hasConfirmed"));
        Triple confirmationStatement = tripleFactory.createTriple(manager, hasConfirmed, statement);
        graph.add(confirmationStatement);

        //print the contents
        print("Graph contains (after reification): ", graph);
View Full Code Here

        for (int index = 0; index < nodesToUpdate; index++) {
            URI subjectURI = URI.create(subjectPrefix + index);
            List<Triple> triplesToChange = addTriplesToArray(graph, subjectURI);
            for (Triple triple : triplesToChange) {
                URI subject = ((URIReference) triple.getSubject()).getURI();
                URIReference newSubject = graph.getElementFactory().createURIReference(
                    URI.create(subject.toString() + "hello"));
                graph.add(newSubject, triple.getPredicate(), triple.getObject());
                graph.remove(triple);
                noUpdates++;
            }
View Full Code Here

TOP

Related Classes of org.jrdf.graph.URIReference

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.