pyowl2.axioms.class_axiom.sub_class_of

Implements the OWL SubClassOf axiom to model hierarchical relationships between ontology classes by asserting that all instances of a subclass are also instances of a superclass.

Description

The software models a fundamental logical construct from the Web Ontology Language that establishes a taxonomic hierarchy by asserting that every instance of a specific subclass expression must also be an instance of a more general superclass expression. By inheriting from a base class axiom, it integrates into a broader ontology framework, allowing for the attachment of optional annotations such as provenance or confidence scores to the logical statement. The implementation manages the relationship through properties that expose and modify the subclass and superclass expressions, ensuring that the internal state reflects the defined logical constraints. A string representation method generates a functional syntax output, which aids in debugging and serialization by clearly displaying the axiom type, associated annotations, and the linked class expressions.

Classes

OWLSubClassOf

Represents a fundamental axiom in the Web Ontology Language that defines a hierarchical relationship between two class expressions, asserting that all instances of the subclass are necessarily instances of the superclass. This construct allows for the creation of taxonomies and logical constraints by linking either simple named classes or complex, anonymous class expressions. To use this entity, instantiate it with the specific subclass and superclass expressions, optionally providing a list of annotations to attach metadata such as provenance or confidence levels to the logical statement.

Module Contents

UML Class Diagram for OWLSubClassOf

UML Class Diagram for OWLSubClassOf

class OWLSubClassOf(
sub_class: pyowl2.abstracts.class_expression.OWLClassExpression,
super_class: 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.sub_class_of.OWLSubClassOf

Represents a fundamental axiom in the Web Ontology Language that defines a hierarchical relationship between two class expressions, asserting that all instances of the subclass are necessarily instances of the superclass. This construct allows for the creation of taxonomies and logical constraints by linking either simple named classes or complex, anonymous class expressions. To use this entity, instantiate it with the specific subclass and superclass expressions, optionally providing a list of annotations to attach metadata such as provenance or confidence levels to the logical statement.

Parameters:
  • sub_class_expression (OWLClassExpression) – The class expression that is declared to be a subclass of the superclass expression.

  • super_class_expression (OWLClassExpression) – The superclass expression in the axiom, representing the more general concept that the subclass is a subset of.

__str__() str[source]

Returns a string representation of the SubClassOf axiom, formatted according to a functional syntax style. The output string includes the axiom annotations, the sub-class expression, and the super-class expression. If the axiom contains annotations, they are included in the string; otherwise, an empty list is explicitly rendered to ensure the structure remains consistent. This method has no side effects and is primarily used for debugging or logging purposes.

Returns:

A string representation of the SubClassOf axiom, formatted as ‘SubClassOf([annotations] sub_class_expression super_class_expression)’.

Return type:

str

_sub_class_expression: pyowl2.abstracts.class_expression.OWLClassExpression
_super_class_expression: pyowl2.abstracts.class_expression.OWLClassExpression
property sub_class_expression: pyowl2.abstracts.class_expression.OWLClassExpression

Updates the subclass expression component of the OWL SubClassOf axiom by assigning the provided OWLClassExpression to the internal attribute. This method modifies the object’s state in place, overwriting any previously stored subclass expression with the new value.

Parameters:

value (OWLClassExpression) – The OWL class expression to be set as the subclass.

property super_class_expression: pyowl2.abstracts.class_expression.OWLClassExpression

Sets the superclass expression for this OWLSubClassOf axiom to the provided value. This method updates the internal state of the object, replacing the existing superclass definition with the new OWLClassExpression. As a property setter, it directly modifies the axiom’s structure to reflect that the subclass is a sub-class of the specified expression.

Parameters:

value (OWLClassExpression) – The expression representing the superclass to be set.