owlapy.owl_literal

OWL Literals

Module Contents

Classes

OWLLiteral

Literals represent data values such as particular strings or integers. They are analogous to typed RDF

Attributes

Literals

OWLTopObjectProperty

OWLBottomObjectProperty

OWLTopDataProperty

OWLBottomDataProperty

DoubleOWLDatatype

IntegerOWLDatatype

BooleanOWLDatatype

StringOWLDatatype

DateOWLDatatype

DateTimeOWLDatatype

DurationOWLDatatype

TopOWLDatatype

NUMERIC_DATATYPES

TIME_DATATYPES

owlapy.owl_literal.Literals
class owlapy.owl_literal.OWLLiteral[source]

Bases: owlapy.owl_annotation.OWLAnnotationValue

Literals represent data values such as particular strings or integers. They are analogous to typed RDF literals and can also be understood as individuals denoting data values. Each literal consists of a lexical form, which is a string, and a datatype.

__slots__ = ()
type_index: Final = 4008
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_boolean() bool[source]

Whether this literal is typed as boolean.

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.

is_double() bool[source]

Whether this literal is typed as double.

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.

is_integer() bool[source]

Whether this literal is typed as integer.

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.

is_string() bool[source]

Whether this literal is typed as string.

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.

is_date() bool[source]

Whether this literal is typed as date.

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.

is_datetime() bool[source]

Whether this literal is typed as dateTime.

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.

is_duration() bool[source]

Whether this literal is typed as duration.

parse_duration() pandas.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.

is_literal() bool[source]
Returns:

true if the annotation value is a literal

as_literal() OWLLiteral[source]
Returns:

if the value is a literal, returns it. Return None otherwise

to_python() Literals[source]
abstract get_datatype() owlapy.owl_datatype.OWLDatatype[source]

Gets the OWLDatatype which types this literal.

Returns:

The OWLDatatype that types this literal.

owlapy.owl_literal.OWLTopObjectProperty: Final
owlapy.owl_literal.OWLBottomObjectProperty: Final
owlapy.owl_literal.OWLTopDataProperty: Final
owlapy.owl_literal.OWLBottomDataProperty: Final
owlapy.owl_literal.DoubleOWLDatatype: Final
owlapy.owl_literal.IntegerOWLDatatype: Final
owlapy.owl_literal.BooleanOWLDatatype: Final
owlapy.owl_literal.StringOWLDatatype: Final
owlapy.owl_literal.DateOWLDatatype: Final
owlapy.owl_literal.DateTimeOWLDatatype: Final
owlapy.owl_literal.DurationOWLDatatype: Final
owlapy.owl_literal.TopOWLDatatype: Final
owlapy.owl_literal.NUMERIC_DATATYPES: Final[Set[owlapy.owl_datatype.OWLDatatype]]
owlapy.owl_literal.TIME_DATATYPES: Final[Set[owlapy.owl_datatype.OWLDatatype]]