pyowl2.expressions.inverse_object_property

Defines a class representing the inverse of an OWL object property to model reciprocal relationships between individuals.

Description

The implementation provides a mechanism to express the inverse of a specific object property within an ontology, effectively reversing the direction of the relationship between two individuals. By wrapping an existing property, the logic allows systems to infer reciprocal connections, such as deriving a parent relationship from a child relationship, without requiring explicit assertions for both directions. The design includes methods to verify whether the underlying property corresponds to the universal top or bottom properties, ensuring consistency with OWL semantics. Additionally, the structure supports standard functional syntax output, enabling clear serialization and debugging of the logical constructs.

Classes

OWLInverseObjectProperty

This class represents an expression that defines the inverse of a specific object property, effectively reversing the direction of the relationship between two individuals. It is constructed by wrapping an existing OWLObjectProperty, allowing the ontology to infer that if the original property relates individual A to individual B, this expression relates B to A. This mechanism is essential for modeling reciprocal relationships—such as deriving "isParentOf" from "hasChild"—thereby enhancing the expressiveness and reasoning capabilities of the ontology without requiring explicit assertions for both directions.

Module Contents

UML Class Diagram for OWLInverseObjectProperty

UML Class Diagram for OWLInverseObjectProperty

class OWLInverseObjectProperty(property: pyowl2.expressions.object_property.OWLObjectProperty)[source]

Bases: pyowl2.abstracts.object_property_expression.OWLObjectPropertyExpression

Inheritance diagram of pyowl2.expressions.inverse_object_property.OWLInverseObjectProperty

This class represents an expression that defines the inverse of a specific object property, effectively reversing the direction of the relationship between two individuals. It is constructed by wrapping an existing OWLObjectProperty, allowing the ontology to infer that if the original property relates individual A to individual B, this expression relates B to A. This mechanism is essential for modeling reciprocal relationships—such as deriving “isParentOf” from “hasChild”—thereby enhancing the expressiveness and reasoning capabilities of the ontology without requiring explicit assertions for both directions.

Parameters:

object_property (OWLObjectProperty) – The object property that is being inverted to represent the relationship in the opposite direction.

__str__() str[source]

Returns a string representation of the inverse object property formatted according to functional syntax conventions. The output explicitly wraps the underlying object property within the “ObjectInverseOf” constructor, providing a human-readable depiction of the logical structure. This method does not alter the state of the object and relies on the string conversion of the internal object property attribute.

Returns:

A string representation of the object, formatted as ‘ObjectInverseOf({object_property})’.

Return type:

str

is_bottom_object_property() bool[source]

Checks if the underlying object property is the top object property. The method returns True if the object_property attribute of the current instance is equal to the universal top object property, and False otherwise. This operation does not modify the state of the object or have any side effects.

Returns:

True if the object property is the top object property, False otherwise.

Return type:

bool

is_top_object_property() bool[source]

Determines whether the underlying object property is the bottom object property. This method compares the internal object property reference against the standard bottom property defined in the OWL ontology. It returns True if the properties are identical, indicating that this inverse property represents the bottom property.

Returns:

True if the object property is the bottom object property, False otherwise.

Return type:

bool

_object_property: pyowl2.expressions.object_property.OWLObjectProperty
property object_property: pyowl2.expressions.object_property.OWLObjectProperty

Updates the internal state of the OWLInverseObjectProperty instance by assigning a new object property. This setter accepts an instance of OWLObjectProperty and stores it in the private _object_property attribute, effectively defining or modifying the property involved in the inverse relationship. The method modifies the instance in place and returns None.

Parameters:

value (OWLObjectProperty) – The OWL object property to set.