@Override public void removeData(final Value[] pattern) throws CumulusStoreException { try { if (Util.ALL_CONSTANTS.apply(pattern)) { notifyListeners(_startChangesEvent); batchDeleteWithIDs(_dictionary.toIDQuadIterator(Iterators.singletonIterator(valuesToStatement(pattern))), _batchLimit); notifyListeners(_finishedChangesEvent); } else if (Util.ALL_VARS.apply(pattern)) { clear(); } else { removeDataWithIDs(queryWithIDs(pattern)); } } catch (final DataAccessLayerException exception) { _log.error(MessageCatalog._00093_DATA_ACCESS_LAYER_FAILURE, exception); throw new CumulusStoreException(exception); } catch (final Exception exception) { _log.error(MessageCatalog._00026_NWS_SYSTEM_INTERNAL_FAILURE, exception); throw new CumulusStoreException(exception); } }
@Override public Iterator<Statement> query(final Value[] query, final int limit) throws CumulusStoreException { return _dictionary.toValueQuadIterator(queryAsIDs(query, limit)); }
@Override protected void clearInternal(final Resource... contexts) throws SailException { if (contexts == null || contexts.length == 0) { _crdf.clear(); } else { Arrays.stream(contexts).parallel().forEach(context -> { try { ((QuadStore) _crdf).removeData(new Value[] { null, null, null, context}); } catch (final Exception exception) { LOGGER.error(MessageCatalog._00025_CUMULUS_SYSTEM_INTERNAL_FAILURE, exception); } }); } }
@Override public void removeData(final Iterator<Statement> iterator) throws CumulusStoreException { try { notifyListeners(_startChangesEvent); batchDeleteWithIDs(_dictionary.toIDQuadIterator(iterator), _batchLimit); notifyListeners(_finishedChangesEvent); } catch (final DataAccessLayerException exception) { _log.error(MessageCatalog._00093_DATA_ACCESS_LAYER_FAILURE, exception); throw new CumulusStoreException(exception); } catch (final Exception exception) { _log.error(MessageCatalog._00026_NWS_SYSTEM_INTERNAL_FAILURE, exception); throw new CumulusStoreException(exception); } }
/** * Test if the ttl feature for the triple store works. * @throws Exception never, otherwise the corresponding test will fail. */ @Ignore @Test public void testTTL() throws Exception { ProgrammableConfigurator progConf = new ProgrammableConfigurator(Collections.singletonMap("ttl-value", Integer.valueOf(5))); QuadStore quadStore = new QuadStore("TestKS"); quadStore.accept(progConf); quadStore.open(); quadStore.bulkLoad(DATA_NQ, RDFFormat.NQUADS); assertEquals((int) _query2numOfRes.get(_null_queries[0]), numOfRes(quadStore.query(_null_queries[0]))); Thread.sleep(7000); assertEquals(0, numOfRes(quadStore.query(_null_queries[0]))); } }
/** * Returns a new instance of a quad store with default values. * * @return a new instance of a quad store with default values. */ public static final Store newQuadStore() { return new QuadStore(randomString()); }
@Override protected Iterator<byte[][]> queryAsIDs(final Value[] query, final int limit) throws CumulusStoreException { try { return queryWithIDs(_dictionary.getIDs(query[0], query[1], query[2], query.length > 3 ? query[3] : null), limit); } catch (final DataAccessLayerException exception) { _log.error(MessageCatalog._00093_DATA_ACCESS_LAYER_FAILURE, exception); throw new CumulusStoreException(exception); } }
/** * Returns a new instance of a quad store with default values. * * @return a new instance of a quad store with default values. */ public static final Store newQuadStore() { return new QuadStore(randomString()); }
@Override public void removeData(final Iterator<Statement> iterator) throws CumulusStoreException { try { notifyListeners(_startChangesEvent); batchDeleteWithIDs(_dictionary.toIDQuadIterator(iterator), _batchLimit); notifyListeners(_finishedChangesEvent); } catch (final DataAccessLayerException exception) { _log.error(MessageCatalog._00093_DATA_ACCESS_LAYER_FAILURE, exception); throw new CumulusStoreException(exception); } catch (final Exception exception) { _log.error(MessageCatalog._00026_NWS_SYSTEM_INTERNAL_FAILURE, exception); throw new CumulusStoreException(exception); } }
@Override protected Iterator<byte[][]> queryAsIDs(final Value[] query, final int limit) throws CumulusStoreException { try { return queryWithIDs(_dictionary.getIDs(query[0], query[1], query[2], query.length > 3 ? query[3] : null), limit); } catch (final DataAccessLayerException exception) { _log.error(MessageCatalog._00093_DATA_ACCESS_LAYER_FAILURE, exception); throw new CumulusStoreException(exception); } }
@Override public void removeData(final Value[] pattern) throws CumulusStoreException { try { if (Util.ALL_CONSTANTS.apply(pattern)) { notifyListeners(_startChangesEvent); batchDeleteWithIDs(_dictionary.toIDQuadIterator(Iterators.singletonIterator(valuesToStatement(pattern))), _batchLimit); notifyListeners(_finishedChangesEvent); } else if (Util.ALL_VARS.apply(pattern)) { clear(); } else { removeDataWithIDs(queryWithIDs(pattern)); } } catch (final DataAccessLayerException exception) { _log.error(MessageCatalog._00093_DATA_ACCESS_LAYER_FAILURE, exception); throw new CumulusStoreException(exception); } catch (final Exception exception) { _log.error(MessageCatalog._00026_NWS_SYSTEM_INTERNAL_FAILURE, exception); throw new CumulusStoreException(exception); } }
final String layout = commandLine.getOptionValue("s"); if (ConfigValues.STORE_LAYOUT_QUAD.equalsIgnoreCase(layout)) { store = new QuadStore(); _log.info(MessageCatalog._00006_USING_QUAD_STORE_LAYOUT); } else {
@Override public Iterator<Statement> query(final Value[] query, final int limit) throws CumulusStoreException { return _dictionary.toValueQuadIterator(queryAsIDs(query, limit)); }
@Override protected void clearInternal(final Resource... contexts) throws SailException { if (contexts == null || contexts.length == 0) { _crdf.clear(); } else { Arrays.stream(contexts).parallel().forEach(context -> { try { ((QuadStore) _crdf).removeData(new Value[] { null, null, null, context}); } catch (final Exception exception) { LOGGER.error(MessageCatalog._00025_CUMULUS_SYSTEM_INTERNAL_FAILURE, exception); } }); } }
final String layout = commandLine.getOptionValue("s"); if (ConfigValues.STORE_LAYOUT_QUAD.equalsIgnoreCase(layout)) { store = new QuadStore(); _log.info(MessageCatalog._00006_USING_QUAD_STORE_LAYOUT); } else {
/** * Store must have an identity, supplied at construction time. */ @Test public void setId() { String id = randomString(); _cut = new TripleStore(id); assertEquals(id, _cut.getId()); id = randomString(); _cut = new QuadStore(id); assertEquals(id, _cut.getId()); } }