pyowl2.axioms.annotations.annotation_property_range

Implements an OWL axiom that constrains the valid range of values for a specific annotation property.

Description

Defines the semantic constraint that values assigned to a specific annotation property must belong to a certain class or type. By extending the abstract OWLAnnotationAxiom base class, the implementation allows the constraint to carry metadata annotations about the axiom itself. The design encapsulates an OWLAnnotationProperty and a range identifier, which can be either an IRI or a URI reference, providing property accessors to manage these components. A string representation method facilitates debugging and logging by displaying the property, range, and associated annotations in a standardized format.

Classes

OWLAnnotationPropertyRange

This axiom represents a constraint that specifies the valid range of values for a given annotation property within an ontology. It asserts that any value associated with the property must be an instance of the class identified by the provided IRI. To use this entity, one must provide the annotation property to be constrained and the IRI representing the range class, along with optional annotations to attach metadata directly to the axiom.

Module Contents

UML Class Diagram for OWLAnnotationPropertyRange

UML Class Diagram for OWLAnnotationPropertyRange

class OWLAnnotationPropertyRange(
property: pyowl2.base.annotation_property.OWLAnnotationProperty,
iri: rdflib.URIRef | pyowl2.base.iri.IRI,
annotations: list[pyowl2.base.annotation.OWLAnnotation] | None = None,
)[source]

Bases: pyowl2.abstracts.annotation_axiom.OWLAnnotationAxiom

Inheritance diagram of pyowl2.axioms.annotations.annotation_property_range.OWLAnnotationPropertyRange

This axiom represents a constraint that specifies the valid range of values for a given annotation property within an ontology. It asserts that any value associated with the property must be an instance of the class identified by the provided IRI. To use this entity, one must provide the annotation property to be constrained and the IRI representing the range class, along with optional annotations to attach metadata directly to the axiom.

Parameters:
  • annotation_property (OWLAnnotationProperty) – The annotation property for which the range is being specified.

  • range (Union[URIRef, IRI]) – The IRI or URI reference identifying the class to which the values of the annotation property must belong.

__str__() str[source]

Returns a string representation of the annotation property range axiom, formatted to display the annotations, the annotation property, and the range. The output string follows the pattern “AnnotationPropertyRange([annotations] property range)”, where the annotations section reflects the actual axiom_annotations if present, or an empty list “[]” if they are absent. This method is intended for debugging or display purposes and does not modify the state of the object.

Returns:

A string representation of the annotation property range axiom, formatted as ‘AnnotationPropertyRange([annotations] property range)’.

Return type:

str

_annotation_property: pyowl2.base.annotation_property.OWLAnnotationProperty
_range: rdflib.URIRef | pyowl2.base.iri.IRI
property annotation_property: pyowl2.base.annotation_property.OWLAnnotationProperty

Updates the annotation property associated with this OWLAnnotationPropertyRange instance by assigning the provided value to the internal state. This method serves as the setter for the annotation_property attribute, replacing any existing reference with the new OWLAnnotationProperty object. The operation mutates the instance in place and does not return a value.

Parameters:

value (OWLAnnotationProperty) – The OWL annotation property to assign to the object.

property range: rdflib.URIRef | pyowl2.base.iri.IRI

Sets the range restriction for the OWL annotation property represented by this object. The method accepts a value that must be a URI reference or an IRI, which identifies the specific type or class defining the range. Upon invocation, it updates the internal state of the instance by assigning the provided value to the private _range attribute.

Parameters:

value (Union[URIRef, IRI]) – The URI or IRI to assign as the range.