com.bigdata.rdf.lexicon
Class Term2IdTupleSerializer

java.lang.Object
  extended by com.bigdata.btree.DefaultTupleSerializer
      extended by com.bigdata.rdf.lexicon.Term2IdTupleSerializer
All Implemented Interfaces:
ITupleSerializer, IKeyBuilderFactory, Externalizable, Serializable

public class Term2IdTupleSerializer
extends DefaultTupleSerializer

Handles the term:id index (forward mapping for the lexicon). The keys are unsigned byte[]s representing a total order for the RDF Value space. The index assigns term identifiers, and those term identifiers are stored in the values of the index.

Version:
$Id: Term2IdTupleSerializer.java 4818 2011-06-29 20:01:56Z thompsonbry $
Author:
Bryan Thompson
See Also:
Serialized Form

Constructor Summary
Term2IdTupleSerializer()
          De-serialization ctor.
Term2IdTupleSerializer(IKeyBuilderFactory keyBuilderFactory)
          Uses the caller's IKeyBuilderFactory.
Term2IdTupleSerializer(Properties properties)
          Configures the IKeyBuilderFactory from the caller's properties.
 
Method Summary
 IV deserialize(ITuple tuple)
          De-serializes the ITuple as a IV whose value is the term identifier associated with the key.
 Object deserializeKey(ITuple tuple)
          You can not decode the term:id keys since they include Unicode sort keys and that is a lossy transform.
 LexiconKeyBuilder getLexiconKeyBuilder()
          Thread-local object for constructing keys for the lexicon.
 void readExternal(ObjectInput in)
           
 byte[] serializeKey(Object obj)
          Return the unsigned byte[] key for an RDF Value.
 byte[] serializeVal(Object obj)
          Return the byte[] value, which is a term identifier written as a packed long integer.
 void writeExternal(ObjectOutput out)
           
 
Methods inherited from class com.bigdata.btree.DefaultTupleSerializer
getDefaultKeyBuilderFactory, getDefaultLeafKeysCoder, getDefaultValuesCoder, getKeyBuilder, getLeafKeysCoder, getLeafValuesCoder, newInstance, setLeafKeysCoder, setLeafValuesCoder, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Term2IdTupleSerializer

public Term2IdTupleSerializer()
De-serialization ctor.


Term2IdTupleSerializer

public Term2IdTupleSerializer(Properties properties)
Configures the IKeyBuilderFactory from the caller's properties.

Parameters:
properties -

Term2IdTupleSerializer

public Term2IdTupleSerializer(IKeyBuilderFactory keyBuilderFactory)
Uses the caller's IKeyBuilderFactory.

Parameters:
keyBuilderFactory -
Method Detail

getLexiconKeyBuilder

public LexiconKeyBuilder getLexiconKeyBuilder()
Thread-local object for constructing keys for the lexicon.


deserializeKey

public Object deserializeKey(ITuple tuple)
You can not decode the term:id keys since they include Unicode sort keys and that is a lossy transform.

Specified by:
deserializeKey in interface ITupleSerializer
Overrides:
deserializeKey in class DefaultTupleSerializer
Throws:
UnsupportedOperationException - always

serializeKey

public byte[] serializeKey(Object obj)
Return the unsigned byte[] key for an RDF Value.

Specified by:
serializeKey in interface ITupleSerializer
Overrides:
serializeKey in class DefaultTupleSerializer
Parameters:
obj - The RDF Value.
Returns:
An unsigned byte[] which places the object into the total sort order for the index and never null ( null keys are not allowed into an index).

serializeVal

public byte[] serializeVal(Object obj)
Return the byte[] value, which is a term identifier written as a packed long integer.

Specified by:
serializeVal in interface ITupleSerializer
Overrides:
serializeVal in class DefaultTupleSerializer
Parameters:
obj - A term identifier expressed as a TermId.
Returns:
The serialized representation of the object as a byte[] -or- null if the reference is null.

deserialize

public IV deserialize(ITuple tuple)
De-serializes the ITuple as a IV whose value is the term identifier associated with the key. The key itself is not decodable.

Specified by:
deserialize in interface ITupleSerializer
Overrides:
deserialize in class DefaultTupleSerializer
Parameters:
tuple - The tuple.
Returns:
The de-serialized object.

readExternal

public void readExternal(ObjectInput in)
                  throws IOException,
                         ClassNotFoundException
Specified by:
readExternal in interface Externalizable
Overrides:
readExternal in class DefaultTupleSerializer
Throws:
IOException
ClassNotFoundException

writeExternal

public void writeExternal(ObjectOutput out)
                   throws IOException
Specified by:
writeExternal in interface Externalizable
Overrides:
writeExternal in class DefaultTupleSerializer
Throws:
IOException


Copyright © 2006-2011 SYSTAP, LLC. All Rights Reserved.