pyowl2.axioms.annotations.annotation_assertion
Defines a class representing an OWL annotation assertion axiom that links a specific subject to a property and a value to attach metadata within an ontology.
Description
The implementation models the semantic structure of an annotation assertion by creating a triple that connects a subject entity to a specific property and a corresponding value. By inheriting from a base axiom class, it manages the storage of annotations that apply to the assertion itself, separate from the assertion’s content, allowing for provenance tracking or contextual metadata. Internal state is managed through properties that expose the subject, property, and value, enabling modification of these core components while maintaining the integrity of the assertion structure. A string representation method generates a functional syntax output, which facilitates debugging and serialization by displaying the assertion’s components and any associated annotations in a standardized format.
Classes
This class represents an axiom used to attach metadata to entities within an OWL ontology by asserting that a specific annotation property holds a particular value for a given subject. It functions as a triple connecting a subject—which can be an IRI, anonymous individual, or literal—to a property and a corresponding value, effectively labeling or describing the subject. Users can instantiate this object to define relationships such as labels, comments, or custom metadata, and optionally include a list of annotations on the axiom itself to capture provenance or other contextual information. |
Module Contents
UML Class Diagram for OWLAnnotationAssertion
- class OWLAnnotationAssertion(
- subject: pyowl2.abstracts.annotation_subject.OWLAnnotationSubject,
- property: pyowl2.base.annotation_property.OWLAnnotationProperty,
- value: pyowl2.abstracts.annotation_value.OWLAnnotationValue,
- annotations: list[pyowl2.base.annotation.OWLAnnotation] | None = None,
Bases:
pyowl2.abstracts.annotation_axiom.OWLAnnotationAxiom
This class represents an axiom used to attach metadata to entities within an OWL ontology by asserting that a specific annotation property holds a particular value for a given subject. It functions as a triple connecting a subject—which can be an IRI, anonymous individual, or literal—to a property and a corresponding value, effectively labeling or describing the subject. Users can instantiate this object to define relationships such as labels, comments, or custom metadata, and optionally include a list of annotations on the axiom itself to capture provenance or other contextual information.
- Parameters:
annotation_property (OWLAnnotationProperty) – The annotation property being asserted to have a specific value for the subject.
annotation_subject (OWLAnnotationSubject) – The entity being annotated, which can be an IRI, an anonymous individual, or a literal.
annotation_value (OWLAnnotationValue) – The specific value being asserted for the annotation property and subject, which can be an IRI, an anonymous individual, or a literal.
- __str__() str[source]
Returns a string representation of the annotation assertion formatted in a functional-style syntax. The output string includes the list of annotations associated with the axiom itself, followed by the annotation property, the subject, and the value. If the axiom has no associated annotations, the representation explicitly displays an empty list in the corresponding position.
- Returns:
A string representation of the annotation assertion, formatted as “AnnotationAssertion(annotations property subject value)”.
- Return type:
str
- _annotation_property: pyowl2.base.annotation_property.OWLAnnotationProperty
- _annotation_subject: pyowl2.abstracts.annotation_subject.OWLAnnotationSubject
- _annotation_value: pyowl2.abstracts.annotation_value.OWLAnnotationValue
- property annotation_property: pyowl2.base.annotation_property.OWLAnnotationProperty
Assigns the specified OWLAnnotationProperty to this assertion, replacing any existing value. This method directly modifies the internal state of the object to reflect the new annotation property. While the type hint indicates an OWLAnnotationProperty is expected, the implementation performs no runtime validation, so passing incompatible types may lead to errors elsewhere in the module.
- Parameters:
value (OWLAnnotationProperty) – The OWL annotation property to assign to the object.
- property annotation_subject: pyowl2.abstracts.annotation_subject.OWLAnnotationSubject
Updates the subject of the annotation assertion to the specified value, replacing any previously assigned subject. The provided value must be an instance of OWLAnnotationSubject, representing the entity (such as an IRI or anonymous individual) to which the annotation is attached. This method directly mutates the internal state of the object.
- Parameters:
value (OWLAnnotationSubject) – The IRI or anonymous individual that serves as the subject of the annotation.
- property annotation_value: pyowl2.abstracts.annotation_value.OWLAnnotationValue
Updates the value associated with this annotation assertion. It replaces the currently stored annotation value with the specified OWLAnnotationValue, effectively mutating the object’s state.
- Parameters:
value (OWLAnnotationValue) – The annotation value to assign.