com.bigdata.rdf.lexicon
Class LexiconKeyBuilder

java.lang.Object
  extended by com.bigdata.rdf.lexicon.LexiconKeyBuilder
All Implemented Interfaces:
ITermIndexCodes

public class LexiconKeyBuilder
extends Object
implements ITermIndexCodes

Flyweight helper class for building (and decoding to the extent possible) unsigned byte[] keys for RDF Values and term identifiers. In general, keys for RDF values are formed by a leading byte that indicates the type of the value (URI, BNode, or some type of Literal), followed by the components of that value type.

Version:
$Id: LexiconKeyBuilder.java 4837 2011-07-05 13:31:31Z thompsonbry $
Author:
Bryan Thompson

Field Summary
 IKeyBuilder keyBuilder
           
 
Fields inherited from interface com.bigdata.rdf.lexicon.ITermIndexCodes
TERM_CODE_BND, TERM_CODE_DTL, TERM_CODE_LCL, TERM_CODE_LIT, TERM_CODE_URI
 
Constructor Summary
protected LexiconKeyBuilder(IKeyBuilder keyBuilder)
          Normally invoked by Term2IdTupleSerializer.getLexiconKeyBuilder()
 
Method Summary
 byte[] blankNode2Key(String id)
           
 byte[] datatypeLiteral2key(URI datatype, String value)
          Formats a datatype literal sort key.
 byte[] languageCodeLiteral2key(String languageCode, String text)
          Note: The language code is serialized as US-ASCII UPPER CASE for the purposes of defining the total key ordering.
 byte[] plainLiteral2key(String text)
           
 byte[] uri2key(String uri)
          Returns the sort key for the URI.
 byte[] value2Key(Value value)
          Return an unsigned byte[] that locates the value within a total ordering over the RDF value space.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

keyBuilder

public final IKeyBuilder keyBuilder
Constructor Detail

LexiconKeyBuilder

protected LexiconKeyBuilder(IKeyBuilder keyBuilder)
Normally invoked by Term2IdTupleSerializer.getLexiconKeyBuilder()

Parameters:
keyBuilder - The IKeyBuilder that will determine the distinctions and sort order among the rdf Values. In general, this should support Unicode and should use StrengthEnum.Identical so that all distinctions in the Value space are recognized by the lexicon.
See Also:
IKeyBuilder, IKeyBuilderFactory
Method Detail

uri2key

public byte[] uri2key(String uri)
Returns the sort key for the URI.

Parameters:
uri - The URI.
Returns:
The sort key.

plainLiteral2key

public byte[] plainLiteral2key(String text)

languageCodeLiteral2key

public byte[] languageCodeLiteral2key(String languageCode,
                                      String text)
Note: The language code is serialized as US-ASCII UPPER CASE for the purposes of defining the total key ordering. The character set for the language code is restricted to [A-Za-z0-9] and "-" for separating subtype codes. The RDF store interprets an empty language code as NO language code, so we require that the languageCode is non-empty here. The language code specifications require that the language code comparison is case-insensitive, so we force the code to upper case for the purposes of comparisons.

See Also:
Literal.getLanguage()

datatypeLiteral2key

public byte[] datatypeLiteral2key(URI datatype,
                                  String value)
Formats a datatype literal sort key. The value is formated according to the datatype URI.

Parameters:
datatype -
value -
Returns:

blankNode2Key

public byte[] blankNode2Key(String id)

value2Key

public byte[] value2Key(Value value)
Return an unsigned byte[] that locates the value within a total ordering over the RDF value space.

Parameters:
value - An RDF value.
Returns:
The sort key for that RDF value.


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