com.bigdata.rdf.lexicon
Interface LexiconKeyBuilder.IDatatypeKeyCoder

All Known Implementing Classes:
LexiconKeyBuilder.XSDAnyURICoder, LexiconKeyBuilder.XSDBooleanCoder, LexiconKeyBuilder.XSDByteCoder, LexiconKeyBuilder.XSDDoubleCoder, LexiconKeyBuilder.XSDFloatCoder, LexiconKeyBuilder.XSDIntCoder, LexiconKeyBuilder.XSDLongCoder, LexiconKeyBuilder.XSDShortCoder, LexiconKeyBuilder.XSDXmlLiteralCoder
Enclosing class:
LexiconKeyBuilder

public static interface LexiconKeyBuilder.IDatatypeKeyCoder

Interface for classes encapsulating the logic to encode (and where possible, decode) datatype literals.

Version:
$Id: LexiconKeyBuilder.java 2265 2009-10-26 12:51:06Z thompsonbry $
Author:
Bryan Thompson

Field Summary
static int CODE_OTHER
          Code used for unrecognized or otherwise unhandled data types.
static int CODE_XML_LITERAL
          An RDF.XMLLITERAL.
static int CODE_XSD_ANYURI
           
static int CODE_XSD_BASE64BINARY
           
static int CODE_XSD_BOOLEAN
           
static int CODE_XSD_BYTE
           
static int CODE_XSD_DATE
           
static int CODE_XSD_DATETIME
           
static int CODE_XSD_DECIMAL
          Arbitrary magnitude decimal values with arbitrary digits after the decimal.
static int CODE_XSD_DOUBLE
           
static int CODE_XSD_DURATION
          Deprecated. until good semantics have been developed.
static int CODE_XSD_FLOAT
           
static int CODE_XSD_GMONTHDAY
           
static int CODE_XSD_GYEAR
           
static int CODE_XSD_GYEARMONTH
           
static int CODE_XSD_HEXBINARY
           
static int CODE_XSD_INT
           
static int CODE_XSD_INTEGER
           
static int CODE_XSD_LONG
           
static int CODE_XSD_NOTATION
           
static int CODE_XSD_QNAME
           
static int CODE_XSD_SHORT
           
static int CODE_XSD_STRING
           
static int CODE_XSD_TIME
           
static int CODE_XSD_UBYTE
           
static int CODE_XSD_UINT
           
static int CODE_XSD_ULONG
           
static int CODE_XSD_USHORT
           
 
Method Summary
 int code()
          Return the unique code designated for the primitive data type handled by this coder.
 String decode(byte[] key, int off, int len)
          Decode a slice of a byte[] containing a key formed by encode(IKeyBuilder, String).
 void encode(IKeyBuilder keyBuilder, String text)
          Interpret the text as some specific data type and encode a representation of that data type value suitable for an index whose keys are unsigned byte[]s.
 boolean isDecodable()
          Return true if the implementation of this interface encodes keys which can be decoded without loss.
 

Field Detail

CODE_OTHER

static final int CODE_OTHER
Code used for unrecognized or otherwise unhandled data types.

See Also:
Constant Field Values

CODE_XSD_STRING

static final int CODE_XSD_STRING
See Also:
Constant Field Values

CODE_XSD_BOOLEAN

static final int CODE_XSD_BOOLEAN
See Also:
Constant Field Values

CODE_XSD_DECIMAL

static final int CODE_XSD_DECIMAL
Arbitrary magnitude decimal values with arbitrary digits after the decimal.

See Also:
Constant Field Values

CODE_XSD_FLOAT

static final int CODE_XSD_FLOAT
See Also:
Constant Field Values

CODE_XSD_DOUBLE

static final int CODE_XSD_DOUBLE
See Also:
Constant Field Values

CODE_XSD_DURATION

static final int CODE_XSD_DURATION
Deprecated. until good semantics have been developed.
See Also:
Constant Field Values

CODE_XSD_DATETIME

static final int CODE_XSD_DATETIME
See Also:
Constant Field Values

CODE_XSD_TIME

static final int CODE_XSD_TIME
See Also:
Constant Field Values

CODE_XSD_DATE

static final int CODE_XSD_DATE
See Also:
Constant Field Values

CODE_XSD_GYEARMONTH

static final int CODE_XSD_GYEARMONTH
See Also:
Constant Field Values

CODE_XSD_GYEAR

static final int CODE_XSD_GYEAR
See Also:
Constant Field Values

CODE_XSD_GMONTHDAY

static final int CODE_XSD_GMONTHDAY
See Also:
Constant Field Values

CODE_XSD_HEXBINARY

static final int CODE_XSD_HEXBINARY
See Also:
Constant Field Values

CODE_XSD_BASE64BINARY

static final int CODE_XSD_BASE64BINARY
See Also:
Constant Field Values

CODE_XSD_ANYURI

static final int CODE_XSD_ANYURI
See Also:
Constant Field Values

CODE_XSD_QNAME

static final int CODE_XSD_QNAME
See Also:
Constant Field Values

CODE_XSD_NOTATION

static final int CODE_XSD_NOTATION
See Also:
Constant Field Values

CODE_XSD_INTEGER

static final int CODE_XSD_INTEGER
See Also:
Constant Field Values

CODE_XSD_LONG

static final int CODE_XSD_LONG
See Also:
Constant Field Values

CODE_XSD_INT

static final int CODE_XSD_INT
See Also:
Constant Field Values

CODE_XSD_SHORT

static final int CODE_XSD_SHORT
See Also:
Constant Field Values

CODE_XSD_BYTE

static final int CODE_XSD_BYTE
See Also:
Constant Field Values

CODE_XSD_ULONG

static final int CODE_XSD_ULONG
See Also:
Constant Field Values

CODE_XSD_UINT

static final int CODE_XSD_UINT
See Also:
Constant Field Values

CODE_XSD_USHORT

static final int CODE_XSD_USHORT
See Also:
Constant Field Values

CODE_XSD_UBYTE

static final int CODE_XSD_UBYTE
See Also:
Constant Field Values

CODE_XML_LITERAL

static final int CODE_XML_LITERAL
An RDF.XMLLITERAL.

See Also:
Constant Field Values
Method Detail

encode

void encode(IKeyBuilder keyBuilder,
            String text)
Interpret the text as some specific data type and encode a representation of that data type value suitable for an index whose keys are unsigned byte[]s.

Parameters:
keyBuilder - The object used to build up the key.
text - A lexical representation of the value.

decode

String decode(byte[] key,
              int off,
              int len)
Decode a slice of a byte[] containing a key formed by encode(IKeyBuilder, String).

Parameters:
key - The byte[].
off - The first byte in the slice.
len - The length of the slice.
Returns:
A lexical representation of the decoded value.
Throws:
UnsupportedOperationException - If the keys for the datatype encoded by this interface can not be decoded without loss. For example, this is true of XMLSchema.STRING when compressed Unicode sort keys are used.
TODO:
the [len] parameter is probably not necessary for most things, but there are some cool key types that are both variable length and totally ordered. E.g., eXist XML node identifiers.

isDecodable

boolean isDecodable()
Return true if the implementation of this interface encodes keys which can be decoded without loss. "Loss" means that it is not possible to decode a value which correspond to the same point in the value space of the datatype. For example, .5 and 0.5 both represent the same point in the XMLSchema.FLOAT value space. These values are therefore decodable without loss, even though the decoded value might not have the same lexical representation.


code

int code()
Return the unique code designated for the primitive data type handled by this coder. Coders which self-report values for this method which are in conflict will be reported by a runtime exception. The appropriate code values are declared by this interface. The primitive datatypes include:
         3.2.1 string
         3.2.2 boolean
         3.2.3 decimal
         3.2.4 float
         3.2.5 double
         3.2.6 duration
         3.2.7 dateTime
         3.2.8 time
         3.2.9 date
         3.2.10 gYearMonth
         3.2.11 gYear
         3.2.12 gMonthDay
         3.2.13 gDay
         3.2.14 gMonth
         3.2.15 hexBinary
         3.2.16 base64Binary
         3.2.17 anyURI
         3.2.18 QName
         3.2.19 NOTATION
 

See Also:
http://www.w3.org/TR/swbp-xsch-datatypes/,

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