pyowl2.utils.object_property
Provides a comprehensive interface for defining and manipulating OWL object properties, including their logical characteristics, domain and range constraints, and associated axioms.
Description
A high-level abstraction wraps a core property entity identified by an Internationalized Resource Identifier (IRI), aggregating its definition and logical rules into a single manageable object. It maintains an internal collection of axioms, enabling users to dynamically configure property characteristics such as symmetry, transitivity, and functionality through boolean flags that automatically update the underlying ontology structure. The design supports the creation of complex hierarchical relationships, such as sub-property and inverse property definitions, alongside class expression restrictions involving cardinality and value constraints. Furthermore, the software allows for the assertion of specific relationships between individuals, serving as a central hub for constructing and managing the complete logical profile of a relationship type.
Classes
This class provides a structured abstraction for an object property in an OWL ontology, aggregating its definition, logical characteristics, and associated metadata. It encapsulates a core property entity identified by an IRI, allowing users to specify and modify its domain and range constraints. Beyond basic definition, it facilitates the management of property axioms, including characteristics like symmetry, transitivity, and functionality, as well as complex restrictions such as cardinality and value constraints. The class also supports the assertion of relationships between specific individuals and the definition of hierarchical or equivalent relationships with other properties, serving as a central hub for constructing and manipulating the logical rules governing a specific relationship type. |
Module Contents
UML Class Diagram for OWLFullObjectProperty
- class OWLFullObjectProperty(
- iri: pyowl2.base.iri.IRI,
- domain: pyowl2.abstracts.class_expression.OWLClassExpression | None = None,
- range: pyowl2.abstracts.class_expression.OWLClassExpression | None = None,
- is_symmetric: bool = False,
- is_asymmetric: bool = False,
- is_functional: bool = False,
- is_inverse_functional: bool = False,
- is_transitive: bool = False,
- is_reflexive: bool = False,
- is_irreflexive: bool = False,
Bases:
pyowl2.abstracts.object.OWLObject
This class provides a structured abstraction for an object property in an OWL ontology, aggregating its definition, logical characteristics, and associated metadata. It encapsulates a core property entity identified by an IRI, allowing users to specify and modify its domain and range constraints. Beyond basic definition, it facilitates the management of property axioms, including characteristics like symmetry, transitivity, and functionality, as well as complex restrictions such as cardinality and value constraints. The class also supports the assertion of relationships between specific individuals and the definition of hierarchical or equivalent relationships with other properties, serving as a central hub for constructing and manipulating the logical rules governing a specific relationship type.
- Parameters:
PROPERTY_CLASSES (list[type]) – A collection of axiom types that define the specific characteristics of an object property, such as symmetry, transitivity, and functionality. This list is used to filter and identify axioms that describe the property’s behavior.
object_property (OWLObjectProperty) – The underlying OWLObjectProperty instance representing the fundamental relationship entity in the ontology, serving as the central reference for all associated axioms and characteristics.
domain (OWLObjectPropertyDomain) – Internal representation of the domain axiom, defining the class of individuals that can be the subject of this object property.
range (OWLObjectPropertyRange) – Internal storage for the range axiom, defining the class or classes of individuals that can be the object of this property.
axioms (list[OWLAxiom]) – A list of axioms defining the object property’s logical characteristics, relationships, restrictions, and assertions.
annotations (Optional[list[OWLAnnotation]]) – Stores an optional list of annotations that provide metadata, such as comments or labels, for the object property. These annotations serve to document the property without influencing its logical semantics.
- _del_property(curr_value: bool, value: bool, cls: type) None[source]
Manages the presence of a specific axiom type within the object’s axioms list based on a state transition. By comparing the current boolean value with the desired value, the method either adds or removes an instance of the specified class. If the property is being enabled, it creates a new axiom using the object property and adds it to the list, avoiding duplicates; if the property is being disabled, it locates and removes the corresponding axiom. No modifications are made if the current and desired states are identical.
- Parameters:
curr_value (bool) – Indicates whether the property is currently active or set to True.
value (bool) – The desired state of the property, determining whether the corresponding axiom should be added or removed.
- add_assertion(
- individual_1: pyowl2.abstracts.individual.OWLIndividual,
- individual_2: pyowl2.abstracts.individual.OWLIndividual,
- annotations: list[pyowl2.base.annotation.OWLAnnotation] | None = None,
Adds an object property assertion to the axioms of this property, establishing a directed relationship between two specified individuals. This method constructs an assertion linking the first individual to the second via the current object property, optionally associating a list of annotations to provide additional metadata. The operation is idempotent; it checks the existing axioms to prevent duplication, ensuring that the assertion is only appended if an identical entry is not already present.
- Parameters:
individual_1 (OWLIndividual) – The subject individual in the assertion, representing the entity that holds the object property relationship with the second individual.
individual_2 (OWLIndividual) – The individual that serves as the target of the object property relationship.
annotations (Optional[list[OWLAnnotation]]) – An optional list of annotations to associate with the object property assertion, providing additional metadata such as comments or labels.
- add_domain_annotations(annotations: list[pyowl2.base.annotation.OWLAnnotation]) None[source]
Associates a list of OWL annotations with the domain of this object property. If the property does not currently have a domain defined, the method exits without taking any action. When a domain exists, this method updates the domain’s axiom annotations with the provided list, overwriting any previously associated annotations.
- Parameters:
annotations (list[OWLAnnotation]) – Metadata, such as comments or labels, to associate with the domain axiom of this object property.
- add_negative_assertion(
- individual_1: pyowl2.abstracts.individual.OWLIndividual,
- individual_2: pyowl2.abstracts.individual.OWLIndividual,
- annotations: list[pyowl2.base.annotation.OWLAnnotation] | None = None,
Appends a negative object property assertion to the internal collection of axioms associated with this object property, formally declaring that the first individual does not relate to the second individual via this specific relationship. The method constructs the assertion using the provided individuals and an optional list of annotations for metadata. It ensures idempotency by verifying that the assertion does not already exist within the axioms before adding it, preventing duplicate entries.
- Parameters:
individual_1 (OWLIndividual) – The first individual in the negative assertion, representing the subject that is not related to the second individual via this object property.
individual_2 (OWLIndividual) – The individual that is asserted not to be related to the first individual via this object property.
annotations (Optional[list[OWLAnnotation]]) – Optional list of annotations to associate with the negative object property assertion, providing metadata such as comments or labels.
- add_property_annotations(
- property_class: pyowl2.abstracts.object_property_axiom.OWLObjectPropertyAxiom,
- annotations: list[pyowl2.base.annotation.OWLAnnotation],
Attaches a list of annotations to the first object property axiom found that is an instance of the specified class. The method iterates through the entity’s axioms and replaces the axiom_annotations attribute of the first matching axiom with the provided list. If no axiom matches the given class, the method performs no action. Note that due to an immediate return upon finding a match, only the first encountered axiom of the specified type is modified, leaving any subsequent matching axioms unchanged.
- Parameters:
property_class (OWLObjectPropertyAxiom) – The class of object property axioms to target for annotation. Must be a subclass of OWLObjectPropertyAxiom.
annotations (list[OWLAnnotation]) – A list of OWLAnnotation objects containing metadata, such as comments or labels, to be associated with the object property axiom.
- add_range_annotations(annotations: list[pyowl2.base.annotation.OWLAnnotation]) None[source]
Associates a list of OWL annotations with the range axiom of this object property, providing metadata such as comments or labels. This method directly assigns the provided list to the range’s annotation property, thereby replacing any existing annotations that may have been present. If the object property does not have a defined range, the method takes no action.
- Parameters:
annotations (list[OWLAnnotation]) – A list of annotations to associate with the range of this object property, providing metadata such as comments or labels.
- all(cls: pyowl2.abstracts.class_expression.OWLClassExpression) None[source]
Adds a universal restriction (all values from axiom) to the object property, asserting that every value associated with this property must satisfy the specified class expression. The method constructs an OWLObjectAllValuesFrom instance and appends it to the internal list of axioms, provided that an identical axiom does not already exist. This check ensures that duplicate axioms are not added, maintaining the integrity of the ontology definition.
- del_assertion(
- assertion: pyowl2.axioms.assertion.object_property_assertion.OWLObjectPropertyAssertion | pyowl2.axioms.assertion.negative_object_property_assertion.OWLNegativeObjectPropertyAssertion,
Removes a specified object property assertion or negative object property assertion from the internal list of axioms maintained by this object property. The method iterates through the existing axioms to find a match for the provided assertion; if found, it deletes that specific axiom from the collection and returns immediately. If the assertion is not present, the method performs no action and exits without raising an error, effectively leaving the object’s state unchanged.
- Parameters:
assertion (Union[OWLObjectPropertyAssertion, OWLNegativeObjectPropertyAssertion]) – The object property assertion or negative object property assertion to remove from the axioms.
- exact_cardinality(cardinality: int, cls: pyowl2.abstracts.class_expression.OWLClassExpression) None[source]
This method constructs and adds an exact cardinality axiom to the internal collection of axioms for the object property, enforcing that there must be precisely a specific number of values satisfying a given class expression. It accepts a non-negative integer representing the required count and an OWL class expression defining the type of the values. The operation is idempotent; if an identical axiom already exists in the axioms list, the method performs no action, otherwise, it appends the new axiom to the collection.
- Parameters:
cardinality (int) – The exact number of values for the object property that must satisfy the specified class expression. Must be a non-negative integer.
- has_self() None[source]
Adds a ‘has self’ axiom to the collection of axioms associated with this object property, asserting that the property relates an individual to itself. The operation is idempotent; it verifies whether the specific axiom already exists within the internal axioms list and only appends it if it is absent. This ensures that duplicate axioms are not created.
- has_value(individual: pyowl2.abstracts.individual.OWLIndividual) None[source]
Adds a “has value” axiom to the internal list of axioms associated with this object property, asserting that the property relates to a specific individual. The method constructs an OWLObjectHasValue restriction using the provided OWLIndividual and the current object property. It ensures idempotency by verifying that the axiom does not already exist within the axioms collection before appending it, preventing duplicate entries. This operation modifies the state of the object by updating its axioms list.
- Parameters:
individual (OWLIndividual) – The specific individual instance that serves as the value for the object property restriction.
- is_disjoint_from(
- properties: pyowl2.abstracts.object_property_expression.OWLObjectPropertyExpression | list[pyowl2.abstracts.object_property_expression.OWLObjectPropertyExpression] | Self | list[Self],
- annotations: list[pyowl2.base.annotation.OWLAnnotation] | None = None,
Asserts that this object property is disjoint from the specified properties by creating and adding a corresponding axiom to the object’s internal collection. The method accepts a single property or a list of properties, supporting both raw OWLObjectPropertyExpression objects and OWLFullObjectProperty instances. Optional annotations may be provided to attach metadata to the axiom. The operation ensures idempotency by checking for the existence of an equivalent axiom before adding it; if the axiom is already present, the method returns without making changes. Input types are validated to ensure all provided properties are of a compatible type.
- Parameters:
properties (Union[OWLObjectPropertyExpression, list[OWLObjectPropertyExpression], Self, list[Self]]) – One or more properties to be asserted as disjoint from this instance.
annotations (Optional[list[OWLAnnotation]]) – Optional list of annotations to associate with the disjoint properties axiom, providing metadata such as comments or labels.
- is_equivalent_to(
- properties: pyowl2.abstracts.object_property_expression.OWLObjectPropertyExpression | list[pyowl2.abstracts.object_property_expression.OWLObjectPropertyExpression] | Self | list[Self],
- annotations: list[pyowl2.base.annotation.OWLAnnotation] | None = None,
This method adds an equivalent object properties axiom to the current object property, defining it as equivalent to the specified property or list of properties. It handles inputs that are either raw OWLObjectPropertyExpression objects or OWLFullObjectProperty instances, extracting the underlying property expressions as needed. Optional annotations can be supplied to attach metadata, such as comments or labels, to the axiom. The method ensures idempotency by checking if the resulting axiom already exists within the property’s axioms; if it does, no action is taken. In cases where the input types are invalid, the method returns a TypeError object.
- Parameters:
properties (Union[OWLObjectPropertyExpression, list[OWLObjectPropertyExpression], Self, list[Self]]) – The object properties to which this property is equivalent. Accepts a single property or a list of properties, where each property can be an OWLObjectPropertyExpression or an instance of OWLFullObjectProperty.
annotations (Optional[list[OWLAnnotation]]) – Optional list of annotations to associate with the equivalent properties axiom, providing metadata such as comments or labels.
- is_inverse_of(property: pyowl2.abstracts.object_property_expression.OWLObjectPropertyExpression) None[source]
Asserts that the current object property is the inverse of the provided property expression by appending a corresponding axiom to the internal collection. This operation defines a symmetric relationship in the ontology, meaning that if an individual x relates to y via this property, y must relate to x via the specified property. The method is idempotent; it checks for the existence of the specific inverse property axiom before adding it, ensuring that no duplicate axioms are created.
- Parameters:
property (OWLObjectPropertyExpression) – The object property expression that is the inverse of this property.
- is_sub_property_of(
- super_property: pyowl2.abstracts.object_property_expression.OWLObjectPropertyExpression | Self,
- annotations: list[pyowl2.base.annotation.OWLAnnotation] | None = None,
Establishes a subproperty relationship between this object property and the specified super property by constructing and adding a subproperty axiom to the internal axioms list. The method handles the super property argument flexibly, accepting either a raw object property expression or another OWLFullObjectProperty instance, from which it extracts the underlying property. If an identical axiom is already present in the axioms collection, the method performs no action, ensuring that duplicate relationships are not created. Optional annotations can be provided to attach metadata to the newly created axiom.
- Parameters:
super_property (Union[OWLObjectPropertyExpression, Self]) – The parent property in the subproperty relationship, indicating that this property is a specialization of the specified property.
annotations (Optional[list[OWLAnnotation]]) – Optional list of annotations to attach to the subproperty axiom, providing metadata such as comments or labels.
- is_super_property_of(
- sub_property: pyowl2.abstracts.object_property_expression.OWLObjectPropertyExpression | pyowl2.axioms.object_property_axiom.object_property_chain.OWLObjectPropertyChain | Self,
- annotations: list[pyowl2.base.annotation.OWLAnnotation] | None = None,
Adds a superproperty axiom to the internal list of axioms, declaring that the current object property is a superproperty of the provided sub-property. The sub-property argument can be an object property expression, a property chain, or another instance of the same class. An optional list of annotations may be provided to associate metadata with the axiom. The method performs a check to ensure that the exact axiom does not already exist in the axioms collection; if it is found, the method returns without making changes, preventing duplicate entries. If the axiom is new, it is appended to the collection.
- Parameters:
sub_property (Union[OWLObjectPropertyExpression, OWLObjectPropertyChain, Self]) – The object property expression, property chain, or object property instance that is a subproperty of the current property.
annotations (Optional[list[OWLAnnotation]]) – An optional list of annotations to associate with the superproperty axiom, providing metadata such as comments or labels.
- max_cardinality(cardinality: int, cls: pyowl2.abstracts.class_expression.OWLClassExpression) None[source]
Adds a maximum cardinality axiom to the object property, asserting that the number of distinct values linked by this property which satisfy the specified class expression must not exceed the given integer. This method constructs an OWLObjectMaxCardinality instance and appends it to the property’s internal axiom list, ensuring that no duplicate axioms are added if an identical restriction already exists. The cardinality argument represents the non-negative upper bound for the count of qualifying values, while the cls argument defines the OWLClassExpression that these values must instantiate to be included in the count.
- Parameters:
cardinality (int) – The non-negative integer defining the maximum number of distinct values for the object property that satisfy the class expression.
- min_cardinality(cardinality: int, cls: pyowl2.abstracts.class_expression.OWLClassExpression) None[source]
Adds a minimum cardinality restriction to the axioms of this object property, asserting that there must be at least the specified number of distinct values satisfying the provided class expression. The method constructs an OWLObjectMinCardinality instance and appends it to the internal list of axioms only if an identical axiom does not already exist, thereby preventing duplicates. This operation modifies the internal state of the object property by updating its associated axiom collection.
- Parameters:
cardinality (int) – The non-negative integer representing the minimum number of values for the object property that must satisfy the specified class expression.
- some(cls: pyowl2.abstracts.class_expression.OWLClassExpression) None[source]
Adds an existential restriction, known as a “some values from” axiom, to the internal list of axioms associated with this object property. This method asserts that there exists at least one value for this property that satisfies the specified class expression. The operation is idempotent; if the specific axiom already exists within the axioms collection, it will not be added again, otherwise, the newly constructed axiom is appended to the list.
- PROPERTY_CLASSES: list[type]
- _annotations: list[pyowl2.base.annotation.OWLAnnotation] | None = None
- _axioms: list[pyowl2.abstracts.axiom.OWLAxiom] = []
- _object_property: pyowl2.expressions.object_property.OWLObjectProperty
- property all_axioms: list[pyowl2.class_expression.object_all_values_from.OWLObjectAllValuesFrom]
Retrieves a list of universal restriction axioms associated with this object property by filtering the general axiom collection for instances of OWLObjectAllValuesFrom. These axioms define constraints requiring that all values of this property for a given subject must belong to a specific class or satisfy a specific condition. The method returns a new list, ensuring that modifications to the result do not affect the internal state, and returns an empty list if no matching axioms are found.
- Returns:
A list of all universal restriction (all values from) axioms associated with this object property.
- Return type:
list[OWLObjectAllValuesFrom]
- property annotations: list[pyowl2.base.annotation.OWLAnnotation] | None
Sets the annotations for the current OWL full object property instance. The provided value, which can be a list of OWLAnnotation objects or None, replaces the existing annotations stored in the private _annotations attribute. This operation overwrites the previous state rather than appending to it, effectively resetting the property’s metadata to the new list or clearing it if None is provided.
- Parameters:
value (Optional[list[OWLAnnotation]]) – The annotations to assign to the object, or None to clear them.
- property assertions: list[pyowl2.axioms.assertion.object_property_assertion.OWLObjectPropertyAssertion]
Retrieves a list of all specific assertions involving this object property by filtering the internal collection of axioms. This includes both positive assertions, which affirm a relationship between two individuals, and negative assertions, which explicitly deny such a relationship. The method returns a new list containing instances of OWLObjectPropertyAssertion and OWLNegativeObjectPropertyAssertion, providing access to all concrete usages of the property within the ontology. If no assertions are associated with the property, an empty list is returned.
- Returns:
A list of all object property assertions (both positive and negative) associated with this object property.
- Return type:
- property axioms: list[pyowl2.abstracts.axiom.OWLAxiom]
Returns the list of axioms associated with this OWL Full object property. This property provides direct access to the internal collection of OWLAxiom instances. Because the reference to the underlying list is returned rather than a copy, any modifications made to the returned list will directly alter the state of the object.
- Returns:
A list of the axioms associated with this object.
- Return type:
list[OWLAxiom]
- property disjoint_properties: list[pyowl2.axioms.object_property_axiom.disjoint_object_properties.OWLDisjointObjectProperties]
Retrieves a list of axioms that define disjointness relationships between this object property and other object properties within the ontology. The method filters the internal collection of axioms to return only those instances that explicitly declare a disjointness constraint. If no such axioms are associated with the property, an empty list is returned. This property is read-only and does not modify the state of the object or the underlying axioms.
- Returns:
A list of axioms indicating that this object property is disjoint with other object properties.
- Return type:
- property domain: pyowl2.axioms.object_property_axiom.object_property_domain.OWLObjectPropertyDomain | None
Sets the domain restriction for the object property to the specified class expression. This method constructs an OWLObjectPropertyDomain axiom that links the current object property with the provided value, defining the valid types of subjects for the property. The resulting axiom is stored internally, replacing any previously defined domain.
- Parameters:
value (OWLClassExpression) – The class expression defining the domain of the object property.
- property equivalent_properties: list[pyowl2.axioms.object_property_axiom.equivalent_object_properties.OWLEquivalentObjectProperties]
Retrieves all axioms that assert this object property is equivalent to another object property. This method filters the property’s associated axioms to identify and return only those of type OWLEquivalentObjectProperties, which formally state that this property and another have the same extension. The returned list may be empty if no equivalent properties are defined for this entity.
- Returns:
A list of axioms indicating that this object property is equivalent to other object properties.
- Return type:
- property exact_axioms: list[pyowl2.class_expression.object_exact_cardinality.OWLObjectExactCardinality]
Retrieves a list of exact cardinality axioms associated with this object property. These axioms define constraints requiring that a subject has precisely a specific number of distinct values for the property. The method filters the property’s general axiom collection to isolate instances of OWLObjectExactCardinality. It returns an empty list if no matching axioms are found and does not modify the underlying state.
- Returns:
A list of axioms specifying that this object property must have exactly a certain number of values.
- Return type:
- property has_self_axioms: list[pyowl2.class_expression.object_has_self.OWLObjectHasSelf]
Retrieves all axioms associated with this object property that assert a self-referential relationship. The method filters the internal collection of axioms to return only those instances of OWLObjectHasSelf. This is a read-only operation that returns a new list; if no matching axioms are found, the result is an empty list.
- Returns:
A list of OWLObjectHasSelf axioms associated with this object property. The list is empty if no such axioms are defined.
- Return type:
list[OWLObjectHasSelf]
- property has_value_axioms: list[pyowl2.class_expression.object_has_value.OWLObjectHasValue]
Retrieves a list of all axioms associated with this object property that specify a particular value. This property filters the internal collection of axioms, returning only those that are instances of OWLObjectHasValue. The operation returns a new list, ensuring that modifications to the result do not affect the original data structure, and yields an empty list if no matching axioms are found.
- Returns:
A list of all OWLObjectHasValue axioms associated with this object property, or an empty list if no such axioms exist.
- Return type:
list[OWLObjectHasValue]
- property inverses: list[pyowl2.axioms.object_property_axiom.inverse_object_properties.OWLInverseObjectProperties]
Retrieves a collection of axioms that define inverse relationships for this object property. By filtering the internal list of axioms, it identifies and returns only those instances of OWLInverseObjectProperties, which assert that this property is the semantic inverse of another. If no inverse relationships are currently asserted for this property, the method returns an empty list.
- Returns:
A list of axioms defining the inverse properties for this object property.
- Return type:
- property is_asymmetric: bool
Updates the asymmetric characteristic of the object property based on the provided boolean value. If the value is True, the property is marked as asymmetric, implying that if it relates an individual A to B, it cannot relate B to A. If the value is False, the asymmetric characteristic is removed from the property definition. This operation modifies the underlying ontology by adding or removing the corresponding OWLAsymmetricObjectProperty axiom.
- Parameters:
value (bool) – Indicates whether the object property is asymmetric.
- property is_functional: bool
Sets the functional characteristic of the object property, determining whether it relates an individual to at most one other individual. When the provided value is true, the method adds the corresponding OWLFunctionalObjectProperty axiom to the ontology; if false, it removes this assertion. This operation directly modifies the underlying ontology structure to reflect the change in property constraints.
- Parameters:
value (bool) – Boolean flag indicating whether the property is functional, meaning it can have only one value for each instance.
- property is_inverse_functional: bool
Sets the inverse-functional characteristic of the object property to the specified boolean value. When set to True, this indicates that the inverse of the property is functional, meaning no two distinct individuals can be the target of the inverse property for the same source individual. The method updates the underlying ontology by adding or removing the corresponding OWLInverseFunctionalObjectProperty axiom depending on the provided value.
- Parameters:
value (bool) – True to mark the property as inverse functional, False otherwise.
- property is_irreflexive: bool
Sets the irreflexive characteristic of the object property to the specified boolean value. If the value is True, the method asserts that the property is irreflexive, meaning no individual can be related to itself via this property. If the value is False, this assertion is removed. This operation modifies the underlying ontology structure by adding or removing the corresponding OWLIrreflexiveObjectProperty axiom.
- Parameters:
value (bool) – True if the property should be irreflexive, False otherwise.
- property is_reflexive: bool
Sets the reflexive characteristic of the object property to the specified boolean value. When the value is True, this method asserts that the property relates every individual to itself, effectively adding or updating the corresponding axiom in the ontology. Conversely, setting the value to False removes the reflexive property assertion. This operation modifies the internal state of the entity by invoking the underlying _del_property mechanism to handle the OWLReflexiveObjectProperty axiom.
- Parameters:
value (bool) – True if the property should be reflexive, False otherwise.
- property is_symmetric: bool
Configures the symmetric nature of the object property based on the provided boolean value. If the value is True, the property is marked as symmetric, meaning that if $x$ is related to $y$, then $y$ is related to $x$; if False, this characteristic is removed. This setter triggers an internal update to the ontology’s axioms, specifically adding or deleting an instance of OWLSymmetricObjectProperty to reflect the new state.
- Parameters:
value (bool) – True if the object property is symmetric, False otherwise.
- property is_transitive: bool
Sets the transitive characteristic of the object property by updating the underlying ontology axioms. This method acts as a setter for the is_transitive property, accepting a boolean value that determines whether the property should be treated as transitive. It delegates the actual modification of the ontology structure to an internal helper method, passing the provided value and the specific OWLTransitiveObjectProperty axiom type to either assert or retract the transitivity constraint.
- Parameters:
value (bool) – True if the property is transitive, False otherwise.
- property max_axioms: list[pyowl2.class_expression.object_max_cardinality.OWLObjectMaxCardinality]
Retrieves all maximum cardinality axioms associated with this object property by filtering the internal collection of axioms. These axioms define constraints that limit the number of distinct values the property can have to a specific maximum. The method returns a new list containing only the instances of OWLObjectMaxCardinality; if no such constraints exist, an empty list is returned.
- Returns:
A list of maximum cardinality axioms associated with this object property, representing constraints that limit the maximum number of values the property can have.
- Return type:
list[OWLObjectMaxCardinality]
- property min_axioms: list[pyowl2.class_expression.object_min_cardinality.OWLObjectMinCardinality]
Retrieves a list of all minimum cardinality axioms associated with this object property by filtering the property’s general collection of axioms. This method specifically identifies constraints that mandate a lower bound on the number of distinct values or relationships an entity must possess via this property. If no such constraints are defined, an empty list is returned. The operation is read-only and does not modify the underlying ontology structure.
- Returns:
A list of all minimum cardinality axioms associated with this object property.
- Return type:
list[OWLObjectMinCardinality]
- property object_property: pyowl2.expressions.object_property.OWLObjectProperty
Sets the object property associated with this instance. It accepts a value of type OWLObjectProperty and assigns it to the internal attribute, replacing any existing value. This operation updates the state of the object to reflect the new property relationship.
- Parameters:
value (OWLObjectProperty) – The object property to assign to the instance.
- property properties: list[pyowl2.abstracts.object_property_axiom.OWLObjectPropertyAxiom]
Retrieves a filtered list of axioms that specifically describe the characteristics and relationships of this object property. The method iterates over the internal collection of axioms and selects only those belonging to the predefined set of object property axiom types. This includes definitions of logical properties such as symmetry, transitivity, or functionality, as well as structural relationships like subproperty hierarchies or equivalences. The operation is read-only and returns a new list; if no relevant axioms are associated with the property, an empty list is returned.
- Returns:
A list of axioms associated with this object property, defining its characteristics (e.g., symmetry, transitivity) and relationships (e.g., subproperties, equivalence).
- Return type:
list[OWLObjectPropertyAxiom]
- property range: pyowl2.axioms.object_property_axiom.object_property_range.OWLObjectPropertyRange | None
Sets the range of the object property to the specified class expression. This method updates the internal state by creating an OWLObjectPropertyRange axiom that links the current object property with the provided OWLClassExpression. Any previous range definition associated with this property is overwritten by this operation.
- Parameters:
value (OWLClassExpression) – The class expression that defines the range of the object property.
- property some_axioms: list[pyowl2.class_expression.object_some_values_from.OWLObjectSomeValuesFrom]
Retrieves a list of all existential restriction axioms, specifically those of type OWLObjectSomeValuesFrom, that are associated with this object property. This property filters the underlying collection of axioms to isolate constraints indicating that there must exist at least one value for the property belonging to a particular class. The operation is read-only and returns a new list; consequently, modifying the returned list will not affect the original set of axioms, and an empty list is returned if no such restrictions are defined.
- Returns:
A list of OWLObjectSomeValuesFrom axioms associated with this object property, representing existential restrictions where the property has at least one value satisfying a specific condition. Returns an empty list if no such axioms are found.
- Return type:
list[OWLObjectSomeValuesFrom]
- property sub_properties: list[pyowl2.axioms.object_property_axiom.sub_object_property_of.OWLSubObjectPropertyOf]
Retrieves a list of axioms that define other properties as sub-properties of the current object property. This method iterates over the internal axioms to find instances of OWLSubObjectPropertyOf where the super property expression matches the current property. It effectively identifies the direct hierarchy of properties descending from this one. If no such axioms exist, an empty list is returned, and the method does not modify the object’s state.
- Returns:
A list of axioms defining object properties that are sub-properties of this object property.
- Return type:
list[OWLSubObjectPropertyOf]
- property super_properties: list[pyowl2.axioms.object_property_axiom.sub_object_property_of.OWLSubObjectPropertyOf]
Retrieves a list of axioms that define the super-properties of this object property by filtering the internal set of axioms. Specifically, it returns instances of OWLSubObjectPropertyOf where the current property is the sub-property expression, indicating that this property is a specialization of another property within the ontology hierarchy. If no such axioms exist, an empty list is returned.
- Returns:
A list of axioms asserting that this object property is a sub-property of another object property.
- Return type:
list[OWLSubObjectPropertyOf]