public class SPOIndexWriteProc extends AbstractKeyArrayIndexProcedure<Object> implements IParallelizableIndexProcedure<Object>, IMutableRelationIndexWriteProcedure<Object>
The key for each statement encodes the {s:p:o} of the statement in the order that is appropriate for the index (SPO, POS, OSP, etc). The key is written unchanged on the index.
The value for each statement is a byte that encodes the StatementEnum
and also encodes whether or not the "override" flag is set using - see
StatementEnum.MASK_OVERRIDE
- followed by 8 bytes representing the
statement identifier IFF statement identifiers are enabled AND the
StatementEnum
is StatementEnum.Explicit
. The value requires
interpretation to determine the byte[] that will be written as the value on
the index - see the code for more details.
Note: This needs to be a custom batch operation using a conditional insert so that we do not write on the index when the data would not be changed and to handle the overflow flag and the optional statement identifier correctly.
Modifier and Type | Class and Description |
---|---|
static class |
SPOIndexWriteProc.IndexWriteProcConstructor |
AbstractKeyArrayIndexProcedure.ResultBitBuffer, AbstractKeyArrayIndexProcedure.ResultBitBufferCounter, AbstractKeyArrayIndexProcedure.ResultBitBufferHandler, AbstractKeyArrayIndexProcedure.ResultBuffer, AbstractKeyArrayIndexProcedure.ResultBufferHandler
Modifier | Constructor and Description |
---|---|
|
SPOIndexWriteProc()
De-serialization constructor.
|
protected |
SPOIndexWriteProc(IRabaCoder keySer,
IRabaCoder valSer,
int fromIndex,
int toIndex,
byte[][] keys,
byte[][] vals,
boolean reportMutation) |
Modifier and Type | Method and Description |
---|---|
Object |
applyOnce(IIndex ndx,
IRaba keys,
IRaba vals)
Apply the procedure to the specified key range of the index.
|
boolean |
isReadOnly()
Return
true iff the procedure asserts that it will not
write on the index. |
protected IResultHandler<Object,Object> |
newAggregator()
Return an
IResultHandler that will be used to combine the results
if the index procedure is parallelized against a local index (including a
scale-out shard). |
protected void |
readMetadata(ObjectInput in)
Reads metadata written by
AbstractKeyArrayIndexProcedure.writeMetadata(ObjectOutput) . |
protected void |
writeMetadata(ObjectOutput out)
Writes metadata (not the keys or values, but just other metadata used by
the procedure).
|
apply, getKeys, getKeysCoder, getValues, getValuesCoder, readExternal, writeExternal
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
apply
public SPOIndexWriteProc()
protected SPOIndexWriteProc(IRabaCoder keySer, IRabaCoder valSer, int fromIndex, int toIndex, byte[][] keys, byte[][] vals, boolean reportMutation)
fromIndex
- toIndex
- keys
- vals
- public final boolean isReadOnly()
IReadOnly
true
iff the procedure asserts that it will not
write on the index. When true
, the procedure may be run
against a view of the index that is read-only or which allows concurrent
processes to read on the same index object. When false
the
procedure will be run against a mutable view of the index (assuming that
the procedure is executed in a context that has access to a mutable index
view).isReadOnly
in interface IReadOnly
public Object applyOnce(IIndex ndx, IRaba keys, IRaba vals)
AbstractKeyArrayIndexProcedure
applyOnce
in class AbstractKeyArrayIndexProcedure<Object>
ndx
- The index.Long
-or- a ResultBitBuffer
IFF
reportMutations := true
.protected void writeMetadata(ObjectOutput out) throws IOException
AbstractKeyArrayIndexProcedure
The default implementation writes out the AbstractKeyArrayIndexProcedure.getKeysCoder()
and the
AbstractKeyArrayIndexProcedure.getValuesCoder()
.
writeMetadata
in class AbstractKeyArrayIndexProcedure<Object>
IOException
protected void readMetadata(ObjectInput in) throws IOException, ClassNotFoundException
AbstractKeyArrayIndexProcedure
AbstractKeyArrayIndexProcedure.writeMetadata(ObjectOutput)
.readMetadata
in class AbstractKeyArrayIndexProcedure<Object>
IOException
ClassNotFoundException
protected IResultHandler<Object,Object> newAggregator()
AbstractKeyArrayIndexProcedure
IResultHandler
that will be used to combine the results
if the index procedure is parallelized against a local index (including a
scale-out shard). If a null
is returned, then the index
procedure WILL NOT be parallelized against the local index. To
parallelize index procedures that do not return anything against a local
index, just use NopAggregator
. A non-null
value will
permit both index local parallelization of the index procedure and (in
scale-out) parallelization of the index procedure across the shards as
well. In order to be parallelized, the index procedure must also be
marked as IParallelizableIndexProcedure
.newAggregator
in class AbstractKeyArrayIndexProcedure<Object>
IResultHandler
-or- null
NopAggregator
,
IParallelizableIndexProcedure
,
(Schedule more IOs when loading data)
Copyright © 2006–2019 SYSTAP, LLC DBA Blazegraph. All rights reserved.