com.franz.ag
Class EncodedLiteral

java.lang.Object
  extended bycom.franz.ag.ValueObject
      extended bycom.franz.ag.ValueNode
          extended bycom.franz.ag.Literal
              extended bycom.franz.ag.EncodedLiteral
All Implemented Interfaces:
java.lang.Comparable, Literal, java.io.Serializable, Value

public class EncodedLiteral
extends Literal

This class implements Literal instances that hold encoded AllegroGraph values. Encoded values allow queries that match a range of values; they can also be used to store data in a more compact form.

Encoded literals are dicusssed in more detail in the AllegroGraph Introduction.

Encoded literals are created by calling the methods AllegroGraph.createEncodedLiteral(String, String), AllegroGraph.createEncodedLiteral(long, String), or AllegroGraph.createEncodedLiteral(double, String).

Encoded literals are also created when bulk loading from an N-Triples file if datatype or predicate mappings are defined in the triple store. See AllegroGraph.setDataMapping(String[]) and friends.

Encoding nameWhat is encoded and how
"triple-id"the long integer returned by Triple.queryAGId() is encoded as a value suitable for abbreviated reification.
"single-float"a float or double value is encoded as a range-searchable literal.
"double-float"a float or double value is encoded as a range-searchable literal.
"gyear"a string value is encoded as a range-searchable literal; the value should conform to the XML Schema type "gYear".
"time"a string value is encoded as a range-searchable literal; the value should conform to the XML Schema type "time".
"date"a string value is encoded as a range-searchable literal; the value should conform to the XML Schema type "date".
"long"an integer value is encoded as a range-searchable literal; the value should conform to the XML Schema type "long".
"short"an integer value is encoded as a range-searchable literal; the value should conform to the XML Schema type "short".
"int"an integer value is encoded as a range-searchable literal; the value should conform to the XML Schema type "int".
"byte"an integer value is encoded as a range-searchable literal; the value should conform to the XML Schema type "byte".
"unsigned-long"an integer value is encoded as a range-searchable literal; the value should conform to the XML Schema type "unsignedLong".
"unsigned-short"an integer value is encoded as a range-searchable literal; the value should conform to the XML Schema type "unsignedShort".
"unsigned-int"an integer value is encoded as a range-searchable literal; the value should conform to the XML Schema type "unsignedInt".
"unsigned-byte"an integer value is encoded as a range-searchable literal; the value should conform to the XML Schema type "unsignedByte".
"date-time"a containing an ISO 8601 date-time value is encoded as a range-searchable literal; the value should conform to the XML Schema type "dateTime".

See Also:
Serialized Form

Method Summary
 void add()
          Add this literal to the AllegroGraph triple store.
 java.lang.String getEncoding()
          Get the encoding used for this literal value.
 java.lang.String getLanguage()
          This method overrides the method in the Literal class, and returns null.
 java.lang.Object getValue()
          Get the object that represents the encoded value of the literal.
 java.lang.String toString()
          This method overrides the generic toString method.
 
Methods inherited from class com.franz.ag.Literal
equals, getAGId, getDatatype, getLabel, getType, hashCode, queryLabel, queryLanguage, queryType
 
Methods inherited from class com.franz.ag.ValueNode
compareTo, getObjectStatements, queryAGId
 
Methods inherited from class com.franz.ag.ValueObject
compareTo
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.openrdf.model.Value
getObjectStatements
 
Methods inherited from interface java.lang.Comparable
compareTo
 

Method Detail

getEncoding

public java.lang.String getEncoding()
Get the encoding used for this literal value.

Returns:
the string that names the encoding

getValue

public java.lang.Object getValue()
Get the object that represents the encoded value of the literal.

Returns:
a String, Long, or Double instance

add

public void add()
         throws AllegroGraphException
Description copied from class: Literal
Add this literal to the AllegroGraph triple store. If the literal already is in the triple store, do nothing.

A Literal instance is in the triple store if queryAGId() returns a non-null value.

Overrides:
add in class Literal
Throws:
AllegroGraphException

toString

public java.lang.String toString()
Description copied from class: Literal
This method overrides the generic toString method. This method generates a more readable output string of the form "<Literal id: label[langortype]>".

Overrides:
toString in class Literal

getLanguage

public java.lang.String getLanguage()
This method overrides the method in the Literal class, and returns null.

Specified by:
getLanguage in interface Literal
Overrides:
getLanguage in class Literal
Returns:
null if the Literal does not have a language qualifier.