Query statement generation method and device

By identifying entities and related information in the query structure graph and generating target query statements, the problem of colloquial language in data queries is solved, the accuracy and efficiency of data queries are improved, and the reliance on report templates is reduced.

CN116467499BActive Publication Date: 2026-02-10HUNDSUN TECH
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202310222591.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-03-03
Publication Date
2026-02-10
Estimated Expiration
2043-03-03

AI Technical Summary

Technical Problem

In existing technologies, data query solutions suffer from problems such as the use of colloquial language in querying, leading to inaccurate data. Furthermore, the excessive number of maintained report query templates cannot support a large number of query needs, thus affecting the accuracy and efficiency of data queries.

Method used

By identifying entities in the query information and filtering related information using a pre-built query structure graph, the target query statement is generated, avoiding the need to maintain different report query templates and directly generating accurate query statements from the query structure graph.

Benefits of technology

This approach integrates colloquial query features into the query structure graph, generating target query statements that accurately cover colloquial expressions. This improves the efficiency and accuracy of data queries and reduces reliance on report query templates.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116467499B_ABST
    Figure CN116467499B_ABST
Patent Text Reader

Abstract

The specification provides a query statement generation method and device, wherein the query statement generation method comprises: performing entity recognition on to-be-queried information to determine entities in the to-be-queried information and attribute information of the entities; from a pre-constructed query structure relationship graph, screening a plurality of candidate associated information corresponding to the attribute information, wherein the query structure relationship graph is used to predict associated information corresponding to the to-be-queried information; according to the to-be-queried information, screening target associated information from the plurality of candidate associated information, and determining at least one to-be-queried business field based on the target associated information; and generating a target query statement corresponding to the to-be-queried information according to the entities, the attribute information, the at least one to-be-queried business field, and a data set corresponding to the at least one to-be-queried business field. By using the query structure relationship graph, the target associated information and the to-be-queried business field are accurately obtained, the associated knowledge of the attribute information is injected into the target query statement, and the accuracy of the target query statement is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This specification relates to the field of computer technology, and in particular to a method for generating query statements. This specification also relates to a query statement generation apparatus, a computing device, and a computer-readable storage medium. Background Technology

[0002] With the continuous development of computer technology, the amount of data generated by enterprises or individual users is growing explosively. How to efficiently and accurately query data in massive amounts of data has gradually become a research focus.

[0003] In existing technologies, data querying typically utilizes template matching: relevant data for the query question is encapsulated into a report, the slot-filling parameters required for the report query template are extracted from the query question, and the data is retrieved using these parameters and the report query template. However, because the query questions are often colloquial, the relevant data is inaccurate, affecting the accuracy of the data query. Furthermore, the above approach requires maintaining too many report query templates, making it unable to handle a large number of query requests. Therefore, a more efficient and accurate data querying solution is needed. Summary of the Invention

[0004] In view of this, embodiments of this specification provide a method for generating query statements. This specification also relates to a query statement generation apparatus, a computing device, and a computer-readable storage medium, to address the technical deficiencies existing in the prior art.

[0005] According to a first aspect of the embodiments of this specification, a query statement generation method is provided, comprising:

[0006] Entity identification is performed on the information to be queried to determine the entities and their attribute information in the information to be queried;

[0007] From a pre-built query structure graph, multiple candidate related information corresponding to attribute information are filtered out. The query structure graph is used to predict the related information corresponding to the information to be queried.

[0008] Based on the information to be queried, filter the target related information from multiple candidate related information, and determine at least one business field to be queried based on the target related information;

[0009] Generate the target query statement corresponding to the information to be queried based on the entity, attribute information, at least one business field to be queried, and the dataset corresponding to at least one business field to be queried.

[0010] According to a second aspect of the embodiments of this specification, a query statement generation apparatus is provided, comprising:

[0011] The identification module is configured to perform entity identification on the information to be queried, and to determine the entities and their attribute information in the information to be queried;

[0012] The filtering module is configured to filter multiple candidate related information corresponding to attribute information from a pre-built query structure relationship graph, wherein the query structure relationship graph is used to predict the related information corresponding to the query information;

[0013] The determination module is configured to filter target related information from multiple candidate related information based on the information to be queried, and determine at least one business field to be queried based on the target related information;

[0014] The generation module is configured to generate the target query statement corresponding to the information to be queried based on the entity, attribute information, at least one business field to be queried, and the dataset corresponding to at least one business field to be queried.

[0015] According to a third aspect of the embodiments of this specification, a computing device is provided, comprising:

[0016] Memory and processor;

[0017] The memory is used to store computer-executable instructions, and the processor is used to execute the computer-executable instructions, which, when executed by the processor, implement the steps of the query statement generation method provided in the first aspect above.

[0018] According to a fourth aspect of the embodiments of this specification, a computer-readable storage medium is provided that stores computer-executable instructions, which, when executed by a processor, implement the steps of the query statement generation method provided in the first aspect above.

[0019] The query statement generation method provided in this specification performs entity recognition on the information to be queried, determining the entities and their attribute information within the information to be queried; it filters multiple candidate related information corresponding to the attribute information from a pre-constructed query structure relationship graph, wherein the query structure relationship graph is used to predict the related information corresponding to the information to be queried; based on the information to be queried, it filters target related information from multiple candidate related information, and determines at least one business field to be queried based on the target related information; based on the entity, attribute information, at least one business field to be queried, and the dataset corresponding to at least one business field to be queried, it generates the target query statement corresponding to the information to be queried. By using the related information corresponding to the entity attribute information and the business fields to be queried corresponding to each related information to extend the related knowledge of the attribute information in the query structure relationship graph, it supports the rapid configuration of related data query content, thereby incorporating colloquial query features into the query structure relationship graph, further generating target query statements that accurately cover colloquial expressions. Furthermore, since the query structure relationship graph can be used to predict the related information corresponding to the information to be queried, there is no need to maintain different report query templates; the target query statement can be generated efficiently and accurately using only the query structure relationship graph. Attached Figure Description

[0020] Figure 1 This is an architecture diagram of a query statement generation system provided in one embodiment of this specification;

[0021] Figure 2 This is a flowchart of a query statement generation method provided in one embodiment of this specification;

[0022] Figure 3 This is a framework diagram of a query structure relationship diagram provided in one embodiment of this specification;

[0023] Figure 4a This is a flowchart of a data query method provided in one embodiment of this specification;

[0024] Figure 4b This is a framework diagram of another query structure relationship diagram provided in one embodiment of this specification;

[0025] Figure 5 This is a flowchart illustrating a query statement generation method for data query scenarios provided in one embodiment of this specification.

[0026] Figure 6 This is a schematic diagram of a data query interface provided in one embodiment of this specification;

[0027] Figure 7 This is a schematic diagram of the structure of a query statement generation device provided in one embodiment of this specification;

[0028] Figure 8 This is a structural block diagram of a computing device provided in one embodiment of this specification. Detailed Implementation

[0029] Many specific details are set forth in the following description to provide a full understanding of this specification. However, this specification can be implemented in many other ways than those described herein, and those skilled in the art can make similar extensions without departing from the spirit of this specification. Therefore, this specification is not limited to the specific implementations disclosed below.

[0030] The terminology used in one or more embodiments of this specification is for the purpose of describing particular embodiments only and is not intended to be limiting of the one or more embodiments of this specification. The singular forms “a,” “described,” and “the” as used in one or more embodiments of this specification and the appended claims are also intended to include the plural forms unless the context clearly indicates otherwise. It should also be understood that the term “and / or” as used in one or more embodiments of this specification refers to and includes any or all possible combinations of one or more associated listed items.

[0031] It should be understood that although the terms first, second, etc., may be used to describe various information in one or more embodiments of this specification, such information should not be limited to these terms. These terms are only used to distinguish information of the same type from one another. For example, first may also be referred to as second without departing from the scope of one or more embodiments of this specification, and similarly, second may also be referred to as first. Depending on the context, the word "if" as used herein may be interpreted as "when," "when," or "in response to a determination."

[0032] First, the terms and concepts used in one or more embodiments of this specification will be explained.

[0033] Structured Query Language (SQL) is a database query and programming language used to access, query, update, and manage relational database systems.

[0034] Entity: An entity is an objectively existing and distinguishable thing. In the context of databases, an entity often refers to a collection of things of a certain kind, which can be specific people, things, or abstract concepts or relationships.

[0035] Pre-trained language models: Pre-trained language models (BERT, Bidirectional Encoder Representation from Transformers) emphasize that instead of using traditional unidirectional language models or shallow concatenation of two unidirectional language models for pre-training, they adopt a new masked language model (MLM) to generate deep bidirectional language representations.

[0036] Global Pointer Prediction Model: In the Global Pointer prediction model, "Global" refers to the use of global normalization in the Named Entity Recognition (NER) task, indiscriminately identifying nested and non-nested entities. The Global Pointer prediction model treats the beginning and end of an entity as a whole for judgment, providing a more "global" perspective. "Pointer" uses pointers (start pointer & end pointer) to predict entities.

[0037] Edit distance: Edit distance, also known as Levenshtein distance, refers to the minimum number of edit operations required to transform one string into another. The larger the edit distance between two strings, the more different they are. Typical edit operations include replacing one character with another, inserting a character, and deleting a character.

[0038] With the continuous development of computer technology, the amount of data generated by enterprises or individual users is growing explosively. Data query technology involves many aspects. For example, in scenarios such as financial investment research and investment consulting, professional investment researchers, general investors, and data analysts will search for a large amount of data needed for analysis on application (APP) and web page.

[0039] In data retrieval and query scenarios, most data queries involve simultaneously querying multiple unspecified related data points for a single entity. These data points are expressed through an abstract business term. For example, consider the queries "How profitable was Company XXX in 2021?" and "Personal profile of Fund Manager Zhang." In "How profitable was Company XXX in 2021?", "profit" implicitly includes detailed information such as net profit, net profit attributable to shareholders, and net profit excluding non-recurring items. Similarly, in "Personal profile of Fund Manager Zhang," "personal profile" implicitly includes information such as age, education, years of experience, and alma mater. These unspecified abstract terms cover a wide range of data, and the inclusion of numerous colloquial terms in data queries often leads to low efficiency and accuracy. Therefore, how to perform precise data queries has gradually become a research focus.

[0040] Currently, the main approach involves encapsulating reports to integrate related data into an Application Programming Interface (API). This API exposes parameters for flexible invocation, matches the correct report to the user's query, extracts the necessary fill parameters for the report query template, and finally uses these parameters and the template to perform related data queries. However, this template-matching method ("report encapsulation + issue - report matching + parameter fill") is too lengthy, requires maintaining too many report query templates, and cannot support large-scale related data queries. Furthermore, the colloquial nature of the query questions leads to inaccurate data, affecting the overall accuracy of the data query.

[0041] To address the aforementioned issues, this specification provides a query statement generation scheme. The scheme involves: entity recognition of the information to be queried to determine the entities and their attribute information; filtering multiple candidate related information corresponding to the attribute information from a pre-constructed query structure relationship graph, where the query structure relationship graph is used to predict the related information corresponding to the information to be queried; selecting target related information from the multiple candidate related information based on the information to be queried, and determining at least one business field to be queried based on the target related information; and generating a target query statement corresponding to the information to be queried based on the entity, attribute information, at least one business field to be queried, and the dataset corresponding to the at least one business field to be queried. By extending the related knowledge of attribute information using the related information corresponding to entity attribute information and the business fields to be queried for each related information in the query structure relationship graph, the scheme supports rapid configuration of related data query content. This allows for the integration of colloquial query features into the query structure relationship graph, further generating target query statements that accurately cover colloquial expressions. Furthermore, since the query structure relationship graph can be used to predict the related information corresponding to the information to be queried, there is no need to maintain different report query templates; the target query statement can be generated efficiently and accurately using only the query structure relationship graph.

[0042] It should be noted that the embodiments in this specification may involve the use of user data. In practical applications, user-specific personal data may be used in the scheme described herein within the scope permitted by applicable laws and regulations, provided that it complies with the applicable laws and regulations of the country (e.g., with the user's explicit consent, with the user being properly notified, etc.).

[0043] This specification provides a query statement generation method, and also relates to a query statement generation apparatus, a computing device, and a computer-readable storage medium, which will be described in detail in the following embodiments.

[0044] See Figure 1 , Figure 1 An architecture diagram of a query statement generation system according to an embodiment of this specification is shown. The query statement generation system includes a client 100 and a server 200;

[0045] Client 100 is used to send query information to server 200;

[0046] Server 200 is used to perform entity recognition on the query information, determine the entities and their attribute information in the query information; filter multiple candidate related information corresponding to the attribute information from a pre-built query structure relationship graph, wherein the query structure relationship graph is used to predict the related information corresponding to the query information; filter target related information from multiple candidate related information based on the query information, and determine at least one business field to be queried based on the target related information; generate the target query statement corresponding to the query information based on the entity, attribute information, at least one business field to be queried, and the dataset corresponding to at least one business field to be queried; and send the target query statement to client 100.

[0047] Client 100 is also used to receive the target query statement.

[0048] By applying the solution of the embodiments in this specification, the attribute information is extended with relational knowledge by utilizing the associated information corresponding to entity attribute information and the business fields to be queried corresponding to each associated information in the query structure relationship graph. This supports the rapid configuration of associated data query content, thereby incorporating colloquial query features into the query structure relationship graph and further generating target query statements that accurately cover colloquial expressions. Furthermore, since the query structure relationship graph can be used to predict the associated information corresponding to the information to be queried, there is no need to maintain different report query templates. The target query statement can be generated efficiently and accurately using only the query structure relationship graph.

[0049] See Figure 2 , Figure 2 A flowchart of a query statement generation method according to an embodiment of this specification is shown, which specifically includes the following steps:

[0050] Step 202: Perform entity recognition on the information to be queried to determine the entities and their attribute information in the information to be queried.

[0051] In one or more embodiments of this specification, before generating a query statement, information to be queried can be obtained, and the information to be queried can be further analyzed and processed to generate a query statement corresponding to the information to be queried.

[0052] Specifically, the information to be queried is the object processed during the query statement generation process, and can be the query question. The information to be queried can come from different scenarios, such as financial scenarios, educational scenarios, e-commerce scenarios, etc. The information to be queried can also be in various forms, such as query text, query audio, query image, etc., selected according to the actual situation; this specification does not impose any limitations on this. The attribute information of an entity refers to the abstract attributes of the entity itself, such as the attribute information of the entity "XXX Company" being "listed company".

[0053] It should be noted that if the information to be queried is audio, an audio conversion tool can be used to convert the audio to obtain the corresponding text. If the information to be queried is an image, optical character recognition (OCR) can be performed on the image to obtain the corresponding text. Alternatively, entity recognition can be performed directly on either the audio or the image; the choice depends on the specific circumstances, and this specification does not impose any limitations on this approach.

[0054] In practical applications, before performing entity recognition on the information to be queried and determining the entities and their attribute information, the information to be queried can be obtained. There are various ways to obtain the information to be queried, and the specific method chosen depends on the actual situation; this specification does not limit this approach. In one possible implementation of this specification, the information to be queried can be read from other data acquisition devices or a database. In another possible implementation of this specification, the information to be queried can be received from user input on a client side.

[0055] Furthermore, after obtaining the information to be queried, entity recognition can be performed on the information to determine the entities and their attribute information within the information. In the embodiments of this specification, there are multiple methods for performing entity recognition on the information to be queried and determining the entities and their attribute information within the information. The specific method should be selected according to the actual situation, and this embodiment of the specification does not impose any limitations on this.

[0056] In one possible implementation of this specification, an entity thesaurus including multiple sample entities can be pre-set. The information to be queried is matched with the entity thesaurus to determine the entities in the information to be queried. Further, the query intent of the information to be queried is analyzed, and the attribute information of the entities is determined based on the query intent and the entities.

[0057] In another possible implementation of this specification, an entity recognition model can be used to perform entity recognition on the query information. That is, the above-mentioned entity recognition on the query information to determine the entities and attribute information of the entities in the query information may include the following steps:

[0058] The information to be queried is input into the entity recognition model, and after processing by the entity recognition model, the entity in the information to be queried is obtained.

[0059] Search for the entity's attribute information in the pre-defined entity attribute table.

[0060] Specifically, the entity attribute table, also known as the entity dictionary, includes the correspondence between entities and attribute information. The entity recognition model is a machine learning model, which can be understood as a trained program that can discover patterns and make predictions in new data. These models are represented as a mathematical function that receives requests in the form of input data, makes predictions on the input data, and then provides an output as a response. In the embodiments of this specification, the entity recognition model is a model capable of predicting entities in the query information, including but not limited to global pointer prediction models and pre-trained language models, selected according to the actual situation; this specification does not impose any limitations on this.

[0061] For example, suppose the query information is "How was the profit of Company XXX in 2021?", and the pre-set entity attribute table is shown in Table 1 below. Inputting the query information "How was the profit of Company XXX in 2021?" into the entity recognition model, the model processes it and obtains the entity "Company XXX" as the entity in the query information. Further, the attribute information corresponding to "Company XXX" in the entity attribute table is found to be "Listed Company".

[0062] Table 1 Entity Attribute Table

[0063] Attribute information entity Listed companies XXX Company, XXX Group, XXX Limited Company... Fund products XXX insurance, XXX bonds... Educational institutions XXX preschool education, XXX postgraduate entrance exam preparation, XXX art classes...

[0064] The scheme described in this specification involves inputting the information to be queried into an entity recognition model. After processing by the entity recognition model, the entities in the information to be queried are obtained. The attribute information of the entities is then searched in a pre-set entity attribute table. By utilizing the entity recognition model and the pre-set entity attribute table, the entities and their attributes in the information to be queried are determined efficiently and accurately, further improving the efficiency and accuracy of generating query statements.

[0065] In one optional embodiment of this specification, in order to accurately find the target association information corresponding to the attribute information in the pre-constructed query structure relationship graph, after obtaining the attribute information of the entity, it can be determined whether the query structure relationship graph includes the attribute information, and further the attribute information is processed according to the determination result. That is, after the above-mentioned entity identification of the query information and determination of the entity and the attribute information of the entity in the query information, the following steps may also be included:

[0066] If the query structure graph does not include attribute information, the attribute information is matched with multiple nodes in the query structure graph to determine the target node;

[0067] Update the attribute information using the target node to obtain the updated attribute information.

[0068] In the embodiments of this specification, the query structure relationship graph includes attribute information nodes. After determining the attribute information of the entity in the information to be queried, each node in the query structure relationship graph can be traversed to determine whether there is a node in the query structure relationship graph that has the same attribute information as the entity. If it exists, the attribute information of the entity is not processed; if it does not exist, the attribute information is matched with multiple nodes in the query structure relationship graph to determine the target node, and the target node is used as the updated attribute information.

[0069] It should be noted that there are multiple ways to match attribute information with multiple nodes in the query structure graph, and the specific method should be selected according to the actual situation. This specification does not impose any limitations on this method in the embodiments. In one possible implementation, the similarity (e.g., cosine similarity) between the entity's attribute information and each node can be calculated, and nodes whose similarity meets a similarity threshold can be used as target nodes. In another possible implementation, the edit distance between the entity's attribute information and each node can be calculated, and nodes whose edit distance meets an edit distance threshold can be used as target nodes.

[0070] The solution implemented in this specification, when the query structure graph does not include attribute information, matches the attribute information with multiple nodes in the query structure graph to determine the target node; the target node is then used to update the attribute information to obtain the updated attribute information. This ensures that the attribute information of the entities in the query information exists in the query structure graph, avoiding the problem of query statement generation failure due to the absence of attribute information in the query structure graph, and improving the accuracy of query statement generation.

[0071] Step 204: Filter multiple candidate related information corresponding to attribute information from the pre-built query structure relationship graph, wherein the query structure relationship graph is used to predict the related information corresponding to the query information.

[0072] In one or more embodiments of this specification, after entity recognition is performed on the query information to determine the entities and attribute information of the entities in the query information, multiple candidate association information corresponding to the attribute information can be further filtered from a pre-constructed query structure relationship graph.

[0073] Specifically, candidate related information refers to information that is related to attribute information in the query structure graph. In the query structure graph, candidate related information and attribute information are connected by edges. Therefore, when filtering multiple candidate related information corresponding to attribute information from the pre-constructed query structure graph, the query structure graph can be traversed starting from the attribute information, and nodes with edges connected to the attribute information can be used as candidate related information.

[0074] In one optional embodiment of this specification, before filtering multiple candidate association information corresponding to attribute information from a pre-built query structure relationship graph, the following steps may be included:

[0075] Retrieve query information from multiple samples;

[0076] Entity recognition is performed on multiple sample query information to determine the sample entities and sample attribute information in each sample query information, and the sample association information corresponding to the sample attribute information is determined.

[0077] Identify the sample query fields that are related to the sample association information from a pre-set dataset;

[0078] A query structure graph is constructed using each sample query information, sample attribute information, sample association information, sample query fields, and the dataset corresponding to the sample query fields as nodes, and the association relationships between nodes as edges.

[0079] Specifically, the query structure graph is a multi-relational heterogeneous graph (RGCN). The sample query information included in the query structure graph is a question example corresponding to the query statement, which can serve as a hint for parsing and a target for semantic similarity matching. For example, the sample question for related data 1 (the profit situation of listed companies) is "How are the profits of XXX company in the past three years?". Sample attribute information is the query object specified by the data query, such as listed companies, fund products, and fund managers. Furthermore, it can also specify the corresponding attribute type and the dataset corresponding to the attribute information to support subsequent entity recognition of the query data. Sample association information refers to information that is related to the sample attribute information, such as content expressed directly or indirectly in the query question, such as profit situation, how are the profits, revenue situation, basic information, etc. Furthermore, it can also specify the associated aliases of the sample association information, which are other paradigms mentioned in the question, such as other ways to say "profit situation" such as "profit performance" or "profitability". The sample query fields that are related to the sample association information refer to the sample association information in all dimensions, such as "profit situation" including net profit (dataset 1), non-GAAP net profit (dataset 2), and diluted net profit (dataset 2).

[0080] It should be noted that the implementation method of "obtaining multiple sample query information" is the same as that of "obtaining query information" above. The implementation method of "performing entity recognition on multiple sample query information to determine the sample entity and sample attribute information of each sample query information" is the same as that of "performing entity recognition on query information to determine the entity and attribute information of the entity in the query information" above. Therefore, this embodiment will not repeat the details.

[0081] In the embodiments of this specification, there are multiple ways to determine the sample association information corresponding to the sample attribute information. The specific method should be selected according to the actual situation, and this specification does not limit the method in any way. In one possible implementation of this specification, the sample association information can be read from other data acquisition devices or databases. In another possible implementation of this specification, a machine learning model can be used to determine the sample association information.

[0082] Furthermore, when the sample query information includes sample constraint information, this constraint information can be identified from the sample query information and added to the query structure graph. The sample constraint information is used to constrain the query scope of the sample query information, including but not limited to date constraints and age constraints. For example, in the sample query information "How are the profits of XXX company in the past three years?", the sample constraint information is "date". Furthermore, the dataset corresponding to the constraint information and the value type of the constraint information (generally Date) can be determined. Since the sample query information may be colloquial, after determining the sample association information, the colloquial expressions of the sample association information (association aliases) can also be determined, such as the association aliases for "profit situation" being "profit performance" and "profitability".

[0083] See Figure 3 , Figure 3 This diagram illustrates a framework of a query structure relationship graph according to an embodiment of this specification. Assuming the sample query information for associated data 1 is "How are the profits of Company XXX in the past three years?", entity recognition is performed on the sample query information to determine that the sample entity in the sample query information is "Company XXX". Next, the sample attribute information of the sample entity "Company XXX" is determined to be "Listed Company", the attribute type of "Listed Company" is "company", and the dataset to which "Listed Company" belongs is "Dataset 2". Then, the sample association information corresponding to the sample attribute information "Listed Company" is determined to be "Profit Situation". The association of the sample association information "Profit Situation" is also called "Profit Performance". The query structure graph is constructed based on the following: First, the query field related to "profit situation" in the pre-set dataset 1 is "net profit". Second, the query field related to "profit situation" in the pre-set dataset 2 is "net profit excluding non-recurring items" and "diluted net profit". Third, the query field related to "net profit excluding non-recurring items" and "diluted net profit" is "net profit excluding non-recurring items" and "net profit excluding non-recurring items" is "net profit excluding non-recurring items" and "diluted net profit". Finally, the query structure graph is constructed based on the constraint information "date" and its value type "Date" determined for the past three years.

[0084] By applying the solution of the embodiments in this specification, the association knowledge of the attribute information is extended by using the associated information corresponding to the entity attribute information and the business fields to be queried corresponding to each associated information in the query structure relationship graph. This supports the rapid configuration of the associated data query content, thereby incorporating colloquial query features into the query structure relationship graph and further generating target query statements that accurately cover colloquial expressions.

[0085] In one optional embodiment of this specification, after constructing the query structure relationship graph, the query structure relationship graph can be dynamically expanded. That is, after constructing the query structure relationship graph using each sample query information, sample attribute information, sample association information, sample query fields, and the dataset corresponding to the sample query fields as nodes, and the association relationships between nodes as edges, the following steps can be further included:

[0086] Receive update query information input by the user through the front end;

[0087] The query structure graph is updated using the updated query information to obtain the updated query structure graph.

[0088] It should be noted that when updating the query structure graph using updated query information to obtain the updated query structure graph, entity recognition can be performed on the updated query information to determine the updated entities and their updated attribute information, as well as the updated association information corresponding to the updated attribute information. The updated query fields that are associated with the updated association information can be determined from the pre-set dataset. The updated query information, updated attribute information, updated association information, updated query fields, and the datasets corresponding to the updated query fields are added as nodes, and the associations between nodes are added as edges to the pre-built query structure graph.

[0089] The scheme implemented in this specification receives updated query information input by the user through the front end; it then updates the query structure graph using this updated query information to obtain the updated query structure graph. This achieves dynamic expansion of the query structure graph. For new query requests, only the above-mentioned complete information needs to be configured to activate the corresponding capabilities, thus improving the efficiency of data querying.

[0090] Step 206: Based on the information to be queried, filter the target related information from multiple candidate related information, and determine at least one business field to be queried based on the target related information.

[0091] In one or more embodiments of this specification, entity recognition is performed on the information to be queried to determine the entities and attribute information of the entities in the information to be queried. After filtering multiple candidate related information corresponding to the attribute information from a pre-constructed query structure relationship graph, target related information can be filtered from multiple candidate related information according to the information to be queried, and at least one business field to be queried can be determined based on the target related information.

[0092] In practical applications, there are various ways to filter target related information from multiple candidate related information based on the information to be queried. The specific method should be selected according to the actual situation. This specification does not limit the specific methods used in this embodiment.

[0093] In one possible implementation of this specification, the edit distance between the information to be queried and each candidate related information can be calculated, and the target related information with a high degree of matching with the information to be queried can be filtered from multiple candidate related information based on the edit distance.

[0094] In another possible implementation of this specification, a multi-relationship graph propagation model can be used to predict the links between the query information and each candidate related information. That is, the above-mentioned filtering of target related information from multiple candidate related information based on the query information may include the following steps:

[0095] The query information and multiple candidate related information are encoded separately to obtain encoded query information and multiple candidate encoded related information.

[0096] Determine the predictive metrics between the association information and the query information of each candidate code;

[0097] Based on the various forecasting indicators, determine the target-related information.

[0098] Specifically, the multi-relationship graph propagation model is as shown in formula (1):

[0099]

[0100] Where σ is the activation function, R is the relation type of each node in the query structure graph, and r is any relation type in R. Let i represent the set of neighboring nodes whose relationship to i is r, and j represent candidate association information. It is a linear transformation function that transforms neighboring nodes of the same type of edge using the same parameter matrix; h represents the transformation performed on node i itself. j (l) h is the candidate encoding association information of node j in layer l. i (l) It is the encoded query information of node i at layer l, h i (l +1) It is the encoded query information of node i at layer l+1.

[0101] In the link prediction of the query structure graph, each link prediction triple (s,r,o) involves a diagonal matrix R associated with relation r. r In the embodiments described in this specification, the prediction is for the relationship between "query information" and "related information". Therefore, the prediction index determination function can be simplified to f(s,r,o)=e s T e o The loss function is defined as cross-entropy loss, where s is the query information and o is the candidate association information.

[0102] In practical applications, the query information and multiple candidate related information are encoded separately. There are various ways to obtain the encoded query information and multiple candidate encoded related information, and the specific method is selected according to the actual situation. This specification does not limit the specific method used in the embodiments. In one possible implementation of this specification, an encoder in a machine learning model can be used to encode the query information and multiple candidate related information. In another possible implementation of this specification, one-hot encoding can be used to encode the query information and multiple candidate related information.

[0103] Furthermore, after obtaining the predictive metrics between the candidate code association information and the code query information, the predictive metrics can be sorted, and the candidate association information corresponding to the top-ranked predictive metrics can be used as the target association information. Alternatively, the predictive metrics can be compared with preset index thresholds, and the candidate association information corresponding to the predictive metrics that meet the preset index thresholds can be used as the target association information.

[0104] By applying the scheme of the embodiments of this specification, the query information and multiple candidate related information are encoded to obtain encoded query information and multiple candidate encoded related information; prediction indicators between each candidate encoded related information and the encoded query information are determined; and target related information is determined based on each prediction indicator, so that the determined target related information is more accurate, thereby further improving the accuracy of target query statement generation.

[0105] In the embodiments of this specification, there are multiple ways to determine at least one business field to be queried based on the target association information. The specific method should be selected according to the actual situation, and this embodiment of the specification does not impose any limitations on this.

[0106] In one possible implementation of this specification, business fields that are related to the target information can be read from other data acquisition devices or databases, and then the business fields can be matched with each node in the query structure relationship diagram to determine the business fields to be queried based on the matching results.

[0107] In another possible implementation of this specification, the business field to be queried can be directly found in the query structure relationship graph. That is, the above determination of at least one business field to be queried based on the target association information may include the following steps:

[0108] In a pre-built query structure graph, find at least one business field to be queried that is related to the target information.

[0109] It should be noted that when searching for at least one business field to be queried that is related to the target related information in the pre-built query structure relationship graph, you can start with the attribute information, traverse the query structure relationship graph, and take the nodes with edges between them as candidate related information.

[0110] By applying the solution of the embodiments in this specification, at least one business field to be queried that is related to the target information is found in the pre-constructed query structure relationship graph, thereby expanding the query scope of the information to be queried and improving the accuracy of the target query statement.

[0111] Step 208: Generate the target query statement corresponding to the information to be queried based on the entity, attribute information, at least one business field to be queried, and the dataset corresponding to at least one business field to be queried.

[0112] In one or more embodiments of this specification, entity recognition is performed on the information to be queried to determine the entities and attribute information of the entities in the information to be queried. Multiple candidate related information corresponding to the attribute information is filtered from a pre-constructed query structure relationship graph. Target related information is filtered from the multiple candidate related information according to the information to be queried. After determining at least one business field to be queried based on the target related information, a target query statement corresponding to the information to be queried can be generated based on the entity, attribute information, at least one business field to be queried, and the dataset corresponding to at least one business field to be queried.

[0113] It should be noted that the target query statement is a Structured Query Language (SCL). There are multiple ways to generate the target query statement for the information to be queried based on the entity, attribute information, at least one business field to be queried, and the dataset corresponding to at least one business field to be queried. The specific method should be chosen according to the actual situation, and this specification does not impose any limitations on this method. In one possible implementation of this specification, the target query statement can be directly generated using a SCL generation tool. In another possible implementation of this specification, the target query statement can be generated based on a query template. That is, generating the target query statement for the information to be queried based on the entity, attribute information, at least one business field to be queried, and the dataset corresponding to at least one business field to be queried may include the following steps:

[0114] Retrieve the pre-set query template;

[0115] Fill the query template with the entity, attribute information, at least one business field to be queried, and the dataset corresponding to at least one business field to be queried to obtain the target query statement.

[0116] Specifically, the pre-set query template is as follows: SELECT object1 FROM object2 WHERE object3. Object1 includes a set of fields such as attribute information, the business fields to be queried, and constraint information; Object2 includes the datasets corresponding to all fields in Object1, and the corresponding dataset association methods; Object3 includes attribute information = entity, constraint information = value type (Date) of constraint information, default query field constraint conditions, etc.

[0117] It should be noted that the corresponding dataset association method is preset, and the default query field constraints can be set according to actual needs. This specification does not impose any limitations on this embodiment.

[0118] For example, assuming the information to be queried is "the profit situation of XXX Company in 2021", the target query statement is "SELECT field set FROM dataset list and association method WHERE listed company = XXX Company and Date = 2021".

[0119] The scheme implemented in this specification involves entity recognition of the information to be queried, determining the entities and their attribute information within the information to be queried; filtering multiple candidate related information corresponding to the attribute information from a pre-constructed query structure relationship graph, wherein the query structure relationship graph is used to predict the related information corresponding to the information to be queried; filtering target related information from multiple candidate related information based on the information to be queried, and determining at least one business field to be queried based on the target related information; and generating a target query statement corresponding to the information to be queried based on the entity, attribute information, at least one business field to be queried, and the dataset corresponding to at least one business field to be queried. By extending the related knowledge of attribute information by utilizing the related information corresponding to entity attribute information and the business fields to be queried corresponding to each related information in the query structure relationship graph, the rapid configuration of related data query content is supported. This allows for the integration of colloquial query features into the query structure relationship graph, further generating a target query statement that accurately covers colloquial expressions. Furthermore, since the query structure relationship graph can be used to predict the related information corresponding to the information to be queried, there is no need to maintain different report query templates; the target query statement can be generated efficiently and accurately solely through the query structure relationship graph.

[0120] In one optional embodiment of this specification, when the information to be queried includes constraint information, before generating the target query statement corresponding to the information to be queried based on the entity, attribute information, at least one business field to be queried, and the dataset corresponding to at least one business field to be queried, the following steps may be included:

[0121] Identify the constraint information in the query information;

[0122] Based on the entity, attribute information, at least one business field to be queried, and the dataset corresponding to at least one business field to be queried, generate the target query statement corresponding to the information to be queried, which may include the following steps:

[0123] Based on the entity, attribute information, at least one business field to be queried, constraint information, and the dataset corresponding to at least one business field to be queried, generate the target query statement corresponding to the information to be queried.

[0124] In the embodiments of this specification, there are multiple ways to identify constraint information in the information to be queried, and the specific method selected depends on the actual situation. This specification does not impose any limitations on these methods. In one possible implementation, a constraint information database including multiple sample constraint information can be pre-set, and the information to be queried can be matched against the constraint information database to determine the constraint information in the information to be queried. In another possible implementation, an information recognition model can be used to identify the constraint information in the information to be queried.

[0125] It should be noted that the implementation method of "generating the target query statement corresponding to the query information based on the entity, attribute information, at least one business field to be queried, constraint information, and the dataset corresponding to at least one business field to be queried" is the same as the implementation method of "generating the target query statement corresponding to the query information based on the entity, attribute information, at least one business field to be queried, and the dataset corresponding to at least one business field to be queried". Therefore, the embodiments in this specification will not be described again.

[0126] By applying the scheme of the embodiments of this specification, the constraint information in the information to be queried is identified, and a target query statement corresponding to the information to be queried is generated based on the entity, attribute information, at least one business field to be queried, constraint information, and the dataset corresponding to at least one business field to be queried. This allows the target query statement to accurately limit the constraint information in the information to be queried, thereby improving the accuracy of the target query statement.

[0127] In one optional embodiment of this specification, after generating the target query statement corresponding to the query information based on the entity, attribute information, at least one business field to be queried, and the dataset corresponding to at least one business field to be queried, the following steps may be further included:

[0128] Send the target query statement to the client so that the user can query data using the target query statement.

[0129] It should be noted that when sending the target query statement to the client, you can either send the target query statement directly, or you can encrypt the target query statement using a key agreed upon with the client in advance, thereby ensuring the security of the target query statement.

[0130] The solution implemented in this specification sends the target query statement to the client, enabling the user to perform data queries using the target query statement. This provides the user with an accurate target query statement, allowing the user to perform accurate data queries.

[0131] In another optional embodiment of this specification, after generating the target query statement corresponding to the query information based on the entity, attribute information, at least one business field to be queried, and the dataset corresponding to at least one business field to be queried, the following steps may be included:

[0132] Based on the target query statement, generate the query results corresponding to the information to be queried, and send the query results to the client so that the client can display the query results.

[0133] It should be noted that after generating the target query statement, you can directly use the target query statement to query in the relational database and obtain the query results corresponding to the information to be queried.

[0134] The solution implemented in this specification generates query results corresponding to the information to be queried based on the target query statement, and sends the query results to the client so that the client can display the query results. This saves the user's query time and the client's processing resources, thereby improving the user experience.

[0135] See Figure 4a , Figure 4a A flowchart of a data query method according to an embodiment of this specification is shown. In the data query stage, an entity recognition model can be used to identify entities in the query information. Further, based on knowledge configured in the query structure relationship graph, entity, attribute information, constraint information, and association information are determined. This information is then used to populate a query template to obtain a target query statement. The target query statement is executed to generate query results corresponding to the query information. For example, see [link to relevant documentation]. Figure 4b , Figure 4b A framework diagram of another query structure relationship graph provided according to an embodiment of this specification is shown. For example... Figure 4bThe query structure graph shown includes nodes such as "XXX Company's profits over the past three years, basic information, profitability, profit performance, profit situation, listed company, net profit, non-GAAP net profit, diluted net profit, and actual controller information". Inputting the test question "How profitable is XX Bank?" helps identify the target data for the test question, "Profit situation," by associating the entity attribute information "listed company" with the corresponding related data "profit situation, basic information, and actual controller information." Further, it generates the target query statement based on the related data "profit situation," "profit performance," "net profit," "non-GAAP net profit," and "diluted net profit." It's worth noting that edges in the query structure graph can also carry specific relationship types. For example, nodes in the query structure graph include sample attribute information, sample association information, association aliases, sample query fields, and sample query information. The relationship types between nodes include attribute information (subject) - association information, association information - association aliases, association information - query fields, query statement (question) - association information, and query statement - attribute information.

[0136] The solution implemented in this specification can be divided into two stages: query structure diagram configuration and data query identification. In the configuration stage, data query content and corresponding knowledge can be associated, and related data query skills can be quickly added subsequently through the query structure diagram. In the identification stage, the knowledge of the associated data configuration can be applied, and conversational related data queries can be parsed through the query structure diagram incorporating knowledge. By extending the association knowledge of attribute information using the associated information corresponding to entity attribute information and the business fields to be queried corresponding to each associated information in the query structure diagram, the rapid configuration of related data query content is supported. This allows for the incorporation of conversational query features into the query structure diagram, further generating target query statements that accurately cover conversational expressions. Furthermore, since the query structure diagram can be used to predict the associated information corresponding to the information to be queried, there is no need to maintain different report query templates; the target query statement can be generated efficiently and accurately solely through the query structure diagram.

[0137] The following is in conjunction with the appendix Figure 5 Taking the query statement generation method provided in this specification as an example in a data query scenario, the query statement generation method will be further explained. Among other things, Figure 5 The flowchart illustrates a query statement generation method for a data query scenario according to an embodiment of this specification, specifically including the following steps:

[0138] Step 502: Obtain a data query request, wherein the data query request carries the information to be queried.

[0139] Step 504: Input the information to be queried into the entity recognition model. After processing by the entity recognition model, the entity in the information to be queried is obtained.

[0140] Step 506: Search for the entity's attribute information in the pre-set entity attribute table.

[0141] Step 508: Filter multiple candidate related information corresponding to attribute information from the pre-built query structure relationship graph, wherein the query structure relationship graph is used to predict the related information corresponding to the query information.

[0142] Step 510: Encode the query information and multiple candidate related information separately to obtain the encoded query information and multiple candidate encoded related information.

[0143] Step 512: Determine the prediction metrics between the association information and the query information of each candidate code.

[0144] Step 514: Based on each prediction indicator, determine the target related information, and in the pre-built query structure relationship graph, find at least one business field to be queried that has a relationship with the target related information.

[0145] Step 516: Generate the target query statement corresponding to the information to be queried based on the entity, attribute information, at least one business field to be queried, and the dataset corresponding to at least one business field to be queried.

[0146] Step 518: Generate the query results corresponding to the information to be queried based on the target query statement.

[0147] It should be noted that the specific implementation methods of steps 502-518 are different from those of... Figure 2 The implementation of the provided query statement generation method is the same, so the embodiments in this specification will not be described again.

[0148] By applying the solution of the embodiments in this specification, the attribute information is extended with relational knowledge by utilizing the associated information corresponding to entity attribute information and the business fields to be queried corresponding to each associated information in the query structure relationship graph. This supports the rapid configuration of associated data query content, thereby incorporating colloquial query features into the query structure relationship graph and further generating target query statements that accurately cover colloquial expressions. Furthermore, since the query structure relationship graph can be used to predict the associated information corresponding to the information to be queried, there is no need to maintain different report query templates. The target query statement can be generated efficiently and accurately using only the query structure relationship graph.

[0149] See Figure 6 , Figure 6 A schematic diagram of a data query interface provided according to an embodiment of this specification is shown.

[0150] Data querying is divided into a query request interface and a query result display interface. The query request interface includes a query information input box, an "OK" control, and a "Cancel" control. The query result display interface includes a query result display box. The user enters the query information "Basic Information of XXX Company" into the query information input box displayed on the front end, and clicks the "OK" control. The server receives the query information sent by the front end, performs entity recognition on the query information, determines the entities and their attribute information, filters multiple candidate related information corresponding to the attribute information from a pre-built query structure relationship graph, selects target related information from the multiple candidate related information based on the query information, and determines at least one query business field based on the target related information. Based on the entity, attribute information, at least one query business field, and the dataset corresponding to at least one query business field, the server generates a target query statement corresponding to the query information. Based on the target query statement, the server generates the query result "Company Address XX District XX Road XX Number". The server sends the query result to the front end so that the front end displays the query result "Company Address XX District XX Road XX Number" in the query result display box.

[0151] It should be noted that users can interact with the control in any of the following ways: clicking, double-clicking, touching, hovering the mouse, swiping, long-pressing, voice control, or shaking. The specific method to be selected depends on the actual situation, and this specification does not limit the specific method used in this embodiment.

[0152] Corresponding to the above method embodiments, this specification also provides embodiments of a query statement generation apparatus. Figure 7 A schematic diagram of a query statement generation apparatus according to an embodiment of this specification is shown. Figure 7 As shown, the device includes:

[0153] The identification module 702 is configured to perform entity identification on the information to be queried, and to determine the entities and attribute information of the entities in the information to be queried;

[0154] The filtering module 704 is configured to filter multiple candidate related information corresponding to attribute information from a pre-built query structure relationship graph, wherein the query structure relationship graph is used to predict the related information corresponding to the information to be queried;

[0155] The determination module 706 is configured to filter target related information from multiple candidate related information based on the information to be queried, and determine at least one business field to be queried based on the target related information;

[0156] The generation module 708 is configured to generate a target query statement corresponding to the information to be queried based on the entity, attribute information, at least one business field to be queried, and the dataset corresponding to at least one business field to be queried.

[0157] Optionally, the recognition module 702 is further configured to input the information to be queried into the entity recognition model, and after processing by the entity recognition model, obtain the entity in the information to be queried; and search for the attribute information of the entity in a pre-set entity attribute table.

[0158] Optionally, the device further includes: a matching module configured to match attribute information with multiple nodes in the query structure graph when the attribute information is not included in the query structure graph, to determine a target node; and to update the attribute information using the target node to obtain the updated attribute information.

[0159] Optionally, the device further includes: a construction module configured to acquire multiple sample query information; perform entity recognition on the multiple sample query information to determine the sample entities and sample attribute information of each sample query information, and determine the sample association information corresponding to the sample attribute information; determine the sample query fields that are associated with the sample association information from a pre-set dataset; and construct a query structure relationship graph with each sample query information, sample attribute information, sample association information, sample query fields, and the dataset corresponding to the sample query fields as nodes, and the relationship between nodes as edges.

[0160] Optionally, the device further includes: an update module configured to receive update query information input by the user through the front end; and to update the query structure relationship graph using the update query information to obtain the updated query structure relationship graph.

[0161] Optionally, the filtering module 704 is further configured to encode the query information and multiple candidate related information respectively to obtain coded query information and multiple candidate coded related information; determine the prediction index between each candidate coded related information and the coded query information respectively; and determine the target related information based on each prediction index.

[0162] Optionally, the filtering module 704 is further configured to search for at least one business field to be queried that has a relationship with the target related information in a pre-built query structure relationship graph.

[0163] Optionally, the generation module 708 is further configured to obtain a pre-set query template; fill the query template with entity, attribute information, at least one business field to be queried, and the dataset corresponding to at least one business field to be queried, to obtain the target query statement.

[0164] Optionally, the device further includes: a constraint recognition module configured to recognize constraint information in the information to be queried; and a generation module 708 further configured to generate a target query statement corresponding to the information to be queried based on the entity, attribute information, at least one business field to be queried, constraint information, and the dataset corresponding to at least one business field to be queried.

[0165] Optionally, the device further includes a first sending module configured to send a target query statement to a client so that the user can perform a data query using the target query statement.

[0166] Optionally, the device further includes a second sending module, configured to generate query results corresponding to the information to be queried based on the target query statement, and send the query results to the client so that the client can display the query results.

[0167] The scheme implemented in this specification involves entity recognition of the information to be queried, determining the entities and their attribute information within the information to be queried; filtering multiple candidate related information corresponding to the attribute information from a pre-constructed query structure relationship graph, wherein the query structure relationship graph is used to predict the related information corresponding to the information to be queried; filtering target related information from multiple candidate related information based on the information to be queried, and determining at least one business field to be queried based on the target related information; and generating a target query statement corresponding to the information to be queried based on the entity, attribute information, at least one business field to be queried, and the dataset corresponding to at least one business field to be queried. By extending the related knowledge of attribute information by utilizing the related information corresponding to entity attribute information and the business fields to be queried corresponding to each related information in the query structure relationship graph, the rapid configuration of related data query content is supported. This allows for the integration of colloquial query features into the query structure relationship graph, further generating a target query statement that accurately covers colloquial expressions. Furthermore, since the query structure relationship graph can be used to predict the related information corresponding to the information to be queried, there is no need to maintain different report query templates; the target query statement can be generated efficiently and accurately solely through the query structure relationship graph.

[0168] The above is a schematic scheme of a query statement generation device according to this embodiment. It should be noted that the technical solution of this query statement generation device and the technical solution of the query statement generation method described above belong to the same concept. For details not described in detail in the technical solution of the query statement generation device, please refer to the description of the technical solution of the query statement generation method described above.

[0169] Figure 8A structural block diagram of a computing device according to an embodiment of this specification is shown. The components of the computing device 800 include, but are not limited to, a memory 810 and a processor 820. The processor 820 is connected to the memory 810 via a bus 830, and a database 850 is used to store data.

[0170] The computing device 800 also includes an access device 840, which enables the computing device 800 to communicate via one or more networks 860. Examples of these networks include Public Switched Telephone Network (PSTN), Local Area Network (LAN), Wide Area Network (WAN), Personal Area Network (PAN), or combinations of communication networks such as the Internet. The access device 840 may include one or more of any type of wired or wireless network interface (e.g., Network Interface Card (NIC)), such as an IEEE 802.11 Wireless Local Area Networks (WLAN) interface, a Wi-MAX (World Interoperability for Microwave Access) interface, an Ethernet interface, a Universal Serial Bus (USB) interface, a cellular network interface, a Bluetooth interface, a Near Field Communication (NFC) interface, and so on.

[0171] In one embodiment of this specification, the above-described components of the computing device 800 and Figure 8 Other components, not shown, can also be connected to each other, for example, via a bus. It should be understood that... Figure 8 The block diagram of the computing device shown is for illustrative purposes only and is not intended to limit the scope of this specification. Those skilled in the art can add or replace other components as needed.

[0172] The computing device 800 can be any type of stationary or mobile computing device, including mobile computers or mobile computing devices (e.g., tablet computers, personal digital assistants, laptop computers, notebook computers, netbooks, etc.), mobile phones (e.g., smartphones), wearable computing devices (e.g., smartwatches, smart glasses, etc.) or other types of mobile devices, or stationary computing devices such as desktop computers or personal computers (PCs). The computing device 800 can also be a mobile or stationary server.

[0173] The processor 820 is used to execute computer-executable instructions:

[0174] Entity identification is performed on the information to be queried to determine the entities and their attribute information in the information to be queried;

[0175] From a pre-built query structure graph, multiple candidate related information corresponding to attribute information are filtered out. The query structure graph is used to predict the related information corresponding to the information to be queried.

[0176] Based on the information to be queried, filter the target related information from multiple candidate related information, and determine at least one business field to be queried based on the target related information;

[0177] Generate the target query statement corresponding to the information to be queried based on the entity, attribute information, at least one business field to be queried, and the dataset corresponding to at least one business field to be queried.

[0178] The above is an illustrative scheme of a computing device according to this embodiment. It should be noted that the technical solution of this computing device and the technical solution of the query statement generation method described above belong to the same concept. For details not described in detail in the technical solution of the computing device, please refer to the description of the technical solution of the query statement generation method described above.

[0179] One embodiment of this specification also provides a computer-readable storage medium storing computer instructions that, when executed by a processor, are used for:

[0180] Entity identification is performed on the information to be queried to determine the entities and their attribute information in the information to be queried;

[0181] From a pre-built query structure graph, multiple candidate related information corresponding to attribute information are filtered out. The query structure graph is used to predict the related information corresponding to the information to be queried.

[0182] Based on the information to be queried, filter the target related information from multiple candidate related information, and determine at least one business field to be queried based on the target related information;

[0183] Generate the target query statement corresponding to the information to be queried based on the entity, attribute information, at least one business field to be queried, and the dataset corresponding to at least one business field to be queried.

[0184] The above is an illustrative scheme of a computer-readable storage medium according to this embodiment. It should be noted that the technical solution of this storage medium and the technical solution of the query statement generation method described above belong to the same concept. For details not described in detail in the technical solution of the storage medium, please refer to the description of the technical solution of the query statement generation method described above.

[0185] The foregoing has described specific embodiments of this specification. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recited in the claims may be performed in a different order than that shown in the embodiments and may still achieve the desired result. Furthermore, the processes depicted in the drawings do not necessarily require the specific or sequential order shown to achieve the desired result. In some embodiments, multitasking and parallel processing are possible or may be advantageous.

[0186] The computer instructions include computer program code, which may be in the form of source code, object code, executable file, or some intermediate form. The computer-readable medium may include: any entity or device capable of carrying the computer program code, recording media, USB flash drive, portable hard drive, magnetic disk, optical disk, computer memory, read-only memory (ROM), random access memory (RAM), electrical carrier signals, telecommunication signals, and software distribution media, etc.

[0187] It should be noted that, for the sake of simplicity, the foregoing method embodiments are all described as a series of actions. However, those skilled in the art should understand that this specification is not limited to the described order of actions, as some steps may be performed in other orders or simultaneously according to this specification. Furthermore, those skilled in the art should also understand that the embodiments described in this specification are preferred embodiments, and the actions and modules involved are not necessarily essential to this specification.

[0188] In the above embodiments, the descriptions of each embodiment have different focuses. For parts not described in detail in a certain embodiment, please refer to the relevant descriptions of other embodiments.

[0189] The preferred embodiments disclosed above are merely illustrative of this specification. The optional embodiments do not exhaustively describe all details, nor do they limit the invention to the specific implementations described. Clearly, many modifications and variations can be made based on the content of this specification. These embodiments have been selected and specifically described in this specification to better explain the principles and practical applications of this specification, thereby enabling those skilled in the art to better understand and utilize this specification. This specification is limited only by the claims and their full scope and equivalents.

Claims

1. A method for generating query statements, characterized in that, include: Entity identification is performed on the information to be queried to determine the entities in the information to be queried and the attribute information of the entities; From a pre-constructed query structure graph, multiple candidate related information corresponding to the attribute information are filtered out. The query structure graph is used to predict the related information corresponding to the query information. The query structure graph is constructed with at least sample attribute information, sample related information of the sample attribute information, and related aliases of the sample related information as nodes, and the relationship between the sample attribute information and the sample related information and the relationship between the sample related information and the related aliases as edges. The sample related information includes colloquial indirect expressions. Based on the information to be queried, target related information is filtered from the plurality of candidate related information, and at least one business field to be queried is determined based on the target related information; the step of filtering target related information from the plurality of candidate related information based on the information to be queried includes: filtering target related information from the plurality of candidate related information based on the matching degree between the information to be queried and each candidate related information; Based on the entity, the attribute information, the at least one business field to be queried, and the dataset corresponding to the at least one business field to be queried, a target query statement corresponding to the information to be queried is generated.

2. The method according to claim 1, characterized in that, The step of performing entity recognition on the information to be queried, and determining the entities in the information to be queried and the attribute information of the entities, includes: The query information is input into the entity recognition model, and after processing by the entity recognition model, the entity in the query information is obtained. Search for the attribute information of the entity in the pre-set entity attribute table.

3. The method according to claim 1, characterized in that, After performing entity recognition on the information to be queried, and determining the entities and attribute information of the entities in the information to be queried, the method further includes: If the attribute information is not included in the query structure graph, the attribute information is matched with multiple nodes in the query structure graph to determine the target node; The target node is used to update the attribute information to obtain the updated attribute information.

4. The method according to claim 1, characterized in that, Before filtering multiple candidate association information corresponding to the attribute information from the pre-built query structure relationship graph, the process further includes: Retrieve query information from multiple samples; Entity recognition is performed on the multiple sample query information to determine the sample entities and sample attribute information of each sample query information, and the sample association information corresponding to the sample attribute information is determined. Determine the sample query fields that are associated with the sample association information from a pre-set dataset; Using the query information, attribute information, association information, query fields, and datasets corresponding to the query fields of each sample as nodes, and the association relationships between the nodes as edges, a query structure relationship graph is constructed.

5. The method according to claim 4, characterized in that, After constructing a query structure graph using the query information, attribute information, association information, query fields, and corresponding datasets of each sample query field as nodes, and the relationships between the nodes as edges, the process further includes: Receive update query information input by the user through the front end; The query structure graph is updated using the updated query information to obtain the updated query structure graph.

6. The method according to claim 1, characterized in that, The step of filtering target association information from the plurality of candidate association information based on the information to be queried includes: The information to be queried and the multiple candidate related information are encoded respectively to obtain encoded query information and multiple candidate encoded related information; Determine the prediction index between the association information of each candidate code and the code query information respectively; Based on the various forecasting indicators, determine the target-related information.

7. The method according to claim 1, characterized in that, The step of determining at least one business field to be queried based on the target association information includes: In a pre-built query structure relationship graph, find at least one business field to be queried that is related to the target associated information.

8. The method according to claim 1, characterized in that, The step of generating a target query statement corresponding to the information to be queried based on the entity, the attribute information, the at least one business field to be queried, and the dataset corresponding to the at least one business field to be queried includes: Retrieve the pre-set query template; The entity, the attribute information, the at least one business field to be queried, and the dataset corresponding to the at least one business field to be queried are filled into the query template to obtain the target query statement.

9. The method according to claim 1, characterized in that, Before generating the target query statement corresponding to the query information based on the entity, the attribute information, the at least one business field to be queried, and the dataset corresponding to the at least one business field to be queried, the method further includes: Identify the constraint information in the information to be queried; The step of generating a target query statement corresponding to the information to be queried based on the entity, the attribute information, the at least one business field to be queried, and the dataset corresponding to the at least one business field to be queried includes: Based on the entity, the attribute information, the at least one business field to be queried, the constraint information, and the dataset corresponding to the at least one business field to be queried, a target query statement corresponding to the information to be queried is generated.

10. The method according to any one of claims 1-9, characterized in that, After generating the target query statement corresponding to the query information based on the entity, the attribute information, the at least one queryable business field, and the dataset corresponding to the at least one queryable business field, the process further includes: The target query statement is sent to the client so that the user can perform a data query using the target query statement.

11. The method according to any one of claims 1-9, characterized in that, After generating the target query statement corresponding to the query information based on the entity, the attribute information, the at least one queryable business field, and the dataset corresponding to the at least one queryable business field, the process further includes: Based on the target query statement, the query results corresponding to the query information are generated, and the query results are sent to the client so that the client can display the query results.

12. A query statement generation device, characterized in that, include: The identification module is configured to perform entity identification on the information to be queried, and to determine the entities in the information to be queried and the attribute information of the entities; The filtering module is configured to filter multiple candidate association information corresponding to the attribute information from a pre-built query structure relationship graph. The query structure relationship graph is used to predict the association information corresponding to the query information. The query structure relationship graph is constructed with at least sample attribute information, sample association information of the sample attribute information, and association aliases of the sample association information as nodes, and the association relationship between the sample attribute information and the sample association information and the association relationship between the sample association information and the association aliases as edges. The sample association information includes colloquial indirect expression content. The determining module is configured to filter target related information from the plurality of candidate related information based on the information to be queried, and determine at least one business field to be queried based on the target related information; the determining module is further configured to filter target related information from the plurality of candidate related information based on the matching degree between the information to be queried and each candidate related information. The generation module is configured to generate a target query statement corresponding to the query information based on the entity, the attribute information, the at least one queryable business field, and the dataset corresponding to the at least one queryable business field.

13. A computing device, characterized in that, include: Memory and processor; The memory is used to store computer-executable instructions, and the processor is used to execute the computer-executable instructions, which, when executed by the processor, implement the steps of the query statement generation method according to any one of claims 1 to 11.

14. A computer-readable storage medium, characterized in that, It stores computer instructions that, when executed by a processor, implement the steps of the query statement generation method according to any one of claims 1 to 11.

Citation Information

Patent Citations

  • Target query statement construction method and device, storage medium and electronic device

    CN113127506A