@Override public byte[] compose(final byte[] id1, final byte[] id2, final byte[] id3) { return _decoratee.compose(id1, id2, id3); }
@Override public byte[] compose(final byte[] id1, final byte[] id2, final byte[] id3) { return _decoratee.compose(id1, id2, id3); }
@Override public byte[] compose(final byte[] id1, final byte[] id2) { return _decoratee.compose(id1, id2); }
@Override public byte[] compose(final byte[] id1, final byte[] id2) { return _decoratee.compose(id1, id2); }
@Override public void insertRanges(final byte[][] ids, final double value) throws DataAccessLayerException { insertInRN_SPO(_dictionary.compose(ids[0], ids[1]), ids, value); insertInRN_POS(ids[1], ids, value); }
@Override public void insertRanges(final byte[][] ids, final long value) throws DataAccessLayerException { insertInRDT_POS(ids[1], ids, value); insertInRDT_SPO(_dictionary.compose(ids[0], ids[1]), ids, value); }
@Override public void insertRanges(final byte[][] ids, final double value) throws DataAccessLayerException { insertInRN_SPO(_dictionary.compose(ids[0], ids[1]), ids, value); insertInRN_POS(ids[1], ids, value); }
@Override public void insertRanges(final byte[][] ids, final long value) throws DataAccessLayerException { insertInRDT_POS(ids[1], ids, value); insertInRDT_SPO(_dictionary.compose(ids[0], ids[1]), ids, value); }
@Override public void insertTriple(final byte[][] ids) throws DataAccessLayerException { byte[] po_row = _dictionary.compose(ids[1], ids[2]); insertInPOSC(po_row, ids); insertInSPOC(ids[0], ids); insertInOPSC(ids[2], ids); }
@Override public void insertTriple(final byte[][] ids) throws DataAccessLayerException { byte[] po_row = _dictionary.compose(ids[1], ids[2]); insertInPOSC(po_row, ids); insertInSPOC(ids[0], ids); insertInOPSC(ids[2], ids); }
/** * A PC query that should be handled by the SCPO index. * * @param query The query. * @param limit The maximum amount of results to return. * @return An iterator iterating over the query results. */ private Iterator<byte[][]> secundarySPCOQuery(final byte[][] query, final int limit) { return new CAndPCSlicesQueryIterator( HFactory.createRangeSlicesQuery(_dataAccessLayerFactory.getKeyspace(), BYTE_SERIALIZER, COMPOSITE_SERIALIZER, BYTE_SERIALIZER) .setColumnFamily(SPC_O) .addEqualsExpression(PC_COL, _dictionary.compose(query[1], query[3])) .setRange(INCLUDE_ALL_COMPOSITE_LOWER_BOUND, INCLUDE_ALL_COMPOSITE_HIGHER_BOUND, false, limit) .setReturnKeysOnly(), limit, SPC_O, _dataAccessLayerFactory.getKeyspace(), _dictionary, true); }
/** * A PC query that should be handled by the SCPO index. * * @param query The query. * @param limit The maximum amount of results to return. * @return An iterator iterating over the query results. */ private Iterator<byte[][]> secundarySPCOQuery(final byte[][] query, final int limit) { return new CAndPCSlicesQueryIterator( HFactory.createRangeSlicesQuery(_dataAccessLayerFactory.getKeyspace(), BYTE_SERIALIZER, COMPOSITE_SERIALIZER, BYTE_SERIALIZER) .setColumnFamily(SPC_O) .addEqualsExpression(PC_COL, _dictionary.compose(query[1], query[3])) .setRange(INCLUDE_ALL_COMPOSITE_LOWER_BOUND, INCLUDE_ALL_COMPOSITE_HIGHER_BOUND, false, limit) .setReturnKeysOnly(), limit, SPC_O, _dataAccessLayerFactory.getKeyspace(), _dictionary, true); }
HFactory.createSliceQuery(_dataAccessLayerFactory.getKeyspace(), BYTE_SERIALIZER, COMPOSITE_SERIALIZER, BYTE_SERIALIZER) .setColumnFamily(SPC_O) .setKey(_dictionary.compose(query[0], query[1], query[3])) .setRange(INCLUDE_ALL_COMPOSITE_LOWER_BOUND, INCLUDE_ALL_COMPOSITE_HIGHER_BOUND, false, limit), INCLUDE_ALL_COMPOSITE_LOWER_BOUND,
@Override public Iterator<byte[][]> query( final byte[][] query, final int limit) throws DataAccessLayerException { // Use triple-indexes if context is a variable if (query.length == 3 || isVariable(query[3])) { return super.query(query, limit); } final int queryIndex = getQueryIndex(query); final BoundStatement statement = _queries[queryIndex].bind(); // Fill the query int queryVariableIndex = 0; if (queryIndex == 5) { // The pc query is an exception, it has a manually composed column statement.setBytesUnsafe(queryVariableIndex++, ID_SERIALIZER.serialize(_dictionary.compose(query[1], query[3]))); } else { for (int i = 0; i < 4; i++) { if (!isVariable(query[i])) { statement.setBytesUnsafe(queryVariableIndex++, ID_SERIALIZER.serialize(query[i])); } } } // Set the limit, it is always the last variable statement.setInt(queryVariableIndex, limit); return new SPOCResultIterator(_session.executeAsync(statement), true); }
@Override public Iterator<byte[][]> query( final byte[][] query, final int limit) throws DataAccessLayerException { // Use triple-indexes if context is a variable if (query.length == 3 || isVariable(query[3])) { return super.query(query, limit); } final int queryIndex = getQueryIndex(query); final BoundStatement statement = _queries[queryIndex].bind(); // Fill the query int queryVariableIndex = 0; if (queryIndex == 5) { // The pc query is an exception, it has a manually composed column statement.setBytesUnsafe(queryVariableIndex++, ID_SERIALIZER.serialize(_dictionary.compose(query[1], query[3]))); } else { for (int i = 0; i < 4; i++) { if (!isVariable(query[i])) { statement.setBytesUnsafe(queryVariableIndex++, ID_SERIALIZER.serialize(query[i])); } } } // Set the limit, it is always the last variable statement.setInt(queryVariableIndex, limit); return new SPOCResultIterator(_session.executeAsync(statement), true); }
@Override public void insertTriple(final byte[][] ids) throws DataAccessLayerException { super.insertTriple(ids); // Insert in OC_PS final BoundStatement ocpsStatement = _insertOCPSStatement.bind(); ocpsStatement.setBytesUnsafe(0, ID_SERIALIZER.serialize(ids[2])); ocpsStatement.setBytesUnsafe(1, ID_SERIALIZER.serialize(ids[3])); ocpsStatement.setBytesUnsafe(2, ID_SERIALIZER.serialize(ids[1])); ocpsStatement.setBytesUnsafe(3, ID_SERIALIZER.serialize(ids[0])); ocpsStatement.setBytesUnsafe(4, ID_SERIALIZER.serialize(ids[3])); _batchStatements.get().add(ocpsStatement); // Insert in SC_OP final BoundStatement scopStatement = _insertSCOPStatement.bind(); scopStatement.setBytesUnsafe(0, ID_SERIALIZER.serialize(ids[0])); scopStatement.setBytesUnsafe(1, ID_SERIALIZER.serialize(ids[3])); scopStatement.setBytesUnsafe(2, ID_SERIALIZER.serialize(ids[2])); scopStatement.setBytesUnsafe(3, ID_SERIALIZER.serialize(ids[1])); _batchStatements.get().add(scopStatement); // Insert in SPC_O final BoundStatement spcoStatement = _insertSPCOStatement.bind(); spcoStatement.setBytesUnsafe(0, ID_SERIALIZER.serialize(ids[0])); spcoStatement.setBytesUnsafe(1, ID_SERIALIZER.serialize(ids[1])); spcoStatement.setBytesUnsafe(2, ID_SERIALIZER.serialize(ids[3])); spcoStatement.setBytesUnsafe(3, ID_SERIALIZER.serialize(ids[2])); spcoStatement.setBytesUnsafe(4, ID_SERIALIZER.serialize(_dictionary.compose(ids[1], ids[3]))); _batchStatements.get().add(spcoStatement); }
@Override public void insertTriple(final byte[][] ids) throws DataAccessLayerException { super.insertTriple(ids); // Insert in OC_PS final BoundStatement ocpsStatement = _insertOCPSStatement.bind(); ocpsStatement.setBytesUnsafe(0, ID_SERIALIZER.serialize(ids[2])); ocpsStatement.setBytesUnsafe(1, ID_SERIALIZER.serialize(ids[3])); ocpsStatement.setBytesUnsafe(2, ID_SERIALIZER.serialize(ids[1])); ocpsStatement.setBytesUnsafe(3, ID_SERIALIZER.serialize(ids[0])); ocpsStatement.setBytesUnsafe(4, ID_SERIALIZER.serialize(ids[3])); _batchStatements.get().add(ocpsStatement); // Insert in SC_OP final BoundStatement scopStatement = _insertSCOPStatement.bind(); scopStatement.setBytesUnsafe(0, ID_SERIALIZER.serialize(ids[0])); scopStatement.setBytesUnsafe(1, ID_SERIALIZER.serialize(ids[3])); scopStatement.setBytesUnsafe(2, ID_SERIALIZER.serialize(ids[2])); scopStatement.setBytesUnsafe(3, ID_SERIALIZER.serialize(ids[1])); _batchStatements.get().add(scopStatement); // Insert in SPC_O final BoundStatement spcoStatement = _insertSPCOStatement.bind(); spcoStatement.setBytesUnsafe(0, ID_SERIALIZER.serialize(ids[0])); spcoStatement.setBytesUnsafe(1, ID_SERIALIZER.serialize(ids[1])); spcoStatement.setBytesUnsafe(2, ID_SERIALIZER.serialize(ids[3])); spcoStatement.setBytesUnsafe(3, ID_SERIALIZER.serialize(ids[2])); spcoStatement.setBytesUnsafe(4, ID_SERIALIZER.serialize(_dictionary.compose(ids[1], ids[3]))); _batchStatements.get().add(spcoStatement); }