Efficient processing method for nested cross calculation under multiple rules
By building a data processing interface and a computing engine, the problem of redundant calculations in nested multi-rule calculations was solved, improving computing performance and reducing system costs.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- SHANGHAI GLORYSOFT CO LTD
- Filing Date
- 2023-02-08
- Publication Date
- 2026-04-21
AI Technical Summary
In multi-rule nesting or cross-calculation, there are problems such as repeated calculations consuming computing power, high cost of expression transformation calculation instances, and low computing performance.
By constructing data processing interfaces, expression classes, rule label expressors, and a calculation engine, we can achieve pre-parsing configuration, reuse, and calculation path planning of expressions, share unit calculation results, and reduce redundant calculations.
It minimizes redundant calculations, improves data computing performance under multi-rule conditions, reduces system costs, and enhances user experience.
Smart Images

Figure CN116795331B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of data analysis technology, specifically to an efficient processing method for nested cross-calculation under multiple rules. Background Technology
[0002] In the field of computer application development, it is common to encounter situations where multiple rules are used for the same business data, with nested or intersecting rules involving multiple unit calculations to confirm the final result. Examples include specification control in the industrial sector, risk control rule engines in the financial industry, and alarm logic under various business or system monitoring. The industry's typical solution is to divide the data into the smallest computational units according to business logic, then express these units using expressions, and finally perform calculations on a unit-by-unit basis according to actual business needs. This approach suffers from several drawbacks: redundant calculations consume computing power; the cost of converting expressions into computational instances is high; and computational performance is low. Summary of the Invention
[0003] This invention provides an efficient processing method for nested cross-calculation under multiple rules. Its purpose is to minimize the redundant calculations caused by nested cross-calculation on a range dataset by pre-parsing and configuring expressions, reusing them, planning calculation paths, and sharing results with uniqueness in unit calculations.
[0004] This application is achieved through the following technical solution:
[0005] An efficient method for nested cross-calculation under multiple rules includes the following steps:
[0006] (1) Construct a data processing interface HandleInteface, which includes two methods: handleSingle for single elements and handleMany for multiple elements.
[0007] (2) Define the computing units required by the business according to the HandleInterface interface specification, and complete the business logic;
[0008] (3) Construct the Expression class, and construct two constructors with parameters respectively: a data container map, a computation interface HandleInteface, a single key, and a set of keys.
[0009] (4) Construct a rule expression generator Rules, which contains an ordered collection of Expression instances;
[0010] (5) Construct an expression generator RuleBuilder. The construction method buildRuleInstance takes a string expression as a parameter. It parses the passed string rule expression set by "()" in layers and finally generates a Rule.
[0011] (6) Construct a dataset accessor DataConventor, construct a single data receiving method onlyOne, and construct a multiple data receiving method putMany. In both methods, construct a data container map, put the input data into the data container, and return it.
[0012] (7) Construct the computing engine Runer, construct a multi-threaded processor, in the thread Task, the run method accepts a business type and business data. If the business type rule is not instantiated, read the rule string expression from the configuration table.
[0013] In a preferred embodiment, the parameters of handleSingle in step (1) include source data key, target data key, and data container map.
[0014] In a preferred embodiment, the parameters of handleMany in step (1) include the source data key set, the target key, and the data container map.
[0015] In a preferred embodiment, the calculation method used by the calculation unit in step (2) is four arithmetic operations, square root, square, log, sine, and cosine.
[0016] In a preferred embodiment, the set of string rules expressed in step (5) requires that the calculation unit and the initial parameter marker must be separated by "()".
[0017] As a preferred embodiment, the specific operation of step (7) is as follows: generate rules through RuleBuilder, then loop through the expressions in rules, use DataConventor to transform the data, execute it for each Expression instance, and finally return the desired result of the rule set.
[0018] Beneficial Effects: This invention's efficient processing method for nested cross-calculation under multiple rules minimizes redundant calculations caused by nested cross-calculation on a range of datasets through pre-parsing and reusing expressions, computation path planning, and unique result sharing in unit calculations. This maximizes the processing performance of data computation under multiple rules, thereby effectively reducing application system costs and improving the real-time experience for end users. Attached Figure Description
[0019] Figure 1This is a business process diagram of the efficient processing method for nested cross-calculation under multiple rules according to the present invention. Detailed Implementation
[0020] The embodiments of the present invention will be described in detail below with reference to the accompanying drawings: These embodiments are implemented based on the technical solution of the present invention, and provide detailed implementation methods and specific operation processes, but the protection scope of the present invention is not limited to the following embodiments.
[0021] like Figure 1 As shown, the efficient processing method for nested cross-calculation under multiple rules includes the following steps:
[0022] (1) Construct a data processing interface HandleInteface, which includes two methods: handleSingle for single elements and handleMany for multiple elements. The parameters of handleSingle are source data key, target data key, and data container map. The parameters of handleMany are source data key set, target key, and data container map.
[0023] (2) Define the computing units required by the business according to the HandleInterface interface specification, and complete the business logic;
[0024] The calculation methods used by the calculation unit in step (2) are four arithmetic operations, square root, square, log, sine, and cosine.
[0025] (3) Construct the Expression class, and construct two constructors with parameters respectively: a data container map, a computation interface HandleInteface, a single key, and a set of keys.
[0026] (4) Construct a rule expression generator Rules, which contains an ordered collection of Expression instances;
[0027] (5) Construct an expression generator RuleBuilder. The construction method buildRuleInstance takes a string expression as a parameter. It parses the passed string rule expression set (the rule expression requires that the calculation unit and the initial parameter mark must be separated by "()") in layers according to "()" and finally generates a Rule.
[0028] (6) Construct a dataset accessor DataConventor, construct a single data receiving method onlyOne, and construct a multiple data receiving method putMany. In both methods, construct a data container map, put the input data into the data container, and return it.
[0029] (7) Construct the computing engine Runner, which is a multi-threaded processor. In the thread Task, the run method accepts a business type and business data. If the business type rule is not instantiated, it reads the rule string expression from the configuration table. Specifically, it generates rules through RuleBuilder, then loops through the expressions in rules, uses DataConventor to transform the data, executes it for each Expression instance, and finally returns the desired result of the rule set.
[0030] The foregoing has shown and described the basic principles, main features, and advantages of the present invention. Those skilled in the art should understand that the present invention is not limited to the above embodiments. The embodiments and descriptions in the specification are merely illustrative of the principles of the invention. Various changes and modifications can be made to the invention without departing from its spirit and scope, and all such changes and modifications fall within the scope of the present invention as claimed. The scope of protection of this invention is defined by the appended claims and their equivalents.
Claims
1. A method for efficient processing of nested cross-calculation under multiple rules, characterized in that, Includes the following steps: (1) Construct a data processing interface HandleInteface, which includes two methods: handleSingle for single elements and handleMany for multiple elements. (2) According to the HandleInterface interface specification, define the computing units required by the business and complete the business logic; (3) Construct the Expression class, construct two constructors, with parameters being the data container map, the computation interface HandleInteface, a single key, and a set of keys respectively; (4) Construct a rule-based expression constructor (Rules) containing an ordered set of Expression instances; (5) Construct an expression generator RuleBuilder. The construction method buildRuleInstance takes a string expression as a parameter. It parses the passed string rule expression set in layers according to "()" and finally generates a Rule. (6) Construct a dataset accessor DataConventor, construct a single data receiving method onlyOne, and a multiple data receiving method putMany. In both methods, construct a data container map, put the input data into the data container, and return it. (7) Construct the computing engine Runer, construct a multi-threaded processor, in the thread Task, the run method accepts a business type and business data. If the business type rule is not instantiated, read the rule string expression from the configuration table.
2. The efficient processing method for nested cross-calculation under multiple rules as described in claim 1, characterized in that, In step (1), the parameters of handleSingle include source data key, target data key, and data container map.
3. The efficient processing method for nested cross-calculation under multiple rules as described in claim 1, characterized in that, In step (1), the parameters of handleMany include the source data key set, the target key, and the data container map.
4. The efficient processing method for nested cross-calculation under multiple rules according to claim 1, characterized in that, The calculation methods used by the calculation unit in step (2) are four arithmetic operations, square root, square, log, sine, and cosine.
5. The efficient processing method for nested cross-calculation under multiple rules according to claim 1, characterized in that, In step (5), the input string rule expression set is required. The rule expression requires that the calculation unit and the initial parameter mark must be separated by "()".
6. The efficient processing method for nested cross-calculation under multiple rules according to claim 1, characterized in that, The specific operation of step (7) is as follows: generate rules through RuleBuilder, then loop through the expressions in the rules, use DataConventor to transform the data, execute it for each Expression instance, and finally return the desired result of the rule set.
Citation Information
Patent Citations
Data algorithm model test method and system and computer storage medium
CN112989606A
Expression processing method and device, electronic equipment and computer readable storage medium
CN114611500A