public interface Literal extends Value
A literal value in an RDF graph
| Modifier and Type | Field and Description |
|---|---|
static boolean |
STRICT_TYPES
System setting that controls whether the casting methods of
Literal such as intValue(Literal)
are strict about the conversion. |
| Modifier and Type | Method and Description |
|---|---|
static boolean |
booleanValue(Literal theLiteral)
Get the value of the
Literal as a `boolean`. |
static byte |
byteValue(Literal theLiteral) |
static XMLGregorianCalendar |
calendarValue(Literal theLiteral)
|
Datatype |
datatype()
The datatype of the `Literal`.
|
default IRI |
datatypeIRI()
The IRI of the
Datatype of the `Literal`. |
static BigDecimal |
decimalValue(Literal theLiteral)
Get the value of the
Literal as a BigDecimal. |
static double |
doubleValue(Literal theLiteral)
Get the value of the
Literal as a `double`. |
static Duration |
durationValue(Literal theLiteral) |
static float |
floatValue(Literal theLiteral)
Get the value of the
Literal as a `float`. |
static BigInteger |
integerValue(Literal theLiteral)
Get the value of the
Literal as a BigInteger. |
static int |
intValue(Literal theLiteral) |
static boolean |
isLanguageLiteral(Literal theLiteral)
Sugar for `Literal.lang().isPresent()`
|
String |
label()
The lexical value of the literal
|
default Optional<String> |
lang()
Optionally, the language of the lexical value of the `Literal`.
|
static long |
longValue(Literal theLiteral) |
static int |
shortValue(Literal theLiteral) |
static String |
str(Literal theLiteral)
Return the `String` serialization of the
Literal |
static final boolean STRICT_TYPES
Literal such as intValue(Literal)
are strict about the conversion. When `true`, if you try to get the `int` value of `"5"^^xsd:string` it will
throw a NumberFormatException because the datatype of the `Literal` is incompatible with `int`.
If `false` the label() will be used and passed to, in this example, `Integer.parseInt(String)
which still may throw a `NumberFormatException` if the value of the `Literal` is not a valid numeric value.
The default value is `false`.@Nonnull default Optional<String> lang()
datatype() is
RDF.LANG_STRING.@Nonnull default IRI datatypeIRI()
Datatype of the `Literal`. Often, this is syntactic sugar for `datatype().iri()` however,
in the case where it is a user defined datatype, eg Datatype.UDF this will return the specific IRI
of the datatype.@Nonnull Datatype datatype()
@Nonnull static String str(@Nonnull Literal theLiteral)
LiteraltheLiteral - the `Literal` to serializestatic boolean isLanguageLiteral(@Nonnull Literal theLiteral)
theLiteral - the literalstatic boolean booleanValue(@Nonnull Literal theLiteral)
Literal as a `boolean`.theLiteral - the literalBooleanLiteralstatic XMLGregorianCalendar calendarValue(@Nonnull Literal theLiteral)
theLiteral - the literalIllegalArgumentException - if the literal is not a calendar datatypeCalendarLiteral,
XMLDatatypes.isCalendarDatatype(Datatype)static float floatValue(@Nonnull Literal theLiteral)
Literal as a `float`.theLiteral - the literalNumberFormatException - if the literal is not a numeric datatypestatic double doubleValue(@Nonnull Literal theLiteral)
Literal as a `double`.theLiteral - the literalNumberFormatException - if the literal is not a numeric datatypestatic BigInteger integerValue(@Nonnull Literal theLiteral)
Literal as a BigInteger.theLiteral - the literalNumberFormatException - if the literal is not a numeric datatypestatic BigDecimal decimalValue(@Nonnull Literal theLiteral)
Literal as a BigDecimal.theLiteral - the literalNumberFormatException - if the literal is not a numeric datatypeCopyright © 2010-2016 Stardog Union. All Rights Reserved.