org.jrdf.graph
Interface Literal

All Superinterfaces:
Node, ObjectNode, Serializable, TypedNodeVisitable
All Known Implementing Classes:
AbstractLiteral

public interface Literal
extends ObjectNode, TypedNodeVisitable

RDF literal node.

Version:
$Revision: 1.1 $
Author:
Simon Raboczi, Andrew Newman

Method Summary
 boolean equals(Object obj)
          Indicates whether some other object is "equal to" this one.
 URI getDatatypeURI()
          Returns the URI of the RDF datatype of this resource, or null for an untyped node.
 String getEscapedForm()
          Provide a legible representation of a literal, following the N-Triples format defined in §3.2 of the W3C's RDF Test Cases Recommendation.
 String getEscapedLexicalForm()
          Returns an escaped lexical form where double quotes and backslashes are escaped.
 String getLanguage()
          Returns the language code of the literal, or null if no language specified.
 String getLexicalForm()
          Obtain the text of this literal.
 int hashCode()
          Returns a hash-code value for this literal.
 boolean isWellFormedXML()
          Whether the literal is well formed XML.
 String toString()
          Returns the lexical form.
 
Methods inherited from interface org.jrdf.graph.TypedNodeVisitable
accept
 

Method Detail

getLexicalForm

public String getLexicalForm()
Obtain the text of this literal.

Returns:
the text of the literal, never null

getLanguage

public String getLanguage()
Returns the language code of the literal, or null if no language specified.

Returns:
the language code of the literal, or null if no language specified.

isWellFormedXML

public boolean isWellFormedXML()
Whether the literal is well formed XML.

Returns:
whether the literal is wll formed XML.

getDatatypeURI

public URI getDatatypeURI()
Returns the URI of the RDF datatype of this resource, or null for an untyped node.

Returns:
the URI of the RDF datatype of this resource, or null for an untyped node.

equals

public boolean equals(Object obj)
Indicates whether some other object is "equal to" this one. A literal is equal to another literal if:

Parameters:
obj - the reference object with which to compare.
Returns:
true if this object is the same as the obj argument; false otherwise.

hashCode

public int hashCode()
Returns a hash-code value for this literal. The hash code is based upon XORing all of the literal's components hash codes including the lexical form, datatype, and language.

Returns:
a hash-code value for this literal.

getEscapedForm

public String getEscapedForm()
Provide a legible representation of a literal, following the N-Triples format defined in §3.2 of the W3C's RDF Test Cases Recommendation. Well-formed Unicode surrogate pairs in the lexical form are escaped as a single 8-digit hexadecimal \U escape sequence rather than a pair of 4-digit &x5C;u sequences representing the surrogates.

Returns:
this instance in N-Triples format

getEscapedLexicalForm

public String getEscapedLexicalForm()
Returns an escaped lexical form where double quotes and backslashes are escaped.

Returns:
String the lexical form.

toString

public String toString()
Returns the lexical form.

Returns:
the lexical form.