pyowl2.axioms.class_axiom.disjoint_classes

Implements the OWL DisjointClasses axiom to enforce mutual exclusion among a set of class expressions within an ontology.

Description

The software models the semantic constraint that no individual can simultaneously belong to more than one class in a specified collection, a fundamental concept in ontology engineering known as the DisjointClasses axiom. By inheriting from a base class axiom, it integrates seamlessly into the broader ontology structure while enforcing strict validation rules, such as requiring a minimum of two class expressions to define a meaningful disjointness relationship. Internally, the implementation automatically sorts the provided class expressions to maintain a deterministic order, which aids in comparison and serialization processes. Optional metadata can be attached to the axiom through annotations, and the logic includes a string representation method that outputs the structure in standard OWL functional syntax.

Classes

OWLDisjointClasses

This axiom defines a mutual exclusion relationship between two or more class expressions within an ontology, asserting that no individual can be an instance of more than one of the specified classes simultaneously. To utilize this entity, instantiate it with a list of OWLClassExpression objects, ensuring the list contains at least two elements; the implementation automatically sorts these expressions to maintain a consistent internal order. Optional annotations can be attached to provide metadata about the axiom itself, such as provenance or confidence scores.

Module Contents

UML Class Diagram for OWLDisjointClasses

UML Class Diagram for OWLDisjointClasses

class OWLDisjointClasses(
expressions: list[pyowl2.abstracts.class_expression.OWLClassExpression],
annotations: list[pyowl2.base.annotation.OWLAnnotation] | None = None,
)[source]

Bases: pyowl2.abstracts.class_axiom.OWLClassAxiom

Inheritance diagram of pyowl2.axioms.class_axiom.disjoint_classes.OWLDisjointClasses

This axiom defines a mutual exclusion relationship between two or more class expressions within an ontology, asserting that no individual can be an instance of more than one of the specified classes simultaneously. To utilize this entity, instantiate it with a list of OWLClassExpression objects, ensuring the list contains at least two elements; the implementation automatically sorts these expressions to maintain a consistent internal order. Optional annotations can be attached to provide metadata about the axiom itself, such as provenance or confidence scores.

Parameters:

class_expressions (list[OWLClassExpression]) – The sorted list of class expressions involved in the disjointness axiom.

__str__() str[source]

Returns a string representation of the disjoint classes axiom formatted in a functional syntax style. The output begins with the keyword ‘DisjointClasses’ followed by the list of axiom annotations; if no annotations are present, an empty list is explicitly included. The string concludes with the space-separated string representations of all class expressions involved in the disjointness relationship.

Returns:

A string representation of the DisjointClasses axiom in functional syntax, including the axiom annotations and the list of class expressions.

Return type:

str

_class_expressions: list[pyowl2.abstracts.class_expression.OWLClassExpression]
property class_expressions: list[pyowl2.abstracts.class_expression.OWLClassExpression]

Replaces the current collection of class expressions with the provided list of OWLClassExpression objects. This setter normalizes the input by sorting the elements before storing them in the private attribute, ensuring a deterministic internal order regardless of the input sequence. The operation modifies the object in place and returns None.

Parameters:

value (list[OWLClassExpression]) – A list of OWL class expressions to assign. The list will be sorted before being stored.