fuzzy_dl_owl2.fuzzyowl2.util.constants

Establishes a centralized vocabulary of fuzzy logic concept types and parsing tokens for the FuzzyOWL2 framework.

Description

The ConceptType enumeration categorizes various fuzzy constructs, such as aggregation operators like Sugeno and Choquet integrals, alongside weighted operations and structural modifications, acting as a type discriminator to ensure correct semantic application during ontology processing. Simultaneously, the FuzzyOWL2Keyword class maps specific language tokens—including logic operators, modifiers, and XML-like tags—to their corresponding pyparsing definitions, effectively bridging the gap between the abstract syntax of the fuzzy ontology language and the concrete parsing logic required to process it. By encapsulating parser objects within an enumeration, the design provides a single source of truth for grammar definitions while offering utility methods to normalize string representations and handle flexible equality comparisons. These constants serve as foundational building blocks for the broader system, allowing other components to reference fuzzy logic operators and structural elements reliably without hardcoding string literals or parser definitions throughout the codebase.

Classes

ConceptType

This enumeration categorizes the various types of fuzzy concepts utilized within the FuzzyOWL2 framework. Extending StrEnum, it provides a set of string-based identifiers that distinguish between different fuzzy logic constructs, such as aggregation operators (e.g., Sugeno, Choquet, OWA), weighted operations (e.g., Weighted Sum, Weighted Min), and structural modifications (e.g., Modified Concept, Fuzzy Nominal). It serves as a type discriminator for concept definitions, ensuring that specific fuzzy semantics are correctly applied during ontology processing.

FuzzyOWL2Keyword

This enumeration defines the specific vocabulary and structural tokens used in the FuzzyOWL2 language, mapping semantic concepts such as fuzzy logic operators, modifiers, and XML-like tags to their corresponding pyparsing definitions. It serves as a centralized registry for constructing grammars or validating syntax, where each member encapsulates a parser object that recognizes a specific keyword or symbol. The class provides utility methods to extract the string representation or the underlying parser object, and it overrides the equality comparison to allow flexible matching against raw strings, parser keywords, or other enum members based on the normalized token name.

Module Contents

UML Class Diagram for ConceptType

UML Class Diagram for ConceptType

class ConceptType[source]

Bases: enum.StrEnum

Inheritance diagram of fuzzy_dl_owl2.fuzzyowl2.util.constants.ConceptType

This enumeration categorizes the various types of fuzzy concepts utilized within the FuzzyOWL2 framework. Extending StrEnum, it provides a set of string-based identifiers that distinguish between different fuzzy logic constructs, such as aggregation operators (e.g., Sugeno, Choquet, OWA), weighted operations (e.g., Weighted Sum, Weighted Min), and structural modifications (e.g., Modified Concept, Fuzzy Nominal). It serves as a type discriminator for concept definitions, ensuring that specific fuzzy semantics are correctly applied during ontology processing.

Parameters:
  • CHOQUET (Any) – Represents a concept defined using the Choquet integral aggregation operator.

  • FUZZY_NOMINAL (Any) – Represents a concept defined by a fuzzy nominal, typically involving specific individuals or enumerated values with fuzzy membership degrees.

  • MODIFIED_CONCEPT (Any) – Represents a concept that has been modified by a specific function or hedge.

  • OWA (Any) – Represents a concept defined using the Ordered Weighted Averaging (OWA) aggregation operator.

  • QUANTIFIED_OWA (Any) – Represents a concept type that employs Quantified Ordered Weighted Averaging (OWA) aggregation.

  • QUASI_SUGENO (Any) – Represents a concept defined using the Quasi-Sugeno fuzzy integral.

  • SUGENO (Any) – Represents a concept defined using the Sugeno integral.

  • WEIGHTED_CONCEPT (Any) – Represents a concept that is associated with a specific weight, serving as a fundamental element for weighted aggregation operations.

  • WEIGHTED_MAX (Any) – Represents a fuzzy concept defined using the weighted maximum aggregation operator.

  • WEIGHTED_MIN (Any) – Represents a fuzzy concept defined using the weighted minimum aggregation operator.

  • WEIGHTED_SUM (Any) – Represents a concept defined by the weighted sum aggregation operator.

  • WEIGHTED_SUM_ZERO (Any) – Represents a concept type defined by a weighted sum aggregation with a zero-sum constraint.

__repr__() str[source]

Returns the official string representation of the ConceptType instance. This implementation returns the value of the object’s ‘name’ attribute directly, providing a concise and human-readable identifier for the concept. The method has no side effects and relies solely on the current state of the ‘name’ attribute.

Returns:

A string representation of the object, corresponding to its name.

Return type:

str

__str__() str[source]

Returns a human-readable string representation of the instance, which is primarily used for display purposes or when the object is converted to a string. This implementation specifically returns the value of the name attribute associated with the ConceptType instance, providing a concise identifier rather than a detailed structural representation.

Returns:

The name of the object.

Return type:

str

CHOQUET
FUZZY_NOMINAL
MODIFIED_CONCEPT
OWA
QUANTIFIED_OWA
QUASI_SUGENO
SUGENO
WEIGHTED_CONCEPT
WEIGHTED_MAX
WEIGHTED_MIN
WEIGHTED_SUM
WEIGHTED_SUM_ZERO
UML Class Diagram for FuzzyOWL2Keyword

UML Class Diagram for FuzzyOWL2Keyword

class FuzzyOWL2Keyword(*args, **kwds)[source]

Bases: enum.Enum

Inheritance diagram of fuzzy_dl_owl2.fuzzyowl2.util.constants.FuzzyOWL2Keyword

This enumeration defines the specific vocabulary and structural tokens used in the FuzzyOWL2 language, mapping semantic concepts such as fuzzy logic operators, modifiers, and XML-like tags to their corresponding pyparsing definitions. It serves as a centralized registry for constructing grammars or validating syntax, where each member encapsulates a parser object that recognizes a specific keyword or symbol. The class provides utility methods to extract the string representation or the underlying parser object, and it overrides the equality comparison to allow flexible matching against raw strings, parser keywords, or other enum members based on the normalized token name.

Parameters:
  • OPEN_TAG (Any) – Parser element representing the opening angle bracket delimiter used in FuzzyOWL2 syntax.

  • CLOSE_TAG (Any) – Pyparsing element that matches the closing angle bracket character used to terminate tags.

  • SINGLE_CLOSE_TAG (Any) – Represents the self-closing tag delimiter ‘/>’ used in FuzzyOWL2 syntax.

  • SLASH (Any) – Parser element representing the forward slash character used in FuzzyOWL2 syntax.

  • ONTOLOGY (Any) – Parser element for the ‘ontology’ keyword.

  • FUZZY_OWL_2 (Any) – Keyword representing the ‘fuzzyOwl2’ identifier.

  • FUZZY_LABEL (Any) – Parser keyword for the ‘fuzzyLabel’ token used in FuzzyOWL2 syntax.

  • FUZZY_TYPE (Any) – Parser token for the “fuzzyType” keyword used to specify the type of fuzzy logic or set.

  • FUZZY_LOGIC (Any) – Keyword representing the “FuzzyLogic” token used to define or specify the fuzzy logic system within the ontology.

  • TYPE (Any) – Keyword representing the ‘type’ token in FuzzyOWL2 syntax.

  • LOGIC (Any) – Keyword matching the ‘logic’ token used to define the fuzzy logic type.

  • DATATYPE (Any) – Parser element matching the ‘datatype’ keyword in FuzzyOWL2 syntax.

  • CONCEPT (Any) – Parser element matching the ‘concept’ keyword in FuzzyOWL2 syntax.

  • ROLE (Any) – Keyword identifying a role (object property) in FuzzyOWL2 syntax.

  • AXIOM (Any) – Keyword representing the ‘axiom’ construct in FuzzyOWL2 syntax.

  • DEGREE_DEF (Any) – Keyword used to define the degree of truth or membership in fuzzy axioms.

  • DEGREE_VALUE (Any) – Keyword representing the specific value associated with a fuzzy degree definition.

  • MODIFIED (Any) – Represents the ‘modified’ keyword used in the FuzzyOWL2 syntax.

  • WEIGHTED (Any) – Keyword token representing the ‘weighted’ identifier in FuzzyOWL2 syntax.

  • NOMINAL (Any) – Keyword representing the ‘nominal’ construct in FuzzyOWL2 syntax.

  • INDIVIDUAL (Any) – Keyword representing an individual in the FuzzyOWL2 syntax.

  • WEIGHTED_MAXIMUM (Any) – Keyword representing the weighted maximum aggregation operator in FuzzyOWL2 syntax.

  • WEIGHTED_MINIMUM (Any) – Keyword representing the weighted minimum operator in FuzzyOWL2 syntax.

  • WEIGHTED_SUM (Any) – Keyword for the weighted sum operator in FuzzyOWL2.

  • WEIGHTED_SUMZERO (Any) – Keyword for the weighted sum zero aggregation operator.

  • OWA (Any) – Keyword representing the Ordered Weighted Averaging (OWA) aggregation operator.

  • Q_OWA (Any) – Represents the ‘qowa’ keyword used for Quantified Ordered Weighted Averaging operations.

  • CHOQUET (Any) – Keyword representing the Choquet integral aggregation operator.

  • SUGENO (Any) – Keyword representing the Sugeno fuzzy integral or aggregation operator.

  • QUASI_SUGENO (Any) – Keyword representing the Quasi-Sugeno fuzzy integral or operator.

  • MODIFIER (Any) – Keyword representing the ‘modifier’ construct in FuzzyOWL2 syntax.

  • BASE (Any) – Keyword representing the ‘base’ component, used to specify the underlying concept or type in fuzzy definitions.

  • CONCEPT_NAMES (Any) – Keyword representing the ‘names’ identifier used to denote concept names within the FuzzyOWL2 syntax.

  • NAME (Any) – Keyword representing the literal string ‘name’ used in FuzzyOWL2 syntax.

  • WEIGHT (Any) – Keyword representing the ‘weight’ identifier used in weighted fuzzy logic constructs.

  • WEIGHTS (Any) – Keyword for the ‘weights’ identifier used to specify a collection of weight values in FuzzyOWL2 syntax.

  • QUANTIFIER (Any) – Keyword representing the ‘quantifier’ token in FuzzyOWL2 syntax.

  • CRISP (Any) – Keyword used to denote a crisp (non-fuzzy) element or logic type within the FuzzyOWL2 ontology.

  • LEFT_SHOULDER (Any) – Keyword representing a left shoulder membership function shape.

  • RIGHT_SHOULDER (Any) – Keyword representing the ‘rightshoulder’ shape for a fuzzy membership function.

  • TRIANGULAR (Any) – Keyword for the triangular membership function shape.

  • TRAPEZOIDAL (Any) – Keyword representing the trapezoidal membership function type.

  • LINEAR (Any) – Represents the ‘linear’ keyword used to define linear membership functions or types.

  • A (Any) – Keyword representing the ‘a’ parameter used in defining fuzzy membership function shapes (e.g., triangular or trapezoidal).

  • B (Any) – Represents the keyword for the ‘b’ parameter, commonly used in defining fuzzy membership functions such as triangular or trapezoidal shapes.

  • C (Any) – Keyword representing the third parameter (‘c’) used to define the shape of fuzzy membership functions, such as triangular or trapezoidal shapes.

  • D (Any) – Keyword representing the ‘d’ parameter, typically used as the fourth coordinate defining the right endpoint of a trapezoidal fuzzy membership function.

  • LUKASIEWICZ (Any) – Keyword representing the Łukasiewicz fuzzy logic type.

  • GOEDEL (Any) – Keyword representing the Gödel fuzzy logic type.

  • ZADEH (Any) – Keyword representing the Zadeh fuzzy logic type, which uses standard min and max operators.

  • PRODUCT (Any) – Keyword representing the “product” t-norm logic operator used in FuzzyOWL2 expressions.

  • EQUAL (Any) – The equals sign symbol used in FuzzyOWL2 syntax.

  • LES (Any) – Represents the ‘les’ keyword used for strict less-than comparisons.

  • LEQ (Any) – Keyword representing the less-than-or-equal-to comparison operator.

  • GEQ (Any) – Keyword representing the “greater than or equal to” comparison operator.

  • GRE (Any) – Keyword representing the “greater than” comparison operator.

Raises:

NotImplementedError – Raised when attempting to compare the keyword with an object of an unsupported type (i.e., not a string, pyparsing Keyword, or another FuzzyOWL2Keyword).

__eq__(value: object) bool[source]

Determines equality between the current keyword instance and a provided value by comparing their underlying names. The method supports comparison against string literals, pyparsing Keyword objects, or other FuzzyOWL2Keyword instances, performing a case-insensitive check in all cases. If the provided value is not one of these supported types, a NotImplementedError is raised.

Parameters:

value (object) – The object to compare against, which can be a string (case-insensitive), a pp.Keyword, or another FuzzyOWL2Keyword instance.

Raises:

NotImplementedError – Raised when the provided value is not a string, pp.Keyword, or FuzzyOWL2Keyword instance.

Returns:

True if the keyword name matches the provided value, False otherwise. Supports comparison against strings, pp.Keyword, and FuzzyOWL2Keyword objects.

Return type:

bool

__repr__() str[source]

Returns the official string representation of the FuzzyOWL2Keyword instance by directly returning the value of its ‘name’ attribute. This implementation provides a concise and readable identifier for the object, which is particularly useful for debugging and logging purposes. The method assumes that the ‘name’ attribute is present and holds a string value; if the attribute is missing or of an incompatible type, the behavior may deviate from the standard expectation of returning a valid string representation.

Returns:

The string representation of the object, corresponding to the value of its name attribute.

Return type:

str

__str__() str[source]

Returns the informal string representation of the FuzzyOWL2Keyword instance, typically used for display or logging purposes. The method simply retrieves and returns the value stored in the instance’s name attribute. This operation is read-only and does not modify the state of the object, though it relies on the name attribute being present.

Returns:

Returns the string representation of the object, which is its name.

Return type:

str

get_name() str[source]

Retrieves a normalized version of the keyword’s name by converting it to lowercase and stripping all single and double quotation marks. This transformation ensures that variations in casing or quoting are standardized for comparison or processing. The method performs a read-only operation on the underlying value’s name attribute and returns the cleaned string without modifying the original state.

Returns:

The lowercase name with all single and double quotes removed.

Return type:

str

get_str_value() str[source]

Converts the internal value to its string representation and removes all occurrences of both single and double quotes. This process ensures the returned string is sanitized of quote characters, which is useful for serialization or embedding the value in contexts where quotes might cause parsing errors. Note that this method strips quotes from anywhere within the string, not just the boundaries, and does not modify the original value attribute.

Returns:

A string representation of the internal value with all single and double quotes removed.

Return type:

str

get_tag_name() str[source]

Returns a capitalized string representation of the keyword, formatted for use as a tag name. This method retrieves the underlying string value via get_str_value and applies standard capitalization, converting the first character to uppercase and the remaining characters to lowercase. The operation is stateless and does not modify the object, relying entirely on the current output of the internal string value retrieval.

Returns:

The tag name as a capitalized string.

Return type:

str

get_value() pyparsing.CaselessKeyword | pyparsing.Word[source]

Retrieves the underlying parser element associated with this keyword instance. The returned value is a pyparsing object, specifically either a CaselessKeyword or a Word, which defines the matching pattern for the keyword in a grammar. This method acts as a simple accessor and does not modify the internal state of the object or perform any computation beyond returning the stored attribute.

Returns:

Returns the pyparsing token (either a CaselessKeyword or a Word) associated with this instance.

Return type:

Union[pp.CaselessKeyword, pp.Word]

A
AXIOM
B
BASE
C
CHOQUET
CLOSE_TAG
CONCEPT
CONCEPT_NAMES
CRISP
D
DATATYPE
DEGREE_DEF
DEGREE_VALUE
EQUAL
FUZZY_LABEL
FUZZY_LOGIC
FUZZY_OWL_2
FUZZY_TYPE
GEQ
GOEDEL
GRE
INDIVIDUAL
LEFT_SHOULDER
LEQ
LES
LINEAR
LOGIC
LUKASIEWICZ
MODIFIED
MODIFIER
NAME
NOMINAL
ONTOLOGY
OPEN_TAG
OWA
PRODUCT
QUANTIFIER
QUASI_SUGENO
Q_OWA
RIGHT_SHOULDER
ROLE
SINGLE_CLOSE_TAG
SLASH
SUGENO
TRAPEZOIDAL
TRIANGULAR
TYPE
WEIGHT
WEIGHTED
WEIGHTED_MAXIMUM
WEIGHTED_MINIMUM
WEIGHTED_SUM
WEIGHTED_SUMZERO
WEIGHTS
ZADEH