fuzzy_dl_owl2.fuzzydl.concept.sigma_concept

A class representing a sigma-count construct within fuzzy description logic that evaluates the cardinality of related individuals against a fuzzy concrete domain.

Description

The implementation extends the base Concept class to model a specific fuzzy logic constraint where satisfaction depends on the number of related individuals belonging to a target concept. By combining a binary role, a reference set of individuals, and a fuzzy concrete domain concept, it defines a complex condition that evaluates the cardinality of relationships within a fuzzy context. To facilitate logical reasoning, the class overrides standard operators to support negation, conjunction, and disjunction, delegating the construction of these composite expressions to a dedicated operator handler. Structural integrity is maintained through a deep cloning mechanism and a custom hashing implementation that relies on the internal components, ensuring that instances behave correctly when used in collections or complex logical structures.

Classes

SigmaConcept

This class models a sigma-count construct within fuzzy description logic, defining a concept that is satisfied based on the cardinality of related individuals. Specifically, it evaluates whether the number of individuals reachable via a specific role that also belong to a given concept falls within a fuzzy concrete domain relative to a specified set of reference individuals. To utilize this class, instantiate it by providing a role string, a target concept, a list of individual objects, and a fuzzy concrete concept. The object automatically generates a string representation for its name and provides methods to access its components, clone itself deeply, and participate in logical operations such as negation, conjunction, and disjunction.

Module Contents

UML Class Diagram for SigmaConcept

UML Class Diagram for SigmaConcept

class SigmaConcept(
concept: fuzzy_dl_owl2.fuzzydl.concept.concept.Concept,
role: str,
individuals: list[fuzzy_dl_owl2.fuzzydl.individual.individual.Individual],
concrete_concept: fuzzy_dl_owl2.fuzzydl.concept.concrete.fuzzy_concrete_concept.FuzzyConcreteConcept,
)

Bases: fuzzy_dl_owl2.fuzzydl.concept.concept.Concept

Inheritance diagram of fuzzy_dl_owl2.fuzzydl.concept.sigma_concept.SigmaConcept

This class models a sigma-count construct within fuzzy description logic, defining a concept that is satisfied based on the cardinality of related individuals. Specifically, it evaluates whether the number of individuals reachable via a specific role that also belong to a given concept falls within a fuzzy concrete domain relative to a specified set of reference individuals. To utilize this class, instantiate it by providing a role string, a target concept, a list of individual objects, and a fuzzy concrete concept. The object automatically generates a string representation for its name and provides methods to access its components, clone itself deeply, and participate in logical operations such as negation, conjunction, and disjunction.

Parameters:
  • concept (Concept) – The concept C that related individuals must be instances of to be counted in the sigma-count.

  • role (str) – The binary relation used in the sigma-count expression to identify the connections between individuals.

  • individuals (list[Individual]) – The list of individuals constituting the set {a1, a2, …, an} used as the reference context for evaluating the sigma-count concept.

  • concrete_concept (FuzzyConcreteConcept) – The fuzzy concrete concept used to evaluate the sigma-count of related individuals.

  • name (str) – Computed string representation of the sigma-count concept, automatically generated during initialization.

__and__(value: Self) Self

Implements the bitwise AND operation (&) for the SigmaConcept instance, allowing it to be combined with another instance of the same type. This method delegates the logic to OperatorConcept.and_, passing the current object and the provided value to compute the result. The operation returns a new instance representing the conjunction of the two concepts, leaving the original operands unmodified.

Parameters:

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

Returns:

A new instance representing the result of the AND operation between this 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.concept.Concept

Implements the unary negation operator to return the logical negation of the current concept. This allows the use of the minus sign (-) to invert the meaning of a SigmaConcept, resulting in a new Concept that represents the logical NOT operation applied to the original instance. The method delegates the actual construction of the negated concept to the OperatorConcept.not_ factory method.

Returns:

A new Concept representing the logical negation of the current instance.

Return type:

Concept

__or__(value: Self) Self

Implements the bitwise OR operator (|) to combine the current concept with another instance of the same type. This method delegates the logic to OperatorConcept.or_, effectively creating a new concept that represents the logical disjunction or union of the two operands. It ensures type consistency by returning an instance of the same class as the inputs.

Parameters:

value (Self) – The right-hand operand 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 deep copy of the current SigmaConcept instance. To ensure the new object is independent of the original, the method recursively clones the concept, concrete_concept, and every element within the individuals list. The role attribute is passed by reference to the new instance. This operation does not modify the original object.

Returns:

A new instance of the class that is a copy of the current object, with nested concepts, individuals, and concrete concepts also cloned.

Return type:

Self

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

Computes the set of atomic concepts associated with this SigmaConcept. In this specific implementation, the method returns an empty set, indicating that the concept does not decompose into atomic constituents or serving as a default stub for subclasses. The operation is side-effect free and generates a new set instance upon each call.

Returns:

A set of atomic concepts.

Return type:

set[Concept]

compute_name() str | None

Constructs and returns a string representation of the sigma concept using a specific parenthesized syntax. The format follows the pattern (sigma-count role concept {individuals} concrete_concept), where the list of individuals is converted to strings, joined by spaces, and enclosed in curly braces. This method relies on the current values of the role, concept, individuals, and concrete_concept attributes without modifying them, resulting in a deterministic string output based on the object’s state. While the type hint indicates a potential return of None, the implementation consistently returns a formatted string, which may include literal “None” text if the underlying attributes are unset.

Returns:

A formatted string representing the sigma-count, constructed from the role, concept, individuals, and concrete concept.

Return type:

str | None

get_concept() fuzzy_dl_owl2.fuzzydl.concept.concept.Concept

Retrieves the underlying Concept instance associated with this SigmaConcept object. This method acts as a simple accessor, returning the value stored in the concept attribute without modifying the state of the SigmaConcept instance. Note that because it returns a direct reference to the internal object, any mutations made to the returned Concept will be reflected in the original instance.

Returns:

The Concept object associated with this instance.

Return type:

Concept

get_fuzzy_concept() fuzzy_dl_owl2.fuzzydl.concept.concrete.fuzzy_concrete_concept.FuzzyConcreteConcept

Retrieves the fuzzy concrete concept representation associated with this instance. This method acts as a simple accessor, returning the object stored in the concrete_concept attribute. It performs no computation or modification of state during the retrieval process.

Returns:

The FuzzyConcreteConcept instance stored in the concrete_concept attribute.

Return type:

FuzzyConcreteConcept

get_individuals() list[fuzzy_dl_owl2.fuzzydl.individual.individual.Individual]

Returns the list of Individual entities currently associated with this SigmaConcept instance. This method provides direct access to the underlying list attribute, allowing callers to inspect the collection. Note that because the reference is returned directly, any modifications made to the list (such as adding or removing elements) will immediately affect the internal state of the SigmaConcept object.

Returns:

The list of Individual objects associated with this instance.

Return type:

list[Individual]

get_role() str

Retrieves the role associated with the SigmaConcept instance. This accessor method returns the value of the internal role attribute without modifying the object’s state. The method assumes the attribute has been initialized; otherwise, an AttributeError will be raised.

Returns:

The role associated with the instance.

Return type:

str

get_roles() set[str]

Retrieves the set of role identifiers associated with the concept instance. The current implementation returns an empty set, serving as a default behavior for subclasses or instances where no specific roles are defined. This method has no side effects and returns a new set object on every call.

Returns:

A set of strings representing the roles.

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

Returns the current instance unchanged, acting as an identity function within the replacement operation. Although the method signature implies a substitution of concept a with concept c, the implementation indicates that SigmaConcept is treated as an atomic or terminal entity that does not contain sub-components subject to this transformation. As a result, the method has no side effects and returns the original object regardless of the arguments provided.

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

  • c (Concept) – The concept to replace the original concept with.

Returns:

Returns the current instance.

Return type:

Concept

concept: fuzzy_dl_owl2.fuzzydl.concept.concept.Concept
concrete_concept: fuzzy_dl_owl2.fuzzydl.concept.concrete.fuzzy_concrete_concept.FuzzyConcreteConcept
individuals: list[fuzzy_dl_owl2.fuzzydl.individual.individual.Individual]
name: str
role: str