pyowl2.axioms.annotations.annotation_property_domain

Defines an OWL axiom that restricts the domain of an annotation property to a specific class identified by an IRI.

Description

The implementation models a semantic constraint within an ontology by asserting that the subject of any annotation utilizing a specific property must be an instance of a designated class. It encapsulates the relationship between an annotation property and a domain identifier, which can be represented as either a URI reference or an Internationalized Resource Identifier. By inheriting from a base annotation axiom class, it supports the attachment of optional metadata annotations that describe the axiom itself, separating the logical constraint from descriptive information. The logic includes a string representation mechanism that renders the structure in functional syntax, explicitly handling the presence or absence of these metadata annotations to ensure accurate serialization.

Classes

OWLAnnotationPropertyDomain

This class represents an axiom that defines a domain restriction for an annotation property, asserting that the subject of any annotation using this property must be an instance of a specific class. It serves as a formal constraint within an ontology, linking an annotation property to a class identifier represented by a URI or IRI. To utilize this entity, one must provide the annotation property to be constrained and the domain class, along with optional metadata annotations that describe the axiom itself.

Module Contents

UML Class Diagram for OWLAnnotationPropertyDomain

UML Class Diagram for OWLAnnotationPropertyDomain

class OWLAnnotationPropertyDomain(
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_domain.OWLAnnotationPropertyDomain

This class represents an axiom that defines a domain restriction for an annotation property, asserting that the subject of any annotation using this property must be an instance of a specific class. It serves as a formal constraint within an ontology, linking an annotation property to a class identifier represented by a URI or IRI. To utilize this entity, one must provide the annotation property to be constrained and the domain class, along with optional metadata annotations that describe the axiom itself.

Parameters:
  • annotation_property (OWLAnnotationProperty) – The annotation property for which the domain is being specified by this axiom.

  • domain (Union[URIRef, IRI]) – The IRI representing the class of subjects to which the annotation property applies.

__str__() str[source]

Returns a string representation of the annotation property domain axiom, formatted in a functional syntax style. The representation always includes the annotation property and the domain, enclosed within an AnnotationPropertyDomain(…) structure. If the axiom contains annotations, they are listed at the beginning of the argument list; otherwise, an empty list [] is explicitly rendered. This method ensures that the string output accurately reflects the internal state of the axiom, specifically handling the presence or absence of metadata annotations.

Returns:

A string representation of the axiom in the format “AnnotationPropertyDomain([annotations] property domain)”.

Return type:

str

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

Sets the annotation property for this domain axiom. This method updates the internal state of the object by assigning the provided OWLAnnotationProperty instance to the corresponding private attribute, effectively replacing any previously associated value.

Parameters:

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

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

Sets the domain IRI for the OWL annotation property. This method accepts a value that is either a URIRef or an IRI object and updates the internal state of the instance by assigning this value to the _domain attribute. It effectively overwrites any existing domain definition stored in the object.

Parameters:

value (Union[URIRef, IRI]) – The IRI or URI reference to set as the domain.