Adjustment method and interpreter system for SAAS platform service rules
By adopting technologies such as RETE algorithm interpreter and neo4j graph database in the multi-tenant SaaS platform, the problem of insufficient flexibility and ease of use of rules design and management is solved, and efficient and flexible business rules management is achieved, reducing maintenance costs and complexity.
Patent Information
- Application Number
- CN202510276024.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-03-10
- Publication Date
- 2025-06-27
AI Technical Summary
The flexibility and ease of use of rule design and management in the multi-tenant SaaS platform make it difficult to cope with rapidly changing business needs, and the system maintenance complexity and cost are high.
The rule design method based on RETE algorithm interpreter is adopted, and by providing a rule template library, format checking and syntax verification, RETE algorithm interpreter and neo4j graph database and other technologies, it realizes efficient parsing, storage and matching of rules, and supports dynamic adjustment and immediate effect.
It improves the flexibility and response speed of business rules, reduces system maintenance costs and complexity, and enhances the ease of use of rule management and system stability.
Smart Images

Figure CN120216000A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of multi-tenant SAAS (Software as a Service) platforms, specifically to the business logic planning and adjustment of SAAS platforms, and particularly to a method and interpreter system for adjusting business rules of SAAS platforms. Background Art
[0002] In the complex ecosystem of multi-tenant SaaS (Software as a Service) platforms, the business requirements and operation rules among tenants exhibit significant diversity and dynamics. This characteristic requires the platform to have a high degree of flexibility and scalability to quickly and effectively adapt to the frequently changing business requirements of different tenants. Traditionally, rule design often uses hard-coding, that is, directly embedding business logic into program code. However, the limitation of this method lies in its rigidity, making it difficult to cope with rapidly changing business requirements. At the same time, hard-coding also greatly increases the complexity and cost of system maintenance, which is not conducive to long-term sustainable development.
[0003] To overcome these challenges, the industry has begun to explore and introduce dynamic configuration mechanisms and rule engine technologies. These solutions aim to achieve dynamic adjustment of business logic through external configuration files or specialized rule languages, thereby improving the flexibility and adaptability of the system. For example: CN202311685605.4 discloses a multi-dimensional rule engine algorithm and method based on a digital marketing data service SaaS system (publication date: March 12, 2024); CN201110422609.4 discloses a software customization system based on SAAS (publication date: June 19, 2013); CN202110126766.4 discloses a method, device, equipment and storage medium for information verification based on a SaaS platform (publication date: May 14, 2021); Nevertheless, these methods still face many problems in practical applications. On the one hand, complex configuration files and specialized rule languages often exceed the understanding ability of ordinary users, resulting in a cumbersome and error-prone configuration process; on the other hand, when faced with highly complex or personalized business logic, the processing capabilities of these solutions are stretched, making it difficult to meet the high requirements for flexibility and customization in a multi-tenant environment.
[0004] In view of the limitations of the above methods, in recent years, some cutting-edge solutions have begun to attempt to integrate natural language processing (NLP) models and machine learning (ML) technologies into multi-tenant SaaS platforms. These advanced technologies are theoretically capable of providing a higher level of intelligence and automation, thus enabling more accurate processing of complex business logics. For example: CN202410358544.9 discloses a method and system for controlling software platform services through natural language input (Publication Date: 2024-07-16);
[0005] CN202011226841.6 discloses a cloud platform and method for providing machine learning services (Publication Date: 2021-02-02); CN202311227460.3 discloses an intelligent interaction method, device, equipment, and storage medium based on a SaaS platform (Publication Date: 2023-10-31); However, the implementation costs of these methods are relatively high, and the demand for computing resources is huge, which greatly limits their widespread promotion in application scenarios with limited resources or cost sensitivity.
[0006] Therefore, the present invention proposes an adjustment method and interpreter system for business rules of a SaaS platform. Summary of the Invention
[0007] In view of this, the present invention hopes to provide an adjustment method and interpreter system for business rules of a SaaS platform to solve or alleviate the technical problems existing in the prior art, that is, how to solve the flexibility and ease of use of rule design and management in a multi-tenant SaaS platform. By introducing a rule design method based on a RETE algorithm interpreter, tenants can flexibly define and adjust business rules to meet personalized needs, while reducing the maintenance costs and complexity of the system. The technical solution of the present invention is realized as follows:
[0008] First aspect, an adjustment method for business rules of a SaaS platform:
[0009] (I) Overview:
[0010] The present invention aims to construct an efficient, flexible and easy-to-manage business rule processing system. By providing a rule template library, users can quickly define and construct rules that meet their own business needs without in-depth programming knowledge. The built-in format checking and syntax verification functions in the system ensure the correctness and consistency of the rules, reducing the occurrence of errors. Using the RETE algorithm interpreter and the neo4j graph database, the solution realizes the efficient parsing, storage and matching of rules, greatly improving the speed and accuracy of rule execution. At the same time, through entity verification and attribute verification using the knowledge graph, and establishing rule indexes, the effectiveness and maintainability of the rules are further enhanced. The solution also supports the dynamic adjustment and immediate effectiveness of rules, as well as comprehensive rule management functions, enabling business rules to adapt to changes as needed and quickly adapt to market changes.
[0011] (2) Technical solution:
[0012] To achieve the above technical objectives, the present invention selects to perform the following operation steps. After receiving the rule scheme activation instruction from the user input, the following steps S1 to S5 are executed accordingly.
[0013] 2.1 Step S1, activate the rule definition module:
[0014] Start the rule definition interface; receive the user's automatic definition and construction of business rules through the graphical editing interface or by calling the templates in the rule template library.
[0015] At the same time, perform format checking and syntax verification on the business rules; if there are problems with the rules, return error messages to the user interface.
[0016] 2.1.1 Step S100, automatically define and construct business rules:
[0017] The system automatically constructs business rules according to the user's input or selected template. The structure of the rules includes rule ID, condition set LHS, action set RHS, priority, and valid time range; multi-condition combinations include AND logic and OR logic.
[0018] 2.1.2 Step S101, format checking and syntax verification:
[0019] Perform format checking and syntax verification on the rules; including checking whether the structure of the rules is complete, whether the condition block and action block match, and whether the logical relationship is correct.
[0020] If there are format errors, syntax errors or logical conflicts in the rules, return error messages to the user interface and indicate the location and cause of the problems;
[0021] If the rules pass the verification, they are saved and sent to the next module for further processing and execution.
[0022] 2.2 Step S2, Rule Parsing and Storage:
[0023] Through the RETE algorithm interpreter module, parse the verified business rules and convert them into executable rule logic (rule program).
[0024] 2.2.1 Step S200, Rule Parsing:
[0025] The RETE algorithm is a rule matching algorithm that can decompose rules into a series of patterns and conditions and construct a network structure for quickly matching fact data. Among them, the parsing process of the RETE algorithm interpreter module includes converting the condition set, action set, and priority of the rules into an internal representation form that the RETE algorithm can understand.
[0026] 2.2.2 Step S201, Convert to Executable Rule Logic:
[0027] Convert the rules into executable rule logic, that is, a rule program. This rule program is part of the RETE algorithm network and can quickly match and activate corresponding rules according to the input fact data.
[0028] 2.2.3 Step S202, Store Rules Using the neo4j Graph Database:
[0029] Use the neo4j graph database to convert the rule logic into a combination of nodes and edges, where nodes represent the conditions, actions, and attributes of the rules, and edges represent the relationships between them.
[0030] 2.2.4 Step S203, Establish Rule Index:
[0031] To speed up the retrieval and execution speed of rules, an index is established for the rule logic in the neo4j graph database. An index is a data structure that can quickly locate rules that meet specific conditions.
[0032] By establishing an index, the system can quickly find the rules to be matched when executing rules, thereby improving the efficiency of rule execution.
[0033] 2.3 Step S3, Rule Verification:
[0034] Call the knowledge graph to perform entity verification and attribute verification on the rule logic (rule program), and use the graph database to perform traversal and query on the logical coherence of the rule conditions to avoid conflicting or invalid rules.
[0035] 2.3.1 Step S300, Call the Knowledge Graph:
[0036] Invoke the knowledge graph module that contains a graph data structure of business entities, attributes, and their relationships. The knowledge graph provides basic data support for rule verification, and is used to verify whether the entities and attributes involved in the rules exist and are correct.
[0037] 2.3.2 Step S301, entity verification:
[0038] Verify the entities in the rule logic (rule program). This includes checking whether the entities exist in the knowledge graph and whether the types of the entities meet the rule requirements. If an entity does not exist or the type does not match, the system will return an error message indicating the problem.
[0039] 2.3.3 Step S302, attribute verification:
[0040] Verify the attributes in the rule logic. This includes checking whether the attributes are defined in the knowledge graph and whether the values of the attributes meet the rule requirements. If an attribute does not exist or the value does not meet the requirements, an error message will also be returned.
[0041] 2.3.4 Step S303, logical coherence verification:
[0042] Use the neo4j graph database to check whether the rule conditions can form a coherent logical chain to ensure that the rule can be correctly triggered during execution. If conflicts or invalid situations are found in the rule during the verification process, detailed error messages will be returned indicating the problem.
[0043] The user modifies and adjusts the rule according to the error message until the rule passes all verifications.
[0044] 2.4 Step S4, rule compilation and loading:
[0045] Send the rule logic that has passed the verification into the RETE network for compilation and load the compiled rule into the rule execution engine.
[0046] 2.4.1 Step S400, rule logic compilation:
[0047] Send the rule logic that has passed the verification into the RETE network for compilation. The RETE network is an optimized data structure for rule matching. It can decompose the rule into a series of patterns and conditions and construct an efficient matching network.
[0048] During the compilation process, convert the rule logic into an internal representation that the RETE network can understand, that is, generate executable rule nodes. The rule nodes contain the conditions, actions, and related logical relationships of the rule; each rule node corresponds to a specific condition or action in the rule. When the input fact data meets the conditions of the node, the corresponding action will be triggered.
[0049] 2.4.2 Step S401, Loading Rules into the Execution Engine:
[0050] The rule execution engine is the core component responsible for executing rules. It can quickly match and activate corresponding rules based on the input fact data. Load the rule nodes into the rule execution engine; during the loading process, bind the rule nodes to the internal data structure of the execution engine to ensure that the rules can be executed correctly.
[0051] 2.4.3 Step S402, Dynamically Adjusting Rules:
[0052] During the system operation, users need to dynamically adjust the rules. At this time, the system supports real-time updating of the rule nodes in the RETE network without overall recompilation or system restart. Users can modify, add, or delete rules through specific interfaces or tools. The system will automatically update the corresponding nodes in the RETE network in the background and ensure that the new rules can take effect in a timely manner.
[0053] 2.5 Step S5, Rule Execution:
[0054] When receiving fact data, the rule execution engine matches and activates rules according to the RETE algorithm; by executing the action set RHS of the matching rules, corresponding business effects are generated.
[0055] When receiving new fact data, the rule execution engine quickly matches relevant rules in the loaded rule network using the RETE algorithm. The RETE algorithm is an efficient rule matching algorithm that can quickly find matching rules among a large number of rules and fact data.
[0056] The matching process involves checking whether the fact data satisfies the condition part (LHS, Left Hand Side) of the rule. If it is satisfied, the rule is activated.
[0057] When the condition part of the rule matches the fact data, the rule is activated by the execution engine. The activated rule means that its action part (RHS, Right Hand Side) will be executed.
[0058] For each activated rule, the rule execution engine executes its action set RHS. The action set contains a series of operations to update the state of business objects, trigger events, and / or call external services.
[0059] During the execution process, the system ensures that the execution order and dependency relationships of the actions are correct to avoid conflicts or inconsistent states.
[0060] By executing the action set of the matching rules, the system produces corresponding business effects. These effects include updating business data, triggering subsequent business processes, generating reports or notifications, etc.
[0061] (III) Mechanism for Solving Technical Problems:
[0062] The core of the present invention lies in separating business rules from application code and using the efficient RETE algorithm for rule matching and execution, thereby endowing tenants with high flexibility and ease of use in defining and adjusting business rules, while reducing the maintenance cost and complexity of the system.
[0063] 3.1 Rule Definition and Templatization:
[0064] The solution provides a graphical editing interface and a rule template library, enabling tenants to intuitively define and adjust business rules without in-depth understanding of underlying programming details.
[0065] 3.2 Rule Parsing and Validation:
[0066] The RETE algorithm interpreter is used to parse the rules defined by the tenant and convert them into executable program logic (rule program). During the rule parsing process, the system performs format checks and syntax validations to ensure the correctness and consistency of the rules, reducing runtime errors.
[0067] Advanced storage technologies such as the neo4j graph database are used to persistently store the parsed rules and establish rule indexes using the characteristics of the graph database. The rule indexes improve the speed of rule retrieval and execution, enabling the system to quickly respond to tenant requests.
[0068] 3.3 Rule Verification and Optimization:
[0069] The knowledge graph is called to perform entity verification and attribute verification on the rules to ensure that the entities and attributes in the rules are valid and accurate in the business context. By checking the logical coherence of the rule conditions, the existence of conflicting or invalid rules is avoided, improving the stability and reliability of the system.
[0070] 3.4 Rule Execution and Dynamic Adjustment:
[0071] The rule execution engine efficiently matches and executes rules based on the network structure (RETE network) constructed by the RETE algorithm. Tenants can adjust rules in real time and make them take effect immediately without restarting the system or making complex configuration changes. The RETE algorithm supports dynamic updates and recompilation of rules, ensuring the flexibility and timeliness of rule adjustment.
[0072] Second aspect, an interpreter system for business rules of the SAAS platform:
[0073] Such as Figure 2and Figure 4 As shown, the interpreter system is used to implement the adjustment method for the business rules of the SAAS platform described above, and it includes:
[0074] (1) A rule definition module that defines the basic composition of the rules: including rule ID, condition set (LHS), action set (RHS), priority, valid time range, etc. It supports multi-condition combinations, such as AND and OR logic, to meet the requirements of complex business scenarios.
[0075] At the same time, the rule definition module also includes the following two sub-modules:
[0076] (1.1) A graphical editing interface sub-module: A low-code platform where users can intuitively build rules by dragging and dropping condition blocks and action blocks. Each block represents an atomic condition or action, and users can easily set the logical relationships between conditions to form complex rule structures.
[0077] (1.2) A rule template library sub-module: Built-in with preset rule templates to help users quickly create common rules. At the same time, it supports users to customize templates to further improve the efficiency of rule definition.
[0078] (2) A RETE algorithm interpreter module that parses the rules defined by tenants into executable program logic and uses the RETE algorithm for pattern matching and execution. It includes the following sub-modules:
[0079] (2.1) A knowledge graph integration module: Builds a knowledge graph, extracts and aggregates knowledge from the parsed rules, and serves as the basis for rule verification. This ensures that the entities and attributes in the rules are valid and accurate in the business context;
[0080] (2.2) A rule storage module: Persistently stores all the rules defined by users using the neo4j graph database. This mechanism also assists users in correctly selecting the priority of the rules when building rules, thereby accelerating the execution order of the rules;
[0081] (2.3) A rule verification module: Before the rules are submitted for storage, first verify whether the entities in the rule conditions exist and the attributes are correct through knowledge graph queries. At the same time, utilize the traversal and query capabilities of the graph database to check whether the rule condition logic is coherent and avoid the generation of conflicting or invalid rules. After verification, the rules are sent to the RETE network for compilation and storage, ready for execution.
[0082] When the rules are executed, the RETE algorithm efficiently matches the activated rules based on the input factual data and performs the corresponding actions. For dynamically adjusted rules, by updating the rule nodes in the RETE network in real time, the rules can take effect immediately without overall recompilation or system restart. In addition, a feedback mechanism is introduced to continuously optimize and adjust the rules according to the rule execution results and business effects, forming an iterative loop to improve the decision-making quality.
[0083] (3) A rule management module that provides rule version control, testing, and release functions: Ensures the correctness and stability of the rules. Through version control, users can easily manage and track the historical versions of the rules; through the testing function, users can verify the rules before formal release; through the release function, users can release the rules that pass the test to the production environment.
[0084] (4) A dynamic adjustment module that allows tenants to dynamically adjust rules according to business needs and take effect in real time without restarting the system: Gives tenants great flexibility and convenience, enabling them to quickly respond to market changes and business needs. At the same time, this module also supports real-time monitoring and feedback mechanisms for rules, so that tenants can adjust and optimize the rules in a timely manner.
[0085] Compared with the prior art, the beneficial effects of the present invention are:
[0086] First, improve business flexibility and response speed: Under the technical solution of the present invention, tenants can quickly define and adjust rules according to their own business needs without waiting for the support of the development team, thus greatly improving the business flexibility and response speed. Tenants can flexibly define and adjust business rules to meet personalized needs.
[0087] Second, reduce maintenance costs and complexity: Under the technical solution of the present invention, the separation of rules from application code reduces the coupling degree of the system, making system upgrade and maintenance easier. At the same time, the efficiency of the RETE algorithm reduces the time for rule matching and execution, reducing the operating cost of the system.
[0088] Third, improve the usability of rule management: Under the technical solution of the present invention, the use of a graphical editing interface and a rule template library lowers the threshold for rule definition, enabling non-technical personnel to easily get started. This reduces the enterprise's dependence on professional personnel and lowers the labor cost.
[0089] Fourth, enhance the stability and reliability of the system: Under the technical solution of the present invention, format checking and syntax verification during the rule parsing process, as well as entity verification and attribute verification during the rule verification phase, ensure the correctness and consistency of the rules. This reduces the occurrence of runtime errors and enhances the stability and reliability of the system. Description of the Drawings
[0090] To more clearly illustrate the technical solutions in the embodiments of the present application or the prior art, the following will briefly introduce the accompanying drawings required for use in the description of the embodiments or the prior art. Obviously, the accompanying drawings in the following description are only some embodiments of the present application. For those of ordinary skill in the art, without creative efforts, other drawings can also be obtained based on these drawings.
[0091] Figure 1 It is a schematic diagram of the method logic of the present invention;
[0092] Figure 2 It is a schematic diagram of the method execution process of the present invention;
[0093] Figure 3 It is a schematic diagram of the system composition of the present invention;
[0094] Figure 4 It is a schematic diagram of the system execution process of the present invention. Specific Embodiments
[0095] To make the above objects, features, and advantages of the present invention more obvious and understandable, the following will provide a detailed description of the specific embodiments of the present invention with reference to the accompanying drawings. Many specific details are set forth in the following description to facilitate a full understanding of the present invention. However, the present invention can be implemented in many other ways different from those described herein. Those skilled in the art can make similar improvements without departing from the spirit of the present invention. Therefore, the present invention is not limited by the specific embodiments disclosed below;
[0096] It should be noted that the various embodiments in this specification are described in a progressive manner, and the key point of each embodiment is to illustrate the differences from other embodiments. The same or similar parts among the various embodiments can be referred to each other. For the devices disclosed in the embodiments, since they correspond to the methods disclosed in the embodiments, the description is relatively simple, and the relevant parts can be referred to the description of the method part.
[0097] Explanation of Related Terms:
[0098] (1) Rule Template Library: A preset collection of rule frameworks to facilitate users in quickly creating common rules.
[0099] (2) Format Check: Conduct a structural review of the input rules to ensure that they meet the predetermined format requirements.
[0100] (3) Syntax Verification: Check whether the symbols, expressions, etc. used in the rules conform to the syntax rules.
[0101] (4) RETE Algorithm: An algorithm for efficiently matching and executing rules.
[0102] (5) Neo4j graph database: A graphical database used to store and query complex relational data such as rules.
[0103] (6) Rule index: An indexing mechanism established for quickly retrieving rules.
[0104] (7) Knowledge graph: A graphical data structure representing knowledge entities and their relationships, used for rule verification.
[0105] (8) Rule logic (rule program): The executable logic or program formed after the rule is parsed.
[0106] (9) Entity verification and attribute verification: Checking whether the entities and their attributes involved in the rule exist and are correct.
[0107] (10) Graph database: A database that stores and queries data based on a graphical structure.
[0108] (11) RETE network: A network structure constructed by the RETE algorithm, used for efficiently matching rules.
[0109] (12) Rule node: A logical unit representing a rule in the RETE network.
[0110] (13) Rule execution engine: A component responsible for executing matching rules.
[0111] (14) Action set RHS: The set of operations or actions to be executed when the rule is activated.
[0112] Example 1: As Figures 1 - 2 shown, this example discloses the application of the method for adjusting business rules of the SAAS platform in the management of the online car-hailing platform. Suppose there is a multi-tenant SaaS online car-hailing platform, and different tenants (i.e., different online car-hailing companies) have different departure business logics. For example, some tenants require drivers to depart within 5 minutes after receiving an order, otherwise the order will be automatically cancelled; some tenants allow a longer waiting time, or have different cancellation policies. To meet these personalized needs, a rule design method based on the RETE algorithm interpreter is used to achieve flexible definition and adjustment of business rules. It includes the following steps S1 to S5.
[0113] In this example, regarding step S1: Activate the rule definition module: The administrator (or tenant representative) of the online car-hailing platform logs in to the system and enters the rule definition module. The system displays a graphical editing interface, allowing users to define business rules by dragging and dropping components, filling in parameters, etc.
[0114] Specifically, receive user input: The administrator selects "Create a new rule" and enters a rule name, such as "Departure time limit".
[0115] Through the interface, the administrator defines the condition set LHS of the rule: "The waiting time of the driver after receiving the order exceeds X minutes" (X is a configurable parameter).
[0116] The action set RHS is defined as: "Automatically cancel the order and notify the passenger and the driver".
[0117] Set the priority of the rule to "High" and the valid time range to "All day".
[0118] Specifically, format check and syntax verification: The system automatically performs format check and syntax verification on the input rule. If errors are found, such as mismatches between condition blocks and action blocks, or logical relationship errors, the system will pop up an error message and point out the problem. The administrator modifies the rule according to the prompt until the rule passes the verification.
[0119] In this embodiment, regarding step S2: The rule parsing and storage system uses a RETE algorithm interpreter to parse the rule that has passed the verification. The interpreter converts the condition set, action set, and priority of the rule into an internal representation form that the RETE algorithm can understand.
[0120] Specifically, convert to executable rule logic: The interpreter generates an executable rule program, which is part of the RETE network. When the input fact data (such as the driver's waiting time) meets the rule conditions, the corresponding actions (cancel the order and notify) will be triggered.
[0121] Specifically, use the neo4j graph database to store rules: The system converts the rule logic into a combination of nodes and edges in the neo4j graph database. Nodes represent the conditions, actions, and attributes of the rule, and edges represent the relationships between them.
[0122] Specifically, establish a rule index: To speed up rule retrieval and execution, the system establishes an index for the rule logic in the neo4j graph database.
[0123] In this embodiment, regarding step S3: Rule verification: The system calls the knowledge graph module that contains the business entities, attributes, and their relationships of the online car-hailing platform. The knowledge graph contains entities such as drivers, passengers, and orders and their related attributes.
[0124] Specifically, entity verification and attribute verification: The system checks whether the entities (such as drivers, orders) in the rule logic exist in the knowledge graph and whether the types of the entities (such as driver type, order status) meet the rule requirements. The system also checks whether the attributes (such as waiting time) in the rule logic are defined in the knowledge graph and whether the values of the attributes (such as 5 minutes) meet the rule requirements.
[0125] Specifically, for logical coherence verification: The system uses the neo4j graph database to traverse and query the logical coherence of the rule conditions. Ensure that when the driver's waiting time exceeds the set value, the action of canceling the order can be correctly triggered.
[0126] In this embodiment, regarding step S4: Rule compilation and loading: The system sends the verified rule logic into the RETE network for compilation. During the compilation process, the rule logic is converted into an internal representation that the RETE network can understand, that is, executable rule nodes are generated.
[0127] Specifically, loading the rules into the execution engine: The system loads the rule nodes into the rule execution engine. During the loading process, the rule nodes are bound to the internal data structure of the execution engine to ensure that the rules can be correctly executed.
[0128] Specifically, dynamically adjusting the rules: During the operation of the system, the administrator can modify, add, or delete rules through specific interfaces or tools. The system will automatically update the corresponding nodes in the RETE network in the background and ensure that the new rules can take effect immediately.
[0129] Exemplarily, the administrator can adjust the waiting time from 5 minutes to 10 minutes, and the system will automatically update the rule nodes in the RETE network.
[0130] In this embodiment, regarding step S5: Rule execution: When the driver receives an order and starts waiting, the system receives and processes this fact data in real time.
[0131] Specifically, rule matching and activation: The rule execution engine uses the RETE algorithm to quickly match relevant rules in the loaded rule network. If the driver's waiting time exceeds the set threshold (such as 10 minutes), the "departure time limit" rule is matched.
[0132] Specifically, executing the action set: After the rule is activated by the execution engine, its action set RHS is executed. The system automatically cancels the order and sends notifications to the passenger and the driver.
[0133] Specifically, generating business effects: By executing the rules, the system updates the business data (such as the order status becomes "cancelled"). At the same time, subsequent business processes are triggered (such as refunding the passenger, recording the driver's behavior, etc.). The system also generates reports or notifies relevant management personnel.
[0134] It is understandable that by introducing a rule design method based on a RETE algorithm interpreter, tenants can flexibly define and adjust business rules. They can set different conditions, actions, and priorities according to their own needs without modifying the underlying code. This greatly improves the flexibility and customizability of the rules. The graphical editing interface and rule template library make the rule definition process more intuitive and user-friendly. Even administrators without a technical background can easily create and modify rules. In addition, functions such as format checking, syntax verification, and logical coherence verification provided by the system ensure the correctness and effectiveness of the rules.
[0135] In summary, using a RETE algorithm interpreter and a neo4j graph database to store rule logic makes the execution of rules more efficient and stable. The system can quickly match and activate rules, reducing unnecessary calculations and resource consumption. At the same time, the function of dynamically adjusting rules avoids the need for overall recompilation or system restart, reducing maintenance costs and complexity.
[0136] Embodiment 2: This embodiment further provides a python execution program for the method of adjusting business rules for a SAAS platform as described in Embodiment 1:
[0137]
[0138]
[0139]
[0140]
[0141]
[0142]
[0143] In the above program: The define_rule function executes the definition of rules by the administrator through the graphical interface. The administrator inputs the rule name, condition set (lhs), action set (rhs), priority, and valid time range. The parse_and_store_rule function executes the parsing of the rule and stores it in the graph database.
[0144] The validate_rule function executes the entity verification, attribute verification, and logical coherence verification of the rule.
[0145] The compile_and_load_rule function executes the compilation of the rule and loads it into the RETE network.
[0146] The execute_rule function executes the action set of the rule when the fact data meets the rule conditions.
[0147] All of the above embodiments merely represent the implementation manners of the relevant actual applications of the present invention. The descriptions thereof are relatively specific and detailed, but should not be construed as limiting the scope of the invention patent. It should be noted that for those of ordinary skill in the art, without departing from the concept of the present invention, several modifications and improvements can still be made, and these all fall within the protection scope of the present invention. Therefore, the protection scope of the present invention patent shall be subject to the appended claims.
[0148] For those skilled in the art, it can be further realized that the units and algorithm steps of each example described in combination with the embodiments disclosed in this article can be implemented by electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the composition and steps of each example have been generally described according to functions in the above description. Whether these functions are executed in a hardware or software manner depends on the specific application and design constraints of the technical solution. Professional technicians can use different methods to implement the described functions for each specific application, but such implementation should not be considered as exceeding the scope of the present invention.
[0149] At the same time, those skilled in the art can understand that all or part of the processes of implementing the methods of all the above embodiments can be completed by instructing relevant hardware through a computer program. The computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above methods. Among them, any reference to a memory, storage, database, or other medium provided in this application and used in the embodiments can include non-volatile and / or volatile memories. Non-volatile memories can include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM), or flash memory. Volatile memories can include random access memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in various forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (SSRSDRAM), enhanced SDRAM (ESDRAM), synchronous link (Synchlink) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM), etc.
Claims
1. A method for adjusting business rules of a SAAS platform, characterized in that: When receiving the rule scheme activation instruction from the user, perform the following steps: S1, start the rule definition interface; receive the user through the graphical editing interface or call the template in the rule template library, automatically define and build business rules; S2, through the RETE algorithm interpreter module, parses the verified business rules and converts them into executable rule logic; S3 calls the knowledge graph to perform entity and attribute verification on the rule logic, and uses the graph database to traverse and query the logical coherence of the rule conditions; S4, sending the verified rule logic to the RETE network for compilation and loading the compiled rules into the rule execution engine; S5, when fact data is received, the rule execution engine matches the activated rules according to the RETE algorithm; by executing the action set RHS of the matching rules, the corresponding business effect is generated.
2. The adjustment method according to claim 1, characterized in that: The execution method of S1 includes: S100, automatically constructing business rules based on user input or selected template; the rule structure includes rule ID, condition set LHS, action set RHS, priority and effective time range; multi-condition combination includes AND logic and OR logic; S101, perform format check and syntax verification on the rules, including checking whether the structure of the rules is complete, whether the condition blocks and action blocks match, and whether the logical relationships are correct.
3. The adjustment method according to claim 1, characterized in that: The implementation method of S2 includes: S200, the parsing process of the RETE algorithm interpreter module includes converting the condition set, action set and priority of the rule into an internal representation that can be understood by the RETE algorithm; S201, converting the rules into executable rule logic; S202, using the neo4j graph database to convert the rule logic into a combination of nodes and edges, where the nodes represent the conditions, actions and attributes of the rules, and the edges represent the relationships between them.
4. The adjustment method according to claim 3, characterized in that: In the S2, it also includes: using the neo4j graph database to create an index for the rule logic; when the rule is executed, the rule that needs to be matched can be found.
5. The adjustment method according to claim 1, characterized in that: The implementation method of S3 includes: S300, calling a knowledge graph module including a graph data structure of business entities, attributes and their relationships; S301, verifying the entities in the rule logic, including checking whether the entities exist in the knowledge graph and whether the types of the entities meet the rule requirements; S302, verifying the attributes in the rule logic, including checking whether the attributes are defined in the knowledge graph and whether the values of the attributes meet the rule requirements; S303, using the neo4j graph database to check whether the rule conditions can form a coherent logical chain to ensure that the rules can be correctly triggered during execution.
6. The adjustment method according to claim 1, 2 or 5, characterized in that: The implementation method of S4 includes: S400, sending the verified rule logic to the RETE network for compilation. During the compilation process, the rule logic is converted into an internal representation that can be understood by the RETE network, that is, an executable rule node is generated; S401, during the loading process of the rule execution engine, the rule node is bound to the internal data structure of the execution engine; S402, when receiving a user's instruction to dynamically adjust the rules, the rule nodes in the RETE network are updated in real time so that the new rules can take effect immediately.
7. The adjustment method according to claim 6, characterized in that: In S400, the rule node includes the conditions, actions and related logical relationships of the rule; each rule node corresponds to a specific condition or action in the rule, and when the input fact data meets the condition of the node, the corresponding action will be triggered.
8. The adjustment method according to claim 6, characterized in that: In said S5, when new fact data is received, the rule execution engine uses the RETE algorithm to quickly match relevant rules in the loaded rule network; When the condition part of the rule matches the fact data, the rule is activated by the execution engine, and the activated rule is equivalent to its action part being executed; For each activated rule, the rule execution engine executes its action set RHS, including updating the state of business objects, triggering events and / or calling external services.
9. An interpreter system for implementing the adjustment method according to any one of claims 1 to 8, characterized in that: The interpreter system comprises: A rule definition module that defines the basic composition of rules; The RETE algorithm interpreter module parses the tenant-defined rules into executable program logic and uses the RETE algorithm for pattern matching and execution; A rule management module that provides version control, testing, and publishing functions for rules; Allow tenants to dynamically adjust rules based on business needs and take effect in real time without restarting the system's dynamic adjustment module.
10. The interpreter system according to claim 9, characterized in that: The rule definition module includes a graphical editing interface submodule and a rule template library submodule; The RETE algorithm interpreter module includes a knowledge graph integration module, a rule storage module and a rule verification module.
Citation Information
Patent Citations
Software customization system based on software as a service (SAAS)
CN103164206A
Cloud platform and method for providing machine learning service
CN112311605A
Information checking method, device and equipment based on SaaS platform, and storage medium
CN112801792A
Intelligent interaction method, device and equipment based on SAAS platform and storage medium
CN116974652A
Multi-latitude rule engine algorithm and method based on digital marketing data service SaaS system
CN117687603A
Cited By
Dynamic rule engine loading method
CN120565011A
