com.franz.ag
Class Literal

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

public class Literal
extends ValueNode
implements Literal

This class represents 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.

See Also:
Serialized Form

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()
           
 URI 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 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

queryLabel

public 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

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

Specified by:
getLabel in interface Literal
Returns:
A string. If the value is not in the Java cache, retrieve it from the triple store.

queryType

public 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

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

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

getType

public 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

public 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

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

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

toString

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


equals

public 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.


hashCode

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

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


add

public 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

public UPI getAGId()
            throws AllegroGraphException
Throws:
AllegroGraphException