@Override public Iterator<byte[][]> rangeAsIDs( final Value[] query, final Literal lower, final boolean equalsLower, final Literal upper, final boolean equalsUpper, final boolean reverse, final int limit) throws DataAccessLayerException { if (query == null || query.length != 2 || isVariable(query[1])) { return Iterators.emptyIterator(); } final double lowerBound = asDecimal(lower, MIN_LOWER_BOUND).doubleValue(); final double upperBound = asDecimal(upper, MAX_UPPER_BOUND).doubleValue(); return _rdfIndexDAO.numericRangeQuery(query, lowerBound, equalsLower, upperBound, equalsUpper, reverse, limit); }
@Override public void accept(final Configuration<Map<String, Object>> configuration) { if (!isRangeIndexesSupportEnabled()) { _idxRanges = configuration.getAttribute("storage-index-ranges", Boolean.FALSE); } }
@Override protected void removeDataWithIDs(final byte[][] pattern) throws CumulusStoreException { try { if (Util.ALL_CONSTANTS_WITH_IDS.apply(pattern)) { notifyListeners(_startChangesEvent); batchDeleteWithIDs(Iterators.singletonIterator(pattern), _batchLimit); notifyListeners(_finishedChangesEvent); } 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 protected void removeDataWithIDs(final Iterator<byte[][]> triples) throws DataAccessLayerException { notifyListeners(_startChangesEvent); batchDeleteWithIDs(triples, _batchLimit); notifyListeners(_finishedChangesEvent); }
@Override public void addData(final Iterator<Statement> iterator) throws CumulusStoreException { try { notifyListeners(_startChangesEvent); batchInsert(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); } }
/** * Returns a new instance of a triple store with default values. * * @return a new instance of a triple store with default values. */ public static final Store newTripleStore() { return new TripleStore(randomString()); }
/** * Enabling range indexes after opening the store has no effect. */ public void enableRangeIndexesAfterOpeningTheStore() { // FIXME Do not use default visibility just for this... _cut._isOpen = true; assertTrue(_cut.isOpen()); assertFalse(_cut.isRangeIndexesSupportEnabled()); _cut.enableRangeIndexesSupport(); assertFalse(_cut.isRangeIndexesSupportEnabled()); } }
/** * Range indexes can be enabled only before opening the store. */ public void enableRangeIndexesBeforeOpeningTheStore() { assertFalse(_cut.isRangeIndexesSupportEnabled()); _cut.enableRangeIndexesSupport(); assertTrue(_cut.isRangeIndexesSupportEnabled()); }
@Override public boolean isClass(final Value n) { return getClasses().contains(n); }
@Override public boolean isObjectProperty(final Value n) { return getObjectProperties().contains(n); }
@Override public boolean isDataProperty(final Value n) { return getDataProperties().contains(n); }
/** * Deletes the given triples/quads from the store. * The triples/quads are represented as ids. * * @param nodes an iterator iterating over the triples/quads to delete. * @param batchSize the maximum size of a batch query. * @throws DataAccessLayerException in case of data access failure. */ void batchDeleteWithIDs(final Iterator<byte[][]> nodes, final int batchSize) throws DataAccessLayerException { List<byte[][]> deleted = null; try { deleted = _rdfIndexDAO.deleteTriples(nodes, batchSize, _idxRanges); } catch (final Exception exception) { _log.error(MessageCatalog._00055_DELETION_FAILURE, exception); } if (deleted != null && !deleted.isEmpty()) { notifyListeners(new RemoveTriplesEvent(this, deleted)); } }
/** * Returns a new instance of a triple store with default values. * * @return a new instance of a triple store with default values. */ public static final Store newTripleStore() { return new TripleStore(randomString()); }
@Override protected void removeDataWithIDs(final Iterator<byte[][]> triples) throws DataAccessLayerException { notifyListeners(_startChangesEvent); batchDeleteWithIDs(triples, _batchLimit); notifyListeners(_finishedChangesEvent); }
@Override public void addData(final Iterator<Statement> iterator) throws CumulusStoreException { try { notifyListeners(_startChangesEvent); batchInsert(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 public boolean isClass(final Value n) { return getClasses().contains(n); }
@Override public boolean isObjectProperty(final Value n) { return getObjectProperties().contains(n); }
@Override public boolean isDataProperty(final Value n) { return getDataProperties().contains(n); }
/** * Deletes the given triples/quads from the store. * The triples/quads are represented as ids. * * @param nodes an iterator iterating over the triples/quads to delete. * @param batchSize the maximum size of a batch query. * @throws DataAccessLayerException in case of data access failure. */ void batchDeleteWithIDs(final Iterator<byte[][]> nodes, final int batchSize) throws DataAccessLayerException { List<byte[][]> deleted = null; try { deleted = _rdfIndexDAO.deleteTriples(nodes, batchSize, _idxRanges); } catch (final Exception exception) { _log.error(MessageCatalog._00055_DELETION_FAILURE, exception); } if (deleted != null && !deleted.isEmpty()) { notifyListeners(new RemoveTriplesEvent(this, deleted)); } }
@Override protected void removeDataWithIDs(final byte[][] pattern) throws CumulusStoreException { try { if (Util.ALL_CONSTANTS_WITH_IDS.apply(pattern)) { notifyListeners(_startChangesEvent); batchDeleteWithIDs(Iterators.singletonIterator(pattern), _batchLimit); notifyListeners(_finishedChangesEvent); } 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); } }