CN117573186A - Rule engine efficiency optimization method and device based on Drools and electronic equipment - Google Patents

Rule engine efficiency optimization method and device based on Drools and electronic equipment Download PDF

Info

Publication number
CN117573186A
CN117573186A CN202311585348.7A CN202311585348A CN117573186A CN 117573186 A CN117573186 A CN 117573186A CN 202311585348 A CN202311585348 A CN 202311585348A CN 117573186 A CN117573186 A CN 117573186A
Authority
CN
China
Prior art keywords
rule
node
condition
drools
conditions
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
CN202311585348.7A
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.)
Beijing Zhonghaitong Technology Co ltd
Original Assignee
Beijing Zhonghaitong 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 Beijing Zhonghaitong Technology Co ltd filed Critical Beijing Zhonghaitong Technology Co ltd
Priority to CN202311585348.7A priority Critical patent/CN117573186A/en
Publication of CN117573186A publication Critical patent/CN117573186A/en
Pending legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/70Software maintenance or management
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F18/00Pattern recognition
    • G06F18/20Analysing
    • G06F18/22Matching criteria, e.g. proximity measures
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06QINFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
    • G06Q10/00Administration; Management
    • G06Q10/06Resources, workflows, human or project management; Enterprise or organisation planning; Enterprise or organisation modelling
    • G06Q10/063Operations research, analysis or management
    • G06Q10/0635Risk analysis of enterprise or organisation activities

Landscapes

  • Engineering & Computer Science (AREA)
  • Business, Economics & Management (AREA)
  • Theoretical Computer Science (AREA)
  • Human Resources & Organizations (AREA)
  • General Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Strategic Management (AREA)
  • Data Mining & Analysis (AREA)
  • Software Systems (AREA)
  • Entrepreneurship & Innovation (AREA)
  • Economics (AREA)
  • Educational Administration (AREA)
  • Bioinformatics & Computational Biology (AREA)
  • Life Sciences & Earth Sciences (AREA)
  • Evolutionary Biology (AREA)
  • Development Economics (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Artificial Intelligence (AREA)
  • Evolutionary Computation (AREA)
  • Game Theory and Decision Science (AREA)
  • Bioinformatics & Cheminformatics (AREA)
  • Marketing (AREA)
  • Operations Research (AREA)
  • Quality & Reliability (AREA)
  • Tourism & Hospitality (AREA)
  • General Business, Economics & Management (AREA)
  • Management, Administration, Business Operations System, And Electronic Commerce (AREA)

Abstract

The application relates to a rule engine efficiency optimization method and device based on Drools and electronic equipment. The method can solve the risk decision problem in the complex business field, reduce the influence of Cartesian products in the rule execution process and integrally improve the rule execution efficiency.

Description

Rule engine efficiency optimization method and device based on Drools and electronic equipment
Technical Field
The present application relates to the field of rule engine algorithms, and in particular, to a rule engine efficiency optimization method and apparatus based on Drools, and an electronic device.
Background
At the heart of the rule engine is a rule matching algorithm, a common rule matching algorithm including PHREAK, RETE, LFA, TREAI, LEAPS. Among them, the RETE algorithm was originally an algorithm described in the paper published in 1974 by Charles L.Forgy doctor, university of Carcinyl Mercury, which provides an efficient implementation of expert systems, and is widely used in the Rules engine projects of Drools, ILog, jess, JBoss Rules, etc. The RETE algorithm is a pattern matching algorithm which utilizes time redundancy and structural similarity in a rule engine, utilizes the structural similarity of constraint rules to reduce time expenditure, calculates parts with the same structure only once, and improves reasoning efficiency by saving intermediate processes and pattern sharing.
In the field of complex risk decision service, risk research and judgment are required to be carried out on a rule tree in a multi-way tree form aiming at a comprehensive service object containing multiple data entities, but a Drools rule engine does not have a rule tree concept, and a Cartesian product generated by involving the complex service object in the rule execution process has no good optimization scheme, so that in the complex risk decision process, when a rule of a father node of the rule tree is not hit, a corresponding sub rule of the rule tree cannot be executed, and the rule execution efficiency is low because the Cartesian product is too large.
Disclosure of Invention
In view of this, the present application proposes a rule engine efficiency optimization method based on Drools to solve the problems presented in the background art.
According to an aspect of the present application, there is provided a rule engine efficiency optimization method based on Drools, including the steps of:
acquiring rule conditions to be processed;
grouping the rule conditions to be processed according to a preset standard to obtain rule level nodes;
and executing the rule conditions according to the rule conditions corresponding to the rule level nodes to obtain corresponding results.
As an optional implementation manner of the present application, optionally, grouping the rule conditions to be processed according to a preset standard to obtain a rule level node includes:
setting the root rule condition in the rule conditions to be processed as a corresponding root node;
and setting the sub-rule condition of the root rule condition as a corresponding sub-node according to the rule to be processed.
As an optional embodiment of the present application, optionally, further comprising:
the rule hierarchy nodes are categorized by hierarchy.
As an optional embodiment of the present application, optionally, executing the rule condition according to the rule condition corresponding to the rule level node, to obtain a corresponding result includes:
judging whether the current rule level node is an operation node of an 'and' operator;
when the current rule level node is an operation node of an 'and' operator, judging whether the next level node is the 'and' operation node step by step;
and executing the rule condition corresponding to the judged node when the judged node is the operand node.
As an optional implementation manner of the present application, optionally, according to a rule condition corresponding to the rule level node, executing the rule condition to obtain a corresponding result, and further includes:
judging whether the current rule level node is an operation node of an OR operator or not;
splitting rule conditions corresponding to the current rule level node when the current rule level node is an operation node of an OR operator to obtain newly added rule conditions;
and according to the newly added rule condition, newly adding rule level nodes.
As an optional implementation manner of the present application, optionally, splitting the rule corresponding to the current rule level node further includes:
the split standard is that the split standards are in unnecessary relation;
and executing the new rule condition corresponding to the new rule level node according to the split standard, wherein the obtained result is consistent with the execution result of the corresponding rule condition before being split.
As an optional implementation manner of the present application, optionally, when the judged node is an operand node, executing a rule condition corresponding to the judged node further includes:
the rule condition corresponding to the operand node is a necessary condition of the rule;
if the rule requirement relates to only one data type, the rule requirement is set as a judging condition of the data type.
According to two aspects of the present application, there is provided a rule engine efficiency optimization apparatus based on Drools, including the following modules:
the rule condition acquisition module is used for acquiring rule conditions to be processed;
the node grouping module is used for grouping the rule conditions to be processed according to a preset standard to obtain rule level nodes;
and the rule executing module is used for executing the rule conditions according to the rule conditions corresponding to the rule level nodes to obtain corresponding results.
As an optional embodiment of the present application, optionally, the node grouping module includes:
the root node module is used for setting the root rule condition in the rule conditions to be processed as a corresponding root node;
and the sub-node module is used for setting the sub-rule condition of the root rule condition as a corresponding sub-node according to the rule to be processed.
According to a third aspect of the present application, there is provided an electronic device comprising:
a processor;
a memory for storing processor-executable instructions;
wherein the processor is configured to implement the above-described Drools-based rule engine efficiency optimization method when executing the executable instructions.
The beneficial effects of this application:
in the invention, invalid rule operation is reduced through a rule tree hierarchical execution scheme, the Cartesian product influence is lightened by reconstructing the rule by extracting the necessary condition and splitting the unnecessary condition as new rules, and the method has good effect on improving the rule execution efficiency on solving the risk decision problem in the complex service field.
Other features and aspects of the present application will become apparent from the following detailed description of exemplary embodiments, which proceeds with reference to the accompanying drawings.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate exemplary embodiments, features and aspects of the present application and together with the description, serve to explain the principles of the present application.
FIG. 1 illustrates a flow chart of a Drools-based rule engine efficiency optimization method of an embodiment of the present application;
FIG. 2 is a schematic diagram of rule tree agenda groupings of a Drools-based rule engine efficiency optimization method of an embodiment of the present application;
FIG. 3 illustrates a schematic diagram of a rule optimization scheme for reconstructing the extraction necessary conditions of a Drools-based rule engine efficiency optimization method in accordance with an embodiment of the present application;
FIG. 4 is a schematic diagram illustrating a new rule optimization diagram for a split unnecessary condition of a Drools-based rule engine efficiency optimization method according to an embodiment of the present application;
FIG. 5 is a graph showing the average time spent on rules before and after optimization of the Drools-based rule engine efficiency optimization method of the embodiments of the present application;
FIG. 6 illustrates a Drools-based rule engine efficiency optimization device block diagram of an embodiment of the present application;
Detailed Description
Various exemplary embodiments, features and aspects of the present application will be described in detail below with reference to the accompanying drawings. In the drawings, like reference numbers indicate identical or functionally similar elements. Although various aspects of the embodiments are illustrated in the accompanying drawings, the drawings are not necessarily drawn to scale unless specifically indicated.
It should be understood, however, that the terms "center," "longitudinal," "transverse," "length," "width," "upper," "lower," "front," "rear," "left," "right," "vertical," "horizontal," "top," "bottom," "inner," "outer," "clockwise," "counter-clockwise," "axial," "radial," "circumferential," and the like indicate or are based on the orientation or positional relationship shown in the drawings, and are merely for convenience of description or to simplify the description, and do not indicate or imply that the devices or elements referred to must have a particular orientation, be configured and operated in a particular orientation, and therefore should not be construed as limiting the present application.
Furthermore, the terms "first," "second," and the like, are used for descriptive purposes only and are not to be construed as indicating or implying a relative importance or implicitly indicating the number of technical features indicated. Thus, a feature defining "a first" or "a second" may explicitly or implicitly include one or more such feature. In the description of the present application, the meaning of "a plurality" is two or more, unless explicitly defined otherwise.
The word "exemplary" is used herein to mean "serving as an example, embodiment, or illustration. Any embodiment described herein as "exemplary" is not necessarily to be construed as preferred or advantageous over other embodiments.
In addition, numerous specific details are set forth in the following detailed description in order to provide a better understanding of the present application. It will be understood by those skilled in the art that the present application may be practiced without some of these specific details. In some instances, methods, means, elements, and circuits have not been described in detail as not to unnecessarily obscure the present application.
Example 1
FIG. 1 illustrates a flow chart of a Drools-based rule engine efficiency optimization method in accordance with an embodiment of the present application. As shown in fig. 1, the flowchart includes:
s100, acquiring rule conditions to be processed;
and analyzing and reconstructing all rule conditions in the Drools algorithm model to finally form a matching network.
S200, grouping the rule conditions to be processed according to a preset standard to obtain rule level nodes;
the formed matching network has no concept of rule tree, and can not realize the purpose that child nodes are not executed when a father node is not hit under the default condition, so that the operation amount is reduced, and therefore rule level nodes are set for the formed matching network.
And S300, executing the rule conditions according to the rule conditions corresponding to the rule level nodes to obtain corresponding results.
The corresponding results may be obtained in the following cases: can help developers manage rules quickly and efficiently, execute decision flows in a flexible manner, process data in an efficient manner, and the like.
As an optional embodiment of the present application, optionally, in step S200, grouping the rule conditions to be processed according to a preset standard to obtain a rule level node includes:
s201, setting the root rule condition in the rule conditions to be processed as a corresponding root node;
when a rule tree is formulated, a root node and a child node need to be determined, and the rule tree can be set according to the attribute of the rule condition, in a drop rule engine, if a certain rule condition is judged to be an entry of a network object, and when the network object passes through the entry, the subsequent matching operation can be performed, the node containing the rule condition is set as the root node, and the corresponding rule condition can be regarded as the root rule condition, so that the nodes can be easily distinguished and set.
S202, setting the sub-rule condition of the root rule condition as a corresponding sub-node according to the rule to be processed.
When the network object passes through the entrance, the rule type is matched, the rule condition corresponding to the rule type is a sub-rule condition, and the node containing the sub-rule condition is set as a child node. For example, a Drools rule engine is required to search for results satisfying both an age and a gender, where the age and the gender are rule types, and the rule types are used to execute a flow to reach a child node after passing through a root node to perform type judgment.
As an optional embodiment of the present application, optionally, further comprising:
the rule hierarchy nodes are categorized by hierarchy.
In this embodiment, the number of all rule trees is huge, so a hierarchical classification method can be adopted to manage the rule trees, as shown in fig. 2, by grouping the root nodes of all rule trees into the same group, namely a first-level agenda group; the 5 child nodes of the root node belong to a second-level agenda group; the grandchild node of the root node has the same-genus three-level agenda group of the common father node; the agenda group of each level is subdivided into the same group according to whether the previous level has a common node, for example, R11, R12 and R21 belong to the second level agenda group, but R11 and R12 have the same parent node, so in the second level agenda group, R11 and R12 are classified into the same group in the second level agenda group. And so on, grouping of all nodes of the rule tree is completed. And in the execution process, firstly, executing the root node grouping, and if the parent node is successfully matched, continuing to execute the child node group.
As an optional embodiment of the present application, optionally, in step S300, according to a rule condition corresponding to the rule level node, executing the rule condition to obtain a corresponding result, including:
s301, judging whether a current rule level node is an operation node of an 'and' operator;
in this embodiment, the cartesian product problem is solved by extracting the necessary condition reconstruction rule, and first, by performing abstract syntax tree analysis on rule conditions, it is determined from the root node of the syntax tree whether the current node is the "and" operation node layer by layer.
S302, when the current rule level node is an operation node of an 'and' operator, judging whether the next level node is the 'and' operation node step by step;
if so, continuing to judge the next layer until the current node is an operand node.
And S303, executing rule conditions corresponding to the judged nodes when the judged nodes are operand nodes.
As shown in FIG. 3, after the network Object enters from the root node EP entry, the drop rule engine lets the network Object matched to the Object-T1 and Object-T2 types reach the node, and when Beta-R1 is judged as an operand node before optimization, the rule conditions according to Beta-R1 are as follows: t1.a=10andt2.x > 3andt1.b=t2.y; meaning that after the word face value is input to the Object-T1 and Object-T2 type nodes, a matching process is performed after whether the word face value meets the above rule condition is determined. One disadvantage of this is that, as long as there is one change, for the Beta-R1 node, one calculation is performed every time the change is made. Considering that for the purpose of reducing the number of calculation, an optimization method for reconstructing rules by extracting necessary conditions is adopted, and the optimized rules are shown in the right side of fig. 3; the literal value judgment conditions for the types of Object-T1 and Object-T2 are t1.a=10 and t2.x >3, respectively; before the Beta-R1 node is reached, the calculation result of the word face value meeting T1.a=10 and T2.x >3 is firstly carried out, and then the calculation result is used for calculating the word face value meeting the word face value judging condition T1.b=T2.y of the Beta-R1 node. After the optimization, for example, after the word value input by the Object-T1 is changed, before the word value satisfying the word value judgment condition t1.b=t2.y of the Beta-R1 node is calculated, the word value satisfying the word value condition of the Object-T1 after the change and t2.x >3 are calculated. The Beta-R1 node is reduced by one operation compared with the node before the optimization. Through the rule condition corresponding to the operand node is the necessary condition of the rule, partial data examples can be filtered in advance, the purpose of reducing the calculation times of the subsequent conditions is achieved, and the whole operation amount is further compressed.
As an optional embodiment of the present application, optionally, in step S300, according to a rule condition corresponding to the rule level node, the rule condition is executed to obtain a corresponding result, and further includes:
s310, judging whether the current rule level node is an operation node of an OR operator;
in this embodiment, the rule may be reconfigured by splitting the unnecessary condition into a new rule, and if the root node in the abstract syntax tree of the rule expression is an or operator, the rule expression may be split.
S320, splitting rule conditions corresponding to the current rule level node when the current rule level node is an operation node of an OR operator to obtain newly added rule conditions;
one rule condition corresponds to one node, and when split, one rule condition is changed into a plurality of rule conditions.
S330, according to the newly added rule condition, newly adding rule level nodes.
Similarly, the plurality of rule conditions obtained by splitting have a plurality of corresponding nodes.
As an optional implementation manner of the present application, optionally, splitting the rule corresponding to the current rule level node further includes:
the split standard is that the split standards are in unnecessary relation;
when a node is an OR Operator (OR), a rule expression can be obtained that can be divided into two parts that are in unnecessary relation to each other, depending on the nature of the OR operator.
And executing the new rule condition corresponding to the new rule level node according to the split standard, wherein the obtained result is consistent with the execution result of the corresponding rule condition before being split.
Because the split criteria are mutually unnecessary, that is, when the matching result of any part is true, the matching result of the whole rule is necessarily true, and the split of the two parts into two rules is executed respectively, the final execution result will not be affected.
The split unnecessary condition shown in fig. 4 is a new rule optimization schematic, and according to the rule condition expression of the operand node Beta-R1 shown on the left side of the figure is t1.a=t2.xor t2.y=t3.m; splitting the data into T1.a=T2.x and T2.y=T3.m, wherein corresponding nodes are Beta-R1' and Beta-R1 respectively, calculating T1.a=T2.x for the word face value of the Object-T1 type and the word face value of the Object-T2 type or calculating T2.y=T3.m for the word face value of the Object-T3 type and the word face value of the Object-T2 type; as long as one of the calculation results is true, the matching result of the entire rule shown in the figure is true. After splitting, a certain probability exists, so that the number of data types involved by two new rules is reduced, the Cartesian product generated in the rule execution process is further reduced, and finally the purpose of compressing the whole operation amount is achieved.
As an optional implementation manner of the present application, optionally, when the judged node is an operand node, executing a rule condition corresponding to the judged node further includes:
the rule condition corresponding to the operand node is a necessary condition of the rule;
the requirement for a rule is that its condition must be satisfied in order for the rule to be executed.
If the rule requirement relates to only one data type, the rule requirement is set as a judging condition of the data type.
Since the corresponding rule condition may relate to one or more data types, when only one data type is referred to, the rule condition is individually extracted as the corresponding data type judgment condition, i.e., the necessary condition.
By the method, as shown in fig. 5, in the case that only one root node exists under each rule tree on the same hardware condition, the results of the optimization scheme are compared before and after, and according to the results in the graph, the good effect of the optimization scheme on improving the rule execution efficiency can be verified.
Example 2
Based on the same principle as the foregoing method, a rule engine efficiency optimization device based on Drools is also provided, referring to fig. 6, a rule engine efficiency optimization device 100 based on Drools according to an embodiment of the disclosure includes:
an acquiring rule condition module 110, configured to acquire a rule condition to be processed;
the node grouping module 120 is configured to group the rule conditions to be processed according to a preset standard, so as to obtain a rule level node;
and the execution rule module 130 is configured to execute the rule condition according to the rule condition corresponding to the rule level node, so as to obtain a corresponding result.
As an optional embodiment of the present application, optionally, the node grouping module 120 includes:
a root node module 121, configured to set a root rule condition in the rule conditions to be processed as a corresponding root node;
the child node module 122 is configured to set, according to the rule to be processed, a child rule condition of the root rule condition as a corresponding child node.
It should be apparent to those skilled in the art that the implementation of all or part of the above-described embodiments of the method may be implemented by a computer program for instructing relevant hardware, and the program may be stored in a computer readable storage medium, and the program may include the steps of the embodiments of the control methods described above when executed. The modules or steps of the invention described above may be implemented in a general-purpose computing device, they may be centralized in a single computing device, or distributed across a network of computing devices, or they may alternatively be implemented in program code executable by a computing device, such that they may be stored in a memory device and executed by a computing device, or they may be separately fabricated into individual integrated circuit modules, or multiple modules or steps within them may be fabricated into a single integrated circuit module. Thus, the present invention is not limited to any specific combination of hardware and software.
It will be appreciated by those skilled in the art that implementing all or part of the above-described embodiment methods may be implemented by a computer program for instructing relevant hardware, and the program may be stored in a computer readable storage medium, and the program may include the embodiment flow of each control method as described above when executed. The storage medium may be a magnetic disk, an optical disc, a Read-only memory (ROM), a random access memory (RandomAccessMemory, RAM), a flash memory (flash memory), a hard disk (HDD), or a Solid State Drive (SSD); the storage medium may also comprise a combination of memories of the kind described above.
Example 3
Still further, an electronic device is proposed, comprising:
a processor;
a memory for storing processor-executable instructions;
wherein the processor is configured to implement the Drools-based rule engine efficiency optimization method of embodiment 1 when executing the executable instructions.
An electronic device of an embodiment of the present disclosure includes a processor and a memory for storing processor-executable instructions. Wherein the processor is configured to implement any of the above-described Drools-based rule engine efficiency optimization methods when executing the executable instructions.
It should be noted that the number of the processors may be one or more. Meanwhile, in the electronic device of the embodiment of the disclosure, an input device and an output device may be further included. The processor, the memory, the input device, and the output device may be connected by a bus, or may be connected by other means, which is not specifically limited herein.
The memory, as a Drools-based rule engine efficiency optimization method computer-readable storage medium, may be used to store software programs, computer-executable programs, and various modules, such as: the rule engine efficiency optimization method based on Drools in the embodiment of the disclosure corresponds to a program or a module. The processor executes various functional applications and data processing of the electronic device by running software programs or modules stored in the memory.
The input device may be used to receive an input number or signal. Wherein the signal may be a key signal generated in connection with user settings of the device/terminal/server and function control. The output means may comprise a display device such as a display screen.
The embodiments of the present application have been described above, the foregoing description is exemplary, not exhaustive, and not limited to the embodiments disclosed. Many modifications and variations will be apparent to those of ordinary skill in the art without departing from the scope and spirit of the various embodiments described. The terminology used herein was chosen in order to best explain the principles of the embodiments, the practical application, or the improvement of technology in the marketplace, or to enable others of ordinary skill in the art to understand the embodiments disclosed herein.

Claims (10)

1.A method for optimizing efficiency of a Drools-based rule engine, comprising:
acquiring rule conditions to be processed;
grouping the rule conditions to be processed according to a preset standard to obtain rule level nodes;
and executing the rule conditions according to the rule conditions corresponding to the rule level nodes to obtain corresponding results.
2. The method for optimizing rule engine efficiency based on Drools according to claim 1, wherein grouping the rule conditions to be processed according to a preset standard to obtain rule level nodes comprises:
setting the root rule condition in the rule conditions to be processed as a corresponding root node;
and setting the sub-rule condition of the root rule condition as a corresponding sub-node according to the rule to be processed.
3. The method for optimizing efficiency of a Drools-based rule engine of claim 1, further comprising:
the rule hierarchy nodes are categorized by hierarchy.
4. The method for optimizing efficiency of a rule engine based on Drools of claim 1, wherein executing the rule condition according to the rule condition corresponding to the rule level node to obtain a corresponding result comprises:
judging whether the current rule level node is an operation node of an 'and' operator;
when the current rule level node is an operation node of an 'and' operator, judging whether the next level node is the 'and' operation node step by step;
and executing the rule condition corresponding to the judged node when the judged node is the operand node.
5. The method for optimizing efficiency of a rule engine based on Drools according to claim 1, wherein executing the rule condition according to the rule condition corresponding to the rule level node, to obtain a corresponding result, further comprises:
judging whether the current rule level node is an operation node of an OR operator or not;
splitting rule conditions corresponding to the current rule level node when the current rule level node is an operation node of an OR operator to obtain newly added rule conditions;
and according to the newly added rule condition, newly adding rule level nodes.
6. The method for optimizing efficiency of a rule engine based on Drools of claim 5, wherein splitting the rule corresponding to the current rule level node further comprises:
the split standard is that the split standards are in unnecessary relation;
and executing the new rule condition corresponding to the new rule level node according to the split standard, wherein the obtained result is consistent with the execution result of the corresponding rule condition before being split.
7. The method for optimizing efficiency of a Drools-based rule engine of claim 4 wherein executing the rule condition corresponding to the judged node when the judged node is an operand node further comprises:
the rule condition corresponding to the operand node is a necessary condition of the rule;
if the rule requirement relates to only one data type, the rule requirement is set as a judging condition of the data type.
8. A Drools-based rule engine efficiency optimization device, comprising the following modules:
the rule condition acquisition module is used for acquiring rule conditions to be processed;
the node grouping module is used for grouping the rule conditions to be processed according to a preset standard to obtain rule level nodes;
and the rule executing module is used for executing the rule conditions according to the rule conditions corresponding to the rule level nodes to obtain corresponding results.
9. The Drools-based rule engine efficiency optimization apparatus of claim 8 wherein the node grouping module comprises:
the root node module is used for setting the root rule condition in the rule conditions to be processed as a corresponding root node;
and the sub-node module is used for setting the sub-rule condition of the root rule condition as a corresponding sub-node according to the rule to be processed.
10. An electronic device, comprising:
a processor;
a memory for storing processor-executable instructions;
wherein the processor is configured to implement the Drools-based rule engine efficiency optimization method of any one of claims 1 to 8 when executing the executable instructions.
CN202311585348.7A 2023-11-24 2023-11-24 Rule engine efficiency optimization method and device based on Drools and electronic equipment Pending CN117573186A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202311585348.7A CN117573186A (en) 2023-11-24 2023-11-24 Rule engine efficiency optimization method and device based on Drools and electronic equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202311585348.7A CN117573186A (en) 2023-11-24 2023-11-24 Rule engine efficiency optimization method and device based on Drools and electronic equipment

Publications (1)

Publication Number Publication Date
CN117573186A true CN117573186A (en) 2024-02-20

Family

ID=89893350

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202311585348.7A Pending CN117573186A (en) 2023-11-24 2023-11-24 Rule engine efficiency optimization method and device based on Drools and electronic equipment

Country Status (1)

Country Link
CN (1) CN117573186A (en)

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20100070948A1 (en) * 2008-09-15 2010-03-18 Infosys Technologies Ltd. System and method for improving modularity of large legacy software systems
CN109815389A (en) * 2019-02-02 2019-05-28 北京三快在线科技有限公司 Using the node matching method, apparatus and computer equipment of regulation engine
CN112527838A (en) * 2020-12-10 2021-03-19 联通(浙江)产业互联网有限公司 Business decision method, device, equipment and storage medium based on rule engine

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20100070948A1 (en) * 2008-09-15 2010-03-18 Infosys Technologies Ltd. System and method for improving modularity of large legacy software systems
CN109815389A (en) * 2019-02-02 2019-05-28 北京三快在线科技有限公司 Using the node matching method, apparatus and computer equipment of regulation engine
CN112527838A (en) * 2020-12-10 2021-03-19 联通(浙江)产业互联网有限公司 Business decision method, device, equipment and storage medium based on rule engine

Similar Documents

Publication Publication Date Title
CN105574098B (en) The generation method and device of knowledge mapping, entity control methods and device
EP3588283A1 (en) System and method for recommending service experience package
CN101751333A (en) Method, computer program and computer system for assisting in analyzing program
US9922133B2 (en) Live topological query
CN111651613B (en) Knowledge graph embedding-based dynamic recommendation method and system
CN111090686B (en) Data processing method, device, server and storage medium
CN111768096A (en) Rating method and device based on algorithm model, electronic equipment and storage medium
JP2012198873A (en) Information acquisition method and system from data set
WO2023093689A1 (en) Computational graph optimization method and apparatus, and device
CN111967521B (en) Cross-border active user identification method and device
CN114723014A (en) Tensor segmentation mode determination method and device, computer equipment and medium
CN113220902A (en) Knowledge graph information processing method and device, electronic equipment and storage medium
Kilby et al. The backbone of the travelling salesperson
CN104750834B (en) A kind of regular storage method, matching process and device
CN110765100B (en) Label generation method and device, computer readable storage medium and server
CN113535798A (en) Network training method based on big data mining and digital content center
CN117573186A (en) Rule engine efficiency optimization method and device based on Drools and electronic equipment
US11588728B2 (en) Tree structure-based smart inter-computing routing model
US20190384761A1 (en) Information processing apparatus, information processing method, and non-transitory computer-readable recording medium
CN108429865B (en) Product recommendation processing method and device
CN115996169A (en) Network fault analysis method and device, electronic equipment and storage medium
CN114866400A (en) Alarm rule reasoning method based on cache space optimization
CN116361403A (en) Data link processing method, device, computer equipment and storage medium
US20230297848A1 (en) Optimizing cascade of classifiers schema using genetic search
CN115034392B (en) Compiling method and device of Rete network and executing method and device of Rete algorithm

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