Engine implementation method and apparatus, terminal, and storage medium

By establishing dimension tables and fact tables for matching, the problem that the engine implementation method could not adapt to different business needs was solved, enabling low-cost business decision-making and rule expression, and supporting rule processing with complex nested semantics.

CN116401243BActive Publication Date: 2026-04-28HANGZHOU NETEASE CLOUD MUSIC TECH CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
HANGZHOU NETEASE CLOUD MUSIC TECH CO LTD
Filing Date
2023-02-17
Publication Date
2026-04-28

Smart Images

  • Figure CN116401243B_ABST
    Figure CN116401243B_ABST
Patent Text Reader

Abstract

The application discloses an engine implementation method and device, a terminal and a storage medium. The method comprises the following steps: establishing a dimension table and a fact table; matching the dimension table and the fact table according to dimensions to obtain a matching result; and processing the matching result to obtain a decision result. The dimension table and the fact table are matched to establish the structure of a business rule, and the data in the structure is processed based on the dimensions to directly obtain the decision result, thereby avoiding high development and maintenance costs and realizing the expression of a rule of complex nested semantics. In addition, the dimension table and the fact table established by the application can be directly reused, thereby meeting different business requirements.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of computers, and more specifically, to an engine implementation method, apparatus, terminal, and storage medium. Background Technology

[0002] Engine technology is a component embedded in an application that separates business decisions from application code and uses predefined semantic modules to write business decisions. That is, it receives data input, interprets the business, and makes business decisions based on the business.

[0003] Currently, the engine is mainly implemented using hard coding, which means that the relevant parameters of the output or input (e.g., path, output form or format) are written directly as constants in the source code.

[0004] However, the above method requires writing different code for different business needs during the engine implementation process, and cannot be applied to different business needs. Summary of the Invention

[0005] The main purpose of this application is to provide an engine implementation method, device, terminal and storage medium to solve the problem that existing engine implementation methods cannot be applied to different business needs.

[0006] To achieve the above objectives, firstly, this application provides an engine implementation method, including:

[0007] Create dimension tables and fact tables;

[0008] The dimension table and the fact table are matched according to the dimensions to obtain the matching results;

[0009] The matching results are processed to obtain the decision result.

[0010] In one possible implementation, dimension tables and fact tables are created, including:

[0011] Define the column names for the dimension table and the fact table;

[0012] Determine the column names of the dimension table and the fact table to identify them.

[0013] In one possible implementation, the column names of the dimension table include both dimension and script, and the column names of the fact table include both dimension and measure.

[0014] The column names for the dimension and fact tables are defined, including:

[0015] Set all fields under all matching conditions as dimension fields, and use the dimension fields to form dimensions;

[0016] Set all fields used by all execution methods as metric fields, and use metric fields to form metrics;

[0017] Set the different execution methods under all matching conditions as script fields, and use script fields to form scripts.

[0018] In one possible implementation, all fields under the condition of full matching are set as dimension fields, including:

[0019] Enumerate all fields under all matching conditions;

[0020] Iterate through all fields. If the condition of any field is an enumerated value, set that field as a dimension field.

[0021] If any field in the set of all fields contains a non-enumerated value, convert that field to an enumerated value and set it as a dimension field.

[0022] In one possible implementation, the column names of the dimension table and the fact table are determined by judging the column names, including:

[0023] If the preset column names match the column names of the dimension table and the fact table;

[0024] Import the preset business data into the cells corresponding to the column names in the dimension table and fact table;

[0025] If there are no blank cells in the cells corresponding to the column names in the dimension table and the fact table, then the dimension table and the fact table are obtained.

[0026] In one possible implementation, the column names of the dimension table and the fact table are determined by judging the column names, including:

[0027] If the preset column names do not match the column names of the dimension table and the fact table;

[0028] Adjust the column names of the dimension table and fact table according to the preset column names, and then perform the step of importing the preset business data into the cells corresponding to the column names of the dimension table and fact table.

[0029] In one possible implementation, the method also includes:

[0030] If the preset dimensions do not match the dimensions in the dimension table and the fact table;

[0031] Based on preset dimensions, add or modify dimensions in the dimension table and fact table, and then import preset business data into the cells corresponding to the column names in the dimension table and fact table.

[0032] In one possible implementation, the method also includes:

[0033] If the preset metric does not match the metric in the fact table;

[0034] Add or modify the measures in the fact table based on the preset measures, and then perform the steps of importing the preset business data into the cells corresponding to the column names in the dimension table and the fact table.

[0035] In one possible implementation, the method also includes:

[0036] If the preset script does not match the script in the dimension table;

[0037] Based on the preset script, add or modify the script in the dimension table, and execute the steps to import the preset business data into the cells corresponding to the column names in the dimension table and fact table.

[0038] In one possible implementation, the method also includes:

[0039] If there are blank cells in the cells corresponding to the column names in the dimension table and the fact table, fill the blank cells with default values ​​to obtain the dimension table and the fact table.

[0040] In one possible implementation, the dimension table and the fact table are matched based on the dimensions to obtain the matching results, including:

[0041] Read the dimension table and fact table;

[0042] The calculation engine performs equi-joins on the dimensions in the dimension table and the fact table to obtain a result set, which includes at least the measure and script corresponding to the equi-joined dimensions.

[0043] In one possible implementation, the matching results are processed to obtain a decision result, including:

[0044] Select the target metric and target script from the metrics and scripts corresponding to the dimensions after equijoining;

[0045] Input the target metric and target script into the expression engine to obtain the decision result.

[0046] Secondly, embodiments of the present invention provide an engine implementation apparatus, comprising:

[0047] The module is used to create dimension tables and fact tables;

[0048] The matching module is used to match the dimension table and the fact table based on the dimensions to obtain the matching results;

[0049] The processing module is used to process the matching results and obtain the decision result.

[0050] Thirdly, embodiments of the present invention provide a terminal, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the steps of any of the above engine implementation methods.

[0051] Fourthly, embodiments of the present invention provide a computer-readable storage medium storing a computer program, which, when executed by a processor, implements the steps of any of the above engine implementation methods.

[0052] This invention provides an engine implementation method, apparatus, terminal, and storage medium, comprising: first establishing a dimension table and a fact table; then matching the dimension table and the fact table according to the dimensions to obtain a matching result; and finally processing the matching result to obtain a decision result. This invention establishes a business rule structure by matching the constructed dimension table and fact table, and processes the data in the structure based on the dimensions to directly obtain the decision result, avoiding high development and maintenance costs and enabling the expression of rules with complex nested semantics. Furthermore, the dimension table and fact table established by this invention can be directly reused to meet different business needs. Attached Figure Description

[0053] The accompanying drawings, which form part of this application, are used to provide a further understanding of the application and to make other features, objects, and advantages of the application more apparent. The illustrative embodiments and descriptions of this application are used to explain the application and do not constitute an undue limitation of the application. In the drawings:

[0054] Figure 1 This is a schematic diagram illustrating an application scenario of an engine implementation method provided in an embodiment of the present invention;

[0055] Figure 2 This is a flowchart illustrating an engine implementation method according to an embodiment of the present invention;

[0056] Figure 3 This is a flowchart illustrating an engine implementation method according to another embodiment of the present invention;

[0057] Figure 4 This is a flowchart illustrating the process of creating a dimension table and a fact table according to an embodiment of the present invention;

[0058] Figure 5 This is a flowchart illustrating the method for configuring dimensions in the dimension table and fact table provided in an embodiment of the present invention.

[0059] Figure 6 This is a schematic diagram of the structure of an engine implementation device provided in an embodiment of the present invention;

[0060] Figure 7This is a schematic diagram of the terminal provided in an embodiment of the present invention. Detailed Implementation

[0061] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0062] The terms "first," "second," "third," "fourth," etc. (if present) in the specification, claims, and accompanying drawings of this invention are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that embodiments of the invention described herein can be implemented in sequences other than those illustrated or described herein.

[0063] It should be understood that in the various embodiments of the present invention, the sequence number of each process does not imply the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present invention.

[0064] It should be understood that in this invention, "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion, for example, a process, method, system, product, or device that includes a series of steps or units is not necessarily limited to those steps or units that are explicitly listed, but may include other steps or units that are not explicitly listed or that are inherent to such process, method, product, or device.

[0065] It should be understood that in this invention, "multiple" refers to two or more. "And / or" is merely a description of the relationship between related objects, indicating that three relationships can exist. For example, "and / or B" can represent: A existing alone, A and B existing simultaneously, and B existing alone. The character " / " generally indicates that the preceding and following related objects are in an "or" relationship. "Contains A, B, and C", "Contains A, B, and C" means that all three A, B, and C are contained; "Contains A, B, or C" means that one of A, B, and C is contained; "Contains A, B, and / or C" means that any one, two, or three of A, B, and C are contained.

[0066] It should be understood that in this invention, "B corresponding to A", "B corresponding to A", "A and B correspond", or "B and A correspond" means that B is associated with A, and B can be determined based on A. Determining B based on A does not mean determining B solely based on A; B can also be determined based on A and / or other information. Matching A and B is defined as a similarity between A and B that is greater than or equal to a preset threshold.

[0067] Depending on the context, "if" as used here can be interpreted as "when," "when," "in response to determination," or "in response to detection."

[0068] The data disclosed herein may be data authorized by the user or fully authorized by all parties. The collection, dissemination, and use of the data shall comply with the requirements of relevant national laws and regulations. The implementation methods / executives of this disclosure may be combined with each other.

[0069] The technical solution of the present invention will be described in detail below with reference to specific embodiments. These specific embodiments can be combined with each other, and the same or similar concepts or processes may not be described again in some embodiments.

[0070] To make the objectives, technical solutions, and advantages of the present invention clearer, specific embodiments will be described below in conjunction with the accompanying drawings.

[0071] To facilitate understanding of this solution, the terms used in this application need to be explained, as follows:

[0072] Dimensional modeling: A data modeling method in data warehouse construction, it is a logical design method for structuring data. It divides the objective world into measures and contexts. Kimball first proposed this concept. Its simplest description is to build a data warehouse according to fact tables and dimension tables.

[0073] As the core of dimensional modeling in a data warehouse, the fact table is designed around business processes. It expresses business processes by obtaining metrics that describe them, and includes the dimensions referenced and the metrics related to the business processes.

[0074] A dimension table can be viewed as a window for analyzing data. It contains the characteristics of the fact records in the fact table. Some characteristics provide descriptive information, while others specify how to summarize the data in the fact table to provide useful information for analysts. The dimension table contains a hierarchical structure of characteristics that help summarize the data.

[0075] Rule Engine: Rules, as a form of knowledge, are typically used to draw conclusions based on a given set of rules and actual situations. This conclusion might be a static result or a set of operations that need to be performed. This process of applying rules is called reasoning. If a program handles the reasoning process, then that program is called an inference engine. The inference engine is the core module of an expert system (a branch of artificial intelligence). The control strategies adopted by inference engines vary depending on the knowledge representation; common types include neural network-based, case-based, and rule-based inference engines. Among these, rule-based inference engines are widely used because they are easy to understand, acquire, and manage. This type of inference engine is called a "rule engine." In a rule engine, knowledge is expressed as rules, and the situations to be analyzed are defined as facts. Rules and facts are the input parameters accepted by the rule engine, which itself consists of three components: a pattern matcher, an agenda, and an execution engine. The Pattern Matcher finds matching rules based on facts, the Agenda manages the execution order of the rules selected by the Pattern Matcher, and the Execution Engine is responsible for performing specific operations based on the rules output by the Agenda.

[0076] Currently, rule engines are mainly implemented using two methods. The first method uses hard coding, where rule definition and execution are implemented within the same codebase as other program logic. For developers, this requires knowledge of rule storage and parsing methods, as well as the implementation of business logic and rule execution. Its main drawbacks are: high iteration costs (adding or changing rules requires development, testing, and deployment of the entire business program, especially in big data scenarios where testing costs are extremely high); poor maintainability (rule definition and execution are embedded in the code logic, rule iteration may cause other code changes); and the lack of independent structured records for rules hinders the reuse and analysis of rule knowledge.

[0077] The second approach, based on open-source rule engines like Drools, separates rule definition and execution from the code, encapsulating the reasoning process within the rule engine. This allows the business system to focus on its own logic without needing to worry excessively about rule judgments. Its main drawbacks are: rule management still lacks reusability and analytical capabilities; the rule syntax is only suitable for flat rules; for rules with nested conditional semantics, configuration requires combining conditions using Cartesian products, which multiplies as the number of conditions increases, leading to poor maintainability; and in big data scenarios, the input parameters `facts` to the rule engine also require Cartesian product combinations of dimensions in the data warehouse to generate corresponding fact table metrics, resulting in high iteration costs.

[0078] Therefore, based on the above problems, this application proposes an engine implementation method.

[0079] Please see Figure 1 , Figure 1 This is a schematic diagram illustrating an application scenario of an engine implementation method provided in an embodiment of this application. For example... Figure 1 As shown, client 102 communicates with server 104. Client 102 receives business rules and sends them to server 104. Server 104 establishes dimension tables and fact tables corresponding to the business rules, and then matches the dimension tables and fact tables according to the dimensions to obtain matching results. Then, it processes the matching results based on the business rules to obtain business decision results.

[0080] The client 102 and server 104 can communicate through any communication method, including but not limited to network communication. The network can include, but is not limited to, wired networks and wireless networks. Wired networks include local area networks (LANs), metropolitan area networks (MANs), and wide area networks (WANs). Wireless networks include Bluetooth, Wi-Fi, and other networks that enable wireless communication. The client 102 includes, but is not limited to, at least one of the following: mobile phones (such as Android phones, iOS phones, etc.), laptops, tablets, handheld computers, MIDs (Mobile Internet Devices), PADs, desktop computers, smart TVs, etc. The server 104 can be a field server or a remote server. Both field servers and remote servers can be independent servers or service clusters composed of multiple servers. The above is merely an example, and no limitations are imposed in this embodiment.

[0081] Please see Figure 2 , Figure 2 This is a flowchart illustrating an engine implementation method provided in an embodiment of this application. Figure 2 As shown, this method is applied to Figure 1The server 104 shown includes the following steps:

[0082] Step S201: Create dimension tables and fact tables.

[0083] The dimension table includes dimensions and scripts, while the fact table includes dimensions and measures.

[0084] Combination Figure 3 When applying dimension tables and fact tables to rules or business rules, it is necessary to establish corresponding dimension tables (rules) and fact tables (facts). The rules can be any type of rule, not limited to business rules, which include, but are not limited to, financial settlement and securities trading.

[0085] When creating the dimension table for business rules, the condition matching part of the business rule is used as the dimension, and the execution part is used as the attribute, which are organized into the dimension table in dimensional modeling. A single condition in the business rule corresponds to a single dimension dim, such as dim1, dim2, dim3, etc. Nested conditions correspond to dimension combinations, and the execution part corresponds to a script that can be directly executed by the expression engine, such as script1, script2, etc.

[0086] When establishing the fact table for business rules, the condition matching part of the business rules is used as the dimension, and the execution part is used as the attribute, which are organized into a dimension table in dimensional modeling. A single condition in the business rule corresponds to a single dimension, such as dim1, dim2, dim3, etc., and nested conditions correspond to dimension combinations. It also includes the measure mes in the facts that the rule needs to analyze, such as mes1, mes2, mes3, etc.

[0087] To create dimension tables and fact tables, you first need to define the column names for the dimension tables and fact tables, and then determine the column names to define the dimension tables and fact tables.

[0088] Because the dimension tables and fact tables need to meet different business rule requirements, the column names of the dimension tables and fact tables are listed exhaustively as much as possible here. Figure 4 When constructing the column names of dimension tables and fact tables, all fields under all matching conditions of all rules (such as IF / WHEN statements) need to be set as dimension fields, and dimension fields constitute dimensions; all fields used by all execution methods need to be set as measure fields, and measure fields constitute measures; different execution methods under all matching conditions of all rules need to be set as script fields, and script fields constitute scripts.

[0089] When setting dimension fields, you need to first enumerate all fields (such as fact fields) under all matching conditions of all rules, and then iterate through all fields. If the judgment condition of any field in all fields is an enumerated value, set that field as a dimension field. If the judgment condition of any field in all fields contains a non-enumerated value, convert that field to an enumerated value and set it as a dimension field.

[0090] Let the fact fields be F = {F1, F2, F3...}. Then, iterate through each field in F. If the criteria for field F1 are all enumerated values, directly set the field as dimension dim(F1). If the criteria for field F2 include non-enumerated values, change the criteria for the original field F2 to the criteria for the transformed field F2′, where all criteria for field F2′ are enumerated values, and set it as dimension dim(F2′). Repeat this process for other fact fields to achieve the setting of dimension fields.

[0091] After setting the column names of the dimension table and the fact table, it is necessary to determine the column names of the dimension table and the fact table based on the specific business rules to determine the dimension table and fact table corresponding to the business rules. Specifically, for specific business rules, the preset column names, preset business data, preset dimensions, preset scripts, and preset measures can be the column names, business data, dimensions, scripts, and measures corresponding to the specific business rules, respectively.

[0092] Specifically, it is necessary to determine whether the column names corresponding to the business rules match the column names of the dimension tables and fact tables. If the preset column names match the column names of the dimension tables and fact tables, the preset business data is imported into the cells corresponding to the column names of the dimension tables and fact tables. If there are no blank cells in the cells corresponding to the column names of the dimension tables and fact tables, the dimension tables and fact tables are obtained. If there are blank cells in the cells corresponding to the column names of the dimension tables and fact tables, the blank cells are filled with default values, and the dimension tables and fact tables are obtained. If the preset column names do not match the column names of the dimension tables and fact tables, the column names of the dimension tables and fact tables are adjusted according to the preset column names, and the step of importing the preset business data into the cells corresponding to the column names of the dimension tables and fact tables is executed.

[0093] Suppose the business rule is financial settlement. The dimension table corresponding to financial settlement needs to be configured with dimensions dim1, dim2, and scripts script1, script2. The fact table corresponding to financial settlement needs to be configured with dimensions dim1, dim2, and measures mes1, mes2. Then, the column names in the dimension table and fact table corresponding to financial settlement can be matched with the column names of the existing dimension table and fact table. If the existing dimension table includes dimensions dim1, dim2, dim3, and scripts script1, script2, script3, and the fact table includes dimensions dim1, dim2, dim3, and measures mes1, mes2, mes3, then by matching the fact table and dimension table corresponding to financial settlement with the existing fact table and dimension table, we can see that the column names of the existing fact table and dimension table contain the column names of the fact table and dimension table corresponding to financial settlement. This indicates a successful match, and the business data corresponding to financial settlement can be imported into the existing dimension table's dimensions dim1, dim2, and scripts script1, script2, and the fact table's dimensions dim1, dim2, and measures mes1, mes2.

[0094] After importing the business data corresponding to financial settlement, if there are blank cells in any column of the dimension, script, or metric, the default values ​​corresponding to financial settlement can be used to fill them.

[0095] Since the column names in the dimension and fact tables include dimensions, scripts, and measures, it is necessary to match the column names (including dimensions, scripts, and measures) of the dimension and fact tables with the dimensions, scripts, and measures corresponding to the specific business rules. If any of the column names in the dimension and fact tables do not match, a corresponding add or modify operation is required. A modification is any operation other than adding, such as deletion, replacement, or modification.

[0096] Specifically, in combination Figure 5 If the preset dimensions do not match the dimensions of the dimension table and the fact table, add or change the dimensions of the dimension table and the fact table according to the preset dimensions, and perform the step of importing the preset business data into the cells corresponding to the column names of the dimension table and the fact table.

[0097] Suppose the business rule is financial settlement. The dimension table corresponding to financial settlement needs to be configured with measures mes1 and mes2. If the existing dimension table includes measures mes3 and mes4, and the dimension table corresponding to financial settlement does not match the existing dimension table when matching it, the existing dimension table needs to be changed. Any two of the existing dimensions dim3, dim4, and dim5 can be changed to dim1 and dim2.

[0098] If we change dim3 and dim4 in the existing dimensions dim3, dim4, and dim5 to dim1 and dim2, then after the existing dimensions become dim1, dim2, and dim5, we only need to import the business data corresponding to financial settlement into the existing dimensions dim1 and dim2.

[0099] If blank cells exist in dimensions dim1 and dim2 after importing business data related to financial settlement into them, the default values ​​corresponding to financial settlement can be used to fill them. No specific limitations are set here regarding the default values ​​for financial settlement; they can be determined based on specific circumstances.

[0100] If the preset measure does not match the measure in the fact table, add or modify the measure in the fact table according to the preset measure, and perform the step of importing the preset business data into the cells corresponding to the column names in the dimension table and the fact table.

[0101] Suppose the business rule is financial settlement. The fact table corresponding to financial settlement needs to be configured with measures mes1 and mes2. If the existing fact table includes measures mes1 and mes3, and the fact table corresponding to financial settlement does not match the existing fact table when matching it, the existing fact table needs to be modified. A new measure dim2 can be added to the existing measures mes1 and mes3.

[0102] If a new measure mes2 is added to the existing measures mes1 and mes3, the existing fact tables will become measures mes1, mes2, and mes3. Then, the business data corresponding to financial settlement only needs to be imported into the existing measures mes1 and mes2.

[0103] If blank cells exist in the existing measures mes1 and mes2 after importing the business data corresponding to financial settlement into them, the default values ​​corresponding to financial settlement can be used to fill them.

[0104] If the preset script does not match the script in the dimension table, add or modify the script in the dimension table according to the preset script, and then perform the step of importing the preset business data into the cells corresponding to the column names in the dimension table and the fact table.

[0105] Suppose the business rule is financial settlement. The dimension table corresponding to financial settlement needs to be configured with scripts script1, script2, and script3. If the existing dimension table includes scripts script1 and script2, and the dimension table corresponding to financial settlement does not match the existing dimension table when matching it, the existing dimension table needs to be changed. Script script3 can be added to the existing scripts script1 and script2.

[0106] By adding script script3 to the existing scripts script1 and script2, the existing dimension tables will become scripts script1, script2, and script3. Then, the business data corresponding to financial settlement only needs to be imported into the existing scripts script1, script2, and script3.

[0107] If blank cells exist in the existing scripts script1, script2, and script3 after importing the business data corresponding to financial settlement into them, the default values ​​corresponding to financial settlement can be used to fill them.

[0108] It should be noted that each column name in the dimensions, scripts, and measures corresponds to a cell, and you only need to fill in the corresponding cells based on the column name.

[0109] Step S202: Match the dimension table and the fact table according to the dimensions to obtain the matching results.

[0110] In this application, rule matching is performed by using computing engines such as Spark, Hive, and Flink to associate the fact table with the dimension table through dimensions.

[0111] Specifically, the dimension table and fact table need to be read first, and then the dimensions in the dimension table and fact table are equal-joined by the calculation engine to obtain the result set. The result set includes at least the measure and script corresponding to the equal-joined dimension.

[0112] Suppose the dimension table includes dimension dim1, script1, and script2, and the fact table includes dimension dim2, measure mes1, and mes2. The cells corresponding to dim1 contain fields a, b, and c, and the cells corresponding to dim2 also contain fields a, b, and c. Then, dimension dim1 in the dimension table and dimension dim2 in the fact table can be equijoined to form the equijoined dimension dim3, whose corresponding cells contain fields a, b, and c.

[0113] Select scripts script1 and script2, as well as measures mes1 and mes2, from the dimension table and fact table respectively, corresponding to the dimension dim3 after equi-joining, to form a result set.

[0114] Step S203: Process the matching results to obtain the decision result.

[0115] The result set after association and matching is handed over to the execution engine to perform specific operations. Through expression engines such as Aviator, OGNL, and QLExpress, the target metric and target script are selected from the metrics and scripts corresponding to the dimensions after equi-joining. Then, the target metric and target script are input into the expression engine to obtain the decision result.

[0116] Let the expression engine be a specific expression, such as decision result = dimension + metric + script. Since the dimension dim3 after equi-joining includes fields a, b, and c, the fields a, b, and c are matched with the fields in the corresponding scripts script1 and script2 and metrics mes1 and mes2 of the equi-joined dimension dim3. If the matched metrics are e, f, and g, and the scripts are d, f, and g, then the decision result can be obtained from the above expression as a + e + d, b + f + f, c + g + g.

[0117] This invention provides an engine implementation method, comprising: first, establishing a dimension table and a fact table; then, matching the dimension table and the fact table according to the dimensions to obtain the matching result; and finally, processing the matching result to obtain the decision result. This invention establishes the structure of business rules by matching the constructed dimension table and fact table, and processes the data in the structure based on the dimensions to directly obtain the decision result, avoiding high development and maintenance costs and enabling the expression of rules with complex nested semantics. Furthermore, the dimension table and fact table established by this invention can be directly reused to meet different business needs.

[0118] It should be understood that the sequence number of each step in the above embodiments does not imply the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present invention.

[0119] The following are device embodiments of the present invention. For details not described in detail, please refer to the corresponding method embodiments described above.

[0120] Figure 6 The diagram illustrates the structure of an engine implementation device according to an embodiment of the present invention. For ease of explanation, only the parts relevant to the embodiment of the present invention are shown. The engine implementation device includes an establishment module 601, a matching module 602, and a processing module 603, as detailed below:

[0121] Module 601 is used to create dimension tables and fact tables;

[0122] Matching module 602 is used to match the dimension table and the fact table based on the dimensions to obtain the matching results;

[0123] The processing module 603 is used to process the matching results to obtain the decision result.

[0124] In one possible implementation, module 601 is also used to construct the column names of the dimension table and the fact table;

[0125] Determine the column names of the dimension table and the fact table to identify them.

[0126] In one possible implementation, the column names of the dimension table include both dimension and script, and the column names of the fact table include both dimension and measure.

[0127] The module 601 is also used to set all fields under all matching conditions as dimension fields, and to form dimensions from the dimension fields;

[0128] Set all fields used by all execution methods as metric fields, and use metric fields to form metrics;

[0129] Set the different execution methods under all matching conditions as script fields, and use script fields to form scripts.

[0130] In one possible implementation, module 601 is also used to enumerate all fields under all matching conditions;

[0131] Iterate through all fields. If the condition of any field is an enumerated value, set that field as a dimension field.

[0132] If any field in the set of all fields contains a non-enumerated value, convert that field to an enumerated value and set it as a dimension field.

[0133] In one possible implementation, the setup module 601 is also used to match the preset column names with the column names of the dimension table and the fact table.

[0134] Import the preset business data into the cells corresponding to the column names in the dimension table and fact table;

[0135] If there are no blank cells in the cells corresponding to the column names in the dimension table and the fact table, then the dimension table and the fact table are obtained.

[0136] In one possible implementation, module 601 is further configured to handle situations where the preset column names do not match the column names of the dimension table and the fact table.

[0137] Adjust the column names of the dimension table and fact table according to the preset column names, and then perform the step of importing the preset business data into the cells corresponding to the column names of the dimension table and fact table.

[0138] In one possible implementation, the device further includes a first operation module, which is used to handle situations where the preset dimensions do not match the dimensions of the dimension table and the fact table.

[0139] Based on preset dimensions, add or modify dimensions in the dimension table and fact table, and then import preset business data into the cells corresponding to the column names in the dimension table and fact table.

[0140] In one possible implementation, the device further includes a second operation module, which is used to handle situations where the preset metric does not match the metric in the fact table.

[0141] Add or modify the measures in the fact table based on the preset measures, and then perform the steps of importing the preset business data into the cells corresponding to the column names in the dimension table and the fact table.

[0142] In one possible implementation, the device further includes a third operation module, which is used to handle situations where the preset script does not match the script of the dimension table.

[0143] Based on the preset script, add or modify the script in the dimension table, and execute the steps to import the preset business data into the cells corresponding to the column names in the dimension table and fact table.

[0144] In one possible implementation, the device further includes a fourth operation module, which is used to fill blank cells with default values ​​if there are blank cells in the cells corresponding to the column names of the dimension table and the fact table, thereby obtaining the dimension table and the fact table.

[0145] In one possible implementation, the matching module 602 is also used to read the dimension table and the fact table;

[0146] The calculation engine performs equi-joins on the dimensions in the dimension table and the fact table to obtain a result set, which includes at least the measure and script corresponding to the equi-joined dimensions.

[0147] In one possible implementation, the processing module 603 is further configured to select a target metric and a target script from the metrics and scripts corresponding to the dimensions after equi-joining;

[0148] Input the target metric and target script into the expression engine to obtain the decision result.

[0149] Figure 7 This is a schematic diagram of a terminal provided in an embodiment of the present invention. Figure 7As shown, the terminal 7 in this embodiment includes: a processor 701, a memory 702, and a computer program 703 stored in the memory 702 and executable on the processor 701. When the processor 701 executes the computer program 703, it implements the steps in the various engine implementation method embodiments described above, for example... Figure 2 Steps 201 to 203 are shown. Alternatively, when processor 701 executes computer program 703, it implements the functions of each module / unit in the above-described engine implementation device embodiments, for example... Figure 6 The functions of modules / units 601 to 603 shown.

[0150] The present invention also provides a readable storage medium storing a computer program, which, when executed by a processor, is used to implement the engine implementation methods provided in the various embodiments described above.

[0151] The readable storage medium can be a computer storage medium or a communication medium. A communication medium includes any medium that facilitates the transfer of computer programs from one location to another. A computer storage medium can be any available medium accessible to a general-purpose or special-purpose computer. For example, a readable storage medium is coupled to a processor, enabling the processor to read information from and write information to the readable storage medium. Of course, the readable storage medium can also be a component of the processor. The processor and the readable storage medium can reside in an Application-Specific Integrated Circuit (ASIC). Alternatively, the ASIC can be located in a user equipment. Of course, the processor and the readable storage medium can also exist as discrete components in a communication device. The readable storage medium can be a read-only memory (ROM), random access memory (RAM), CD-ROM, magnetic tape, floppy disk, and optical data storage device, etc.

[0152] The present invention also provides a program product including executable instructions stored in a readable storage medium. At least one processor of the device can read the executable instructions from the readable storage medium, and the execution of the executable instructions by the at least one processor causes the device to implement the engine implementation methods provided in the various embodiments described above.

[0153] In the embodiments of the above-described device, it should be understood that the processor can be a Central Processing Unit (CPU), or other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), etc. The general-purpose processor can be a microprocessor or any conventional processor. The steps of the method disclosed in this invention can be directly manifested as execution by a hardware processor, or execution by a combination of hardware and software modules within the processor.

[0154] The above embodiments are only used to illustrate the technical solutions of the present invention, and are not intended to limit it. Although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention.

Claims

1. An engine implementation method, characterized in that, include: Establish dimension tables and fact tables. The column names of the dimension tables include dimensions used to express matching conditions in business rules and scripts used to express execution logic in business rules. The column names of the fact tables include dimensions used to express matching conditions in business rules and measures used to express facts to be analyzed. Nested conditions in business rules correspond to combinations of dimensions in the dimension tables. The process of matching the dimension table and the fact table based on dimensions to obtain matching results includes: reading the dimension table and the fact table; and performing equal-joins on the dimensions in the dimension table and the fact table through a calculation engine to obtain a result set, wherein the result set includes at least the measure and script corresponding to the equal-joined dimension. The matching results are processed to obtain a decision result, including: selecting a target metric and a target script from the metrics and scripts corresponding to the dimensions after equi-joining; and inputting the target metric and target script into an expression engine to obtain the decision result. The step of establishing the dimension table and the fact table includes: constructing the column names of the dimension table and the fact table; judging the column names of the dimension table and the fact table to determine the dimension table and the fact table; The construction of the column names of the dimension table and the fact table includes: setting all fields under all matching conditions as dimension fields, and using the dimension fields to form the dimension; setting all fields used by all execution methods as metric fields, and using the metric fields to form the metric; setting different execution methods under all matching conditions as script fields, and using the script fields to form the script. Setting all fields under all matching conditions as dimension fields includes: enumerating all fields under all matching conditions; traversing all fields, and if the judgment condition of any field in all fields is an enumerated value, setting that field as a dimension field; if the judgment condition of any field in all fields contains a non-enumerated value, converting that field into an enumerated value and setting it as a dimension field.

2. The engine implementation method as described in claim 1, characterized in that, The step of determining the column names of the dimension table and the fact table to identify the dimension table and the fact table includes: If the preset column names match the column names of the dimension table and the fact table; Import the preset business data into the cells corresponding to the column names in the dimension table and fact table; If there are no blank cells in the cells corresponding to the column names of the dimension table and the fact table, then the dimension table and the fact table are obtained.

3. The engine implementation method as described in claim 2, characterized in that, The step of determining the column names of the dimension table and the fact table to identify the dimension table and the fact table includes: If the preset column names do not match the column names of the dimension table and the fact table; The column names of the dimension table and the fact table are adjusted according to the preset column names, and the step of importing the preset business data into the cells corresponding to the column names of the dimension table and the fact table is performed.

4. The engine implementation method as described in claim 3, characterized in that, The method includes: If the preset dimensions do not match the dimensions of the dimension table and the fact table; The dimensions of the dimension table and the fact table are added or changed according to the preset dimensions, and the step of importing the preset business data into the cells corresponding to the column names of the dimension table and the fact table is executed.

5. The engine implementation method as described in claim 3, characterized in that, The method includes: If the preset metric does not match the metric in the fact table; The measures in the fact table are added or modified according to the preset measures, and the step of importing the preset business data into the cells corresponding to the column names of the dimension table and the fact table is executed.

6. The engine implementation method as described in claim 3, characterized in that, The method includes: If the preset script does not match the script in the dimension table; The script of the dimension table is added or modified according to the preset script, and the step of importing the preset business data into the cells corresponding to the column names of the dimension table and the fact table is executed.

7. The engine implementation method as described in claim 2, characterized in that, The method further includes: If there are blank cells in the cells corresponding to the column names of the dimension table and the fact table, fill the blank cells with default values ​​to obtain the dimension table and the fact table.

8. An engine implementation device, characterized in that, include: A module is established to create dimension tables and fact tables. The column names of the dimension tables include dimensions used to express matching conditions in business rules and scripts used to express execution logic in business rules. The column names of the fact tables include dimensions used to express matching conditions in business rules and measures used to express facts to be analyzed. The matching module is used to match the dimension table and the fact table based on the dimensions to obtain the matching result, including: reading the dimension table and the fact table; and performing an isojoin on the dimensions in the dimension table and the fact table through the calculation engine to obtain a result set, wherein the result set includes at least the measure and script corresponding to the isojoined dimension; The processing module is used to process the matching results to obtain a decision result, including: selecting a target metric and a target script from the metrics and scripts corresponding to the dimensions after equi-joining; and inputting the target metric and target script into the expression engine to obtain the decision result. The creation module is also used to construct the column names of the dimension table and the fact table; to determine the column names of the dimension table and the fact table; The establishment module is further configured to set all fields under all matching conditions as dimension fields, and the dimension fields constitute the dimension; set all fields used by all execution methods as metric fields, and the metric fields constitute the metric; set different execution methods under all matching conditions as script fields, and the script fields constitute the script; The establishment module is also used to enumerate all fields under all matching conditions; traverse all fields, and if the judgment condition of any field in all fields is an enumerated value, set the field as a dimension field; if the judgment condition of any field in all fields contains a non-enumerated value, convert the field to an enumerated value and set it as a dimension field.

9. The engine implementation apparatus as described in claim 8, characterized in that, The module is also used to match preset column names with column names in the dimension table and fact table; Import the preset business data into the cells corresponding to the column names in the dimension table and fact table; If there are no blank cells in the cells corresponding to the column names in the dimension table and the fact table, then the dimension table and the fact table are obtained.

10. The engine implementation apparatus as described in claim 9, characterized in that, The module is also used if the preset column names do not match the column names of the dimension table and the fact table; Adjust the column names of the dimension table and fact table according to the preset column names, and then perform the step of importing the preset business data into the cells corresponding to the column names of the dimension table and fact table.

11. The engine implementation apparatus as described in claim 10, characterized in that, The device also includes a first operation module, which is used to handle situations where the preset dimensions do not match the dimensions of the dimension table and the fact table. Based on preset dimensions, add or modify dimensions in the dimension table and fact table, and then import preset business data into the cells corresponding to the column names in the dimension table and fact table.

12. The engine implementation apparatus as described in claim 10, characterized in that, The device also includes a second operation module, which is used to handle situations where the preset metric does not match the metric in the fact table; Add or modify the measures in the fact table based on the preset measures, and then perform the steps of importing the preset business data into the cells corresponding to the column names in the dimension table and the fact table.

13. The engine implementation apparatus as described in claim 10, characterized in that, The device also includes a third operation module, which is used to handle situations where the preset script does not match the script in the dimension table; Based on the preset script, add or modify the script in the dimension table, and execute the steps to import the preset business data into the cells corresponding to the column names in the dimension table and fact table.

14. The engine implementation apparatus as described in claim 9, characterized in that, The device also includes a fourth operation module, which is used to fill blank cells with default values ​​if there are blank cells in the cells corresponding to the column names of the dimension table and the fact table, so as to obtain the dimension table and the fact table.

15. A terminal, characterized in that, Includes a memory, and one or more processors communicatively connected to the memory; The memory stores instructions that can be executed by the one or more processors to cause the one or more processors to implement the engine implementation method as described in any one of claims 1 to 7.

16. A computer-readable storage medium, characterized in that, Includes a program or instructions that, when run on a computer, implement the engine implementation method of any one of claims 1 to 7.

Citation Information

Patent Citations

  • Star data management and storage method and device, terminal equipment and storage medium

    CN112765168A