@Test public void testFetchStatements() throws MergerException { final AccumuloRyaStatementStore accumuloRyaStatementStore = createAccumuloRyaStatementStore(); for (final RyaStatement ryaStatement : RYA_STATEMENTS) { accumuloRyaStatementStore.addStatement(ryaStatement); } accumuloRyaStatementStore.fetchStatements(); }
@Override public Iterator<RyaStatement> fetchStatements() throws FetchStatementException { try { final RyaTripleContext ryaTripleContext = RyaTripleContext.getInstance(accumuloRyaDao.getConf()); Scanner scanner = null; try { scanner = AccumuloRyaUtils.getScanner(tablePrefix + RdfCloudTripleStoreConstants.TBL_SPO_SUFFIX, accumuloRyaDao.getConf()); for (final IteratorSetting iteratorSetting : iteratorSettings) { scanner.addScanIterator(iteratorSetting); } } catch (final IOException e) { throw new FetchStatementException("Unable to get scanner to fetch Rya Statements", e); } final Iterator<Entry<Key, Value>> entryIter = scanner.iterator(); final Iterator<RyaStatement> ryaStatementIter = Iterators.transform(entryIter, new Function<Entry<Key, Value>, RyaStatement>() { @Override public RyaStatement apply(final Entry<Key, Value> entry) { final Key key = entry.getKey(); final Value value = entry.getValue(); RyaStatement ryaStatement = null; try { ryaStatement = AccumuloRyaUtils.createRyaStatement(key, value, ryaTripleContext); } catch (final TripleRowResolverException e) { log.error("Unable to convert the key/value pair into a Rya Statement", e); } return ryaStatement; } }); return ryaStatementIter; } catch (final Exception e) { throw new FetchStatementException("Failed to fetch statements.", e); } }
AccumuloRyaStatementStore implements RyaStatementStore { @Override public Iterator<RyaStatement> fetchStatements() throws FetchStatementException { try { final RyaTripleContext ryaTripleContext = RyaTripleContext.getInstance(accumuloRyaDao.getConf()); Scanner scanner = null; try { scanner = AccumuloRyaUtils.getScanner(tablePrefix + RdfCloudTripleStoreConstants.TBL_SPO_SUFFIX, accumuloRyaDao.getConf()); for (final IteratorSetting iteratorSetting : iteratorSettings) { scanner.addScanIterator(iteratorSetting); } } catch (final IOException e) { throw new FetchStatementException("Unable to get scanner to fetch Rya Statements", e); } final Iterator<Entry<Key, Value>> entryIter = scanner.iterator(); final Iterator<RyaStatement> ryaStatementIter = Iterators.transform(entryIter, new Function<Entry<Key, Value>, RyaStatement>() { @Override public RyaStatement apply(final Entry<Key, Value> entry) { final Key key = entry.getKey(); final Value value = entry.getValue(); RyaStatement ryaStatement = null; try { ryaStatement = AccumuloRyaUtils.createRyaStatement(key, value, ryaTripleContext); } catch (final TripleRowResolverException e) { log.error("Unable to convert the key/value pair into a Rya Statement", e); } return ryaStatement; } }); return ryaStatementIter; } catch (final Exception e) { throw new FetchStatementException("Failed to fetch statements.", e); } } }
AccumuloRyaStatementStore implements RyaStatementStore { @Override public Iterator<RyaStatement> fetchStatements() throws FetchStatementException { try { final RyaTripleContext ryaTripleContext = RyaTripleContext.getInstance(accumuloRyaDao.getConf()); Scanner scanner = null; try { scanner = AccumuloRyaUtils.getScanner(tablePrefix + RdfCloudTripleStoreConstants.TBL_SPO_SUFFIX, accumuloRyaDao.getConf()); for (final IteratorSetting iteratorSetting : iteratorSettings) { scanner.addScanIterator(iteratorSetting); } } catch (final IOException e) { throw new FetchStatementException("Unable to get scanner to fetch Rya Statements", e); } final Iterator<Entry<Key, Value>> entryIter = scanner.iterator(); final Iterator<RyaStatement> ryaStatementIter = Iterators.transform(entryIter, new Function<Entry<Key, Value>, RyaStatement>() { @Override public RyaStatement apply(final Entry<Key, Value> entry) { final Key key = entry.getKey(); final Value value = entry.getValue(); RyaStatement ryaStatement = null; try { ryaStatement = AccumuloRyaUtils.createRyaStatement(key, value, ryaTripleContext); } catch (final TripleRowResolverException e) { log.error("Unable to convert the key/value pair into a Rya Statement", e); } return ryaStatement; } }); return ryaStatementIter; } catch (final Exception e) { throw new FetchStatementException("Failed to fetch statements.", e); } } AccumuloRyaStatementStore(final AccumuloRyaDAO dao, final String tablePrefix, final String ryaInstance); }
AccumuloRyaStatementStore implements RyaStatementStore { @Override public Iterator<RyaStatement> fetchStatements() throws FetchStatementException { try { final RyaTripleContext ryaTripleContext = RyaTripleContext.getInstance(accumuloRyaDao.getConf()); Scanner scanner = null; try { scanner = AccumuloRyaUtils.getScanner(tablePrefix + RdfCloudTripleStoreConstants.TBL_SPO_SUFFIX, accumuloRyaDao.getConf()); for (final IteratorSetting iteratorSetting : iteratorSettings) { scanner.addScanIterator(iteratorSetting); } } catch (final IOException e) { throw new FetchStatementException("Unable to get scanner to fetch Rya Statements", e); } final Iterator<Entry<Key, Value>> entryIter = scanner.iterator(); final Iterator<RyaStatement> ryaStatementIter = Iterators.transform(entryIter, new Function<Entry<Key, Value>, RyaStatement>() { @Override public RyaStatement apply(final Entry<Key, Value> entry) { final Key key = entry.getKey(); final Value value = entry.getValue(); RyaStatement ryaStatement = null; try { ryaStatement = AccumuloRyaUtils.createRyaStatement(key, value, ryaTripleContext); } catch (final TripleRowResolverException e) { log.error("Unable to convert the key/value pair into a Rya Statement", e); } return ryaStatement; } }); return ryaStatementIter; } catch (final Exception e) { throw new FetchStatementException("Failed to fetch statements.", e); } } AccumuloRyaStatementStore(final AccumuloRyaDAO dao, final String tablePrefix, final String ryaInstance); @Override Iterator<RyaStatement> fetchStatements(); @Override void addStatement(final RyaStatement statement); @Override void removeStatement(final RyaStatement statement); @Override void updateStatement(final RyaStatement original, final RyaStatement update); @Override boolean containsStatement(final RyaStatement ryaStatement); @Override Optional<MergeParentMetadata> getParentMetadata(); @Override void setParentMetadata(final MergeParentMetadata metadata); RyaStatement findStatement(final RyaStatement ryaStatement); void addIterator(final IteratorSetting iteratorSetting); }
AccumuloRyaStatementStore implements RyaStatementStore { @Override public Iterator<RyaStatement> fetchStatements() throws FetchStatementException { try { final RyaTripleContext ryaTripleContext = RyaTripleContext.getInstance(accumuloRyaDao.getConf()); Scanner scanner = null; try { scanner = AccumuloRyaUtils.getScanner(tablePrefix + RdfCloudTripleStoreConstants.TBL_SPO_SUFFIX, accumuloRyaDao.getConf()); for (final IteratorSetting iteratorSetting : iteratorSettings) { scanner.addScanIterator(iteratorSetting); } } catch (final IOException e) { throw new FetchStatementException("Unable to get scanner to fetch Rya Statements", e); } final Iterator<Entry<Key, Value>> entryIter = scanner.iterator(); final Iterator<RyaStatement> ryaStatementIter = Iterators.transform(entryIter, new Function<Entry<Key, Value>, RyaStatement>() { @Override public RyaStatement apply(final Entry<Key, Value> entry) { final Key key = entry.getKey(); final Value value = entry.getValue(); RyaStatement ryaStatement = null; try { ryaStatement = AccumuloRyaUtils.createRyaStatement(key, value, ryaTripleContext); } catch (final TripleRowResolverException e) { log.error("Unable to convert the key/value pair into a Rya Statement", e); } return ryaStatement; } }); return ryaStatementIter; } catch (final Exception e) { throw new FetchStatementException("Failed to fetch statements.", e); } } AccumuloRyaStatementStore(final AccumuloRyaDAO dao, final String tablePrefix, final String ryaInstance); @Override Iterator<RyaStatement> fetchStatements(); @Override void addStatement(final RyaStatement statement); @Override void removeStatement(final RyaStatement statement); @Override void updateStatement(final RyaStatement original, final RyaStatement update); @Override boolean containsStatement(final RyaStatement ryaStatement); @Override Optional<MergeParentMetadata> getParentMetadata(); @Override void setParentMetadata(final MergeParentMetadata metadata); RyaStatement findStatement(final RyaStatement ryaStatement); void addIterator(final IteratorSetting iteratorSetting);  }