fuzzy_dl_owl2.fuzzydl.concept.concrete.modified_concrete_concept

A fuzzy concrete concept wrapper that applies a specific modifier to an underlying concept to transform membership degrees.

Description

Designed to model linguistic hedges or intensifiers within a fuzzy description logic framework, the software wraps an existing fuzzy concrete concept and applies a transformation function to its membership values. By combining a base concept, such as “tall,” with a modifier like “very,” the system creates composite expressions that mathematically adjust the truth values of simpler definitions. The architecture relies on a composition strategy where the membership degree of an input is first determined by the underlying concept and then passed through the modifier’s function to produce the final result. During evaluation, strict domain constraints are enforced to ensure that inputs outside the valid range result in a zero membership degree, maintaining logical consistency. The core logic delegates the calculation of the base degree to the wrapped concept before applying the modifier, allowing for dynamic and flexible construction of complex fuzzy sets. Furthermore, the implementation supports standard logical operations such as negation, conjunction, and disjunction by delegating these tasks to a central operator utility, ensuring consistent behavior across different concept types. To facilitate identification and storage, the software generates a structured string representation and computes hash values based on the internal state, including the modifier and the modified concept. This approach allows the modified concept to function seamlessly within larger knowledge bases or reasoning engines where unique identification and efficient comparison are required.

Classes

ModifiedConcreteConcept

This class models a fuzzy concrete concept that has been altered by a specific modifier, such as "very" or "somewhat," effectively creating a composite concept like "very tall." It operates by wrapping an existing fuzzy concrete concept and applying a transformation function to the membership degrees generated by that base concept. When evaluating the membership degree of an input value, the implementation strictly enforces a domain constraint: if the input is less than or equal to zero or greater than one, the resulting membership degree is zero. For inputs within the valid range, the class calculates the membership degree using the underlying concept and then applies the modifier's membership function to that intermediate value to determine the final degree of satisfaction. This mechanism allows for the dynamic construction of complex linguistic expressions by mathematically adjusting the truth values of simpler concepts.

Module Contents

UML Class Diagram for ModifiedConcreteConcept

UML Class Diagram for ModifiedConcreteConcept

class ModifiedConcreteConcept(
name: str,
modifier: fuzzy_dl_owl2.fuzzydl.modifier.modifier.Modifier,
f: fuzzy_dl_owl2.fuzzydl.concept.concrete.fuzzy_concrete_concept.FuzzyConcreteConcept,
)

Bases: fuzzy_dl_owl2.fuzzydl.concept.concrete.fuzzy_concrete_concept.FuzzyConcreteConcept

Inheritance diagram of fuzzy_dl_owl2.fuzzydl.concept.concrete.modified_concrete_concept.ModifiedConcreteConcept

This class models a fuzzy concrete concept that has been altered by a specific modifier, such as “very” or “somewhat,” effectively creating a composite concept like “very tall.” It operates by wrapping an existing fuzzy concrete concept and applying a transformation function to the membership degrees generated by that base concept. When evaluating the membership degree of an input value, the implementation strictly enforces a domain constraint: if the input is less than or equal to zero or greater than one, the resulting membership degree is zero. For inputs within the valid range, the class calculates the membership degree using the underlying concept and then applies the modifier’s membership function to that intermediate value to determine the final degree of satisfaction. This mechanism allows for the dynamic construction of complex linguistic expressions by mathematically adjusting the truth values of simpler concepts.

Parameters:
  • k1 (float) – The lower bound of the support interval for the fuzzy concept, defining the minimum value for which the membership degree is non-zero.

  • k2 (float) – The upper bound of the support interval, defining the threshold above which the membership degree is zero.

  • _modifier (Modifier) – The fuzzy logic modifier applied to the underlying concept to transform its membership degree.

  • _modified (FuzzyConcreteConcept) – The fuzzy concrete concept that is subject to modification by the associated modifier.

__and__(value: Self) Self

Implements the bitwise AND operation for the instance, allowing it to be combined with another object of the same type using the & operator. This method delegates the actual logic to the and_ function within the OperatorConcept class, ensuring consistent behavior across the module. It returns a new instance representing the result of the conjunction without modifying the original objects.

Parameters:

value (Self) – Another instance of the same class to perform the AND operation with.

Returns:

A new instance representing the result of the AND operation between the current object 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.concrete.fuzzy_concrete_concept.FuzzyConcreteConcept

Implements the unary negation operator, allowing the concept to be negated using the minus sign syntax. This method computes the logical NOT of the current concept by delegating to the OperatorConcept.not_ static method. It returns a new FuzzyConcreteConcept representing the negated value, leaving the original instance unchanged.

Returns:

Returns the logical negation (complement) of the current concept.

Return type:

FuzzyConcreteConcept

__or__(value: Self) Self

Implements the bitwise OR operator (|) for the instance, allowing it to be combined with another value of the same type. This method delegates the actual computation to the OperatorConcept.or_ static method, passing the current instance and the provided value as arguments. It returns a new instance of the same class representing the result of the operation, leaving the original operands unmodified.

Parameters:

value (Self) – Another instance of the same class to perform the OR operation with.

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 ModifiedConcreteConcept that replicates the state of the current object. The new object is initialized using the existing values of the name, modifier, and modified attributes. This operation performs a shallow copy, meaning that while the instance itself is distinct, any mutable attributes will be shared by reference between the original and the clone. The method has no side effects on the original instance.

Returns:

A new instance of the class initialized with the same name, modifier, and modified values as the current object.

Return type:

Self

compute_name() str

Generates a formatted string representation of the concept’s name by combining the modifier and modified attributes. The output follows the specific pattern “modified(modifier modified)”, utilizing the string conversion of the underlying attribute values. This method is read-only and does not alter the state of the object, though it assumes that the modifier and modified attributes are defined.

Returns:

A string formatted as “modified({modifier} {modified})”, incorporating the object’s modifier and modified attributes.

Return type:

str

get_membership_degree(x: float) float

Calculates the membership degree of a value x by composing the membership functions of a base concept and a modifier. If the input x is less than or equal to 0.0 or greater than 1.0, the method returns 0.0, treating values outside this interval as having no membership. For valid inputs, it first computes the membership degree of x using the modified object and then passes that result to the modifier object to determine the final, transformed membership degree.

Parameters:

x (float) – The input value for which the membership degree is calculated. Values outside the range (0, 1] result in a degree of 0.0.

Returns:

The membership degree of the input value x, calculated by applying the modifier to the membership degree of the modified set. Returns 0.0 if x is outside the range (0, 1].

Return type:

float

_modified: fuzzy_dl_owl2.fuzzydl.concept.concrete.fuzzy_concrete_concept.FuzzyConcreteConcept
_modifier: fuzzy_dl_owl2.fuzzydl.modifier.modifier.Modifier
k1: float = 0.0
k2: float = 1.0
property modified: fuzzy_dl_owl2.fuzzydl.concept.concrete.fuzzy_concrete_concept.FuzzyConcreteConcept

Returns the underlying fuzzy concrete concept that this modified concept wraps and whose membership degrees are transformed by the modifier. The value is read from the private _modified attribute without modifying the instance.

Returns:

The wrapped concrete concept being modified.

Return type:

FuzzyConcreteConcept

property modifier: fuzzy_dl_owl2.fuzzydl.modifier.modifier.Modifier

Returns the fuzzy modifier (e.g. “very”, “somewhat”) applied to the wrapped concrete concept. The modifier transforms the membership degrees produced by the underlying concept. The value is read from the private _modifier attribute without modifying the instance.

Returns:

The modifier applied to the wrapped concept.

Return type:

Modifier