public interface OWLLiteral extends OWLObject, OWLAnnotationObject, OWLAnnotationValue, OWLPropertyAssertionObject
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 |
|---|---|
void |
accept(OWLDataVisitor visitor) |
<O> O |
accept(OWLDataVisitorEx<O> visitor) |
OWLDatatype |
getDatatype()
Gets the
OWLDatatype which types this literal. |
String |
getLang()
Gets the language tag of this literal.
|
String |
getLiteral()
Gets the lexical value of this literal.
|
boolean |
hasLang()
Determines if this literal has a language tag.
|
boolean |
hasLang(String lang)
Determines if this
OWLLiteral has a particular language tag. |
boolean |
isBoolean()
Determines if this literal is typed with a datatype that has an IRI that is
"http://www.w3.org/2001/XMLSchema#"boolean. |
boolean |
isDouble()
Determines if this literal is typed with a datatype that has an IRI that is
"http://www.w3.org/2001/XMLSchema#"double. |
boolean |
isFloat()
Determines if this literal is typed with a datatype that has an IRI that is
"http://www.w3.org/2001/XMLSchema#"float. |
boolean |
isInteger()
Determines if this literal is typed with a datatype that has an IRI that is
"http://www.w3.org/2001/XMLSchema#"integer. |
boolean |
isRDFPlainLiteral()
Determines if the datatype of this literal is
rdf:PlainLiteral. |
boolean |
parseBoolean()
Parses the lexical value of this literal into a boolean.
|
double |
parseDouble()
Parses the lexical value of this literal into a double.
|
float |
parseFloat()
Parses the lexical value of this literal into a float.
|
int |
parseInteger()
Parses the lexical value of this literal into an integer.
|
accept, acceptaccept, accept, getAnonymousIndividuals, getClassesInSignature, getDataPropertiesInSignature, getDatatypesInSignature, getIndividualsInSignature, getNestedClassExpressions, getObjectPropertiesInSignature, getSignature, isBottomEntity, isTopEntitycompareToboolean 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).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.boolean hasLang()
true if this literal has a non-empty language tag, otherwise falseString getLang()
rdf:PlainLiteral, or because its language tag is empty, then the empty string
will be returned. (The null value is never returned).boolean hasLang(String lang)
OWLLiteral has a particular language tag.lang - The specific lang to test for. The tag will be normalised - white space will be trimmed from
the end and it will be converted to lower case.true if this literal has a language tag equal to lang, otherwise
false.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.int parseInteger()
throws NumberFormatException
"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.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.boolean parseBoolean()
throws NumberFormatException
"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.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.double parseDouble()
throws NumberFormatException
"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.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.float parseFloat()
throws NumberFormatException
"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.void accept(OWLDataVisitor visitor)
<O> O accept(OWLDataVisitorEx<O> visitor)
Copyright © 2013 The University of Manchester. All Rights Reserved.