com.franz.agbase
Interface EncodedLiteral

All Superinterfaces:
LiteralNode, ValueNode, ValueObject

public interface EncodedLiteral
extends LiteralNode

This interface defines 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 discussed 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".


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 interface com.franz.agbase.LiteralNode
equals, getAGId, getDatatype, getLabel, getType, hashCode, queryLabel, queryLanguage, queryType
 
Methods inherited from interface com.franz.agbase.ValueNode
compareTo, getObjectStatements, queryAGId
 

Method Detail

getEncoding

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

Returns:
the string that names the encoding

getValue

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

Returns:
a String, Long, or Double instance

add

void add()
         throws AllegroGraphException
Description copied from interface: LiteralNode
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.

Specified by:
add in interface LiteralNode
Throws:
AllegroGraphException

toString

java.lang.String toString()
Description copied from interface: LiteralNode
This method overrides the generic toString method. This method generates a more readable output string of the form '"label"[langortype]' where langortype is a language or datatype qualifier. Note that although the string looks like NTriples syntax, it may not parse correctly because disallowed characters are not escaped.

Specified by:
toString in interface LiteralNode
Overrides:
toString in class java.lang.Object

getLanguage

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

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