All Downloads are FREE. Search and download functionalities are using the official Maven repository.

net.fortytwo.sesametools.writeonly.WriteOnlySail Maven / Gradle / Ivy

There is a newer version: 1.9
Show newest version

package net.fortytwo.sesametools.writeonly;

import org.openrdf.model.ValueFactory;
import org.openrdf.rio.RDFHandler;
import org.openrdf.sail.SailConnection;
import org.openrdf.sail.SailException;
import org.openrdf.sail.helpers.AbstractSail;

/**
 * A Sail which can be written to, but not read from.
 * Read operations are simply ignored or return no results.
 *
 * @author Joshua Shinavier (http://fortytwo.net).
 */
public class WriteOnlySail extends AbstractSail {
    private RDFHandler handler;
    private ValueFactory valueFactory;

    public WriteOnlySail(final RDFHandler handler,
                         final ValueFactory valueFactory) {
        this.handler = handler;
        this.valueFactory = valueFactory;
    }

    protected SailConnection getConnectionInternal() throws SailException {
        return new WriteOnlySailConnection(this, handler, valueFactory);
    }

    public ValueFactory getValueFactory() {
        return valueFactory;
    }

    protected void initializeInternal() throws SailException {
        // Does nothing
    }

    public boolean isWritable() throws SailException {
        return true;
    }

    protected void shutDownInternal() throws SailException {
        // Does nothing
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy