fuzzy_dl_owl2.fuzzydl.concept.modified.triangularly_modified_concept
A specialized class representing a fuzzy logic concept that has been transformed by a triangular modifier to adjust its membership degree.
Description
The implementation extends the general framework for modified concepts to specifically handle triangular transformations, which are used to non-linearly adjust the degree of membership or satisfaction of a base concept. By associating a specific modifier with a conceptual entity, the structure allows for the dynamic alteration of fuzzy logic values while maintaining the integrity of the original concept hierarchy. Logical operations such as negation, conjunction, and disjunction are supported through delegation to a central operator handler, enabling these modified concepts to participate in complex logical expressions. Furthermore, the design includes mechanisms for cloning the instance and recursively replacing sub-concepts, with the replacement process specifically applying a logical negation to the updated structure to ensure consistent behavior during manipulation. Hashing is implemented based on the internal attributes to facilitate the use of these objects within collections that require unique identification.
Classes
This class represents a conceptual entity where a base concept is adjusted by a triangular modifier, which transforms the degree of satisfaction or membership value of the concept in a specific, non-linear manner. To utilize this structure, one must instantiate it with the target concept and the desired triangular modifier. The resulting object supports standard logical operations, including negation, conjunction, and disjunction, allowing it to participate in complex logical expressions. Additionally, it offers methods for cloning the instance and recursively replacing sub-concepts within the underlying structure to facilitate dynamic manipulation of the conceptual hierarchy. |
Module Contents
UML Class Diagram for TriangularlyModifiedConcept
- class TriangularlyModifiedConcept(
- 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 represents a conceptual entity where a base concept is adjusted by a triangular modifier, which transforms the degree of satisfaction or membership value of the concept in a specific, non-linear manner. To utilize this structure, one must instantiate it with the target concept and the desired triangular modifier. The resulting object supports standard logical operations, including negation, conjunction, and disjunction, allowing it to participate in complex logical expressions. Additionally, it offers methods for cloning the instance and recursively replacing sub-concepts within the underlying structure to facilitate dynamic manipulation of the conceptual hierarchy.
- __and__(value: Self) Self
Implements the bitwise AND operation using the & operator for the current instance. This method delegates the actual computation to the OperatorConcept.and_ static method, passing both the current instance and the provided value. It returns a new instance of the same type representing the result of the conjunction, without modifying the original operands.
- Parameters:
value (Self) – The other operand to perform the AND operation with.
- Returns:
The result of the logical 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
Implements the unary negation operator, enabling the use of the minus sign to represent the logical negation of the concept. This method returns a new Concept instance that wraps the current instance within a logical ‘NOT’ operation by delegating to OperatorConcept.not_. The operation does not modify the original object in place.
- Returns:
A new Concept representing the logical negation of this concept.
- Return type:
- __or__(value: Self) Self
Implements the bitwise OR operation for the concept, enabling the use of the pipe operator (|) to combine two instances. This method accepts another object of the same type and returns a new instance representing the logical disjunction or union of the two concepts. The operation is delegated to the OperatorConcept class to handle the specific calculation logic, ensuring that the original instances remain unmodified.
- Parameters:
value (Self) – Another instance to combine with the current instance using the OR operation.
- Returns:
The result of the OR operation between the current instance and the provided value.
- Return type:
Self
- clone() Self
Creates and returns a new instance of TriangularlyModifiedConcept that replicates the state of the current object. The clone is constructed using the existing curr_concept and modifier attributes, ensuring that the original object remains unmodified. Note that because the attributes are passed directly to the new instance, this operation performs a shallow copy; if the underlying concept or modifier objects are mutable, changes to them will be reflected in both the original and the clone.
- Returns:
A new instance of the class that is a copy of the current object.
- Return type:
Self
- replace( ) fuzzy_dl_owl2.fuzzydl.concept.concept.Concept
Performs a substitution operation by replacing every instance of concept a with concept c within the underlying curr_concept. This method preserves the current modifier and constructs a new TriangularlyModifiedConcept instance containing the updated underlying concept. The final result is the logical negation of this newly constructed instance, ensuring that the original object remains unmodified.
- Parameters:
- Returns:
A new Concept representing the result of replacing concept a with concept c within the current concept, preserving the existing modification context and applying a negation.
- Return type: