@Override public void close() throws RepositoryException { stmts.close(); }
@Override public void close() throws RepositoryException { stmts.close(); }
@Override public void close() { try { this.it.close(); } catch (RepositoryException e) { LOGGER.error("Error when closing SailStore iterator."); } }
@Override public void close() { try { this.iteration.close(); } catch (final Throwable ex) { LOGGER.error("Could not close iteration", ex); } }
private void closeQuietly(RepositoryResult<?> results, String message) { if(results!=null) { try { results.close(); } catch (OpenRDFException e) { if(LOGGER.isWarnEnabled()) { LOGGER.warn(message,e); } } } }
@Override public void close() { try { statements.close(); } catch (org.openrdf.repository.RepositoryException e1) { throw new RepositoryException(e1); } }
@Override public void close() { try { this.result.close(); } catch(RepositoryException e) { throw new ModelRuntimeException(e); } }
public void close() { try { this.idIterator.close(); } catch (RepositoryException e) { throw new ModelRuntimeException(e); } }
@Override protected void finalize() throws Throwable { if(!result.isClosed()) result.close(); super.finalize(); } };
@Override public void close() { try { this.idIterator.close(); } catch(RepositoryException e) { throw new ModelRuntimeException(e); } }
@Override protected void finalize() throws Throwable { if(!result.isClosed()) result.close(); super.finalize(); } };
public void close() { try { this.result.close(); } catch (RepositoryException e) { throw new ModelRuntimeException(e); } }
private static long sizeOf(RepositoryResult<?> repositoryResult) throws RepositoryException { try { long result = 0; while (repositoryResult.hasNext()) { repositoryResult.next(); result++; } return result; } finally { repositoryResult.close(); } }
private static long sizeOf(RepositoryResult<?> repositoryResult) throws RepositoryException { try { long result = 0; while (repositoryResult.hasNext()) { repositoryResult.next(); result++; } return result; } finally { repositoryResult.close(); } }
@Override public boolean hasStatement(Resource subj, org.openrdf.model.URI pred, Value obj, boolean includeInferred, Resource... contexts) throws RepositoryException { //Checks whether the repository contains statements with a specific subject, //predicate and/or object, optionally in the specified contexts. RepositoryResult<Statement> stIter = getStatements(subj, pred, obj, includeInferred, contexts); try { return stIter.hasNext(); } finally { stIter.close(); } }
private RepositoryResult<Statement> detach(RepositoryResult<Statement> stmts) throws RepositoryException { try { Iterator<Statement> iter = stmts.asList().iterator(); CloseableIteration<Statement, RepositoryException> itern; itern = new CloseableIteratorIteration<Statement, RepositoryException>( iter); return new RepositoryResult<Statement>(itern); } finally { stmts.close(); } }
private Statement first(RepositoryConnection conn, URI pred, Value obj) throws RepositoryException { RepositoryResult<Statement> stmts; stmts = conn.getStatements(null, pred, obj, true); try { if (stmts.hasNext()) return stmts.next(); return null; } finally { stmts.close(); } }
@Override public T next() { try { T next = result.next(); if(!result.hasNext()) { result.close(); } return next; } catch (RepositoryException e) { handleRepositoryException(e, ResourceUtils.class); return null; } }
@Override public String getMimeType(RepositoryConnection connection, URI uri) throws RepositoryException { final RepositoryResult<Statement> formats = connection.getStatements(uri, DCTERMS.format, null, false, ldpContext); try { if (formats.hasNext()) return formats.next().getObject().stringValue(); } finally { formats.close(); } return null; } @Override
@Test public void testGetStatements() throws RepositoryException { final RepositoryResult<Statement> stmts = con.getStatements(s, p, o, includeInferred, c); try { assertEquals(EncodeDecodeValue.encodeValue(s), remote.data.opts.getRequestParam("s")); assertEquals(EncodeDecodeValue.encodeValue(p), remote.data.opts.getRequestParam("p")); assertEquals(EncodeDecodeValue.encodeValue(o), remote.data.opts.getRequestParam("o")); assertEquals(EncodeDecodeValue.encodeValue(c), remote.data.opts.getRequestParam("c")); assertEquals(Boolean.toString(includeInferred), remote.data.opts.getRequestParam(RemoteRepositoryDecls.INCLUDE_INFERRED)); } finally { stmts.close(); } }