public class SimpleLiteral extends AbstractLiteral
Literal interface.| Modifier | Constructor and Description |
|---|---|
protected |
SimpleLiteral() |
protected |
SimpleLiteral(String label)
Creates a new plain literal with the supplied label.
|
protected |
SimpleLiteral(String label,
IRI datatype)
Creates a new datatyped literal with the supplied label and datatype.
|
protected |
SimpleLiteral(String label,
String language)
Creates a new plain literal with the supplied label and language tag.
|
protected |
SimpleLiteral(String label,
XSD.Datatype datatype) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
booleanValue()
Returns the boolean value of this literal.
|
byte |
byteValue()
Returns the byte value of this literal.
|
XMLGregorianCalendar |
calendarValue()
Returns the
XMLGregorianCalendar value of this literal. |
BigDecimal |
decimalValue()
Returns the decimal value of this literal.
|
double |
doubleValue()
Returns the double value of this literal.
|
boolean |
equals(Object o)
Compares this literal to another object.
|
float |
floatValue()
Returns the float value of this literal.
|
IRI |
getDatatype()
Gets the datatype for this literal.
|
String |
getLabel()
Gets the label (the lexical value) of this literal.
|
Optional<String> |
getLanguage()
Gets the language tag for this literal, normalized to lower case.
|
Optional<XSD.Datatype> |
getXsdDatatype() |
int |
hashCode()
Computes the hash code of this literal.
|
BigInteger |
integerValue()
Returns the integer value of this literal.
|
int |
intValue()
Returns the int value of this literal.
|
long |
longValue()
Returns the long value of this literal.
|
protected void |
setDatatype(IRI datatype) |
protected void |
setDatatype(XSD.Datatype datatype) |
protected void |
setLabel(String label) |
protected void |
setLanguage(String language) |
short |
shortValue()
Returns the short value of this literal.
|
String |
stringValue()
Returns the String-value of a Value object.
|
String |
toString()
Returns the label of the literal with its language or datatype.
|
temporalAccessorValue, temporalAmountValueclone, finalize, getClass, notify, notifyAll, wait, wait, waitisBNode, isIRI, isResource, isTripleprotected SimpleLiteral()
protected SimpleLiteral(String label)
label - The label for the literal, must not be null.protected SimpleLiteral(String label, String language)
label - The label for the literal, must not be null.language - The language tag for the literal, must not be null and not be empty.protected SimpleLiteral(String label, IRI datatype)
label - The label for the literal, must not be null.datatype - The datatype for the literal.protected SimpleLiteral(String label, XSD.Datatype datatype)
protected void setLabel(String label)
public String getLabel()
Literalprotected void setLanguage(String language)
public Optional<String> getLanguage()
LiteralOptional.empty() if it doesn't have one.protected void setDatatype(IRI datatype)
protected void setDatatype(XSD.Datatype datatype)
public IRI getDatatype()
Literal
If Literal.getLanguage() returns a non-empty value than this must return
rdf:langString. If no datatype was
assigned to this literal by the creator, then this method must return
xsd:string.
public Optional<XSD.Datatype> getXsdDatatype()
public boolean equals(Object o)
Literalequals in interface Literalequals in class AbstractLiteralo - the object to compare this literal totrue, if the other object is an instance of Literal and if their labels, language tags and datatypes are equalpublic int hashCode()
LiteralhashCode in interface LiteralhashCode in class AbstractLiteralLiteral.getLabel().hashCode()public String toString()
toString in class AbstractLiteralNTriplesUtil.toNTriplesString(org.eclipse.rdf4j.model.Literal)public String stringValue()
ValueLiteral's label, a
IRI's URI or a BNode's ID.stringValue in interface ValuestringValue in class AbstractLiteralpublic boolean booleanValue()
LiteralbooleanValue in interface LiteralbooleanValue in class AbstractLiteralpublic byte byteValue()
LiteralbyteValue in interface LiteralbyteValue in class AbstractLiteralpublic short shortValue()
LiteralshortValue in interface LiteralshortValue in class AbstractLiteralpublic int intValue()
LiteralintValue in interface LiteralintValue in class AbstractLiteralpublic long longValue()
LiterallongValue in interface LiterallongValue in class AbstractLiteralpublic float floatValue()
LiteralfloatValue in interface LiteralfloatValue in class AbstractLiteralpublic double doubleValue()
LiteraldoubleValue in interface LiteraldoubleValue in class AbstractLiteralpublic BigInteger integerValue()
LiteralintegerValue in interface LiteralintegerValue in class AbstractLiteralpublic BigDecimal decimalValue()
LiteraldecimalValue in interface LiteraldecimalValue in class AbstractLiteralpublic XMLGregorianCalendar calendarValue()
LiteralXMLGregorianCalendar value of this literal. A calendar representation can be given for
literals whose label conforms to the syntax of the following XML
Schema datatypes: dateTime, time, date, gYearMonth, gMonthDay,
gYear, gMonth or gDay.calendarValue in interface LiteralcalendarValue in class AbstractLiteralCopyright © 2015-2020 Eclipse Foundation. All Rights Reserved.