fuzzy_dl_owl2.fuzzydl.concept.modified.linearly_modified_concept
A specialized implementation of a fuzzy description logic concept that applies a linear transformation to the degree of satisfaction of a base concept.
Description
The software models a specific type of fuzzy concept where the truth value is scaled or shifted according to a linear modifier, effectively representing a structure like (modifier C). By inheriting from a base modified concept class, it encapsulates a core concept and a modifier object, allowing the system to represent nuanced degrees of membership. Logical operations such as negation, conjunction, and disjunction are supported through operator overloading, which delegates the actual construction of complex expressions to a central operator handler. Additionally, structural integrity is maintained through methods that allow for the cloning of instances and the replacement of sub-concepts, facilitating dynamic manipulation of the concept hierarchy without mutating the original objects. The implementation also defines a hashing mechanism based on the internal components to ensure consistent object identity within collections.
Classes
This class models a concept whose degree of satisfaction is adjusted by a linear modifier, representing a structure of the form (modifier C). It is instantiated by providing a base concept and a specific linear modifier that scales or shifts the concept's truth value in a linear fashion. The class supports standard logical operations, including negation, conjunction, and disjunction, enabling the integration of modified concepts into complex logical expressions. Furthermore, it provides utility methods for cloning the instance and replacing sub-concepts within the underlying structure, allowing for dynamic manipulation of the concept hierarchy. |
Module Contents
UML Class Diagram for LinearlyModifiedConcept
- class LinearlyModifiedConcept(c: fuzzy_dl_owl2.fuzzydl.concept.concept.Concept, mod: fuzzy_dl_owl2.fuzzydl.modifier.modifier.Modifier)
Bases:
fuzzy_dl_owl2.fuzzydl.concept.modified.modified_concept.ModifiedConcept
This class models a concept whose degree of satisfaction is adjusted by a linear modifier, representing a structure of the form (modifier C). It is instantiated by providing a base concept and a specific linear modifier that scales or shifts the concept’s truth value in a linear fashion. The class supports standard logical operations, including negation, conjunction, and disjunction, enabling the integration of modified concepts into complex logical expressions. Furthermore, it provides utility methods for cloning the instance and replacing sub-concepts within the underlying structure, allowing for dynamic manipulation of the concept hierarchy.
- __and__(value: Self) Self
Implements the bitwise AND operation for the concept, allowing the use of the & operator to combine it with another instance of the same type. This method delegates the actual computation to OperatorConcept.and_, ensuring that the logic for conjunction is handled centrally within the module. The operation returns a new instance representing the result of the combination, without modifying the original objects.
- Parameters:
value (Self) – The right-hand operand for the AND operation.
- Returns:
The result of the AND operation between this instance and the provided value.
- Return type:
Self
- __hash__() int
Return a hash value for this object, computed from its string representation. This approach ensures that the hash value reflects the structural identity of the object without relying on cached values or additional methods. The hash is derived from the output of the __str__ method, which provides a consistent and unique representation of the concept’s structure. This implementation does not utilize any internal caching mechanism and directly computes the hash each time it is called.
- Returns:
An integer hash value representing the structural identity of this object.
- Return type:
int
- __neg__() fuzzy_dl_owl2.fuzzydl.concept.concept.Concept
Returns the logical negation of the current concept, effectively representing the ‘not’ operation. This method is invoked when the unary minus operator (-) is applied to an instance of the class. It delegates the construction of the resulting concept to OperatorConcept.not_, returning a new Concept object without modifying the original instance.
- Returns:
A new Concept representing the logical negation of the current concept.
- Return type:
- __or__(value: Self) Self
Performs a logical OR or union operation between the current instance and another instance of the same type, enabling the use of the pipe operator (|). This method delegates the underlying logic to OperatorConcept.or_, which handles the specific combination rules. It returns a new instance representing the combined concept without modifying the original operands. The operation expects the provided value to be a compatible instance of the same class.
- Parameters:
value (Self) – The other operand to perform the OR operation with.
- Returns:
An instance representing the result of the OR operation between this instance and the provided value.
- Return type:
Self
- clone() Self
Creates and returns a new instance of LinearlyModifiedConcept that duplicates the state of the current object. The clone is initialized with the same curr_concept and modifier attributes as the original, ensuring that subsequent modifications to the new instance do not affect the source. This method provides a mechanism for obtaining an independent copy of the object without altering the original’s internal state.
- Returns:
A new instance of the class that is a copy of the current object, initialized with the same concept and modifier.
- Return type:
Self
- replace(a: fuzzy_dl_owl2.fuzzydl.concept.concept.Concept, c: fuzzy_dl_owl2.fuzzydl.concept.concept.Concept) Self
Returns a new instance of the class where the underlying concept has been updated by replacing occurrences of concept a with concept c. The replacement operation is delegated to the underlying concept, and the modifier associated with the current instance is preserved in the result. This method does not mutate the original instance but instead returns a modified copy.