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

as_anonymous_individual

returns:

if the value is an anonymous, return it. Return None otherwise.

as_iri

returns:

if the value is an IRI, return it. Return Mone otherwise.

as_literal

Returns: if the value is a literal, returns it.

get_datatype

Gets the OWLDatatype which types this literal.

get_literal

Gets the lexical value of this literal.

is_anonymous

is_boolean

Whether this literal is typed as boolean

is_date

Whether this literal is typed as date

is_datetime

Whether this literal is typed as dateTime

is_double

Whether this literal is typed as double

is_duration

Whether this literal is typed as duration

is_integer

Whether this literal is typed as integer

is_literal

Returns: true if the annotation value is a literal

is_string

Whether this literal is typed as string

parse_boolean

Parses the lexical value of this literal into a bool.

parse_date

Parses the lexical value of this literal into a date.

parse_datetime

Parses the lexical value of this literal into a datetime.

parse_double

Parses the lexical value of this literal into a double.

parse_duration

Parses the lexical value of this literal into a Timedelta.

parse_integer

Parses the lexical value of this literal into an integer.

parse_string

Parses the lexical value of this literal into a string.

to_python

Attributes

type_index

as_anonymous_individual()
Returns:

if the value is an anonymous, return it. Return None otherwise.

as_iri()Optional[IRI]
Returns:

if the value is an IRI, return it. Return Mone 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
is_boolean()bool[source]

Whether this literal is typed as boolean

is_date()bool[source]

Whether this literal is typed as date

is_datetime()bool[source]

Whether this literal is typed as dateTime

is_double()bool[source]

Whether this literal is typed as double

is_duration()bool[source]

Whether this literal is typed as duration

is_integer()bool[source]

Whether this literal is typed as integer

is_literal()bool[source]

Returns: true if the annotation value is a literal

is_string()bool[source]

Whether this literal is typed as string

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