|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.jrdf.graph.AbstractLiteral
public abstract class AbstractLiteral
A base implementation of an RDF Literal
.
Field Summary | |
---|---|
protected URI |
datatypeURI
RDF datatype URI, NullURI for untyped literal. |
protected String |
language
The language code of the literal. |
protected DatatypeValue |
value
The lexical form of the literal. |
Constructor Summary | |
---|---|
protected |
AbstractLiteral()
|
protected |
AbstractLiteral(Object newObject)
Construct a datatype literal based on an existing Java class. |
protected |
AbstractLiteral(String newLexicalForm)
Construct a plain literal. |
protected |
AbstractLiteral(String newLexicalForm,
String newLanguage)
Construct a literal with language. |
protected |
AbstractLiteral(String newLexicalForm,
URI newDatatypeURI)
Construct a datatyped literal. |
Method Summary | |
---|---|
void |
accept(TypedNodeVisitor visitor)
Accept a call from a TypedNodeVisitor. |
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 NO_DATATYPE for a plain literal. |
DatatypeValue |
getDatatypeValue()
Obtain the data type representation of this literal. |
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 "" if no language specified. |
String |
getLexicalForm()
Obtain the text of this literal. |
Object |
getValue()
Obtain a Java native representation of the datatype. |
int |
hashCode()
Returns a hash-code value for this literal. |
boolean |
isDatatypedLiteral()
Returns true if the literal is a datatype literal. |
boolean |
isLanguageLiteral()
Returns true if the literal is a language literal. |
boolean |
isPlainLiteral()
Returns true if the literal is a untyped/plain literal. |
boolean |
isWellFormedXML()
Whether the literal is well formed XML. |
String |
toString()
Returns the lexical form. |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected DatatypeValue value
protected String language
protected URI datatypeURI
NullURI
for untyped literal.
Constructor Detail |
---|
protected AbstractLiteral()
protected AbstractLiteral(String newLexicalForm)
newLexicalForm
- the text part of the literal
IllegalArgumentException
- if newLexicalForm is null
protected AbstractLiteral(String newLexicalForm, String newLanguage)
newLexicalForm
- the text part of the literalnewLanguage
- the language code, possibly the empty string but not
null
IllegalArgumentException
- if lexicalForm or
lang are null
protected AbstractLiteral(String newLexicalForm, URI newDatatypeURI)
newLexicalForm
- the text part of the literalnewDatatypeURI
- the URI for a datatyped literal
IllegalArgumentException
- if lexicalForm or
datatype are null
protected AbstractLiteral(Object newObject)
newObject
- the object to use to construct the literal from. Uses a map of registered classes to
creator objects.
IllegalArgumentException
- if the class is not registered to convert to a datatype.Method Detail |
---|
public String getLexicalForm()
Value
getLexicalForm
in interface Value
null
public Object getValue()
Literal
getValue
in interface Literal
getValue
in interface Value
public DatatypeValue getDatatypeValue()
Literal
getDatatypeValue
in interface Literal
public String getLanguage()
Literal
""
if no language specified.
getLanguage
in interface Literal
""
if no language specified.public boolean isDatatypedLiteral()
Literal
isDatatypedLiteral
in interface Literal
public boolean isLanguageLiteral()
Literal
isLanguageLiteral
in interface Literal
public boolean isPlainLiteral()
Literal
isPlainLiteral
in interface Literal
public boolean isWellFormedXML()
isWellFormedXML
in interface Value
public URI getDatatypeURI()
NO_DATATYPE
for a plain literal.
getDatatypeURI
in interface Literal
NO_DATATYPE
for a plain literal.public void accept(TypedNodeVisitor visitor)
accept
in interface TypedNodeVisitable
visitor
- the object doing the visiting.public int hashCode()
Literal
hashCode
in interface Literal
hashCode
in class Object
public boolean equals(Object obj)
Literal
equals
in interface Literal
equals
in class Object
obj
- the reference object with which to compare.
public String getEscapedForm()
\U
escape sequence rather than a
pair of 4-digit &x5C;u
sequences representing the surrogates.
getEscapedForm
in interface Literal
public String toString()
toString
in interface Literal
toString
in class Object
public String getEscapedLexicalForm()
Literal
getEscapedLexicalForm
in interface Literal
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |