pyowl2.axioms.object_property_axiom.object_property_range
A Python class representing an OWL axiom that constrains the range of an object property to a specific class expression.
Description
The implementation models a semantic constraint within an ontology by asserting that any individual serving as a value for a specific object property must belong to a defined class type. By inheriting from both OWLPropertyRange and OWLObjectPropertyAxiom, the class integrates range restriction logic directly into the axiom structure, allowing for the enforcement of type safety across relationships. It encapsulates an object property expression and a class expression, storing them as internal attributes while supporting optional annotations for metadata enrichment. The design includes property accessors for modifying the constraint components and a string representation method that outputs the axiom in standard functional syntax for debugging or serialization.
Classes
This entity represents an axiom within an ontology that constrains the types of individuals which may serve as values for a specific object property. It asserts that for any pair of individuals related by the given property, the target individual must be an instance of the specified class expression, thereby enforcing type consistency across relationships. To utilize this component, instantiate it with the object property expression to be constrained, the class expression defining the allowable range, and an optional list of annotations for metadata. The class provides properties to access and modify the property expression, the range class expression, and any associated annotations, serving as a fundamental building block for defining type safety in object-oriented relationships. |
Module Contents
UML Class Diagram for OWLObjectPropertyRange
- class OWLObjectPropertyRange(
- property: pyowl2.abstracts.object_property_expression.OWLObjectPropertyExpression,
- expression: pyowl2.abstracts.class_expression.OWLClassExpression,
- annotations: list[pyowl2.base.annotation.OWLAnnotation] | None = None,
Bases:
pyowl2.abstracts.property_range.OWLPropertyRange,pyowl2.abstracts.object_property_axiom.OWLObjectPropertyAxiom
This entity represents an axiom within an ontology that constrains the types of individuals which may serve as values for a specific object property. It asserts that for any pair of individuals related by the given property, the target individual must be an instance of the specified class expression, thereby enforcing type consistency across relationships. To utilize this component, instantiate it with the object property expression to be constrained, the class expression defining the allowable range, and an optional list of annotations for metadata. The class provides properties to access and modify the property expression, the range class expression, and any associated annotations, serving as a fundamental building block for defining type safety in object-oriented relationships.
- Parameters:
object_property_expression (OWLObjectPropertyExpression) – The object property expression whose range is defined by this axiom.
class_expression (OWLClassExpression) – The class expression defining the range of the object property, specifying the type of individuals that can be its values.
- __str__() str[source]
Returns a string representation of the OWL object property range axiom, formatted according to a specific functional syntax. The output string encapsulates the axiom’s annotations, the object property expression, and the class expression within parentheses. If the axiom contains annotations, they are included in the string; otherwise, an empty list representation is substituted in their place. This method does not modify the object’s state and is primarily used for generating human-readable output or logging.
- Returns:
A string representation of the axiom in the format ObjectPropertyRange([annotations] property range).
- Return type:
str
- _class_expression: pyowl2.abstracts.class_expression.OWLClassExpression
- _object_property_expression: pyowl2.abstracts.object_property_expression.OWLObjectPropertyExpression
- property class_expression: pyowl2.abstracts.class_expression.OWLClassExpression
Updates the range constraint of the object property by assigning a new OWLClassExpression. This setter replaces the existing class expression stored within the OWLObjectPropertyRange instance, effectively modifying the axiom’s definition to reflect the new restriction. The change is immediate and affects the internal state of the object.
- Parameters:
value (OWLClassExpression) – The OWL class expression to assign to the object.
- property object_property_expression: pyowl2.abstracts.object_property_expression.OWLObjectPropertyExpression
Assigns the specified object property expression to this instance, replacing any previously held value. The input must be a valid OWLObjectPropertyExpression object. This method directly mutates the internal state of the object to reflect the new association.
- Parameters:
value (OWLObjectPropertyExpression) – The object property expression to assign.