fuzzy_dl_owl2.fuzzydl.query.min.min_subsumes_query
A query mechanism that determines the minimum degree of subsumption between two fuzzy concepts within a knowledge base by solving a mixed-integer linear programming problem.
Description
Software designed to compute the infimum truth value of a subsumption relationship between two concepts in a fuzzy description logic setting. It supports multiple fuzzy logic operators, including Łukasiewicz, Gödel, Kleene-Dienes, and Zadeh, translating the subsumption assertion into a corresponding logical implication for the selected logic. The reasoning process leverages mixed-integer linear programming to minimize the degree of implication, introducing specific variables and constraints to model the fuzzy logic rules within the knowledge base. Performance optimizations are integrated to bypass complex calculations when the knowledge base is pre-classified and the concepts are atomic, allowing for direct retrieval of results from the classification hierarchy. If the ontology is inconsistent or requires full computation, the system clones the knowledge base, applies preprocessing to formulate the optimization problem, and returns the calculated solution or an inconsistency flag.
Classes
This class models a query designed to retrieve the minimum degree of subsumption between two fuzzy concepts within a knowledge base, effectively determining the infimum truth value of the assertion that one concept is subsumed by another. It supports various fuzzy logic operators—specifically Łukasiewicz, Gödel, Kleene-Dienes, and Zadeh—translating the subsumption relationship into the corresponding logical implication for the selected logic. To use this entity, one must instantiate it with the two concepts involved in the relationship and the desired logic operator type, and then invoke the solve method with a target knowledge base. The solving process is optimized: if the knowledge base is pre-classified and the concepts are atomic, the result is fetched directly from the classification hierarchy; otherwise, the system clones the knowledge base, formulates a mixed-integer linear programming problem to minimize the degree of the implication, and returns the computed solution or an inconsistency flag if the ontology is invalid. |
Module Contents
UML Class Diagram for MinSubsumesQuery
- class MinSubsumesQuery(
- c1: fuzzy_dl_owl2.fuzzydl.concept.concept.Concept,
- c2: fuzzy_dl_owl2.fuzzydl.concept.concept.Concept,
- type_: fuzzy_dl_owl2.fuzzydl.util.constants.LogicOperatorType,
Bases:
fuzzy_dl_owl2.fuzzydl.query.subsumption_query.SubsumptionQuery
This class models a query designed to retrieve the minimum degree of subsumption between two fuzzy concepts within a knowledge base, effectively determining the infimum truth value of the assertion that one concept is subsumed by another. It supports various fuzzy logic operators—specifically Łukasiewicz, Gödel, Kleene-Dienes, and Zadeh—translating the subsumption relationship into the corresponding logical implication for the selected logic. To use this entity, one must instantiate it with the two concepts involved in the relationship and the desired logic operator type, and then invoke the solve method with a target knowledge base. The solving process is optimized: if the knowledge base is pre-classified and the concepts are atomic, the result is fetched directly from the classification hierarchy; otherwise, the system clones the knowledge base, formulates a mixed-integer linear programming problem to minimize the degree of the implication, and returns the computed solution or an inconsistency flag if the ontology is invalid.
- __str__() str
Returns a human-readable string representation of the subsumption query, formatted to display the relationship between the two components involved. The output string follows the pattern ‘{c1} subsumes {c2} ? >= ‘, where {c1} and {c2} are the string representations of the corresponding attributes. This method is side-effect free and implicitly converts the internal attributes to strings, making it suitable for debugging and logging purposes.
- Returns:
A string representation of the object in the format ‘{c1} subsumes {c2} ? >= ‘.
- Return type:
str
- preprocess(kb: fuzzy_dl_owl2.fuzzydl.knowledge_base.KnowledgeBase) None
Prepares the knowledge base for a minimum subsumption query by translating the logical relationship into a constraint suitable for optimization. If the knowledge base is already classified, the method returns immediately to avoid redundant processing. It constructs a specific implication concept based on the configured logic operator (Lukasiewicz, Gödel, Zadeh, or Kleene-Dienes) to represent the subsumption of the second concept by the first. A new semi-continuous optimization variable is introduced to represent the degree of subsumption, and an assertion is added to the knowledge base linking this variable to the negation of the constructed concept. The method concludes by invoking the solver to process the new assertions and update the knowledge base state.
- Parameters:
kb (KnowledgeBase) – The knowledge base instance to be modified by adding new variables, assertions, and solving constraints related to the logical operator.
- solve(kb: fuzzy_dl_owl2.fuzzydl.knowledge_base.KnowledgeBase) fuzzy_dl_owl2.fuzzydl.milp.solution.Solution
Solves the minimum subsumption query by evaluating the provided Knowledge Base. If the ontology is inconsistent, the method returns a solution indicating inconsistency immediately. For classified knowledge bases involving atomic concepts, it attempts to resolve the query using pre-computed classification nodes, returning a certainty of 1.0 if one of the concepts is the top-level ‘Thing’ or utilizing subsumption flags otherwise. In the general case, the method creates a clone of the knowledge base—potentially solving or removing the ABox depending on configuration and the presence of nominals—applies preprocessing, and executes an optimization routine to determine the solution. Throughout the process, the method updates internal timing metrics to track execution duration.
- Parameters:
kb (KnowledgeBase) – The knowledge base containing the ontology definitions and assertions to be processed.
- Returns:
A Solution object containing the result of the reasoning task, which may be a subsumption flag, an optimization score, or an inconsistency indicator.
- Return type: