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.If this node is a StatementTerm, answer that statement term; otherwise throw an exception.If a base direction is defined for this literal return itbooleanIf the literal is interpretable as a Boolean return its value as a boolean.bytegetByte()If the literal is interpretable as a Byte return its value.chargetChar()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.doubleIf the literal is interpretable as a Double return its value.floatgetFloat()If the literal is interpretable as a Float return its value.intgetInt()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.longgetLong()If the literal is interpretable as a Long return its value.getModel()Answer the model this literal was created in, if any, otherwise null.shortgetShort()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.booleansameValueAs(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, isStatementTerm, isURIResource, isValid, viewAsMethods inherited from class org.apache.jena.enhanced.Polymorphic
addView, supportsMethods inherited from interface org.apache.jena.graph.FrontsNode
asNodeMethods inherited from interface org.apache.jena.rdf.model.Literal
equals, getTextDirectionMethods inherited from interface org.apache.jena.rdf.model.RDFNode
as, canAs, isAnon, isLiteral, isResource, isStatementTerm, isURIResource
-
Field Details
-
factory
-
-
Constructor Details
-
LiteralImpl
-
LiteralImpl
-
-
Method Details
-
visitWith
Description copied from interface:RDFNodeApply 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:RDFNodeIf this node is a Literal, answer that literal; otherwise throw an exception. -
asResource
Description copied from interface:RDFNodeIf this node is a Resource, answer that resource; otherwise throw an exception.- Specified by:
asResourcein interfaceRDFNode
-
asStatementTerm
Description copied from interface:RDFNodeIf this node is a StatementTerm, answer that statement term; otherwise throw an exception.- Specified by:
asStatementTermin interfaceRDFNode
-
getModel
Answer the model this literal was created in, if any, otherwise null. -
toString
Description copied from interface:RDFNodeAnswer 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:
getDatatypein interfaceLiteral
-
getDatatypeURI
Return the uri of the datatype of the literal. This will be null in the case of plain literals.- Specified by:
getDatatypeURIin interfaceLiteral
-
getLexicalForm
Return the lexical form of the literal.- Specified by:
getLexicalFormin interfaceLiteral
-
getBoolean
public boolean getBoolean()Description copied from interface:LiteralIf 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:
getBooleanin interfaceLiteral- Returns:
- the literal interpreted as a boolean
-
getByte
public byte getByte()Description copied from interface:LiteralIf 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:LiteralIf 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:LiteralIf 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:LiteralIf 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:LiteralIf 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:LiteralIf 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:LiteralIf 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:LiteralIf the literal is interpretable as a string return its value. -
getLanguage
Description copied from interface:LiteralIf a language is defined for this literal return it- Specified by:
getLanguagein interfaceLiteral- Returns:
- the language for this literal if it exists, or empty string if none
-
getBaseDirection
Description copied from interface:LiteralIf a base direction is defined for this literal return it- Specified by:
getBaseDirectionin interfaceLiteral- Returns:
- the base direction for this literal if it exists, or null if none
-
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:
sameValueAsin interfaceLiteral
-