pyowl2.abstracts.annotation_subject
Defines an abstract base class for Web Ontology Language annotation subjects where equality and ordering are determined by string representation.
Description
Acts as a polymorphic abstraction for entities within the Web Ontology Language framework that can be the target of an annotation, such as Internationalized Resource Identifiers or anonymous individuals. The implementation enforces a specific comparison strategy where equality and ordering are determined exclusively by the string representation of the subject’s underlying value rather than object identity or type. By delegating all rich comparison methods and hashing operations to this string conversion, the design ensures that instances can be consistently sorted, compared, and used within hash-based collections like sets and dictionaries. Subclasses are expected to define a specific value attribute, which acts as the source of truth for generating the textual representation used throughout these operations.
Classes
Represents the entity to which an annotation is applied within the Web Ontology Language (OWL) framework, acting as a polymorphic abstraction for Internationalized Resource Identifiers (IRIs), anonymous individuals, and literals. This abstract base class enforces a comparison strategy where equality and ordering are determined solely by the string representation of the subject's underlying value, rather than by object identity or type. It is designed to be subclassed by specific entity types that define the value attribute, ensuring consistent string conversion and hashing behavior across different annotation targets. |
Module Contents
UML Class Diagram for OWLAnnotationSubject
- class OWLAnnotationSubject[source]
Bases:
pyowl2.abstracts.object.OWLObject,abc.ABC
Represents the entity to which an annotation is applied within the Web Ontology Language (OWL) framework, acting as a polymorphic abstraction for Internationalized Resource Identifiers (IRIs), anonymous individuals, and literals. This abstract base class enforces a comparison strategy where equality and ordering are determined solely by the string representation of the subject’s underlying value, rather than by object identity or type. It is designed to be subclassed by specific entity types that define the value attribute, ensuring consistent string conversion and hashing behavior across different annotation targets.
- __str__() str[source]
Returns a human-readable string representation of the annotation subject by delegating to the string conversion of the underlying value attribute. This method is invoked implicitly by the str() built-in function and during string formatting operations, providing a direct textual representation of the entity being annotated. The behavior depends entirely on the type of the wrapped value, and no side effects occur during the conversion process.
- Returns:
The string representation of the object’s value.
- Return type:
str
- __slots__ = ()