pyowl2.axioms.assertion.same_individual
Models an OWL axiom asserting that a collection of named individuals are identical within the domain of discourse.
Description
The software implements a specific type of Web Ontology Language (OWL) assertion used to declare that multiple distinct entities refer to the same individual within a knowledge base. By extending the base assertion class, it integrates seamlessly into the broader ontology structure while enforcing strict validation rules to ensure logical consistency. Specifically, the implementation requires a minimum of two individuals to form a valid identity assertion and automatically sorts these entities to maintain a canonical representation regardless of input order. Additionally, the logic supports the attachment of optional metadata annotations and generates a standardized string output that adheres to functional syntax conventions for interoperability.
Classes
This class models an OWL axiom asserting that a collection of named individuals are identical within the domain of discourse. By declaring individuals as the same, any properties or assertions applicable to one individual can be inferred for the others. To use this class, instantiate it with a list containing at least two OWLIndividual objects; providing fewer than two will raise an assertion error. The class automatically sorts the provided list of individuals to maintain a canonical order, and it optionally accepts a list of annotations to attach metadata to the axiom. |
Module Contents
UML Class Diagram for OWLSameIndividual
- class OWLSameIndividual(
- individuals: list[pyowl2.abstracts.individual.OWLIndividual],
- annotations: list[pyowl2.base.annotation.OWLAnnotation] | None = None,
Bases:
pyowl2.abstracts.assertion.OWLAssertion
This class models an OWL axiom asserting that a collection of named individuals are identical within the domain of discourse. By declaring individuals as the same, any properties or assertions applicable to one individual can be inferred for the others. To use this class, instantiate it with a list containing at least two OWLIndividual objects; providing fewer than two will raise an assertion error. The class automatically sorts the provided list of individuals to maintain a canonical order, and it optionally accepts a list of annotations to attach metadata to the axiom.
- Parameters:
individuals (list[OWLIndividual]) – Sorted list of named individuals asserted to be identical.
- __str__() str[source]
Returns a string representation of the axiom formatted in a functional syntax style. The representation begins with the keyword ‘SameIndividual’ followed by the axiom annotations. If the axiom contains no annotations, an empty list indicator ‘[]’ is used in their place. The string concludes with the space-separated string representations of the individuals declared to be identical.
- Returns:
A string representation of the axiom in the format ‘SameIndividual([annotations] individuals)’.
- Return type:
str
- _individuals: list[pyowl2.abstracts.individual.OWLIndividual]
- property individuals: list[pyowl2.abstracts.individual.OWLIndividual]
Sets the list of individuals associated with this OWL SameIndividual axiom. The method accepts a list of OWLIndividual objects and assigns them to the internal storage. Notably, the input list is sorted before assignment, ensuring that the individuals are maintained in a deterministic order regardless of the sequence provided.
- Parameters:
value (list[OWLIndividual]) – The new list of OWLIndividual objects to store. The list is sorted before assignment.