owlapy.model.OWLLiteral¶
-
class
owlapy.model.
OWLLiteral
(value, type_: Optional[owlapy.model.OWLDatatype] = None)[source]¶ Bases:
owlapy.model.OWLAnnotationValue
Represents a Literal in the OWL 2 Specification.
Convenience method that obtains a literal
- Parameters:
value – The value of the literal
type – the datatype of the literal
Methods
- returns:
if the value is an anonymous, return it. Return None otherwise.
- returns:
if the value is an IRI, return it. Return Mone otherwise.
Returns: if the value is a literal, returns it.
Gets the OWLDatatype which types this literal.
Gets the lexical value of this literal.
Whether this literal is typed as boolean
Whether this literal is typed as date
Whether this literal is typed as dateTime
Whether this literal is typed as double
Whether this literal is typed as duration
Whether this literal is typed as integer
Returns: true if the annotation value is a literal
Whether this literal is typed as string
Parses the lexical value of this literal into a bool.
Parses the lexical value of this literal into a date.
Parses the lexical value of this literal into a datetime.
Parses the lexical value of this literal into a double.
Parses the lexical value of this literal into a Timedelta.
Parses the lexical value of this literal into an integer.
Parses the lexical value of this literal into a string.
Attributes
-
as_anonymous_individual
()¶ - Returns:
if the value is an anonymous, return it. Return None otherwise.
-
as_literal
() → owlapy.model.OWLLiteral[source]¶ Returns: if the value is a literal, returns it. Return None otherwise
-
abstract
get_datatype
() → owlapy.model.OWLDatatype[source]¶ Gets the OWLDatatype which types this literal.
- Returns:
The OWLDatatype that types this literal.
-
get_literal
() → str[source]¶ Gets the lexical value of this literal. Note that the language tag is not included.
- Returns:
The lexical value of this literal.
-
is_anonymous
() → bool¶
-
parse_boolean
() → bool[source]¶ Parses the lexical value of this literal into a bool. The lexical value of this literal should be in the lexical space of the boolean datatype (”http://www.w3.org/2001/XMLSchema#boolean”).
- Returns:
A bool value that is represented by this literal.
-
parse_date
() → datetime.date[source]¶ Parses the lexical value of this literal into a date. The lexical value of this literal should be in the lexical space of the date datatype (”http://www.w3.org/2001/XMLSchema#date”).
- Returns:
A date value that is represented by this literal.
-
parse_datetime
() → datetime.datetime[source]¶ Parses the lexical value of this literal into a datetime. The lexical value of this literal should be in the lexical space of the dateTime datatype (”http://www.w3.org/2001/XMLSchema#dateTime”).
- Returns:
A datetime value that is represented by this literal.
-
parse_double
() → float[source]¶ Parses the lexical value of this literal into a double. The lexical value of this literal should be in the lexical space of the double datatype (”http://www.w3.org/2001/XMLSchema#double”).
- Returns:
A double value that is represented by this literal.
-
parse_duration
() → pandas._libs.tslibs.timedeltas.Timedelta[source]¶ Parses the lexical value of this literal into a Timedelta. The lexical value of this literal should be in the lexical space of the duration datatype (”http://www.w3.org/2001/XMLSchema#duration”).
- Returns:
A Timedelta value that is represented by this literal.
-
parse_integer
() → int[source]¶ Parses the lexical value of this literal into an integer. The lexical value of this literal should be in the lexical space of the integer datatype (”http://www.w3.org/2001/XMLSchema#integer”).
- Returns:
An integer value that is represented by this literal.
-
parse_string
() → str[source]¶ Parses the lexical value of this literal into a string. The lexical value of this literal should be in the lexical space of the string datatype (”http://www.w3.org/2001/XMLSchema#string”).
- Returns:
A string value that is represented by this literal.
-
to_python
() → Union[owlapy.model.OWLLiteral, int, float, bool, pandas._libs.tslibs.timedeltas.Timedelta, datetime.datetime, datetime.date, str][source]¶
-
type_index
: Final = 4008¶