pyowl2.axioms.declaration
Defines a class representing an OWL declaration axiom that formally introduces named entities into an ontology.
Description
The implementation centers on the OWLDeclaration class, which extends the base OWLAxiom to provide the structural representation required for asserting the existence of vocabulary terms like classes, properties, or individuals. By storing a reference to a specific OWLEntity, the class ensures that the subject of the declaration is explicitly defined and accessible within the broader ontology structure. The design supports the attachment of optional metadata through a list of OWLAnnotation objects, which are managed by the parent class to allow for rich contextual information without cluttering the core declaration logic. Furthermore, the logic includes a custom string representation method to facilitate debugging and human-readable output, displaying the associated annotations and the declared entity in a standardized format.
Classes
This axiom serves as the formal mechanism for introducing a named entity—such as a class, property, or individual—into the ontology's vocabulary. By asserting the existence of an entity, this declaration enables it to be referenced and utilized within other axioms and logical expressions throughout the ontology. To use this class, instantiate it with the specific OWLEntity to be declared, optionally providing a list of annotations to attach metadata or contextual information to the declaration itself. |
Module Contents
UML Class Diagram for OWLDeclaration
- class OWLDeclaration(
- entity: pyowl2.abstracts.entity.OWLEntity,
- annotations: list[pyowl2.base.annotation.OWLAnnotation] | None = None,
Bases:
pyowl2.abstracts.axiom.OWLAxiom
This axiom serves as the formal mechanism for introducing a named entity—such as a class, property, or individual—into the ontology’s vocabulary. By asserting the existence of an entity, this declaration enables it to be referenced and utilized within other axioms and logical expressions throughout the ontology. To use this class, instantiate it with the specific OWLEntity to be declared, optionally providing a list of annotations to attach metadata or contextual information to the declaration itself.
- Parameters:
entity (OWLEntity) – The OWL entity (class, property, or individual) that is being declared and introduced into the ontology.
- __str__() str[source]
Returns a string representation of the OWL declaration axiom, formatted to display the annotations and the declared entity. If the axiom contains annotations, they are included within the parentheses; otherwise, an empty list representation is used. This method does not modify the object’s state and is intended for generating human-readable output or debugging information.
- Returns:
Returns a string representation of the declaration, including the axiom annotations and the entity.
- Return type:
str
- _entity: pyowl2.abstracts.entity.OWLEntity
- property entity: pyowl2.abstracts.entity.OWLEntity
Assigns the specified OWL entity to this declaration, replacing the existing entity reference. This method updates the internal state of the declaration to point to the provided entity object, effectively changing the subject of the axiom.
- Parameters:
value (OWLEntity) – The ontology object to assign.