owlapy.owl_literal

OWL Literals

Attributes

OWLTopObjectProperty

OWLBottomObjectProperty

OWLTopDataProperty

OWLBottomDataProperty

DoubleOWLDatatype

FloatOWLDatatype

DecimalOWLDatatype

IntegerOWLDatatype

NonNegativeIntegerOWLDatatype

NonPositiveIntegerOWLDatatype

NegativeIntegerOWLDatatype

PositiveIntegerOWLDatatype

BooleanOWLDatatype

StringOWLDatatype

DateOWLDatatype

TimeOWLDatatype

GYearMonthOWLDatatype

GMonthDayOWLDatatype

GYearOWLDatatype

GMonthOWLDatatype

GDayOWLDatatype

DateTimeOWLDatatype

DurationOWLDatatype

TopOWLDatatype

NUMERIC_DATATYPES

TIME_DATATYPES

Literals

Classes

FloatSpecialValue

Generic enumeration.

OWLLiteral

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

Module Contents

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.FloatOWLDatatype: Final
owlapy.owl_literal.DecimalOWLDatatype: Final
owlapy.owl_literal.IntegerOWLDatatype: Final
owlapy.owl_literal.NonNegativeIntegerOWLDatatype: Final
owlapy.owl_literal.NonPositiveIntegerOWLDatatype: Final
owlapy.owl_literal.NegativeIntegerOWLDatatype: Final
owlapy.owl_literal.PositiveIntegerOWLDatatype: Final
owlapy.owl_literal.BooleanOWLDatatype: Final
owlapy.owl_literal.StringOWLDatatype: Final
owlapy.owl_literal.DateOWLDatatype: Final
owlapy.owl_literal.TimeOWLDatatype: Final
owlapy.owl_literal.GYearMonthOWLDatatype: Final
owlapy.owl_literal.GMonthDayOWLDatatype: Final
owlapy.owl_literal.GYearOWLDatatype: Final
owlapy.owl_literal.GMonthOWLDatatype: Final
owlapy.owl_literal.GDayOWLDatatype: 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]]
class owlapy.owl_literal.FloatSpecialValue[source]

Bases: enum.Enum

Generic enumeration.

Derive from this class to define new enumerations.

NAN = 'Nan'
POS_INF = 'INF'
NEG_INF = '-INF'
__str__()[source]
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 (”https://www.w3.org/TR/owl2-syntax/#Floating-Point_Numbers”).

Returns:

A double value that is represented by this literal.

is_float() bool[source]

Whether this literal is typed as float.

parse_float() float[source]

Parses the lexical value of this literal into a float. The lexical value of this literal should be in the lexical space of the float datatype (”https://www.w3.org/TR/owl2-syntax/#Floating-Point_Numbers”).

Returns:

A float value that is represented by this literal.

is_decimal() bool[source]

Whether this literal is typed as decimal.

parse_decimal() decimal.Decimal[source]

Parses the lexical value of this literal into a decimal. The lexical value of this literal should be in the lexical space of the decimal datatype (”https://www.w3.org/TR/owl2-syntax/#Floating-Point_Numbers”).

Returns:

A decimal 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_time() bool[source]

Whether this literal is typed as time.

parse_time() datetime.time[source]

Parses the lexical value of this literal into time. The lexical value of this literal should be in the lexical space of the time datatype (”http://www.w3.org/2001/XMLSchema#time”).

Returns:

A time value that is represented by this literal.

is_gyearmonth() bool[source]

Whether this literal is typed as gYearMonth.

parse_gyearmonth() tuple[source]

Parses the lexical value of this literal into gYearMonth.

Returns:

A tuple value of length 2 that is represented by this literal.

is_gmonthday() bool[source]

Whether this literal is typed as gMonthDay.

parse_gmonthday() tuple[source]

Parses the lexical value of this literal into gMonthDay.

Returns:

A tuple value of length 2 that is represented by this literal.

is_gyear() bool[source]

Whether this literal is typed as gYear.

parse_gyear() tuple[source]

Parses the lexical value of this literal into gYear.

Returns:

A integer value that is represented by this literal.

is_gmonth() bool[source]

Whether this literal is typed as gMonth.

parse_gmonth() tuple[source]

Parses the lexical value of this literal into gMonth.

Returns:

A integer value that is represented by this literal.

is_gday() bool[source]

Whether this literal is typed as gDay.

parse_gday() tuple[source]

Parses the lexical value of this literal into gDay.

Returns:

A integer value that is represented by this literal.

has_float_special_value() bool[source]

Whether this literal is using a float special value i.e. v ∈ [“NaN”, “INF”, “-INF”], defined by and enumeration class (not pure string value).

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.