fuzzy_dl_owl2.fuzzydl.concept.sigma_concept

A class representing a sigma-count construct within fuzzy description logic that evaluates concepts based on the cardinality of related individuals.

Description

The implementation models a specialized construct known as a sigma-count, which determines satisfaction by counting the number of individuals reachable via a specific role that also belong to a target concept. It encapsulates a binary role, a target concept definition, a collection of reference individuals, and a fuzzy concrete concept that defines the evaluation criteria within a fuzzy logic framework. By inheriting from the base Concept class, the implementation integrates seamlessly into the broader description logic system, providing mechanisms for deep cloning and generating a standardized string representation of the complex logical structure. Logical operations such as negation, conjunction, and disjunction are supported through delegation to an OperatorConcept utility, allowing these instances to participate in complex logical expressions while maintaining their specific semantic identity. The design treats the construct as an atomic entity for replacement operations and relies on its string representation for hashing, ensuring consistent behavior when used in collections.

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,
)[source]

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[source]

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[source]

Returns an integer hash value for the instance based on its string representation, enabling the object to be used as a dictionary key or stored in a set. The implementation delegates the hashing logic to the built-in hash function applied to the result of str(self), which implies that the object should be treated as immutable or that its string representation must remain constant to maintain consistent behavior within hash-based collections.

Returns:

An integer hash value based on the string representation of the object.

Return type:

int

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

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[source]

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[source]

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][source]

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[source]

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[source]

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[source]

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][source]

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[source]

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][source]

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[source]

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

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.

role: str