fuzzy_dl_owl2.fuzzydl.concept.self_concept

Implements a self-referential concept construct within fuzzy description logic that requires an individual to be related to itself through a specified role.

Description

The software provides a mechanism to model reflexive relationships within a fuzzy description logic framework, specifically capturing scenarios where an entity must satisfy a relationship with itself. By inheriting from a base concept class and a role-handling interface, the implementation ensures that the entity is treated as an atomic unit while still carrying the semantic weight of the specific role involved. Logical operations such as conjunction, disjunction, and negation are supported through delegation to a central operator handler, allowing these self-referential constructs to be seamlessly integrated into complex logical expressions. Additionally, the design includes functionality for cloning, role retrieval, and standardized string formatting, which facilitates consistent identification and hashing within the broader system.

Classes

SelfConcept

Represents a self-referential concept within fuzzy description logic, specifically denoting that an individual satisfies a relationship with itself through a given role. This construct is essential for expressing reflexivity or local reflexivity properties, where an entity must be linked to itself via the specified role to satisfy the concept. To utilize this class, instantiate it by providing the specific role name as a string, which will automatically generate a standardized string representation. Once created, it behaves as an atomic concept that can be combined with other concepts using logical operators such as conjunction, disjunction, and negation, and it supports cloning and role retrieval operations.

Module Contents

UML Class Diagram for SelfConcept

UML Class Diagram for SelfConcept

class SelfConcept(role: str)[source]

Bases: fuzzy_dl_owl2.fuzzydl.concept.concept.Concept, fuzzy_dl_owl2.fuzzydl.concept.interface.has_role_interface.HasRoleInterface

Inheritance diagram of fuzzy_dl_owl2.fuzzydl.concept.self_concept.SelfConcept

Represents a self-referential concept within fuzzy description logic, specifically denoting that an individual satisfies a relationship with itself through a given role. This construct is essential for expressing reflexivity or local reflexivity properties, where an entity must be linked to itself via the specified role to satisfy the concept. To utilize this class, instantiate it by providing the specific role name as a string, which will automatically generate a standardized string representation. Once created, it behaves as an atomic concept that can be combined with other concepts using logical operators such as conjunction, disjunction, and negation, and it supports cloning and role retrieval operations.

Parameters:

name (Any) – The canonical string representation of the concept, formatted as “(self role)”.

__and__(value: Self) Self[source]

Performs a logical conjunction between the current concept and another provided concept, enabling the use of the bitwise AND operator (&) to combine them. This method returns a new instance representing the intersection or combination of the two operands, leaving the original concepts unmodified. The actual logic is delegated to OperatorConcept.and_, which handles the specifics of the conjunction operation. While the method expects a value of the same type, specific behaviors regarding incompatible inputs or contradictory concepts are determined by the underlying operator implementation.

Parameters:

value (Self) – The right-hand operand for the AND operation.

Returns:

The result of the bitwise AND operation between this instance and the provided value.

Return type:

Self

__hash__() int[source]

Computes an integer hash value for the object based on its string representation. By delegating to the hash of str(self), this method ensures that the hash is consistent with the object’s textual output, allowing instances to be used as dictionary keys or stored in sets. This implementation implies that the hashability of the object is directly tied to the stability and uniqueness of its string representation.

Returns:

An integer representing the hash of the object’s string representation.

Return type:

int

__neg__() fuzzy_dl_owl2.fuzzydl.concept.concept.Concept[source]

Implements the unary negation operator for the concept, allowing the use of the minus sign (-) to represent logical negation. This method returns a new Concept instance that serves as the logical complement of the current object by delegating the operation to OperatorConcept.not_. The original concept remains unmodified, as the operation produces a distinct entity representing the ‘not’ state.

Returns:

A new Concept representing the logical negation (NOT) of the current concept.

Return type:

Concept

__or__(value: Self) Self[source]

Implements the bitwise OR operator (|) to perform a logical disjunction or union between the current concept and another concept of the same type. This method delegates the actual computation to OperatorConcept.or_, ensuring consistent handling of the operation logic. It returns a new instance representing the combined concept, leaving the original operands unmodified. If the provided value is not a compatible concept, the underlying implementation may raise a TypeError.

Parameters:

value (Self) – The right-hand operand to combine with the current instance using the OR operation.

Returns:

A new instance representing the logical OR of the current instance and the provided value.

Return type:

Self

clone()[source]

Creates and returns a new SelfConcept instance that duplicates the current object, initialized with the same role attribute. This method performs a shallow copy of the object’s state, meaning the new instance shares the reference to the original role object if it is mutable. The operation has no side effects on the original instance.

compute_atomic_concepts() set[fuzzy_dl_owl2.fuzzydl.concept.concept.Concept][source]

Computes and returns the set of atomic concepts that constitute this entity. By returning a set containing only the instance itself, the method indicates that this concept is atomic and cannot be decomposed into smaller constituent concepts. The operation is stateless and has no side effects, as it merely constructs and returns a new set containing the current object.

Returns:

A set containing the concept itself.

Return type:

set[Concept]

compute_name() str | None[source]

Constructs and returns a string representation of the self-concept by embedding the instance’s role into a specific format. The output follows the pattern ‘(self {role})’, where the placeholder is replaced by the value of the role attribute. This method performs a read-only operation and assumes the role attribute is accessible on the instance.

Returns:

A string representing the computed name, formatted as “(self {role})”.

Return type:

Optional[str]

get_roles() set[str][source]

Retrieves the specific role assigned to the instance and returns it as a set containing a single string element. This method encapsulates the internal role attribute, ensuring the return type is always a collection for consistency with other methods that may handle multiple roles. The function has no side effects on the instance’s state, and because it returns a new set object, any modifications made to the result will not impact the original data.

Returns:

A set containing the role associated with the instance.

Return type:

set[str]

replace(
a: fuzzy_dl_owl2.fuzzydl.concept.concept.Concept,
c: fuzzy_dl_owl2.fuzzydl.concept.concept.Concept,
) fuzzy_dl_owl2.fuzzydl.concept.concept.Concept[source]

Returns the current instance unchanged, acting as a base case for replacement operations. Since a SelfConcept does not contain nested or child concepts, there are no internal structures to substitute. The method ignores the source and replacement concepts provided as arguments and simply returns the object itself.

Parameters:
  • a (Concept) – The concept to be replaced.

  • c (Concept) – The concept to substitute for a.

Returns:

Returns the instance itself.

Return type:

Concept

static self(role: str) Self[source]

This static method acts as a factory function for creating new instances of the SelfConcept class. It accepts a single string argument representing the role, which is passed directly to the class constructor during initialization. The method returns a new SelfConcept object configured with the provided role.

Parameters:

role (str) – The role or persona defining the self-concept.

Returns:

A new instance of the class representing the self concept for the specified role.

Return type:

Self

name

Updates the name of the Concept instance to the specified string value. This setter modifies the object’s internal state by assigning the provided value to the private _name attribute, effectively replacing any previously stored name.

Parameters:

value (str) – The new name to assign to the object.