Source code for pyowl2.abstracts.object

import abc


[docs] class OWLObject(abc.ABC, metaclass=abc.ABCMeta): """ This abstract base class serves as the foundational root for all entities within an OWL (Web Ontology Language) representation. It is intended to be subclassed by specific constructs such as classes, properties, and individuals, rather than instantiated directly. By establishing a common type, it enables polymorphic handling of various ontology elements throughout the module. """ __slots__ = () def __init__(self): """Constructs a new instance representing a generic entity within the Web Ontology Language (OWL) structure. As the base constructor, this method currently performs no specific initialization logic beyond standard object instantiation and accepts no additional arguments. It is designed to be inherited by subclasses representing specific OWL components, such as classes, properties, or individuals, which may override this method to define their own initialization requirements.""" pass
[docs] def __eq__(self, value: object) -> bool: """Determines equality by comparing string representations. Two OWL objects are considered equal if their string representations match.""" return str(self) == str(value)
[docs] def __ne__(self, value: object) -> bool: """Determines inequality by comparing string representations.""" return str(self) != str(value)
[docs] def __lt__(self, value: object) -> bool: """Determines less-than ordering by comparing string representations lexicographically.""" return str(self) < str(value)
[docs] def __le__(self, value: object) -> bool: """Determines less-than-or-equal ordering by comparing string representations lexicographically.""" return str(self) <= str(value)
[docs] def __gt__(self, value: object) -> bool: """Determines greater-than ordering by comparing string representations lexicographically.""" return str(self) > str(value)
[docs] def __ge__(self, value: object) -> bool: """Determines greater-than-or-equal ordering by comparing string representations lexicographically.""" return str(self) >= str(value)
[docs] def __hash__(self) -> int: """Computes a hash code from the string representation, enabling use in hash-based collections.""" return hash(str(self))
[docs] def __repr__(self) -> str: """Returns the string representation, used for debugging and inspection.""" return str(self)