pyowl2.axioms.datatype_definition
Represents an OWL axiom that defines a new datatype by equating it to a specific data range.
Description
The implementation extends the base OWLAxiom class to model the logical construct of defining a custom datatype within an ontology. By associating a specific OWLDatatype instance with a defining OWLDataRange, the software enables the creation of complex data types that restrict values based on existing ranges or literal constraints. Optional annotations can be attached to the definition to provide metadata, which are handled through inheritance from the parent axiom class. State management is facilitated through properties that allow the retrieval and modification of both the target datatype and the defining data range, while a custom string representation ensures the axiom can be displayed in a human-readable format consistent with OWL syntax.
Classes
This axiom serves to define a new datatype within an ontology by equating it to a specific data range, which may consist of simple literals or complex restrictions on existing datatypes. It functions as a logical building block, allowing the newly created datatype to be utilized in other parts of the ontology to enforce precise value constraints. The definition is composed of a target datatype and a defining data range, and it can optionally include annotations to provide additional context or metadata about the axiom itself. |
Module Contents
UML Class Diagram for OWLDatatypeDefinition
- class OWLDatatypeDefinition(
- datatype: pyowl2.base.datatype.OWLDatatype,
- data_range: pyowl2.abstracts.data_range.OWLDataRange,
- annotations: list[pyowl2.base.annotation.OWLAnnotation] | None = None,
Bases:
pyowl2.abstracts.axiom.OWLAxiom
This axiom serves to define a new datatype within an ontology by equating it to a specific data range, which may consist of simple literals or complex restrictions on existing datatypes. It functions as a logical building block, allowing the newly created datatype to be utilized in other parts of the ontology to enforce precise value constraints. The definition is composed of a target datatype and a defining data range, and it can optionally include annotations to provide additional context or metadata about the axiom itself.
- Parameters:
datatype (OWLDatatype) – The new datatype being defined by this axiom, identified by its IRI.
data_range (OWLDataRange) – Specifies the set of values or constraints that define the new datatype.
- __str__() str[source]
Returns a formatted string representation of the datatype definition axiom, incorporating the axiom’s annotations, the specific datatype being defined, and the data range used for the definition. If the axiom has no associated annotations, the representation explicitly includes an empty list in place of the annotations to maintain a consistent structure.
- Returns:
A string representation of the datatype definition axiom, formatted as DatatypeDefinition([annotations] datatype data_range).
- Return type:
str
- _data_range: pyowl2.abstracts.data_range.OWLDataRange
- _datatype: pyowl2.base.datatype.OWLDatatype
- property data_range: pyowl2.abstracts.data_range.OWLDataRange
Updates the data range associated with this OWL datatype definition by assigning the provided OWLDataRange object to the internal state. This operation overwrites any existing data range, effectively modifying the definition’s constraints in place. While the method signature expects an instance of OWLDataRange, the implementation does not perform explicit runtime validation of the input type.
- Parameters:
value (OWLDataRange) – The OWL data range to assign.
- property datatype: pyowl2.base.datatype.OWLDatatype
Updates the OWL datatype associated with this definition by assigning the provided value to the internal storage. This setter allows the underlying data type reference to be replaced or initialized. The method accepts an instance of OWLDatatype and directly overwrites the existing attribute without performing additional validation.
- Parameters:
value (OWLDatatype) – The OWL datatype to assign.