|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.bigdata.btree.DefaultTupleSerializer<SPO,SPO>
com.bigdata.rdf.spo.SPOTupleSerializer
public class SPOTupleSerializer
(De-)serializes SPOs 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(long, long, long) and therefore require a thread-local
IKeyBuilder.
| Constructor Summary | |
|---|---|
SPOTupleSerializer()
De-serialization constructor. |
|
SPOTupleSerializer(SPOKeyOrder keyOrder)
Create an ITupleSerializer for the indicated access path. |
|
SPOTupleSerializer(SPOKeyOrder keyOrder,
IRabaCoder leafKeySer,
IRabaCoder leafValSer)
Create an ITupleSerializer for the indicated access path. |
|
| Method Summary | |
|---|---|
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(SPO spo)
Encodes the StatementEnum and the optional statement identifier. |
byte[] |
statement2Key(long id1,
long id2,
long id3)
Encodes a statement represented as three long integers as an unsigned byte[] sort key. |
void |
writeExternal(ObjectOutput out)
|
| Methods inherited from class com.bigdata.btree.DefaultTupleSerializer |
|---|
getDefaultKeyBuilderFactory, getDefaultLeafKeysCoder, getDefaultValuesCoder, getKeyBuilder, getLeafKeysCoder, getLeafValuesCoder, newInstance, serializeVal, setLeafKeysCoder, setLeafValuesCoder, toString |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public SPOTupleSerializer()
public SPOTupleSerializer(SPOKeyOrder keyOrder)
ITupleSerializer for the indicated access path.
keyOrder - The access path.
public SPOTupleSerializer(SPOKeyOrder keyOrder,
IRabaCoder leafKeySer,
IRabaCoder leafValSer)
ITupleSerializer for the indicated access path.
keyOrder - The access path.leafKeySer - leafValSer - | Method Detail |
|---|
public SPOKeyOrder getKeyOrder()
public SPO deserialize(ITuple tuple)
DefaultTupleSerializervalue 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)
DefaultTupleSerializerITupleSerializer 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 byte[] serializeKey(Object obj)
ITupleSerializerIAutoboxBTree.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[] statement2Key(long id1,
long id2,
long id3)
Note: while the conversion of long integers into the byte[] is non-trivial the value identifiers are mapped onto 8 bytes at a time and the contents of the array could be rearranged into alternative orders directly. For example, if you provide (s,p,o) then you could form the (p,o,s) key by copying 8 byte sections of the returned sort key around to generate the desired permutation.
id1 - An RDF value identifier from the term index.id2 - An RDF value identifier from the term index.id3 - An RDF value identifier from the term index.
public byte[] serializeVal(SPO spo)
StatementEnum and the optional statement identifier.
spo - An object (MAY NOT be null).
null if no value will be stored under the
serialized key.
public void readExternal(ObjectInput in)
throws IOException,
ClassNotFoundException
readExternal in interface ExternalizablereadExternal in class DefaultTupleSerializer<SPO,SPO>IOException
ClassNotFoundException
public void writeExternal(ObjectOutput out)
throws IOException
writeExternal in interface ExternalizablewriteExternal in class DefaultTupleSerializer<SPO,SPO>IOException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||