A data query method based on large model

By combining large-scale models and rule recognition, the identification of complex query conditions and the generation of basic query information is solved, the limitations of large-scale models in processing complex query conditions are improved, the accuracy and efficiency of data query are enhanced, and the flexibility of the system is enhanced. and scalability.

CN118656385BActive Publication Date: 2024-11-26GUANGZHOU SMART SOFTWARE CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411139423.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-08-20
Publication Date
2024-11-26
Estimated Expiration
2044-08-20

AI Technical Summary

Technical Problem

The existing large-model-based data query scheme has limitations when processing complex query conditions, making it difficult to accurately parse and convert it into effective data query statements. Moreover, the data models in different industries and application scenarios are complex and diverse, which adds to the generation of large-models. The difficulty of query statements.

Method used

Combining large model and rule recognition, by separating the identification of complex query conditions and the task of generating basic query information, the query condition identification module is used to identify the specified type of query conditions, and generate query information through the large model, thereby realizing effective query of the database.

Benefits of technology

It significantly improves the accuracy and efficiency of data queries, reduces the burden on large models, ensures the accurate processing of complex query conditions, enhances the flexibility and scalability of the system, and reduces the cost of system development and maintenance.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118656385B_ABST
    Figure CN118656385B_ABST
Patent Text Reader

Abstract

The present application relates to a data query method based on a large model. By combining the natural language understanding ability of the large model and the customized query condition identification rules, it avoids letting the large model directly handle complex and changeable query conditions, but instead entrusts these tasks to a special rule identification module. It not only reduces the burden of the large model, allowing it to focus more on understanding and parsing the basic information in the user's query, but also ensures that complex query conditions can be accurately and efficiently identified and processed. Finally, by integrating the output of the large model and rule identification, complete and accurate query information is generated, thereby realizing effective query of the database, significantly improving the accuracy and efficiency of data query. The present application not only improves the accuracy of the query, but also enhances the flexibility and scalability of the system, providing users with a more intelligent and convenient data query experience.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the technical field of data warehouse, and in particular to a data query method based on a large model. Background Art

[0002] With the rapid development of information technology, data query has become an indispensable part of enterprise operations, scientific research and daily life. Traditional data query methods rely on users to write complex SQL statements or specific query languages, which requires high professional skills and is inefficient. In recent years, with the rapid development of natural language processing (NLP) technology, especially the widespread application of large models represented by ChatGPT, it has become possible to query databases through natural language. However, although the existing data query solutions based on large models can handle basic query requirements, such as identifying column names, they are still unable to cope with complex query conditions, such as time range screening, sorting requirements, and quantity restrictions. This is mainly because large models have certain limitations in processing complex logic and context understanding, and it is difficult to accurately parse and convert them into effective data query statements. In addition, the data models in different industries and different application scenarios are complex and diverse, the associations between data tables, the data types and constraints of fields are different, and the complex query conditions involved in the user's query may also be different, which further increases the difficulty of accurately generating query statements for large models.

[0003] Therefore, there is an urgent need for a data query method that can effectively deal with complex query conditions while fully utilizing the advantages of large models. Summary of the invention

[0004] Based on this, the purpose of this application is to provide a data query method based on a big model, combining the big model and rule recognition, and significantly improving the accuracy and efficiency of data query by separating the tasks of identifying complex query conditions and generating basic query information.

[0005] The data query method based on the big model provided in the embodiment of the present application includes the following steps:

[0006] Get the natural query statement entered by the user;

[0007] Inputting the natural query statement into a preset query condition recognition module to obtain a first query condition; the query condition recognition module is used to recognize a query condition of a specified type;

[0008] Acquire a constellation data model; determine, according to the natural query statement, several relevant basic fields from the constellation data model as candidate basic fields; wherein the constellation data model records several data tables and basic fields contained in each data table;

[0009] Eliminate the basic fields related to the query condition of the specified type from the candidate basic fields;

[0010] Constructing a task processing instruction according to the candidate basic fields, the natural query statement and a preset task execution text; wherein the task execution text is used to prompt the large model to output query information that meets the query intent of the natural query statement, and the query information is determined according to the candidate basic fields;

[0011] Inputting the task processing instruction into the large model to obtain output query information;

[0012] According to the first query condition, the query information and the constellation data model, corresponding service data is queried from a database corresponding to the constellation data model.

[0013] The data query method based on the big model proposed in the embodiment of the present application significantly improves the accuracy and efficiency of data query by cleverly combining the natural language understanding ability of the big model and the customized query condition identification rules. Specifically, the technical solution avoids letting the big model directly handle complex and changeable query conditions, but instead entrusts these tasks to a special rule recognition module. Doing so not only reduces the burden of the big model, allowing it to focus more on understanding and parsing the basic information in the user's query, but also ensures that complex query conditions can be accurately and efficiently identified and processed. By integrating the output of the big model and rule recognition, the technical solution can generate complete and accurate query information, thereby realizing effective query of the database. This combination not only improves the accuracy of the query, but also enhances the flexibility and scalability of the system-since the identification of the query condition of the specified type is independent of the generation of the basic query information, the rules can be flexibly adjusted according to actual needs, so that the system can quickly adapt to different query scenarios and data model changes. In short, the technical solution provides users with a more intelligent and convenient data query experience by optimizing the application scenarios of the big model and introducing an efficient rule recognition mechanism, while reducing the development and maintenance costs of the system.

[0014] For better understanding and implementation, the present application is described in detail below with reference to the accompanying drawings. BRIEF DESCRIPTION OF THE DRAWINGS

[0015] Figure 1 A schematic diagram of a flow chart of a data query method based on a large model according to an embodiment of the present application;

[0016] Figure 2 A schematic diagram of the steps of the query condition identification module identifying the time condition in the embodiment of the present application;

[0017] Figure 3This is a schematic diagram of the steps for determining relevant candidate basic fields according to a natural query statement in an embodiment of the present application. DETAILED DESCRIPTION

[0018] In order to make the purpose, technical solution and advantages of the present application clearer, the embodiments of the present application will be further described in detail below in conjunction with the accompanying drawings. Wherein, when the following description refers to the accompanying drawings, unless otherwise indicated, the same numbers in different drawings represent the same or similar elements.

[0019] It should be clear that the implementation methods described in the embodiments described below do not represent all implementation methods consistent with the present application. Instead, they are merely examples of devices and methods consistent with some aspects of the present application as detailed in the attached claims. Based on the embodiments of the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present application.

[0020] The terms used in this application are only for the purpose of describing specific embodiments and are not intended to limit this application. The singular forms of "a", "said" and "the" used in this application are also intended to include plural forms, unless the context clearly indicates other meanings. In addition, in the description of this application, unless otherwise specified, "multiple" refers to two or more. It should also be understood that the term "and / or" used in this article refers to and includes any or all possible combinations of one or more associated listed items, for example, A and / or B can represent: A exists alone, A and B exist at the same time, and B exists alone; the character " / " generally indicates that the objects associated before and after are in an "or" relationship.

[0021] It should be understood that, although the terms first, second, third, etc. may be used in the present application to describe various information, such information should not be limited to these terms, and these terms are only used to distinguish similar objects, and do not have to be used to describe a specific order or sequence, nor can they be understood as indicating or implying relative importance. For those of ordinary skill in the art, the specific meanings of the above terms in the present application can be understood according to the specific circumstances. Depending on the context, the words "if" / "if" used in the present application can be interpreted as "at the time of" or "when" or "in response to determination".

[0022] With the rapid development of information technology, data query has become an indispensable part of enterprise operations, scientific research and daily life. Traditional data query methods rely on users to write complex SQL statements or specific query languages, which requires high professional skills and is inefficient. In recent years, with the rapid development of natural language processing (NLP) technology, especially the widespread application of large models represented by ChatGPT, it has become possible to query databases through natural language. However, although the existing data query solutions based on large models can handle basic query requirements, such as identifying column names, they are still unable to cope with complex query conditions, such as time range screening, sorting requirements, and quantity restrictions. This is mainly because large models have certain limitations in processing complex logic and context understanding, and it is difficult to accurately parse and convert them into effective data query statements. In addition, the data models in different industries and different application scenarios are complex and diverse, the associations between data tables, the data types and constraints of fields are different, and the complex query conditions involved in the user's query may also be different, which further increases the difficulty of accurately generating query statements for large models.

[0023] Therefore, there is an urgent need for a data query method that can effectively deal with complex query conditions and fully utilize the advantages of large models.

[0024] Please refer to Figure 1 , the embodiment of the present application provides a data query method based on a large model, comprising the following steps:

[0025] S101: Obtaining a natural query sentence input by a user;

[0026] S102: Inputting the natural query statement into a preset query condition recognition module to obtain a first query condition; the query condition recognition module is used to recognize a query condition of a specified type;

[0027] S103: Acquire a constellation data model; determine, according to the natural query statement, several relevant basic fields from the constellation data model as candidate basic fields; wherein the constellation data model records several data tables and basic fields contained in each data table;

[0028] S104: Eliminate the basic fields related to the query condition of the specified type from the candidate basic fields;

[0029] S105: constructing a task processing instruction according to the candidate basic fields, the natural query statement, and a preset task execution text; wherein the task execution text is used to prompt the large model to output query information that meets the query intent of the natural query statement, and the query information is determined according to the candidate basic fields;

[0030] S106: Input the task processing instruction into the large model to obtain output query information;

[0031] S107: According to the first query condition, the query information and the constellation data model, query and obtain corresponding service data from a database corresponding to the constellation data model.

[0032] The data query method based on a large model proposed in the embodiment of the present application achieves accurate response to complex data query requirements by cleverly combining large models (such as large language models such as ChatGPT) with customized query condition identification rules, and significantly improves the overall effect of data query. This method not only overcomes the limitations of large models in the prior art in understanding complex query conditions, but also reduces the pressure of large models through the strategy of task separation, making the identification of column names more efficient and accurate. At the same time, it enables the generation of basic query information and the identification of complex query conditions to be processed in parallel, thereby optimizing the entire query process.

[0033] Specifically, the big model is used to identify the basic information in the query statement, ensuring that the basic framework of the query is accurate. In addition, through the customized query condition identification rules, the complex conditions of the specified type in the query statement are accurately parsed. The accurate identification of these conditions is the key to ensuring that the query results meet the user's expectations. Finally, the basic query information generated by the big model is combined with the complex query conditions obtained by rule identification to form a complete and accurate query instruction, and then the corresponding business data is retrieved from the database. During the whole process, users do not need to have professional SQL knowledge or query language skills. They only need to enter the query requirements in the form of natural language to obtain query results that meet the requirements, which greatly reduces the threshold for data query. At the same time, since the identification of the query conditions of the specified type is independent of the generation of the basic query information, the system can flexibly adjust the rules according to actual needs, quickly adapt to different query scenarios and data model changes, and enhance the flexibility and scalability of the system.

[0034] To sum up, the big model-based data query method proposed in the embodiment of the present application has achieved remarkable technical effects in improving query accuracy, enhancing system flexibility, lowering usage thresholds, and optimizing query processes, bringing innovative solutions to the field of data query.

[0035] The data query method based on the big model in the embodiment of the present application is executed by a computer. Hereinafter, the big model in the embodiment of the present application is first described, and then each step is described in detail.

[0036] In the embodiment of the present application, the large model is responsible for parsing the natural query statements input by the user, understanding the query intent, and generating corresponding query information based on these intents so as to subsequently retrieve data from the database. The large model is usually a complex machine learning model, especially a natural language processing (NLP) model based on deep learning.

[0037] In an embodiment of the present application, the large model may be based on one or more pre-trained language models, such as BERT, GPT, etc. (these models have been trained on a large amount of text data and can capture the deep semantic and syntactic features of the language), and is fine-tuned to adapt to the specific tasks in the present application (i.e., query intent understanding and query information generation). This usually involves further training the pre-trained language model on an annotated data set containing query statements and corresponding query information, so that it can better understand the query intent and generate accurate query information. Of course, the large model may also be an existing large language model, and as long as it has the processing capability of the specific tasks of the present application, it can be applied in the technical solution of the present application, and the embodiments of the present application are not limited to this.

[0038] In step S101, a natural query sentence input by a user is obtained.

[0039] In this embodiment, the user can input the query requirements in the form of natural language through the user query interface provided by the system (such as a web page, mobile application or command line interface). For example, the user may input "query the names and sales of the top 10 products with the highest sales in the first quarter of 2023". This step is the starting point of the data query process and provides the necessary input for the subsequent steps.

[0040] In step S102, the natural query statement is input into a preset query condition recognition module to obtain a first query condition.

[0041] In this step, after receiving the natural query statement input by the user, the system passes it to the preset query condition recognition module. Among them, the query condition recognition module is a trained or configured module that can recognize the specified type of query conditions in the natural query statement, such as time conditions ("first quarter of 2023"), sorting conditions ("sorted in descending order by sales") or quantity restriction conditions ("top 10"), which can specifically refer to a computer program module. In this embodiment, the query condition recognition module recognizes these conditions as the first query conditions to provide the necessary query constraints for the subsequent steps.

[0042] Among them, the specified type of query conditions, in this embodiment, refers to query conditions that are difficult for the large model to accurately understand and identify. In layman's terms, it refers to complex query conditions. For example, time conditions, quantity restriction conditions, sorting conditions, etc., which are currently found to be generally unable to be accurately identified in various large models, can be set as the specified type of query conditions.

[0043] It should be noted that the complexity of complex query conditions is relative to the large model. If a certain type of query condition cannot be accurately identified in a certain large model but can be accurately identified in another large model, then it is a complex query condition for the former large model, but it is not considered a complex query condition for the latter (correspondingly, this type of query condition can be used as the second query condition for the latter large model to directly identify it, without being identified by the query condition identification module or setting corresponding identification rules in the query condition identification module).

[0044] Generally speaking, data models in different industries and application scenarios are complex and diverse, and the relationships between data tables, field data types and constraints are different. Therefore, the complex query conditions involved may also vary. Therefore, the query conditions of the specified type can be determined according to the specific scenario.

[0045] Please refer to Figure 2 ,In one embodiment, the query condition of the specified type includes a time condition;

[0046] In step S102, the query condition identification module identifies the time condition in the following manner:

[0047] Step S1021, if a time entity in the natural query sentence is recognized by the pre-trained time entity recognition model, the time entity is segmented based on the pre-trained time entity segmenter to obtain at least one time entity segmentation; wherein different time entity segmentations correspond to different time dimensions;

[0048] Step S1022, identifying at least one time value covered by each of the time entity segmentations;

[0049] Step S1023, identifying the time dimension corresponding to each of the time entity segmentations;

[0050] Step S1024, obtaining at least one digital format time corresponding to each of the time entity segmentations according to the time dimension corresponding to each of the time entity segmentations, at least one time value covered, and a preset time digital format;

[0051] Step S1025, obtaining the time condition according to the digital format time corresponding to each of the time entity segmentations.

[0052] Among them, the Time Entity Recognition Model is an important tool in the field of natural language processing (NLP), which aims to automatically identify and extract time-related entity information from text data. These time entities can include specific dates (such as "July 26, 2024"), times (such as "3 pm"), time periods (such as "last Wednesday to this Friday"), and more complex time expressions (such as "three days after May Day"). Specifically in this embodiment, the JioNLP model can be used to identify time entities. In one example, the question "the contract amount from June to August in the past three years" identifies the time entity as "June to August in the past three years". The time entity recognition model is essentially a model trained by machine learning or deep learning technology, which can understand the semantic information in natural language text, identify and annotate the time entities in the text. These models are usually trained based on large-scale annotated data sets to learn the characteristics and patterns of various time expressions.

[0053] A temporal entity tokenizer is a natural language processing (NLP) tool specifically designed to process time-related text. Its main function is to further subdivide the temporal entities (such as date, time, time period, etc.) identified in the text into smaller units with clear time dimensions (such as year, month, day, hour, minute, second, etc.), namely temporal entity tokenizers. These tokenizers not only retain the overall meaning of the original temporal entity, but also reveal its internal temporal structure through decomposition, which facilitates subsequent processing and analysis. Temporal entity tokenizers are usually built based on deep learning models, such as recurrent neural networks (RNNs), long short-term memory networks (LSTMs), or Transformers, which can capture the temporal information and contextual dependencies in the text, thereby accurately identifying and segmenting temporal entities. During the training process, the model will learn a large amount of annotated temporal entity data and master the tokenization rules and patterns of different temporal expressions.

[0054] In this embodiment, detailed operation steps are described for the specific type of time condition in the query condition identification process. Specifically, step S1021 first uses a pre-trained time entity recognition model to scan the natural query statement to identify all entities that may represent time in the statement, such as "tomorrow", "last Wednesday", "January 2023", etc. Then, the identified time entity is further processed by the pre-trained time entity segmenter to split it into finer-grained units. These segmentations represent different time dimensions, such as year, month, day, hour, minute, etc. For example, "January 2023" is segmented into "2023" and "January", and "June to August in the past three years" is segmented into "nearly three years" and "June to August". Step S1022 identifies and extracts at least one time value covered by each time entity segmentation. These values ​​are key information for constructing time conditions. For example, the time values ​​extracted from the time entity segmentation "in the past three years" (using this year as 2024 for illustration) include [2022, 2023, 2024], and the time values ​​extracted from the time entity segmentation "June to August" include [6, 7, 8]. At the same time, step S1023 also needs to determine the time dimension corresponding to each time entity segmentation, that is, whether it represents years, months, days or other time units, to ensure that the meaning of the time value can be correctly understood in subsequent processing. Step S1024 constructs a standardized digital format time based on the time dimension, time value and preset time digital format of each time entity segmentation. This step is a key step in converting the time description in the original text into a time format that can be directly operated by the computer. For example, according to the time entity segmentation "nearly three years" and "June to August" according to the preset time digital format, the standardized digital format time is constructed including: [2022-6; 2022-7; 2022-8; 2023-6; 2023-7; 2023-8; 2024-6; 2024-7; 2024-8]. Finally, step S1025 combines all the constructed digital format times into a complete time condition. This time condition will be used as an input parameter for subsequent query or analysis to filter or limit data within the time range.

[0055] Through the above specific embodiments, the technical solution can efficiently and accurately identify and extract time conditions from natural language query statements input by users. This process not only simplifies user operations and improves the convenience of queries, but also avoids inaccurate data retrieval caused by manual parsing errors through intelligent processing methods. In addition, by constructing standardized digital format time, a unified time benchmark is provided for subsequent data processing and analysis, further improving the efficiency and accuracy of data processing. Overall, this technical solution significantly improves the intelligence level and user experience of the information processing system.

[0056] In one embodiment, the query condition of the specified type includes a quantity restriction condition and / or a sorting condition;

[0057] In step S102, the query condition identification module identifies the quantity restriction condition and / or the sorting condition in the following manner:

[0058] Step S1026, if it is identified that the natural query statement contains a preset quantity limit keyword, and / or a preset quantity range keyword and is adjacent to the first numerical value, a quantity limit condition is obtained according to the quantity limit keyword and / or the quantity range keyword and the first numerical value;

[0059] Step S1027: If it is identified that the natural query statement has a preset sorting keyword, a sorting condition is obtained according to the sorting keyword.

[0060] In this embodiment, regular expressions are used to detect whether there are preset quantity limit limiting keywords in the natural query statement, such as "most", "least", etc. These keywords are used to indicate the upper or lower limit of the quantity of the query results. If such quantity limit limiting keywords are identified, the quantity limiting condition is obtained according to the quantity limit limiting keywords. In one embodiment, the quantity limit limiting keywords include largest, most, best, most awesome, highest, most powerful, least, smallest, worst, lowest, last ranked, and first ranked. When the quantity limit limiting keywords are identified, the quantity limiting condition is determined to be "quantity = 1".

[0061] Similarly, regular expressions are used to detect whether there are preset quantity range limiting keywords in the natural query statement, and these keywords must be adjacent to one or more specific numerical values ​​(called the first numerical value). This structure is usually used to clearly specify the quantity range of the query results. By parsing these keywords and numerical values, a specific quantity range limiting condition is constructed. In one embodiment, the regular expression (top (\\d+)|bottom (\\d+)|top (\\d+)|bottom (\\d+)|top (\\d+)|top (\\d+))(?!(number|year|month|day|season)) can be used to detect whether there are quantity range limiting keywords and adjacent to the first numerical value (i.e., \\d+). If it is detected to exist, the quantity limiting condition is determined to be "quantity = \\d+".

[0062] In addition, the embodiment of the present application can also use regular expressions to check whether there are preset sorting keywords in the natural query statement, such as few, small, poor, low, back, inverted, ascending, etc. These keywords are used to indicate that the user wants to sort the query results according to a certain field or attribute. Therefore, once the sorting keyword is identified, the sorting field or attribute that may follow the keyword will be further parsed, as well as the direction of sorting (ascending or descending, if explicitly specified). Based on this information, a sorting condition is constructed, which will guide the query results to be arranged in the order specified by the user. In one embodiment, if the presence of "few", "small", "poor", "low", "back", "inverted", and "ascending" is detected, the sorting condition is determined to be "ascending order", otherwise it is "descending order".

[0063] This embodiment realizes accurate identification of specific types of query conditions, including quantity restriction conditions and sorting conditions, through a query condition identification module. Specifically, the query condition identification module can intelligently analyze specific keywords and their contexts in natural query statements to construct query constraints that meet the user's intentions. For quantity restriction conditions, the query condition identification module can keenly capture the preset quantity limit limiting keywords or quantity range limiting keywords and their accompanying numerical values, so as to accurately construct query conditions containing specific quantity requirements. At the same time, for sorting conditions, the query condition identification module also has efficient recognition capabilities. By identifying the preset sorting keywords, it automatically extracts the user's sorting preferences and constructs sorting conditions accordingly. This function enables the query results to be arranged in order according to the standards specified by the user, further enhancing the practicality of the query results and the user experience.

[0064] In summary, this embodiment not only enriches the types of query conditions by introducing the ability to recognize quantity restriction conditions and sorting conditions, but also significantly improves the intelligence level of the query system and user satisfaction, allowing users to obtain required information more flexibly and accurately.

[0065] For step S103, a constellation data model is obtained; and several relevant basic fields are determined from the constellation data model as candidate basic fields according to the natural query statement.

[0066] The constellation data model is an abstract representation used to describe the database structure. It is a data logic layer established in advance based on various data tables stored in the data warehouse, which records several data tables, basic fields contained in each data table, and graph relationships of each data table. In other words, the constellation data model does not record the specific business data of the fields of each data table, but only records the relevant information used to generate query statements, which mainly includes the table name of the data table and the field information of the data table. In addition, the graph relationship between each data table is established in the constellation data model. Among them, the graph relationship at least includes a directed graph relationship. This step first loads or accesses this model, and then selects the basic fields related to the query content, such as "product name", "sales", etc., as candidate basic fields according to the natural query statement entered by the user. These candidate basic fields are column names that may be required when constructing query statements later.

[0067] The basic fields are generally fields that record the original business data in the database. More specifically, the basic fields are generally divided into metric fields and dimension fields. The metric fields generally refer to the fields in the fact table, and the dimension fields generally refer to the fields in the dimension table. Among them, the fact table and the dimension table are concepts in data modeling in the field of data warehouses. At present, the main data models involved in the field of data warehouses are star data models, snowflake data models generated on the basis of star data models (which can actually be considered as a type of star data model) and constellation data models. In the star data model, it includes a data table located in the center and other data tables connected to the center data table, among which the data table in the center is the fact table, and the other data tables connected to it are dimension tables.

[0068] In one embodiment, the step of obtaining the natural query statement input by the user in step S101 further includes:

[0069] Get the constellation data model identifier selected by the user;

[0070] The step of obtaining the constellation data model in step S103 includes:

[0071] The corresponding constellation data model is acquired according to the constellation data model identifier.

[0072] In this embodiment, when the user enters a natural query statement in the query interface, the user can also select the target data warehouse to be queried, so that the system obtains the constellation data model identifier corresponding to the target data warehouse. In step S103, the system obtains the data of the corresponding constellation data model according to the constellation data model identifier, that is, the structural modeling data of the target data warehouse selected by the user. Through this embodiment, it means that the user can specify to query in different target data warehouses. These different data warehouses are established based on different business scenarios or different user subjects. Therefore, the data that can be queried is also different. Accordingly, the user expresses appropriate natural query statements according to the query purpose and the selected data warehouse to ensure that the desired business data can be queried in the correct data warehouse.

[0073] In summary, this embodiment introduces the constellation data model identifier selected by the user as part of the query condition, and accurately obtains the corresponding constellation data model based on it, thereby further refining and personalizing the natural query statement, ensuring that the subsequent processing process is based on the user's real intention and preference, thereby providing query results or services that are more in line with user needs. This technical improvement not only improves the convenience and satisfaction of user queries, but also enhances the system's ability to process complex query requests, making the final query results or services more accurate and comprehensive, and providing users with a richer and more interesting constellation-related content experience.

[0074] Please refer to Figure 3 In one embodiment, the step of determining several relevant basic fields as candidate basic fields from the constellation data model according to the natural query statement in step S103 includes:

[0075] Step S1031, performing keyword recognition on the natural query sentence to obtain a number of keywords;

[0076] Step S1032, vectorizing each of the keywords and each basic field in the constellation data model;

[0077] Step S1033, calculating the vector similarity between any of the keywords and any of the basic fields;

[0078] Step S1034, determining the basic fields whose similarity with any of the keywords is greater than a preset similarity threshold as candidate basic fields; or, based on the vector similarity between each basic field and the corresponding keyword, obtaining a preset number of basic fields with high similarity ranking, and determining the preset number of basic fields as candidate basic fields.

[0079] The preset similarity threshold and the preset number can be set according to specific circumstances. In this embodiment, the preset number can be set to 40.

[0080] This embodiment describes in detail how to filter out the basic fields related to the natural query statement input by the user from the constellation data model as the candidate basic fields. First, in step S1031, the natural query statement is identified by keywords, and several keywords that can represent the user's query intention are extracted using natural language processing technology (such as word segmentation, part-of-speech tagging, etc.). These keywords are the basis for subsequent analysis and are crucial for accurately understanding user needs. Then, in step S1032, the identified keywords and each basic field in the constellation data model are converted into a vector representation in a high-dimensional space using vectorization technology. Vectorization is a common method for processing text data. It can convert text information into a numerical form that is easy for computers to process, which is convenient for subsequent similarity calculations. Then, in step S1033, the vector similarity between each keyword and each basic field is calculated. Similarity calculation is a key step in evaluating the proximity of two vectors in a high-dimensional space, and its result can reflect the correlation between keywords and basic fields. Finally, in step S1034, candidate basic fields are filtered out according to the similarity calculation results. Specifically, there are two ways: one is to directly determine the basic fields whose similarity with any keyword is greater than a preset similarity threshold as candidate basic fields. This method is simple and direct, and is suitable for situations where the number of candidate fields is not strictly required; the other is to sort each basic field according to the vector similarity with the corresponding keyword, and then select a preset number of basic fields with high similarity ranking as candidate basic fields. This method can more accurately control the quantity and quality of candidate fields and is suitable for situations where there are high requirements for query results.

[0081] In one embodiment, the step of performing keyword recognition on the natural query statement to obtain a plurality of keywords in step S1031 includes:

[0082] Step S10311, segmenting the natural query sentence based on a preset segmenter to obtain a segmentation result;

[0083] Step S10312: Based on the pre-trained entity recognition model, entity recognition is performed on the natural query sentence and the word segmentation result to obtain a first entity recognition result and a second entity recognition result respectively;

[0084] Step S10313, obtaining a number of keywords according to the first entity recognition result and the second entity recognition result.

[0085] Among them, the word segmenter is a basic tool in natural language processing, and its main function is to divide continuous text strings into independent vocabulary units (tokens). There are many ways to implement the word segmenter, including rule-based word segmentation, statistical-based word segmentation, and hybrid methods. Rule-based word segmentation relies on a preset dictionary and rule set, and segments the text by matching the entries and rules in the dictionary. The statistical-based word segmentation uses statistical models (such as hidden Markov models, conditional random fields, etc.) to predict the boundaries of words in the text. The hybrid method combines the advantages of rules and statistics to improve the accuracy and efficiency of word segmentation. In practical applications, the choice of word segmenter depends on the specific language characteristics and task requirements. In this embodiment, a suitable word segmenter can be selected according to the specific scenario.

[0086] The entity recognition model is an important component in natural language processing, which is used to identify entities with specific meanings from text. These entities can be named entities (such as names of people, places, names of institutions, etc.), or other entities with specific meanings (such as time, date, numbers, etc.). Entity recognition models are usually built based on machine learning or deep learning technology, and learn the characteristics and patterns of entities in text by training a large amount of labeled data. During the training process, the model learns how to distinguish between entities and non-entity parts in the text, and identifies the types and boundaries of entities. This embodiment accurately identifies entities in the text through the entity recognition model, and can better determine the candidate basic fields related to natural query statements.

[0087] This embodiment describes in detail how to perform keyword recognition on natural query statements. This process aims to extract keywords that are crucial to subsequent query processing from natural language texts to more accurately determine relevant candidate basic fields. First, in step S10311, a preset word segmenter is used to perform word segmentation on the natural query statement. Through word segmentation, complex query statements can be decomposed into more easily processed vocabulary sequences. Then, in step S10312, a pre-trained entity recognition model is used to perform dual entity recognition on the natural query statement and its word segmentation results. By performing entity recognition on the original query statement and the word segmentation result respectively, the key information in the query statement can be captured more comprehensively and the accuracy of keyword recognition can be improved. The first entity recognition result is based on the overall understanding of the original query statement, while the second entity recognition result focuses more on the vocabulary unit after word segmentation. The two complement each other and together constitute an in-depth understanding of the query statement. Finally, in step S10313, several keywords are extracted based on the comprehensive analysis of the first entity recognition result and the second entity recognition result. These keywords include not only the explicit named entities in the query, but also some words with specific meanings or importance, which together constitute the core content of the query and provide key guidance for subsequent data retrieval and processing. In one embodiment, the entities in the first entity recognition result and the second entity recognition result are combined to obtain all the keywords of the natural query.

[0088] In summary, this embodiment achieves accurate recognition of keywords in natural query sentences by introducing word segmentation and dual entity recognition. This process not only improves the accuracy and comprehensiveness of keyword recognition, thereby ensuring accurate and comprehensive determination of candidate basic fields, but also provides strong support for subsequent query information generation and data retrieval.

[0089] In step S104, basic fields related to the query condition of the specified type are removed from the candidate basic fields.

[0090] Since the large model cannot accurately process complex query conditions, in order to avoid it trying to understand and output these conditions (these outputs are likely to be wrong and interfere with the final query), this step removes the basic fields in the candidate basic fields that are directly related to the specified type of query conditions identified in step S102. This ensures that the large model only focuses on and processes basic query information in subsequent steps, and does not try to understand and output complex query conditions.

[0091] In one embodiment, the step of removing the basic fields related to the query condition of the specified type from the candidate basic fields in step S104 includes:

[0092] Step S1041, obtaining a number of character strings corresponding to the query condition of the specified type;

[0093] Step S1042: If any basic field in the candidate basic fields is the same as any of the character strings, it is determined that the basic field is related to the query condition of the specified type, and the basic field is removed.

[0094] In this embodiment, the query conditions of the specified type generally include specific keywords, phrases or complex expressions for limiting or filtering data. Therefore, these query conditions can be decomposed into a series of basic units - character strings, thereby obtaining a number of character strings corresponding to the query conditions of each specified type.

[0095] This embodiment specifically describes the steps of how to remove those basic fields that match the query conditions of the specified type from the candidate basic fields. First, in step S1041, several character strings corresponding to the query conditions of the specified type are first obtained. Then, in step S1042, the candidate basic fields are traversed to check whether each basic field is the same as any character string obtained in step S1041. The "same" here refers to the complete match between the field name or field identifier and the character string. If any basic field in the candidate basic fields is the same as any character string, the system considers that the basic field is related to the query conditions of the specified type, so it needs to be removed from the candidate basic field list. This step ensures that only those fields that are directly related to the query conditions will be removed by precise matching, thereby avoiding unnecessary mis-removal. In this way, field information that may interfere with the complex query conditions of the large model can be effectively filtered out to avoid trying to understand and output these complex query conditions (i.e., query conditions of the specified type).

[0096] For step S105, a task processing instruction is constructed according to the candidate basic fields, the natural query statement and the preset task execution text.

[0097] In this step, the remaining candidate basic fields, the original natural query statement, and the preset task execution text are used to construct a task processing instruction. This task processing instruction is designed to guide the large model to select accurate basic fields from the candidate basic fields according to the intent of the natural query statement and generate query information that meets the query intent.

[0098] Among them, the task execution text is used to require or prompt the task requirements of the large model, including specific requirements and format instructions for the model output, and may also include task-related scene information or context information for the model to learn and understand the task to be processed, etc. In the embodiment of the present application, different sub-texts can be set in the task execution text according to the needs of the query, which are used to require or prompt the corresponding task requirements of the large model. For example, the task execution text may include a first task execution text, a second task execution text, a third task execution text... and so on, and different sub-texts contain specific requirements for model processing and output according to task requirements, etc.

[0099] In one embodiment, the task execution text in step S105 includes a first task execution text; the first task execution text is used to prompt that the query information output by the large model includes a first basic field and a second query condition, and prompts that the first basic field is determined from the candidate basic fields and the second query condition is determined based on the candidate basic fields; wherein, the first basic field is used to query the corresponding business data, and the second query condition is used to limit the conditions that the business data queried by the first basic field needs to meet.

[0100] The first task execution text is generally a command text used to request or prompt the big model what task to perform, which details the specific rules that the big model should follow when generating query information. Alternatively, the first task execution text can also be an instruction set in a specific format, which also details the specific rules that the big model should follow when generating query information. The first task execution text can be determined in what form according to the requirements of the big model for task processing instructions.

[0101] The first basic field is the core part of the query information and directly corresponds to the field used to retrieve business data in the database. With the guidance of the first task execution text, the big model can accurately identify and select the most appropriate field as the basis for the query.

[0102] The second query condition is a condition that further limits the query result of the first basic field, and is used to filter out business data that meets specific requirements. Specifically, it may include various types such as numerical range, dimension restriction, text matching mode or time window, depending on business needs and data characteristics. The second query condition and the first query condition are essentially limiting conditions for the query results. The difference is that, in the embodiment of the present application, the first query condition is determined by the query condition identification module, while the second query condition can be directly determined by the large model. In other words, the second query condition is a condition that the large model has the ability to accurately identify, so it does not need to be identified through the query condition identification model or through a custom identification rule.

[0103] In this embodiment, the first task execution text prompts the big model, and the output query information contains two key elements: the first basic field and the second query condition. The big model is also instructed to determine the first basic field from the candidate basic fields. At the same time, the method for determining the second query condition is also specified. The second query condition should be constructed based on the candidate basic fields to further limit the scope of the query results and ensure that the final query results only return business data that meets specific conditions.

[0104] It should be noted that those skilled in the art understand that the task execution text prompts the big model what to do, but it does not mean that the big model must do it. For example, if the big model understands the natural query statement and believes that the current query does not involve query conditions, it may not output the second query condition to avoid violating the core task of the task execution text prompt, that is, outputting query information that meets the query intent.

[0105] In one embodiment, the constellation data model further records data operation fields bound to at least some basic fields; the task execution text further includes a second task execution text, the second task execution text is used to prompt that the query information output by the large model also includes a data operation field and a third basic field bound to the data operation field, the data operation field is determined from the candidate data operation fields according to the query intent of the natural query statement; the data operation field is used to specify the data operation on the business data of the third basic field;

[0106] After the step of removing the basic fields related to the query condition of the specified type from the candidate basic fields in step S104, the following steps are also included:

[0107] Step S1041, determining the data operation fields bound to each of the candidate basic fields as candidate data operation fields;

[0108] The step of constructing a task processing instruction according to the candidate basic fields, the natural query statement and the preset task execution text in step S105 includes:

[0109] Step S1051, constructing a task processing instruction according to the candidate basic fields, the candidate data operation fields, the natural query statement and the preset task execution text.

[0110] Among them, the data operation field, also called the MDX operation field, is different from the basic field. It is not a native field recorded in the database, but a field obtained by definition. The data queried is obtained by performing complex operations (such as complex calculations) based on the data of the basic fields in the database. Specifically, data operation fields for various operations can be defined according to the needs of data analysis. In one embodiment, the data operation field can be "same period", "previous period", "year-on-year", "month-on-month", "global proportion", "group proportion", "global ranking" and "group ranking", etc. Obviously, the query of the data operation field involves calculation or comparison of the data of the basic field in multiple dimensions. Unlike querying the basic field, it only needs to obtain the data corresponding to the basic field from the database, but requires more complex analysis and processing involving multiple dimensions and / or multiple basic data.

[0111] In this embodiment, at least some of the basic fields of the constellation data model are also bound to data operation fields. This binding is generally established in advance by the user according to the query requirements, so that when the user enters natural language to query, the required data analysis results can be accurately and quickly queried. This binding mechanism allows any basic field to be associated with one or more data operation fields. Different data operation fields define different specific operations that can be performed on the business data represented by the basic field, greatly enhancing the flexibility and dynamism of data processing.

[0112] At the same time, the second task execution text is also introduced in this embodiment. As a part of the task execution text, it is specifically used to instruct the large model to include data operation fields and the third basic fields bound to the data operation fields when outputting query information in addition to the basic fields. The third basic fields here refer to those basic fields on which the data operation fields will act in actual operations (it can be understood that the third basic field is likely to overlap with the first basic field. In this embodiment, it will also be included in the first basic field. However, in other embodiments, the third basic field may not be included in the first basic field. This actually depends on how the subsequent query system parses the query information and determines the target field to be queried and how to query. Therefore, it can be set according to the situation). Through the prompt of the second task execution text, the large model can clearly understand whether the user's query intention contains the operation requirements for specific data, and which data these operations should act on.

[0113] This embodiment defines that after step S104, step S1041 is added, that is, all candidate basic fields are traversed, and the data operation fields bound to each of them are determined as candidate data operation fields. This step is an important preparation before constructing the task processing instruction. It ensures that all possible data operations are taken into consideration and provides comprehensive data support for the generation of subsequent instructions. Finally, corresponding adjustments are also made in step S105 of constructing the task processing instruction. The candidate data operation field is also used as one of the input parameters, and is used together with the candidate basic fields, natural query statements and preset task execution text to construct the task processing instruction. Such a design ensures that the constructed instructions not only contain the basic field information required for the query, but also clarify what operations may be performed on these fields, thereby achieving a complete expression and precise execution of the query intent.

[0114] In summary, this embodiment greatly improves the system's ability to understand the user's query intention and the flexibility of task processing by introducing a binding mechanism between basic fields and data operation fields, as well as the prompt function of the second task execution text. At the same time, by incorporating candidate data operation fields into the task processing instruction construction process, the integrity and accuracy of the instructions are ensured, so that the system can perform corresponding data operations according to the user's real needs, thereby providing a more efficient and accurate constellation query service.

[0115] In one embodiment, the constellation data model further records the data type of each basic field, and different data types correspond to different candidate conditional operators; the second query condition includes a second basic field and a conditional operator;

[0116] The task execution text also includes a third task execution text; the third task execution text is used to prompt the large model, the second basic field in the second query condition is determined from the candidate basic fields, and the conditional operator in the second query condition is determined from the candidate conditional operator set;

[0117] After the step of removing the basic fields related to the query condition of the specified type from the candidate basic fields in step S104, the following steps are also included:

[0118] Step S1042, determining a candidate conditional operator for each candidate basic field according to the data type of each candidate basic field;

[0119] Step S1043, obtaining the candidate conditional operator set according to the candidate conditional operators of each of the candidate basic fields;

[0120] The step of constructing a task processing instruction according to the candidate basic fields, the candidate data operation fields, the natural query statement and the preset task execution text in step S1051 includes:

[0121] Step S1052: construct a task processing instruction according to the candidate basic fields, the candidate data operation fields, the candidate conditional operator set, the natural query statement and the preset task execution text.

[0122] In this embodiment, special attention is paid to the impact of differences in data types on query conditions, and the construction process of the task execution text is adjusted accordingly to improve the flexibility and accuracy of user operations.

[0123] In step S1042, the system first reads the data type information of each candidate basic field recorded in the constellation data model. Since different data types support different query condition operations (such as equal to, greater than, less than, contains, etc.), the system will select the condition operator suitable for the data type from the predefined condition operator set according to the specific data type of each candidate basic field to form a candidate condition operator list for the candidate basic field. For example, for numeric fields, candidate condition operators may include "=", ">", "<", ">=", "<=", etc.; and for string type fields, they may include "=", "LIKE" (fuzzy matching), etc.

[0124] Step S1043 is a summary of the results of the previous step. The system traverses the candidate conditional operator lists of all candidate basic fields, removes duplicates, and finally forms a set containing all unique candidate conditional operators, namely, the candidate conditional operator set. This set will be used in subsequent steps to help the large model select a suitable operator from the candidate conditional operator set when determining the conditional operator in the second query condition.

[0125] In the process of constructing the task processing instruction, step S1052 not only considers the candidate basic fields, candidate data operation fields and natural query statements, but also adds the consideration of the candidate conditional operator set. At the same time, a new guidance content is introduced into the task execution text - the third task execution text. This text is specifically used to prompt the large model to select the second basic field from the candidate basic fields and select the appropriate conditional operator from the candidate conditional operator set, so as to obtain the second query condition.

[0126] In summary, this embodiment significantly enhances the flexibility and accuracy of data query processing by introducing detailed management of candidate basic field data types and precise matching of candidate conditional operators. It not only allows users or the system to automatically select appropriate query conditional operators based on data types, but also further improves the efficiency and accuracy of query information output by large models through prompts in task execution text, which helps reduce query errors caused by data type mismatch or misuse of conditional operators, thereby improving the reliability and stability of the entire data processing process.

[0127] In one embodiment, the task execution text further includes a fourth task execution text, and the fourth task execution text is used to prompt the large model that the second query condition is a query condition other than the query condition of the specified type.

[0128] In this embodiment, as part of the task execution text, the fourth task execution text has a specific prompt function. It is specifically used to clearly indicate to the large model that the second query condition currently being processed or about to be processed is a query condition outside the specified type of query condition. This allows it to try to understand and output conditions outside the specified type of query condition, avoid outputting the specified type of query condition that it is not good at, and ensure that the accuracy of the technical concept and technical solution of this application is further strengthened and guaranteed.

[0129] For step S106, the task processing instruction is input into the large model to obtain output query information.

[0130] In this step, the constructed task processing instructions are sent to the big model. The model analyzes the intent of the natural query statement according to the requirements in the instructions, combines the candidate basic fields, and generates query information that meets the query requirements / intent. The query information is usually expressed in a structured format (such as JSON), which contains the specific field names and possible query logic used for database queries.

[0131] For step S107, according to the first query condition, the query information and the constellation data model, corresponding service data is queried from a database corresponding to the constellation data model.

[0132] This step combines the first query condition obtained in step S102, the query information obtained in step S106, and the constellation data model to construct a complete database query statement, which is sent to the database for execution to retrieve business data that meets the user's query intent. These data can then be returned to the user or used for further analysis and processing.

[0133] In one embodiment, the task execution text further includes a fifth task execution text, and the fifth task execution text is used to prompt the large model to output the query information according to a preset report query request format;

[0134] The step of querying and obtaining corresponding service data from a database corresponding to the constellation data model according to the first query condition, the query information and the constellation data model in step S107 includes:

[0135] Step S1071, merge the first query condition into the query information according to the report query request format, use the merged query information as a report query request, and input the report query request and the constellation data model into the MDX query engine, and obtain the corresponding business data from the database corresponding to the constellation data model through the MDX query engine; wherein the MDX query engine is an engine for parsing report query requests and performing data queries based on the parsing results and the constellation data model.

[0136] Among them, the MDX (Multidimensional Expressions) query engine is a component specially designed to process complex report queries. It can understand and parse query requests written in the MDX query language, and retrieve corresponding business data from the database based on these requests and the definition of the constellation data model (multidimensional data structure model, commonly used in OLAP systems).

[0137] In this embodiment, for the understanding of the MDX query engine, specific reference can be made to the working principle of the Mondrian engine (an open source online analytical processing engine developed based on Java). In the MDX query engine, it is necessary to combine the data model description information and the MDX statement for querying. The MDX statement is a query statement with a similar grammatical structure to the SQL statement. In the SQL statement or the MDX statement, the general format is: select query field from query data source; when there is a field that needs to be defined, the query statement also includes "with field operation definition" before the select field; when there is a query restriction condition that needs to be limited, the query statement also includes "where query restriction condition" after the from field. Among them, the query data source generally specifies the target data table of the target database that the user wants to query, so it generally fills in the table name of the data table. In some cases, it can also fill in another query statement (the query statement actually determines a set of data, and this set of data can also be considered to constitute a data table).

[0138] Specifically, the data model description information is generally a Schema XML (Extensible Markup Language) file, which describes the database table description information, measurement description information, dimension description information, and data operation field (MDX operation field) description information (including calculated member description information and / or named set description information) of a data model cube; the query data source of the MDX statement is determined to be the model name defined in the data model description information (generally speaking, the Schema XML defines the model name as cube, which corresponds to from cube in the MDX statement). In the MDX query engine, for a data operation field (MDX operation field), corresponding operation definition information (such as a calculation formula) is required to perform the corresponding operation. Specifically, the definition of the data operation field can be defined in the with part of the MDX statement, or in the data model description information (Schema XML file).

[0139] In this embodiment, the MDX query engine is a multidimensional query engine obtained by secondary development based on a general multidimensional analysis engine such as the Mondrian engine, that is, it not only executes queries according to MDX statements and data model description information like a general multidimensional analysis engine, but also generates MDX statements and data model description information before that. For details, please refer to the prior art description, and also refer to the description involved in the subsequent embodiments.

[0140] In this embodiment, the function of the task execution text is further expanded, and the fifth task execution text is introduced. The text has a specific role - guiding the large model to organize and output the query information according to the preset report query request format. Specifically, the fifth task execution text can set prompt texts one by one according to the preset report query request format, so as to require the large model to adjust the format of the query information according to the prompt requirements one by one, so as to finally output the query information that conforms to the report query request format. This design is intended to ensure that the format of the query information matches the expected input format of the back-end data system (especially the database system that supports MDX query), thereby improving the accuracy and efficiency of data query. Specifically, when performing data query, the first query condition and the query information are first integrated according to the preset report query request format. This integration process may involve formatting the query condition, replacing or supplementing the parameters, and reorganizing the query information to ensure that they meet the input requirements of the MDX query engine. After the integration is completed, the query information obtained is submitted to the MDX query engine as a report query request. The MDX query engine receives the query request from the report, parses the target fields of the user's query and the query restrictions involved therein, and then uses the constellation data model as a navigation graph to perform query operations in the database, and finally returns the business data that meets the conditions.

[0141] In summary, this application significantly enhances the interaction between the big model and the backend data system by introducing the fifth task execution text and defining the implementation process of step S1071 in detail. Specifically, it ensures that the format of the query information is highly consistent with the input requirements of the MDX query engine, so that based on the existing technical architecture of the MDX query engine, it is only necessary to directly input the query information as a general report query request into the MDX query engine to perform the query.

[0142] In one embodiment, the MDX query engine in step S1071 obtains the corresponding business data by querying in the following manner:

[0143] Step S10711, parsing the report query request according to a preset parsing method to obtain a target field for query; determining a basic field according to the target field;

[0144] Step S10712, determining a plurality of star data models including the basic fields from the constellation data model; wherein each of the star data models respectively records a fact table, a dimension table, and the basic fields respectively included in each data table;

[0145] Step S10713, if the target field includes a data operation field, obtain corresponding operation definition information according to the data operation field; generate data model description information according to each of the star data models and the operation definition information; generate an MDX statement according to the report query request and the operation definition information; query the query result of the target field from the database corresponding to the constellation data model according to the MDX statement and the data model description information; determine that the query result of the target field is the business data obtained by the query;

[0146] Step S10714, if the target field does not include a data operation field, generate data model description information according to each of the star data models; generate an MDX statement according to the report query request; according to the MDX statement and the data model description information, query the query result of the target field from the database corresponding to the constellation data model; determine that the query result of the target field is the business data obtained by the query.

[0147] Among them, in step S10711, the report query request is parsed to obtain the target field that the user wants to query. Specifically, in different query requirements, the target field obtained by parsing is generally different. In this embodiment, the target field obtained by parsing the report query request includes basic fields and / or data operation fields. Generally speaking, the target field queried by the report query request can include only basic fields (meaning that only the basic data in the database is queried), or only data operation fields (meaning that only a certain data analysis result or data obtained after a certain specified data operation is queried, such as the year-on-year growth rate, without querying specific basic data), and can also include both basic fields and data operation fields (meaning that both basic data and data obtained by specified operations are queried). Among them, if the target field of the query includes a data operation field, the data operation field will also be bound to at least one basic field - that is, the data operation field actually specifies the operation of the bound basic field. However, it should be noted that in this case, the data operation field is the target field of the query, but the basic field bound to it is not the target field of the query. For example, the query request queries the "sales volume" "same period growth rate", where "sales volume" is the target field of the query, and "sales volume" is just the basic field referenced by the target field. The final query result should be the query result of "sales volume" and does not include the data of the "sales volume" field (unless the basic field "sales volume" is also the target field of the user's query). This step determines the basic field related to the query based on the target field (same as above, not necessarily the target field of the query), so that in step S10712, the star data model related to this query can be determined based on the basic field. Specifically, if the target field of the query is a basic field, then it is the basic field related to the query; if the target field of the query is a data operation field, then the basic field bound to it is the basic field related to the query. In some special cases, there is another type of aggregate field. This type of field is associated with a basic field. The associated basic field is the basic field related to the query. For example, for the aggregate field "average sales volume", the "sales volume" field is the basic field related to the query.

[0148] In step S10712, the star data model is determined from the constellation data model. Generally speaking, in a complex constellation data model, if different data tables are centered, different star data models can be determined. A data table can be used as a fact table in a star data model and as a dimension table in other star data models.

[0149] In this step, the main goal of determining the star data model from the constellation data model is to obtain the minimum available star data model related to the query. The minimum available star data model should only contain data tables related to the query, and the data tables should only contain the basic fields determined in step S10711, wherein the data tables related to the query are divided into several cases: for dimension tables, they are considered to be data tables related to the query only when they contain the basic fields or are bound to query-related restriction information; there is no limitation for fact tables, generally speaking, a fact table is a necessary data table in a star data model, even if it does not contain basic fields. There are many ways to determine the minimum available star data model, and specific reference may be made to the prior art in the field, which will not be elaborated here.

[0150] In step S10713, the operation definition information is used to define the operation processing method corresponding to the data operation field, which can also be said to define what operation is performed on the data of the basic field bound to the data operation field. Take an example of querying in an existing report query interface (including various query components) for explanation, assuming that the predefined operation field is "sales volume" when querying, and select the parameter of its "time" dimension field as 2024, and select the data operation field "sales volume" to submit the query. Then, when the backend processes the query, it obtains the corresponding definition formula according to the "sales volume" for the same period, such as "sales volume = (current data - previous data) / previous data", and substitutes the specific basic field (measurement field and / or dimension field) and related parameters into the definition formula to obtain the operation definition information of the "sales volume" of the query, such as "sales volume in 2024 - sales volume in 2023) / sales volume in 2023". Of course, this example is only for illustrative purposes to facilitate understanding of the data operation fields and their operation definition information. The specific implementation details can be set according to the situation. How each of the star data models generates data model description information and how the report query request generates an MDX statement are prior arts in the art. Please refer to the prior arts for details and will not be elaborated here.

[0151] In step S10714, the database includes data of various data tables corresponding to the constellation data model. That is, the database is actually the basis for modeling the constellation data model. In one embodiment, the database is preferably an OLAP (On-Line Analytical Processing) database.

[0152] In this embodiment, the basic field is determined according to the target field queried by the user, and several star data models containing the basic field are determined. If the target field includes a data operation field, the corresponding operation definition information is obtained according to the data operation field through the MDX query engine; data model description information is generated according to each of the star data models and the operation definition information; MDX statements are generated according to the report query request and the operation definition information; and query results of the target field are obtained from the database according to the MDX statements and the data model description information. If the target field does not include a data operation field, data model description information is directly generated according to each of the star data models, and MDX statements are directly generated according to the report query request; the subsequent steps are similar according to the MDX statements and the data model description information. Through this embodiment, the MDX query engine can accurately parse the report query request, generate data model description information and MDX statements, and thus, in combination with the data model description information and the MDX statements, it can efficiently query the query results of the target field from the database, and determine that the query results of the target field are the business data obtained by the query.

[0153] The above-mentioned embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the invention patent. It should be pointed out that, for ordinary technicians in this field, several modifications and improvements can be made without departing from the concept of the present application, and the present application is also intended to include such modifications and modifications.

Claims

1. A data query method based on a large model, characterized in that: The following steps are involved: Get the natural query statement entered by the user; Inputting the natural query statement into a preset query condition recognition module to obtain a first query condition; The query condition identification module is used to identify a query condition of a specified type; Acquire a constellation data model; determine, according to the natural query statement, several relevant basic fields from the constellation data model as candidate basic fields; wherein the constellation data model records several data tables and basic fields contained in each data table; Eliminate the basic fields related to the query condition of the specified type from the candidate basic fields; A task processing instruction is constructed according to the candidate basic fields, the natural query statement and the preset task execution text; wherein the task execution text is used to prompt the large model to output query information that meets the query intent of the natural query statement, and the query information is determined according to the candidate basic fields; the task execution text includes a first task execution text; the first task execution text is used to prompt that the query information output by the large model includes a first basic field and a second query condition, and prompts that the first basic field is determined from the candidate basic field and the second query condition is determined according to the candidate basic field; wherein the first basic field is used to query the corresponding business data, and the second query condition is used to limit the conditions that the business data queried by the first basic field needs to meet; Inputting the task processing instruction into the large model to obtain output query information; According to the first query condition, the query information and the constellation data model, query and obtain corresponding service data from a database corresponding to the constellation data model; The step of eliminating the basic fields related to the query condition of the specified type from the candidate basic fields includes: Obtain several character strings corresponding to the query conditions of the specified type; If any basic field among the candidate basic fields is the same as any of the character strings, it is determined that the basic field is related to the query condition of the specified type, and the basic field is removed; The query condition of the specified type includes a time condition; the query condition identification module identifies the time condition in the following manner: If a time entity in the natural query sentence is identified by the pre-trained time entity recognition model, the time entity is segmented based on the pre-trained time entity segmenter to obtain at least one time entity segmentation; wherein different time entity segmentations correspond to different time dimensions; Identify at least one time value covered by each of the temporal entity participles; Identify the time dimension corresponding to each of the time entity participles; According to the time dimension corresponding to each of the time entity segmentations, at least one time value covered, and a preset time digital format, obtaining at least one digital format time corresponding to each of the time entity segmentations; Obtain the time condition according to the digital format time corresponding to each of the time entity segmentations; The query condition of the specified type also includes a quantity restriction condition and a sorting condition; the query condition identification module identifies the quantity restriction condition and the sorting condition in the following manner: If it is identified that the natural query statement has a preset quantity limit keyword, a quantity limit condition is obtained according to the quantity limit keyword; and / or if it is identified that the natural query statement has a preset quantity range limit keyword and is adjacent to a first numerical value, a quantity limit condition is obtained according to the quantity range limit keyword and the first numerical value; If it is identified that the natural query statement has a preset sorting keyword, a sorting condition is obtained according to the sorting keyword.

2. The data query method based on a large model according to claim 1 is characterized in that: The constellation data model also records data operation fields bound to at least some basic fields; the task execution text also includes a second task execution text, the second task execution text is used to prompt that the query information output by the large model also includes a data operation field and a third basic field bound to the data operation field, the data operation field is determined from candidate data operation fields according to the query intent of the natural query statement; the data operation field is used to specify data operations on business data of the third basic field; After the step of removing the basic fields related to the query condition of the specified type from the candidate basic fields, the step further includes: Determine the data operation fields bound to each of the candidate basic fields as candidate data operation fields; The step of constructing a task processing instruction according to the candidate basic fields, the natural query statement and the preset task execution text includes: A task processing instruction is constructed according to the candidate basic fields, the candidate data operation fields, the natural query statement and the preset task execution text.

3. The data query method based on a large model according to claim 2 is characterized in that: The constellation data model also records the data types of each basic field, and different data types correspond to different candidate condition operators; the second query condition includes a second basic field and a condition operator; the task execution text also includes a third task execution text; The third task execution text is used to prompt the large model, the second basic field in the second query condition is determined from the candidate basic fields, and the conditional operator in the second query condition is determined from a set of candidate conditional operators; After the step of removing the basic fields related to the query condition of the specified type from the candidate basic fields, the step further includes: Determining a candidate conditional operator for each of the candidate basic fields according to the data type of each of the candidate basic fields; Obtain the candidate conditional operator set according to the candidate conditional operators of each of the candidate basic fields; The step of constructing a task processing instruction according to the candidate basic fields, the candidate data operation fields, the natural query statement and the preset task execution text includes: A task processing instruction is constructed according to the candidate basic fields, the candidate data operation fields, the candidate conditional operator set, the natural query statement and the preset task execution text.

4. The data query method based on a large model according to claim 1 is characterized in that: The task execution text further includes a fifth task execution text, and the fifth task execution text is used to prompt the large model to output the query information according to a preset report query request format; The step of querying and obtaining corresponding service data from a database corresponding to the constellation data model according to the first query condition, the query information and the constellation data model comprises: The first query condition is merged into the query information according to the report query request format, the merged query information is used as a report query request, and the report query request and the constellation data model are input into the MDX query engine, and the corresponding business data is obtained by querying from the database corresponding to the constellation data model through the MDX query engine; wherein the MDX query engine is an engine for parsing report query requests and performing data queries based on the parsing results and the constellation data model.

5. The data query method based on a large model according to claim 4 is characterized in that: The MDX query engine obtains the corresponding business data by querying in the following way: Parsing the report query request according to a preset parsing method to obtain a target field for query; determining a basic field according to the target field; Determine a plurality of star data models containing the basic fields from the constellation data model; wherein each of the star data models respectively records a fact table, a dimension table, and the basic fields respectively contained in each data table; If the target field includes a data operation field, corresponding operation definition information is obtained according to the data operation field; data model description information is generated according to each of the star data models and the operation definition information; an MDX statement is generated according to the report query request and the operation definition information; according to the MDX statement and the data model description information, a query result of the target field is obtained by querying from a database corresponding to the constellation data model; and the query result of the target field is determined to be the business data obtained by the query; If the target field does not include a data operation field, generate data model description information according to each of the star data models; generate an MDX statement according to the report query request; according to the MDX statement and the data model description information, query the query result of the target field from the database corresponding to the constellation data model; determine that the query result of the target field is the business data obtained by the query.

6. The data query method based on a large model according to claim 1, characterized in that: The step of determining a number of related basic fields as candidate basic fields from the constellation data model according to the natural query statement includes: Perform keyword recognition on the natural query sentence to obtain a number of keywords; Vectorizing each of the keywords and each basic field in the constellation data model; Calculating the vector similarity between any of the keywords and any of the basic fields; A basic field whose similarity with any of the keywords is greater than a preset similarity threshold is determined as a candidate basic field; or, based on the vector similarity between each basic field and the corresponding keyword, a preset number of basic fields with top similarity rankings are obtained, and the preset number of basic fields are determined as candidate basic fields.

7. The data query method based on a large model according to claim 6 is characterized in that: The step of performing keyword recognition on the natural query sentence to obtain a plurality of keywords includes: Segment the natural query sentence based on a preset word segmenter to obtain a word segmentation result; Based on the pre-trained entity recognition model, entity recognition is performed on the natural query sentence and the word segmentation result respectively to obtain a first entity recognition result and a second entity recognition result respectively; Several keywords are obtained according to the first entity recognition result and the second entity recognition result.