Service rule dynamic configuration method, device and system based on rule engine

Through the dynamic configuration method of business rules based on rules engines, the problem of traditional industrial software development requiring professional programming skills and a lot of development time is solved, and the development cycle and maintenance costs are reduced and the efficient utilization of resources is achieved.

CN119597294APending Publication Date: 2025-03-11WUXI XUELANG DIGITAL TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411644579.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-11-18
Publication Date
2025-03-11

AI Technical Summary

Technical Problem

Traditional industrial software development requires professional programming skills and a lot of development time, resulting in extended development cycles, repeated labor, high maintenance costs and waste of resources.

Method used

The business rules dynamic configuration method based on the rules engine is adopted, and by receiving the business rules dynamic configuration request, dynamic analysis is performed, the current business rules are updated, and the business rules after configuration is output.

Benefits of technology

It reduces development cycle and maintenance costs, avoids waste of resources, and realizes flexible configuration and rapid response of business logic.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119597294A_ABST
    Figure CN119597294A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of industrial software development, and particularly discloses a business rule dynamic configuration method, device and system based on a rule engine, and the method comprises the steps: receiving a business rule dynamic configuration request which at least comprises a business rule configuration target; performing dynamic analysis according to the service rule dynamic configuration request to obtain a dynamic analysis result; configuring and updating a current service rule according to the dynamic analysis result; and outputting the service rule after configuration update. According to the business rule dynamic configuration method based on the rule engine, dynamic analysis is achieved through the business rule dynamic configuration request, then configuration updating of the business rule is achieved, and the technical problem that professional programming ability and a large amount of development time are needed in a traditional software development mode is solved; therefore, the development cycle and the maintenance cost are reduced, and resource waste is avoided.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of industrial software development, and in particular to a business rule dynamic configuration method based on a rule engine, a business rule dynamic configuration device based on a rule engine, an industrial software development system based on a rule engine, and an intelligent manufacturing system. Background Art

[0002] The essence of intelligent manufacturing is to achieve automation, efficiency and intelligence of the production process through the use of advanced technology and system integration, through digitalization, networking and intelligence. In the intelligent manufacturing environment, the digital base is an important component used to display and manage production-related data, indicators and operation interfaces. The digital base page usually combines multiple components by dragging and dropping, and builds them in the form of building blocks. Users can configure component properties and communication between components through the panel, such as list data display, chart data display, real-time monitoring view, etc.

[0003] At present, traditional industrial software development requires cooperation between front-end and back-end development teams. The front-end is responsible for user interface design and development, and the back-end is responsible for data processing, business logic and system integration. This development method requires professional programming skills and a lot of development time. It is also difficult to precipitate templates and achieve business reuse, leading to problems such as extended development cycle, duplication of work, high maintenance costs and waste of resources.

[0004] Therefore, how to solve the high development cost problem of traditional industrial software development has become a technical problem that needs to be urgently solved by technical personnel in this field. Summary of the invention

[0005] The present invention provides a business rule dynamic configuration method based on a rule engine, a business rule dynamic configuration device based on a rule engine, an industrial software development system and an intelligent manufacturing system based on a rule engine, which solve the problem of high development cost of traditional industrial software development existing in related technologies.

[0006] As a first aspect of the present invention, a method for dynamically configuring business rules based on a rule engine is provided, which includes: Receiving a business rule dynamic configuration request, wherein the business rule dynamic configuration request at least includes a business rule configuration target; Dynamically configure the request according to the business rules to perform dynamic analysis and obtain dynamic analysis results; Configure and update the current business rules according to the dynamic analysis result; Output the business rules after the configuration is updated.

[0007] Further, dynamically configuring the request according to the business rule to perform dynamic parsing and obtain a dynamic parsing result includes: Extracting the business rule configuration target in the business rule dynamic configuration request; Converting the business rule configuration target into a business rule configuration string; Convert the business rule configuration string into a word sequence; The word sequence is parsed into a syntax tree to obtain a dynamic parsing result.

[0008] Further, converting the business rule configuration string into a word sequence includes: Parse the business rule configuration strings one by one to obtain words corresponding to each business rule configuration string; Place the words corresponding to all business rule configuration strings in the parsing order to form a word sequence.

[0009] Further, the business rule configuration strings are parsed one by one to obtain words corresponding to each business rule configuration string, including: Parsing the business rule configuration string one by one in order from the outside to the inside, wherein the order from the outside to the inside includes: external variable declaration, external variable name, internal attribute information, internal variable name, operation rule and operand; The parsed words are formed into word sequences.

[0010] Further, when the business rule configuration character strings are parsed one by one, lexical error detection is performed on the parsed words; When a lexical error is found, an exception is generated.

[0011] Further, parsing the word sequence into a syntax tree includes: The word sequence is parsed in the order of the character string parsing configured by the business rule to form a syntax tree, wherein the levels of the syntax tree are, from high to low, functions, variables, and operands.

[0012] Further, parsing the word sequence into a syntax tree also includes: Traversing each node of the syntax tree in descending order of the hierarchy of the syntax tree; When traversing to the current node, determine whether the corresponding calculation needs to be performed; If the corresponding calculation needs to be performed at the current node, the calculation corresponding to the node is performed according to the calculation rules; When the traversal of each node of the syntax tree is completed, each node completes the corresponding calculation at the same time.

[0013] As another aspect of the present invention, a business rule dynamic configuration device based on a rule engine is provided, which is used to implement the business rule dynamic configuration method based on a rule engine as described above, and includes: A receiving module, configured to receive a business rule dynamic configuration request, wherein the business rule dynamic configuration request at least includes a business rule configuration target; A dynamic parsing module, used to dynamically parse the request according to the business rule dynamic configuration, and obtain a dynamic parsing result; A configuration update module, used to configure and update current business rules according to the dynamic analysis results; The output module is used to output the business rules after the configuration is updated.

[0014] As another aspect of the present invention, there is provided an industrial software development system based on a rule engine, which includes: a data input device, a business decision device and the business rule dynamic configuration device based on the rule engine as described above, the data input device and the business decision device are both communicatively connected with the business rule dynamic configuration device based on the rule engine, the data input device is used to input data, the business rule dynamic configuration device based on the rule engine is used to update the business rule configuration according to the input data, and the business decision device is used to make business decisions according to the updated business rules.

[0015] As another aspect of the present invention, an intelligent manufacturing system is provided, which includes the industrial software development system based on the rule engine as described above.

[0016] The business rule dynamic configuration method based on the rule engine provided by the present invention realizes dynamic parsing through the business rule dynamic configuration request, and then realizes the configuration update of the business rules, solves the technical problems of requiring professional programming capabilities and a lot of development time in the traditional software development model, thereby reducing the development cycle and maintenance costs and avoiding waste of resources. BRIEF DESCRIPTION OF THE DRAWINGS

[0017] The accompanying drawings are used to provide further understanding of the present invention and constitute a part of the specification. Together with the following specific embodiments, they are used to explain the present invention, but do not constitute a limitation of the present invention.

[0018] Figure 1 A flow chart of a method for dynamically configuring business rules based on a rule engine provided by the present invention.

[0019] Figure 2 A schematic diagram showing the difference between the traditional encoding method and the rule engine provided by the present invention.

[0020] Figure 3 This is a schematic diagram of the working principle of the rule engine provided by the present invention.

[0021] Figure 4 A flow chart of the dynamic parsing method provided by the present invention.

[0022] Figure 5 A schematic diagram of dynamically parsing a character string provided by the present invention.

[0023] Figure 6 The present invention provides a flowchart for converting a character string into a word sequence.

[0024] Figure 7 A flow chart of the method for converting a character string into a word sequence provided by the present invention.

[0025] Figure 8 A schematic diagram of parsing a string provided by the present invention into a syntax tree.

[0026] Fig. 9 A schematic diagram of syntax tree traversal provided by the present invention.

[0027] Fig.10 This is a structural block diagram of the business rule dynamic configuration device based on the rule engine provided by the present invention. DETAILED DESCRIPTION

[0028] It should be noted that, in the absence of conflict, the embodiments of the present invention and the features in the embodiments may be combined with each other. The present invention will be described in detail below with reference to the accompanying drawings and in combination with the embodiments.

[0029] In order to enable those skilled in the art to better understand the scheme of the present invention, the technical scheme in the embodiment of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiment of the present invention. Obviously, the described embodiment is only a part of the embodiment of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative work should fall within the scope of protection of the present invention.

[0030] It should be noted that the terms "first", "second", etc. in the specification and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so as to describe the embodiments of the present invention described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.

[0031] In this embodiment, a method for dynamically configuring business rules based on a rule engine is provided. Figure 1 is a flow chart of a method for dynamically configuring business rules based on a rule engine according to an embodiment of the present invention. Figure 1 As shown, including: S100, receiving a business rule dynamic configuration request, where the business rule dynamic configuration request at least includes a business rule configuration target; In the embodiment of the present invention, the business rule dynamic configuration request at least includes a business rule configuration target, and dynamic parsing can be achieved based on the business rule configuration target.

[0032] S200, dynamically parse the request according to the business rule dynamic configuration to obtain a dynamic parsing result; In the embodiment of the present invention, the dynamic parsing can be specifically divided into two steps: first, converting the character string into a word sequence, and second, parsing the word sequence into a syntax tree. Based on the dynamic parsing, a dynamic parsing result can be obtained.

[0033] S300, configuring and updating current business rules according to the dynamic analysis result; The current business rules can be updated according to the above dynamic analysis results.

[0034] S400: Output the updated business rules.

[0035] In the embodiment of the present invention, the rule engine is specifically developed from the reasoning engine, which is a component embedded in the application program, which realizes the separation of business decisions from the application program code and uses predefined semantic modules to write business decisions. It accepts data input, interprets business rules, and makes business decisions based on business rules. From the perspective of business use, the rule engine can well help business personnel to make new business rules take effect directly by adjusting the configuration without recoding, compiling, and deploying the application.

[0036] like Figure 2 It explains the difference between traditional coding methods and rule engines. From this, we can clearly see that the application of rule engine technology can greatly improve related businesses.

[0037] From a technical point of view, the rule engine is responsible for obtaining outputs based on the input of the caller and the configured rules. For example, a very simple example is user registration service. When the user is under 18 years old, we return an error message, otherwise it indicates that the registration is successful. Here the input is user information, the rule is age judgment, and the output is various results of the registration service. The general process is as follows: Figure 3 shown.

[0038] In the above business, the main job of the rule engine is to provide a dynamically configurable way to modify the calculation logic of the application without recoding to achieve the purpose of business change. Or for the user registration business, if the entry age of our application is lowered in the future, and users over 16 years old can register, then we only need to modify the above Figure 3 The computing configuration part can make new business rules take effect in real time, greatly improve business efficiency and seize market opportunities.

[0039] Therefore, the business rule dynamic configuration method based on the rule engine provided by the present invention realizes dynamic parsing through the dynamic configuration request of the business rules, and then realizes the configuration update of the business rules, solves the technical problems of requiring professional programming capabilities and a lot of development time in the traditional software development model, thereby reducing the development cycle and maintenance costs and avoiding waste of resources.

[0040] Specifically, in the embodiment of the present invention, the dynamically configured computing logic part, namely the rule engine, is a syntax parsing technology based on technical personnel and with the goal of being efficient, flexible and fully functional.

[0041] In the embodiment of the present invention, the request is dynamically parsed according to the business rule dynamic configuration to obtain a dynamic parsing result, such as Figure 4 As shown, including: S210, extracting the business rule configuration target in the business rule dynamic configuration request; S220, converting the business rule configuration target into a business rule configuration character string; Dynamic parsing is responsible for calculating the grammatical meaning of a string of input characters, which may be any code, and executing these grammatical meanings, such as Figure 5 As shown in the figure, dynamic parsing is divided into two stages: converting a string into a word sequence and parsing the word sequence into a syntax tree. The words here are the words designed based on the basic Java syntax we just talked about. For example, integer words can be represented by regular expressions: "[-+]{0,1}[0-9]+".

[0042] S230, converting the business rule configuration string into a word sequence; According to the input string, it starts parsing from the first character one by one. After each parsing, a word is formed and put into the word sequence until the last word. During this parsing process, if a lexical error is found, an exception is thrown. For example, the function noun method requires that the function must start with a letter. If the function name entered by the user is like this: 123now(), an exception will be thrown directly: Illegal word: '123now()'. The process of converting a string into a word sequence is as follows: Figure 6shown.

[0043] Specifically, Figure 7 As shown, the business rule configuration string is converted into a word sequence, including: S231, parsing the business rule configuration strings one by one to obtain a word corresponding to each business rule configuration string; It should be understood that when parsing the business rule configuration character strings one by one, they can be parsed one by one in an order from the outside to the inside to obtain the corresponding words after parsing.

[0044] Specifically, the business rule configuration strings are parsed one by one to obtain words corresponding to each business rule configuration string, including: Parsing the business rule configuration string one by one in order from the outside to the inside, wherein the order from the outside to the inside includes: external variable declaration, external variable name, internal attribute information, internal variable name, operation rule and operand; The parsed words are formed into word sequences.

[0045] S232. Place the words corresponding to all business rule configuration strings in a parsing order to form a word sequence.

[0046] It should be noted that when the business rule configuration character strings are parsed one by one, lexical error detection is performed on the parsed words; when a lexical error is found, an abnormal signal is generated.

[0047] S240: Parse the word sequence into a syntax tree to obtain a dynamic parsing result.

[0048] Specifically, parsing the word sequence into a syntax tree includes: The word sequence is parsed in the order of the character string parsing configured by the business rule to form a syntax tree, wherein the levels of the syntax tree are, from high to low, functions, variables, and operands.

[0049] It should be understood that after the lexical analysis stage, a sequence of words is obtained, and now it is time to convert it into a syntax tree. When defining words at the beginning, you also need to define syntax such as calculation syntax: exp cal exp. The calculation expression represented by this syntax means two expressions with a calculator in between to form a calculation expression. Here, exp stands for expression. Expressions can be of many types. Variables are also expressions, numbers are also expressions, functions are also expressions, and calculation expressions are also a representation, that is, the value of any type of expression can be used for calculation. In order to reflect the hierarchy of the syntax tree, this string is used for demonstration: add(user.age, 1). The syntax tree that the string is finally parsed into is as follows: Figure 8 shown.

[0050] In an embodiment of the present invention, parsing the word sequence into a syntax tree further includes: Traversing each node of the syntax tree in descending order of the hierarchy of the syntax tree; When traversing to the current node, determine whether the corresponding calculation needs to be performed; If the corresponding calculation needs to be performed at the current node, the calculation corresponding to the node is performed according to the calculation rules; When the traversal of each node of the syntax tree is completed, each node completes the corresponding calculation at the same time.

[0051] It should be understood that from the syntax tree, we can see that the add function name is at a higher level, while the user variable, age variable, and 1 number are at a lower level. Usually, when calculating the syntax tree, each node is traversed from left to right and from top to bottom, and when traversing the node, it is determined whether the corresponding calculation needs to be performed. Finally, when all nodes are traversed, the calculation corresponding to the syntax has been completed. The specific traversal process is as follows Fig. 9 shown.

[0052] In summary, the dynamic configuration method of business rules based on the rule engine provided by the present invention enables business personnel to make new business logic effective by directly modifying the configuration without having to go through the traditional coding process again when encountering changes in business logic; business personnel can write any syntax that meets the specifications according to the pre-defined syntax specifications to make new business rules effective. The rule engine can automatically identify incorrect configurations and return corresponding prompts to the user to help the user modify their configuration. The rule engine can identify each atomic configuration and execute the corresponding calculation logic according to the configuration rules; the rule engine can identify nested configurations, and layer the nesting, execute the calculations corresponding to each configuration from the inside out, and cache the results of each calculation for subsequent configurations.

[0053] Therefore, based on the above functions, applications can be quickly built, and accumulation and precipitation can be achieved to achieve rapid delivery of industrialized software. The precipitation of application-level and business-level templates improves resource reuse and reduces development costs. The business rule dynamic configuration method based on the rule engine provided by the present invention makes application development more efficient and flexible, and provides important support for the development and delivery of industrialized software.

[0054] As another embodiment of the present invention, a device 100 for dynamically configuring business rules based on a rule engine is provided, which is used to implement the method for dynamically configuring business rules based on a rule engine as described above, wherein: Fig.10 As shown, including: A receiving module 110 is configured to receive a business rule dynamic configuration request, wherein the business rule dynamic configuration request at least includes a business rule configuration target; A dynamic parsing module 120, configured to perform dynamic parsing according to the business rule dynamic configuration request to obtain a dynamic parsing result; Configuration update module 130, used for updating current business rules according to the dynamic analysis result configuration; The output module 140 is used to output the business rules after the configuration is updated.

[0055] The business rule dynamic configuration device based on the rule engine provided by the present invention realizes dynamic analysis through the business rule dynamic configuration request, and then realizes the configuration update of the business rules, solves the technical problems of requiring professional programming capabilities and a lot of development time in the traditional software development model, thereby reducing the development cycle and maintenance costs and avoiding waste of resources.

[0056] Regarding the specific working process and principle of the business rule dynamic configuration device based on the rule engine provided by the present invention, reference can be made to the description of the business rule dynamic configuration method based on the rule engine in the previous text, which will not be repeated here.

[0057] As another embodiment of the present invention, there is provided an industrial software development system based on a rule engine, which includes: a data input device, a business decision device and the business rule dynamic configuration device based on the rule engine as described above, the data input device and the business decision device are both communicatively connected with the business rule dynamic configuration device based on the rule engine, the data input device is used to input data, the business rule dynamic configuration device based on the rule engine is used to update the business rule configuration according to the input data, and the business decision device is used to make business decisions according to the updated business rules.

[0058] The business rule dynamic configuration system based on the rule engine provided by the present invention realizes dynamic parsing through business rule dynamic configuration requests, and then realizes configuration update of business rules, solves the technical problems of requiring professional programming capabilities and a lot of development time in the traditional software development model, thereby reducing the development cycle and maintenance costs and avoiding waste of resources.

[0059] The specific working process and principle of the business rule dynamic configuration system based on the rule engine provided by the present invention can be referred to the description of the business rule dynamic configuration method based on the rule engine in the previous text, which will not be repeated here.

[0060] As another embodiment of the present invention, an intelligent manufacturing system is provided, which includes the industrial software development system based on the rule engine as described above.

[0061] The intelligent manufacturing system provided by the present invention, due to the adoption of the industrial software development system based on the rule engine mentioned above, can solve the technical problems of the traditional software development model that require professional programming capabilities and a lot of development time, thereby reducing the development cycle and maintenance costs and avoiding waste of resources.

[0062] It is to be understood that the above embodiments are merely exemplary embodiments used to illustrate the principles of the present invention, but the present invention is not limited thereto. For those of ordinary skill in the art, various modifications and improvements can be made without departing from the spirit and essence of the present invention, and these modifications and improvements are also considered to be within the scope of protection of the present invention.

Claims

1. A method for dynamically configuring business rules based on a rule engine, characterized in that: include: Receiving a business rule dynamic configuration request, wherein the business rule dynamic configuration request at least includes a business rule configuration target; Dynamically configure the request according to the business rules to perform dynamic analysis and obtain dynamic analysis results; Configure and update the current business rules according to the dynamic analysis result; Output the business rules after the configuration is updated.

2. The method for dynamically configuring business rules based on a rule engine according to claim 1, characterized in that: Dynamically configuring the request according to the business rule to perform dynamic parsing and obtain dynamic parsing results, including: Extracting the business rule configuration target in the business rule dynamic configuration request; Converting the business rule configuration target into a business rule configuration string; Convert the business rule configuration string into a word sequence; The word sequence is parsed into a syntax tree to obtain a dynamic parsing result.

3. The method for dynamically configuring business rules based on a rule engine according to claim 2, characterized in that: Convert the business rule configuration string into a word sequence, including: Parse the business rule configuration strings one by one to obtain words corresponding to each business rule configuration string; Place the words corresponding to all business rule configuration strings in the parsing order to form a word sequence.

4. The method for dynamically configuring business rules based on a rule engine according to claim 3, characterized in that: Parse the business rule configuration strings one by one to obtain words corresponding to each business rule configuration string, including: Parsing the business rule configuration string one by one in order from the outside to the inside, wherein the order from the outside to the inside includes: external variable declaration, external variable name, internal attribute information, internal variable name, operation rule and operand; The parsed words are formed into word sequences.

5. The method for dynamically configuring business rules based on a rule engine according to claim 3, characterized in that: When the business rule configuration character strings are parsed one by one, lexical error detection is performed on the parsed words; When a lexical error is found, an exception is generated.

6. The method for dynamically configuring business rules based on a rule engine according to claim 2, characterized in that: Parsing the word sequence into a syntax tree includes: The word sequence is parsed in the order of the character string parsing configured by the business rule to form a syntax tree, wherein the levels of the syntax tree are, from high to low, functions, variables, and operands.

7. The method for dynamically configuring business rules based on a rule engine according to claim 6, characterized in that: Parsing the word sequence into a syntax tree also includes: Traversing each node of the syntax tree in descending order of the hierarchy of the syntax tree; When traversing to the current node, determine whether the corresponding calculation needs to be performed; If the corresponding calculation needs to be performed at the current node, the calculation corresponding to the node is performed according to the calculation rules; When the traversal of each node of the syntax tree is completed, each node completes the corresponding calculation at the same time.

8. A business rule dynamic configuration device based on a rule engine, used to implement the business rule dynamic configuration method based on a rule engine according to any one of claims 1 to 7, characterized in that: include: A receiving module, configured to receive a business rule dynamic configuration request, wherein the business rule dynamic configuration request at least includes a business rule configuration target; A dynamic parsing module, used to dynamically parse the request according to the business rule dynamic configuration, and obtain a dynamic parsing result; A configuration update module, used to configure and update current business rules according to the dynamic analysis results; The output module is used to output the business rules after the configuration is updated.

9. An industrial software development system based on a rule engine, characterized in that: include: A data input device, a business decision device and a business rule dynamic configuration device based on a rule engine as described in claim 8, wherein the data input device and the business decision device are both communicatively connected to the business rule dynamic configuration device based on a rule engine, the data input device is used to input data, the business rule dynamic configuration device based on a rule engine is used to update the business rule configuration according to the input data, and the business decision device is used to make business decisions according to the updated business rules.

10. An intelligent manufacturing system, characterized in that: Including the industrial software development system based on rule engine as described in claim 9.