pyowl2.axioms.assertion.data_property_assertion

Defines a class representing an OWL axiom that asserts a specific data property value for an individual.

Description

The class models a fundamental statement within an ontology where a subject individual is associated with a concrete data value, such as a string or number, through a defined data property expression. References to the property expression, the source individual, and the target literal are stored to ensure the relationship is fully encapsulated within a single object. By extending a base assertion class, the structure supports the attachment of optional annotations, enabling the inclusion of metadata or contextual information alongside the core logical statement. A string representation method generates a functional syntax format of the assertion, which facilitates serialization and debugging by clearly displaying the components and any associated annotations.

Classes

OWLDataPropertyAssertion

This class represents a fundamental axiom used to define facts about an individual within an OWL ontology by associating it with a specific data value via a data property. It serves as a structured container linking a subject individual to a target literal—such as a number or string—through a specific property expression, enabling the representation of statements like "Alice hasAge 30". To utilize this component, one must provide the data property expression, the source individual, and the target literal during instantiation, with the option to attach annotations for further context or metadata.

Module Contents

UML Class Diagram for OWLDataPropertyAssertion

UML Class Diagram for OWLDataPropertyAssertion

class OWLDataPropertyAssertion(
expression: pyowl2.abstracts.data_property_expression.OWLDataPropertyExpression,
source: pyowl2.abstracts.individual.OWLIndividual,
value: pyowl2.literal.literal.OWLLiteral,
annotations: list[pyowl2.base.annotation.OWLAnnotation] | None = None,
)[source]

Bases: pyowl2.abstracts.assertion.OWLAssertion

Inheritance diagram of pyowl2.axioms.assertion.data_property_assertion.OWLDataPropertyAssertion

This class represents a fundamental axiom used to define facts about an individual within an OWL ontology by associating it with a specific data value via a data property. It serves as a structured container linking a subject individual to a target literal—such as a number or string—through a specific property expression, enabling the representation of statements like “Alice hasAge 30”. To utilize this component, one must provide the data property expression, the source individual, and the target literal during instantiation, with the option to attach annotations for further context or metadata.

Parameters:
  • data_property_expression (OWLDataPropertyExpression) – The data property expression that relates the source individual to the target value.

  • source_individual (OWLIndividual) – The individual that is the subject of the assertion, possessing the specific data value for the data property.

  • target_value (OWLLiteral) – The data value to which the relationship points, such as “30” in the assertion “Alice hasAge 30”.

__str__() str[source]

Returns a human-readable string representation of the data property assertion axiom, formatted according to a functional syntax style. The representation includes the axiom’s annotations, data property expression, source individual, and target value, enclosed within parentheses. If the axiom has no associated annotations, an empty list is displayed in their place to preserve the structural format. This method does not modify the object’s state.

Returns:

A string representation of the data property assertion in functional syntax format.

Return type:

str

_data_property_expression: pyowl2.abstracts.data_property_expression.OWLDataPropertyExpression
_source_individual: pyowl2.abstracts.individual.OWLIndividual
_target_value: pyowl2.literal.literal.OWLLiteral
property data_property_expression: pyowl2.abstracts.data_property_expression.OWLDataPropertyExpression

Updates the specific data property expression used in this assertion by assigning the provided value to the internal state. This setter replaces the existing _data_property_expression attribute with the new OWLDataPropertyExpression instance. The method expects the input to be a valid data property expression object, ensuring the assertion maintains a valid OWL structure.

Parameters:

value (OWLDataPropertyExpression) – The OWL data property expression to assign to the object.

property source_individual: pyowl2.abstracts.individual.OWLIndividual

Assigns the provided individual as the source (or subject) of this data property assertion. This operation directly updates the internal state of the assertion, overwriting any existing source individual. The method expects an instance of OWLIndividual, though no runtime validation is explicitly performed to ensure the type matches the hint.

Parameters:

value (OWLIndividual) – The OWL individual to set as the source individual.

property target_value: pyowl2.literal.literal.OWLLiteral

Updates the literal value associated with this data property assertion by assigning the provided OWLLiteral instance to the internal _target_value attribute. This setter overwrites any previously stored value, effectively modifying the assertion to reference the new data value.

Parameters:

value (OWLLiteral) – The literal to assign as the target value.