public class SPOTupleSerializer extends DefaultTupleSerializer<SPO,SPO>
SPO
s for statement indices.
Note: the encoded key for a statement is formed from the 64-bit
long
term identifier for the subject, predicate, and object
positions of the statement. Each statement index uses a permutation of those
term identifiers, e.g., {s,p,o}, {o,s,p}, or {p,o,s}. The SPOKeyOrder
identifies the specific permutation for a given index. The keys are fully
decodable and are NOT stored redundantly in the tuple's value.
The tuple value encodes the StatementEnum
, indicating whether the
statement is {explicit, inferred, or an axiom}, and optionally the unique
statement identifier.
Note: While the static methods used to decode an existing key are safe for
concurrent readers, concurrent readers also form keys using
#statement2Key(IV, IV, IV)
and therefore require a thread-local
IKeyBuilder
.
Constructor and Description |
---|
SPOTupleSerializer()
De-serialization constructor.
|
SPOTupleSerializer(SPOKeyOrder keyOrder,
boolean sids)
Create an
ITupleSerializer for the indicated access path. |
SPOTupleSerializer(SPOKeyOrder keyOrder,
boolean sids,
IRabaCoder leafKeySer,
IRabaCoder leafValSer)
Create an
ITupleSerializer for the indicated access path. |
Modifier and Type | Method and Description |
---|---|
ISPO |
decodeValue(ISPO spo,
byte[] val)
Set the statement type, bit flags, and optional sid based on the tuple
value.
|
SPO |
deserialize(ITuple tuple)
De-serializes an object from the
value stored
in the tuple (ignores the key stored in the tuple). |
SPO |
deserializeKey(ITuple tuple)
This is an unsupported operation.
|
SPOKeyOrder |
getKeyOrder() |
void |
readExternal(ObjectInput in) |
byte[] |
serializeKey(ISPO spo)
Forms the statement key.
|
byte[] |
serializeKey(Object obj)
Serialize a facet of an object's state that places the object into the
total sort order for the index.
|
byte[] |
serializeVal(boolean override,
boolean userFlag,
StatementEnum type)
Return the byte[] that would be written into a statement index for this
SPO , including the optional StatementEnum.MASK_OVERRIDE
bit. |
byte[] |
serializeVal(ISPO spo)
|
byte[] |
serializeVal(SPO spo)
Encodes the
StatementEnum and the optional statement identifier. |
void |
writeExternal(ObjectOutput out) |
getDefaultKeyBuilderFactory, getDefaultLeafKeysCoder, getDefaultValuesCoder, getKeyBuilder, getLeafKeysCoder, getLeafValuesCoder, getPrimaryKeyBuilder, newInstance, setLeafKeysCoder, setLeafValuesCoder, toString
public SPOTupleSerializer()
public SPOTupleSerializer(SPOKeyOrder keyOrder, boolean sids)
ITupleSerializer
for the indicated access path.keyOrder
- The access path.public SPOTupleSerializer(SPOKeyOrder keyOrder, boolean sids, IRabaCoder leafKeySer, IRabaCoder leafValSer)
ITupleSerializer
for the indicated access path.keyOrder
- The access path.sids
- If true, attach sids to decoded SPOs where appropriate.leafKeySer
- leafValSer
- public SPOKeyOrder getKeyOrder()
public byte[] serializeKey(Object obj)
ITupleSerializer
IAutoboxBTree.insert(Object, Object)
and friends to convert the
key object into an unsigned variable
length byte[].
Note: This handles the conversion between an object and the unsigned variable length byte[] representation of that object which determines its place within the total index order. Since this transform imposes the total order of the index, different techniques are applied here than are applied to the serialization of the index values.
serializeKey
in interface ITupleSerializer<SPO,SPO>
serializeKey
in class DefaultTupleSerializer<SPO,SPO>
obj
- A object (MAY NOT be null
).null
(
null
keys are not allowed into an index).public byte[] serializeKey(ISPO spo)
spo
- The statement.public byte[] serializeVal(ISPO spo)
public byte[] serializeVal(SPO spo)
StatementEnum
and the optional statement identifier.serializeVal
in interface ITupleSerializer<SPO,SPO>
serializeVal
in class DefaultTupleSerializer<SPO,SPO>
spo
- The object to be serialized (MAY be null
).null
if the reference is null
.public byte[] serializeVal(boolean override, boolean userFlag, StatementEnum type)
SPO
, including the optional StatementEnum.MASK_OVERRIDE
bit. If the statement identifier is non-null then it will be included in
the returned byte[].override
- true
iff you want the
StatementEnum.MASK_OVERRIDE
bit set (this is only set
when serializing values for a remote procedure that will write
on the index, it is never set in the index itself).userFlag
- true
iff you want the
StatementEnum.MASK_USER_FLAG
bit set.type
- The StatementEnum
.SPO
.public SPO deserialize(ITuple tuple)
DefaultTupleSerializer
value
stored
in the tuple (ignores the key stored in the tuple).deserialize
in interface ITupleSerializer<SPO,SPO>
deserialize
in class DefaultTupleSerializer<SPO,SPO>
tuple
- The tuple.public SPO deserializeKey(ITuple tuple)
DefaultTupleSerializer
ITupleSerializer
or you can specialize
this one so that it can de-serialize your keys using whichever approach
makes the most sense for your data.deserializeKey
in interface ITupleSerializer<SPO,SPO>
deserializeKey
in class DefaultTupleSerializer<SPO,SPO>
public ISPO decodeValue(ISPO spo, byte[] val)
public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException
readExternal
in interface Externalizable
readExternal
in class DefaultTupleSerializer<SPO,SPO>
IOException
ClassNotFoundException
public void writeExternal(ObjectOutput out) throws IOException
writeExternal
in interface Externalizable
writeExternal
in class DefaultTupleSerializer<SPO,SPO>
IOException
Copyright © 2006–2019 SYSTAP, LLC DBA Blazegraph. All rights reserved.