pyowl2.axioms.assertion.class_assertion

Defines a Python class representing an OWL Class Assertion axiom that links a specific individual to a class expression within an ontology.

Description

The software models a specific type of axiom found in the Web Ontology Language (OWL) used to declare that a named entity is an instance of a particular class or complex class expression. By inheriting from a base assertion class, it provides a structured way to encapsulate the relationship between an individual and a class expression, allowing for the attachment of optional metadata annotations to enrich the semantic data. Internal state management is handled through properties that permit the modification of both the class expression and the individual after the object has been created, ensuring flexibility in ontology construction. A string representation method generates a functional syntax output that clearly displays the assertion type, any associated annotations, the class expression, and the individual, facilitating debugging and serialization.

Classes

OWLClassAssertion

This class represents a fundamental axiom in the Web Ontology Language (OWL) used to declare that a specific individual is an instance of a given class expression. It serves to classify entities within an ontology by linking an OWLIndividual to an OWLClassExpression, effectively stating that the individual belongs to the defined type. Users can instantiate this object to define type relationships, optionally providing a list of annotations to attach metadata to the assertion itself. The component allows for the modification of both the class expression and the individual after instantiation through its properties, and it integrates into the broader ontology structure by inheriting from OWLAssertion.

Module Contents

UML Class Diagram for OWLClassAssertion

UML Class Diagram for OWLClassAssertion

class OWLClassAssertion(
expression: pyowl2.abstracts.class_expression.OWLClassExpression,
individual: pyowl2.abstracts.individual.OWLIndividual,
annotations: list[pyowl2.base.annotation.OWLAnnotation] | None = None,
)[source]

Bases: pyowl2.abstracts.assertion.OWLAssertion

Inheritance diagram of pyowl2.axioms.assertion.class_assertion.OWLClassAssertion

This class represents a fundamental axiom in the Web Ontology Language (OWL) used to declare that a specific individual is an instance of a given class expression. It serves to classify entities within an ontology by linking an OWLIndividual to an OWLClassExpression, effectively stating that the individual belongs to the defined type. Users can instantiate this object to define type relationships, optionally providing a list of annotations to attach metadata to the assertion itself. The component allows for the modification of both the class expression and the individual after instantiation through its properties, and it integrates into the broader ontology structure by inheriting from OWLAssertion.

Parameters:
  • class_expression (OWLClassExpression) – The class expression that the individual is asserted to be an instance of.

  • individual (OWLIndividual) – The specific entity that is asserted to be an instance of the class expression.

__str__() str[source]

Returns a string representation of the class assertion axiom using a functional syntax format. The string includes the axiom annotations, the class expression, and the individual. If the object has no annotations, the representation explicitly includes an empty list placeholder to preserve the structural format.

Returns:

A string representation of the class assertion, formatted as “ClassAssertion([annotations] class_expression individual)”.

Return type:

str

_class_expression: pyowl2.abstracts.class_expression.OWLClassExpression
_individual: pyowl2.abstracts.individual.OWLIndividual
property class_expression: pyowl2.abstracts.class_expression.OWLClassExpression

Updates the class expression associated with this OWL class assertion by assigning the provided value. This operation overwrites the existing class expression stored internally, effectively changing the type or classification being asserted. The method expects an instance of OWLClassExpression as input to ensure the structural integrity of the axiom.

Parameters:

value (OWLClassExpression) – The class expression to assign to this object.

property individual: pyowl2.abstracts.individual.OWLIndividual

Assigns the specified individual to this class assertion axiom, replacing any previously associated individual. This method updates the internal state of the object to reflect that the provided OWLIndividual is the subject of the assertion. It acts as a direct mutator and does not return a value.

Parameters:

value (OWLIndividual) – The OWL individual instance to assign.