fuzzy_dl_owl2.fuzzydl.concept.sigma_count
A structural representation of a sigma-count concept used in fuzzy description logic to evaluate constraints based on the number of role fillers satisfying specific conditions.
Description
The SigmaCount class encapsulates the components necessary to evaluate constraints based on the quantity of role fillers within a fuzzy description logic framework. It holds references to a counting variable, a target individual, a set of reference individuals, a specific role, and a concept that fillers must satisfy. By including a deep cloning utility, the design ensures that instances can be copied independently to preserve state during complex logical operations or optimizations. Additionally, standard hashing and string formatting capabilities are provided to support usage in hash-based collections and to enable clear textual representation for debugging purposes.
Classes
This class represents a sigma-count concept within fuzzy description logic, serving as a structural representation for evaluating constraints based on the quantity of role fillers. It defines a condition where a target individual is considered satisfied if the number of related entities—connected via a specific role and conforming to a particular concept—falls within a fuzzy set determined by a collection of reference individuals. To use this class, instantiate it with a variable for the count, the target individual, the list of reference individuals, the role name, and the concept to be evaluated. The object provides methods to access these internal components and a cloning utility to create deep copies of the instance. |
Module Contents
UML Class Diagram for SigmaCount
- class SigmaCount(
- var: fuzzy_dl_owl2.fuzzydl.milp.variable.Variable,
- ind: fuzzy_dl_owl2.fuzzydl.individual.individual.Individual,
- inds: list[fuzzy_dl_owl2.fuzzydl.individual.individual.Individual],
- role: str,
- concept: fuzzy_dl_owl2.fuzzydl.concept.concept.Concept,
This class represents a sigma-count concept within fuzzy description logic, serving as a structural representation for evaluating constraints based on the quantity of role fillers. It defines a condition where a target individual is considered satisfied if the number of related entities—connected via a specific role and conforming to a particular concept—falls within a fuzzy set determined by a collection of reference individuals. To use this class, instantiate it with a variable for the count, the target individual, the list of reference individuals, the role name, and the concept to be evaluated. The object provides methods to access these internal components and a cloning utility to create deep copies of the instance.
- Parameters:
variable (Variable) – The variable associated with the sigma-count concept, used for counting the number of role fillers that satisfy the concept C.
individual (Individual) – The individual for which the sigma-count concept is being evaluated.
individuals (list[Individual]) – The set of individuals ${a_1, a_2, dots, a_n}$ considered in the fuzzy concrete concept $D$ for the sigma-count evaluation.
role (str) – The relationship identifier ‘r’ used in the sigma-count expression to connect the individual to the fillers being counted.
concept (Concept) – The concept C that role fillers must satisfy to be included in the sigma-count.
- __hash__() int[source]
Computes the hash value for the instance by hashing its string representation. This allows the object to be used as a dictionary key or stored in a set. The hash is derived directly from the output of the __str__ method, ensuring that the hash value remains consistent as long as the string representation does not change.
- Returns:
An integer hash value calculated from the object’s string representation.
- Return type:
int
- __repr__() str[source]
Returns the official string representation of the instance by delegating directly to the informal string conversion logic. This approach ensures that the output displayed in interactive sessions or logs is identical to the user-facing string format. The method performs no state modifications and depends entirely on the behavior of the __str__ method to generate the resulting string.
- Returns:
The string representation of the object, identical to the output of str().
- Return type:
str
- __str__() str[source]
Returns a human-readable string representation of the SigmaCount instance formatted as a functional expression. The output string follows the pattern ‘sigma-count(…)’, incorporating the object’s variable, individual, individuals, role, and concept attributes as comma-separated arguments. This method is intended for display purposes and does not modify the object’s state.
- Returns:
A string representation of the object, formatted as a sigma-count function call containing the variable, individual, individuals, role, and concept attributes.
- Return type:
str
- clone() Self[source]
Creates and returns a deep copy of the current SigmaCount instance. The method recursively clones the variable, individual, and concept attributes, and generates a new list containing clones of all elements within the individuals collection. The role attribute is passed by reference rather than being cloned. This operation has no side effects on the original object, ensuring that the returned instance is independent with respect to its deep-copied components.
- Returns:
A new instance of SigmaCount that is a deep copy of the current object.
- Return type:
Self
- get_concept() fuzzy_dl_owl2.fuzzydl.concept.concept.Concept[source]
Returns the Concept object associated with the current SigmaCount instance. This method acts as a simple accessor, retrieving the value of the concept attribute without modifying the object’s internal state. If the attribute has not been set, this method will raise an AttributeError.
- Returns:
The Concept object associated with this instance.
- Return type:
- get_individual() fuzzy_dl_owl2.fuzzydl.individual.individual.Individual[source]
Retrieves the Individual entity associated with the current SigmaCount instance. This accessor method returns the reference to the stored object without causing any side effects or modifying the internal state.
- Returns:
The Individual instance associated with this object.
- Return type:
- get_individuals() list[fuzzy_dl_owl2.fuzzydl.individual.individual.Individual][source]
Retrieves the collection of Individual objects managed by the SigmaCount instance. Since this method returns a direct reference to the internal list, any in-place modifications to the returned list will alter the state of the object.
- Returns:
A list of the individuals associated with this instance.
- Return type:
list[Individual]
- get_role() str[source]
Retrieves the string value assigned to the role attribute of the current instance. This accessor method provides read-only access to the specific role or category associated with the SigmaCount object without modifying its internal state. It assumes the attribute has been properly initialized; accessing this method on an instance where the attribute is missing will result in an AttributeError.
- Returns:
The role associated with the instance.
- Return type:
str
- get_variable() fuzzy_dl_owl2.fuzzydl.milp.variable.Variable[source]
Retrieves the Variable instance associated with this SigmaCount object. This method acts as a simple accessor, returning the reference to the internal variable attribute without modifying the state of the object. It allows external code to inspect which variable is being tracked or aggregated by the counter.
- Returns:
The Variable instance stored in the variable attribute.
- Return type:
- individuals: list[fuzzy_dl_owl2.fuzzydl.individual.individual.Individual]
- role: str