pyowl2.axioms.class_axiom.equivalent_classes
Defines a logical axiom asserting that two or more OWL class expressions share the exact same set of instances.
Description
The implementation models the semantic identity between distinct concepts, enabling reasoners to infer that any individual belonging to one class must also belong to all others declared equivalent. To ensure consistency and logical validity, the construction process mandates that a minimum of two class expressions are provided, preventing the creation of trivial or incomplete equivalences. A key design choice involves the automatic sorting of these expressions upon initialization and modification, which guarantees a canonical representation where the order of input does not affect the identity of the axiom. Optional metadata can be attached via annotations, and the structure supports a functional-style string representation that explicitly renders the annotation state alongside the equivalent class expressions.
Classes
This axiom defines a logical equivalence between two or more class expressions, asserting that they share the exact same set of instances within an ontology. It is utilized to model scenarios where distinct concepts are semantically identical, allowing reasoners to infer that any individual belonging to one class must also belong to all others declared equivalent. To construct this object, a user must provide a list containing at least two OWLClassExpression instances, along with an optional list of annotations for metadata. The implementation automatically sorts the provided expressions to maintain a canonical representation, ensuring that the order of input does not affect the identity of the axiom. |
Module Contents
UML Class Diagram for OWLEquivalentClasses
- class OWLEquivalentClasses(
- expressions: list[pyowl2.abstracts.class_expression.OWLClassExpression],
- annotations: list[pyowl2.base.annotation.OWLAnnotation] | None = None,
Bases:
pyowl2.abstracts.class_axiom.OWLClassAxiom
This axiom defines a logical equivalence between two or more class expressions, asserting that they share the exact same set of instances within an ontology. It is utilized to model scenarios where distinct concepts are semantically identical, allowing reasoners to infer that any individual belonging to one class must also belong to all others declared equivalent. To construct this object, a user must provide a list containing at least two OWLClassExpression instances, along with an optional list of annotations for metadata. The implementation automatically sorts the provided expressions to maintain a canonical representation, ensuring that the order of input does not affect the identity of the axiom.
- Parameters:
class_expressions (list[OWLClassExpression]) – A sorted list of class expressions declared to be equivalent, containing at least two elements.
- __str__() str[source]
Returns a string representation of the OWL equivalent classes axiom using a functional-style syntax. The output string begins with ‘EquivalentClasses’ and includes the axiom annotations; if no annotations are present, an empty list ‘[]’ is explicitly rendered. The class expressions defining the equivalence are converted to strings and concatenated with spaces to complete the representation.
- Returns:
A string representation of the equivalent classes axiom, including its annotations and class expressions.
- Return type:
str
- _class_expressions: list[pyowl2.abstracts.class_expression.OWLClassExpression]
- property class_expressions: list[pyowl2.abstracts.class_expression.OWLClassExpression]
Sets the list of class expressions that are declared equivalent within this axiom. The provided list of OWLClassExpression objects is sorted prior to storage to maintain a consistent internal order. This method replaces any existing class expressions currently held by the object.
- Parameters:
value (list[OWLClassExpression]) – The OWL class expressions to assign. The list will be sorted before being stored.