A query method, query device and storage medium based on query model

By customizing the query elements and data sources and building a query model, we can solve the problems of high construction difficulty and cost, achieve efficient and flexible query model adaptation, support the integration of multiple data sources and big data engines, and improve query performance and efficiency.

CN114722072BActive Publication Date: 2025-09-23YGSOFT INC
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202210295579.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-03-23
Publication Date
2025-09-23
Estimated Expiration
2042-03-23

AI Technical Summary

Technical Problem

Building a query model is difficult and costly, and existing query models cannot be separated from the underlying data tables and cannot meet the needs of complex query scenarios.

Method used

A query method based on a query model is provided. By customizing the query elements, a query model is constructed, and query code is adaptively constructed according to the configuration information and data source to achieve dynamic generation of query results.

Benefits of technology

It enables customized construction of query models without coding, reduces costs, improves development efficiency, supports the adaptation of multiple data sources, meets the query requirements of different application scenarios, supports the integration of big data engines, and improves query performance.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114722072B_ABST
    Figure CN114722072B_ABST
Patent Text Reader

Abstract

This application discloses a query method, query device, and storage medium based on a query model. The method includes: customizing query elements to obtain a query model; obtaining configuration information of the query model and a query data source; constructing query code supported by the query data source based on the configuration information and the query data source; and executing the query code after receiving a query operation to obtain query result data. Through the above-mentioned methods, the application can adaptively configure the query model to adapt to the application requirements of different query data sources.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer technology, and in particular to a query method, query device and storage medium based on a query model. Background Art

[0002] Currently, building a query model is difficult and costly. In addition, the query model cannot be separated from the underlying data table to build a query script. A unified query model cannot be used to meet the query requirements in complex and different query scenarios. Summary of the Invention

[0003] The present application provides a query method, query device and storage medium based on a query model, which can adaptively configure the query model to adapt to the application requirements of different query data sources.

[0004] To solve the above technical problems, the technical solution adopted in this application is: to provide a query method based on a query model, the method including: customizing the query elements to obtain a query model; obtaining the configuration information of the query model and the query data source; based on the configuration information and the query data source, constructing a query code supported by the query data source; running the query code after receiving the query operation to obtain the query result data.

[0005] In order to solve the above technical problems, another technical solution adopted in this application is: to provide a query device, the query device includes a memory and a processor connected to each other, wherein the memory is used to store a computer program, and when the computer program is executed by the processor, it is used to implement the query model-based query method in the above technical solution.

[0006] To solve the above technical problems, another technical solution adopted in this application is: providing a computer-readable storage medium for storing a computer program, which, when executed by a processor, is used to implement the query model-based query method in the above technical solution.

[0007] Through the above scheme, the beneficial effects of this application are: custom configuration of query elements, construction of a query model, and then adaptive construction of query code supported by the query data source based on the configuration information of the query model and the query data source, so that the query code is run after receiving the query operation to obtain the query result data; the scheme provided by this application can realize the custom construction of the query model, and there is no need to encode the query model during the modeling process, which can save costs and greatly improve the efficiency of developing software and systems. At the same time, it can use the configuration information of the query model to adaptively encode different query data sources, support the adaptation of various different data sources, meet different application scenarios and needs, not only support query statistics of ordinary business systems, but also support integration with big data engines, and build high-performance queries for big data. BRIEF DESCRIPTION OF THE DRAWINGS

[0008] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the following briefly introduces the drawings required for describing the embodiments. Obviously, the drawings described below are only some embodiments of the present application. For those skilled in the art, other drawings can be obtained based on these drawings without inventive efforts. Among them:

[0009] Figure 1 This is a flowchart of an embodiment of a query method based on a query model provided by the present application;

[0010] Figure 2 This is a schematic diagram of an embodiment of a configuration module provided by this application;

[0011] Figure 3 is a schematic diagram of an embodiment of a query model provided by this application;

[0012] Figure 4 This is a flowchart of an embodiment of a method for customizing query elements provided by this application;

[0013] Figure 5 This is a schematic diagram of configuring query sources, query conditions, and query results provided by this application;

[0014] Figure 6 is a schematic diagram of the model list configuration interface provided by this application;

[0015] Figure 7 It is a schematic diagram of the configuration interface of the newly added design diagram provided in this application;

[0016] Figure 8 is a schematic diagram of the model view configuration interface provided by this application;

[0017] Figure 9 This is a schematic diagram of the query condition configuration interface provided by this application;

[0018] Figure 10 is a schematic diagram of the association configuration interface provided by this application;

[0019] Figure 11 This is a schematic diagram of the query result configuration interface provided by this application;

[0020] Figure 12 is a schematic diagram of the visual interface of the query model provided by this application;

[0021] Figure 13 This is a flowchart of another embodiment of the query method based on the query model provided by the present application;

[0022] Figure 14 It is a schematic diagram of the configuration nodes of the query model provided by this application;

[0023] Figure 15 This is a schematic structural diagram of an embodiment of a query device provided by the present application;

[0024] Figure 16 It is a structural diagram of an embodiment of a computer-readable storage medium provided by this application. DETAILED DESCRIPTION

[0025] The present application will be further described in detail below in conjunction with the accompanying drawings and examples. It is particularly noted that the following examples are only intended to illustrate the present application and are not intended to limit the scope of the present application. Similarly, the following examples are only some examples of the present application and not all examples. All other examples obtained by those of ordinary skill in the art without creative work are intended to fall within the scope of protection of this application.

[0026] References to "embodiments" in this application mean that a particular feature, structure, or characteristic described in connection with the embodiment may be included in at least one embodiment of the application. The appearance of this phrase in various places in the specification does not necessarily refer to the same embodiment, nor does it constitute an independent or alternative embodiment that is mutually exclusive of other embodiments. It is understood, both explicitly and implicitly, by those skilled in the art that the embodiments described herein may be combined with other embodiments.

[0027] It should be noted that the terms "first", "second" and "third" in this application are only used for descriptive purposes and should not be understood as indicating or suggesting relative importance or implicitly indicating the number of the indicated technical features. Thus, the features defined as "first", "second" and "third" may explicitly or implicitly include at least one of the features. In the description of this application, the meaning of "plurality" is at least two, such as two, three, etc., unless otherwise clearly and specifically defined. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions. For example, a process, method, system, product or device that includes a series of steps or units is not limited to the listed steps or units, but optionally also includes steps or units that are not listed, or optionally also includes other steps or units that are inherent to these processes, methods, products or devices.

[0028] See also Figure 1 , Figure 1 : is a flow chart of an embodiment of a query method based on a query model provided by the present application, the method comprising:

[0029] Step 11: Customize the query elements to obtain the query model.

[0030] Query elements are the conditions required for the query model to implement the query function, mainly including query source, query conditions or query results. By customizing the query elements, a query model can be obtained, and the query function can be implemented using the query model.

[0031] In a specific embodiment, Figure 2 As shown, the query model may include a query source module, a query result module, an association model module, a merge model module, a query condition module, a query item module, a merge relationship module or an association relationship module, etc. The query model can be obtained by customizing the above modules. Specifically, the query source module can be used to describe the source of the query data, the query result module is used to display the query result data, the association relationship module can be used to describe the association between entities in the query, the merge relationship module can be used to describe the merger of entities in the query, the query condition module can be used to describe the field conditions for filtering the query data, the query item module can be used to describe the entity's items or the virtual items calculated from the entity's items, the association model module can be used to describe the association field between two entities, and the merge model module can be used to describe the merge field between two entities. Furthermore, the query model can be a visual query interface, such as Figure 3 As shown, the user can clearly and adaptively configure and develop different query solutions based on the visual query interface to apply the query model to different query scenarios.

[0032] Step 12: Get the query model configuration information and query data source.

[0033] The configuration information can be configuration data for configuring the query elements. The query data source is the source of the query data to be queried under the current query operation. The query data source can be customized by the user according to the current application requirements, such as: a large database; it can be understood that the query data source can also be other data sources outside the large database, which is not limited here.

[0034] Step 13: Based on the configuration information and the query data source, construct the query code supported by the query data source.

[0035] Since different data sources support different statement formats for running codes, general query solutions cannot directly target multiple different data sources. However, this instance can adaptively construct query code suitable for the current query data source by obtaining the configuration information of the query model. No coding is required when constructing the query model, and no changes are required to the query model when adapting to the query data source. This can greatly save costs, achieve efficient development of software and systems, and enable the software to have high quality and high adaptability. For example, when the query data source is a large database, the query code constructed according to the configuration information of the query model is the query code supported by the large database.

[0036] Understandably, the query model also has great flexibility. When applying the constructed query model in actual business scenarios, users can also personalize the configuration information according to their own needs. They can design query solutions that highly meet the perspectives of their respective roles based on the existing query model, thereby improving users' work comfort and efficiency.

[0037] Step 14: After receiving the query operation, run the query code to obtain the query result data.

[0038] After receiving the query operation input by the user, the constructed query code can be run to obtain the corresponding query result data.

[0039] The solution adopted in this embodiment can customize the query elements, build a query model, and then adaptively build a query code supported by the query data source based on the configuration information of the query model and the query data source, so that the query code is run after receiving the query operation to obtain the query result data; it can realize the customized construction of the query model, and there is no need to encode the query model during the modeling process, which can save costs and greatly improve the efficiency of developing software and systems. At the same time, it can use the configuration information of the query model to adaptively encode different query data sources, support the adaptation of various different data sources, meet different application scenarios and needs, not only support query statistics of ordinary business systems, but also support integration with big data engines, and build high-performance queries for big data.

[0040] See also Figure 4 , Figure 4 This is a flow chart of an embodiment of a method for customizing query elements provided by the present application. By customizing the query elements, a query model can be obtained, wherein the query elements mainly include query sources, query conditions, and query results, such as Figure 5 As shown, Figure 5 A schematic diagram of an embodiment of configuring a query source, query conditions, and query results, the method comprising:

[0041] Step 41: Configure the query source to obtain query data.

[0042] The query source can be the source of query data, which may include a database or historical query result data. That is, the query source can be a domain model or scenario model that also has a data model, which can support the query model to query the database. By configuring the query source, you can get the source of query data for the application scenario. For example: the query data can be a view in the database, an original table, a combination of multiple original tables, or historical query result data, etc. In actual application, users can set a specific query data source according to the configured query source to complete specific query operations.

[0043] Step 42: Based on the query data, configure the query conditions.

[0044] Query conditions are configured based on query data. The query conditions may include fixed conditions and adjustable conditions. The query data may be filtered based on the fixed conditions to obtain valid query data, and then query result data may be generated based on the valid query data. For example, to build a query model for "completed orders", the fixed condition may be set to "order completed" to filter the query data and eliminate data that is not the query target, i.e., data on "uncompleted orders", and only retain data information on completed orders, i.e., valid query data. It is understandable that the fixed conditions cannot be customized during the query operation. When the query model is used for query operations, the fixed conditions will perform filtering operations to obtain valid query data that is useful for subsequent query operations. Furthermore, the query data may be pre-processed by setting fixed conditions to filter out unnecessary data that is not related to the query, thereby reducing the workload of the query operation.

[0045] In one embodiment, the adjustable conditions are conditions that can be customized by the user when performing a query operation. The adjustable conditions after the user's customized adjustment can be used as screening conditions for this query operation, thereby generating query result data based on the valid query data; specifically, the adjustable conditions can be configured, and when performing a query operation, the customized parameters of the adjustable conditions can be obtained; the valid query data is queried based on the customized parameters to obtain query result data that meets the adjustable conditions.

[0046] For example: During the configuration phase, you can select "Date" as an adjustable condition. Then, when the user performs a query operation, they can customize the input date value range. Thus, when the query operation is performed, the data with "Date" in the set date value range in the valid query data will be filtered out, thereby obtaining the query result data.

[0047] Step 43: Correlate at least two query data to obtain at least two sets of correlated data.

[0048] During the configuration process, at least two query data can be associated to obtain at least two groups of associated data. By establishing associations between the query data, comprehensive intelligent queries can be supported. Specifically, at least two query data can be associated according to a preset association method. The preset association method may include inner association, left association, right association, outer association or merging. The establishment of the above association methods is a conventional association operation and will not be described in detail here. Furthermore, when establishing an association, a pairwise association method can be selected. When there are three query data to be associated, the two query data can be associated first to obtain a group of associated data, and then the associated data can be associated with the remaining query data to obtain the final associated data. The use of a pairwise association method can facilitate model analysis and data superposition.

[0049] It can be understood that associations can be established between different query data in the same query source, and associations can also be established for different query sources. For example, a merge relationship can be established between two query sources. Query source 1 contains query data 1 to 2, and query source 2 contains query data 3 to 4. Then, by merging these two query sources, associated data containing data 1 to 4 can be obtained.

[0050] Step 44: Configure the intermediate query results corresponding to each set of associated data.

[0051] The query result is a display list containing the query result data. The column information of the display list can be configured based on the preset list template to obtain the intermediate query result. The column information in the display table is used to present the desired field results. The column information includes the number of columns and the column content. For example: in the process of building a query model for financial statements, the column content in the query result can be configured as related fields such as "applicant" or "reimbursement amount", so that when executing the query operation, the corresponding field data in the query data that meets the query conditions can be presented in the display list.

[0052] Furthermore, you can configure the format of the column, that is, use expressions or functions to set the presentation effect of the field data. You can also add calculated columns to the query results according to application requirements, so as to use the calculated columns to perform numerical operations on the query result data and present the operation results in the display list.

[0053] Step 45: Merge all intermediate query results to obtain the query result to complete the configuration of the query element.

[0054] All intermediate query results are merged to obtain the final query result, thereby completing the configuration of the query elements. By setting an intermediate query result for each group of related data and then merging them, it is beneficial to recursive nesting and combined analysis of data. It can be understood that in one embodiment, different query conditions can also be customized for each group of related data.

[0055] In a specific embodiment, Figures 6-12 As shown, the query source, query conditions and query results can be customized using the visual configuration interface to obtain the query model. Specifically, Figure 6 Select the new query model in the model list configuration interface shown, and then Figure 7 Configure the basic information of the query model in the configuration interface of the new design diagram shown in the following example. Figure 8 Configure the query source in the model view configuration interface shown in Figure 9 Configure the query field information (i.e. query conditions) in the configuration interface shown. Figure 10 The association configuration interface shown in the figure establishes the association between the query data, and finally Figure 11 Configure the query results in the configuration interface shown in the figure, thereby completing the configuration of the query source, query conditions and query results, and obtaining the following Figure 12 The query model shown.

[0056] This embodiment can achieve dynamic configuration of the query model through customized configuration of the query source, query conditions and query results. There is no need for coding when building the model, which can save costs and greatly improve R&D efficiency. Moreover, it also provides a visual configuration interface, and the model building process is simple and clear. People in different roles can understand and build query solutions well. In addition, since the query model is built in an application scenario-oriented manner, customers can make adaptive adjustments and assemble new query solutions according to their own business scenarios, which can meet the query interface and query result requirements of different scenarios, and improve the ability to cope with complex query software development and demand changes.

[0057] See also Figure 13 , Figure 13 : is a flow chart of another embodiment of a query method based on a query model provided by the present application, the method comprising:

[0058] Step 131: Obtain configuration information of the query model and query data source.

[0059] After obtaining the query model, the configuration information of the query model and the query data source can be obtained. Then, based on the configuration information and the query data source, the query code supported by the query data source can be constructed. Specifically, the steps of constructing the query code supported by the query data source can be shown in the following steps 132 to 134:

[0060] Step 132: Obtain final node information of the query model based on the configuration node information.

[0061] Configuration information may include configuration node information, such as Figure 14 As shown, Figure 14 This is a visualization of the configuration nodes of the query model. Each icon in the figure represents a configuration node of the query model. The configuration information corresponding to each configuration node is the configuration node information. The final node information is the icon "query result" marked by the arrow of the final query result, which is the query result obtained by merging the intermediate query results.

[0062] Step 133: Construct a logic tree based on the final node information and configuration information.

[0063] A logic tree is constructed based on the final node information and the configuration information. The node corresponding to the final node information is used as the root node. Based on the configuration information, the logic tree is constructed using the pre-order traversal method. Specifically, each configuration node corresponds to at most two child nodes. A binary tree can be constructed based on the configuration node information. The root node is first visited, then the left node, and then the right node is visited, thereby realizing the recursive traversal process and finally constructing the logic tree.

[0064] Step 134: Based on the logic tree and the query data source, construct a query code supported by the query data source.

[0065] Step 135: After receiving the query operation, the query code is run to obtain the query result data.

[0066] The logic tree can be encoded according to the query data source to obtain the statement format supported by the query data source, and then the logic tree can be encoded according to the statement format to obtain the query code supported by the query data source. Then, after receiving the query operation input by the user, the query code is run to obtain the query result data.

[0067] This embodiment uses the acquired query modeling to construct a logical tree, and then uses the logical tree to obtain the query code supported by the current query data source to execute the query operation. There is no need to adjust the query modeling, and it can achieve adaptation to multiple query data sources. It not only supports query statistics of ordinary business systems, but also supports query statistics of large databases. It can develop different scenario models for different scenario applications. The code built by the program software based on the domain layer does not need to be changed, which can save costs, efficiently develop software and systems, and enable the software to have high quality, high performance and high adaptability.

[0068] See also Figure 15 , Figure 15It is a structural diagram of an embodiment of the query device provided in the present application. The query device 150 includes a memory 151 and a processor 152 connected to each other. The memory 151 is used to store computer programs. When the computer program is executed by the processor 152, it is used to implement the query method based on the query model in the above embodiment.

[0069] See also Figure 16 , Figure 16 It is a structural diagram of an embodiment of a computer-readable storage medium provided in the present application. The computer-readable storage medium 160 is used to store a computer program 161. When the computer program 161 is executed by the processor, it is used to implement the query method based on the query model in the above embodiment.

[0070] The computer-readable storage medium 160 can be a server, a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk, etc., which can store program codes.

[0071] In the several embodiments provided in this application, it should be understood that the disclosed methods and devices can be implemented in other ways. For example, the device embodiments described above are merely illustrative. For example, the division of modules or units is merely a logical functional division. In actual implementation, other division methods may be used, such as combining or integrating multiple units or components into another system, or omitting or not implementing certain features.

[0072] Units described as separate components may or may not be physically separate, and components shown as units may or may not be physical units, that is, they may be located in one place or distributed across multiple network units. Some or all of these units may be selected to achieve the purpose of this embodiment according to actual needs.

[0073] In addition, each functional unit in each embodiment of the present application may be integrated into a processing unit, each unit may exist physically separately, or two or more units may be integrated into a single unit. The above-mentioned integrated units may be implemented in the form of hardware or software functional units.

[0074] The above description is merely an embodiment of the present application and does not limit the patent scope of the present application. Any equivalent structure or equivalent process transformation made using the contents of the present application specification and drawings, or directly or indirectly applied in other related technical fields, are also included in the patent protection scope of the present application.

Claims

1. A query method based on a query model, characterized in that: include: Customizing query elements to obtain a query model, wherein the query elements include a query source, a query condition, and a query result; The step of customizing the query elements includes: configuring the query source to obtain query data, wherein the query source is the source of the query data and includes historical query result data; configuring the query conditions, wherein the query conditions include fixed conditions and adjustable conditions, the fixed conditions are used to filter the query data to obtain valid query data, and the adjustable conditions are conditions that the user customizes when performing a query operation, and the adjustable conditions are used to filter the valid query data; correlating at least two of the query data to obtain at least two groups of correlated data; configuring an intermediate query result corresponding to each group of the correlated data; merging all the intermediate query results to obtain the query result, so as to complete the configuration of the query elements; Obtaining configuration information of the query model and query data source, wherein the configuration information includes configuration node information; Acquiring final node information of the query model based on the configuration node information; Constructing a logic tree based on the final node information and the configuration information; Encoding the logic tree according to the statement format supported by the query data source to construct the query code supported by the query data source, where different query data sources support different statement formats for running codes; After receiving the query operation, the query code is executed to obtain the query result data.

2. The query method based on the query model according to claim 1, characterized in that: The query condition includes the fixed condition, and the method further includes: Filtering the query data based on the fixed condition to obtain valid query data; The query result data is generated based on the valid query data.

3. The query method based on the query model according to claim 2, characterized in that: The query condition also includes the adjustable condition. The step of generating the query result data based on the valid query data includes: When executing the query operation, obtaining the custom parameters of the adjustable condition; The valid query data is queried based on the custom parameters to obtain the query result data that meets the adjustable conditions.

4. The query method based on the query model according to claim 1, characterized in that: The query result is a display list containing the query result data, and the step of configuring the intermediate query result corresponding to each group of the associated data includes: The column information of the display list is configured based on a preset list template to obtain the intermediate query result, where the column information includes the number of columns and the content of the columns.

5. The query method based on the query model according to claim 1, characterized in that: The step of associating at least two query data to obtain at least two sets of associated data includes: At least two query data are associated based on a preset association method, where the preset association method includes inner association, left association, right association, outer association or merging.

6. The query method based on the query model according to claim 1, characterized in that: The step of constructing a logic tree based on the final node information and the configuration information includes: The node corresponding to the final node information is used as the root node, and based on the configuration information, the logic tree is constructed using a pre-order traversal method.

7. A query device, characterized in that: The system comprises a memory and a processor connected to each other, wherein the memory is used to store a computer program, and when the computer program is executed by the processor, it is used to implement the query method based on the query model according to any one of claims 1 to 6.

8. A computer-readable storage medium for storing a computer program, characterized in that: When the computer program is executed by a processor, it is used to implement the query method based on the query model according to any one of claims 1 to 6.

Citation Information

Patent Citations

  • Database query statement generation method and device, computer equipment and storage medium

    CN111813799A

  • Data query method and device, electronic equipment and computer readable medium

    CN112966004A