/** * Builds a new schema for a given store. * * @param dictionary the dictionary used by the store. */ protected Schema(final ITopLevelDictionary dictionary) { _dictionary = dictionary; _classesSet = new PersistentSet<byte[]>(byte[].class, COL_CLAZZES); _dPropsSet = new PersistentSet<byte[]>(byte[].class, COL_D_PROPS); _oPropsSet = new PersistentSet<byte[]>(byte[].class, COL_O_PROPS); _classes = new DictionarySetDecorator(_classesSet, _dictionary, false); _dataProperties = new DictionarySetDecorator(_dPropsSet, _dictionary, true); _objectProperties = new DictionarySetDecorator(_oPropsSet, _dictionary, true); }
/** * Returns true if this index contains the given id. * * @param id the id of a given resource. * @return true if this index contains the given id. * @throws DataAccessLayerException in case of data access failure. */ public boolean contains(final byte[] id) throws DataAccessLayerException { return _byId.containsKey(id); }
/** * Builds a new set with a given element class and identified by a given name. * * @param elementClass the element class. * @param name the set (identity) name. */ public PersistentSet(final Class<E> elementClass, final String name) { _map = new PersistentMap<E, byte[]>(elementClass, byte[].class, name, false, null); }
/** * Removes the given resource from this index. * * @param n3 the n3 representation of the resource to be removed. * @throws DataAccessLayerException in case of data access failure. */ public void remove(final String n3) throws DataAccessLayerException { _byId.removeQuick(_byValue.get(n3)); _byValue.removeQuick(n3); } }
@Override protected void removeNamespaceInternal(final String prefix) throws SailException { try { _crdf.getPrefix2Namespaces().remove(prefix); } catch (DataAccessLayerException exception) { throw new SailException(exception); } }
@Override protected void removeDataWithIDs(final Iterator<byte[][]> triples) throws DataAccessLayerException { notifyListeners(_startChangesEvent); batchDeleteWithIDs(triples, _batchLimit); notifyListeners(_finishedChangesEvent); }
/** * Returns true if this map is empty. * * @return true if this map is empty. * @throws DataAccessLayerException in case of data access failure. */ public boolean isEmpty() throws DataAccessLayerException { return size() == 0; }
/** * Returns true if this set is empty. * * @return true if this set is empty. * @throws DataAccessLayerException in case of data access failure. */ public boolean isEmpty() throws DataAccessLayerException { return _map.isEmpty(); }
/** * Returns the value associated with the given id. * * @param id the Cumulus internal id. * @return the value associated with the given id. * @throws DataAccessLayerException in case of data access failure. */ public String getQuick(final byte[] id) throws DataAccessLayerException { return _byId.getQuick(id); }
/** * Creates and initializes the underlying index. * * @return the underlying index. */ protected BIndex createIndex() { return new BIndex(_indexName); }
/** * Adds a new element to this set. * * @param e the element. * @return true if the add succeeds. * @throws DataAccessLayerException in case of data access failure. */ public boolean add(final E e) throws DataAccessLayerException { return e == null ? false : (_map.put(e, PRESENT) == null); }
/** * Removes all elements from this set. * * @throws DataAccessLayerException in case of data access failure. */ public void clear() throws DataAccessLayerException { _map.clear(); }
/** * Builds a new selectivity estimator with the given data. * * @param counterFactory the counter factory. */ public AbstractSelectivityEstimator(final CounterFactory counterFactory) { _triple_counter = counterFactory.getCounter("TRIPLE_COUNTER"); }
/** * Returns the current value of the counter. * @return the current value of the counter. * * @throws DataAccessLayerException if the counter value can not be read. */ public long current() throws DataAccessLayerException { sync(); return _data; }
/** * Gets the instance of RepositoryManager. * @return the instance of RepositoryManager */ public static RepositoryManager getInstance() { if (manager == null) { manager = new RepositoryManager(); } return manager; }
/** * Returns the counter factory associated with this store. * * @return the counter factory associated with this store. */ public CounterFactory getCounterFactory() { _counterFactory = CounterFactory.getInstance(); return _counterFactory; }
/** * Builds a new schema for a given store. * * @param dictionary the dictionary used by the store. */ protected Schema(final ITopLevelDictionary dictionary) { _dictionary = dictionary; _classesSet = new PersistentSet<byte[]>(byte[].class, COL_CLAZZES); _dPropsSet = new PersistentSet<byte[]>(byte[].class, COL_D_PROPS); _oPropsSet = new PersistentSet<byte[]>(byte[].class, COL_O_PROPS); _classes = new DictionarySetDecorator(_classesSet, _dictionary, false); _dataProperties = new DictionarySetDecorator(_dPropsSet, _dictionary, true); _objectProperties = new DictionarySetDecorator(_oPropsSet, _dictionary, true); }
/** * Returns true if a given element is found within this set. * * @param o the element. * @return true if a given element is found within this set, false otherwise. * @throws DataAccessLayerException in case of data access failure. */ public boolean contains(final E o) throws DataAccessLayerException { return o == null ? false : _map.containsKey(o); }
/** * Returns the size of this set. * * @return the size of this set. * @throws DataAccessLayerException in case of data access failure. */ public int size() throws DataAccessLayerException { return _map.size(); }
/** * Returns true if this set is empty. * * @return true if this set is empty. * @throws DataAccessLayerException in case of data access failure. */ public boolean isEmpty() throws DataAccessLayerException { return _map.isEmpty(); }