CN116401243A - Engine implementation method, device, terminal and storage medium - Google Patents

Engine implementation method, device, terminal and storage medium Download PDF

Info

Publication number
CN116401243A
CN116401243A CN202310156615.2A CN202310156615A CN116401243A CN 116401243 A CN116401243 A CN 116401243A CN 202310156615 A CN202310156615 A CN 202310156615A CN 116401243 A CN116401243 A CN 116401243A
Authority
CN
China
Prior art keywords
dimension
fact
column names
fields
fact table
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202310156615.2A
Other languages
Chinese (zh)
Inventor
宋志毅
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Hangzhou Netease Cloud Music Technology Co Ltd
Original Assignee
Hangzhou Netease Cloud Music Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Hangzhou Netease Cloud Music Technology Co Ltd filed Critical Hangzhou Netease Cloud Music Technology Co Ltd
Priority to CN202310156615.2A priority Critical patent/CN116401243A/en
Publication of CN116401243A publication Critical patent/CN116401243A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/22Indexing; Data structures therefor; Storage structures
    • G06F16/2282Tablespace storage structures; Management thereof
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/28Databases characterised by their database models, e.g. relational or object models
    • G06F16/283Multi-dimensional databases or data warehouses, e.g. MOLAP or ROLAP

Landscapes

  • Engineering & Computer Science (AREA)
  • Databases & Information Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Data Mining & Analysis (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Software Systems (AREA)
  • Stored Programmes (AREA)

Abstract

The application discloses an engine implementation method, an engine implementation device, a terminal and a storage medium, wherein the method comprises the following steps: establishing a dimension table and a fact table; matching the dimension table with the fact table according to the dimension to obtain a matching result; and processing the matching result to obtain a decision result. The invention establishes the structure of the business rule by matching the constructed dimension table and the fact table, processes the data in the structure based on the dimension, directly obtains the decision result, avoids high development and maintenance cost, and realizes the expression of the rule of the complex nested semantics. In addition, the dimension table and the fact table established by the invention can be directly multiplexed, thereby meeting different service demands.

Description

Engine implementation method, device, terminal and storage medium
Technical Field
The present invention relates to the field of computers, and in particular, to an engine implementation method, an engine implementation device, a terminal, and a storage medium.
Background
The engine technology is a component embedded in an application program, and is used for separating business decisions from application program codes, writing the business decisions by using a predefined semantic module, namely, receiving data input, interpreting the business and making business decisions according to the business.
Currently, engine implementations mainly employ hard-coding, i.e., the relevant parameters of the output or input (e.g., path, form or format of the output) are written directly in the source code in a constant manner.
However, in the process of implementing the engine, different codes need to be written according to different service requirements, and the method cannot be suitable for the different service requirements.
Disclosure of Invention
The main purpose of the application is to provide an engine implementation method, an engine implementation device, a terminal and a storage medium, so as to solve the problem that the existing engine implementation method cannot be suitable for different service demands.
To achieve the above object, in a first aspect, the present application provides an engine implementation method, including:
establishing a dimension table and a fact table;
matching the dimension table with the fact table according to the dimension to obtain a matching result;
and processing the matching result to obtain a decision result.
In one possible implementation, building a dimension table and a fact table includes:
constructing column names of a dimension table and a fact table;
and judging column names of the dimension table and the fact table, and determining the dimension table and the fact table.
In one possible implementation, the column names of the dimension tables include dimensions and scripts, and the column names of the fact tables include dimensions and metrics;
constructing column names of the dimension table and the fact table, including:
setting all fields under all matching conditions as dimension fields, and forming dimensions by the dimension fields;
setting fields used by all execution modes as measurement fields, and forming measurement by the measurement fields;
and setting different execution modes under all matching conditions as script fields, and forming a script by the script fields.
In one possible implementation, setting all fields under all matching conditions as dimension fields includes:
enumerating all fields under all matching conditions;
traversing all the fields, and setting any field as a dimension field if the judgment condition of any field in all the fields is an enumeration value;
if the judging condition of any field in all the fields contains a non-enumerated value, converting any field into an enumerated value and setting the enumerated value as a dimension field.
In one possible implementation, determining column names of the dimension table and the fact table to determine the dimension table and the fact table includes:
if the preset column names are matched with the column names of the dimension table and the fact table;
importing preset service data into cells corresponding to column names of a dimension table and a fact table;
and if the cells corresponding to the column names of the dimension table and the fact table have no blank cells, obtaining the dimension table and the fact table.
In one possible implementation, determining column names of the dimension table and the fact table to determine the dimension table and the fact table includes:
if the preset column names are not matched with the column names of the dimension table and the fact table;
and adjusting the column names of the dimension table and the fact table according to the preset column names, and executing the step of importing the preset service data into the cells corresponding to the column names of the dimension table and the fact table.
In one possible implementation, the method further includes:
if the preset dimension is not matched with the dimension of the dimension table and the dimension of the fact table;
and performing new addition or change operation on the dimensions of the dimension table and the fact table according to the preset dimensions, and executing the step of importing the preset service data into the cells corresponding to the column names of the dimension table and the fact table.
In one possible implementation, the method further includes:
if the preset measurement is not matched with the measurement of the fact table;
and performing new or changing operation on the measurement of the fact table according to the preset measurement, and executing the step of importing the preset business data into the dimension table and the cells corresponding to the column names of the fact table.
In one possible implementation, the method further includes:
if the preset script is not matched with the script of the dimension table;
and performing new adding or changing operation on the script of the dimension table according to the preset script, and executing the step of importing the preset business data into the cells corresponding to the column names of the dimension table and the fact table.
In one possible implementation, the method further includes:
and if the blank cells exist in the cells corresponding to the column names of the dimension table and the fact table, filling the blank cells by using a default value to obtain the dimension table and the fact table.
In one possible implementation, matching the dimension table and the fact table according to the dimension to obtain a matching result includes:
reading a dimension table and a fact table;
and performing equivalent connection on the dimensions in the dimension table and the fact table through a calculation engine to obtain a result set, wherein the result set at least comprises a measurement and a script corresponding to the equivalent-connected dimensions.
In one possible implementation, processing the matching result to obtain a decision result includes:
selecting a target measurement and a target script from the measurement and the script corresponding to the dimension after equivalent connection;
and inputting the target measurement and the target script into an expression engine to obtain a decision result.
In a second aspect, an embodiment of the present invention provides an engine implementation apparatus, including:
the building module is used for building a dimension table and a fact table;
the matching module is used for matching the dimension table with the fact table according to the dimension to obtain a matching result;
and the processing module is used for processing the matching result to obtain a decision result.
In a third aspect, an embodiment of the present invention provides a terminal, including a memory, a processor, and a computer program stored in the memory and executable on the processor, the processor implementing the steps of any one of the engine implementing methods described above when the computer program is executed by the processor.
In a fourth aspect, embodiments of the present invention provide a computer readable storage medium storing a computer program which, when executed by a processor, performs steps of a method of implementing any one of the engines described above.
The embodiment of the invention provides an engine implementation method, an engine implementation device, a terminal and a storage medium, wherein the engine implementation method comprises the following steps: firstly establishing a dimension table and a fact table, then matching the dimension table and the fact table according to the dimension to obtain a matching result, and then processing the matching result to obtain a decision result. The invention establishes the structure of the business rule by matching the constructed dimension table and the fact table, processes the data in the structure based on the dimension, directly obtains the decision result, avoids high development and maintenance cost, and realizes the expression of the rule of the complex nested semantics. In addition, the dimension table and the fact table established by the invention can be directly multiplexed, thereby meeting different service demands.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this application, are included to provide a further understanding of the application and to provide a further understanding of the application with regard to the other features, objects and advantages of the application. The drawings of the illustrative embodiments of the present application and their descriptions are for the purpose of illustrating the present application and are not to be construed as unduly limiting the present application. In the drawings:
fig. 1 is a schematic diagram of an application scenario of an engine implementation method provided in an embodiment of the present invention;
FIG. 2 is a flow chart of an engine implementation method according to an embodiment of the present invention;
FIG. 3 is a flow chart of an engine implementation method according to another embodiment of the present invention;
FIG. 4 is a schematic flow chart of creating dimension tables and fact tables according to an embodiment of the present invention;
FIG. 5 is a flow chart of a method for configuring dimensions in a dimension table and a fact table according to an embodiment of the present invention;
fig. 6 is a schematic structural diagram of an engine implementation device according to an embodiment of the present invention;
fig. 7 is a schematic diagram of a terminal according to an embodiment of the present invention.
Detailed Description
For the purpose of making the objects, technical solutions and advantages of the embodiments of the present invention more apparent, the technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present invention, and it is apparent that the described embodiments are only some embodiments of the present invention, not all embodiments. All other embodiments, which can be made by those skilled in the art based on the embodiments of the invention without making any inventive effort, are intended to be within the scope of the invention.
The terms "first," "second," "third," "fourth" and the like in the description and in the claims and in the above drawings, if any, are used for distinguishing between similar objects and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used may be interchanged where appropriate such that the embodiments of the invention described herein may be implemented in sequences other than those illustrated or otherwise described herein.
It should be understood that, in various embodiments of the present invention, the sequence number of each process does not mean that the execution sequence of each process should be determined by its functions and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present invention.
It should be understood that in the present invention, "comprising" and "having" and any variations thereof are intended to cover non-exclusive inclusion, such that a process, method, system, article, or apparatus that comprises a list of steps or elements is not necessarily limited to those steps or elements that are expressly listed or inherent to such process, method, article, or apparatus.
It should be understood that in the present invention, "plurality" means two or more. "and/or" is merely an association relationship describing an association object, and means that three relationships may exist, for example, and/or B may mean: a exists alone, A and B exist together, and B exists alone. The character "/" generally indicates that the context-dependent object is an "or" relationship. "comprising A, B and C", "comprising A, B, C" means that all three of A, B, C comprise, "comprising A, B or C" means that one of the three comprises A, B, C, and "comprising A, B and/or C" means that any 1 or any 2 or 3 of the three comprises A, B, C.
It should be understood that in the present invention, "B corresponding to a", "a corresponding to B", or "B corresponding to a" means that B is associated with a, from which B can be determined. Determining B from a does not mean determining B from a alone, but may also determine B from a and/or other information. The matching of A and B is that the similarity of A and B is larger than or equal to a preset threshold value.
As used herein, "if" may be interpreted as "at … …" or "at … …" or "in response to a determination" or "in response to detection" depending on the context.
The data related to the disclosure may be data authorized by a user or fully authorized by each party, and the collection, transmission, use, etc. of the data all conform to the requirements of national related laws and regulations, and the embodiments of the disclosure may be combined with each other.
The technical scheme of the invention is described in detail below by specific examples. The following embodiments may be combined with each other, and some embodiments may not be repeated for the same or similar concepts or processes.
For the purpose of making the objects, technical solutions and advantages of the present invention more apparent, the following description will be made by way of specific embodiments with reference to the accompanying drawings.
In order to facilitate understanding of the present solution, the words in the present application need to be explained as follows:
dimension modeling (dimensional modeling): a data modeling method in data warehouse construction is a logic design method for structuring data, which divides objective world into measurement and context, kimball first puts forward the concept, and the simplest description is to construct the data warehouse according to fact tables and dimension tables.
The fact table is used as the core of dimension modeling of the data warehouse, is designed around the business process, expresses the business process by acquiring the measurement describing the business process, and comprises the referenced dimension and the measurement related to the business process.
The dimension table may be viewed as a window for analyzing data, the dimension table containing characteristics of fact records in the fact data table, some of the characteristics providing descriptive information, some of the characteristics specifying how to aggregate the fact data table data to provide useful information to an analyst, the dimension table containing a hierarchy of characteristics that assist in aggregating the data.
Rule engine: rules are used as a knowledge, typically applied by the practice of drawing conclusions from a given set of rules. This conclusion may be a static result or a set of operations that need to be performed. The process of applying such rules is called reasoning. If the Inference process is handled by a program, then this program is called an Inference Engine (Inference Engine). The inference engine is the core module of an expert system (expert system is a branch of artificial intelligence). The control strategies adopted by the inference engine according to the knowledge representation are also different, and common types include neural network-based, case-based, and rule-based inference engines. Among them, rule-based inference engines are easy to understand, easy to obtain, easy to manage, and widely used. Such inference engines are referred to as "rule engines". In a rule engine, knowledge is expressed as rules, the conditions to be analyzed are defined as facts (facts), the rules and the facts are input parameters accepted by the rule engine, and the rule engine itself comprises three components: pattern Matcher (Pattern Matcher), agenda (Agenda), and Execution Engine (Execution Engine). The Pattern Matcher finds matched rules according to the patterns, and the Agenda manages the Execution sequence of rules selected by the Pattern Matcher, and the Execution Engine is responsible for executing specific operations according to the rules output by Agenda.
At present, the implementation of the rule engine is mainly realized by the following two methods, wherein the first method is as follows: the definition and execution of rules are implemented in the same piece of code logic as other program logic in a hard-coded manner. For developers, knowledge of the storage and parsing of rules is required, along with implementation of business logic and rule execution. The method has the defects that iteration cost is high, the whole business program needs to be developed, tested and deployed by new addition and change of rules, and especially for big data scenes, the test cost is very high; the maintainability is poor, the definition and execution of the rules are embedded in the code logic, and the iteration of the rules may cause other code change problems; the rules have no independent structured records, which is not beneficial to multiplexing and analysis of rule knowledge.
The second method is as follows: based on open source rule engines such as Drools, definition and execution of rules are separated from codes, reasoning processes are packaged into the rule engines for processing, and business systems can concentrate on logic processing of the business systems without paying excessive attention to rule judgment. The defect is mainly that rule management still cannot provide multiplexing and analysis; the grammar of the rule is only suitable for flat rules, for the rule of nested condition semantics, the condition can be configured after being subjected to Cartesian product combination, when the number of the condition becomes large, the number of the Cartesian product combination is multiplied, and the maintainability is poor; in a big data scene, for input parameters of the rule engine, the dimensions also need to be subjected to Cartesian product combination in a data warehouse to generate corresponding fact table measurement, and the iteration cost is high.
Therefore, based on the above problems, the present application proposes an engine implementation method.
Referring to fig. 1, fig. 1 is a schematic diagram of an application scenario of an engine implementation method according to an embodiment of the present application. As shown in fig. 1, a client 102 communicates with a server 104, the client 102 receives a service rule and sends the service rule to the server 104, the server 104 establishes a dimension table and a fact table corresponding to the service rule, then matches the dimension table and the fact table according to dimensions to obtain a matching result, and processes the matching result based on the service rule to obtain a service decision result.
Wherein the client 102 and the server 104 may communicate by any communication means, including but not limited to network communication, and the network may include but is not limited to: a wired network, a wireless network, wherein the wired network comprises: local area networks, metropolitan area networks, and wide area networks, the wireless network comprising: bluetooth, WIFI, and other networks that enable wireless communications. Wherein the client 102 includes, but is not limited to, at least one of: cell phones (e.g., android cell phones, iOS cell phones, etc.), notebook computers, tablet computers, palm computers, MIDs (Mobile Internet Devices ), PADs, desktop computers, smart televisions, etc. The server 104 may be a field server or a remote server, where the field server and the remote server may be implemented as separate servers or a service cluster formed by multiple servers. The above is merely an example, and is not limited in any way in the present embodiment.
Referring to fig. 2, fig. 2 is a flow chart of an engine implementation method according to an embodiment of the present application. As shown in fig. 2, the method is applied to the server 104 shown in fig. 1, and includes the following steps:
step S201: and establishing a dimension table and a fact table.
Wherein the dimension table includes dimensions and scripts and the fact table includes dimensions and metrics.
In connection with fig. 3, when a dimension table and a fact table are applied to a rule or a business rule, a dimension table rule and a fact table fact corresponding to the rule or the business rule need to be established. Wherein the rules may be any rules, not limited to business rules, including but not limited to financial settlement, securities trading, and the like.
When the dimension table of the business rule is established, the condition matching part of the business rule is used as a dimension, the executing part is used as an attribute, and the dimension table in dimension modeling is organized, wherein a single condition in the business rule corresponds to a single dimension dim, such as dim1, dim2, dim3 and the like, the nesting condition corresponds to a dimension combination, and the executing part corresponds to script, such as script1, script2 and the like, which can be directly executed by an expression engine.
When the fact table of the business rule is established, the condition matching part of the business rule is taken as a dimension, the executing part is taken as an attribute, and the business rule is organized into a dimension table in dimension modeling, wherein a single condition in the business rule corresponds to a single dimension, such as dim1, dim2, dim3 and the like, and a nested condition corresponds to a dimension combination and simultaneously comprises measures mes in the fact that the rule needs to analyze, such as mes1, mes2, mes3 and the like.
And establishing the dimension table and the fact table, namely firstly establishing column names of the dimension table and the fact table, then judging the column names of the dimension table and the fact table, and determining the dimension table and the fact table.
The list names of dimension tables and fact tables are exhausted as much as possible because the dimension tables and fact tables need to meet different business rule requirements. In connection with fig. 4, WHEN column names of the dimension table and the fact table are constructed, all fields under all matching conditions (such as IF/WHEN statement) of all rules need to be set as dimension fields, and dimensions are formed by the dimension fields; setting fields used by all execution modes as measurement fields, and forming measurement by the measurement fields; setting different execution modes under all matching conditions of all rules as script fields, and forming scripts by the script fields.
In the process of setting the dimension fields, all fields (such as fact fields) under all matching conditions of all rules need to be enumerated first, then all fields are traversed, if the judging condition of any field in all fields is an enumerated value, any field is set as the dimension field, and if the judging condition of any field in all fields contains a non-enumerated value, any field is converted into an enumerated value and is set as the dimension field.
Let fact field be f= { F1, F2, F3..}, then traverse each field in F, if the judging condition of field F1 is an enumerated value, directly set the field to dimension dim (F1), if the judging condition of field F2 contains a non-enumerated value, change the judging condition of the original field F2 to the judging condition of the converted field F2', and the judging condition of field F2' is an enumerated value, and set it to dimension dim (F2 '). And the other fact fields are analogized in sequence, so that the setting of the dimension field can be realized.
After the column names of the dimension table and the fact table are set, the column names of the dimension table and the fact table need to be judged based on the specific business rule to determine the dimension table and the fact table corresponding to the business rule, wherein when aiming at the specific business rule, the preset column names, the preset business data, the preset dimension, the preset script and the preset measurement can be respectively the column names, the business data, the dimension, the script and the measurement corresponding to the specific business rule.
Specifically, whether the column names corresponding to the business rule are matched with the column names of the dimension table and the fact table is required to be judged, namely if the preset column names are matched with the column names of the dimension table and the fact table, the preset business data are imported into the cells corresponding to the column names of the dimension table and the fact table, if no blank cells are arranged in the cells corresponding to the column names of the dimension table and the fact table, the dimension table and the fact table are obtained, if blank cells are arranged in the cells corresponding to the column names of the dimension table and the fact table, the blank cells are filled with default values, and the dimension table and the fact table are obtained; and if the preset column names are not matched with the column names of the dimension table and the fact table, adjusting the column names of the dimension table and the fact table according to the preset column names, and executing the step of importing the preset service data into the cells corresponding to the column names of the dimension table and the fact table.
If the business rule is financial settlement, dimensions dim1 and dim2 are required to be configured in a dimension table corresponding to the financial settlement, scripts 1 and scripts 2 are required to be configured in a fact table corresponding to the financial settlement, dimensions dim1 and dim2 and metrics mes1 and mes2 are required to be configured in a fact table corresponding to the financial settlement, and column names of the dimension table and the fact table corresponding to the financial settlement can be matched with column names of the existing dimension table and the existing fact table. If the existing dimension table includes dimensions dim1, dim2, dim3 and script1, script2, script3, and the fact table includes dimensions dim1, dim2, dim3 and metrics mes1, mes2, mes3, it is known that the column names of the existing fact table and dimension table include the column names of the fact table and dimension table corresponding to the financial settlement by matching the fact table and dimension table corresponding to the financial settlement with the existing fact table and dimension table, and that the matching is successful is described, the service data corresponding to the financial settlement can be imported into the dimensions dim1, dim2 and script1, script2 of the existing dimension table, the dimensions dim1, dim2 and metrics 1, mes2 of the fact table.
After the business data corresponding to the financial settlement is imported, if any column of corresponding cells in the dimension, the script and the measurement is blank, filling can be performed by adopting a default value corresponding to the financial settlement.
Because the column names of the dimension table and the fact table comprise dimensions, scripts and metrics, the column names of the dimension table and the fact table comprise dimensions, scripts and metrics corresponding to specific business rules, respectively, are required to be matched, and if any of the dimension table and the fact table comprise dimensions, scripts and metrics, corresponding new addition or change operations are required to be performed. Wherein, the change is any operation except the new addition, such as deletion, replacement, modification and the like.
Specifically, referring to fig. 5, if the preset dimension is not matched with the dimension of the dimension table and the dimension of the fact table, performing a new addition or modification operation on the dimension of the dimension table and the dimension of the fact table according to the preset dimension, and executing a step of importing preset service data into cells corresponding to column names of the dimension table and the fact table.
If the business rule is financial settlement, and the dimension table corresponding to the financial settlement needs to be configured with metrics mes1 and mes2, and if the existing dimension table comprises metrics mes3 and mes4, and when the dimension table corresponding to the financial settlement is matched with the existing dimension table, the dimension table corresponding to the financial settlement is not matched with the existing dimension table, the existing dimension table needs to be changed, and any two of the existing dimensions dim3, dim4 and dim5 can be changed to dim1 and dim2.
When dim3 and dim4 in the existing dimensions dim3, dim4 and dim5 are changed to dim1 and dim2, the existing dimensions dim1, dim2 and dim5 are changed, and then the service data corresponding to the financial settlement is only required to be imported into the existing dimensions dim1 and dim2.
If the cells under the dimensions dim1 and dim2 are blank after the business data corresponding to the financial settlement are imported into the existing dimensions dim1 and dim2, filling can be performed by adopting a default value corresponding to the financial settlement. The default value corresponding to the financial settlement is not particularly limited here, and may be set based on the specific case.
And if the preset measurement is not matched with the measurement of the fact table, performing new addition or change operation on the measurement of the fact table according to the preset measurement, and executing the step of importing the preset service data into the cells corresponding to the column names of the dimension table and the fact table.
If the existing fact table includes metrics mes1 and mes3, and when the fact table corresponding to the financial settlement is matched with the existing fact table, the fact table corresponding to the financial settlement is not matched with the existing fact table, the existing fact table needs to be changed, and the metric dim2 can be newly added in the existing metrics mes1 and mes 3.
When the existing measurement mes1 and mes3 is newly added with the measurement mes2, after the existing fact table is changed into the measurement mes1, mes2 and mes3, only the business data corresponding to the financial settlement is imported into the existing measurement mes1 and mes 2.
If the cells under the metrics mes1 and mes2 are blank after the business data corresponding to the financial settlement are imported into the existing metrics mes1 and mes2, the default values corresponding to the financial settlement can be adopted for filling.
If the preset script is not matched with the script of the dimension table, performing new adding or changing operation on the script of the dimension table according to the preset script, and executing the step of importing the preset service data into the cells corresponding to the column names of the dimension table and the fact table.
If the business rule is financial settlement, the dimension table corresponding to the financial settlement needs to be configured with script1, script2 and script3, and if the existing dimension table comprises script1 and script2, when the dimension table corresponding to the financial settlement is matched with the existing dimension table, the dimension table corresponding to the financial settlement is not matched with the existing dimension table, the existing dimension table needs to be changed, and script3 can be newly added in the existing script1 and script 2.
When script3 is newly added to existing script1, script2, the existing dimension table is changed into script1, script2, script3, and then only the business data corresponding to financial settlement is required to be imported into the existing script1, script2, script3.
If the unit cell under the script1, the script2 and the script3 is blank after the business data corresponding to the financial settlement is imported into the existing script1, the script2 and the script3, the default value corresponding to the financial settlement can be adopted for filling.
It should be noted that, each column name in the dimensions, scripts and metrics corresponds to a cell, and the corresponding cell is only required to be filled based on the column name.
Step S202: and matching the dimension table with the fact table according to the dimension to obtain a matching result.
Rule matching in the present application is accomplished by a computation engine, such as Spark, hive, flink, that associates fact tables with dimension tables through dimensions.
Specifically, the dimension table and the fact table need to be read first, and then the dimension in the dimension table and the dimension in the fact table are subjected to equivalent connection through the calculation engine to obtain a result set, wherein the result set at least comprises metrics and scripts corresponding to the equivalent-connected dimension.
Setting a dimension table to include a dimension dim1, script1 and script2, setting a fact table to include a dimension dim2, measuring mes1 and mes2, and setting a field a, b and c in a cell corresponding to dim1 and a field a, b and c in a cell corresponding to dim2, wherein the dimension dim1 in the dimension table and the dimension dim2 in the fact table can be subjected to equivalent connection, namely, a dimension dim3 after equivalent connection is formed, and the corresponding cell includes the fields a, b and c.
Script1 and script2 and metrics 1 and mes2 corresponding to the dimension dim3 after equivalent connection are selected from the dimension table and the fact table respectively to form a result set.
Step S203: and processing the matching result to obtain a decision result.
And the result set after the association matching is submitted to an execution engine to execute specific operation, a target measurement and a target script are selected from the measurement and the script corresponding to the dimension after the equivalent connection through an expression engine such as Aviator, OGNL, QLExpress, and then the target measurement and the target script are input into the expression engine to obtain a decision result.
If the expression engine is a specific expression, for example, the decision result=dimension+measure+script, then, since the dimension dim3 after equivalent connection includes fields a, b and c, the fields a, b and c are matched with the corresponding script1, script2 and the fields in the measures mes1 and mes2 in the dimension dim3 after equivalent connection, if the matched measures are e, f and g and the script is d, f and g, then, the decision result is a+e+d, b+f+f and c+g+g can be obtained through the expression.
The embodiment of the invention provides an engine implementation method, which comprises the following steps: firstly establishing a dimension table and a fact table, then matching the dimension table and the fact table according to the dimension to obtain a matching result, and then processing the matching result to obtain a decision result. The invention establishes the structure of the business rule by matching the constructed dimension table and the fact table, processes the data in the structure based on the dimension, directly obtains the decision result, avoids high development and maintenance cost, and realizes the expression of the rule of the complex nested semantics. In addition, the dimension table and the fact table established by the invention can be directly multiplexed, thereby meeting different service demands.
It should be understood that the sequence number of each step in the foregoing embodiment does not mean that the execution sequence of each process should be determined by the function and the internal logic, and should not limit the implementation process of the embodiment of the present invention.
The following are device embodiments of the invention, for details not described in detail therein, reference may be made to the corresponding method embodiments described above.
Fig. 6 shows a schematic structural diagram of an engine implementation device according to an embodiment of the present invention, and for convenience of explanation, only a portion related to the embodiment of the present invention is shown, where the engine implementation device includes a building module 601, a matching module 602, and a processing module 603, and specifically includes the following steps:
a building module 601, configured to build a dimension table and a fact table;
the matching module 602 is configured to match the dimension table with the fact table according to the dimension, so as to obtain a matching result;
and the processing module 603 is configured to process the matching result to obtain a decision result.
In one possible implementation, the building module 601 is further configured to build column names of the dimension table and the fact table;
and judging column names of the dimension table and the fact table, and determining the dimension table and the fact table.
In one possible implementation, the column names of the dimension tables include dimensions and scripts, and the column names of the fact tables include dimensions and metrics;
the establishing module 601 is further configured to set all fields under all matching conditions as dimension fields, and form dimensions by the dimension fields;
setting fields used by all execution modes as measurement fields, and forming measurement by the measurement fields;
and setting different execution modes under all matching conditions as script fields, and forming a script by the script fields.
In one possible implementation, the establishing module 601 is further configured to enumerate all fields under all matching conditions;
traversing all the fields, and setting any field as a dimension field if the judgment condition of any field in all the fields is an enumeration value;
if the judging condition of any field in all the fields contains a non-enumerated value, converting any field into an enumerated value and setting the enumerated value as a dimension field.
In one possible implementation manner, the establishing module 601 is further configured to match a preset column name with a column name of the dimension table and the fact table;
importing preset service data into cells corresponding to column names of a dimension table and a fact table;
and if the cells corresponding to the column names of the dimension table and the fact table have no blank cells, obtaining the dimension table and the fact table.
In one possible implementation manner, the establishing module 601 is further configured to if the preset column name does not match the column names of the dimension table and the fact table;
and adjusting the column names of the dimension table and the fact table according to the preset column names, and executing the step of importing the preset service data into the cells corresponding to the column names of the dimension table and the fact table.
In one possible implementation manner, the device further includes a first operation module, where the first operation module is configured to, if the preset dimension is not matched with the dimensions of the dimension table and the fact table;
and performing new addition or change operation on the dimensions of the dimension table and the fact table according to the preset dimensions, and executing the step of importing the preset service data into the cells corresponding to the column names of the dimension table and the fact table.
In one possible implementation manner, the device further comprises a second operation module, where the second operation module is configured to, if the preset metric does not match the metric of the fact table;
and performing new or changing operation on the measurement of the fact table according to the preset measurement, and executing the step of importing the preset business data into the dimension table and the cells corresponding to the column names of the fact table.
In one possible implementation manner, the device further includes a third operation module, where the third operation module is configured to, if the preset script is not matched with the script of the dimension table;
and performing new adding or changing operation on the script of the dimension table according to the preset script, and executing the step of importing the preset business data into the cells corresponding to the column names of the dimension table and the fact table.
In one possible implementation manner, the device further includes a fourth operation module, where the fourth operation module is configured to fill the blank cells with a default value if the blank cells exist 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.
In one possible implementation, the matching module 602 is further configured to read the dimension table and the fact table;
and performing equivalent connection on the dimensions in the dimension table and the fact table through a calculation engine to obtain a result set, wherein the result set at least comprises a measurement and a script corresponding to the equivalent-connected dimensions.
In one possible implementation, the processing module 603 is further configured to select a target metric and a target script from metrics and scripts corresponding to the dimensions after equivalent connection;
and inputting the target measurement and the target script into an expression engine to obtain a decision result.
Fig. 7 is a schematic diagram of a terminal according to an embodiment of the present invention. As shown in fig. 7, the terminal 7 of 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. The processor 701, when executing the computer program 703, implements the steps of the various engine implementation method embodiments described above, such as steps 201-203 shown in fig. 2. Alternatively, the processor 701, when executing the computer program 703, implements the functions of the modules/units in the respective engine implementation device embodiments described above, for example, the functions of the modules/units 601 to 603 shown in fig. 6.
The present invention also provides a readable storage medium having a computer program stored therein, which when executed by a processor is configured to implement the engine implementation method provided in the above various embodiments.
The readable storage medium may be a computer storage medium or a communication medium. Communication media includes any medium that facilitates transfer of a computer program from one place to another. Computer storage media can be any available media that can be accessed by a general purpose or special purpose computer. For example, a readable storage medium is coupled to the processor such that the processor can read information from, and write information to, the readable storage medium. In the alternative, the readable storage medium may be integral to the processor. The processor and the readable storage medium may reside in an application specific integrated circuit (Application Specific Integrated Circuits, ASIC for short). In addition, the ASIC may reside in a user device. The processor and the readable storage medium may reside as discrete components in a communication device. The readable storage medium may be read-only memory (ROM), random-access memory (RAM), CD-ROMs, magnetic tape, floppy disk, optical data storage device, etc.
The present invention also provides a program product comprising execution instructions stored in a readable storage medium. The at least one processor of the device may read the execution instructions from the readable storage medium, and execution of the execution instructions by the at least one processor causes the device to implement the engine-implemented methods provided by the various embodiments described above.
In the above embodiment of the apparatus, it should be understood that the processor may be a central processing unit (english: central Processing Unit, abbreviated as CPU), or may be other general purpose processors, digital signal processors (english: digital Signal Processor, abbreviated as DSP), application specific integrated circuits (english: application Specific Integrated Circuit, abbreviated as ASIC), or the like. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like. The steps of a method disclosed in connection with the present invention may be embodied directly in a hardware processor for execution, or in a combination of hardware and software modules in a processor for execution.
The above embodiments are only for illustrating the technical solution of the present invention, and are not limiting; although the invention has been described in detail with reference to the foregoing embodiments, it will be understood by those of ordinary skill in the art that: the technical scheme described in the foregoing embodiments can be modified or some technical features thereof can be replaced by equivalents; such modifications and substitutions do not depart from the spirit and scope of the technical solutions of the embodiments of the present invention.

Claims (10)

1. An engine implementation method, comprising:
establishing a dimension table and a fact table;
matching the dimension table with the fact table according to the dimension to obtain a matching result;
and processing the matching result to obtain a decision result.
2. The engine implementation method of claim 1, wherein the building of the dimension table and the fact table comprises:
constructing column names of the dimension table and the fact table;
and judging column names of the dimension table and the fact table, and determining the dimension table and the fact table.
3. The engine implementation of claim 2, wherein the column names of the dimension tables include dimensions and scripts, and wherein the column names of the fact tables include dimensions and metrics;
the constructing column names of the dimension table and the fact table comprises the following steps:
setting all fields under all matching conditions as dimension fields, and forming the dimension by the dimension fields;
setting fields used by all execution modes as measurement fields, and forming the measurement by the measurement fields;
setting different execution modes under all matching conditions as script fields, and forming the script by the script fields.
4. The engine implementation method of claim 3, wherein setting all fields under all matching conditions as dimension fields comprises:
enumerating all fields under all matching conditions;
traversing all the fields, and setting any field as a dimension field if the judging condition of any field in all the fields is an enumerated value;
if the judging condition of any field in all the fields contains a non-enumerated value, converting any field into an enumerated value and setting the enumerated value as a dimension field.
5. The engine implementation of claim 2, wherein said determining column names of said dimension tables and fact tables to determine said dimension tables and fact tables comprises:
if the preset column names are matched with the column names of the dimension table and the fact table;
importing preset service data into cells corresponding to column names of the dimension table and the fact table;
and if the cells corresponding to the column names of the dimension table and the fact table have no blank cells, obtaining the dimension table and the fact table.
6. The engine implementation of claim 5, wherein said determining column names of said dimension tables and fact tables to determine said dimension tables and fact tables comprises:
if the preset column names are not matched with the column names of the dimension table and the fact table;
and adjusting the column names of the dimension table and the fact table according to the preset column names, and executing the step of importing the preset service data into the cells corresponding to the column names of the dimension table and the fact table.
7. The engine implementation method of claim 6, wherein the method further comprises:
if the preset dimension is not matched with the dimension of the dimension table and the fact table;
and performing new or changed operation on the dimensions of the dimension table and the fact table according to the preset dimensions, and executing the step of importing the preset service data into the cells corresponding to the column names of the dimension table and the fact table.
8. An engine implementation apparatus, comprising:
the building module is used for building a dimension table and a fact table;
the matching module is used for matching the dimension table with the fact table according to the dimension to obtain a matching result;
and the processing module is used for processing the matching result to obtain a decision result.
9. A terminal comprising a memory and one or more processors communicatively coupled to the memory;
stored in the memory are instructions executable by the one or more processors to cause the one or more processors to implement the engine implementation method of any one of claims 1 to 7.
10. A computer readable storage medium comprising a program or instructions which, when run on a computer, implement the engine implementation method of any of claims 1 to 7.
CN202310156615.2A 2023-02-17 2023-02-17 Engine implementation method, device, terminal and storage medium Pending CN116401243A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202310156615.2A CN116401243A (en) 2023-02-17 2023-02-17 Engine implementation method, device, terminal and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202310156615.2A CN116401243A (en) 2023-02-17 2023-02-17 Engine implementation method, device, terminal and storage medium

Publications (1)

Publication Number Publication Date
CN116401243A true CN116401243A (en) 2023-07-07

Family

ID=87011320

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202310156615.2A Pending CN116401243A (en) 2023-02-17 2023-02-17 Engine implementation method, device, terminal and storage medium

Country Status (1)

Country Link
CN (1) CN116401243A (en)

Similar Documents

Publication Publication Date Title
CN103336790B (en) Hadoop-based fast neighborhood rough set attribute reduction method
CN107644323B (en) Intelligent auditing system for business flow
US20160034547A1 (en) Systems and methods for an sql-driven distributed operating system
CN103336791B (en) Hadoop-based fast rough set attribute reduction method
US20130304713A1 (en) System and method for metadata level validation of custom setup objects
US20150220332A1 (en) Resolving merge conflicts that prevent blocks of program code from properly being merged
US10733517B2 (en) Decision service
US20220100963A1 (en) Event extraction from documents with co-reference
CN107943945A (en) Isomery operator management method in a kind of big data analysis development platform
US20220100772A1 (en) Context-sensitive linking of entities to private databases
CN110955801B (en) Knowledge graph analysis method and system for cognos report indexes
US20190235984A1 (en) Systems and methods for providing predictive performance forecasting for component-driven, multi-tenant applications
JP2023538923A (en) Techniques for providing explanations about text classification
US11783221B2 (en) Data exposure for transparency in artificial intelligence
Omori et al. Comparing concept drift detection with process mining tools
KR20210103834A (en) Method and Apparatus for Demand Expectation Based on Machine Learning
CN108711074B (en) Service classification method, device, server and readable storage medium
CN116401243A (en) Engine implementation method, device, terminal and storage medium
CN116701091A (en) Method, electronic device and computer program product for deriving logs
US11501183B2 (en) Generating a recommendation associated with an extraction rule for big-data analysis
CN114281549A (en) Data processing method and device
CN109902831B (en) Service decision processing method and device
CN111784503B (en) Operation rendering method, system and storage medium of communication credit investigation data
US11797577B2 (en) Smart data warehouse for cloud-based reservoir simulation
US20220309384A1 (en) Selecting representative features for machine learning models

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination