fuzzy_dl_owl2.fuzzydl.query.max.max_subsumes_query
A class that calculates the maximum degree to which one fuzzy concept is subsumed by another by formulating the problem as a mixed-integer linear programming optimization task.
Description
It extends the base subsumption query functionality to support various fuzzy logic semantics, including Łukasiewicz, Gödel, Kleene-Dienes, and Zadeh operators. The core mechanism involves transforming the logical subsumption relationship into an optimization problem where the objective is to minimize the degree of an implication assertion derived from the input concepts. During execution, the software clones the knowledge base to preserve the original state, creates a new individual to represent the implication, and configures the objective expression based on the specific logic operator selected. It handles potential inconsistencies in the ontology by catching exceptions and returning a specific solution status, while also managing performance metrics and the conditional solving of the ABox depending on configuration settings.
Classes
Represents a query to determine the maximum degree to which one fuzzy concept is subsumed by another within a knowledge base. It supports various fuzzy logic operators, including Łukasiewicz, Gödel, Kleene-Dienes, and Zadeh, to define the semantics of the subsumption relationship. The query is resolved by transforming the subsumption check into an optimization problem, specifically minimizing the degree of an implication assertion derived from the input concepts. This process involves cloning the knowledge base, preprocessing the concepts into a solvable form, and optimizing an objective expression to retrieve the solution. |
Module Contents
UML Class Diagram for MaxSubsumesQuery
- class MaxSubsumesQuery(
- 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
Represents a query to determine the maximum degree to which one fuzzy concept is subsumed by another within a knowledge base. It supports various fuzzy logic operators, including Łukasiewicz, Gödel, Kleene-Dienes, and Zadeh, to define the semantics of the subsumption relationship. The query is resolved by transforming the subsumption check into an optimization problem, specifically minimizing the degree of an implication assertion derived from the input concepts. This process involves cloning the knowledge base, preprocessing the concepts into a solvable form, and optimizing an objective expression to retrieve the solution.
- __str__() str
Returns a human-readable string representation of the subsumption query, formatted as a question asking whether the first concept subsumes the second. The representation interpolates the two concepts stored in the instance into a specific syntax that includes the phrase “subsumes” and the suffix “? <= “. This method is primarily intended for logging, debugging, or displaying the query to the user, and it does not modify the state of the object.
- Returns:
A string representing the subsumption query between self.c1 and self.c2.
- Return type:
str
- preprocess(kb: fuzzy_dl_owl2.fuzzydl.knowledge_base.KnowledgeBase) None
Prepares the query for execution by constructing a logical implication concept within the provided Knowledge Base. It creates a new individual and determines the specific implication structure based on the configured logic operator type (Lukasiewicz, Goedel, Kleene-Dienes, or Zadeh). The method retrieves the corresponding MILP variable for this individual and concept, sets the query’s objective expression to minimize this variable, and adds an assertion linking them. As a side effect, it increments the Knowledge Base’s counter for legacy binary variables and triggers the immediate solving of current assertions.
- Parameters:
kb (KnowledgeBase) – The KnowledgeBase instance on which to perform preprocessing operations. It is used to generate new individuals, access MILP variables, add assertions, and trigger the solving process.
- solve(kb: fuzzy_dl_owl2.fuzzydl.knowledge_base.KnowledgeBase) fuzzy_dl_owl2.fuzzydl.milp.solution.Solution
Executes the optimization query on the provided knowledge base to generate a solution. The method begins by initializing performance timers and conditionally cloning the knowledge base; if optimizations are disabled or nominals are present in the TBox, the ABox is solved within the clone, otherwise, the clone is created without the ABox. Following preprocessing, the method invokes the optimization routine on the cloned instance using the internal objective expression. If the ontology is found to be inconsistent during this process, the method catches the exception and returns a solution object indicating inconsistency. The original knowledge base remains unmodified, while internal timing metrics are updated.
- Parameters:
kb (KnowledgeBase) – The knowledge base containing the ontology to be solved or optimized.
- Returns:
The Solution object resulting from optimizing the knowledge base, or a solution indicating inconsistency if the ontology is invalid.
- Return type: