fuzzy_dl_owl2.fuzzydl.concept.modified.linearly_modified_concept
A class representing a fuzzy description logic concept whose degree of satisfaction is adjusted by a linear modifier.
Description
The implementation extends the base modified concept structure to handle linear transformations of truth values, allowing for the scaling or shifting of a base concept’s satisfaction degree. By encapsulating a specific concept alongside a linear modifier, the logic enables the construction of complex expressions where fuzzy truth values are adjusted mathematically before being used in further reasoning. Standard logical operations such as negation, conjunction, and disjunction are supported through operator overloading, which delegates the actual computation to a central operator handler to ensure consistency across the system. Additionally, the design facilitates structural manipulation by providing mechanisms to clone the entire concept or replace specific sub-concepts within the hierarchy without altering the original instance, which is essential for maintaining immutability during logical inference. Hashing relies on the string representation of the object, allowing these modified concepts to be used effectively within collections like sets and dictionaries.
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)[source]
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[source]
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[source]
Computes the hash value for the instance by delegating to the hash of the object’s string representation. This behavior allows instances of LinearlyModifiedConcept to be used as dictionary keys or stored in sets, provided that the string representation remains consistent for equal objects and does not change over the object’s lifetime. The implementation relies on the __str__ method to generate the input for the hash function.
- Returns:
An integer hash value derived from the object’s string representation.
- Return type:
int
- __neg__() fuzzy_dl_owl2.fuzzydl.concept.concept.Concept[source]
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[source]
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[source]
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[source]
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.