Package net.fortytwo.linkeddata.sail

Examples of net.fortytwo.linkeddata.sail.LinkedDataSail


    }

    private static Sail createSail(final SailGraph storageGraph) {
        try {
            Ripple.initialize();
            return new LinkedDataSail(storageGraph.getRawGraph());
        } catch (Exception e) {
            throw new RuntimeException(e.getMessage(), e);
        }
    }
View Full Code Here


    }

    private static void runDemo() throws Exception {
        Sail storage = new MemoryStore();
        storage.initialize();
        Sail linkedData = new LinkedDataSail(storage);
        linkedData.initialize();

        RippleSail ripple = new RippleSail(linkedData);
        ripple.initialize();

        Repository repo = new SailRepository(ripple);
        RepositoryConnection rc = repo.getConnection();

        // Constructing literal subjects
        String query1 = "PREFIX math: <http://fortytwo.net/2011/04/ripple/math#>\n" +
                "PREFIX stack: <http://fortytwo.net/2011/04/ripple/stack#>\n" +
                "SELECT ?result WHERE {\n" +
                "   ?x stack:self 42 .\n" +
                "   ?x math:sqrt ?result .\n" +
                "}";

        // Constructing literal predicates
        String query2 = "PREFIX graph: <http://fortytwo.net/2011/04/ripple/graph#>\n" +
                "PREFIX stack: <http://fortytwo.net/2011/04/ripple/stack#>\n" +
                "PREFIX s: <urn:string:>\n" +
                "SELECT ?result WHERE {\n" +
                "   ?x stack:self \"{\\\"foo\\\": true, \\\"bar\\\": [6, 9, 42]}\" .\n" +
                "   ?x graph:to-json/s:foo ?result .\n" +
                "}";

        // Loading externally-defined programs
        String query3 = "PREFIX : <http://ripple.fortytwo.net/code/2011/06/rippleSailExamples#>\n" +
                "SELECT ?name WHERE {" +
                "    () :embarcadero/:parent-place*/s:name ?name ." +
                "}";

        TupleQueryResult r = rc.prepareTupleQuery(QueryLanguage.SPARQL, query2).evaluate();
        while (r.hasNext()) {
            System.out.println("result: " + r.next());
        }

        rc.close();
        repo.shutDown();
        ripple.shutDown();
        linkedData.shutDown();
        storage.shutDown();
    }
View Full Code Here

        map.put("http://www.holygoat.co.uk/owl/redwood/0.1/tags/Tagging",
                LinkedDataSailTest.class.getResource("tags.owl").toString());

        LinkedDataCache wc = LinkedDataCache.createDefault(baseSail);
        wc.setURIMap(map);
        sail = new LinkedDataSail(baseSail, wc);
        sail.initialize();
    }
View Full Code Here

        baseSail.initialize();

        try {
            Repository repo = new SailRepository(baseSail);

            LinkedDataSail sail = new LinkedDataSail(baseSail);
            sail.initialize();
            try {
                SailConnection sc = sail.getConnection();
                try {
                    sc.begin();
                    sc.getStatements(new URIImpl("http://rdf.freebase.com/rdf/en.stephen_fry"), null, null, false);
                    sc.commit();
                } finally {
                    sc.close();
                }
            } finally {
                sail.shutDown();
            }

            RepositoryConnection rc = repo.getConnection();
            try {
                rc.export(new RDFHandler() {
View Full Code Here

        String baseSailType = props.getString(Ripple.LINKEDDATASAIL_BASE_SAIL);

        Sail base = config.createSail(baseSailType, uriMap);
        LinkedDataCache cache = LinkedDataCache.createDefault(base);
        cache.setURIMap(uriMap);
        Sail sail = new LinkedDataSail(base, cache);
        try {
            // Note: base Sail is already initialized.
            sail.initialize();
        } catch (SailException e) {
            throw new RippleException(e);
        }

        return sail;
View Full Code Here

TOP

Related Classes of net.fortytwo.linkeddata.sail.LinkedDataSail

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.