java.lang.Object
org.apache.jena.enhanced.Polymorphic<RDFNode>
org.apache.jena.enhanced.EnhNode
org.apache.jena.rdf.model.impl.LiteralImpl
- All Implemented Interfaces:
FrontsNode
,Literal
,RDFNode
An implementation of Literal.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionIf this node is a Literal, answer that literal; otherwise throw an exception.If this node is a Resource, answer that resource; otherwise throw an exception.boolean
If the literal is interpretable as a Boolean return its value as a boolean.byte
getByte()
If the literal is interpretable as a Byte return its value.char
getChar()
If the literal is interpretable as a Char return its value.Return the datatype of the literal.Return the uri of the datatype of the literal.double
If the literal is interpretable as a Double return its value.float
getFloat()
If the literal is interpretable as a Float return its value.int
getInt()
If the literal is interpretable as a Integer return its value.If a language is defined for this literal return itReturn the lexical form of the literal.long
getLong()
If the literal is interpretable as a Long return its value.getModel()
Answer the model this literal was created in, if any, otherwise null.short
getShort()
If the literal is interpretable as a Short return its value.If the literal is interpretable as a string return its value.getValue()
Return the value of the literal.Literals are not in any particular model, and so inModel can return this.boolean
Deprecated.To be removed.boolean
sameValueAs
(Literal other) Test that two literals are semantically equivalent.toString()
Answer a String representation of the node.visitWith
(RDFVisitor rv) Apply the appropriate method of the visitor to this node's content and return the result.Methods inherited from class org.apache.jena.enhanced.EnhNode
as, asNode, canAs, equals, getGraph, hashCode, isAnon, isLiteral, isResource, isStmtResource, isURIResource, isValid, viewAs
Methods inherited from class org.apache.jena.enhanced.Polymorphic
addView, supports
Methods inherited from interface org.apache.jena.graph.FrontsNode
asNode
Methods inherited from interface org.apache.jena.rdf.model.RDFNode
as, canAs, isAnon, isLiteral, isResource, isStmtResource, isURIResource
-
Field Details
-
factory
-
-
Constructor Details
-
LiteralImpl
-
LiteralImpl
-
-
Method Details
-
visitWith
Description copied from interface:RDFNode
Apply the appropriate method of the visitor to this node's content and return the result. -
inModel
Literals are not in any particular model, and so inModel can return this. -
asLiteral
Description copied from interface:RDFNode
If this node is a Literal, answer that literal; otherwise throw an exception. -
asResource
Description copied from interface:RDFNode
If this node is a Resource, answer that resource; otherwise throw an exception.- Specified by:
asResource
in interfaceRDFNode
-
getModel
Answer the model this literal was created in, if any, otherwise null. -
toString
Description copied from interface:RDFNode
Answer a String representation of the node. The form of the string depends on the type of the node and is intended for human consumption, not machine analysis. -
getValue
Return the value of the literal. In the case of plain literals this will return the literal string. In the case of typed literals it will return a java object representing the value. In the case of typed literals representing a java primitive then the appropriate java wrapper class (Integer etc) will be returned. -
getDatatype
Return the datatype of the literal. This will be null in the case of plain literals.- Specified by:
getDatatype
in interfaceLiteral
-
getDatatypeURI
Return the uri of the datatype of the literal. This will be null in the case of plain literals.- Specified by:
getDatatypeURI
in interfaceLiteral
-
getLexicalForm
Return the lexical form of the literal.- Specified by:
getLexicalForm
in interfaceLiteral
-
getBoolean
public boolean getBoolean()Description copied from interface:Literal
If the literal is interpretable as a Boolean return its value as a boolean. Plain literals are interpreted by parsing their lexical representation, typed literals are interpreted by coercion of the java object representing their value.- Specified by:
getBoolean
in interfaceLiteral
- Returns:
- the literal interpreted as a boolean
-
getByte
public byte getByte()Description copied from interface:Literal
If the literal is interpretable as a Byte return its value. Plain literals are interpreted by parsing their lexical representation, typed literals are interpreted by coercion of the java object representing their value. -
getShort
public short getShort()Description copied from interface:Literal
If the literal is interpretable as a Short return its value. Plain literals are interpreted by parsing their lexical representation, typed literals are interpreted by coercion of the java object representing their value. -
getInt
public int getInt()Description copied from interface:Literal
If the literal is interpretable as a Integer return its value. Plain literals are interpreted by parsing their lexical representation, typed literals are interpreted by coercion of the java object representing their value. -
getLong
public long getLong()Description copied from interface:Literal
If the literal is interpretable as a Long return its value. Plain literals are interpreted by parsing their lexical representation, typed literals are interpreted by coercion of the java object representing their value. -
getChar
public char getChar()Description copied from interface:Literal
If the literal is interpretable as a Char return its value. Plain literals are interpreted by parsing their lexical representation, typed literals are interpreted by coercion of the java object representing their value. -
getFloat
public float getFloat()Description copied from interface:Literal
If the literal is interpretable as a Float return its value. Plain literals are interpreted by parsing their lexical representation, typed literals are interpreted by coercion of the java object representing their value. -
getDouble
public double getDouble()Description copied from interface:Literal
If the literal is interpretable as a Double return its value. Plain literals are interpreted by parsing their lexical representation, typed literals are interpreted by coercion of the java object representing their value. -
getString
Description copied from interface:Literal
If the literal is interpretable as a string return its value. For typed literals this will throw an error for non string literals and one needs to use getLexicalForm to return the string form of other datatypes. -
getLanguage
Description copied from interface:Literal
If a language is defined for this literal return it- Specified by:
getLanguage
in interfaceLiteral
- Returns:
- the language for this literal if it exists, or empty string if none
-
isWellFormedXML
Deprecated.To be removed. Well-formness of XML literal is not tested for.Description copied from interface:Literal
Answer true iff this literal is (or claims to be) well-formed XML.- Specified by:
isWellFormedXML
in interfaceLiteral
-
sameValueAs
Test that two literals are semantically equivalent. In some cases this may be the same as equals, in others equals is stricter. For example, two xsd:int literals with the same value but different language tag are semantically equivalent but distinguished by the java equality function in order to support round tripping.- Specified by:
sameValueAs
in interfaceLiteral
-