pyowl2.axioms.data_property_axiom.data_property_domain
Implements a Web Ontology Language (OWL) axiom that restricts the domain of a data property by asserting that individuals associated with the property must belong to a specific class.
Description
The software models a specific type of logical constraint within the Web Ontology Language by linking a data property expression to a class expression that defines its valid subjects. By storing references to both the property and the domain class, the implementation ensures that any individual utilizing the data property logically belongs to the specified class, thereby enforcing consistency within an ontology. Design choices include support for optional annotations, allowing users to attach metadata to the axiom, and the use of property getters and setters to manage the internal state of the property and class expressions. Furthermore, the logic includes a string representation method that outputs the axiom in a functional syntax style, explicitly handling the presence or absence of annotations to maintain a consistent structural format.
Classes
Represents an axiom in the Web Ontology Language (OWL) that defines the domain restriction for a specific data property, asserting that any individual associated with the property must belong to a specified class. It links a data property expression—which connects individuals to literal values—with a class expression that defines the valid types of subjects for that property. Users can utilize this structure to enforce logical consistency within an ontology by specifying the property, its domain class, and optional annotations for metadata. The implementation supports both simple named classes and complex class expressions, allowing for nuanced constraints on the individuals that may participate in data property assertions. |
Module Contents
UML Class Diagram for OWLDataPropertyDomain
- class OWLDataPropertyDomain(
- property: pyowl2.abstracts.data_property_expression.OWLDataPropertyExpression,
- expression: pyowl2.abstracts.class_expression.OWLClassExpression,
- annotations: list[pyowl2.base.annotation.OWLAnnotation] | None = None,
Bases:
pyowl2.abstracts.data_property_axiom.OWLDataPropertyAxiom
Represents an axiom in the Web Ontology Language (OWL) that defines the domain restriction for a specific data property, asserting that any individual associated with the property must belong to a specified class. It links a data property expression—which connects individuals to literal values—with a class expression that defines the valid types of subjects for that property. Users can utilize this structure to enforce logical consistency within an ontology by specifying the property, its domain class, and optional annotations for metadata. The implementation supports both simple named classes and complex class expressions, allowing for nuanced constraints on the individuals that may participate in data property assertions.
- Parameters:
data_property_expression (OWLDataPropertyExpression) – The data property expression whose domain is defined by this axiom.
class_expression (OWLClassExpression) – Specifies the domain of the data property, defining the class of individuals that can be associated with it.
- __str__() str[source]
Returns a string representation of the data property domain axiom using a functional syntax style. The formatted string includes the axiom’s annotations, the associated data property expression, and the class expression defining the domain. If the axiom does not contain any annotations, the representation explicitly includes an empty list [] in the annotations position to maintain structural consistency.
- Returns:
Returns a string representation of the data property domain axiom, including its annotations, data property expression, and class expression.
- Return type:
str
- _class_expression: pyowl2.abstracts.class_expression.OWLClassExpression
- _data_property_expression: pyowl2.abstracts.data_property_expression.OWLDataPropertyExpression
- property class_expression: pyowl2.abstracts.class_expression.OWLClassExpression
Sets the class expression that defines the domain for this data property axiom. This method assigns the provided OWLClassExpression instance to the internal state, effectively replacing any previously associated domain expression. As a setter, it mutates the object in place and does not return a value.
- Parameters:
value (OWLClassExpression) – The OWL class expression to assign.
- property data_property_expression: pyowl2.abstracts.data_property_expression.OWLDataPropertyExpression
Sets the data property expression for this OWL data property domain axiom. This method assigns the provided OWLDataPropertyExpression to the internal state, overwriting any previously stored value. It defines the specific data property whose domain is being restricted by this axiom.
- Parameters:
value (OWLDataPropertyExpression) – The OWL data property expression to assign.