@Override protected String getValueInternal(final byte[] id, final boolean p) throws DataAccessLayerException { RUNTIME_CONTEXTS.get().isFirstLevelResult = true; return _index.getQuick(id); } }
@Override protected String getValueInternal(final byte[] id, final boolean p) throws DataAccessLayerException { RUNTIME_CONTEXTS.get().isFirstLevelResult = true; return _index.getQuick(id); } }
/** * Returns the N3 representation of the value associated with a given identifier. * * @param id the value identifier. * @param p the predicate flag. * @return the N3 representation of the value associated with a given identifier. * @throws DataAccessLayerException in case of data access failure. */ String getN3(final byte[] id, final boolean p) throws DataAccessLayerException { if (id == null || id.length == 0) { return null; } final String n3 = p ? _pIndex.getQuick(id) : _soIndex.getQuick(id); if (n3 == null || n3.isEmpty()) { _log.error(MessageCatalog._00086_NODE_NOT_FOUND_IN_DICTIONARY, Arrays.toString(id)); } return n3; } }
/** * Returns the N3 representation of the value associated with a given identifier. * * @param id the value identifier. * @param p the predicate flag. * @return the N3 representation of the value associated with a given identifier. * @throws DataAccessLayerException in case of data access failure. */ String getN3(final byte[] id, final boolean p) throws DataAccessLayerException { if (id == null || id.length == 0) { return null; } final String n3 = p ? _pIndex.getQuick(id) : _soIndex.getQuick(id); if (n3 == null || n3.isEmpty()) { _log.error(MessageCatalog._00086_NODE_NOT_FOUND_IN_DICTIONARY, Arrays.toString(id)); } return n3; } }
/** * Returns the N3 representation of the value associated with a given identifier. * * @param id the value identifier. * @param p the predicate flag. * @return the N3 representation of the value associated with a given identifier. * @throws DataAccessLayerException in case of data access failure. */ protected String getStringValue(final byte[] id, final boolean p) throws DataAccessLayerException { final String value = _index.getQuick(id); if (value == null || value.isEmpty()) { _log.error(MessageCatalog._00086_NODE_NOT_FOUND_IN_DICTIONARY, Arrays.toString(id)); } return value; }
/** * Returns the N3 representation of the value associated with a given identifier. * * @param id the value identifier. * @param p the predicate flag. * @return the N3 representation of the value associated with a given identifier. * @throws DataAccessLayerException in case of data access failure. */ protected String getStringValue(final byte[] id, final boolean p) throws DataAccessLayerException { final String value = _index.getQuick(id); if (value == null || value.isEmpty()) { _log.error(MessageCatalog._00086_NODE_NOT_FOUND_IN_DICTIONARY, Arrays.toString(id)); } return value; }
/** * Returns the N3 representation of the value associated with a given identifier. * * @param id the value identifier. * @param p the predicate flag. * @return the N3 representation of the value associated with a given identifier. * @throws DataAccessLayerException in case of data access layer factory. */ protected String getN3(final byte[] id, final boolean p) throws DataAccessLayerException { final String n3 = _index.getQuick(id); if (n3 == null || n3.isEmpty()) { _log.error(MessageCatalog._00086_NODE_NOT_FOUND_IN_DICTIONARY, Arrays.toString(id)); } return n3; } }
/** * Returns the N3 representation of the value associated with a given identifier. * * @param id the value identifier. * @param p the predicate flag. * @return the N3 representation of the value associated with a given identifier. * @throws DataAccessLayerException in case of data access layer factory. */ protected String getN3(final byte[] id, final boolean p) throws DataAccessLayerException { final String n3 = _index.getQuick(id); if (n3 == null || n3.isEmpty()) { _log.error(MessageCatalog._00086_NODE_NOT_FOUND_IN_DICTIONARY, Arrays.toString(id)); } return n3; } }
/** * getQuick method should use the "ById" index. * * @throws Exception never otherwise the test fails. */ @Test public void getQuick() throws Exception { final byte[] id = { 1, 2, 3, 4 }; _cut.getQuick(id); verify(_byId).getQuick(id); }
/** * A null id must return a null identifier. * * @throws Exception never otherwise the test fails. */ @Test public void getValue() throws Exception { final byte[] id = new byte[PersistentStringDictionary.ID_LENGTH]; RANDOMIZER.nextBytes(id); final String aValue = randomString(); when(_dummyIndex.getQuick(id)).thenReturn(aValue); assertEquals(aValue, _cut.getValue(id, RANDOMIZER.nextBoolean())); }
/** * Identifiers for managed URI must be be directly served by the dictionary, without involving the decoratee. * * @throws Exception never otherwise the test fails. */ @Test public void getURIWithManagedId() throws Exception { final URI managedUri = buildResource(FOAF.NAMESPACE + System.currentTimeMillis()); final String n3 = NTriplesUtil.toNTriplesString(managedUri); when(_dummyIndex.getQuick(any(byte[].class))).thenReturn(n3); when(_dummyIndex.get(n3)).thenReturn(ValueDictionaryBase.NOT_SET); byte[] id = _cut.getID(managedUri, _isPredicate); final Value value = _cut.getValue(id, _isPredicate); assertEquals(managedUri, value); verify(_decoratee, times(0)).getValue(id, _isPredicate); }