Data query statement generation method and device, equipment, storage medium and product

By parsing and translating the modeling statements input by users, data query statements are generated, which solves the problem of complex generation processes in existing technologies and achieves the effect of simplifying the process and lowering the threshold.

CN116431657BActive Publication Date: 2026-07-03CHINA CONSTRUCTION BANK +1
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
CHINA CONSTRUCTION BANK
Filing Date
2023-02-28
Publication Date
2026-07-03

AI Technical Summary

Technical Problem

Existing data query statement generation technologies require training with a large number of samples or writing a large number of grammars, resulting in a complex generation process and a high barrier to entry.

Method used

By acquiring the modeling statement input by the user, parsing the keywords and their attributes, and translating them based on the pre-configured mapping relationship, a data query statement is generated.

Benefits of technology

It simplifies the data query statement generation process, lowers the barrier to entry, and improves generation efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116431657B_ABST
    Figure CN116431657B_ABST
Patent Text Reader

Abstract

This invention discloses a method, apparatus, device, storage medium, and product for generating data query statements. This invention relates to the field of big data technology. The method includes: acquiring a modeling statement input by a user; parsing the user-input modeling statement to obtain keywords in the user-input modeling statement and the keyword attributes corresponding to the keywords; translating the keywords in the user-input modeling statement and the keyword attributes corresponding to the keywords based on a pre-configured mapping relationship to obtain keyword translation results; and generating a data query statement based on the keyword translation results. The technical solution of this invention, by parsing and translating the user-input modeling statement to generate a data query statement, has a simple process and can achieve the technical effect of simplifying the data query statement generation process.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The embodiments of the present invention relate to the field of big data technology, and in particular to a method, apparatus, device, storage medium and product for generating data query statements. Background Technology

[0002] With the development of big data technology, data query technology has been widely used.

[0003] Currently, when users perform data queries using data query statements (such as SQL), they often construct data query statements through visual drag-and-drop or generate data query statements through natural language processing algorithms.

[0004] The existing technical solutions for generating data query statements mentioned above require a large number of samples for training or the writing of a large number of grammars, resulting in a complex data query statement generation or modeling process. Summary of the Invention

[0005] This invention provides a method, apparatus, device, storage medium, and product for generating data query statements, which simplifies the data query statement generation process and reduces the complexity of modeling.

[0006] In a first aspect, embodiments of the present invention provide a method for generating data query statements, including:

[0007] Obtain the modeling statements input by the user;

[0008] The modeling statement input by the user is parsed to obtain the keywords in the modeling statement input by the user and the keyword attributes corresponding to the keywords;

[0009] Based on the pre-configured mapping relationship, the keywords in the modeling statement input by the user and the keyword attributes corresponding to the keywords are translated to obtain the keyword translation result;

[0010] Generate a data query statement based on the translation results of the keywords.

[0011] Secondly, embodiments of the present invention also provide a data query statement generation apparatus, the apparatus comprising:

[0012] The modeling statement acquisition module is used to acquire the modeling statements input by the user.

[0013] The keyword parsing module is used to parse the modeling statement input by the user to obtain the keywords in the modeling statement input by the user and the keyword attributes corresponding to the keywords;

[0014] The keyword translation module is used to translate the keywords in the modeling statement input by the user and the keyword attributes corresponding to the keywords based on a pre-configured mapping relationship, so as to obtain the keyword translation result;

[0015] The query statement generation module is used to generate data query statements based on the keyword translation results.

[0016] Thirdly, embodiments of the present invention also provide an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the program to implement the data query statement generation method as described in any of the embodiments of the present invention.

[0017] Fourthly, embodiments of the present invention also provide a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the data query statement generation method as described in any of the embodiments of the present invention.

[0018] Fifthly, embodiments of the present invention also provide a computer program product, including a computer program that, when executed by a processor, implements the data query statement generation method as described in any of the embodiments of the present invention.

[0019] In this embodiment of the invention, a user-input modeling statement is obtained, parsed to obtain keywords and their corresponding keyword attributes; based on a pre-configured mapping relationship, the keywords and their corresponding keyword attributes are translated to obtain a keyword translation result; and a data query statement is generated based on the keyword translation result. This technical solution, by parsing and translating the user-input modeling statement to generate a data query statement, offers a simpler process compared to existing sample training and grammar parsing methods, thus lowering the barrier to entry for data querying. Attached Figure Description

[0020] To more clearly illustrate the technical solutions of the embodiments of the present invention, the accompanying drawings used in the embodiments will be briefly introduced below. It should be understood that the following drawings only show some embodiments of the present invention and should not be regarded as a limitation on the scope. For those skilled in the art, other related drawings can be obtained based on these drawings without creative effort.

[0021] Figure 1 A flowchart illustrating a data query statement generation method provided in an embodiment of the present invention;

[0022] Figure 2A flowchart illustrating a data query statement generation method provided in an embodiment of the present invention;

[0023] Figure 3 A flowchart illustrating a data query statement generation method provided in an embodiment of the present invention;

[0024] Figure 4 This is a schematic diagram of the structure of a data query statement generation system provided in an embodiment of the present invention;

[0025] Figure 5 This is a schematic diagram of the structure of a data query statement generation device provided in an embodiment of the present invention;

[0026] Figure 6 This is a schematic diagram of the structure of an electronic device provided in an embodiment of the present invention. Detailed Implementation

[0027] The present invention will now be described in further detail with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the invention and not intended to limit it. Furthermore, it should be noted that, for ease of description, the accompanying drawings show only the parts relevant to the present invention, and not all of the structures.

[0028] It should be noted that similar reference numerals and letters in the following figures indicate similar items; therefore, once an item is defined in one figure, it does not need to be further defined and explained in subsequent figures. Furthermore, in the description of this invention, terms such as "first," "second," etc., are used only for distinguishing descriptions and should not be construed as indicating or implying relative importance. The acquisition, storage, use, and processing of data in the technical solutions of this application all comply with the relevant provisions of national laws and regulations.

[0029] To clearly understand the technical solution of this invention, a detailed description of existing technical solutions is provided. The existing process for generating SQL based on natural language is as follows:

[0030] 1) Develop context-free grammars that conform to the Chomsky paradigm based on existing natural languages.

[0031] 2) Parse the user's input natural language according to the grammar rules.

[0032] 3) Use NLTK to parse user input natural language into query SQL, where NLTK is a natural language processing toolkit.

[0033] Besides the aforementioned schemes for generating SQL based on natural language, there are other schemes that use other natural language processing algorithms to generate SQL. These schemes all require a large amount of sample training data or writing a large number of grammars to parse the natural language input by users in different scenarios. The model building or usage threshold is high, and the algorithms or models mentioned above for generating data query statements cannot be reused.

[0034] Figure 1 This is a flowchart illustrating a data query statement generation method provided in an embodiment of the present invention. This embodiment is applicable to the automatic generation of data query statements. The method can be executed by a data query statement generation device, which can be implemented in hardware and / or software and can be configured in devices such as computer terminals and servers. Figure 1 As shown, the method includes:

[0035] S110, Obtain the modeling statement input by the user.

[0036] In this embodiment, the modeling statement refers to a data query request based on semi-natural language input by the user. The modeling statement can be text input or voice input, and there is no limitation on this. For example, the modeling statement input by the user can be "Find users whose gender is male", or it can be "Find users in region A", etc.

[0037] Specifically, user-inputted modeling statements can be collected through the voice acquisition device, keyboard, or touchscreen of an electronic device. Alternatively, user-inputted modeling statements can be retrieved from other electronic devices connected to the electronic device or from the cloud. No specific limitations are imposed here.

[0038] Optionally, the modeling statement input by the user can be obtained, including: receiving the modeling statement in voice form from the user; or receiving the modeling statement in text form from the user.

[0039] For example, the user's voice input of "finding users whose gender is male" can be captured through a microphone and converted into processable text information; or, the user's text input of "finding users whose gender is male" can be captured through a keyboard.

[0040] S120. Parse the modeling statement input by the user to obtain the keywords in the modeling statement input by the user and the keyword attributes corresponding to the keywords.

[0041] In this embodiment, keywords refer to the characters or words obtained by parsing the modeling statement. Keyword attributes refer to information that can characterize the properties of keywords, and may include, but are not limited to, field names, target values, and operators.

[0042] After obtaining the modeling statement input by the user, keywords can be extracted from it, resulting in multiple keywords. For example, the user's input modeling statement could be "find users whose gender is male," and the resulting keywords could include "gender," "male," etc., where "gender" corresponds to the keyword attribute as a field name, and "male" corresponds to the keyword attribute as a target value.

[0043] In some embodiments, semantic analysis can be performed on the modeling statement input by the user to obtain multiple keywords and their corresponding keyword attributes. The semantic analysis method can be a lexical-level semantic analysis method.

[0044] S130. Based on the pre-configured mapping relationship, translate the keywords in the modeling statement input by the user and the keyword attributes corresponding to the keywords to obtain the keyword translation result.

[0045] In this embodiment, the pre-configured mapping relationship can map keywords and / or keyword attributes to obtain information that can generate data query statements, i.e., keyword translation results. The pre-configured mapping relationship may include one or more mapping relationships, which is not limited here.

[0046] Specifically, keywords and / or keyword attributes can be mapped to keyword translation results that can be used to generate data query statements based on pre-configured mapping relationships.

[0047] S140. Generate a data query statement based on the keyword translation results.

[0048] In this embodiment, the data query statement is a statement that can be used for data querying, such as an SQL statement.

[0049] Specifically, the keyword translation results can contain multiple translated information. These multiple translated information can be concatenated according to the statement concatenation rules to obtain the data query statement. The statement concatenation rules are pre-configured standard rules for statement concatenation.

[0050] The technical solution of this invention generates data query statements by parsing and translating the modeling statements input by the user. Compared with existing sample training and grammar parsing methods, this data query statement generation scheme is simple and simplifies the data query statement generation process, thereby lowering the threshold for using data queries.

[0051] Figure 2This is a flowchart illustrating a data query statement generation method provided in this embodiment of the invention. The method in this embodiment can be combined with various optional schemes in the data query statement generation methods provided in the above embodiments. The data query statement generation method provided in this embodiment has been further optimized. Optionally, parsing the user-inputted modeling statement to obtain the keywords in the user-inputted modeling statement and the keyword attributes corresponding to the keywords includes: extracting keywords from the user-inputted modeling statement based on a delimiter field to obtain the keywords in the user-inputted modeling statement; and determining the keyword attributes corresponding to the keywords in the user-inputted modeling statement based on a pre-configured modeling statement template.

[0052] like Figure 2 As shown, the method includes:

[0053] S210. Obtain the modeling statement input by the user.

[0054] S220. Extract keywords from the modeling statement input by the user based on the delimiter field to obtain the keywords in the modeling statement input by the user.

[0055] In this embodiment, the separator field refers to the field content used to separate fields. For example, the separator field can be fields such as "is", "of", "and".

[0056] For example, the modeling statement entered by the user can be "find users whose gender is male", with "is" and "of" as the separator fields. Then, the words "gender", "male" and "user" before and after "is" and "of" can be identified as keywords.

[0057] S230. Based on the pre-configured modeling statement template, determine the keyword attributes corresponding to the keywords in the modeling statement input by the user.

[0058] In this embodiment, the modeling statement template is used to determine the keyword attributes corresponding to the keywords in the user-input modeling statement based on keyword location information, where keyword location information refers to the position of the keyword in the modeling statement. Specifically, the modeling statement template may contain a correspondence between keyword location information and keyword attributes, and thus the keyword attributes corresponding to the keywords in the user-input modeling statement can be determined based on this correspondence.

[0059] In some embodiments, the modeling statement template can be selected and determined by the user. In other words, there can be multiple pre-configured modeling statement templates, and the user can select the appropriate modeling statement template according to their needs.

[0060] For example, the modeling statement template can be "Find [customers] with [gender] [are] [male]", where each square bracket represents a keyword position, the keyword attribute information corresponding to the first square bracket position is fixed as the field name, and the keyword attribute information corresponding to the third square bracket position is fixed as the target value.

[0061] Based on the above embodiments, optionally, before obtaining the modeling statement input by the user, the method further includes: responding to template configuration information configured by the user through an electronic device, and generating a modeling statement template based on the template configuration information.

[0062] For example, the modeling statement template can be configured through a user configuration module on the computer. The template configuration information refers to the information required to construct the modeling statement template, which may include information related to field names, operators, and target values.

[0063] S240. Based on the pre-configured mapping relationship, translate the keywords in the modeling statement input by the user and the keyword attributes corresponding to the keywords to obtain the keyword translation result.

[0064] S250. Generate a data query statement based on the keyword translation results.

[0065] The technical solution of this invention extracts keywords from the user-input modeling statement based on the delimiter field, obtains the keywords in the user-input modeling statement, and then determines the keyword attributes corresponding to the keywords in the user-input modeling statement based on a pre-configured modeling statement template, thereby realizing keyword parsing.

[0066] Figure 3 This is a flowchart illustrating a data query statement generation method provided in this embodiment of the invention. The method in this embodiment can be combined with various optional schemes in the data query statement generation methods provided in the above embodiments. The data query statement generation method provided in this embodiment has been further optimized. Optionally, the pre-configured mapping relationship includes a mapping relationship between database tables and fields, and a mapping relationship between target values ​​and database values; and the keyword translation result includes field names and database values; correspondingly, the translation of keywords in the user-input modeling statement and the keyword attributes corresponding to the keywords based on the pre-configured mapping relationship to obtain keyword translation results includes: translating the conditional fields in the keyword attributes corresponding to the keywords into field names corresponding to the conditional fields in the keyword attributes based on the mapping relationship between database tables and fields; and translating the target value in the keyword attributes corresponding to the keywords into the database value corresponding to the target value in the keyword attributes based on the mapping relationship between target values ​​and database values.

[0067] like Figure 3 As shown, the method includes:

[0068] S310. Obtain the modeling statement input by the user.

[0069] S320. Parse the modeling statement input by the user to obtain the keywords in the modeling statement input by the user and the keyword attributes corresponding to the keywords.

[0070] S330. Based on the mapping relationship between the database table and the field, translate the condition field in the keyword attribute corresponding to the keyword into the field name corresponding to the condition field in the keyword attribute.

[0071] In this embodiment, the mapping relationship between database tables and fields is a pre-configured mapping relationship template. It can be understood that through the mapping relationship between database tables and fields, the conversion of condition fields to field names can be quickly realized so as to generate data query statements, thereby improving the generation efficiency of data query statements.

[0072] Based on the above embodiments, optionally, before obtaining the modeling statement input by the user, the method further includes: responding to the mapping relationship between database tables and fields configured by the user through an electronic device, and storing the mapping relationship between the database tables and fields.

[0073] For example, the mapping relationship between database tables and fields can be configured through a user configuration module in the computer, so that it can be used to generate data query statements later.

[0074] S340. Based on the mapping relationship between the target value and the database value, the target value in the keyword attribute corresponding to the keyword is translated into the database value corresponding to the target value in the keyword attribute.

[0075] In this embodiment, the mapping relationship between the target value and the database value is a pre-configured mapping relationship template. It can be understood that through the mapping relationship between the target value and the database value, the conversion from the target value to the database value can be quickly realized so as to generate data query statements, thereby improving the generation efficiency of data query statements.

[0076] Based on the above embodiments, optionally, before obtaining the modeling statement input by the user, the method further includes: responding to the mapping relationship between the target value and the database value configured by the user through an electronic device, and storing the mapping relationship between the target value and the database value.

[0077] For example, the mapping relationship between target values ​​and database values ​​can be configured through a user configuration module in the computer, so that it can be used to generate data query statements later.

[0078] S350. Based on the mapping relationship between the target value and the database value, the target value in the keyword attribute corresponding to the keyword is translated into the database value corresponding to the target value in the keyword attribute.

[0079] S360. Generate a data query statement based on the keyword translation result, wherein the keyword translation result includes the field name corresponding to the condition field in the keyword attribute and the database value corresponding to the target value in the keyword attribute.

[0080] Based on the above embodiments, optionally, generating a data query statement based on the keyword translation result includes: concatenating the field name corresponding to the condition field in the keyword attribute and the database value corresponding to the target value in the keyword attribute to obtain at least one single-sentence query statement; obtaining multi-sentence association conditions input by the user, and associating each of the single-sentence query statements based on the multi-sentence association conditions input by the user to obtain a data query statement.

[0081] A single-statement query refers to a query containing only one data query statement. In contrast, a multi-statement query statement allows for more complex data queries. Multi-statement join conditions can be mapped to AND or OR relationships in data query statements and can be nested, thus increasing the complexity of the data query statement and providing convenience for users' data queries.

[0082] Specifically, based on standardized SQL concatenation rules, the field names corresponding to the condition fields in the keyword attributes and the database values ​​corresponding to the target values ​​in the keyword attributes can be concatenated to obtain a single query statement. Based on multi-statement association conditions, multiple single query statements can be associated to generate more complex data query statements, so that users can complete data queries in one go.

[0083] Based on the above embodiments, optionally, after concatenating the field name corresponding to the condition field in the keyword attribute and the database value corresponding to the target value in the keyword attribute to obtain at least one single query statement, the method further includes: displaying the query conditions related to the single query statement.

[0084] Among them, the query conditions related to a single query statement refer to the WHERE condition.

[0085] For example, the modeling statement entered by the user can be "query users aged 10 years and older", and the corresponding query condition is "where [age](>) 10". The query condition can be displayed through the display device of the electronic device.

[0086] Figure 4This is a schematic diagram of a data query statement generation system provided in an embodiment of the present invention. The system includes a user configuration module, a business processing module, and an SQL statement concatenation module. The user configuration module includes a sentence template configuration unit, a database mapping configuration unit, and a code value mapping configuration unit. The business processing module includes a modeling statement input unit, a keyword parsing unit, and a keyword translation unit. The SQL statement concatenation module includes a single-sentence concatenation unit, a multi-sentence association condition acquisition unit, and an SQL statement concatenation unit.

[0087] Specifically, the sentence template configuration unit is used to respond to template configuration information configured by the user through an electronic device and generate modeling sentence templates based on the template configuration information.

[0088] The database mapping configuration unit is used to respond to the mapping relationship between database tables and fields configured by the user through an electronic device, and to store the mapping relationship between the database tables and fields.

[0089] The code value mapping configuration unit is used to respond to the mapping relationship between the target value and the database value configured by the user through the electronic device, and to store the mapping relationship between the target value and the database value.

[0090] The modeling statement input unit is used to obtain the modeling statement input by the user.

[0091] The keyword parsing unit is used to parse the modeling statement input by the user to obtain the keywords in the modeling statement and the keyword attributes corresponding to the keywords.

[0092] The keyword translation unit is used to translate the keywords in the modeling statement input by the user and the keyword attributes corresponding to the keywords based on a pre-configured mapping relationship, so as to obtain the keyword translation result.

[0093] A single-sentence concatenation unit is used to concatenate the translation results of keywords to obtain at least one single-sentence query statement.

[0094] The multi-sentence association condition acquisition unit is used to respond to the combination conditions selected by the user through the electronic device interface and generate the multi-sentence association conditions corresponding to the combination conditions.

[0095] The SQL statement concatenation unit is used to associate individual query statements based on multi-sentence association conditions input by the user to obtain a data query statement.

[0096] Figure 5 This is a schematic diagram of a data query statement generation device provided in an embodiment of the present invention. Figure 5 As shown, the device includes:

[0097] The modeling statement acquisition module 410 is used to acquire the modeling statement input by the user;

[0098] The keyword parsing module 420 is used to parse the modeling statement input by the user to obtain the keywords in the modeling statement input by the user and the keyword attributes corresponding to the keywords.

[0099] The keyword translation module 430 is used to translate the keywords in the modeling statement input by the user and the keyword attributes corresponding to the keywords based on a pre-configured mapping relationship, so as to obtain the keyword translation result;

[0100] The query statement generation module 440 is used to generate a data query statement based on the keyword translation results.

[0101] In some optional implementations, the modeling statement acquisition module 410 is further configured to:

[0102] Receive user input in the form of voice-based modeling statements; or,

[0103] It receives modeling statements in text form from the user.

[0104] In some alternative implementations, the keyword parsing module 420 includes:

[0105] The keyword extraction unit is used to extract keywords from the modeling statement input by the user based on the delimiter field, so as to obtain the keywords in the modeling statement input by the user.

[0106] The keyword attribute determination unit is used to determine the keyword attributes corresponding to the keywords in the modeling statement input by the user, based on a pre-configured modeling statement template.

[0107] In some optional implementations, the modeling statement template is used for:

[0108] The keyword attributes corresponding to the keywords in the modeling statement input by the user are determined based on the keyword location information.

[0109] In some optional implementations, the pre-configured mapping relationships include mapping relationships between database tables and fields, and mapping relationships between target values ​​and database values.

[0110] In some optional implementations, the keyword translation result includes field names and database values;

[0111] Correspondingly, the keyword translation module 430 includes:

[0112] The first mapping unit is used to translate the condition field in the keyword attribute corresponding to the keyword into the field name corresponding to the condition field in the keyword attribute, based on the mapping relationship between the database table and the field.

[0113] The second mapping unit is used to translate the target value in the keyword attribute corresponding to the keyword into the database value corresponding to the target value in the keyword attribute, based on the mapping relationship between the target value and the database value.

[0114] In some optional implementations, the query statement generation module 440 includes:

[0115] The single-sentence query statement concatenation unit is used to concatenate the field name corresponding to the condition field in the keyword attribute and the database value corresponding to the target value in the keyword attribute to obtain at least one single-sentence query statement.

[0116] The multi-query statement association unit is used to obtain multi-sentence association conditions input by the user, and associate each single-sentence query statement based on the multi-sentence association conditions input by the user to obtain a data query statement.

[0117] In some alternative embodiments, the apparatus further includes:

[0118] The query condition display module is used to display the query conditions related to the single query statement.

[0119] In some alternative embodiments, the apparatus further includes:

[0120] The modeling statement template configuration module is used to respond to template configuration information configured by the user through an electronic device and generate modeling statement templates based on the template configuration information.

[0121] In some alternative embodiments, the apparatus further includes:

[0122] The first mapping relationship configuration module is used to respond to the mapping relationship between database tables and fields configured by the user through an electronic device, and to store the mapping relationship between the database tables and fields.

[0123] In some alternative embodiments, the apparatus further includes:

[0124] The second mapping relationship configuration module is used to respond to the mapping relationship between the target value and the database value configured by the user through the electronic device, and to store the mapping relationship between the target value and the database value.

[0125] The data query statement generation device provided in this embodiment of the invention can execute the data query statement generation method provided in any embodiment of the invention, and has the corresponding functional modules and beneficial effects of the execution method.

[0126] Figure 6 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this disclosure. Reference is made below. Figure 6 It illustrates an electronic device suitable for implementing embodiments of the present disclosure (e.g., Figure 6 The diagram below shows the structure of the terminal device or server 500. The terminal device in this embodiment may include, but is not limited to, mobile terminals such as mobile phones, laptops, digital broadcast receivers, PDAs (personal digital assistants), PADs (tablet computers), PMPs (portable multimedia players), and vehicle terminals (e.g., vehicle navigation terminals), as well as fixed terminals such as digital TVs and desktop computers. Figure 6 The electronic device shown is merely an example and should not be construed as limiting the functionality and scope of the embodiments disclosed herein.

[0127] like Figure 6 As shown, electronic device 500 may include a processing unit (e.g., central processing unit, graphics processor, etc.) 501, which can perform various appropriate actions and processes according to a program stored in read-only memory (ROM) 502 or a program loaded from storage device 508 into random access memory (RAM) 503. The RAM 503 also stores various programs and data required for the operation of electronic device 500. The processing unit 501, ROM 502, and RAM 503 are interconnected via bus 504. An edit / output (I / O) interface 505 is also connected to bus 504.

[0128] Typically, the following devices can be connected to I / O interface 505: input devices 506 including, for example, touchscreens, touchpads, keyboards, mice, cameras, microphones, accelerometers, gyroscopes, etc.; output devices 507 including, for example, liquid crystal displays (LCDs), speakers, vibrators, etc.; storage devices 508 including, for example, magnetic tapes, hard disks, etc.; and communication devices 509. Communication device 509 allows electronic device 500 to communicate wirelessly or wiredly with other devices to exchange data. Although Figure 6 An electronic device 500 with various devices is shown; however, it should be understood that it is not required to implement or possess all of the devices shown. More or fewer devices may be implemented or possessed alternatively.

[0129] In particular, according to embodiments of this disclosure, the processes described above with reference to the flowcharts can be implemented as computer software programs. For example, embodiments of this disclosure include a computer program product comprising a computer program carried on a non-transitory computer-readable medium, the computer program containing program code for performing the methods shown in the flowcharts. In such embodiments, the computer program can be downloaded and installed from a network via a communication device 509, or installed from a storage device 508, or installed from a ROM 502. When the computer program is executed by the processing device 501, it performs the functions defined in the methods of embodiments of this disclosure.

[0130] The names of messages or information exchanged between multiple devices in the embodiments of this disclosure are for illustrative purposes only and are not intended to limit the scope of such messages or information.

[0131] The electronic device provided in this embodiment and the data query statement generation method provided in the above embodiments belong to the same inventive concept. Technical details not described in detail in this embodiment can be found in the above embodiments, and this embodiment has the same beneficial effects as the above embodiments.

[0132] This disclosure provides a computer-readable storage medium storing a computer program thereon, which, when executed by a processor, implements the data query statement generation method provided in the above embodiments.

[0133] It should be noted that the computer-readable medium described in this disclosure can be a computer-readable signal medium or a computer-readable storage medium, or any combination thereof. A computer-readable storage medium can be, for example,—but not limited to—an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples of a computer-readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer disk, a hard disk, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage device, magnetic storage device, or any suitable combination thereof. In this disclosure, a computer-readable storage medium can be any tangible medium containing or storing a program that can be used by or in connection with an instruction execution system, apparatus, or device. In this disclosure, a computer-readable signal medium can include a data signal propagated in baseband or as part of a carrier wave, carrying computer-readable program code. Such propagated data signals can take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. A computer-readable signal medium can be any computer-readable medium other than a computer-readable storage medium, which can send, propagate, or transmit a program for use by or in connection with an instruction execution system, apparatus, or device. The program code contained on the computer-readable medium can be transmitted using any suitable medium, including but not limited to: wires, optical fibers, RF (radio frequency), etc., or any suitable combination thereof.

[0134] In some implementations, clients and servers can communicate using any currently known or future-developed network protocol such as HTTP (Hypertext Transfer Protocol) and can interconnect with digital data communication (e.g., communication networks) of any form or medium. Examples of communication networks include local area networks (“LANs”), wide area networks (“WANs”), the Internet (e.g., the Internet of Things), and peer-to-peer networks (e.g., ad hoc peer-to-peer networks), as well as any currently known or future-developed networks.

[0135] The aforementioned computer-readable medium may be included in the aforementioned electronic device; or it may exist independently and not assembled into the electronic device.

[0136] The aforementioned computer-readable medium carries one or more programs that, when executed by the electronic device, cause the electronic device to:

[0137] Obtain the modeling statements input by the user;

[0138] The modeling statement input by the user is parsed to obtain the keywords in the modeling statement input by the user and the keyword attributes corresponding to the keywords;

[0139] Based on the pre-configured mapping relationship, the keywords in the modeling statement input by the user and the keyword attributes corresponding to the keywords are translated to obtain the keyword translation result;

[0140] Generate a data query statement based on the translation results of the keywords.

[0141] Computer program code for performing the operations of this disclosure can be written in one or more programming languages ​​or a combination thereof, including but not limited to object-oriented programming languages ​​such as Java, Smalltalk, and C++, as well as conventional procedural programming languages ​​such as the "C" language or similar programming languages. The program code can be executed entirely on the user's computer, partially on the user's computer, as a standalone software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving remote computers, the remote computer can be connected to the user's computer via any type of network—including a local area network (LAN) or a wide area network (WAN)—or can be connected to an external computer (e.g., via the Internet using an Internet service provider).

[0142] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of this disclosure. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code containing one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions indicated in the blocks may occur in a different order than those indicated in the drawings. For example, two consecutively indicated blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in the block diagrams and / or flowcharts, and combinations of blocks in the block diagrams and / or flowcharts, can be implemented using a dedicated hardware-based system that performs the specified function or operation, or using a combination of dedicated hardware and computer instructions.

[0143] The units described in the embodiments of this disclosure can be implemented in software or hardware. The names of the units are not, in some cases, intended to limit the specific unit.

[0144] The functions described above in this document can be performed, at least in part, by one or more hardware logic components. For example, exemplary types of hardware logic components that can be used, without limitation, include: Field Programmable Gate Arrays (FPGAs), Application-Specific Integrated Circuits (ASICs), Application Standard Products (ASSPs), System-on-Chip (SoCs), Complex Programmable Logic Devices (CPLDs), and so on.

[0145] In the context of this disclosure, a machine-readable medium can be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, apparatus, or device. A machine-readable medium can be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium can be, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination of the foregoing. More specific examples of machine-readable storage media include electrical connections based on one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination of the foregoing.

[0146] This invention also provides a computer program product, including a computer program that, when executed by a processor, implements the data query statement generation method provided in any embodiment of this application.

[0147] In implementing the computer program product, computer program code for performing the operations of this invention can be written in one or more programming languages ​​or a combination thereof. Programming languages ​​include object-oriented programming languages ​​such as Java, Smalltalk, and C++, as well as conventional procedural programming languages ​​such as C or similar languages. The program code can be executed entirely on the user's computer, partially on the user's computer, as a standalone software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving remote computers, the remote computer can be connected to the user's computer via any type of network—including a local area network (LAN) or a wide area network (WAN)—or can be connected to an external computer (e.g., via the Internet using an Internet service provider).

[0148] Note that the above description is merely a preferred embodiment of the present invention and the technical principles employed. Those skilled in the art will understand that the present invention is not limited to the specific embodiments described herein, and various obvious changes, readjustments, and substitutions can be made without departing from the scope of protection of the present invention. Therefore, although the present invention has been described in detail through the above embodiments, the present invention is not limited to the above embodiments, and may include many other equivalent embodiments without departing from the concept of the present invention, the scope of which is determined by the scope of the appended claims.

Claims

1. A method for generating a data query statement, characterized by, include: Obtain the modeling statements input by the user; Based on the delimiter field, keywords are extracted from the modeling statement input by the user to obtain the keywords in the modeling statement input by the user; wherein, the delimiter field is the field content used to separate fields; Based on a pre-configured modeling statement template, the keyword attributes corresponding to the keywords in the modeling statement input by the user are determined; wherein, the modeling statement template includes the correspondence between keyword position information and keyword attributes; Based on pre-configured mapping relationships, the keywords in the modeling statement input by the user and the keyword attributes corresponding to the keywords are translated to obtain keyword translation results; wherein, the pre-configured mapping relationships include the mapping relationship between database tables and fields, and the mapping relationship between target values ​​and database values; the keyword translation results include field names and database values; and a data query statement is generated based on the keyword translation results. The step of translating keywords in the user-input modeling statement and their corresponding keyword attributes based on a pre-configured mapping relationship to obtain keyword translation results includes: Based on the mapping relationship between the database table and the field, the condition field in the keyword attribute corresponding to the keyword is translated into the field name corresponding to the condition field in the keyword attribute; Based on the mapping relationship between the target value and the database value, the target value in the keyword attribute corresponding to the keyword is translated into the database value corresponding to the target value in the keyword attribute.

2. The method according to claim 1, characterized in that, The modeling statements for obtaining user input include: Receive user input in the form of voice-based modeling statements; or, It receives modeling statements in text form from the user.

3. The method according to claim 1, characterized in that, The modeling statement template is used for: The keyword attributes corresponding to the keywords in the modeling statement input by the user are determined based on the keyword location information.

4. The method according to claim 1, characterized in that, The process of generating a data query statement based on the keyword translation results includes: By concatenating the field name corresponding to the condition field in the keyword attribute and the database value corresponding to the target value in the keyword attribute, at least one single query statement is obtained. Obtain the multi-sentence association conditions input by the user, and associate each of the single-sentence query statements based on the multi-sentence association conditions input by the user to obtain the data query statement.

5. The method according to claim 4, characterized in that, After concatenating the field name corresponding to the condition field in the keyword attribute and the database value corresponding to the target value in the keyword attribute to obtain at least one single query statement, the method further includes: Display the query conditions related to the single query statement.

6. The method according to claim 1, characterized in that, Before obtaining the modeling statement input by the user, the method further includes: In response to template configuration information configured by the user through an electronic device, a modeling statement template is generated based on the template configuration information.

7. The method according to claim 1, characterized in that, Before obtaining the modeling statement input by the user, the method further includes: The system responds to the mapping relationship between database tables and fields configured by the user through an electronic device, and stores the mapping relationship between the database tables and fields.

8. The method according to claim 1, characterized in that, Before obtaining the modeling statement input by the user, the method further includes: The system responds to the mapping relationship between target values ​​and database values ​​configured by the user through an electronic device, and stores the mapping relationship between the target values ​​and database values.

9. A data query statement generation device, characterized in that, include: The modeling statement acquisition module is used to acquire the modeling statements input by the user. The keyword parsing module includes: The keyword extraction unit is used to extract keywords from the modeling statement input by the user based on the separator field, so as to obtain the keywords in the modeling statement input by the user; wherein, the separator field is the field content used to separate fields; The keyword attribute determination unit is used to determine the keyword attributes corresponding to the keywords in the modeling statement input by the user based on a pre-configured modeling statement template; wherein, the modeling statement template includes the correspondence between keyword position information and keyword attributes; The keyword translation module is used to translate the keywords and their corresponding keyword attributes in the modeling statement input by the user based on a pre-configured mapping relationship, and to obtain the keyword translation result; wherein, the pre-configured mapping relationship includes the mapping relationship between database tables and fields, and the mapping relationship between target values ​​and database values; the keyword translation result includes field names and database values; The query statement generation module is used to generate data query statements based on the keyword translation results. The keyword translation module includes: The first mapping unit is used to translate the condition field in the keyword attribute corresponding to the keyword into the field name corresponding to the condition field in the keyword attribute, based on the mapping relationship between the database table and the field. The second mapping unit is used to translate the target value in the keyword attribute corresponding to the keyword into the database value corresponding to the target value in the keyword attribute, based on the mapping relationship between the target value and the database value.

10. An electronic device, characterized in that, The system includes a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, when the processor executes the computer program, it implements the data query statement generation method as described in any one of claims 1-8.

11. A computer-readable storage medium having a computer program stored thereon, characterized in that, When executed by the processor, the program implements the data query statement generation method as described in any one of claims 1-8.

12. A computer program product, comprising a computer program, characterized in that, When the computer program is executed by a processor, it implements the data query statement generation method as described in any one of claims 1-8.