Intention recognition data query method and system based on multilayer model
Through multi-layer model architecture and intelligent addressing rule algorithm, the problem that traditional SQL query methods are difficult to meet complex query needs is solved, efficient and flexible data query is achieved, and query efficiency and resource utilization are improved.
Patent Information
- Application Number
- CN202410834889.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-26
- Publication Date
- 2024-12-03
AI Technical Summary
Traditional SQL-based data query methods are difficult to meet complex and flexible query needs, and lack high-order abstraction and modeling capabilities, resulting in low query efficiency, low resource utilization, and difficulty in responding to market and business changes quickly.
Using a multi-layer model architecture, including basic model, logical model and intent model, create logical models through user-defined SQL query statements, and dynamically route and optimize query paths using model query parameters and addressing rule algorithms to generate efficient SQL query statements .
It significantly improves the flexibility, efficiency and quality of query, realizes a highly customized query experience, automatically optimizes query paths, reduces resource consumption, and improves data processing accuracy and response speed.
Smart Images

Figure CN119066086A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of data query, and in particular to a method and system for querying intention recognition data based on a multi-layer model. Background Art
[0002] In the modern big data environment, enterprises are facing increasingly complex data query needs, and traditional SQL-based data query methods are no longer fully adaptable. Traditional methods rely too much on SQL query statements, which have limited expressive power and are difficult to efficiently assemble to achieve flexible and changeable query scenarios. At the same time, they lack high-level abstraction and modeling capabilities for data, making it impossible to quickly build customized data views for specific businesses. In addition, the cost of modifying SQL statements is high, and it is difficult to combine and splice to meet new complex query requirements.
[0003] Traditional query optimization technology focuses more on the optimization of SQL statements themselves and the physical storage level (such as indexing strategies), rather than going deep into the data model level. This means that the understanding and conversion of complex query intent, as well as the optimization of query paths, often require manual intervention and cannot automatically adapt to changes in query requirements. Traditional methods lack a deep optimization mechanism for data models and cannot effectively integrate and reuse data models, resulting in repeated data processing when processing the same or similar queries, reducing overall query efficiency. With the rapid development of the market and business, the query requirements for data are also constantly changing. Traditional query methods find it difficult to respond to these changes quickly, especially when it is necessary to cross multiple data sources or complex data analysis scenarios, and it is difficult to quickly build and adjust query logic.
[0004] The above problems restrict the performance and business response capabilities of traditional data query systems. Faced with massive data and complex and ever-changing query requirements, innovative technical solutions are urgently needed to break through bottlenecks, improve query flexibility and resource utilization, and truly meet the company's needs for efficient data analysis. Summary of the invention
[0005] In view of the above situation, the present invention provides an intention recognition data query method and system based on a multi-layer model. By constructing a three-layer architecture of basic model, logical model and intention model, efficient mapping and execution from data source to query intention are achieved.
[0006] To achieve the above object, the present invention adopts the following technical solutions:
[0007] In one embodiment of the present invention, a method for querying intent recognition data based on a multi-layer model is proposed, the method comprising:
[0008] Map the data source to be queried to the basic model. In each basic model, the query fields are divided into dimension fields and indicator fields.
[0009] On top of the basic model, a logical model is created based on user-defined SQL query statements. In each logical model, the query fields are divided into dimension fields and indicator fields.
[0010] The user selects and combines one or more basic models and logical models to create an intent model;
[0011] Receive model query parameters, including query fields, aggregation, filter conditions, sorting, model type, model name, and limits and offsets, and distinguish query targets by model type;
[0012] For queries on basic models and logical models, SQL query statements are automatically generated based on model query parameters;
[0013] For queries on intent models, queries are dynamically routed to different models based on model query parameters and addressing rule algorithms. If multiple models are addressed, queries are associated based on dimensions.
[0014] Furthermore, for the query of the intent model, the optimal sub-model set is matched according to the model query parameters and the addressing rule algorithm to generate a sub-model query statement;
[0015] When multiple sub-models are matched, the SQL query statements generated by each sub-model are associated and queried according to the dimensions.
[0016] Furthermore, the addressing rule algorithm steps are as follows:
[0017] (1) Divide the query fields into two categories: dimensions and indicators. Filter out the models that contain all query dimensions and indicators from all sub-models of the intent model. If multiple models match, select the model with the least number of model dimension columns. If the number of model dimension columns is the same, select the model with the least total number of columns. If the total number of columns is the same, select the first model. If no match is found, execute (2).
[0018] (2) If there is no matching model in (1), filter the model that contains all query dimensions and at least one query indicator. If no match is found, return an exception prompt. Otherwise, execute (3).
[0019] (3) If there are multiple models that include all query dimensions and a query indicator, the model with the least number of model dimension columns is selected. If the number of model dimension columns is the same, the model with the least total number of columns is selected. If the total number of columns is the same, the first model is selected.
[0020] (4) Determine whether the field union of all sub-models that are hit contains all query indicators. If not, return an exception prompt. Otherwise, execute (5);
[0021] (5) Mark the indicator field information of the hit model, and then return the multiple sub-models that are finally matched.
[0022] In one embodiment of the present invention, a multi-layer model-based intention recognition data query system is also proposed, the system comprising:
[0023] The multi-level model module is used to map the data source to be queried to the basic model. In each basic model, the query field is divided into dimension field and indicator field. On top of the basic model, a logical model is created based on the user-defined SQL query statement. In each logical model, the query field is divided into dimension field and indicator field. The user selects and combines one or more basic models and logical models to create an intent model.
[0024] Model query parameter module, used to receive model query parameters, including query fields, aggregation, filter conditions, sorting, model type, model name, restrictions and offsets, and distinguish query targets by model type;
[0025] The query generation module is used to query the basic model and logical model, and automatically generate SQL query statements based on the model query parameters. For queries on the intent model, it dynamically routes to different models for query based on the model query parameters and addressing rule algorithm. If multiple models are addressed, the query is associated based on the dimension.
[0026] Furthermore, for the query of the intent model, the optimal sub-model set is matched according to the model query parameters and the addressing rule algorithm to generate a sub-model query statement;
[0027] When multiple sub-models are matched, the SQL query statements generated by each sub-model are associated and queried according to the dimensions.
[0028] Furthermore, the addressing rule algorithm steps are as follows:
[0029] (1) Divide the query fields into two categories: dimensions and indicators. Filter out the models that contain all query dimensions and indicators from all sub-models of the intent model. If multiple models match, select the model with the least number of model dimension columns. If the number of model dimension columns is the same, select the model with the least total number of columns. If the total number of columns is the same, select the first model. If no match is found, execute (2).
[0030] (2) If there is no matching model in (1), filter the model that contains all query dimensions and at least one query indicator. If no match is found, return an exception prompt. Otherwise, execute (3).
[0031] (3) If there are multiple models that include all query dimensions and a query indicator, the model with the least number of model dimension columns is selected. If the number of model dimension columns is the same, the model with the least total number of columns is selected. If the total number of columns is the same, the first model is selected.
[0032] (4) Determine whether the field union of all sub-models that are hit contains all query indicators. If not, return an exception prompt. Otherwise, execute (5);
[0033] (5) Mark the indicator field information of the hit model, and then return the multiple sub-models that are finally matched.
[0034] In one embodiment of the present invention, a computer device is also proposed, including a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, the aforementioned multi-layer model-based intent recognition data query method is implemented.
[0035] In one embodiment of the present invention, a computer-readable storage medium is also proposed, which stores a computer program for executing an intention recognition data query method based on a multi-layer model.
[0036] Beneficial effects:
[0037] 1. The present invention provides a revolutionary optimization solution for data query by constructing a multi-level system including basic model, logical model and intention model. This innovative method not only greatly enhances the flexibility and accuracy of query, but also significantly improves the efficiency and quality of data processing. Specifically, it transforms the traditional mode of directly operating on huge data sources into a more efficient and hierarchical processing flow, making query design and execution simpler and faster.
[0038] 2. The present invention effectively solves the efficiency bottleneck problem in complex query scenarios by intelligently identifying the user's query purpose and automatically optimizing the query path. In particular, the introduction of model query parameters allows the system to accurately formulate query instructions according to the user's specific needs, including query fields, filtering conditions, whether to aggregate, etc., to achieve a highly customized query experience.
[0039] 3. The addressing rule algorithm of the present invention is another key innovation. It can automatically locate the most appropriate query solution in multiple sub-models, especially when the query spans multiple data models, and ensures the accurate integration of data through dimension association query. The intelligent screening and optimization process of this algorithm not only ensures the comprehensiveness of the query, but also avoids unnecessary data processing, significantly speeds up the query response speed and reduces resource consumption. BRIEF DESCRIPTION OF THE DRAWINGS
[0040] Figure 1 It is a flowchart of the intention recognition data query method based on the multi-layer model of the present invention;
[0041] Figure 2 It is a schematic diagram of the addressing rule algorithm flow of the present invention;
[0042] Figure 3 It is an architecture diagram of the intention recognition data query system based on a multi-layer model of the present invention;
[0043] Figure 4 It is a schematic diagram of the module composition of the intention recognition data query system based on the multi-layer model of the present invention;
[0044] Figure 5 It is a schematic diagram of the computer device structure of the present invention. DETAILED DESCRIPTION
[0045] The principles and spirit of the present invention will be described below with reference to several exemplary embodiments. It should be understood that these embodiments are provided only to enable those skilled in the art to better understand and implement the present invention, and are not intended to limit the scope of the present invention in any way. On the contrary, these embodiments are provided to make the present disclosure more thorough and complete, and to fully convey the scope of the present disclosure to those skilled in the art.
[0046] Those skilled in the art will appreciate that the embodiments of the present invention may be implemented as a system, system, device, method or computer program product. Therefore, the present disclosure may be implemented in the following forms, namely: complete hardware, complete software (including firmware, resident software, microcode, etc.), or a combination of hardware and software.
[0047] According to an implementation of the present invention, a method for querying intent recognition data based on a multi-layer model is proposed. By constructing a three-layer architecture of a basic model, a logical model and an intent model, efficient mapping and execution from data source to query intent is achieved.
[0048] The principle and spirit of the present invention are explained in detail below with reference to several representative embodiments of the present invention.
[0049] The present invention proposes a method for querying intent recognition data based on a multi-layer model, which is as follows:
[0050] 1. Basic model: It directly maps the data source table and provides a structured basis for complex query operations. In each basic model, fields are clearly marked as "dimensions" or "indicators". Dimension fields are used to classify, group or filter data, such as product categories, regions, etc., while indicator fields are used for aggregate calculations, such as sales, order quantities, etc. These fields have preset aggregation methods (such as SUM, AVG, COUNT, etc.). The establishment of the basic model provides a standardized data processing unit for subsequent logical models and intent models, ensuring that the underlying data structure of the query is clear and easy to manage.
[0051] 2. Logical model: The logical model is built on top of the basic model. It converts complex query requirements into a series of logically independent and reusable query units by parsing and reconstructing user-defined SQL query statements. This process not only enhances the flexibility of queries, but also improves the expressiveness, allowing users to build more complex query logic by combining these logical units without having to directly operate the underlying data source. The fields in the logical model also distinguish between dimensions and indicators, and the aggregation method can be customized, which makes query design more modular and efficient.
[0052] 3. Intent model: The intent model is the highest level of abstraction, which allows users to select and combine one or more basic models and logical models according to specific query intent to form a customized query view. This customization not only meets specific business needs, but also greatly improves the flexibility and response speed of query design. The intent model provides users with a unified query interface by integrating the resources of the underlying models. Users can quickly build query solutions that meet specific analysis needs without having to deeply understand the underlying data structure. When generating a query, the system will dynamically route and query between the basic model and the logical model according to the query parameters set by the user (such as query fields, filter conditions, whether to aggregate, etc.) and the addressing rule algorithm to ensure the accuracy and efficiency of the query results.
[0053] The core of this invention is to introduce model query parameters, including query fields, filter conditions, aggregation, etc., and distinguish query targets by model type, thereby achieving accurate query of models at different levels. More importantly, a set of addressing rule algorithms is proposed to optimize the query path under the intent model to ensure query efficiency and accuracy of results.
[0054] Model query parameters are another core component of the present invention. They define in detail the various requirements of the query, including query fields, filter conditions, aggregation, sorting, model type, model name, restrictions and offsets, etc., providing a comprehensive instruction set for the model to perform precise queries.
[0055] More importantly, the present invention introduces a set of advanced addressing rule algorithms that can intelligently identify the dimensions and indicator fields in the query request and efficiently locate the most matching query solution in all sub-models. Through step-by-step screening and optimization, it ensures that the query process not only fully covers user needs, but also minimizes unnecessary data processing, thereby greatly improving query efficiency.
[0056] In summary, these three models form a hierarchical and highly flexible data query framework. From the definition of the underlying data structure to the realization of the upper-level query intent, each layer plays a unique role, jointly promoting a significant improvement in data query efficiency and accuracy, while also enhancing the system's adaptability and user query experience.
[0057] It should be noted that, although the operations of the method of the present invention are described in a specific order in the above embodiments and the accompanying drawings, this does not require or imply that the operations must be performed in the specific order, or that all the operations shown must be performed to achieve the desired results. Additionally or alternatively, some steps may be omitted, multiple steps may be combined into one step, and / or one step may be decomposed into multiple steps.
[0058] In order to explain the above-mentioned intention recognition data query method based on the multi-layer model more clearly, a specific embodiment is used for illustration below. However, it should be noted that this embodiment is only for better illustrating the present invention and does not constitute an improper limitation to the present invention.
[0059] Example:
[0060] Figure 1 Schematic diagram of the process flow of the multi-layer model-based intention recognition data query method of the present invention. Figure 1 As shown, the method includes:
[0061] 1. Basic model creation
[0062] First, map the data source table to be queried to the basic model. The basic model mainly includes model information and query field information. The model information includes the model name (corresponding to the data source table name) and the model description information, such as creation time, update time, creator, etc. The query field information is a one-to-one mapping of the data source table fields. On this basis, attribute information is added to each query field to clarify whether it is a "dimension" or "indicator". The dimension field is used to classify, group or filter data, while the indicator field is used for calculation or aggregation. For the indicator field, its aggregation method needs to be defined, such as SUM (sum), AVG (average), MAX (maximum), MIN (minimum), etc. For the dimension field, it can be set to COUNT (count) or COUNT_DISTINCT (count without duplicates).
[0063] 2. Logical model creation
[0064] The logical model is created based on the user-defined SQL query statement. The logical model mainly includes model information and query field information. The model information includes the model name and the customized SQL query statement as well as the model description information, such as the creation time, update time, creator, etc. The model name and the customized SQL query statement are both customized by the user and saved in the model information; then the user-defined SQL query statement is parsed into a series of query field information mapped to the model field. On this basis, attribute information is added to each parsed query field to clarify whether it is a "dimension" or "indicator". The dimension field is used to classify, group or filter data, while the indicator field is used for calculation or aggregation. For the indicator field, its aggregation method needs to be defined, such as SUM (sum), AVG (average), MAX (maximum), MIN (minimum), etc. For the dimension field, it can be set to COUNT (count) or COUNT_DISTINCT (count without duplicates).
[0065] 3. Intent model creation
[0066] The intent model is a model collection that includes multiple basic models and logical models. It is a collection of one or more basic models and logical models selected by the user. These models are organized to meet specific query intents. The intent model mainly includes model information and query field information. The model information includes the model name and model description information, such as creation time, update time, creator, etc. The model name is customized by the user and saved in the model information; the query field information of the intent model is the union of all query fields in the model collection of multiple basic models and logical models under it.
[0067] 4. Model query parameters
[0068] Model query parameter details include:
[0069] (1) Query fields: The specific data field list requested by the user. The field contains attribute information, distinguishing between dimension fields and indicator fields. At the same time, it can specify what type of aggregation operation (SUM, AVG, COUNT, etc.) needs to be performed on the field. If the user specifies the dimension attributes and aggregation method of the field, the SQL query statement is constructed using the parameters specified by the user. If the user does not specify, the SQL query statement is constructed using the dimension attributes and aggregation method parameters in the field information of the model.
[0070] (2) Whether to aggregate: The value is 0 or 1, which is used to determine whether the query uses an aggregate query. 0 means no aggregate query is performed, and the dimension attributes and aggregation method in the field information are no longer used. 1 means an aggregate query is required, and the dimension attributes and aggregation method in the field information are required.
[0071] (3) Filter conditions: Filter conditions applied to queries, usually composed of field names, comparison operators, and values, used to limit the scope of query results. The comparison operator value range: <>, <=, <, >=, >, =, !=, in, like, between; the value can be a single value or an array. When the comparison operator is !=, in, between, the value can pass an array, and when the comparison operator is between, the value only reads the first two bits of the array.
[0072] (4) Sorting: Specify the fields and order (ascending or descending) by which the query results are sorted. The field is the field to be sorted, and the order value is ASC for ascending order and DESC for descending order.
[0073] (5) Model type: Identifies the model level targeted by this query. The value is 0 (basic model), 1 (logical model), or 2 (intent model).
[0074] (6) Model name: Configure the model to be queried according to the model name.
[0075] (7) Limit and offset: Limit the number of results returned (LIMIT) and the number of results to start returning (OFFSET), which is often used for paging queries.
[0076] 5. Query Generation
[0077] (1) For the basic model and logical model, SQL query statements are automatically generated according to the model query parameters.
[0078] Analyze query parameters: First, the system analyzes the model query parameters. According to the model type and model name in the parameters, the corresponding model information and the query field information corresponding to the model can be matched from the database that stores the model information. Then the query field is parsed. If the query field contains dimension attributes and aggregation information, it will be used first. Otherwise, the dimension attributes and aggregation information in the model field will be used. For example, if the query parameters specify that the fields sales_amount (indicator field, preset aggregation is SUM) and product_category (dimension field) need to be queried, the aggregation method is 1, the filtering condition is date>'2024-01-01', and sales_amount is sorted in descending order.
[0079] Build SQL skeleton: Based on the above parameters, you can get the query fields, and mark each field as a "dimension" or "indicator", and know how to aggregate the indicator. Build the basic structure of SQL query based on this information. For the basic model, the model name is the name of the query table; for the logical model, its custom SQL query statement will be used as a subquery statement. For the parameter example in the previous step, the final basic SQL query may be initially:
[0080] SELECT product_category,SUM(sales_amount)AS sales_amount FROMSalesData
[0081] Add filter conditions: Next, add a WHERE clause based on the filter conditions:
[0082] WHERE date>'2023-01-01'
[0083] Aggregation grouping: When the aggregation mode in the parameters is 1, this step needs to be performed. All dimension fields need to be obtained from the query field as grouping fields. The grouping statement is as follows:
[0084] GROUP BY product_category
[0085] Sorting and Limiting: Finally, add the ORDER BY and LIMIT / OFFSET clauses depending on the collation and limiting offset (if any):
[0086] ORDER BY sales_amount DESCLIMIT 10OFFSET 0 - For example, limit the returned records to the first 10, starting from the first record
[0087] The complete SQL query statement example is:
[0088] SELECT product_category,SUM(sales_amount)AS sales_amount
[0089] FROM SalesData WHERE date>'2023-01-01'
[0090] GROUP BY product_category
[0091] ORDER BY sales_amount DESCLIMIT 10OFFSET 0
[0092] (2) Querying the Intent Model The design focus of the present invention is that this method enhances the flexibility of data query.
[0093] Generate sub-model query statements: According to the query parameters and addressing rule algorithms, different models can be dynamically routed for query. If multiple models are addressed, dimension-related queries are supported. Users can simply adjust the parameters to implement different query operations. Because the intent model is based on the basic model and logical model data sets, the generated query is also based on the generation rules of the basic model and logical model. On this basis, when multiple models are matched, the SQL query statements generated by each model will be inner joined according to the dimension. For example, if the query parameters specify that the fields sales_amount (indicator field, preset aggregation is SUM) and product_price (indicator field, preset aggregation is MAX) and product_category (dimension field) need to be queried, the aggregation method is 1, the filtering condition is date>'2024-01-01', and it is sorted in descending order by sales_amount.
[0094] ##Query statement for the SalesData model
[0095] SELECT product_category,SUM(sales_amount)AS sales_amount FROMSalesData WHERE date>'2023-01-01'
[0096] GROUP BY product_category
[0097] ##Query statement for model ProductData
[0098] SELECT product_category,MAX(product_price)AS product_price FROMProductData
[0099] Query by dimension association: We already know the dimension field product_category in the query parameter, so we can associate based on this field:
[0100] select product_category, sales_amount, product_price from(
[0101] SELECT product_category,SUM(sales_amount)AS sales_amount FROMSalesData WHERE date>'2023-01-01'
[0102] GROUP BY product_category
[0103] )t1 inner join(
[0104] SELECT product_category,MAX(product_price)AS product_price FROMProductData)t2 on t1.product_category=t2.product_category
[0105] Sorting and Limiting: Finally, add the ORDER BY and LIMIT / OFFSET clauses depending on the collation and limiting offset (if any):
[0106] select product_category, sales_amount, product_price from(
[0107] SELECT product_category,SUM(sales_amount)AS sales_amount FROMSalesData WHERE date>'2023-01-01'
[0108] GROUP BY product_category
[0109] )t1 inner join(
[0110] SELECT product_category,MAX(product_price)AS product_price FROMProductData)t2 on t1.product_category=t2.product_category
[0111] ORDER BY sales_amount DESCLIMIT 10OFFSET 0
[0112] 6. Addressing rule algorithm:
[0113] The present invention designs a set of addressing rule algorithms for intent model query, which can match the best model from multiple basic models and logical model data sets under the intent model to perform data query operations according to the query field information in the user query parameters. The intent model has multiple sub-models, and the sub-models are composed of one or more basic models, logical models, or a mixture of the two. The addressing algorithm hits one or more sub-models under the intent model based on the requested parameters (dimensions and indicator fields) for data aggregation and summary. Figure 2 As shown, the following are the specific addressing rule algorithm steps:
[0114] Step 1: Divide the query fields into two categories: dimensions and indicators. Filter out the models that contain all query dimensions and indicators from all sub-models of the intent model. If multiple sub-models match, select the model with the least number of model dimension columns. If the number of dimension columns is the same, select the model with the least total number of columns. If the total number of columns is the same, select the first model. If no match is found, proceed to step 2.
[0115] Step 2: If there is no matching model in the first step, filter the sub-model that contains all query dimensions and at least one query indicator. If no match is found, return an exception prompt. Otherwise, execute the third step.
[0116] Step 3: If there are multiple sub-models that include all dimensions and a certain indicator, select the model with the least number of model dimension columns. If the number of dimension columns is the same, select the one with the least total number of columns. If the total number of columns is the same, select the first model.
[0117] Step 4: Determine whether the field union of all sub-models that are hit can contain all query indicators. If not, return an exception prompt, otherwise execute step 5.
[0118] Step 5: Mark the indicator field information of the hit model, and then return the multiple sub-models that are finally matched.
[0119] Based on the same inventive concept, the present invention also proposes an intention recognition data query system based on a multi-layer model. The implementation of the system can refer to the implementation of the above method, and the repeated parts will not be repeated. The term "module" used below can be a combination of software and / or hardware that implements a predetermined function. Although the system described in the following embodiments is preferably implemented in software, the implementation of hardware, or a combination of software and hardware, is also possible and conceived.
[0120] like Figure 3 , 4 As shown, the intention recognition data query system based on the multi-layer model of the present invention includes:
[0121] The multi-level model module 101 is used to map the data source to be queried into a basic model. In each basic model, the query field is divided into a dimension field and an indicator field. On top of the basic model, a logical model is created based on a user-defined SQL query statement. In each logical model, the query field is divided into a dimension field and an indicator field. The user selects and combines one or more basic models and logical models to create an intent model.
[0122] The model query parameter module 102 is used to receive model query parameters, including query fields, aggregation or not, filter conditions, sorting, model type, model name, and restrictions and offsets, and distinguish query targets by model type.
[0123] The query generation module 103 is used to automatically generate SQL query statements for queries against the basic model and the logical model according to the model query parameters; for queries against the intent model, it dynamically routes to different models for query according to the model query parameters and the addressing rule algorithm. If multiple models are addressed, the query is associated according to the dimensions.
[0124] For queries on intent models, the optimal sub-model set is matched according to the model query parameters and addressing rule algorithm to generate sub-model query statements;
[0125] When multiple sub-models are matched, the SQL query statements generated by each sub-model are associated and queried according to the dimensions.
[0126] The addressing rule algorithm steps are as follows:
[0127] (1) Divide the query fields into two categories: dimensions and indicators. Filter out the models that contain all query dimensions and indicators from all sub-models of the intent model. If multiple models match, select the model with the least number of model dimension columns. If the number of model dimension columns is the same, select the model with the least total number of columns. If the total number of columns is the same, select the first model. If no match is found, execute (2).
[0128] (2) If there is no matching model in (1), filter the model that contains all query dimensions and at least one query indicator. If no match is found, return an exception prompt. Otherwise, execute (3).
[0129] (3) If there are multiple models that include all query dimensions and a query indicator, the model with the least number of model dimension columns is selected. If the number of model dimension columns is the same, the model with the least total number of columns is selected. If the total number of columns is the same, the first model is selected.
[0130] (4) Determine whether the field union of all sub-models that are hit contains all query indicators. If not, return an exception prompt. Otherwise, execute (5);
[0131] (5) Mark the indicator field information of the hit model, and then return the multiple sub-models that are finally matched.
[0132] It should be noted that although several modules of the intention recognition data query system based on the multi-layer model are mentioned in the above detailed description, this division is merely exemplary and not mandatory. In fact, according to an embodiment of the present invention, the features and functions of two or more modules described above can be concretized in one module. Conversely, the features and functions of one module described above can be further divided into multiple modules to be concretized.
[0133] Based on the above invention concept, Figure 5 As shown, the present invention also proposes a computer device 200, including a memory 210, a processor 220, and a computer program 230 stored in the memory 210 and executable on the processor 220. When the processor 220 executes the computer program 230, the aforementioned multi-layer model-based intention recognition data query method is implemented.
[0134] Based on the aforementioned inventive concept, the present invention also proposes a computer-readable storage medium, which stores a computer program for executing the aforementioned multi-layer model-based intention recognition data query method.
[0135] The intention recognition data query method and system based on the multi-layer model proposed in the present invention, firstly, simplifies the processing flow of complex query tasks and lowers the technical threshold; secondly, improves the flexibility and accuracy of queries through intelligent model stratification and query parameter configuration; thirdly, greatly improves the efficiency of data query and enhances the overall performance of the system by using advanced addressing rule algorithms; fourthly, promotes the rapid response of enterprises to market changes, improves the real-time and accuracy of business decisions, and brings substantial economic benefits and enhanced competitive advantages to enterprises.
[0136] Although the spirit and principle of the present invention have been described with reference to several specific embodiments, it should be understood that the present invention is not limited to the disclosed specific embodiments, and the division of various aspects does not mean that the features in these aspects cannot be combined to benefit, and such division is only for the convenience of expression. The present invention is intended to cover various modifications and equivalent arrangements contained in the spirit and scope of the attached claims.
[0137] Regarding the limitation of the protection scope of the present invention, those skilled in the art should understand that, based on the technical solution of the present invention, various modifications or variations that can be made by those skilled in the art without creative work are still within the protection scope of the present invention.
Claims
1. A method for querying intention recognition data based on a multi-layer model, characterized in that: The method includes: Map the data source to be queried to the basic model. In each basic model, the query fields are divided into dimension fields and indicator fields. On top of the basic model, a logical model is created based on user-defined SQL query statements. In each logical model, the query fields are divided into dimension fields and indicator fields. The user selects and combines one or more basic models and logical models to create an intent model; Receive model query parameters, including query fields, aggregation, filter conditions, sorting, model type, model name, and limits and offsets, and distinguish query targets by model type; For queries on basic models and logical models, SQL query statements are automatically generated based on model query parameters; For queries on intent models, queries are dynamically routed to different models based on model query parameters and addressing rule algorithms. If multiple models are addressed, queries are associated based on dimensions.
2. The intention recognition data query method based on the multi-layer model according to claim 1 is characterized in that: For queries on intent models, the optimal sub-model set is matched according to the model query parameters and addressing rule algorithm to generate sub-model query statements; When multiple sub-models are matched, the SQL query statements generated by each sub-model are associated and queried according to the dimensions.
3. The intention recognition data query method based on the multi-layer model according to claim 2 is characterized in that: The steps of the addressing rule algorithm are as follows: (1) Divide the query fields into two categories: dimensions and indicators. Filter out the models that contain all query dimensions and indicators from all sub-models of the intent model. If multiple models match, select the model with the least number of model dimension columns. If the number of model dimension columns is the same, select the model with the least total number of columns. If the total number of columns is the same, select the first model. If no match is found, execute (2). (2) If there is no matching model in (1), filter the model that contains all query dimensions and at least one query indicator. If no match is found, return an exception prompt. Otherwise, execute (3). (3) If there are multiple models that include all query dimensions and a query indicator, the model with the least number of model dimension columns is selected. If the number of model dimension columns is the same, the model with the least total number of columns is selected. If the total number of columns is the same, the first model is selected. (4) Determine whether the field union of all sub-models that are hit contains all query indicators. If not, return an exception prompt. Otherwise, execute (5); (5) Mark the indicator field information of the hit model, and then return the multiple sub-models that are finally matched.
4. An intention recognition data query system based on a multi-layer model, characterized in that: The system includes: The multi-level model module is used to map the data source to be queried to the basic model. In each basic model, the query field is divided into dimension field and indicator field. On top of the basic model, a logical model is created based on the user-defined SQL query statement. In each logical model, the query field is divided into dimension field and indicator field. The user selects and combines one or more basic models and logical models to create an intent model. Model query parameter module, used to receive model query parameters, including query fields, aggregation, filter conditions, sorting, model type, model name, restrictions and offsets, and distinguish query targets by model type; The query generation module is used to query the basic model and logical model, and automatically generate SQL query statements based on the model query parameters. For queries on the intent model, it dynamically routes to different models for query based on the model query parameters and addressing rule algorithm. If multiple models are addressed, the query is associated based on the dimension.
5. The intention recognition data query system based on the multi-layer model according to claim 4 is characterized in that: For queries on intent models, the optimal sub-model set is matched according to the model query parameters and addressing rule algorithm to generate sub-model query statements; When multiple sub-models are matched, the SQL query statements generated by each sub-model are associated and queried according to the dimensions.
6. The intention recognition data query system based on the multi-layer model according to claim 5 is characterized in that: The steps of the addressing rule algorithm are as follows: (1) Divide the query fields into two categories: dimensions and indicators. Filter out the models that contain all query dimensions and indicators from all sub-models of the intent model. If multiple models match, select the model with the least number of model dimension columns. If the number of model dimension columns is the same, select the model with the least total number of columns. If the total number of columns is the same, select the first model. If no match is found, execute (2). (2) If there is no matching model in (1), filter the model that contains all query dimensions and at least one query indicator. If no match is found, return an exception prompt. Otherwise, execute (3). (3) If there are multiple models that include all query dimensions and a query indicator, the model with the least number of model dimension columns is selected. If the number of model dimension columns is the same, the model with the least total number of columns is selected. If the total number of columns is the same, the first model is selected. (4) Determine whether the field union of all sub-models that are hit contains all query indicators. If not, return an exception prompt. Otherwise, execute (5); (5) Mark the indicator field information of the hit model, and then return the multiple sub-models that are finally matched.
7. A computer device comprising a memory, a processor and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the method according to any one of claims 1 to 3 is implemented.
8. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program for executing the method according to any one of claims 1 to 3.
Citation Information
Patent Citations
Indicator data analysis model query method
CN107193971A
Method and device for inquiry treatment, and equipment
CN108388564A
SQL-based query language
CN108804460A
Dynamic data encapsulation method based on data item analysis, client and server
CN110019314A
Multi-data-source NL2SQL system based on semantic rules and multi-dimensional model
CN112559550A
Cited By
Query system supporting multiple data sources
CN121365068A
