com.franz.agbase
Interface LiteralNode

All Superinterfaces:
ValueNode, ValueObject
All Known Subinterfaces:
EncodedLiteral

public interface LiteralNode
extends ValueNode

This interface defines an instance of a literal node in AllegroGraph.

The AllegroGraph object defines two slots, id and label. Both slots are copied to the Java instance.

The label member may be a lazy value in the Java instance. If queryLabel returns null, getLabel() must make a round-trip to the triple store for the actual value.

There is no public constructor. Literal instances are created by calls to AllegroGraph methods.


Method Summary
 void add()
          Add this literal to the AllegroGraph triple store.
 boolean equals(java.lang.Object other)
          Implement equality for Literal instances.
 UPI getAGId()
          Return the unique internal AllegroGraph identifier for this Literal.
 URINode getDatatype()
          Retrieve the datatype as a URI instance.
 java.lang.String getLabel()
          Return the string associated with the Literal instance.
 java.lang.String getLanguage()
          Retrieve the language qualifier of the Literal.
 java.lang.String getType()
          Retrieve the string label for the datatype of the Literal.
 int hashCode()
          Compute the hashcode of a Literal instance.
 java.lang.String queryLabel()
          Return the string associated with the Literal instance.
 java.lang.String queryLanguage()
          Retrieve the language field of the Literal.
 java.lang.String queryType()
          Retrieve the string label of the datatype of the Literal.
 java.lang.String toString()
          This method overrides the generic toString method.
 
Methods inherited from interface com.franz.agbase.ValueNode
compareTo, getObjectStatements, queryAGId
 

Method Detail

queryLabel

java.lang.String queryLabel()
Return the string associated with the Literal instance.

Returns:
A string or null.

If the returned value is null, the string value is not in the local Java cache, and must be retrieved from the AllegroGraph server with a call to getLabel().


getLabel

java.lang.String getLabel()
Return the string associated with the Literal instance.

Returns:
A string. If the value is not in the Java cache, retrieve it from the triple store.

queryType

java.lang.String queryType()
Retrieve the string label of the datatype of the Literal.

Returns:
null if the information is not in the local cache or if the Literal does not have a datatype label.

If the returned value is null, getType() or getDatatype() must be called to get the actual value.


getDatatype

URINode getDatatype()
Retrieve the datatype as a URI instance.

Returns:
If the string label is not in the local Java cache, this method requires a round-trip to the AllegroGraph server.

getType

java.lang.String getType()
Retrieve the string label for the datatype of the Literal.

Returns:
a string, or null if the Literal does not have a datatype field. This operation may require a round-trip to the AllegroGraph triple store.

queryLanguage

java.lang.String queryLanguage()
Retrieve the language field of the Literal.

Returns:
null if the value is not in the local cache or if the Literal does not have a language label.

If the returned value is null, getLanguage() must be called to get the actual value.


getLanguage

java.lang.String getLanguage()
Retrieve the language qualifier of the Literal.

Returns:
null if the Literal does not have a language qualifier.

toString

java.lang.String toString()
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.

Overrides:
toString in class java.lang.Object

equals

boolean equals(java.lang.Object other)
Implement equality for Literal instances.

Two Literal instances are equal if both are registered in the AllegroGraph triple store and they have identical AllegroGraph part id numbers.

Otherwise, the string representations are compared.

Overrides:
equals in class java.lang.Object

hashCode

int hashCode()
Compute the hashcode of a Literal instance.

The hashcode of a Literal instance is the hashcode of its string representation.

Overrides:
hashCode in class java.lang.Object

add

void add()
         throws AllegroGraphException
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.

Throws:
AllegroGraphException

getAGId

UPI getAGId()
            throws AllegroGraphException
Return the unique internal AllegroGraph identifier for this Literal. If the indentifier is no available in the local Java cache, go to the server to add the Literal and obtain the identifier.

Returns:
The UPI that identifies this Literal.
Throws:
AllegroGraphException