Package org.openrdf.sail

Examples of org.openrdf.sail.SailConnection.begin()


    sail.setUser("sesame");
    sail.setPassword("opensesame");
    sail.initialize();
    SailConnection conn = sail.getConnection();
    try {
      conn.begin();
      conn.removeStatements(null, null, null);
      conn.clearNamespaces();
      conn.commit();
    }
    finally {
View Full Code Here


    sail.setUser("sesame");
    sail.setPassword("opensesame");
    sail.initialize();
    SailConnection conn = sail.getConnection();
    try {
      conn.begin();
      conn.removeStatements(null, null, null);
      conn.clearNamespaces();
      conn.commit();
    }
    finally {
View Full Code Here

        URI gasGiant = new URIImpl("http://example.org/terms/gasGiant");
        URI narrower = new URIImpl("http://www.w3.org/2004/02/skos/core#narrower");

        SailConnection sc = sail.getConnection();
        try {
            sc.begin();
            sc.addStatement(planet, RDFS.LABEL, new LiteralImpl("planet", "en"));
            sc.addStatement(gasGiant, RDFS.LABEL, new LiteralImpl("gas giant", "en"));
            sc.addStatement(planet, narrower, gasGiant);
            sc.commit();
        } finally {
View Full Code Here

                        final RDFHandler... rdfHandlers) {
        try {
            this.commit();
            final SailConnection c = this.rawGraph.getConnection();
            try {
                c.begin();
                RDFHandler h = null == baseGraph
                        ? new SailAdder(c)
                        : new SailAdder(c, new URIImpl(baseGraph));
                if (rdfHandlers != null) {
                    RDFHandler[] handlers = new RDFHandler[rdfHandlers.length + 1];
View Full Code Here

    public void saveRDF(final OutputStream output, final String format) {
        try {
            this.commit();
            final SailConnection c = this.rawGraph.getConnection();
            try {
                c.begin();
                RDFWriter w = Rio.createWriter(getFormat(format), output);
                w.startRDF();

                CloseableIteration<? extends Statement, SailException> iter = c.getStatements(null, null, null, false);
                try {
View Full Code Here

    }

    private synchronized SailConnection createConnection() throws SailException {
        cleanupConnections();
        final SailConnection sc = rawGraph.getConnection();
        sc.begin();
        connections.add(sc);
        return sc;
    }

    private void cleanupConnections() throws SailException {
View Full Code Here

    public void commit() {
        try {
            SailConnection sc = this.sailConnection.get();
            sc.commit();
            sc.begin();
        } catch (SailException e) {
            throw new RuntimeException(e.getMessage(), e);
        }
    }
View Full Code Here

    public void rollback() {
        try {
            SailConnection sc = this.sailConnection.get();
            sc.rollback();
            sc.begin();
        } catch (SailException e) {
            throw new RuntimeException(e.getMessage(), e);
        }
    }
View Full Code Here

    }

    protected void clear() throws Exception {
        SailConnection sc = sail.getConnection();
        try {
            sc.begin();
            sc.clear();
            sc.commit();
        } finally {
            sc.rollback();
            sc.close();
View Full Code Here

    protected void addFile(final InputStream in,
                           final RDFFormat format) throws Exception {
        try {
            SailConnection sc = sail.getConnection();
            sc.begin();
            try {
                RDFHandler h = new SailAdder(sc);
                RDFParser p = Rio.createParser(format);
                p.setRDFHandler(h);
                p.parse(in, "http://example.org/bogusBaseURI/");
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.