Data query method, system, electronic device and storage medium

By dividing the data query process into data layer, logic layer and application layer, and interacting with it using mapping methods, communication rules are generated to simplify SQL statement query, the problem of low efficiency of large-scale data query is solved and efficient data query performance optimization is achieved .

CN114265865BActive Publication Date: 2024-12-20BEIJING TOPSEC NETWORK SECURITY TECH +2
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202111599471.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-12-24
Publication Date
2024-12-20
Estimated Expiration
2041-12-24

AI Technical Summary

Technical Problem

When users query large-scale data, the CPU computing and device IO usage in the prior art increases, resulting in low query efficiency and ineffective optimization.

Method used

By dividing the data query process into a data layer, a logic layer and an application layer, interacting using mapping methods, generating communication rules to simplify SQL statement query, and directly conducting data queries through the application program interface to avoid tedious SQL statements and resource occupation.

Benefits of technology

It improves data query efficiency, reduces the coupling between the application layer and the data layer, simplifies user logic, optimizes query performance, and avoids the use of computer IO and bandwidth resources.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114265865B_ABST
    Figure CN114265865B_ABST
Patent Text Reader

Abstract

The present application provides a data query method, system, electronic device and storage medium, which relates to the field of data processing technology. The method includes: receiving a user instruction, generating a communication rule according to the description information representing the query content and the query condition carried in the user instruction; generating a first mapping method between the logic layer and the data layer and a second mapping method between the logic layer and the application layer according to the communication rule; controlling the logic layer to cache the data of the data layer to a preset application program interface through the first mapping method; based on the user instruction, controlling the application layer to obtain the target data corresponding to the user instruction from the preset application program interface through the second mapping method. The data query method provided in the embodiment of the present application can optimize the query performance, avoid occupying computer IO and bandwidth resources, and thus improve the efficiency of data query.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of data processing technology, and in particular to a data query method, system, electronic device and storage medium. Background Art

[0002] Usually, the data displayed on the monitoring page provided by the business system is obtained by directly accessing relational databases such as Mysql through computer languages ​​such as C / C++, PHP / Python / JAVA by embedding SQL statements. However, in this technical solution, when the total amount of samples queried by users is particularly large, the CPU calculation and device IO occupancy will increase during the query process, which will reduce device performance and result in low query efficiency. Summary of the invention

[0003] The purpose of the embodiments of the present application is to provide a data query method, system, electronic device and storage medium to improve data query efficiency.

[0004] In a first aspect, an embodiment of the present application provides a data query method, which may include:

[0005] Receive a user instruction, and generate a communication rule according to the description information representing the query content and the query condition carried in the user instruction, wherein the communication rule is to use the query content and the set of the minimum subset of the query condition as a naming specification of the data key;

[0006] Generate a first mapping mode between the logic layer and the data layer and a second mapping mode between the logic layer and the application layer according to the communication rule;

[0007] Controlling the logic layer to cache the data of the data layer to a preset application program interface through the first mapping method, wherein the first mapping method is to convert the data of the data layer into target data in a preset format according to a communication rule;

[0008] Based on the user instruction, the application layer is controlled to obtain target data corresponding to the user instruction from the preset application program interface through the second mapping method, and the second mapping method is to generate a query instruction according to the communication rule.

[0009] In the above implementation process, by setting the data layer, logic layer and application layer to communicate and interact in turn based on the corresponding mapping methods, the consistency of the mapping methods is ensured by communication rules during the interaction process, so as to avoid using cumbersome SQL statements to query the database, formulate communication rules between the logic layer and the application layer and between the logic layer and the data layer based on the user's query content and query request, and replace user requirements with database key value naming specifications, so as to directly query data through the application program interface, simplify the user's business logic, ensure the independence and consistency of user code, and imply query conditions through the data keys of the application program interface, so as to simplify the logic of querying data, optimize query performance, avoid occupying computer IO and bandwidth resources, and enable users to directly generate query statements through the mapping method of the logic layer and the application layer, and directly obtain data from the database, thereby improving the efficiency of user queries.

[0010] Optionally, controlling the application layer to obtain target data corresponding to the user instruction from the preset application program interface through the second mapping method may include:

[0011] Generate a data query instruction based on the communication rule and send it to the data layer;

[0012] When the data layer receives the data query instruction, it obtains query data, converts the query data into the target data in a preset format and returns it to the preset application program interface;

[0013] The logic layer obtains the target data from the preset application program interface based on the user instruction and returns the target data to the application layer.

[0014] In the above implementation process, communication rules are formulated according to the user's query content and query conditions, and data interaction is performed between the application layer and the logic layer, as well as between the logic layer and the data layer, based on the formulated communication rules. This can ensure the consistency of the two-layer mapping method, reduce the coupling between the application layer and the logic layer, as well as between the logic layer and the data layer, and thus improve query efficiency.

[0015] Optionally, generating a communication rule according to the description information representing the query content and the query condition carried in the user instruction may include:

[0016] Select a data type of the preset application program interface, the data type including a string, a hash type, a list, a set, and an ordered set;

[0017] The hyphen of the target data and the naming format of the target data are determined, the data key of the communication rule is formed by the data type, and the data value of the communication rule is determined by the query content.

[0018] In the above implementation process, user requirements are converted into corresponding application interface key values ​​by formulating communication rules, so that users can directly enter query requirements to query corresponding data, which can reduce the difficulty of query and improve user experience.

[0019] Optionally, before controlling the logic layer to cache the data of the data layer to a preset application program interface in the first mapping manner, the method may further include:

[0020] Determine the query condition based on the user instruction and determine whether the query content required by the user exists in the data layer;

[0021] When it is detected that the query content exists in the data layer, it is determined to formulate communication rules between the logic layer and the application layer and between the logic layer and the data layer.

[0022] In the above implementation process, by adding a judgment step before formulating communication rules, by confirming whether there is query content in the data layer, determining whether to formulate communication rules, it is possible to alleviate the computing resources occupied by the query business and improve the efficiency of the query business.

[0023] Optionally, the method may further include:

[0024] When the query content is not detected in the data layer, data classification is added based on the user instruction, and communication rules between the logic layer and the application layer and between the logic layer and the data layer are formulated based on the data classification.

[0025] Optionally, the preset application program interface may be Redis.

[0026] In a second aspect, an embodiment of the present application provides a data query system, which may include:

[0027] Application layer, used to receive user instructions;

[0028] A data layer, wherein the data layer is used to store data;

[0029] The logic layer is connected to the application layer based on a first mapping method and connected to the data layer based on a second mapping method, wherein the first mapping method is to convert the data of the data layer into target data of a preset format according to a communication rule, and the second mapping method is to generate a query instruction according to the communication rule;

[0030] The logic layer is used to cache the data of the data layer to a preset application program interface, and based on a received user instruction, return target data corresponding to the user instruction in the preset application program interface.

[0031] In the above implementation process, by setting the data layer, logic layer and application layer to communicate and interact in turn based on the corresponding mapping methods, the consistency of the mapping methods is ensured by communication rules during the interaction process, which can avoid using cumbersome SQL statements to query the database, and can directly perform data queries through the application program interface. The query conditions are implied by the data keys of the application program interface, which can simplify the logic of querying data, optimize query performance, avoid occupying computer IO and bandwidth resources, and thus improve data query efficiency.

[0032] Optionally, the logic layer may also be used for:

[0033] Generate a data query instruction based on the communication rule and send it to the data layer;

[0034] When the data layer receives the data query instruction, it obtains query data, converts the query data into the target data in a preset format and returns it to the preset application program interface;

[0035] The target data is obtained from the preset application program interface based on the user instruction and returned to the application layer.

[0036] In the above implementation process, communication rules are formulated according to the user's query content and query conditions, and data interaction is performed between the application layer and the logic layer, as well as between the logic layer and the data layer, based on the formulated communication rules. This can ensure the consistency of the two-layer mapping method, reduce the coupling between the application layer and the logic layer, as well as between the logic layer and the data layer, and thus improve query efficiency.

[0037] In a third aspect, an embodiment of the present application provides an electronic device, comprising a memory and a processor, wherein the memory stores program instructions, and when the processor reads and runs the program instructions, it executes the steps in any of the above implementation methods.

[0038] In a fourth aspect, an embodiment of the present application further provides a computer-readable storage medium, wherein the computer-readable storage medium stores computer program instructions, and when the computer program instructions are read and executed by a processor, the steps in any of the above-mentioned implementation methods are executed. BRIEF DESCRIPTION OF THE DRAWINGS

[0039] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for use in the embodiments of the present application will be briefly introduced below. It should be understood that the following drawings only show certain embodiments of the present application and therefore should not be regarded as limiting the scope. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without paying creative work.

[0040] Figure 1A schematic diagram of the steps of the data query method provided in the embodiment of the present application;

[0041] Figure 2 A structural diagram of a data query system provided in an embodiment of the present application;

[0042] Figure 3 A schematic diagram of the steps of querying and returning data based on user instructions provided in an embodiment of the present application;

[0043] Figure 4 A schematic diagram of the steps for formulating communication rules provided in an embodiment of the present application;

[0044] Figure 5 A schematic diagram of the steps for determining whether to formulate communication rules provided in an embodiment of the present application. DETAILED DESCRIPTION

[0045] The technical solutions in the embodiments of the present application will be described below in conjunction with the accompanying drawings in the embodiments of the present application. For example, the flowcharts and block diagrams in the accompanying drawings show the possible architectures, functions and operations of the systems, methods and computer program products according to multiple embodiments of the present invention. In this regard, each box in the flowchart or block diagram may represent a module, a program segment or a part of a code, and the module, a program segment or a part of a code contains one or more executable instructions for implementing the specified logical functions. It should also be noted that in some alternative implementations, the functions marked in the box may also occur in an order different from that marked in the accompanying drawings. For example, two consecutive boxes can actually be executed substantially in parallel, and they may sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram and / or the flowchart, and the combination of boxes in the block diagram and / or the flowchart, can be implemented by a dedicated hardware-based system that performs a specified function or action, or can be implemented by a combination of dedicated hardware and computer instructions. In addition, the functional modules in the various embodiments of the present invention can be integrated together to form an independent part, or each module can exist separately, or two or more modules can be integrated to form an independent part.

[0046] During the research, the applicant found that, based on the basic technical solution, the problem of reducing computer performance during query is solved by increasing the cache of query results; and for the query performance problem, the large query results are divided into multiple differential queries to alleviate the pressure brought by the query, ensure writing and updating, and grab the execution gap. Currently, optimizing SQL query statements and improving query efficiency are relatively common solutions. If funds permit, you can also consider increasing memory, CPU, or choosing to purchase a high-performance cloud server. However, these solutions are not applicable in business.

[0047] Based on this, the embodiment of the present application provides a data query method, which divides the application system into three parts: data layer, logic layer and application layer, and the two adjacent layers interact with each other through corresponding mapping methods to optimize the query performance. Figure 1 , Figure 1 The following is a schematic diagram of the steps of the data query method provided in the embodiment of the present application. The process of the data query method may include the following steps:

[0048] In step S11, a user instruction is received, and a communication rule is generated according to the description information representing the query content and the query conditions carried in the user instruction. The communication rule is to use the query content and the set of the smallest subset of the query conditions as the naming specification of the data key.

[0049] In step S12, a first mapping method between the logic layer and the data layer and a second mapping method between the logic layer and the application layer are generated according to the communication rule.

[0050] In step S13, the logic layer is controlled to cache the data of the data layer to a preset application program interface through the first mapping method, wherein the first mapping method is to convert the data of the data layer into target data of a preset format according to a communication rule;

[0051] In step S14, based on the user instruction, the application layer is controlled to obtain target data corresponding to the user instruction from the preset application program interface through the second mapping method, and the second mapping method is to generate a query instruction according to the communication rule.

[0052] Among them, the application layer is a collection of user function modules, and the application layer contains multiple function modules, each of which can read data from the preset application interface according to the mapping method between the application layer and the logic layer. The logic layer plays a connecting role in the embodiment of the present application, providing data to the application layer and collecting data from the data layer. The data layer can be composed of application services and database management services, and the application services and database management services can be relational databases such as Mysql, Oracle or DB2.

[0053] The first mapping method is the mapping method between the data layer and the logic layer (Data Level To Logic Level, D2L), and the second mapping method is the mapping method between the logic layer and the application layer (Logic Level To Application Level, L2A). For details, please refer to Figure 2 , Figure 2This is a structural diagram of a data query system provided in an embodiment of the present application. The method provided in the embodiment of the present application can be applied to the data query system. In the technical solution provided in the embodiment of the present application, the data layer, the logic layer and the application layer communicate and interact in turn based on the corresponding mapping methods. When changes are made to each layer, only the corresponding mapping method needs to be adjusted, and other layers will not perceive the changes in the layer. The mapping method is used to ensure mutual isolation and non-interference between each layer, thereby ensuring logical data independence and physical data independence.

[0054] Specifically, the preset application programming interface (API) may be Redis, which is a key-value storage database that supports storage data types of string, list, set, sorted set, and hash. The above data types all support push / pop, add / remove, and intersection, union, and difference operations, and thus can be applied to data queries to obtain query results.

[0055] Specifically, taking the TopN application as an example, the logic layer determines that the user's query content is the application type, and the query condition is the traffic distribution of the application type within the predetermined time. The predetermined time is 24 hours, 7 days or 30 days. Therefore, the ordered set key value structure in the communication rule can be determined to be "app+today / 7_days / 30_days", and the member value of the ordered set is determined to be the application protocol type such as HTTP, FTP, TELNET, SIP or OTHER. For example, when querying the application type in the last 24 hours, the communication rule is app_today, when querying the last 7 days, the communication rule is app_7_days, and when querying the last 30 days, the communication rule is app_30_days.

[0056] Accordingly, the user layer can convert the user's query request into an instruction for obtaining query data, such as obtaining today's Top 10 ranking from high to low is "ZREVRANGE app_today 0 9 WITHSCORES", and obtaining today's Top 10 from low to high is "ZRANGE app_today 0 9 WITHSCORES".

[0057] It can be seen that the embodiment of the present application sets the data layer, the logic layer and the application layer to communicate and interact in sequence based on the corresponding mapping methods. During the interaction process, the consistency of the mapping method is ensured by the communication rules, which can avoid the use of cumbersome SQL statements to query the database. The communication rules between the logic layer and the application layer and between the logic layer and the data layer are formulated based on the user's query content and query request, and the user's requirements are replaced by the database key value naming specification. Data query can be performed directly through the application program interface, which can simplify the user's business logic and ensure the independence and consistency of the user code. The query conditions are implied by the data keys of the application program interface, which can simplify the logic of querying data, optimize query performance, and avoid occupying computer IO and bandwidth resources. In addition, it can enable users to directly generate query statements through the mapping method of the logic layer and the application layer, and directly obtain data from the database, thereby improving the efficiency of user queries.

[0058] In an optional embodiment, for step S12, the application layer is controlled to obtain the target data corresponding to the user instruction from the preset application program interface through the second mapping method. The embodiment of the present application provides an implementation method for querying and returning data based on the user instruction, please refer to Figure 3 , Figure 3 A schematic diagram of the steps of querying and returning data based on user instructions provided in an embodiment of the present application, the steps of querying and returning data based on user instructions may include:

[0059] In step S31, a data query instruction is generated based on the communication rule and sent to the data layer.

[0060] In step S32, when the data layer receives the data query instruction, it obtains query data, converts the query data into the target data in a preset format and returns it to the preset application program interface.

[0061] In step S33, the logic layer obtains the target data from the preset application program interface based on the user instruction and returns it to the application layer.

[0062] Among them, the logic layer receives user instructions from the application layer, analyzes the business needs of the application layer, and thus confirms the user's query content and query conditions. In the embodiment of the present application, the TopN application is used as an example to specifically illustrate the steps of querying and returning data based on user instructions.

[0063] First, obtain the prototype diagram. The prototype diagram can be the query information data uploaded by the user through the application layer. Confirm that the user's demand is based on the TopN ranking of the application protocol. The optional time can include the last 24 hours, the last 7 days or the last 30 days. After the logic layer determines the business needs, confirm that the content to be counted includes the application type (APP) according to the information of the prototype diagram. The application type can include HTTP application protocol type, SMTP application protocol type and FTP application protocol type, etc. The data type is determined based on the statistical content. Since the application type is a ranking model, the sort set data structure is selected. The communication rules are determined based on the application type and the data type, and the data query instructions representing the query application type and the selection of the sort set data structure are sent to the data layer.

[0064] The data layer receives the query instruction, obtains the application type and returns it to Redis as the ranking data of the sort set data structure. The logic layer returns the ranking data in Redis to the application layer based on the user instruction to display the application type to the user according to the ranking.

[0065] It can be seen that in the embodiment of the present application, communication rules are formulated according to the user's query content and query conditions, and data interaction is performed between the application layer and the logic layer, as well as between the logic layer and the data layer, based on the formulated communication rules. This can ensure the consistency of the two-layer mapping method, reduce the coupling between the application layer and the logic layer, as well as between the logic layer and the data layer, and thus improve query efficiency.

[0066] It can be seen that the embodiment of the present application formulates communication rules between the logic layer and the application layer, and between the logic layer and the data layer based on the user's query content and query request, and replaces user requirements with database key value naming specifications, which can simplify the user's business logic and ensure the independence and consistency of the user code. In addition, it allows users to directly generate query statements through the mapping method of the logic layer and the application layer, and directly obtain data from the database, thereby improving the efficiency of user queries.

[0067] In an optional embodiment, the present application embodiment also provides an implementation method for formulating communication rules between the logic layer and the application layer and between the logic layer and the data layer, please refer to Figure 4 , Figure 4 The schematic diagram of the steps for formulating communication rules provided in the embodiment of the present application, the implementation method for formulating communication rules may include the following steps:

[0068] In step S41, a data type of the preset application program interface is selected, and the data type includes a string, a hash type, a list, a set, and an ordered set.

[0069] In step S42, the hyphen of the target data and the naming format of the target data are determined, the data type is used to form the data key of the communication rule, and the data value of the communication rule is determined by the query content.

[0070] Specifically, the data type can be the data format of string, list, set, sorted set and hash in the above steps. In addition, when the application program interface is preset to other APIs, it can also be selected according to the data type supported by the API. Commonly used hyphens can be ":" or "_", and the naming format can be determined according to the content and query conditions of the user's query. For example, when a user queries materials in a warehouse, the naming format can be "product name: query condition: library name: table name: column name", or the naming format can be set to "time: product name: table name: data object description".

[0071] It can be seen that the embodiment of the present application converts user requirements into corresponding application interface key values ​​by formulating communication rules, so that users can directly enter query requirements to query corresponding data, which can reduce the difficulty of query use and improve user experience.

[0072] In an optional embodiment, a judgment step may be added before formulating the communication rules, and whether to formulate the communication rules is determined based on whether there is a corresponding query content in the data layer. Figure 5 , Figure 5 A schematic diagram of the steps of determining whether to formulate a communication rule is provided in an embodiment of the present application. The steps of determining whether to formulate a communication rule may include:

[0073] In step S51, the query condition is determined based on the user instruction and it is determined whether the query content required by the user exists in the data layer.

[0074] In step S52, when it is detected that the query content exists in the data layer, it is determined to formulate communication rules between the logic layer and the application layer and between the logic layer and the data layer.

[0075] Specifically, taking the above-mentioned TopN application as an example, when the logic layer obtains the prototype diagram, the user query demand is determined. The user's query demand is a ranking based on the application protocol. Therefore, the content to be counted is determined to be the application type. The logic layer confirms that there is content of the application type in the data layer, so the following communication rules are formulated between the logic layer and the application layer, and between the logic layer and the data layer.

[0076] It can be seen that the embodiment of the present application can alleviate the computing resources occupied by the query business and improve the efficiency of the query business by adding a judgment step before formulating the communication rules and confirming whether the query content exists in the data layer to determine whether to formulate the communication rules.

[0077] Optionally, in the actual application of data query, there may be a situation where there is no corresponding query content in the data layer. Therefore, when the query content is not detected in the data layer, the embodiment of the present application can add data classification based on the user instruction and formulate communication rules between the logic layer and the application layer and between the logic layer and the data layer based on the data classification.

[0078] Specifically, the embodiments of the present application take a counter application as an example to overall illustrate the implementation methods provided in the present application.

[0079] First, get the prototype diagram and confirm the user's query requirements. The user's query requirements are alarm level statistics and counts. The optional time can include the counts of the last 24 hours, the last 7 days, or the last 30 days. According to the prototype diagram, confirm that the content that the user needs to count includes the alarm level (alarm_level), and confirm whether there is already alarm_level data in the data layer. If not, add alarm_level to the statistics. Then determine the data type. Since alarm_level is a statistical count, string and hash data types can be used. However, because all statistical results are obtained at once when the query results are displayed on the page, a hash structure can be used.

[0080] Then determine the communication rules, the hash key value structure is "alarm_stat+today / 7_days / 30_days", the hashfield value can include high risk (high), medium risk (mid), low risk (low) and information (info), obtain the statistical count based on the communication rules, and convert the user's query request into an instruction to obtain the query data, such as "HGETALL alarm_stat_today" to obtain the alarm level statistical count in the last 24 hours. The alarm_level field in the logical layer data corresponds to the hash field values ​​of alarm_stat, high, mid, low and info, with 1-4, and is returned to the application for display.

[0081] Based on the same inventive concept, the embodiment of the present application also provides a data query system, including:

[0082] Application layer, used to receive user instructions;

[0083] A data layer, wherein the data layer is used to store data;

[0084] The logic layer is connected to the application layer based on a first mapping method and connected to the data layer based on a second mapping method, wherein the first mapping method is to convert the data of the data layer into target data of a preset format according to a communication rule, and the second mapping method is to generate a query instruction according to the communication rule;

[0085] The logic layer is used to generate a communication rule according to the description information representing the query content and the query condition carried in the user instruction, wherein the communication rule is to use the query content and the set of the minimum subset of the query condition as the naming specification of the data key;

[0086] Generate a first mapping mode between the logic layer and the data layer and a second mapping mode between the logic layer and the application layer according to the communication rule;

[0087] The data of the data layer is cached to a preset application program interface and based on the user instruction, the target data corresponding to the user instruction in the preset application program interface is returned.

[0088] The connection relationship between the application layer, logic layer and data layer can be found in detail. Figure 2 , I will not go into details here.

[0089] Optionally, the logic layer may also be specifically used for:

[0090] Generate a data query instruction based on the communication rule and send it to the data layer;

[0091] When the data layer receives the data query instruction, it obtains query data, converts the query data into the target data in a preset format and returns it to the preset application program interface;

[0092] The target data is obtained from the preset application program interface based on the user instruction and returned to the application layer.

[0093] Based on the same inventive concept, an embodiment of the present application also provides an electronic device, which includes a memory and a processor, wherein program instructions are stored in the memory, and when the processor reads and runs the program instructions, the steps in any of the above implementation methods are executed.

[0094] Based on the same inventive concept, an embodiment of the present application further provides a computer-readable storage medium, wherein the computer-readable storage medium stores computer program instructions, and when the computer program instructions are read and executed by a processor, the steps in any of the above implementation methods are executed.

[0095] The computer-readable storage medium may be a random access memory (RAM), a read-only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), or any other medium that can store program codes. The storage medium is used to store the program, and the processor executes the program after receiving the execution instruction. The method executed by the electronic terminal of the process definition disclosed in any embodiment of the present invention can be applied to the processor or implemented by the processor.

[0096] In the embodiments provided in the present application, it should be understood that the disclosed devices and methods can be implemented in other ways. The device embodiments described above are merely schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some communication interfaces, and the indirect coupling or communication connection of the devices or units can be electrical, mechanical or other forms.

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

[0098] Furthermore, the functional modules in the various embodiments of the present application may be integrated together to form an independent part, or each module may exist separately, or two or more modules may be integrated to form an independent part.

[0099] Alternatively, the present invention may be implemented in whole or in part by software, hardware, firmware, or any combination thereof. When implemented by software, the present invention may be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the process or function described in the embodiment of the present invention is generated in whole or in part.

[0100] The computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions may be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions may be transmitted from one website, computer, server, or data center to another website, computer, server, or data center via wired (e.g., coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) means.

[0101] In this article, relational terms such as first and second, etc. are used only to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the statement "include..." do not exclude the presence of other identical elements in the process, method, article or device including the elements.

[0102] The above description is only an embodiment of the present application and is not intended to limit the protection scope of the present application. For those skilled in the art, the present application may have various modifications and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application shall be included in the protection scope of the present application.

Claims

1. A data query method, characterized in that: include: Receive a user instruction, and generate a communication rule according to the description information representing the query content and the query condition carried in the user instruction, wherein the communication rule is to use the query content and the set of the minimum subset of the query condition as a naming specification of the data key; Generate a first mapping mode between the logic layer and the data layer and a second mapping mode between the logic layer and the application layer according to the communication rule; Controlling the logic layer to cache the data of the data layer to a preset application program interface through the first mapping method, wherein the first mapping method is to convert the data of the data layer into target data in a preset format according to a communication rule; Based on the user instruction, controlling the application layer to obtain target data corresponding to the user instruction from the preset application program interface through the second mapping method, wherein the second mapping method is to generate a query instruction according to the communication rule; Wherein, the preset application program interface is Redis.

2. The method according to claim 1, characterized in that The controlling the logic layer to cache the data of the data layer to a preset application program interface through the first mapping method, and the controlling the application layer to obtain the target data corresponding to the user instruction from the preset application program interface through the second mapping method includes: Generate a data query instruction based on the communication rule and send it to the data layer; When the data layer receives the data query instruction, it obtains query data, converts the query data into the target data in a preset format and returns it to the preset application program interface; The logic layer obtains the target data from the preset application program interface based on the user instruction and returns the target data to the application layer.

3. The method according to claim 1, characterized in that The generating of the communication rule according to the description information representing the query content and the query condition carried in the user instruction includes: Select a data type of the preset application program interface, the data type including a string, a hash type, a list, a set, and an ordered set; The hyphen of the target data and the naming format of the target data are determined, the data key of the communication rule is formed by the data type, and the data value of the communication rule is determined by the query content.

4. The method according to claim 1, characterized in that Before controlling the logic layer to cache the data of the data layer to the preset application program interface in the first mapping manner, the method further includes: Determine the query condition based on the user instruction and determine whether the query content required by the user exists in the data layer; When it is detected that the query content exists in the data layer, it is determined to formulate communication rules between the logic layer and the application layer and between the logic layer and the data layer.

5. The method according to claim 4, characterized in that The method further comprises: When the query content is not detected in the data layer, data classification is added based on the user instruction, and communication rules between the logic layer and the application layer and between the logic layer and the data layer are formulated based on the data classification.

6. A data query system, characterized in that: include: Application layer, used to receive user instructions; A data layer, wherein the data layer is used to store data; The logic layer is connected to the application layer based on a first mapping method and connected to the data layer based on a second mapping method, wherein the first mapping method is to convert the data of the data layer into target data of a preset format according to a communication rule, and the second mapping method is to generate a query instruction according to the communication rule; The logic layer is used to generate a communication rule according to the description information representing the query content and the query condition carried in the user instruction, wherein the communication rule is to use the query content and the set of the minimum subset of the query condition as the naming specification of the data key; Generate a first mapping mode between the logic layer and the data layer and a second mapping mode between the logic layer and the application layer according to the communication rule; caching the data of the data layer to a preset application program interface and returning target data corresponding to the user instruction in the preset application program interface based on the user instruction; Wherein, the preset application program interface is Redis.

7. The system according to claim 6, characterized in that The logic layer is also used to: Generate a data query instruction based on the communication rule and send it to the data layer; When the data layer receives the data query instruction, it obtains query data, converts the query data into the target data in a preset format and returns it to the preset application program interface; The target data is obtained from the preset application program interface based on the user instruction and returned to the application layer.

8. An electronic device, characterized in that: The electronic device comprises a memory and a processor, wherein the memory stores program instructions, and when the processor runs the program instructions, the steps in the method according to any one of claims 1 to 5 are executed.

9. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer program instructions, and when the computer program instructions are executed by a processor, the steps in the method according to any one of claims 1 to 5 are executed.

Citation Information

Patent Citations

  • Data storage method and system, and data query method and system

    CN107870970A

  • Database management method and system

    WO2015035789A1