private CloseableIteration<Value, RepositoryException> getValues(Resource subj, URI pred, Value obj) { try { RepositoryResult<Statement> stmts; ObjectConnection conn = getObjectConnection(); stmts = conn.getStatements(subj, pred, obj); return new ConvertingIteration<Statement, Value, RepositoryException>(stmts) { @Override protected Value convert(Statement stmt) throws RepositoryException { return stmt.getObject(); } }; } catch (RepositoryException e) { throw new ObjectStoreException(e); } }
private CloseableIteration<Value, RepositoryException> getValues(Resource subj, URI pred, Value obj) { try { RepositoryResult<Statement> stmts; ObjectConnection conn = getObjectConnection(); stmts = conn.getStatements(subj, pred, obj); return new ConvertingIteration<Statement, Value, RepositoryException>(stmts) { @Override protected Value convert(Statement stmt) throws RepositoryException { return stmt.getObject(); } }; } catch (RepositoryException e) { throw new ObjectStoreException(e); } }
protected RepositoryResult<Statement> getStatements() throws RepositoryException { ObjectConnection conn = getObjectConnection(); return conn.getStatements(getResource(), getURI(), null); }
protected RepositoryResult<Statement> getStatements() throws RepositoryException { ObjectConnection conn = getObjectConnection(); return conn.getStatements(getResource(), getURI(), null); }
public Set<URI> getTypes(Resource res) throws RepositoryException { if (!readTypes) return Collections.emptySet(); RepositoryResult<Statement> match = conn.getStatements(res, RDF.TYPE, null); try { if (!match.hasNext()) return Collections.emptySet(); Value obj = match.next().getObject(); if (obj instanceof URI && !match.hasNext()) return Collections.singleton((URI) obj); Set<URI> types = new HashSet<URI>(4); if (obj instanceof URI) { types.add((URI) obj); } while (match.hasNext()) { obj = match.next().getObject(); if (obj instanceof URI) { types.add((URI) obj); } } return types; } finally { match.close(); } }
public Set<URI> getTypes(Resource res) throws RepositoryException { if (!readTypes) return Collections.emptySet(); RepositoryResult<Statement> match = conn.getStatements(res, RDF.TYPE, null); try { if (!match.hasNext()) return Collections.emptySet(); Value obj = match.next().getObject(); if (obj instanceof URI && !match.hasNext()) return Collections.singleton((URI) obj); Set<URI> types = new HashSet<URI>(4); if (obj instanceof URI) { types.add((URI) obj); } while (match.hasNext()) { obj = match.next().getObject(); if (obj instanceof URI) { types.add((URI) obj); } } return types; } finally { match.close(); } }
private int findSize() throws RepositoryException { CloseableIteration<? extends Statement, RepositoryException> iter; HashSet<URI> set = new HashSet<URI>(); ObjectConnection conn = getObjectConnection(); iter = conn.getStatements(getResource(), null, null); try { while (iter.hasNext()) { set.add(iter.next().getPredicate()); } } finally { iter.close(); } int index = 0; while (set.contains(getMemberPredicate(index))) index++; return index; }
private int findSize() throws RepositoryException { CloseableIteration<? extends Statement, RepositoryException> iter; HashSet<URI> set = new HashSet<URI>(); ObjectConnection conn = getObjectConnection(); iter = conn.getStatements(getResource(), null, null); try { while (iter.hasNext()) { set.add(iter.next().getPredicate()); } } finally { iter.close(); } int index = 0; while (set.contains(getMemberPredicate(index))) index++; return index; }
RepositoryResult<Statement> statements = connection.getStatements(node, null, null, true, contexts);