org.jrdf.graph
Interface Literal

All Superinterfaces:
Node, ObjectNode, TypedNodeVisitable
All Known Subinterfaces:
LiteralMutableId
All Known Implementing Classes:
AbstractLiteral, LiteralImpl

public interface Literal
extends ObjectNode, TypedNodeVisitable

RDF literal node.

Version:
$Revision: 1045 $
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

String getLexicalForm()
Obtain the text of this literal.

Returns:
the text of the literal, never null

getLanguage

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

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

Returns:
whether the literal is wll formed XML.

getDatatypeURI

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

boolean equals(Object obj)
Indicates whether some other object is "equal to" this one.

A literal is equal to another literal if:

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

hashCode

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.

Overrides:
hashCode in class Object
Returns:
a hash-code value for this literal.

getEscapedForm

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

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

Returns:
String the lexical form.

toString

String toString()
Returns the lexical form.

Overrides:
toString in class Object
Returns:
the lexical form.