Query statement generation method, data query method and related equipment

By obtaining knowledge and information related to data analysis requests, determining business objects and calculation formulas, and generating query statements, the problem of generating query statements that do not meet expectations in the prior art is solved, and the accuracy and user experience of query statements are improved.

CN120067142APending Publication Date: 2025-05-30BEIJING ZITIAO NETWORK TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510130761.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-02-05
Publication Date
2025-05-30

AI Technical Summary

Technical Problem

In the prior art, the method of generating query statements based on artificial intelligence models is difficult to generate query statements that meet expectations.

Method used

By receiving data analysis requests, obtaining knowledge information associated with the request, determining business objects and calculation formulas, and then generating query statements.

Benefits of technology

Improve the accuracy of the generated query statements, making them more in line with user expectations, and improving the user experience.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120067142A_ABST
    Figure CN120067142A_ABST
Patent Text Reader

Abstract

The invention provides a query statement generation method, a data query method and related equipment. The query statement generation method comprises the following steps: in response to a received data analysis request, obtaining knowledge information associated with the data analysis request according to the data analysis request; determining one or more business objects corresponding to the data analysis request according to the data analysis request and the knowledge information; determining one or more data dimension calculation formulas and one or more data index calculation formulas corresponding to the data analysis request according to the data analysis request, the knowledge information and the one or more business objects; and generating a query statement according to the one or more business objects, the one or more data dimension calculation formulas and the one or more data index calculation formulas.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the field of computer technologies, and in particular, to a method for generating a query statement, a data query method, and related devices. Background Art

[0002] With the continuous development of digital technologies, digital services rely on the storage and query of a large amount of data. Generally, data queries can be implemented based on query statements, but the writing of query statements depends on humans, which affects work efficiency. In related technologies, a method for generating query statements based on an artificial intelligence model is proposed.

[0003] However, the inventors of the present disclosure have found that the method for generating query statements based on an artificial intelligence model in related technologies is difficult to generate query statements that meet expectations. Summary of the Invention

[0004] The present disclosure provides a method for generating a query statement, a data query method, and related devices to solve or partially solve the above problems.

[0005] In a first aspect of the present disclosure, a method for generating a query statement is provided, including:

[0006] In response to receiving a data analysis request, obtaining knowledge information associated with the data analysis request according to the data analysis request;

[0007] Determining one or more business objects corresponding to the data analysis request according to the data analysis request and the knowledge information;

[0008] Determining one or more data dimension calculation formulas and one or more data index calculation formulas corresponding to the data analysis request according to the data analysis request, the knowledge information, and the one or more business objects;

[0009] Generating a query statement according to the one or more business objects, the one or more data dimension calculation formulas, and the one or more data index calculation formulas.

[0010] In a second aspect of the present disclosure, a data query method is provided, including:

[0011] Receiving a data analysis request;

[0012] Generating a query statement according to the data analysis request by using the method described in the first aspect;

[0013] Querying data corresponding to the data analysis request based on the query statement.

[0014] In a third aspect of the present disclosure, a query statement generation device is provided, including:

[0015] An acquisition module, configured to: in response to receiving a data analysis request, acquire knowledge information associated with the data analysis request according to the data analysis request;

[0016] A first determination module, configured to: determine one or more service objects corresponding to the data analysis request according to the data analysis request and the knowledge information;

[0017] A second determination module, configured to: determine one or more data dimension calculation formulas and one or more data index calculation formulas corresponding to the data analysis request according to the data analysis request, the knowledge information, and the one or more service objects;

[0018] A generation module, configured to: generate a query statement according to the one or more service objects, the one or more data dimension calculation formulas, and the one or more data index calculation formulas.

[0019] In a fourth aspect of the present disclosure, a data query device is provided, including:

[0020] A receiving module, configured to: receive a data analysis request;

[0021] A generation module, configured to: generate a query statement according to the data analysis request by using the method described in the first aspect;

[0022] A query module, configured to: query the data corresponding to the data analysis request based on the query statement.

[0023] In a fifth aspect of the present disclosure, a computer device is provided, including one or more processors, a memory; and one or more programs, wherein the one or more programs are stored in the memory and executed by the one or more processors, and the programs include instructions for executing the method described in the first aspect or the second aspect.

[0024] In a sixth aspect of the present disclosure, a non-volatile computer-readable storage medium containing a computer program is provided. When the computer program is executed by one or more processors, the processors are caused to execute the method described in the first aspect or the second aspect.

[0025] In a seventh aspect of the present disclosure, a computer program product is provided, including a computer program, characterized in that when the computer program is executed by a processor, the steps of the method described in the first aspect or the second aspect are implemented.

[0026] The query statement generation method, data query method, and related devices provided by the embodiments of the present disclosure obtain the knowledge information associated with a data analysis request, then determine the business object and calculation formula corresponding to the data analysis request based on the data analysis request and its associated knowledge information, and further generate a query statement based on the business object and the calculation formula, which makes the process of generating the query statement increase the understanding of relevant knowledge. At the same time, the process of generating the query statement is split into at least two subtasks, so that the finally generated query statement can better meet the user's expectations and improve the user experience. BRIEF DESCRIPTION OF THE DRAWINGS

[0027] To more clearly illustrate the technical solutions in the present disclosure or related technologies, the following will briefly introduce the drawings required for use in the description of the embodiments or related technologies. Obviously, the drawings in the following description are only the embodiments of the present disclosure. For those of ordinary skill in the art, other drawings can be obtained based on these drawings without creative efforts.

[0028] Figure 1 FIG. shows a schematic diagram of an exemplary system provided by the embodiments of the present disclosure.

[0029] Figure 2 FIG. shows a schematic flowchart of an exemplary method provided by the embodiments of the present disclosure.

[0030] Figure 3 FIG. shows a schematic flowchart of another exemplary method provided by the embodiments of the present disclosure.

[0031] Figure 4 FIG. shows a schematic flowchart of yet another exemplary method provided by the embodiments of the present disclosure.

[0032] Figure 5 FIG. shows a schematic diagram of the hardware structure of an exemplary computer device provided by the embodiments of the present disclosure.

[0033] Figure 6 FIG. shows a schematic diagram of an exemplary device provided by the embodiments of the present disclosure.

[0034] Figure 7 FIG. shows a schematic diagram of another exemplary device provided by the embodiments of the present disclosure. DETAILED DESCRIPTION OF THE EMBODIMENTS

[0035] To make the objectives, technical solutions, and advantages of the present disclosure clearer, the following further describes the present disclosure in detail with reference to specific embodiments and the accompanying drawings.

[0036] It should be noted that, unless otherwise defined, the technical terms or scientific terms used in the embodiments of the present disclosure should have the ordinary meanings understood by those of ordinary skill in the field to which the present disclosure belongs. The "first", "second" and similar terms used in the embodiments of the present disclosure do not denote any order, quantity or importance, but are only used to distinguish different components. The terms such as "including" or "comprising" mean that the elements or objects appearing before this word cover the elements or objects listed after this word and their equivalents, without excluding other elements or objects. The terms such as "connected" or "coupled" are not limited to physical or mechanical connections, but may include electrical connections, whether direct or indirect. The terms such as "upper", "lower", "left" and "right" are only used to represent relative positional relationships, and when the absolute position of the object being described changes, the relative positional relationship may also change accordingly.

[0037] It can be understood that before using the technical solutions of the various embodiments of the present disclosure, the types, usage scopes, usage scenarios, etc. of the personal information involved will be informed to the user in an appropriate manner, and the user's authorization will be obtained.

[0038] For example, when receiving the user's active request, a prompt message is sent to the user to clearly prompt the user that the operation requested by the user will require obtaining and using the user's personal information. Thus, the user can autonomously choose whether to provide personal information to software or hardware such as an electronic device, an application program, a server or a storage medium that performs the operations of the technical solutions of the present disclosure according to the prompt message.

[0039] As an optional but non-limiting implementation manner, the way of sending a prompt message to the user in response to receiving the user's active request may be, for example, in the form of a pop-up window, and the prompt message may be presented in text in the pop-up window. In addition, the pop-up window may also carry a selection control for the user to choose "agree" or "disagree" to provide personal information to the electronic device.

[0040] It can be understood that the above process of notifying and obtaining the user's authorization is only illustrative and does not limit the implementation manner of the present disclosure, and other ways that meet relevant laws and regulations can also be applied to the implementation manner of the present disclosure.

[0041] Figure 1 FIG. shows a schematic diagram of an exemplary system 100 provided by an embodiment of the present disclosure.

[0042] As Figure 1As shown, the system 100 may include a terminal device 102, a server 106, and a database server 108. A medium (e.g., a network) providing a communication link may be included between the terminal device 102 and the server 106 and the database server 108. The network may include various connection types, such as wired, wireless communication links, or fiber optic cables, etc.

[0043] Various applications (APPs) or software may be installed on the terminal device 102, such as, for example, data query applications or software, collaborative office applications or software, image processing applications or software, video conferencing applications or software, reading applications or software, video applications or software, social applications or software, payment applications or software, web browsers, and instant messaging tools, etc. In some embodiments, these applications or software may all query data based on the request of the user 104.

[0044] The terminal device 102 here may be hardware or software. When the terminal device 102 is hardware, it may be various electronic devices with a display screen, including but not limited to smart phones, tablet computers, e-book readers, MP3 players, laptop computers (Laptops), and desktop computers (PCs), etc. When the terminal device 102 is software, it may be installed in the above-listed electronic devices. It may be implemented as multiple software or software modules (e.g., for providing distributed services), or it may be implemented as a single software or software module. No specific limitation is made here.

[0045] The server 106 may be a server providing various services, such as a background server supporting various applications displayed on the terminal device 102. The database server 108 may also be a database server providing various services. It can be understood that when the relevant functions of the database server 108 can be implemented in the server 106, the database server 108 may not be provided in the system 100.

[0046] The server 106 and the database server 108 here may also be hardware or software. When they are hardware, they may be implemented as a distributed server cluster composed of multiple servers, or they may be implemented as a single server. When they are software, they may be implemented as multiple software or software modules (e.g., for providing distributed services), or they may be implemented as a single software or software module. No specific limitation is made here.

[0047] It should be noted that the method for editing a document provided by the embodiments of the present disclosure may be executed by the server 106. It should be understood that Figure 1The number of terminal devices, users, servers and database servers in the embodiment is only for illustration. Any number of terminal devices, users, servers and database servers may be provided as required.

[0048] In one embodiment, a data query application or software may be installed in the terminal device 102, and the user 104 may use the application or software installed in the terminal device 102 to send a query request to the server 106. The server 106 queries data based on the query request and returns the query result to the terminal device 102.

[0049] As mentioned above, in the related art, an artificial intelligence (AI) model can be used to convert the query request input by the user 104 into an executable query statement, so as to save the process of manually constructing the query statement and improve the data query efficiency.

[0050] However, the inventors of the present disclosure discovered that, taking the use of a large language model (LLM) as an example, the system 100 needs to embed a large amount of business query background knowledge in the context of the data query generation dialogue to help the large language model understand the specific business scenario. The overall number of tokens consumed is large, and the large language model context window length is required to be high.

[0051] In view of this, an embodiment of the present disclosure provides a method for generating a query statement to solve or partially solve the above problem.

[0052] Figure 2 FIG. 2 is a flow chart of an exemplary method 200 provided by an embodiment of the present disclosure. The method 200 may be used to generate a query statement. Optionally, the method 200 may be Figure 1 The server 106 can also be implemented by Figure 1 By way of example, the following describes the method 200 implemented by the server 106.

[0053] like Figure 2 As shown, the user 104 can use the terminal device 102 to input a sentence (for example, "Has the actual R&D time of the R&D team of the XX business line exceeded expectations this quarter?") to generate the data analysis request 202 and send the data analysis request 202 to the server 106 for processing.

[0054] After receiving the data analysis request 202, the server 106 can query data according to the data analysis request 202 and return the query result to the terminal device 102. As mentioned above, when using an artificial intelligence model to generate a query statement in the related art, a large amount of business query background knowledge needs to be embedded in the context of the data query generation dialogue. To solve this problem, in response to receiving the data analysis request 202, the server 106 according to an embodiment of the present disclosure can obtain knowledge information 204 associated with the data analysis request 202 in real time. Exemplarily, keywords can be obtained by parsing the data analysis request 202 to match corresponding knowledge information in the knowledge base.

[0055] Optionally, as Figure 2 shown, on the server 106 side, a knowledge base can be further included. The knowledge base can be defined by the actual business system and the configurator, and includes various common knowledge entries required in the user scenario, including the definitions, explanations, and related documents of relevant knowledge or terms in a specific business system. Optionally, a piece of knowledge can include information such as a term name, a term interpretation, and an application scenario. Among them, the term interpretation can further include information such as a definition, a calculation formula, and an example. The application scenario can include specific scenarios where the knowledge can be used.

[0056] For example, an enterprise can define the following terms as the knowledge in the R & D scenario knowledge base:

[0057] Term name: R & D efficiency.

[0058] Term interpretation:

[0059] Definition: R & D efficiency refers to the proportional relationship between the theoretically required R & D duration and the actual consumed duration in an organization or project. It is used to measure whether time is fully utilized.

[0060] Calculation formula: R & D efficiency = (theoretically maximum working time / actual working time) × 100%.

[0061] Example: The theoretically maximum working time of a project is 2160 hours. If the actual working time is 2880 hours, then the R & D efficiency of this project is (2160 / 2880) × 100% = 75%.

[0062] Application scenario:

[0063] Project management field:

[0064] In a project team, understanding the R & D efficiency of the project helps the project manager arrange tasks reasonably. For example, in a software development project, through the evaluation of the R & D efficiency, it is found that the development efficiency in a certain stage is lower than 70%, and there are new urgent tasks added. The project manager needs to consider whether to increase the manpower, extend the project cycle, or adjust the task priority to avoid overworking the developers and ensure the project quality.

[0065] In some embodiments, the step of obtaining knowledge information associated with the data analysis request according to the data analysis request may be to first extract keywords from the data analysis request 202 based on a natural language processing (NLP) algorithm to determine one or more initial keywords corresponding to the data analysis request 202, then screen the one or more initial keywords to determine one or more target keywords, and finally obtain the knowledge information based on the one or more target keywords. In this way, on the basis of implementing the extraction of initial keywords based on the NLP algorithm, and then screening out target keywords from the data analysis request 202 to obtain matching knowledge information from the knowledge base, the obtained knowledge information can be more relevant to the data analysis request 202, and to a certain extent, avoid embedding a large amount of business query background knowledge in the context of generating a dialogue for data query.

[0066] Optionally, an NLP algorithm can be used to extract keywords from the user's original data analysis requirement statement to obtain a keyword list. For example, the initial keywords can be extracted from "Whether the actual R & D duration of the R & D team of the XX business line this quarter exceeds the expectation": this quarter, XX business line, R & D team, actual R & D duration, exceeds, expectation.

[0067] Optionally, a large language model can be used to screen the keyword list to obtain keywords related to the actual business scenario. For example, the target keywords can be screened out from the initial keywords: R & D team, actual R & D duration, expectation.

[0068] Optionally, based on the screened keyword list, a vectorization method can be used to perform a relevance search and knowledge item recall on the business scenario knowledge base to obtain relevant knowledge information. For example, the target keywords are converted into feature vectors, and then knowledge information 204 with a similarity higher than the threshold is recalled from the knowledge base based on the vector similarity algorithm, such as the definition of R & D efficiency, the definition of R & D cycle.

[0069] In this way, in the knowledge recall step, based on the data analysis requirements proposed by the user, through the NLP algorithm and / or the large language model, the relevant knowledge points in the business scenario knowledge base related to the user's data analysis requirements are screened, and after being sorted according to the degree of relevance, they form a set of relevant background knowledge items on which to solve the data analysis requirements, ensuring the output effect of the model.

[0070] After obtaining the knowledge information, the server 106 may generate query meta-information based on the data analysis request 202 and the knowledge information 204. The query meta-information is used to generate a query statement and may include the meta-information required for generating the query statement. Optionally, the meta-information may include a data dimension calculation formula and a data metric calculation formula, so that the generated query statement may include information on which dimensions of data to calculate what metrics, and then data query and result generation may be performed accordingly.

[0071] Since both the data dimension calculation formula and the data metric calculation formula need to obtain corresponding data objects for calculation, and there is a corresponding relationship between the data objects and the business objects, in some embodiments, the business objects corresponding to the data analysis request 202 may be obtained first. Specifically, one or more business objects corresponding to the data analysis request 202 may be determined according to the data analysis request 202 and the knowledge information 204. In this way, based on identifying the intention of the data analysis request 202 and combining the knowledge information 204 recalled from the knowledge base, one or more business objects corresponding to the data analysis request 202 may be determined.

[0072] In some embodiments, determining the business objects may be to first obtain a predefined set of business objects, and then determine one or more business objects corresponding to the data analysis request according to the data analysis request 202, the knowledge information 204, and the predefined set of business objects. In this way, in the business object selection task, only the object list related to the data analysis request 202 needs to be selected from the set of candidate business objects, which can improve the accuracy of selecting business objects and the final generation effect.

[0073] Optionally, the predefined set of business objects may be a set of business objects pre-configured according to each business system. In some embodiments, as Figure 2 shown, the system 100 may include an Object Relational Mapping (ORM) model, which defines the mapping relationship between the logical model and the actual storage model of business data. For example, by applying the object relational mapping technology, the data objects stored in relational data tables in the system storage service are mapped to the business objects in the business domain, and the relationships such as association, inclusion, and mapping between the objects are mapped into table join operations between different data tables. Therefore, the ORM model may include the predefined set of business objects, and then the server 106 may call the ORM model to obtain the predefined set of business objects and determine one or more corresponding business objects from the predefined set of business objects according to the knowledge information 204 and the data analysis request 202.

[0074] Further, the step of determining the business object may be implemented by invoking a large language model (LLM). Optionally, the large language model may be any general large language model. When invoking the large language model in the embodiments of the present disclosure, the corresponding prompt may be determined according to the specific task to guide the output of the large language model.

[0075] Therefore, in some embodiments, the server 106 may determine a first prompt based on the data analysis request 202, the knowledge information 204, and the predefined set of business objects. The first prompt is used to define the content and format corresponding to the one or more business objects for the output of the large language model. Then, the server 106 may invoke the large language model, input the first prompt into the large language model, and output the one or more business objects, thereby using the large language model to implement the selection of the business object. In this way, since this step is equivalent to having the large language model make multiple selections from the predefined set of business objects, the evaluation and optimization difficulty of this step is significantly lower than directly generating a query statement.

[0076] Optionally, the first prompt may include role information, task information, and output format information, so as to guide the large language model to complete what task in what role and output the result in the required format.

[0077] For example, the first prompt may include the following information:

[0078] Role: You are an experienced data analysis and modeling expert. You can accurately screen relevant business objects and fields from the given set of business objects according to the user's data analysis requirements and relevant knowledge, and determine a business object as the data source object. By defining the scope of the data source object, the business data within a specific range can be analyzed according to the user's data analysis requirements.

[0079] Task: According to the user's data analysis requirements, screen relevant business objects and fields from the given set of business objects. By defining the scope of the data source object, the business data within a specific range can be analyzed according to the user's data analysis requirements.

[0080] Output format:

[0081] Please use the following format for output, without adding any additional explanations:

[0082] Data source object: <data source object name>

[0083] List of data analysis related objects and fields: <list of data analysis related object fields>

[0084] In addition to the above information, the first prompt may further include the data analysis request 202, the knowledge information 204, and the predefined set of business objects obtained in the foregoing steps, so that after the first prompt is input into the large language model, it can better guide the output of the model.

[0085] Exemplarily, the large model may output the following based on the first prompt:

[0086] Data source object: Work item

[0087] List of data analysis related objects and fields:

[0088] - Work item.Id

[0089] - Work item.Type

[0090] - Work item.Priority

[0091] - Node.Id

[0092] - Node.Owner work item Id

[0093] - Subtask.Id

[0094] - Subtask.Owner node

[0095] In this way, the large language model can output business object information that is more in line with expectations based on the first prompt for subsequent generation of query statements.

[0096] After determining the one or more business objects, the server 106 may determine one or more data dimension calculation formulas and one or more data metric calculation formulas corresponding to the data analysis request according to the data analysis request 202, the knowledge information 204, and the one or more business objects 206. In this way, the query statement generated based on the data dimension calculation formula and the data metric calculation formula can finally return a data table as a result and output it to the user 104.

[0097] In some embodiments, the large language model may be called again to output one or more data dimension calculation formulas and one or more data metric calculation formulas corresponding to the data analysis request. Specifically, a second prompt may be determined according to the data analysis request 202, the knowledge information 204, the predefined set of business objects, and the one or more business objects 206. The second prompt is used to limit the content and format output by the large language model corresponding to the data dimension calculation formula and the data metric calculation formula. Then, the large language model is called, and the second prompt is input into the large language model to output the one or more data dimension calculation formulas and the one or more data metric calculation formulas.

[0098] Optionally, the second prompt may include role information, task information, and output format information different from the first prompt, so as to guide the large language model with a new prompt on what role to play for what task and output the result in the required format.

[0099] For example, the second prompt may include the following information:

[0100] Role:

[0101] You are an experienced data analysis and modeling expert. You can accurately break down the data analysis scenario into several "dimensions" and "indicator" data columns according to the user's data analysis requirements and relevant knowledge. All the "dimensions" and "indicator" data columns will form the result table of the data analysis. Through the calculation logic of the "dimensions" and "indicator" data columns in this result table, the user's data analysis requirements can be met.

[0102] Output format:

[0103] Output the names of each "dimension" and "indicator" data column and the calculation formula based on the "data object field" in the following format in sequence. Do not include data filtering logic in the calculation formula and do not add any additional explanations.

[0104] Name of Dimension 1,

[0105] Calculation formula for Dimension 1;

[0106] Name of Dimension 2,

[0107] Calculation formula for Dimension 2

[0108] …

[0109] Name of Indicator 1,

[0110] Calculation formula for Indicator 1

[0111] …

[0112] In addition to the above information, the second prompt may also include the data analysis request 202, the knowledge information 204, the predefined business object set, and the one or more business objects 206 obtained in the previous steps, so that the second prompt can better guide the output of the model after being input into the large language model.

[0113] Exemplarily, the large model may output the following based on the second prompt:

[0114] Work item Id,

[0115] Work item.Id;

[0116] Work item type,

[0117] Work item. Type;

[0118] Work item priority,

[0119] Work item. Priority;

[0120] Average number of subtasks per node,

[0121] (Id of the subtask set in the process node set of the work item) / COUNT(DISTINCT Id of the process node set of the work item").

[0122] The dimension & metric formula generation module relies on the understanding ability of the large language model to convert the data analysis requirements into designing a data table, and disassembles the data analysis scenario into defining the dimensions and metric expressions of the data chart. In the dimension and metric expressions, each field in the business object set can be referenced for secondary calculation.

[0123] It can be seen that the formula generation task translates the data analysis request into a simple calculation formula that the query statement generation module can parse, which may not involve writing actual programming codes such as SQL or Python, and has lower requirements for the programming and mathematical abilities of the large language model. Thus, the large language model can output more compliant results.

[0124] In some embodiments, the server 106 can further generate a query statement according to the one or more business objects 206, the one or more data dimension calculation formulas, and the one or more data metric calculation formulas 208.

[0125] As mentioned above, since the formula generation task translates the data analysis request into a simple calculation formula that the query statement generation module can parse, subsequent by parsing the one or more data dimension calculation formulas and the one or more data metric calculation formulas 208, and then combining the one or more business objects 206, the corresponding query statement can be generated. Since the process of generating the query statement is disassembled into multiple subtasks, only need to call the large language model multiple times to execute different subtasks, rather than only calling the large language model once to directly generate the query statement, which makes the generation effect better.

[0126] In some embodiments, since the data analysis request 202 may contain the semantics of defining a specific data range, therefore, as Figure 2 shown, the method 200 may further include:

[0127] Determine a third prompt according to the data analysis request 202, the knowledge information 204, the predefined business object set, and the one or more business objects 206, where the third prompt is used to limit the content and format output by the large language model corresponding to the data query range;

[0128] Invoke the large language model, input the third prompt into the large language model, and output the data query range 210 corresponding to the data analysis request.

[0129] Optionally, the third prompt may include role information, task information, and output format information different from the first prompt and the second prompt, so as to guide the large language model with a new prompt on what role to play what task and output the result according to the required format.

[0130] For example, the third prompt may include the following information:

[0131] Role: You are an experienced data analysis and modeling expert. You can accurately determine the selected range of the data source object according to the user's data analysis requirements and relevant knowledge, so as to accurately limit the target data set for data analysis.

[0132] Output format: Only output the conditional description of the selected range of the data source object, without adding any additional explanations.

[0133] In addition to the above information, the third prompt may further include the data analysis request 202, the knowledge information 204, the predefined business object set, and the one or more business objects 206 obtained in the previous step, so that after the third prompt is input into the large language model, it can better guide the output of the model.

[0134] Exemplarily, the large model may output the following based on the third prompt:

[0135] work item.type = "requirement" AND work item.priority = "high"

[0136] The data query range processing module is used to delineate and generate the range of the target data query object, and generate the corresponding data query object range according to the user's data analysis requirements. In this way, when generating the query statement later, the data object can be obtained based on the delineated range above. The data query range processing task describes and extracts the range of the data source object that has been determined according to the user's question, which is actually a text extraction and summarization process.

[0137] Further, in some embodiments, generating the query statement according to the one or more business objects, the one or more data dimension calculation formulas, and the one or more data index calculation formulas may further include: generating the query statement according to the data query range, the one or more business objects, the one or more data dimension calculation formulas, and the one or more data index calculation formulas.

[0138] It can be seen that the data query meta-information generation module in the embodiments of the present disclosure utilizes the natural language understanding and summarization capabilities of large language models, combines the current data ORM model of the business system, scenario-related knowledge, and the user's data analysis requirements to complete the generation of data query meta-information. Compared with directly having the large language model generate data query statements, the query meta-information generation module breaks down the generation process into three parts. Each independent step actually corresponds to a simple task, reducing the complexity of a single-step task, thereby reducing the error probability of the large language model. Specifically, it can reduce the difficulty of evaluating and optimizing the output quality of the overall data query generation. Moreover, when directly generating data query statements, it not only depends on the data model description, user questions, and relevant knowledge, but also requires embedding a large number of semantic constraint conditions for the data query statements, and the context length is prone to being too long, causing problems such as hallucinations and forgetting in the large language model. The query meta-information generation module breaks down the generation process into three parts, and the Prompt input for each independent step can be further streamlined, making the model output more accurate.

[0139] The inventors of the present disclosure also found that in the system storage services of related technologies, data objects are usually stored in relational data tables. When generating query statements based on large language models, the large language model needs to understand the background knowledge of business queries, and at the same time, it also needs to understand the mapping relationship between the business data model and the storage data model. The Prompt tuning in the data query generation stage is difficult. Moreover, for scenarios with complex business data models or storage data models, the large language model has poor understanding ability of the association relationship between data fields and data tables, and cannot accurately follow the user's requirements and the relationship between data models to write data query statements that meet expectations.

[0140] Therefore, in some embodiments, as Figure 2 shown, the server 106 can utilize the ORM model to obtain the mapping relationship between business objects and data objects. In this way, by configuring the data model mapping, when subsequent data query generation is performed, there is no need to directly expose the database table field structure and relationship to the large language model, and the business model can be simplified and abstracted to a certain extent, making it more convenient for the large language model to understand data objects and the relationships between objects. Moreover, different large language models have significant differences in the understanding ability of the database table structure described in data languages (such as SQL). The logical data model described in natural language in the embodiments of the present disclosure can lower the understanding threshold of the large language model and can adapt to more types of large language models.

[0141] Furthermore, as Figure 2 shown, in some embodiments, generating the query statement according to the data query range, the one or more business objects, the one or more data dimension calculation formulas, and the one or more data index calculation formulas includes:

[0142] Invoke the object-relational mapping model (ORM model) to determine the mapping relationship between the one or more business objects and the one or more data objects;

[0143] Based on the abstract syntax tree (AST) and the mapping relationship, generate the query statement 212 according to the data query scope 210, the one or more business objects 206, the one or more data dimension calculation formulas, and the one or more data metric calculation formulas 208.

[0144] In this way, by invoking the ORM model, the mapping relationship between the business objects and the data objects in the relational database can be determined. Furthermore, according to this mapping relationship, the business objects in the data query scope 210, the one or more data dimension calculation formulas, and the one or more data metric calculation formulas 208 can be replaced with the corresponding data objects, so that the objects in the query statement 212 are the data objects in the relational database, realizing data query in the relational database. At the same time, based on the abstract syntax tree, the query statement 212 can be obtained by escaping according to the data query scope 210, the one or more business objects 206, the one or more data dimension calculation formulas, and the one or more data metric calculation formulas 208. In this way, the generation of the query statement is realized.

[0145] For example:

[0146] In a project management system, there are the following business objects and fields, and the mapping relationship between the data tables of their corresponding storage models is as follows:

[0147] # Work item (data table: WorkItem)

[0148] - Id (Id)

[0149] - Name (Name)

[0150] - Type (Type)

[0151] - Priority (Priority)

[0152] - Description (Description)

[0153] - Process node set (connected by the Node.work item_id column and the WorkItem.Id column)

[0154] # Node (data table: Node)

[0155] - Id (Id)

[0156] - Belonging work item Id (work_item_id)

[0157] - Name

[0158] - Subtask set (join the SubTask.node_id column and the Node.Id column)

[0159] # Subtask (data table: SubTask)

[0160] - Id

[0161] - Belonging node (node_id)

[0162] - Name

[0163] - Description

[0164] Among them, in front of the brackets are the business objects and their fields, and inside the brackets are the data tables and their fields. Exemplarily, for example, a work item is a business object, and its corresponding data table is the WorkItem table. The business object field Id corresponds to the Id field in the WorkItem table.

[0165] Suppose there is a query task to select all subtask names under a certain work item. The actual business semantic field path is: work item. Process node set, subtask set, name.

[0166] Based on the abstract syntax tree (AST) and the mapping relationship, a SQL query statement for the corresponding fields can be generated.

[0167] After the data query scope is defined and the dimension index formula is generated, a complete configuration of a specific data query is actually completed, including the selection of the data source object set and the definition of the dimension and index calculation logic in the data result set. In the data query generation module, through the ORM framework output by the data model mapping configuration, the above formula set containing business object fields can be translated into an actual data query statement.

[0168] In this way, the simple and structured data query meta-information is escaped into actual program code (SQL in the example) according to fixed rules. Since the query generation module can map data tables and fields based on a fixed abstract syntax tree and ORM mapping rules, it can perform lossless translation and generate correct data query code, avoiding syntax errors and logical hallucinations that are easily introduced by large language models during the code generation stage, and significantly improving the correctness of the overall query generation method.

[0169] Exemplarily, based on the data query range 210, the one or more business objects 206, the one or more data dimension calculation formulas, and the one or more data metric calculation formulas 208, the server 106 can generate a structured information, and based on this structured information, a query statement can be further generated. In this way, a query statement that is more in line with expectations is obtained.

[0170] In some embodiments, the query statement includes a Structured Query Language (SQL) statement, so that the query statement can be applicable to the query tasks of relational databases, and the applicable range is wider.

[0171] As can be seen from the above embodiments, the query statement generation method provided by the embodiments of the present disclosure reduces the Token consumption of the application system for the large language model, avoids directly exposing the underlying data layer design implementation to the large language model, improves the generation accuracy of the data query statement, and reduces the Prompt complexity in the data query generation stage during the process of generating a query statement based on natural language. By adopting this method, the conversational data analysis ability of the AI application service is improved, and the AI application service is enabled to have the ability to understand business data.

[0172] The query statement generation method provided by the embodiments of the present disclosure simplifies the understanding process of the large language model for the data structure and object relationship by exposing the semantics of the actual business scenario objects to the large language model, combines the knowledge related to the business scenario, outputs logically clear and structured data query meta-information, and uses the ORM mapping relationship between the business scenario data model and the business model to convert the data query metadata into an actually executable data query statement step by step, and can generate a correct data query statement that conforms to the user's actual data analysis intention, simplifies the dependence of the intermediate steps on the accuracy of the large model generation result and the overall Token consumption, and improves the overall data query generation accuracy and reduces the tuning difficulty.

[0173] The embodiments of the present disclosure further provide a data query method. After receiving a data analysis request, according to the data analysis request 202, a query statement 212 is generated by using the method described above, and then based on the query statement 212, the data corresponding to the data analysis request 202 is queried and returned to the terminal device 102. Since the accuracy of the query statement 212 is relatively high, the data queried based on the query statement 212 can better meet the user's expectations and improve the user experience.

[0174] It should be noted that the method of the embodiments of the present disclosure can be executed by a single device, such as a computer or a server. The method of this embodiment can also be applied to a distributed scenario and completed by multiple devices cooperating with each other. In such a distributed scenario, one of the multiple devices can only execute one or more steps of the method of the embodiments of the present disclosure, and these multiple devices will interact with each other to complete the described method.

[0175] It should be noted that some embodiments of the present disclosure have been described above. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recited in the claims can be performed in a different order than in the above embodiments and still achieve the desired result. Additionally, the processes depicted in the figures do not necessarily require the particular order or sequential order shown to achieve the desired result. In certain embodiments, multitasking and parallel processing are also possible or may be advantageous.

[0176] The embodiments of the present disclosure also provide a method for generating a query statement. Figure 3 The flowchart of an exemplary method 300 provided by the embodiments of the present disclosure is shown. This method 300 can be implemented by Figure 1 the server 106 or jointly implemented by each device of the system 100. As Figure 3 shown, this method 300 may include the following steps.

[0177] In step 302, in response to receiving a data analysis request (e.g., Figure 2 request 202), obtain knowledge information associated with the data analysis request according to the data analysis request (e.g., Figure 2 knowledge information 204).

[0178] In step 304, determine one or more business objects corresponding to the data analysis request according to the data analysis request and the knowledge information (e.g., Figure 2 business object 206).

[0179] In step 306, determine one or more data dimension calculation formulas and one or more data index calculation formulas corresponding to the data analysis request according to the data analysis request, the knowledge information, and the one or more business objects (e.g., Figure 2 dimension & index formula 208).

[0180] In step 308, generate a query statement according to the one or more business objects, the one or more data dimension calculation formulas, and the one or more data index calculation formulas (e.g., Figure 2 query statement 212).

[0181] The query statement generation method provided by the embodiments of the present disclosure obtains knowledge information associated with a data analysis request, then determines a business object and a calculation formula corresponding to the data analysis request based on the data analysis request and its associated knowledge information, and further generates a query statement based on the business object and the calculation formula, so that the process of generating the query statement increases the understanding of relevant knowledge, and at the same time splits the process of generating the query statement into at least two subtasks, so that the finally generated query statement can better meet the user's expectations and improve the user experience.

[0182] In some embodiments, obtaining knowledge information associated with the data analysis request according to the data analysis request includes:

[0183] Based on a natural language processing algorithm, extract keywords from the data analysis request to determine one or more initial keywords corresponding to the data analysis request;

[0184] Screen the one or more initial keywords to determine one or more target keywords;

[0185] In this way, on the basis of implementing initial keyword extraction based on the NLP algorithm, then screen out target keywords from the data analysis request to obtain matching knowledge information from the knowledge base, which can make the obtained knowledge information more relevant to the data analysis request, and to a certain extent avoid embedding a large amount of business query background knowledge in the context of data query generation conversations.

[0186] Obtain the knowledge information based on the one or more target keywords.

[0187] In some embodiments, determining one or more business objects corresponding to the data analysis request according to the data analysis request and the knowledge information includes:

[0188] Obtain a predefined set of business objects;

[0189] Determine one or more business objects corresponding to the data analysis request according to the data analysis request, the knowledge information, and the predefined set of business objects.

[0190] In this way, in the business object selection task, only need to select a list of objects related to the data analysis request from the set of candidate business objects, which can improve the accuracy of selecting business objects and the final generation effect.

[0191] In some embodiments, determining one or more business objects corresponding to the data analysis request according to the data analysis request, the knowledge information, and the predefined set of business objects includes:

[0192] Determine a first prompt based on the data analysis request, the knowledge information, and the predefined set of business objects, where the first prompt is used to define the content and format corresponding to the one or more business objects output by the large language model;

[0193] Invoke the large language model, input the first prompt into the large language model, and output the one or more business objects.

[0194] In this way, since this step is equivalent to having the large language model make multiple selections from the predefined set of business objects, the evaluation and optimization difficulty of this step is significantly lower than directly generating query statements.

[0195] In some embodiments, determining one or more data dimension calculation formulas and one or more data metric calculation formulas corresponding to the data analysis request according to the data analysis request, the knowledge information, and the one or more business objects includes:

[0196] Determine a second prompt based on the data analysis request, the knowledge information, the predefined set of business objects, and the one or more business objects, where the second prompt is used to define the content and format corresponding to the data dimension calculation formula and the data metric calculation formula output by the large language model;

[0197] Invoke the large language model, input the second prompt into the large language model, and output the one or more data dimension calculation formulas and the one or more data metric calculation formulas.

[0198] It can be seen that the formula generation task translates the data analysis request into simple calculation formulas that can be parsed by the query statement generation module, without involving actual programming code writing such as SQL or Python, and has lower requirements for the programming and mathematical abilities of the large language model, so that the large language model can output more compliant results.

[0199] In some embodiments, the method further includes:

[0200] Determine a third prompt based on the data analysis request, the knowledge information, the predefined set of business objects, and the one or more business objects, where the third prompt is used to define the content and format corresponding to the data query range output by the large language model;

[0201] Invoke the large language model, input the third prompt into the large language model, and output the data query range corresponding to the data analysis request (for example, Figure 2 data query range 210).

[0202] The data query scope processing module is used to delimit and generate the scope of the target data query object, and generate the corresponding data query object scope according to the user's data analysis requirements. In this way, when generating the query statement subsequently, the data object can be obtained based on the delimited scope above. The data query scope processing task describes and extracts the scope of the determined data source object based on the user's question, which is actually a text extraction and summarization process.

[0203] In some embodiments, generating a query statement according to the one or more business objects, the one or more data dimension calculation formulas, and the one or more data index calculation formulas includes:

[0204] Generating the query statement according to the data query scope, the one or more business objects, the one or more data dimension calculation formulas, and the one or more data index calculation formulas.

[0205] It can be seen that the data query meta-information generation module of the embodiments of the present disclosure utilizes the natural language understanding and summarization capabilities of the large language model, combines the current data ORM model of the business system, scenario-related knowledge, and the user's data analysis requirements to complete the generation of data query meta-information. Compared with directly letting the large language model generate the data query statement, the query meta-information generation module disassembles the generation steps into three parts, and each independent step actually corresponds to a simple task, reducing the task complexity of a single step, thereby reducing the error probability of the large language model.

[0206] In some embodiments, generating the query statement according to the data query scope, the one or more business objects, the one or more data dimension calculation formulas, and the one or more data index calculation formulas includes:

[0207] Invoking the object-relational mapping model to determine the mapping relationship between the one or more business objects and the one or more data objects;

[0208] Based on the abstract syntax tree and the mapping relationship, generating the query statement according to the data query scope, the one or more business objects, the one or more data dimension calculation formulas, and the one or more data index calculation formulas.

[0209] In this way, by invoking the ORM model, the mapping relationship between the business object and the data object in the relational database can be determined. Furthermore, according to this mapping relationship, the business objects in the data query scope 210, the one or more data dimension calculation formulas, and the one or more data index calculation formulas 208 can be replaced with corresponding data objects, so that the objects in the query statement 212 are data objects in the relational database, realizing data query in the relational database. At the same time, based on the abstract syntax tree, the query statement 212 can be obtained by escaping according to the data query scope 210, the one or more business objects 206, the one or more data dimension calculation formulas, and the one or more data index calculation formulas 208. In this way, the generation of the query statement is realized.

[0210] In some embodiments, the query statement includes a Structured Query Language (SQL) statement, making the query statement applicable to the query tasks of relational databases and having a wider application scope.

[0211] It should be noted that the method of the embodiments of the present disclosure can be executed by a single device, such as a computer or a server. The method of this embodiment can also be applied to a distributed scenario, and multiple devices cooperate with each other to complete it. In such a distributed scenario, one of the multiple devices can only execute one or more steps of the method of the embodiments of the present disclosure, and these multiple devices will interact with each other to complete the described method.

[0212] It should be noted that some embodiments of the present disclosure have been described above. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recited in the claims can be executed in a different order from that in the above embodiments and still achieve the desired results. Additionally, the processes depicted in the drawings do not necessarily require the specific order or continuous order shown to achieve the desired results. In certain embodiments, multitasking and parallel processing are also possible or may be advantageous.

[0213] The embodiments of the present disclosure also provide a data processing method. Figure 4 The flowchart of the exemplary method 400 provided by the embodiments of the present disclosure is shown. This method 400 can be implemented by Figure 1 the server 106 or jointly implemented by each device of the system 100. As Figure 4 shown, this method 400 may include the following steps.

[0214] In step 402, receive a data analysis request.

[0215] In step 404, according to the data analysis request, any embodiment or arrangement and combination of embodiments of method 200 or 300 is adopted to generate a query statement (for example, Figure 2 query statement 212).

[0216] In step 406, based on the query statement, the data corresponding to the data analysis request is queried.

[0217] The data query method provided by the embodiments of the present disclosure obtains the knowledge information associated therewith according to the data analysis request, and then determines the business object and calculation formula corresponding to the data analysis request based on the data analysis request and its associated knowledge information. Furthermore, a query statement is generated based on the business object and the calculation formula, so that the process of generating the query statement increases the understanding of relevant knowledge, and at the same time, the process of generating the query statement is split into at least two subtasks, so that the finally generated query statement can better meet the user's expectations, and the queried data also better meets the user's needs, thereby improving the user experience.

[0218] The embodiments of the present disclosure also provide a computer device for implementing the above methods 200, 300, and 400. Figure 5 The hardware structure diagram of an exemplary computer device 500 provided by the embodiments of the present disclosure is shown. The computer device 500 can be used to implement Figure 1 the server 106, or can also be used to implement Figure 1 the terminal devices 102 and 104. In some scenarios, the computer device 500 can also be used to implement Figure 1 the database server 108.

[0219] As Figure 5 shown, the computer device 500 may include: a processor 502, a memory 504, a network module 506, a peripheral interface 508, and a bus 510. Among them, the processor 502, the memory 504, the network module 506, and the peripheral interface 508 are communicatively connected to each other inside the computer device 500 through the bus 510.

[0220] The processor 502 may be a central processing unit (CPU), an image processor, a neural network processor (NPU), a microcontroller (MCU), a programmable logic device, a digital signal processor (DSP), an application specific integrated circuit (ASIC), or one or more integrated circuits. The processor 502 may be used to execute functions related to the technologies described in the present disclosure. In some embodiments, the processor 502 may further include multiple processors integrated into a single logic component. For example, as Figure 5As shown, the processor 502 may include multiple processors 502a, 502b, and 502c.

[0221] The memory 504 may be configured to store data (e.g., instructions, computer code, etc.). As Figure 5 shown, the data stored in the memory 504 may include program instructions (e.g., program instructions for implementing the methods 200, 300, 400 of the embodiments of the present disclosure) and data to be processed (e.g., the memory may store configuration files of other modules, etc.). The processor 502 may also access the program instructions and data stored in the memory 504 and execute the program instructions to operate on the data to be processed. The memory 504 may include a volatile storage device or a non-volatile storage device. In some embodiments, the memory 504 may include a random access memory (RAM), a read-only memory (ROM), an optical disc, a magnetic disk, a hard disk, a solid-state drive (SSD), a flash memory, a memory stick, etc.

[0222] The network interface 506 may be configured to provide communication with other external devices to the computer device 500 via a network. The network may be any wired or wireless network capable of transmitting and receiving data. For example, the network may be a wired network, a local wireless network (e.g., Bluetooth, WiFi, near field communication (NFC), etc.), a cellular network, the Internet, or a combination of the above. It can be understood that the type of the network is not limited to the above specific examples.

[0223] The peripheral interface 508 may be configured to connect the computer device 500 to one or more peripheral devices to achieve information input and output. For example, the peripheral devices may include input devices such as a keyboard, a mouse, a touchpad, a touch screen, a microphone, various sensors, etc. and output devices such as a display, a speaker, a vibrator, an indicator light, etc.

[0224] The bus 510 may be configured to transmit information between the various components of the computer device 500 (e.g., the processor 502, the memory 504, the network interface 506, and the peripheral interface 508), such as an internal bus (e.g., a processor-memory bus), an external bus (USB port, PCI-E bus), etc.

[0225] It should be noted that although the architecture of the computer device 500 shown above only shows the processor 502, the memory 504, the network interface 506, the peripheral interface 508, and the bus 510, in the specific implementation process, the architecture of the computer device 500 may also include other components necessary for normal operation. In addition, those skilled in the art can understand that the architecture of the computer device 500 above may also only include the components necessary for implementing the solution of the embodiments of the present disclosure and does not necessarily include all the components shown in the figure.

[0226] The embodiments of the present disclosure also provide a query statement generation device. Figure 6 FIG. shows a schematic diagram of an exemplary device 600 provided by the embodiments of the present disclosure. As Figure 6 shown, the device 600 can be used to implement method 200 or 300, and may further include the following modules.

[0227] An acquisition module 602, configured to: in response to receiving a data analysis request, acquire knowledge information associated with the data analysis request according to the data analysis request;

[0228] A first determination module 604, configured to: determine one or more business objects corresponding to the data analysis request according to the data analysis request and the knowledge information;

[0229] A second determination module 606, configured to: determine one or more data dimension calculation formulas and one or more data index calculation formulas corresponding to the data analysis request according to the data analysis request, the knowledge information, and the one or more business objects;

[0230] A generation module 608, configured to: generate a query statement according to the one or more business objects, the one or more data dimension calculation formulas, and the one or more data index calculation formulas.

[0231] In some embodiments, the acquisition module 602 is configured to:

[0232] Based on a natural language processing algorithm, extract keywords from the data analysis request to determine one or more initial keywords corresponding to the data analysis request;

[0233] Screen the one or more initial keywords to determine one or more target keywords;

[0234] Acquire the knowledge information based on the one or more target keywords.

[0235] In some embodiments, the first determination module 604 is configured to:

[0236] Acquire a predefined set of business objects;

[0237] Determine one or more business objects corresponding to the data analysis request according to the data analysis request, the knowledge information, and the predefined set of business objects.

[0238] In some embodiments, the first determination module 604 is configured to:

[0239] Determine a first prompt based on the data analysis request, the knowledge information, and the predefined set of business objects, where the first prompt is used to define the content and format corresponding to the one or more business objects for the output of the large language model;

[0240] Invoke the large language model, input the first prompt into the large language model, and output the one or more business objects.

[0241] In some embodiments, the second determination module 606 is configured to:

[0242] Determine a second prompt according to the data analysis request, the knowledge information, the predefined set of business objects, and the one or more business objects, where the second prompt is used to define the content and format corresponding to the data dimension calculation formula and the data metric calculation formula for the output of the large language model;

[0243] Invoke the large language model, input the second prompt into the large language model, and output the one or more data dimension calculation formulas and the one or more data metric calculation formulas.

[0244] In some embodiments, the second determination module 606 is configured to:

[0245] Determine a third prompt according to the data analysis request, the knowledge information, the predefined set of business objects, and the one or more business objects, where the third prompt is used to define the content and format corresponding to the data query range for the output of the large language model;

[0246] Invoke the large language model, input the third prompt into the large language model, and output the data query range corresponding to the data analysis request.

[0247] In some embodiments, the generation module 608 is configured to: generate the query statement according to the data query range, the one or more business objects, the one or more data dimension calculation formulas, and the one or more data metric calculation formulas.

[0248] In some embodiments, the generation module 608 is configured to:

[0249] Invoke the object-relational mapping model to determine the mapping relationship between the one or more business objects and one or more data objects;

[0250] Based on the abstract syntax tree and the mapping relationship, generate the query statement according to the data query range, the one or more business objects, the one or more data dimension calculation formulas, and the one or more data metric calculation formulas.

[0251] In some embodiments, the query statement includes a Structured Query Language (SQL) statement.

[0252] For convenience of description, when describing the above device, it is divided into various modules according to functions and described separately. Of course, when implementing the present disclosure, the functions of each module can be implemented in the same or multiple software and / or hardware.

[0253] The device in the above embodiments is used to implement the corresponding method 200 or 300 in any of the foregoing embodiments, and has the beneficial effects of the corresponding method embodiments, which will not be elaborated here.

[0254] The embodiments of the present disclosure also provide a data query device. Figure 7 The schematic diagram of the exemplary device 700 provided by the embodiments of the present disclosure is shown. As Figure 7 shown, the device 700 can be used to implement method 200 or 400, and may further include the following modules.

[0255] A receiving module 702, configured to: receive a data analysis request;

[0256] A generating module 704, configured to: according to the data analysis request, adopt any embodiment or arrangement and combination of embodiments of method 200 or 300 to generate a query statement;

[0257] A query module 706, configured to: based on the query statement, query the data corresponding to the data analysis request.

[0258] For convenience of description, when describing the above device, it is divided into various modules according to functions and described separately. Of course, when implementing the present disclosure, the functions of each module can be implemented in the same or multiple software and / or hardware.

[0259] The device in the above embodiments is used to implement the corresponding method 200 or 400 in any of the foregoing embodiments, and has the beneficial effects of the corresponding method embodiments, which will not be elaborated here.

[0260] Based on the same inventive concept, corresponding to the method in any of the above embodiments, the present disclosure also provides a non-transitory computer-readable storage medium, and the non-transitory computer-readable storage medium stores computer instructions, and the computer instructions are used to cause the computer to execute the method 200, 300, 400 described in any of the foregoing embodiments.

[0261] The computer-readable medium of this embodiment includes permanent and non-permanent, removable and non-removable media, and information storage can be implemented by any method or technology. The information can be computer-readable instructions, data structures, program modules, or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technologies, compact disc read-only memory (CD-ROM), digital versatile disc (DVD) or other optical storage, magnetic cassette tapes, magnetic disk storage or other magnetic storage devices, or any other non-transmission medium that can be used to store information accessible by a computing device.

[0262] The computer instructions stored in the storage medium of the above embodiment are used to cause the computer to execute the methods 200, 300, 400 described in any of the above embodiments, and have the beneficial effects of the corresponding method embodiments, which will not be elaborated here.

[0263] Based on the same inventive concept, corresponding to the methods 200, 300, 400 in any of the above embodiments, the present disclosure also provides a computer program product, which includes a computer program. In some embodiments, the computer program is executable by one or more processors to cause the processors to execute the methods 200, 300, 400. Corresponding to the execution subjects of each step in the embodiments of the methods 200, 300, 400, the processors executing the corresponding steps can belong to the corresponding execution subjects.

[0264] In some embodiments, the computer program product includes a program module for resolving operation conflicts. The program module can be compiled into a binary instruction set based on a stack virtual machine (e.g., wasm) and deployed in a terminal device and / or compiled into a static library and deployed in a server.

[0265] The computer program product of the above embodiment is used to cause a processor to execute the methods 200, 300, 400 described in any of the above embodiments, and has the beneficial effects of the corresponding method embodiments, which will not be elaborated here.

[0266] Those of ordinary skill in the art should understand that the discussion of any of the above embodiments is only exemplary and is not intended to imply that the scope of the present disclosure (including the claims) is limited to these examples; under the concept of the present disclosure, the technical features in the above embodiments or different embodiments can also be combined, the steps can be implemented in any order, and there are many other variations in different aspects of the embodiments of the present disclosure as described above, which are not provided in detail for the sake of brevity.

[0267] In addition, for simplicity of explanation and discussion, and so as not to make the embodiments of the present disclosure difficult to understand, well-known power / ground connections of integrated circuit (IC) chips and other components may or may not be shown in the provided drawings. Further, the devices may be shown in block diagram form in order to avoid making the embodiments of the present disclosure difficult to understand, and this also takes into account the fact that details regarding the implementation of these block diagram devices are highly dependent on the platform on which the embodiments of the present disclosure are to be implemented (i.e., these details should be fully within the understanding of those skilled in the art). In cases where specific details (such as circuits) are set forth to describe exemplary embodiments of the present disclosure, it will be apparent to those skilled in the art that the embodiments of the present disclosure may be practiced without these specific details or with variations of these specific details. Accordingly, these descriptions should be regarded as illustrative rather than restrictive.

[0268] Although the present disclosure has been described in connection with specific embodiments thereof, many alternatives, modifications, and variations of these embodiments will be apparent to those of ordinary skill in the art in light of the foregoing description. For example, other memory architectures (such as dynamic RAM (DRAM)) may be used with the embodiments discussed.

[0269] Embodiments of the present disclosure are intended to cover all such alternatives, modifications, and variations that fall within the broad scope of the appended claims. Therefore, any omissions, modifications, equivalent substitutions, improvements, etc., made within the spirit and principle of the embodiments of the present disclosure shall be included within the protection scope of the present disclosure.

Claims

1. A method for generating a query statement, comprising: In response to receiving a data analysis request, acquiring knowledge information associated with the data analysis request according to the data analysis request; Determining one or more business objects corresponding to the data analysis request according to the data analysis request and the knowledge information; Determine, according to the data analysis request, the knowledge information, and the one or more business objects, one or more data dimension calculation formulas and one or more data indicator calculation formulas corresponding to the data analysis request; A query statement is generated according to the one or more business objects, the one or more data dimension calculation formulas and the one or more data indicator calculation formulas.

2. The method of claim 1, wherein: Acquiring knowledge information associated with the data analysis request according to the data analysis request includes: Based on a natural language processing algorithm, keyword extraction is performed on the data analysis request to determine one or more initial keywords corresponding to the data analysis request; Screening the one or more initial keywords to determine one or more target keywords; Based on the one or more target keywords, the knowledge information is acquired.

3. The method of claim 1, wherein: Determining one or more business objects corresponding to the data analysis request according to the data analysis request and the knowledge information includes: Get a predefined set of business objects; One or more business objects corresponding to the data analysis request are determined according to the data analysis request, the knowledge information, and the predefined business object set.

4. The method of claim 3, wherein: Determining one or more business objects corresponding to the data analysis request according to the data analysis request, the knowledge information, and the predefined business object set includes: Determining a first prompt based on the data analysis request, the knowledge information, and the predefined set of business objects, wherein the first prompt is used to limit the content and format of the large language model output corresponding to the one or more business objects; The large language model is called, the first prompt is input into the large language model, and the one or more business objects are outputted.

5. The method of claim 3, wherein: Determining, according to the data analysis request, the knowledge information, and the one or more business objects, one or more data dimension calculation formulas and one or more data indicator calculation formulas corresponding to the data analysis request includes: Determining a second prompt according to the data analysis request, the knowledge information, the predefined business object set, and the one or more business objects, wherein the second prompt is used to limit the content and format of the large language model output corresponding to the data dimension calculation formula and the data indicator calculation formula; The large language model is called, the second prompt is input into the large language model, and the one or more data dimension calculation formulas and the one or more data indicator calculation formulas are outputted.

6. The method of claim 3, further comprising: Determining a third prompt according to the data analysis request, the knowledge information, the predefined business object set, and the one or more business objects, wherein the third prompt is used to limit the content and format of the large language model output corresponding to the data query scope; The large language model is called, the third prompt is input into the large language model, and a data query range corresponding to the data analysis request is obtained as an output.

7. The method of claim 6, wherein: Generating a query statement according to the one or more business objects, the one or more data dimension calculation formulas, and the one or more data indicator calculation formulas includes: The query statement is generated according to the data query scope, the one or more business objects, the one or more data dimension calculation formulas and the one or more data indicator calculation formulas.

8. The method of claim 7, wherein: Generating the query statement according to the data query scope, the one or more business objects, the one or more data dimension calculation formulas, and the one or more data indicator calculation formulas includes: Calling an object relationship mapping model to determine a mapping relationship between the one or more business objects and the one or more data objects; Based on the abstract syntax tree and the mapping relationship, the query statement is generated according to the data query scope, the one or more business objects, the one or more data dimension calculation formulas and the one or more data indicator calculation formulas.

9. The method according to any one of claims 1 to 8, wherein: The query statement includes a structured query language SQL statement.

10. A data query method, comprising: Receive requests for data analysis; According to the data analysis request, generating a query statement using the method described in any one of claims 1 to 9; Based on the query statement, the data corresponding to the data analysis request is queried and obtained.

11. A query statement generating device, comprising: an acquisition module, configured to: in response to receiving a data analysis request, acquire knowledge information associated with the data analysis request according to the data analysis request; A first determination module is configured to: determine one or more business objects corresponding to the data analysis request according to the data analysis request and the knowledge information; A second determination module is configured to: determine, according to the data analysis request, the knowledge information, and the one or more business objects, one or more data dimension calculation formulas and one or more data indicator calculation formulas corresponding to the data analysis request; The generation module is configured to generate a query statement according to the one or more business objects, the one or more data dimension calculation formulas and the one or more data indicator calculation formulas.

12. A data query device, comprising: The receiving module is configured to: receive a data analysis request; A generating module, configured to: generate a query statement according to the data analysis request by using the method according to any one of claims 1 to 9; The query module is configured to: based on the query statement, query and obtain the data corresponding to the data analysis request.

13. A computer device comprising one or more processors, a memory; and one or more programs, wherein the one or more programs are stored in the memory and executed by the one or more processors, and the programs include instructions for executing the method according to any one of claims 1-10.

14. A non-volatile computer-readable storage medium containing a computer program, which, when executed by one or more processors, causes the processors to perform the method according to any one of claims 1 to 10.

15. A computer program product comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 10 are implemented.