pyowl2.axioms.class_axiom.disjoint_union

Defines a semantic structure representing an OWL Disjoint Union axiom, where a specific class is equivalent to the union of mutually disjoint class expressions.

Description

The software models the Web Ontology Language (OWL) Disjoint Union axiom, which asserts that a designated named class is equivalent to the logical union of a collection of class expressions that are pairwise disjoint. To ensure consistency and canonical representation, the implementation automatically sorts the provided list of disjoint class expressions upon initialization and modification, regardless of the input order. Validation logic enforces that at least two class expressions are supplied to form a valid partition, preventing semantic errors where a disjoint union cannot be formed. Optional annotations can be associated with the axiom to provide metadata, and the structure includes a string representation method that outputs the axiom in standard functional syntax for debugging or serialization purposes.

Classes

OWLDisjointUnion

This class represents a semantic axiom within an ontology that defines a specific class as the union of a set of mutually disjoint class expressions. It asserts that the designated union class is equivalent to the logical disjunction of the provided expressions, while simultaneously enforcing that those expressions share no common instances. Users must provide a primary class and a list of at least two class expressions to define the partition; the implementation automatically sorts these expressions to maintain a canonical internal state. Additionally, optional annotations can be attached to the axiom to provide context or metadata.

Module Contents

UML Class Diagram for OWLDisjointUnion

UML Class Diagram for OWLDisjointUnion

class OWLDisjointUnion(
expression: pyowl2.base.owl_class.OWLClass,
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_union.OWLDisjointUnion

This class represents a semantic axiom within an ontology that defines a specific class as the union of a set of mutually disjoint class expressions. It asserts that the designated union class is equivalent to the logical disjunction of the provided expressions, while simultaneously enforcing that those expressions share no common instances. Users must provide a primary class and a list of at least two class expressions to define the partition; the implementation automatically sorts these expressions to maintain a canonical internal state. Additionally, optional annotations can be attached to the axiom to provide context or metadata.

Parameters:
  • union_class (OWLClass) – The named class declared to be equivalent to the union of the disjoint class expressions.

  • disjoint_class_expressions (list[OWLClassExpression]) – The list of class expressions that are declared to be disjoint, maintained in sorted order.

__str__() str[source]

Generates a human-readable string representation of the disjoint union axiom in a functional syntax format. The output string includes the axiom annotations, defaulting to an empty list ‘[]’ if none are present, followed by the union class and the space-separated list of disjoint class expressions. This ensures a consistent textual format regardless of whether the axiom contains annotations.

Returns:

A string representation of the disjoint union in functional syntax, including annotations, the union class, and the disjoint class expressions.

Return type:

str

_disjoint_class_expressions: list[pyowl2.abstracts.class_expression.OWLClassExpression]
_union_class: pyowl2.base.owl_class.OWLClass
property disjoint_class_expressions: list[pyowl2.abstracts.class_expression.OWLClassExpression]

Assigns a new list of class expressions to the disjoint union definition. The input list is sorted internally before storage to ensure a canonical ordering, regardless of the sequence provided. This operation overwrites the existing set of expressions stored in the object.

Parameters:

value (list[OWLClassExpression]) – The OWL class expressions to set as disjoint.

property union_class: pyowl2.base.owl_class.OWLClass

Assigns the specified OWLClass instance to the internal attribute representing the class defined by the disjoint union axiom. This method serves as the setter for the union_class property, effectively updating the subject of the axiom. It modifies the object’s state in place, replacing any existing value without performing validation on the input type.

Parameters:

value (OWLClass) – The OWL class to assign as the union class.