fuzzy_dl_owl2.fuzzydl.concept.negated_nominal

Defines a class representing the logical complement of a named individual within a fuzzy description logic framework.

Description

The software models a specific type of concept that represents the exclusion of a particular named individual from a domain, often utilized in range restrictions. By inheriting from the base Concept class, it establishes itself as an atomic concept type while storing the identifier of the individual being negated and generating a standardized string representation for that exclusion. Logical operations such as conjunction and disjunction are supported through delegation to an OperatorConcept utility, allowing these negated nominals to participate in complex expressions. However, the implementation enforces a strict constraint against double negation, raising an exception if an attempt is made to complement an already negated nominal, thereby preserving the integrity of the logical structure. Additionally, the implementation includes mechanisms for cloning instances and generating hash values based on structural identity to facilitate use in collections and comparisons.

Classes

NegatedNominal

This class models a negated nominal concept within the framework of fuzzy description logic, specifically representing the complement of a named individual. It is designed to express constraints that exclude specific individuals from a domain, often utilized in range restrictions. To use it, instantiate the object with the name of the individual to be negated; the class automatically generates a standardized string representation for this exclusion. While it supports logical operations like conjunction and disjunction, it enforces a strict limitation where further negation is prohibited, raising an exception if such an operation is attempted.

Module Contents

UML Class Diagram for NegatedNominal

UML Class Diagram for NegatedNominal

class NegatedNominal(ind_name: str)

Bases: fuzzy_dl_owl2.fuzzydl.concept.concept.Concept

Inheritance diagram of fuzzy_dl_owl2.fuzzydl.concept.negated_nominal.NegatedNominal

This class models a negated nominal concept within the framework of fuzzy description logic, specifically representing the complement of a named individual. It is designed to express constraints that exclude specific individuals from a domain, often utilized in range restrictions. To use it, instantiate the object with the name of the individual to be negated; the class automatically generates a standardized string representation for this exclusion. While it supports logical operations like conjunction and disjunction, it enforces a strict limitation where further negation is prohibited, raising an exception if such an operation is attempted.

Parameters:
  • _ind_name (str) – Internal storage for the identifier of the individual being negated, serving as the backing field for the public property.

  • name (str) – The canonical string representation of the negated nominal, formatted as “(not { ind_name } )”.

Raises:

FuzzyOntologyException – Raised when attempting to apply the negation operator to a NegatedNominal instance, as nested negation of nominals is not supported in fuzzy description logic.

__and__(value: Self) Self

Implements the bitwise AND operation (&) for the NegatedNominal class, enabling logical conjunction between two instances. This method accepts another NegatedNominal object as the right-hand operand and delegates the actual computation to the OperatorConcept.and_ static method. The operation returns a new instance of NegatedNominal representing the result of the conjunction, ensuring type consistency with the operands.

Parameters:

value (Self) – The other operand to perform the AND operation with, expected to be of the same type as the current instance.

Returns:

The result of the logical AND operation between this instance 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__() Self

Implements the unary negation operation for the nominal. However, since the instance already represents a negated concept, applying a further complement is not permitted by the underlying logic. Consequently, this method always raises a FuzzyOntologyException to enforce the constraint that negated nominals cannot be complemented.

Raises:

FuzzyOntologyException – Raised when attempting to negate a negated nominal, as negated nominals cannot be complemented.

Returns:

Raises FuzzyOntologyException indicating that negated nominals cannot be complemented.

Return type:

Self

__or__(value: Self) Self

Implements the bitwise OR operator (|) to combine the current instance with another NegatedNominal object. This method delegates the combination logic to OperatorConcept.or_, returning a new instance that represents the union or logical disjunction of the two operands. The operation is side-effect free, as it generates a new object rather than modifying the existing instances.

Parameters:

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

Returns:

Returns the result of the OR operation between this instance and the provided value.

Return type:

Self

clone() Self

Creates and returns a new instance of NegatedNominal that is a copy of the current object. The new instance is initialized with the same ind_name attribute as the original, ensuring logical equivalence while maintaining object identity separation. This method does not modify the existing instance or have any side effects on the original object’s state.

Returns:

A new instance of NegatedNominal initialized with the same individual name as the current object.

Return type:

Self

compute_name() str | None

Retrieves the name associated with the NegatedNominal instance. This method returns the value of the name attribute, which may be a string or None if no name has been assigned. It serves as a direct accessor without performing additional computation or modification of the instance state.

Returns:

The name associated with the instance, or None if it is not set.

Return type:

str | None

_ind_name: str
property ind_name: str

Returns the name of the individual that this negated nominal excludes, i.e. the a in the concept (not {a}). The value is read from the private _ind_name attribute without modifying the instance.

Returns:

The name of the excluded individual.

Return type:

str

name: str