public ReadOnlySailConnection(final AbstractSail sail, final Sail baseSail) throws SailException { super(sail); baseSailConnection = baseSail.getConnection(); }
protected void shutDownInternal() throws SailException { baseSail.shutDown(); } }
public CachingSailConnection(final AbstractSail sail, final Sail baseSail, final Sail cache, final boolean cacheSubject, final boolean cachePredicate, final boolean cacheObject, final Set<Resource> cachedSubjects, final Set<IRI> cachedPredicates, final Set<Value> cachedObjects) throws SailException { super(sail); this.cacheSubject = cacheSubject; this.cachePredicate = cachePredicate; this.cacheObject = cacheObject; baseSailConnection = baseSail.getConnection(); cacheConnection = cache.getConnection(); this.cachedSubjects = cachedSubjects; this.cachedPredicates = cachedPredicates; this.cachedObjects = cachedObjects; this.valueFactory = baseSail.getValueFactory(); }
private void dumpNativeStoreToRDFDocument(final File nativeStoreDirectory, final File dumpFile, final RDFFormat format, final Resource... contexts) throws SailException, RepositoryException, IOException, RDFHandlerException { logger.info("dumping store at " + nativeStoreDirectory + " to file " + dumpFile); Sail sail = new NativeStore(nativeStoreDirectory); sail.initialize(); try { Repository repo = new SailRepository(sail); try (RepositoryConnection rc = repo.getConnection()) { try (OutputStream out = new FileOutputStream(dumpFile)) { RDFHandler h = Rio.createWriter(format, out); rc.export(h, contexts); } } } finally { sail.shutDown(); } } }
final ValueFactory vf = ryaSail.getValueFactory(); final List<Statement> statements = Lists.newArrayList( vf.createStatement(vf.createIRI("http://Eve"), vf.createIRI("http://talksTo"), vf.createIRI("http://Charlie")), vf.createStatement(vf.createIRI("http://Charlie"), vf.createIRI("http://worksAt"), vf.createIRI("http://CoffeeShop"))); SailConnection ryaConn = ryaSail.getConnection(); log.info(""); log.info("Loading the following statements:"); ryaConn = ryaSail.getConnection(); final CloseableIteration<? extends BindingSet, QueryEvaluationException> result = ryaConn.evaluate(parsedQuery.getTupleExpr(), null, null, false); if(ryaSail != null) { log.info("Shutting down the Rya Sail instance."); ryaSail.shutDown();
@Override public ValueFactory getValueFactory() { return baseSail.getValueFactory(); }
protected void initializeInternal() throws SailException { baseSail.initialize(); }
@Override public boolean isWritable() throws SailException { return baseSail.isWritable(); }
@Override public File getDataDir() { return baseSail.getDataDir(); }
@Override public void setDataDir(final File dir) { baseSail.setDataDir(dir); }
@Override public void begin(IsolationLevel level) throws SailException { if (level == null) { level = sail.getDefaultIsolationLevel(); } IsolationLevel compatibleLevel = IsolationLevels.getCompatibleIsolationLevel(level, sail.getSupportedIsolationLevels()); if (compatibleLevel == null) { throw new UnknownSailTransactionStateException( "Isolation level " + level + " not compatible with this Sail"); } super.begin(compatibleLevel); }
@Override public IsolationLevel getDefaultIsolationLevel() { return baseSail.getDefaultIsolationLevel(); } }
private void importRDFDocumentIntoNativeStore(final File nativeStoreDirectory, final File dumpFile, final RDFFormat format, final Resource... contexts) throws SailException, RepositoryException, IOException, RDFParseException { logger.info("importing file " + dumpFile + " into store at " + nativeStoreDirectory); Sail sail = new NativeStore(nativeStoreDirectory); sail.initialize(); try { Repository repo = new SailRepository(sail); try (RepositoryConnection rc = repo.getConnection()) { rc.add(dumpFile, DEFAULT_BASEURI, format, contexts); rc.commit(); } } finally { sail.shutDown(); } } }
public ValueFactory getValueFactory() { return sail.getValueFactory(); }
protected void initializeInternal() throws SailException { baseSail.initialize(); }
@Override public boolean isWritable() throws SailException { return baseSail.isWritable(); }
@Override public File getDataDir() { return baseSail.getDataDir(); }
@Override public void setDataDir(File dataDir) { baseSail.setDataDir(dataDir); }
@Override public IsolationLevel getDefaultIsolationLevel() { return baseSail.getDefaultIsolationLevel(); }
public SingleContextSailConnection(final AbstractSail sail, final Sail baseSail, final Resource context) throws SailException { super(sail); baseSailConnection = baseSail.getConnection(); singleContext = context; }