Multi-data-source processing method, multi-data-source processing system and computer readable storage medium

By generating parsing files and semantic graphs to connect multiple databases, users solve the learning and maintenance difficulties when using different syntax databases, and realize flexible association and nested queries of multiple databases, improving usage efficiency and flexibility.

CN120256457APending Publication Date: 2025-07-04ZHUHAI YOUTE ENTERPRISE MANAGEMENT CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510335238.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-03-20
Publication Date
2025-07-04

AI Technical Summary

Technical Problem

In the prior art, ordinary users need to write multiple sets of adaptation codes when using multiple databases with different syntaxes, which have high learning costs and low usage efficiency. The existing methods can only convert one database and cannot meet the associated use of multiple different syntax databases.

Method used

By obtaining user input information, generating parsing files and forming semantic graphs, connecting target data tables with different syntaxes according to semantic graphs, analyzing and mapping is used for use, reducing the threshold for use, storing connection information using connection pools, improving connection efficiency, and supporting flexible association and nested queries of multiple databases.

Benefits of technology

It realizes flexible association of different syntax databases, reduces code maintenance costs, improves the flexibility and efficiency of multiple databases, and reduces the difficulty of user learning and operation.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120256457A_ABST
    Figure CN120256457A_ABST
Patent Text Reader

Abstract

The invention provides a multi-data-source processing method, a multi-data-source processing system and a computer readable storage medium. The method comprises the following steps: acquiring user input information; variable information and data table information of the user input information are extracted, and the variable information, the data table information and the user input information form an analysis file; generating a semantic graph according to the analysis file, wherein the semantic graph comprises a connection type, data table information and associated field information; analyzing the analysis file according to the semantic graph, connecting each data table according to the connection type, and mapping the user input information into a target language of each data table according to the grammar of the information of each data table; connecting the data tables according to the connection type, and executing the target language of each data table for each data table; and outputting execution result information. According to the method, the use flexibility of multiple databases is improved, and the code maintenance cost of multiple queries is reduced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to a method for processing multiple data sources, and specifically to a method for processing multiple data sources, a system for processing multiple data sources, and a computer-readable storage medium. Background Art

[0002] In database application development, the Structured Query Language (SQL) and SQL-like languages, as core operation tools, have problems such as high technical thresholds and long learning cycles. If ordinary users use a database, they need to master complex syntax rules and database principles, resulting in a significant increase in the initial learning cost. In addition, although mainstream database systems (such as MySQL, Oracle, etc.) are based on the SQL standard, there are differences in the specific syntax implementation. For example, key operations such as paging queries and function calls often use different syntax structures. When there are multiple databases stored in an application, when users use it, they need to write multiple sets of adaptation codes for different databases and dynamically switch syntax rules through conditional judgments, which is not convenient to use and has low usage efficiency.

[0003] There is a multi-data-source adaptation method applicable to a low-code platform that parses standard input data corresponding to input parameters through a basic syntax generator to generate basic statements; if the standard input data contains a filtering condition part, uses a conditional expression parser to parse the filtering condition part, extracts filtering statements, and combines them with the basic statements to form an intermediate language; initializes a database language translator and a result set converter, maps the intermediate language into a target language, and executes the target language; when the execution of the target language is completed, obtains the original result set of the target database, creates an intermediate data structure according to the column names, column data types, and data type mapping configurations of the original result set, and transforms it into output parameters through an output data formatter. However, this method requires parsing standard input data, and ordinary users still have a learning cost. Secondly, this method can only perform conversions on one database, and this method cannot meet the user's need to associate and use multiple databases with different syntaxes. Summary of the Invention

[0004] The first object of the present invention is to provide a method for processing multiple data sources that associates multiple data tables with different syntaxes.

[0005] The second object of the present invention is to provide a system for processing multiple data sources that implements the method for processing multiple data sources for the association of the above data tables.

[0006] The third object of the present invention is to provide a computer-readable storage medium that implements the method for processing multiple data sources for the association of the above data tables.

[0007] To achieve the first object of the present invention, the present invention provides a method for processing multiple data sources, which includes obtaining user input information; extracting variable information and target data table information of the user input information, and forming a parsing file with the variable information, the target data table information, and the user input information; generating a semantic graph according to the parsing file, the semantic graph including connection types, target data table information, and associated field information; parsing the parsing file according to the semantic graph, connecting each target data table according to the connection type, and mapping the user input information into the target language of each target data table according to the syntax of each target data table information; connecting the target data tables according to the connection type, and executing the target language of each target data table for each target data table; and outputting execution result information.

[0008] As can be seen from the above solution, parsing the user input information using a natural language model to form a parsing file reduces the usage threshold. Users can complete the use of the database by inputting natural language information. Connecting the target data tables according to the parsing file and the semantic graph, the semantic graph can better handle the situation of associating target data tables with different grammars. When users need to associate or nested query target data tables with different grammars, they do not need to write different database languages according to the target data tables with different grammars. They only need to input the user input information to achieve complex situations such as multi-table association or nested query, improving the flexibility of using multiple databases, completing the operations of multiple steps with a single user input information, and reducing the code maintenance cost of multiple queries.

[0009] In a further solution, the memory stores a connection pool; before connecting the target data tables according to the connection type, it also performs: determining whether there is connection information of the target data table stored in the memory, and if so, obtaining the connection information from the connection pool and executing the connection information.

[0010] Thus, by setting a connection pool in the memory, each database connection has relevant connection information, such as the address, port, username, password, and other configuration parameters of the database. The connection pool will cache all these connection information and use it for the next connection, thereby improving the connection efficiency.

[0011] In a further solution, the step of forming a parsing file with the variable information, the target data table information, and the user input information includes: using a natural language model to perform re-splicing processing on the user input information.

[0012] Thus, processing the user input information through a natural language model reduces the usage threshold of users.

[0013] In a further solution, the memory stores multiple mapping rules, and one mapping rule corresponds to one data table; after outputting the execution result information, the following is also executed: obtaining the latest data table, and adding the mapping rule corresponding to the latest data table to the memory.

[0014] Thus, it can be seen that if a new database is added, only a new mapping rule needs to be added, without changing the main algorithm, making the system service stable.

[0015] In a further solution, the memory stores multiple data tables, and one data table corresponds to one data table syntax.

[0016] Thus, it can be seen that since different data tables have different syntaxes, this method is compatible with different databases, enabling better connection of databases with different syntaxes.

[0017] In a further solution, before generating the semantic graph according to the parsed file, the following is also executed: using a natural language model to process the user input information in the parsed file.

[0018] Thus, it can be seen that by using a natural language model to analyze and process the user input information, the user can supplement information according to the analysis result, making the user input information more accurate.

[0019] To achieve the second object of the present invention, the multi-data source processing system provided by the present invention includes a view editor, a memory, a converter, and a logic processor. The memory stores multiple data tables, and one data table corresponds to one data table syntax; the view editor is used to obtain user input information; the logic processor is used to extract the variable information and target data table information of the user input information, and the variable information, target data table information, and user input information form a parsed file; the converter is used to generate a semantic graph according to the parsed file, and the semantic graph includes a connection type, target data table information, and associated field information; the converter is used to parse the parsed file according to the semantic graph, connect each target data table according to the connection type, and map the user input information to the target language of each target data table according to the syntax of each target data table information; the logic processor is also used to connect the target data tables according to the connection type, execute the target language of each target data table for each target data table, and output the execution result information to the view editor.

[0020] In a further solution, the multi-data source processing system further includes an analyzer; the analyzer is used to use a natural language model to process the user input information in the parsed file.

[0021] To achieve the third object of the present invention, the computer-readable storage medium provided by the present invention stores a computer program thereon, and is characterized in that when the computer program is executed, it implements the above-mentioned multi-data source processing method. Description of the Drawings

[0022] Figure 1 It is a system structure block diagram of an embodiment of the multi-data source processing system of the present invention.

[0023] Figure 2 It is a flowchart of an embodiment of the multi-data source processing method of the present invention.

[0024] The present invention will be further described below in conjunction with the accompanying drawings and embodiments. Specific embodiments

[0025] The multi-data source processing method provided by the present invention parses the user input information, interconnects it with multiple data tables, and performs operations such as multi-table association or nested query. Only by inputting the user input information can complex situations such as multi-table association or nested query be realized, improving the flexibility of using multiple databases and reducing the code maintenance cost of multiple queries.

[0026] Embodiment of the multi-data source processing system: Refer to Figure 1 , the multi-data source processing system of the present invention includes a logic processor 12, a view editor 11, a converter 13, an analyzer 14, and a memory 15. Among them, the memory 15 stores multiple data tables with different grammars, such as Mysql data tables, DB2 data tables, Oracle data tables, SqlServer data tables, etc. Each data table corresponds to a data table grammar. The user can input the user input information through the view editor 11. After the logic processor 12 parses the user input information to form a parsed file, the converter 13 generates a semantic graph, generates the target language of each target data table according to the semantic graph, the logic processor 11 parses the parsed file according to the semantic graph, connects each data table in the memory 15, executes the target language of the database, and outputs the execution result information to the view editor 11.

[0027] Embodiment of the multi-data source processing method: Refer to Figure 2 , the multi-data source processing method of this embodiment is executed by the multi-data source processing system. When the user needs to use the database, fill in the information of the required database in natural language on the view editor. The view editor first executes step S11 to obtain the user input information. After the view editor obtains the user input information, it sends the user input information to the logic processor.

[0028] After receiving the user input information, the logic processor executes step S12 to extract the variable information and target data table information of the user input information, and forms a parsing file with the variable information, target data table information, and user input information. Among them, the variable information includes variable name, data type, and variable identifier. Among them, the natural language model is used to re - splice the user input information to generate the parsing file.

[0029] For example, if the user input information is "Query all users with the role name of administrator in the user table, and the associated field is the role number", and the user table contains user name and role number, but does not contain role name, so the logic processor 12 can lock the target data table information as the user table and role table according to the role name and user table, and determine the variable information according to the user table and role table. Among them, according to the user input information, the variable names are determined as user name, role number, and role name.

[0030] After the logic processor forms the parsing file, the analyzer uses the natural language model to process the user input information in the parsing file. Among them, the user input information is supplemented. For example, if the user does not mention the role table, the role table is supplemented in the user input information, and the content of the parsing file is sent to the view editor for the user to confirm before executing the next step.

[0031] After the logic processor forms the parsing file, the converter executes step S13 to generate a semantic graph according to the parsing file. The semantic graph includes connection type, target data table information, and associated field information. Since multiple target data tables are involved, the semantic graph needs to express the connection type of the target data tables, target data table information, and associated field information. Among them, the associated field information is the associated field of the target data tables to be connected. For example, the user table and the role table have an associated field, and this associated field is the role number, so the connection type between the user table and the role table is an inner join. The target data table information is the user table and the role table, and the associated field information is the role number. The semantic graph also includes descriptive action information. For example, if the user input information includes a query intention, the descriptive action information in the semantic graph is query. Since the user input information clearly indicates that it is necessary to query users with the role name of administrator, it is confirmed to use conditional query.

[0032] After the converter generates the semantic graph, it executes step S14 to parse the parsing file according to the semantic graph, and maps the user input information to the target languages of each target data table according to the grammar of each target data table information. For example, parsing the parsing file according to the semantic graph, that is, obtaining the descriptive action information according to the semantic graph, determining to use key query, and then mapping the user input information to the target languages of each target data table according to the grammar of each target data table information. For example, mapping according to the grammar of the user table to the language of the user table, and mapping according to the role table to the language of the role table.

[0033] After the converter generates the target language, step S15 is executed to connect the target data tables according to the connection type, establish connections for the target data tables, and execute the target language of each target data table for each target data table. Connect the target data tables according to the connection type in the semantic graph, that is, connect the user table and the role table according to the inner join operation, where the connection condition is that the role number in the user table is equal to the role number in the role table. Through this association condition, the records with the same role number in the two tables are combined.

[0034] Before connecting the target data tables according to the connection type, the following is also executed: Determine whether the connection information of the target data tables is stored in the memory. If so, obtain the connection information from the connection pool and execute the connection information. Each database connection has related connection information, such as the address, port, username, password, and other configuration parameters of the database. The connection pool will cache all this connection information and use it for the next connection.

[0035] Execute the target language of each target data table for each target data table, that is, after querying the role number with the role name of administrator in the role table using the language of the role table, execute the query in the user table to obtain the user name corresponding to the obtained role number.

[0036] After the logic editor executes the target language of each target data table for each target data table, step S16 is executed to output the execution result information to the view editor, and the view editor displays the execution result information, and the user can obtain the execution result information.

[0037] After outputting the execution result information, when there is a new data table that needs to be compatible, obtain the latest data table and add the mapping rule corresponding to the latest data table to the memory.

[0038] When the user needs to perform association or nested queries on data tables with different grammars, there is no need to write different database languages according to the data tables with different grammars. Just input the user input information to achieve complex situations such as multi-table association or nested queries, improve the flexibility of using multiple databases, complete the operations of multiple steps with a single user input information, and reduce the code maintenance cost of multiple queries.

[0039] Embodiment of computer-readable storage medium: In the method for processing multiple data sources in the multiple-data-source processing system described in the foregoing embodiments, the method can be stored in a computer-readable storage medium in the form of a computer program. When the computer program is executed by a processor, the steps of the embodiments of the method for processing multiple data sources in the multiple-data-source processing system described above can be completed. The computer-readable medium can be a computer-readable signal medium or a computer-readable storage medium. The 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 of the above. More specific examples (non-exhaustive list) of the computer-readable storage medium include: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above.

[0040] The foregoing is only a preferred embodiment of the present invention, but the design concept of the invention is not limited thereto. Without departing from the inventive concept, more other equivalent embodiments can be included, and various obvious changes, re-adjustments, and substitutions can be made by those skilled in the art without departing from the protection scope of the present invention.

Claims

1. Processing method for multiple data sources, the method comprising, characterized in that: Obtain user input information; Extract variable information and target data table information of the user input information, and form a parsing file with the variable information, the target data table information and the user input information; Generate a semantic graph according to the parsing file, the semantic graph including connection types, the data table information and associated field information; Parse the parsing file according to the semantic graph, and map the user input information to the target languages of the respective data tables according to the syntax of the respective target data table information; Connect the target data tables according to the connection types, and execute the target languages of the respective data tables for each target data table; Output execution result information.

2. The processing method for multiple data sources according to claim 1, characterized in that: The memory stores a connection pool; Before connecting the target data tables according to the connection types, further execute: Judge whether connection information of the target data table is stored in the memory, if so, obtain the connection information from the connection pool and execute the connection information.

3. The processing method for multiple data sources according to claim 1, characterized in that: The step of forming a parsing file with the variable information, the target data table information and the user input information includes: Use a natural language model to perform re-splicing processing on the user input information.

4. The processing method for multiple data sources according to claim 2, characterized in that: The memory stores multiple mapping rules, and one mapping rule corresponds to one data table; After outputting the execution result information, further execute: Obtain the latest data table, and add the mapping rule corresponding to the latest data table to the memory.

5. The processing method for multiple data sources according to claim 4, characterized in that: The memory stores multiple data tables, and one data table corresponds to one data table syntax.

6. The processing method for multiple data sources according to any one of claims 1 to 5, characterized in that: Before generating a semantic graph according to the parsing file, further execute: Use a natural language model to process the user input information of the parsing file.

7. A processing system for multiple data sources, including a view editor, a memory, a converter, and a logic processor, characterized in that: The memory stores multiple data tables, and one data table corresponds to one data table syntax; The view editor is used to obtain user input information; The logic processor is used to extract variable information and target data table information of the user input information, and the variable information, the target data table information and the user input information form a parsing file; The converter is used to generate a semantic graph according to the parsing file, the semantic graph including connection types, the target data table information and associated field information; The converter is used to parse the parsing file according to the semantic graph, connect the respective target data tables according to the connection types, and map the user input information to the target languages of the respective target data tables according to the syntax of the respective target data table information; The logic processor is further configured to connect the target data tables according to the connection type, execute the target language of each target data table for each target data table, and output execution result information to the view editor.

8. The multi-data source processing system according to claim 7, wherein: The multi-data source processing system further includes an analyzer; The analyzer is configured to process the user input information of the parsed file using a natural language model.

9. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed, it implements the multi-data source processing method according to any one of claims 1 to 6.