public interface OWLLiteral extends OWLObject, OWLAnnotationObject, OWLAnnotationValue, OWLPropertyAssertionObject, OWLPrimitive, HasLang
Each literal consists of a lexical form, which is a string, and a datatype. A literal consisting
of a lexical form "abc"
and a datatype identified by the IRI datatypeIRI
is
written as "abc"^^datatypeIRI
.
Note that literals whose datatype is rdf:PlainLiteral
can be abbreviated. For example,
literals of the form "abc@"^^rdf:PlainLiteral
can be abbreviated in the functional-style
syntax, and other concrete syntaxes to "abc". Literals of the form
"abc@langTag"^^rdf:PlainLiteral where "langTag" is not empty are abbreviated in functional-style
syntax documents (and other concrete syntaxes) to "abc"@langTag whenever possible.
Modifier and Type | Method and Description |
---|---|
default void |
accept(OWLAnnotationValueVisitor visitor) |
default <O> O |
accept(OWLAnnotationValueVisitorEx<O> visitor) |
default void |
accept(OWLDataVisitor visitor) |
default <O> O |
accept(OWLDataVisitorEx<O> visitor) |
default void |
accept(OWLObjectVisitor visitor)
Accepts a visitor
|
default <O> O |
accept(OWLObjectVisitorEx<O> visitor)
Accepts a visitor
|
default Optional<OWLLiteral> |
asLiteral() |
default Stream<?> |
components() |
OWLDatatype |
getDatatype()
Gets the
OWLDatatype which types this literal. |
default String |
getLang()
Gets the language tag of the literal.
|
String |
getLiteral()
Gets the lexical value of this literal.
|
default int |
hashIndex() |
default boolean |
hasLang()
Determines if this literal has a language tag.
|
default boolean |
hasLang(String lang)
Determines if this
OWLLiteral has a particular language tag. |
default int |
initHashCode() |
default boolean |
isBoolean()
Determines if this literal is typed with a datatype that has an IRI that is
"http://www.w3.org/2001/XMLSchema#"boolean . |
default boolean |
isDouble()
Determines if this literal is typed with a datatype that has an IRI that is
"http://www.w3.org/2001/XMLSchema#"double . |
default boolean |
isFloat()
Determines if this literal is typed with a datatype that has an IRI that is
"http://www.w3.org/2001/XMLSchema#"float . |
default boolean |
isInteger()
Determines if this literal is typed with a datatype that has an IRI that is
"http://www.w3.org/2001/XMLSchema#"integer . |
default boolean |
isLiteral() |
default boolean |
isRDFPlainLiteral()
Determines if the datatype of this literal is
rdf:PlainLiteral . |
default boolean |
parseBoolean()
Parses the lexical value of this literal into a boolean.
|
default double |
parseDouble()
Parses the lexical value of this literal into a double.
|
default float |
parseFloat()
Parses the lexical value of this literal into a float.
|
default int |
parseInteger()
Parses the lexical value of this literal into an integer.
|
default int |
typeIndex() |
annotationValue
asAnonymousIndividual, asIRI
getNestedClassExpressions, hashIteration, hasSharedStructure, isAnonymousExpression, isAxiom, isBottomEntity, isIndividual, isIRI, isOntology, isTopEntity, nestedClassExpressions
compareTo
getSignature, signature, unsortedSignature
containsEntityInSignature
anonymousIndividuals, getAnonymousIndividuals
classesInSignature, getClassesInSignature
getObjectPropertiesInSignature, objectPropertiesInSignature
dataPropertiesInSignature, getDataPropertiesInSignature
getIndividualsInSignature, individualsInSignature
datatypesInSignature, getDatatypesInSignature
annotationPropertiesInSignature, getAnnotationPropertiesInSignature
componentsAnnotationsFirst, componentsWithoutAnnotations
isAnonymous, isNamed
anonymousIndividualValue, ifAnonymousIndividual, ifAnonymousIndividualOrElse, ifIri, ifIriOrElse, ifLiteral, ifLiteralOrElse, ifValue, iriValue, literalValue, map, map, mapAnonymousIndividual, mapAnonymousIndividualOrElse, mapAnonymousIndividualOrElseGet, mapIri, mapIriOrElse, mapIriOrElseGet, mapLiteral, mapLiteralOrElse, mapLiteralOrElseGet, mapValue, when
default Stream<?> components()
components
in interface HasComponents
default int initHashCode()
initHashCode
in interface OWLObject
default int hashIndex()
hashIndex
in interface HasHashIndex
default int typeIndex()
default boolean isRDFPlainLiteral()
rdf:PlainLiteral
. Note that literals
that are abbreviated in the functional syntax (and other concrete syntaxes) and are of the
form "abc"
or "abc"@langTag
will be of the type rdf:PlainLiteral
after parsing.true
if the datatype of this literal is rdf:PlainLiteral, otherwise false
.String getLiteral()
rdf:PlainLiteral
then the abbreviated lexical form will be returned. That is, the language tag is not
included.rdf:PlainLiteral
then
the return values are as follows: If the literal is of the form "abc@"^^rdf:PlainLiteral
then the return value will be "abc" (without the language tag
included). If the literal is of the form "abc@langTag"^^rdf:PlainLiteral
then
the return value will be "abc" (without the language tag included).default String getLang()
HasLang
OWLDatatype getDatatype()
OWLDatatype
which types this literal.OWLDatatype
that types this literal. Note that for strings with language
tag (previously considered to be untyped literals) the datatype will be
rdf:PlainLiteral. The return value is never null
.default boolean hasLang()
true
if this literal has a non-empty language tag, otherwise false
default boolean hasLang(@Nullable String lang)
OWLLiteral
has a particular language tag.lang
- The specific language tag to test for. The tag will be normalised - white space
will be trimmed from the end and it will be converted to lower case. Null input will
be treated as empty.true
if this literal has a language tag equal to lang
, otherwise
false
.default boolean isInteger()
"http://www.w3.org/2001/XMLSchema#"integer
.true
if this literal is typed with
"http://www.w3.org/2001/XMLSchema#"integer
, i.e. this literal represents an
integer, otherwise false
.default int parseInteger()
"http://www.w3.org/2001/XMLSchema#"integer
)NumberFormatException
- if the lexical form could not be parsed into an integer because
it is not in the lexical space of the integer datatype.default boolean isBoolean()
"http://www.w3.org/2001/XMLSchema#"boolean
.true
if this literal is typed with
"http://www.w3.org/2001/XMLSchema#"boolean
, i.e. this literal represents a
boolean, otherwise false
.default boolean parseBoolean()
"http://www.w3.org/2001/XMLSchema#"boolean
).NumberFormatException
- if the lexical form could not be parsed into a boolean because
it is not in the lexical space of the boolean datatype.default boolean isDouble()
"http://www.w3.org/2001/XMLSchema#"double
.true
if this literal is typed with
"http://www.w3.org/2001/XMLSchema#"double
, i.e. this literal represents a
double, otherwise false
.default double parseDouble()
"http://www.w3.org/2001/XMLSchema#"double
).NumberFormatException
- if the lexical form could not be parsed into a double because
it is not in the lexical space of the double datatype.default boolean isFloat()
"http://www.w3.org/2001/XMLSchema#"float
.true
if this literal is typed with
"http://www.w3.org/2001/XMLSchema#"float
, i.e. this literal represents a
float, otherwise false
.default float parseFloat()
"http://www.w3.org/2001/XMLSchema#"float
).NumberFormatException
- if the lexical form could not be parsed into a float because it
is not in the lexical space of the float datatype.default Optional<OWLLiteral> asLiteral()
asLiteral
in interface OWLAnnotationValue
default void accept(OWLDataVisitor visitor)
visitor
- visitordefault <O> O accept(OWLDataVisitorEx<O> visitor)
O
- visitor return typevisitor
- visitordefault void accept(OWLObjectVisitor visitor)
OWLObject
default <O> O accept(OWLObjectVisitorEx<O> visitor)
OWLObject
default void accept(OWLAnnotationValueVisitor visitor)
accept
in interface OWLAnnotationValue
visitor
- visitor to acceptdefault <O> O accept(OWLAnnotationValueVisitorEx<O> visitor)
accept
in interface OWLAnnotationValue
O
- visitor return typevisitor
- visitor to acceptdefault boolean isLiteral()
isLiteral
in interface OWLAnnotationValue
Copyright © 2020 The University of Manchester. All rights reserved.