Rule processing method and device based on graph structure, storage medium and electronic equipment
Through disassembly, reconstructing and adjusting existing flow charts, the graph structure rule files are generated, which solves the problem of cumbersome business rules design in the existing technology, and improves business management work efficiency and flexibility in rule arrangement.
Patent Information
- Application Number
- CN202510372098.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-03-27
- Publication Date
- 2025-07-25
AI Technical Summary
In the prior art, the business rules arranged through graph structures require staff to design from scratch on a specific system, which is cumbersome to operate, resulting in low work efficiency.
Through flowchart recognition technology, existing flowcharts are disassembled and reconstructed, graph rule files are generated, and flowcharts are adjusted in the editable interface to support user personalization.
Improve business management efficiency, flexibly adjust business logic through visual and interactive methods, generate graph structure rule files, reduce complex logic development, and improve the flexibility and efficiency of rule arrangement.
Smart Images

Figure CN120373710A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the technical field of rule engines, and in particular to a rule processing method, device, storage medium, and electronic device based on a graph structure. Background Art
[0002] A rule engine system is a software system that uses formal definitions of business logic and makes decisions based on these rules at runtime. It is often applied to business scenarios with a large number of business rules to cope with the frequent changes of business rules. At present, there are some technologies for formulating business rules through graph structure arrangement methods, but all of them require staff to design from scratch on a specific system, and the operation is cumbersome. Therefore, how to cooperate with image recognition technology to recognize the work flow chart, facilitate subsequent design, and thus improve work efficiency is a technical problem that needs to be solved urgently at present.
[0003] Therefore, to meet the actual needs, a rule processing technology based on a graph structure is provided. Summary of the Invention
[0004] Aiming at the defects existing in the prior art, the purpose of this application is to provide a rule processing method, device, storage medium, and electronic device based on a graph structure. Through the flow chart recognition technology, the existing flow chart is disassembled and reconstructed, and then rule arrangement is carried out to provide support for personalized customization for users and effectively improve the work efficiency of business management.
[0005] To achieve the above purpose, the technical solution adopted by this application is:
[0006] In a first aspect, this application provides a rule processing method based on a graph structure, and the method includes the following steps:
[0007] Disassemble an initial flow chart that conforms to a preset flow chart format, and analyze to obtain a corresponding graph rule file;
[0008] Based on the graph rule file, reconstruct to obtain a flow chart to be adjusted;
[0009] Adjust the flow chart to be adjusted to obtain an adjusted flow chart; where
[0010] The preset flow chart format is:
[0011] The initial flow chart includes multiple nodes, and each node is arranged in layers from top to bottom in sequence. The top layer is the input node, the bottom layer is the output node, and the middle layers are intermediate nodes;
[0012] The input end and output end of the intermediate node respectively correspond to at least one input connection line and at least one output connection line;
[0013] The output end of the input node corresponds to at least one output connection line;
[0014] The input end of the output node corresponds to at least one input connection line;
[0015] The initial flowchart, the flowchart to be adjusted, and the adjusted flowchart all include one said input node, at least one said output node, and at least one said intermediate node;
[0016] The intermediate node includes a decision table node, a branch node, a script function node, an expression node, and a custom function node.
[0017] On the basis of the above technical solution, the disassembling of the initial flowchart that conforms to the preset flowchart format and analyzing to obtain the corresponding graph rule file includes the following steps:
[0018] Perform hierarchical disassembly on the initial flowchart that conforms to the preset flowchart format to obtain the nodes corresponding to each layer, and organize to obtain the flowchart layer information;
[0019] Mark the top layer node as the input node, the top layer node as the output node, and the intermediate layer nodes as intermediate nodes, and organize to obtain the flowchart node marking information;
[0020] Perform connection line disassembly on the initial flowchart that conforms to the preset flowchart format to obtain the nodes corresponding to the input end and output end of each connection line, and organize to obtain the connection line-node association information;
[0021] Based on the flowchart layer information, the flowchart node marking information, and the connection line-node association information, organize to obtain the graph rule file.
[0022] On the basis of the above technical solution, the reconstructing the flowchart to be adjusted based on the graph rule file includes the following steps:
[0023] Parse the graph rule file to obtain the flowchart layer information, the flowchart node marking information, and the connection line-node association information;
[0024] Divide multiple node layer areas in the preset reconstruction interface, and based on the flowchart layer information, place each node in the corresponding node layer area;
[0025] Based on the flowchart node marking information and the connection line-node association information, connect each node with connection lines;
[0026] Set each node and the corresponding connection line in the reconstruction interface to an editable mode.
[0027] Based on the above technical solution, when each node and the corresponding connection line in the reconstructed interface are in an editable mode, they are displayed in a flashing form in the reconstructed interface.
[0028] Based on the above technical solution, adjusting the flowchart to be adjusted to obtain an adjusted flowchart further includes the following steps:
[0029] Adding or deleting nodes in each node hierarchical area in the reconstructed interface;
[0030] Adjusting the connection lines of the nodes after addition or deletion in the reconstructed interface;
[0031] Setting the nodes after addition or deletion and the adjusted connection lines in the reconstructed interface to a non-editable mode.
[0032] In a second aspect, the present application provides a rule processing device based on a graph structure, and the device includes:
[0033] A graph structure disassembling module, which is used to disassemble an initial flowchart conforming to a preset flowchart format and analyze to obtain a corresponding graph rule file;
[0034] A graph structure reconstruction module, which is used to reconstruct a flowchart to be adjusted based on the graph rule file;
[0035] A graph structure adjustment module, which is used to adjust the flowchart to be adjusted to obtain an adjusted flowchart; wherein,
[0036] The preset flowchart format is:
[0037] The initial flowchart includes multiple nodes, and each node is arranged in sequence from top to bottom by layer. The top layer is an input node, the bottom layer is an output node, and the middle layers are intermediate nodes;
[0038] The input end and the output end of the intermediate node respectively correspond to at least one input connection line and at least one output connection line;
[0039] The output end of the input node corresponds to at least one output connection line;
[0040] The input end of the output node corresponds to at least one input connection line;
[0041] The initial flowchart, the flowchart to be adjusted, and the adjusted flowchart all include one input node, at least one output node, and at least one intermediate node;
[0042] The intermediate node includes a decision table node, a branch node, a script function node, an expression node, and a custom function node.
[0043] Based on the above technical solution, the graph structure decomposition module is further configured to hierarchically decompose an initial flowchart that conforms to a preset flowchart format, obtain the nodes corresponding to each layer, and organize to obtain flowchart layer information;
[0044] The graph structure decomposition module is further configured to mark the top - layer nodes as input nodes, the top - layer nodes as output nodes, and the nodes in the middle layers as intermediate nodes, and organize to obtain flowchart node marking information;
[0045] The graph structure decomposition module is further configured to decompose the connection lines of an initial flowchart that conforms to a preset flowchart format, obtain the nodes corresponding to the input ends and output ends of each connection line, and organize to obtain connection line - node association information;
[0046] The graph structure decomposition module is further configured to organize and obtain the graph rule file based on the flowchart layer information, the flowchart node marking information, and the connection line - node association information.
[0047] Based on the above technical solution, the graph structure reconstruction module is further configured to parse the graph rule file to obtain the flowchart layer information, the flowchart node marking information, and the connection line - node association information;
[0048] The graph structure reconstruction module is further configured to divide multiple node layer regions in a preset reconstruction interface, and place each node in the corresponding node layer region based on the flowchart layer information;
[0049] The graph structure reconstruction module is further configured to connect each node with a connection line based on the flowchart node marking information and the connection line - node association information;
[0050] The graph structure reconstruction module is further configured to set each node and the corresponding connection line in the reconstruction interface to an editable mode.
[0051] Based on the above technical solution, when each node and the corresponding connection line in the reconstruction interface are in an editable mode, they are displayed in a flashing form in the reconstruction interface.
[0052] Based on the above technical solution, the graph structure adjustment module is further configured to add or delete nodes in each node layer region in the reconstruction interface;
[0053] The graph structure adjustment module is further configured to adjust the connection lines of the nodes after addition or deletion in the reconstruction interface;
[0054] The graph structure adjustment module is further configured to set the nodes after addition or deletion and the adjusted connection lines in the reconstruction interface to a non - editable mode.
[0055] In a third aspect, the present application provides a storage medium, on which a computer program is stored, and when the computer program is executed by a processor, the method mentioned in the first aspect is implemented.
[0056] In a fourth aspect, the present application provides an electronic device, including a memory and a processor, with a computer program stored on the memory and running on the processor, and when the processor executes the computer program, the method mentioned in the first aspect is implemented.
[0057] Compared with the prior art, the advantages of the present application are as follows:
[0058] Through the flowchart recognition technology, the present application disassembles and reconstructs the existing flowchart, and then arranges the rules, providing support for personalized customization for users and effectively improving the efficiency of business management work. BRIEF DESCRIPTION OF THE DRAWINGS
[0059] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the following will briefly introduce the drawings required for the description of the embodiments. Obviously, the drawings in the following description are only some embodiments of the present application, and those of ordinary skill in the art can also obtain other drawings based on these drawings without creative efforts.
[0060] Figure 1 It is a flowchart of the steps of the method for processing rules based on a graph structure according to an embodiment of the present application;
[0061] Figure 2 It is a block diagram of the structure of the device for processing rules based on a graph structure according to an embodiment of the present application;
[0062] Figure 3 It is a block diagram of the structure of an electronic device for the method for processing rules based on a graph structure according to an embodiment of the present application. DETAILED DESCRIPTION OF THE EMBODIMENTS
[0063] To make the objectives, technical solutions, and advantages of the embodiments of the present application clearer, the following will clearly and completely describe the technical solutions in the embodiments of the present application with reference to the accompanying drawings in the embodiments of the present application. Obviously, the described embodiments are some, but not all, of the embodiments of the present application. All other embodiments obtained by those of ordinary skill in the art based on the embodiments of the present application without creative efforts fall within the scope of protection of the present application.
[0064] The following further elaborates on the embodiments of the present application with reference to the accompanying drawings.
[0065] The embodiments of the present application provide a rule processing method, device, storage medium, and electronic device based on a graph structure. Through the flowchart recognition technology, the existing flowchart is disassembled and reconstructed, and then rule arrangement is performed to provide support for personalized customization of users and effectively improve the efficiency of business management work.
[0066] To achieve the above technical effects, the general idea of the present application is as follows:
[0067] A rule processing method based on a graph structure, the method includes the following steps:
[0068] S1. Disassemble the initial flowchart that conforms to the preset flowchart format, and analyze to obtain the corresponding graph rule file;
[0069] S2. Based on the graph rule file, reconstruct to obtain the flowchart to be adjusted;
[0070] S3. Adjust the flowchart to be adjusted to obtain the adjusted flowchart; where
[0071] The preset flowchart format is:
[0072] The initial flowchart includes multiple nodes, and each node is arranged in layers from top to bottom in sequence. The top layer is the input node, the bottom layer is the output node, and the middle layers are intermediate nodes;
[0073] The input end and the output end of the intermediate node respectively correspond to at least one input connection line and at least one output connection line;
[0074] The output end of the input node corresponds to at least one output connection line;
[0075] The input end of the output node corresponds to at least one input connection line;
[0076] The initial flowchart, the flowchart to be adjusted, and the adjusted flowchart all include one input node, at least one output node, and at least one intermediate node;
[0077] The intermediate node includes a decision table node, a branch node, a script function node, an expression node, and a custom function node.
[0078] The following further describes the embodiments of the present application in detail with reference to the accompanying drawings.
[0079] In the first aspect, as shown in Figure 1 The present application provides a rule processing method based on a graph structure, the method includes the following steps:
[0080] S1. Disassemble the initial flowchart that conforms to the preset flowchart format, and analyze to obtain the corresponding graph rule file;
[0081] S2. Reconstruct the flowchart to be adjusted based on the graph rule file;
[0082] S3. Adjust the flowchart to be adjusted to obtain the adjusted flowchart; where
[0083] The preset flowchart format is:
[0084] The initial flowchart includes multiple nodes, and each node is arranged in sequence from top to bottom by layer. The top layer is the input node, the bottom layer is the output node, and the middle layers are intermediate nodes;
[0085] The input end and the output end of the intermediate node respectively correspond to at least one input connection line and at least one output connection line;
[0086] The output end of the input node corresponds to at least one output connection line;
[0087] The input end of the output node corresponds to at least one input connection line;
[0088] The initial flowchart, the flowchart to be adjusted, and the adjusted flowchart all include one input node, at least one output node, and at least one intermediate node;
[0089] The intermediate node includes a decision table node, a branch node, a script function node, an expression node, and a custom function node.
[0090] In the embodiments of the present application, through the flowchart recognition technology, the existing flowchart is disassembled and reconstructed, and then rule arrangement is carried out, providing support for personalized customization for users and effectively improving the efficiency of business management work.
[0091] Further, the disassembling of the initial flowchart that conforms to the preset flowchart format and analyzing to obtain the corresponding graph rule file includes the following steps:
[0092] Perform hierarchical disassembly on the initial flowchart that conforms to the preset flowchart format to obtain the nodes corresponding to each layer, and organize to obtain the flowchart layer information;
[0093] Mark the top layer node as the input node, the top layer node as the output node, and the intermediate layer nodes as intermediate nodes, and organize to obtain the flowchart node marking information;
[0094] Perform connection line disassembly on the initial flowchart that conforms to the preset flowchart format to obtain the nodes corresponding to the input end and the output end of each connection line, and organize to obtain the connection line-node association information;
[0095] Based on the flowchart hierarchical information, the flowchart node marking information, and the connection line-node association information, the graph rule file is sorted and obtained.
[0096] Further, based on the graph rule file, a flowchart to be adjusted is reconstructed, including the following steps:
[0097] Parse the graph rule file to obtain the flowchart hierarchical information, the flowchart node marking information, and the connection line-node association information;
[0098] Divide multiple node hierarchical regions in a preset reconstruction interface, and based on the flowchart hierarchical information, place each node in the corresponding node hierarchical region;
[0099] Based on the flowchart node marking information and the connection line-node association information, connect each node with a connection line;
[0100] Set each node and the corresponding connection line in the reconstruction interface to an editable mode.
[0101] Further, when each node and the corresponding connection line in the reconstruction interface are in an editable mode, they are displayed in a flashing form in the reconstruction interface.
[0102] Further, for adjusting the flowchart to be adjusted to obtain an adjusted flowchart, the following steps are further included:
[0103] Add or delete each node in each node hierarchical region in the reconstruction interface;
[0104] Adjust the connection lines of each node after addition or deletion in the reconstruction interface;
[0105] Set each node after addition or deletion and the adjusted connection lines in the reconstruction interface to a non-editable mode.
[0106] Further, the input node is used to act as an entry for all data related to the context;
[0107] The output node is used to output the result of the final business decision-making process.
[0108] Further, the decision table node is a rule node structured with multiple groups of inputs, expressions, and outputs, and is used to describe the logic of relevant calculations in business.
[0109] Further, the expression node is a rule node with a key-value pair structure and is used to create new data fields.
[0110] Furthermore, the branch node is a rule node that can dynamically branch the execution of decision evaluation according to conditions and is used in scenarios where different decisions need to be made based on different inputs in business logic.
[0111] Furthermore, the function node is a rule node that can quickly parse, remap, and customize data through JS scripts and is used for data preprocessing and parsing.
[0112] Furthermore, the custom node is a rule node that can be extended according to business requirements.
[0113] Specifically, in order to reduce the access cost on different business services and reuse this rule through the API (Application Programming Interface), the API generation group module generates call templates in multiple preset Web backend development programming languages for the HTTP (Hypertext Transfer Protocol) / HTTPS API calls of this rule system. For example, common Web backend development programming languages such as Shell, NodeJS, Python, Java, and Go. This module only needs to replace the open interface ID and open interface key of the called API according to the preset call template to generate a specific call example. Business personnel can select a specific call example according to the actual situation, which is convenient for quickly accessing specific business scenarios.
[0114] Moreover, specifically, in order to be flexibly and stably applied to different business scenarios, in addition to being able to perform interactive editing on the JDM file in this interactive rule orchestration system, a certain rule scheme can be managed in the management sub-module of this system. Management operations include rule editing, permission setting, observation, publishing, and closing, etc.
[0115] The editing of the rule can be entered into the interactive rule orchestration module to modify and save the nodes of the graph rule, the specific rule logic of the nodes, and the orchestration relationship between the nodes;
[0116] The rule permission setting is to set permissions for each user accessing this system, including read-only, read-write, and other permissions;
[0117] The rule observation is an execution that inputs the data of the business scenario into this system for evaluation and execution, writes the decision result into a specified database for recording, but only observes the specific business scenario without making decisions. This avoids some inappropriate rules being discovered during testing before formal application and ensures the stability of the actual business;
[0118] The so-called rule release is to formally apply the corresponding graph rules to specific business scenarios, which will have a specific impact on business processing;
[0119] The so-called rule closing is to stop inputting business data into the corresponding graph rules for evaluation and execution.
[0120] In summary, based on the technical solution of the embodiments of the present application, it helps business personnel extract the business logics that need to be frequently changed in business programs into rules described by graph data structures. Through the interactive rule orchestration system based on graph data structures in this solution, business personnel can edit and modify rule nodes, and achieve real-time and flexible adjustment of business logics through an interactive orchestration method. It can be widely applied to business scenarios such as e-commerce business scenarios, business risk control scenarios, aviation business scenarios, and enterprise internal process systems, etc.
[0121] The graph-based interactive rule orchestration engine system in the technical solution of the embodiments of the present application has the following advantages compared with the previous rule engine solution based on Drools in scenarios where business rules change frequently, flexibility of business requirements is improved, and development of complex logics is reduced:
[0122] Rule orchestration is visual, which can make the business rule solution more complete, rather than in Drools where business personnel mostly focus on the local part and it is difficult to have an overall view.
[0123] Rule orchestration is interactive. Rule nodes are orchestrated by dragging and connecting nodes, and each node can be interactively edited according to its type. After editing and orchestration, a graph data structure file of the corresponding rule solution is generated.
[0124] Updating rules based on the graph structure data file means that updating the file can hot-update the rules, and the performance bottleneck depends on the current server's IO performance, which has a significant improvement compared with the performance of updating rules based on JAVA bytecode.
[0125] The rule file describes rules in the form of a graph structure. Utilizing the characteristics of the graph, it is easier to orchestrate rule nodes, with higher flexibility, and it is easy to discover dead loops or conflicts in the rules based on the graph structure.
[0126] Use common Javascript and data science scripts similar to SQL (Structured Query Language) to implement rule expressions, and the learning threshold is relatively friendly.
[0127] The technical advantages of the present application are:
[0128] Quickly and flexibly orchestrate rules in an interactive and visual way, and generate a graph structure rule file corresponding to the rules;
[0129] Parse and verify the graph structure rule file to obtain a graph structure that describes the rules, including node relationships, rule node types, and other rule node information;
[0130] Evaluate and execute the input data according to the rules described by the rule nodes to obtain the decision results of the nodes;
[0131] Determine the transfer method of the input data in the graph based on the node connection relationships described in the graph structure and the results of the previous rule node, and complete the execution of the decision between the nodes;
[0132] Through the technical solution of the embodiments of the present application, the input data completes the execution of the decision in the rules described by the graph structure and outputs the final result.
[0133] In a second aspect, as shown in Figure 2 The embodiments of the present application provide a rule processing device based on a graph structure. The device includes:
[0134] A graph structure disassembling module, which is used to disassemble the initial flow chart that conforms to the preset flow chart format and analyze to obtain the corresponding graph rule file;
[0135] A graph structure reconstruction module, which is used to reconstruct the to-be-adjusted flow chart based on the graph rule file;
[0136] A graph structure adjustment module, which is used to adjust the to-be-adjusted flow chart to obtain the adjusted flow chart; where
[0137] The preset flow chart format is:
[0138] The initial flow chart includes multiple nodes, and each node is arranged in layers from top to bottom in sequence. The top layer is the input node, the bottom layer is the output node, and the middle layers are intermediate nodes;
[0139] The input end and the output end of the intermediate node respectively correspond to at least one input connection line and at least one output connection line;
[0140] The output end of the input node corresponds to at least one output connection line;
[0141] The input end of the output node corresponds to at least one input connection line;
[0142] The initial flow chart, the to-be-adjusted flow chart, and the adjusted flow chart all include one input node, at least one output node, and at least one intermediate node;
[0143] The intermediate nodes include decision table nodes, branch nodes, script function nodes, expression nodes, and custom function nodes.
[0144] In the embodiments of the present application, through the flowchart recognition technology, the existing flowchart is disassembled and reconstructed, and then the rules are arranged to provide support for personalized customization of users, effectively improving the efficiency of business management work.
[0145] Further, the graph structure disassembly module is further configured to perform hierarchical disassembly on the initial flowchart that conforms to the preset flowchart format, obtain the nodes corresponding to each layer, and organize and obtain the flowchart layer information;
[0146] The graph structure disassembly module is further configured to mark the nodes in the top layer as input nodes, the nodes in the top layer as output nodes, and the nodes in each intermediate layer as intermediate nodes, and organize and obtain the flowchart node marking information;
[0147] The graph structure disassembly module is further configured to perform disassembly on the connection lines of the initial flowchart that conforms to the preset flowchart format, obtain the nodes corresponding to the input ends and output ends of each connection line, and organize and obtain the connection line-node association information;
[0148] The graph structure disassembly module is further configured to organize and obtain the graph rule file based on the flowchart layer information, the flowchart node marking information, and the connection line-node association information.
[0149] Further, the graph structure reconstruction module is further configured to parse the graph rule file to obtain the flowchart layer information, the flowchart node marking information, and the connection line-node association information;
[0150] The graph structure reconstruction module is further configured to divide a plurality of node layer regions in a preset reconstruction interface, and place each node in the corresponding node layer region based on the flowchart layer information;
[0151] The graph structure reconstruction module is further configured to connect each node with a connection line based on the flowchart node marking information and the connection line-node association information;
[0152] The graph structure reconstruction module is further configured to set each node and the corresponding connection line in the reconstruction interface to an editable mode.
[0153] Further, when each node and the corresponding connection line in the reconstruction interface are in an editable mode, they are displayed in a flashing form in the reconstruction interface.
[0154] Further, the graph structure adjustment module is further configured to add or delete each node in each node layer region in the reconstruction interface;
[0155] The graph structure adjustment module is further configured to adjust the connection lines of each node after addition or deletion in the reconstruction interface;
[0156] The graph structure adjustment module is further configured to set each of the nodes after addition and deletion and the adjusted connection lines in the reconstructed interface to an uneditable mode.
[0157] Further, the input node is used to act as an entry for all data related to the context;
[0158] The output node is used to output the result of the final business decision-making process.
[0159] Further, the decision table node is a rule node structured with multiple groups of inputs, expressions, and outputs, and is used to describe the logic of relevant calculations in business.
[0160] Further, the expression node is a rule node with a key-value pair structure and is used to create new data fields.
[0161] Further, the branch node is a rule node that can dynamically branch the decision evaluation according to conditions and is used in scenarios where different decisions need to be made according to different inputs in business logic.
[0162] Further, the function node is a rule node that quickly parses, remaps, and customizes data through JS scripts and is used for preprocessing and parsing of data.
[0163] Further, the custom node is a rule node extended according to the business.
[0164] Specifically, in order to reduce the access cost on different business services and reuse this rule through the API (Application Programming Interface), the API generation group module generates call templates for multiple preset Web backend development programming languages for the HTTP (Hypertext Transfer Protocol) / HTTPS API calls of this rule system. For example, common Web backend development programming languages such as Shell, NodeJS, Python, Java, and Go. This module only needs to replace the open interface ID and open interface key of the called API according to the preset call template, and then a specific call example is generated. Business personnel can select a specific call example according to the actual situation, which is convenient for quickly accessing specific business scenarios.
[0165] Furthermore, specifically, in order to be flexibly and robustly applied to different business scenarios, in addition to being able to perform interactive editing on the JDM file in this interactive rule orchestration system, a certain rule scheme can be managed in the management sub-module of this system. The management operations include editing of rules, permission settings, observation, publishing, and closing, etc.
[0166] The editing of the rules can enter the interactive rule orchestration module to modify and save the nodes of the graph rules, the specific rule logic of the nodes, and the orchestration relationship between the nodes;
[0167] The rule permission setting is to set permissions for each user accessing this system, including permissions such as read-only and read-write;
[0168] The rule observation is an execution that inputs the data of the business scenario into this system for evaluation, writes the decision result into the specified database for recording, but only observes the specific business scenario without making decisions. This avoids some inappropriate rules from being discovered during testing before formal application, ensuring the stability of the actual business;
[0169] The rule publishing is to formally apply the corresponding graph rules to the specific business scenario, having a specific impact on the processing of the business;
[0170] The rule closing is to stop inputting business data into the corresponding graph rules for evaluation and execution.
[0171] In summary, based on the technical solution of the embodiment of this application, it helps business personnel extract the business logic that needs to be frequently changed in the business process into rules described by the graph data structure. Through the interactive rule orchestration system based on the graph data structure in this solution, business personnel can edit and modify the rule nodes and achieve real-time flexible adjustment of the business logic through an interactive orchestration method. It can be widely applied to business scenarios such as e-commerce business scenarios, business risk control scenarios, aviation business scenarios, and enterprise internal process systems, etc.
[0172] The graph-based interactive rule orchestration engine system in the technical solution of the embodiment of this application has the following advantages compared with the previous rule engine solution based on Drools in scenarios where business rules change frequently, improve business flexibility, and reduce the development of complex logic:
[0173] The rule orchestration is visual, which can make the business rule scheme more complete, rather than in Drools where business personnel often focus on the local part and it is difficult to have an overall view.
[0174] The rule arrangement is interactive. The rule nodes are arranged by dragging and connecting nodes, and each node can be interactively edited according to its type. After editing and arrangement, a graph data structure file of the corresponding rule scheme is generated.
[0175] Based on the graph structure data file for rule update, that is, updating the file can hot-update the rules. The performance bottleneck depends on the IO performance of the current server, and there is a significant improvement in performance compared to rule update based on JAVA bytecode.
[0176] The rule file describes the rules in the form of a graph structure. Utilizing the characteristics of the graph, it is easier to arrange the rule nodes, with higher flexibility, and it is easy to detect dead loops or conflicts in the rules based on the graph structure.
[0177] Use common Javascript and data science scripts similar to SQL (Structured Query Language) to implement rule expressions, and the learning threshold is relatively friendly.
[0178] The technical advantages of this application are as follows:
[0179] Arrange rules quickly and flexibly through an interactive and visual way, and generate a graph structure rule file corresponding to the rules;
[0180] Parse and verify the graph structure rule file to obtain a graph structure describing the rules, including node relationships, rule node types, and other rule node information;
[0181] Evaluate and execute the input data according to the rules described by the rule nodes to obtain the decision results of the nodes;
[0182] Determine the way the input data is transmitted in the graph according to the node connection relationship described in the graph structure and the result of the previous rule node, and complete the execution of the decision between the nodes;
[0183] Through the technical solution of the embodiments of this application, the input data completes the execution of the decision in the rules described by the graph structure and outputs the final result.
[0184] In a third aspect, this application provides a storage medium, on which a computer program is stored. When the computer program is executed by a processor, it implements the method mentioned in the first aspect.
[0185] In a fourth aspect, as shown in Figure 3 This application provides an electronic device, which can specifically be called a rule processing electronic device based on a graph structure, including a memory and a processor. A computer program running on the processor is stored on the memory. When the processor executes the computer program, it implements the method mentioned in the first aspect.
[0186] In the description of the present application, it should be noted that the orientation or positional relationship indicated by terms such as "upper" and "lower" is based on the orientation or positional relationship shown in the drawings. It is only for the convenience of describing the present application and simplifying the description, rather than indicating or implying that the device or element referred to must have a specific orientation, be constructed and operated in a specific orientation. Therefore, it should not be construed as a limitation to the present application. Unless otherwise clearly specified and defined, the terms "mounted", "connected" and "coupled" should be understood in a broad sense. For example, it can be a fixed connection, a detachable connection, or an integral connection; it can be a mechanical connection, or an electrical connection; it can be directly connected, or indirectly connected through an intermediate medium, and it can be the communication inside two elements. For those of ordinary skill in the art, the specific meanings of the above terms in the present application can be understood according to specific circumstances.
[0187] It should be noted that in the present application, relational terms such as "first" and "second" are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any actual relationship or order between these entities or operations. Moreover, the terms "comprising", "including" or any other variant thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device comprising a series of elements includes not only those elements, but also other elements not expressly listed, or elements inherent to such process, method, article or device. Without further limitation, an element defined by the statement "comprising an..." does not exclude the presence of additional identical elements in the process, method, article or device comprising the said element.
[0188] The above are only specific embodiments of the present application, enabling those skilled in the art to understand or implement the present application. Various modifications to these embodiments will be obvious to those skilled in the art, and the general principles defined in the embodiments of the present application can be implemented in other embodiments without departing from the spirit or scope of the present application. Therefore, the present application will not be limited to these embodiments shown in the embodiments of the present application, but will conform to the broadest scope consistent with the principles and novel features claimed in the embodiments of the present application.
Claims
1. A rule processing method based on a graph structure, characterized in that, The method includes the following steps: Decompose the initial flowchart that conforms to the preset flowchart format, and analyze to obtain the corresponding graph rule file; Based on the graph rule file, reconstruct to obtain the flowchart to be adjusted; Adjust the flowchart to be adjusted to obtain the adjusted flowchart; wherein, The preset flowchart format is: The initial flowchart includes multiple nodes, and each node is arranged in layers from top to bottom in sequence. The top layer is the input node, the bottom layer is the output node, and the middle layers are intermediate nodes; The input end and the output end of the intermediate node respectively correspond to at least one input connection line and at least one output connection line; The output end of the input node corresponds to at least one output connection line; The input end of the output node corresponds to at least one input connection line; The initial flowchart, the flowchart to be adjusted, and the adjusted flowchart all include one input node, at least one output node, and at least one intermediate node; The intermediate node includes a decision table node, a branch node, a script function node, an expression node, and a custom function node.
2. The rule processing method based on a graph structure according to claim 1, characterized in that, The decomposition of the initial flowchart that conforms to the preset flowchart format and the analysis to obtain the corresponding graph rule file include the following steps: Perform hierarchical decomposition on the initial flowchart that conforms to the preset flowchart format to obtain the nodes corresponding to each layer, and organize to obtain the flowchart hierarchical information; Mark the top layer node as the input node, the top layer node as the output node, and the intermediate layer nodes as intermediate nodes, and organize to obtain the flowchart node marking information; Perform connection line decomposition on the initial flowchart that conforms to the preset flowchart format to obtain the nodes corresponding to the input end and the output end of each connection line, and organize to obtain the connection line-node association information; Based on the flowchart hierarchical information, the flowchart node marking information, and the connection line-node association information, organize to obtain the graph rule file.
3. The rule processing method based on a graph structure according to claim 1, wherein The reconstruction of the flowchart to be adjusted based on the graph rule file includes the following steps: Parse the graph rule file to obtain the flowchart hierarchical information, the flowchart node marking information, and the connection line-node association information; Divide multiple node hierarchical areas in the preset reconstruction interface, and based on the flowchart hierarchical information, place each node in the corresponding node hierarchical area; Based on the flowchart node marking information and the connection line-node association information, connect each node with connection lines; Set each node and the corresponding connection line in the reconstruction interface to an editable mode.
4. The graph structure-based rule processing method according to claim 3, wherein: When each node and the corresponding connection line in the reconstruction interface are in an editable mode, they are displayed in a flashing form in the reconstruction interface.
5. A rule processing device based on a graph structure, characterized in that, The device includes: A graph structure decomposition module, which is used to decompose the initial flowchart that conforms to the preset flowchart format and analyze to obtain the corresponding graph rule file; A graph structure reconstruction module, which is used to reconstruct to obtain the flowchart to be adjusted based on the graph rule file; A graph structure adjustment module, which is used to adjust the flowchart to be adjusted to obtain the adjusted flowchart; wherein, The preset flowchart format is as follows: The initial flowchart includes multiple nodes, and each node is arranged in layers from top to bottom. The top layer is the input node, the bottom layer is the output node, and the intermediate layers are intermediate nodes; The input end and the output end of the intermediate node respectively correspond to at least one input connection line and at least one output connection line; The output end of the input node corresponds to at least one output connection line; The input end of the output node corresponds to at least one input connection line; The initial flowchart, the flowchart to be adjusted, and the adjusted flowchart all include one input node, at least one output node, and at least one intermediate node; The intermediate node includes a decision table node, a branch node, a script function node, an expression node, and a custom function node.
6. The graph structure-based rule processing device according to claim 5, wherein: The graph structure disassembling module is further configured to perform hierarchical disassembly on the initial flowchart conforming to the preset flowchart format, obtain the nodes corresponding to each layer, and organize to obtain the flowchart layer information; The graph structure disassembling module is further configured to mark the top layer node as an input node, the top layer node as an output node, and the intermediate layer nodes as intermediate nodes, and organize to obtain the flowchart node marking information; The graph structure disassembling module is further configured to perform connection line disassembly on the initial flowchart conforming to the preset flowchart format, obtain the nodes corresponding to the input end and the output end of each connection line, and organize to obtain the connection line-node association information; The graph structure disassembling module is further configured to organize and obtain the graph rule file based on the flowchart layer information, the flowchart node marking information, and the connection line-node association information.
7. The graph structure-based rule processing device according to claim 6, wherein: The graph structure reconstruction module is further configured to parse the graph rule file to obtain the flowchart layer information, the flowchart node marking information, and the connection line-node association information; The graph structure reconstruction module is further configured to divide multiple node layer areas in a preset reconstruction interface, and place each node in the corresponding node layer area based on the flowchart layer information; The graph structure reconstruction module is further configured to connect each node with a connection line based on the flowchart node marking information and the connection line-node association information; The graph structure reconstruction module is further configured to set each node and the corresponding connection line in the reconstruction interface to an editable mode.
8. The graph structure-based rule processing device according to claim 7, wherein: When each node and the corresponding connection line in the reconstruction interface are in an editable mode, they are displayed in a flashing form in the reconstruction interface.
9. A storage medium, on which a computer program is stored, characterized in that: The computer program, when executed by a processor, implements the method according to any one of claims 1 to 4.
10. An electronic device, comprising a memory and a processor, where a computer program running on the processor is stored on the memory, and is characterized in that: The processor, when executing the computer program, implements the method according to any one of claims 1 to 4.