Package org.jrdf.graph

Examples of org.jrdf.graph.TripleFactory


    public void addPerformance(int numberOfNodes, Graph graph, GraphPerformance performance) throws GraphException {
        long startTime = System.currentTimeMillis();
        for (int i = 0; i < numberOfNodes; i++) {
            for (int j = 0; j < numberOfPredicates; j++) {
                TripleFactory tripleFactory = graph.getTripleFactory();
                tripleFactory.addTriple(URI.create(subjectPrefix + i), URI.create(predicatePrefix + j),
                    URI.create(objectPrefix + j));
            }
        }
        performance.outputResult(graph, startTime, "Testing Add Performance:");
    }
View Full Code Here


     */
    private void searchGraph(Graph graph) throws Exception {
        System.out.println("Searching Graph...");

        //get the Factory
        TripleFactory tripleFactory = graph.getTripleFactory();
        getAllTriples(tripleFactory, graph);
        doSearch(tripleFactory, graph);
    }
View Full Code Here

    private void performReification(Graph graph) throws Exception {
        System.out.println("Reifying a statement...");

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

TOP

Related Classes of org.jrdf.graph.TripleFactory

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.