Method and apparatus for verifying rule for rule engine, and electronic device

The method and apparatus convert rules into constraint satisfaction problems to automatically verify feasibility and conflicts, enhancing rule engine efficiency by providing feasible solutions and ensuring consistent rule integration.

WO2026000371A1PCT designated stage Publication Date: 2026-01-02SIEMENS AG +1
View PDF 5 Cites 0 Cited by

Patent Information

Application Number
PCT/CN2024/102580
Authority / Receiving Office
WO · WO
Patent Type
Applications
Current Assignee / Owner
Filing Date
2024-06-28
Publication Date
2026-01-02

AI Technical Summary

Technical Problem

Existing rule engines struggle to automatically verify the feasibility and potential conflicts of user-defined rules, especially in complex scenarios, leading to inefficiencies and manual verification challenges.

Method used

A method and apparatus that convert rules into constraint satisfaction problems, using solvers to automatically verify feasibility and conflicts by constructing models based on variables, constraints, and value ranges, ensuring consistency with service logic.

Benefits of technology

Automatically verifies rule feasibility and conflicts, improving efficiency and providing feasible solutions, thus ensuring consistent rule integration without manual test cases.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN2024102580_02012026_PF_FP_ABST
    Figure CN2024102580_02012026_PF_FP_ABST
Patent Text Reader

Abstract

The present disclosure relates to a method and apparatus for verifying a rule of a rule engine, and an electronic device. The method for verifying the rule of the rule engine includes: obtaining a rule to be verified; extracting variables and a constraint condition from the rule to be verified; determining a value range of each variable and an incompatible rule, which is contradictory with the rule to be verified, in a rule engine database; constructing a first model and a second model based on one or more of the variables, the constraint condition, the value ranges of the variables, and the incompatible rule which is contradictory with the rule to be verified, wherein the first model is used for verifying whether the rule to be verified is feasible, and the second model is used for verifying whether the rule to be verified is in conflict with the incompatible rule; and solving the first model and the second model by using a solver, and verifying whether the rule to be verified is feasible and is in conflict with the incompatible rule.
Need to check novelty before this filing date? Find Prior Art

Description

METHOD AND APPARATUS FOR VERIFYING RULE FOR RULE ENGINE, AND ELECTRONIC DEVICETECHNICAL FIELD

[0001] The present disclosure generally relates to the technical field of factory digitization, and in particular, to a method and apparatus for verifying a rule of a rule engine, and an electronic device.BACKGROUND

[0002] In scenarios of the Internet of Things and digitalization, thousands of data have been acquired from devices, production processes, and the like. In order to detect events in data, a rule engine is often used to define and execute rules regularly or in a stream manner, to generate the corresponding events or execute related processing workflows. In addition, the rule engine has become a foundation of event driven programming. The rule engine can be run independently of existing application programs, extend the functionality of an original application program, and play a role in decoupling.

[0003] Problem 1

[0004] However, the problem is, for a rule with one or several conditions, how to ensure it is feasible. For the following rule that only contains Boolean variables, it is actually not feasible. In other words, regardless of how values of these variables change, this rule will never be triggered. This situation is very common because a user often updates rules or add rules frequently to adapt to new service scenarios.

[0005] The above rule is very simple and only includes a Boolean variable. For a complex rule, it can be, for example, represented in the following format. It is difficult to manually verify whether such rules are feasible.

[0006] rule: (bearing1. rms>30) ∧ ( (bearing1. rms+bearing2. rms)<60) ∧ (bearing2. rms>40)

[0007] At present, some rule engines support allowing a user to enter a test case to verify the accuracy of rule definitions. Apparently, this manual verification method is not sufficient to meet needs of the user especially when there are relationships between a plurality of rules in large-sized application programs.

[0008] Problem 2

[0009] A typical case in an Internet of things application program is to use a rule engine to generate and cancel an alarm.

[0010] ·If Rule 1 is satisfied, an alarm is generated.

[0011] ·If Rule 2 is satisfied, an alarm is canceled.

[0012] An implicit constraint condition is that Rule 1 and Rule 2 cannot be triggered simultaneously. In other words, the conjunction of Rule 1 and Rule 2 should have no feasible solution.

[0013] At present, most rule engines do not provide any verification solutions for user-defined rules. For example, some open-source Internet of things platforms provide rule engines embedded into a system. However, only a configuration page is provided to define rules. If a rule is not feasible or conflicts with other rules, there is no prompt on a page of the platform.

[0014] There are still some professional rule engines that allow a user to: enter some test cases to verify the feasibility or work as needed when defining rules. However, the efficiency of this verification method achieved by a user entering test cases is low.SUMMARY

[0015] A brief overview of the present disclosure is given below to provide a basic understanding of certain aspects of the present disclosure. It should be understood that this summary is not an exhaustive overview of the present disclosure. It is not intended to determine key or important parts of the present disclosure, nor is it intended to limit the scope of the present disclosure. The purpose is merely to present some concepts in a simplified form as a prelude to the more detailed description that is discussed later.

[0016] In view of this, the present disclosure provides a method for verifying a rule of a rule engine.

[0017] According to an aspect of the present disclosure, a method for verifying a rule of a rule engine is provided, including:

[0018] obtaining a rule to be verified;

[0019] extracting variables and a constraint condition from the rule to be verified;

[0020] determining a value range of each variable and an incompatible rule, which is contradictory with the rule to be verified, in a rule engine database;

[0021] constructing a first model and a second model based on one or more of the variables, the constraint condition, the value ranges of the variables, and the incompatible rule which is contradictory with the rule to be verified, wherein the first model is used for verifying whether  the rule to be verified is feasible, and the second model is used for verifying whether the rule to be verified is in conflict with the incompatible rule; and

[0022] solving the first model and the second model by using a solver, and verifying whether the rule to be verified is feasible and is in conflict with the incompatible rule.

[0023] In this way, the rule of the rule engine can be automatically verified, and whether an incompatible rule has a conflict can be further verified.

[0024] Optionally, in an example of the above aspect, in a case that the rule to be verified is verified to be feasible, the method further includes: adding the rule to be verified into the rule engine database.

[0025] Optionally, in an example of the above aspect, in a case that the rule to be verified is verified to be feasible, the method further includes: providing one or more feasible schemes of the rule to be verified.

[0026] Optionally, in an example of the above aspect, in a case that the rule to be verified is verified to be infeasible, the method further includes: providing prompt information indicating that the rule to be verified is infeasible.

[0027] Optionally, in an example of the above aspect, in a case that the rule to be verified is verified to be in conflict with the incompatible rule, the method further includes: providing prompt information indicating that the rule to be verified is in conflict with the incompatible rule.

[0028] In this way, a user can separately perform corresponding processing on feasible, infeasible, and conflicting rules.

[0029] Optionally, in an example of the above aspect, the constructing the first model includes: converting the rule to be verified into a constraint satisfaction model; and the constructing the second model includes: combining the rule to be verified with the incompatible rule to form a constraint satisfaction model.

[0030] In this way, models can be separately constructed for a separate rule and a plurality of incompatible rules, and the feasibility of a rule and whether the rule is in conflict can be verified by solving the models.

[0031] Optionally, in an example of the above aspect, the value range of each variable is determined by at least one of the following modes:

[0032] pre-configuring the value range in the rule to be verified, calculating the value range according to historical data, and obtaining the value range from a database.

[0033] In this way, a rule needing to be verified can be determined according to a need.

[0034] According to another aspect of the present disclosure, an apparatus for verifying a rule of  a rule engine is provided, including:

[0035] a rule to be verified obtaining unit, configured to obtain a rule to be verified;

[0036] an extraction unit, configured to extract variables and a constraint condition from the rule to be verified;

[0037] a value range and incompatible rule determining unit, configured to determine a value range of each variable and an incompatible rule, which is in conflict with the rule to be verified, in a rule engine database;

[0038] a model construction unit, configured to: construct a first model and a second model based on one or more of the variables, the constraint condition, the value ranges of the variables, and the incompatible rule which is contradictory with the rule to be verified, wherein the first model is used for verifying whether the rule to be verified is feasible, and the second model is used for verifying whether the rule to be verified is in conflict with the incompatible rule; and

[0039] a solving unit, configured to: solve the first model and the second model by using a solver, and verify whether the rule to be verified is feasible and is in conflict with the incompatible rule.

[0040] According to another aspect of the present disclosure, a computing device is provided, including: at least one processor; and a memory coupled to the at least one processor, wherein the memory is configured to store instructions, and the instructions, when executed by the at least one processor, cause the processor to perform the method described above.

[0041] According to another aspect of the present disclosure, a non-transient machine-readable storage medium is provided, having executable instructions stored thereon, wherein the instructions, when executed, cause a machine to perform the method described above.

[0042] According to another aspect of the present disclosure, a computer program is provided, including computer-executable instructions. The computer-executable instructions, when executed, cause at least one processor to perform the method described above.

[0043] According to another aspect of the present disclosure, a computer program product is provided, which is tangibly stored on a computer-readable medium and includes computer-executable instructions. The computer-executable instructions, when executed, cause at least one processor to perform the method described above.

[0044] According to the technical solutions of the embodiments of the present disclosure, the rule to be verified is converted into a constraint satisfaction problem. The rule in the rule engine is automatically verified to ensure consistency with a service logic, without providing any test case to verify the rule, thereby improving the efficiency of rule verification.

[0045] The method according to the embodiments of the present disclosure can further provide a  user some feasible solutions as reference.

[0046] The method according to the embodiments of the present disclosure converts the problem of conflicts of incompatible rules into a constraint satisfaction problem. The problem is solved by using a constraint satisfaction algorithm, so that whether there is a conflict with the incompatible rule can be automatically verified.BRIEF DESCRIPTION OF THE DRAWINGS

[0047] Referring to the descriptions of the embodiments of the present disclosure in combination with the accompanying drawings, the foregoing and other objectives, features, and advantages of the present disclosure may be more easily understood. Components in the accompanying drawings are merely used for demonstrating the principle of the present disclosure. In the accompanying drawings, the same or similar technical features or components may be represented by using the same or similar reference numerals. In the accompanying drawings:

[0048] FIG. 1 is a flowchart of an exemplary process of a method 100 for verifying a rule of a rule engine according to an embodiment of the present disclosure.

[0049] FIG. 2 is a block diagram of an exemplary configuration of an apparatus 200 for verifying a rule of a rule engine according to an embodiment of the present disclosure.

[0050] FIG. 3 is a block diagram of a computing device for verifying a rule of a rule engine according to an embodiment of the present disclosure.

[0051] Reference numerals are as follows:

[0052] 100: method for verifying a rule of a rule   S102, S104, S106, S108, S110, S112, engine                  S114, S116, S118: Steps

[0053] 200: apparatus for verifying a rule of a rule   202: rule to be verified obtaining unit engine

[0054] 204: extraction unit                   206: value range and incompatible ruledetermining unit

[0055] 208: model construction unit 2              210: solving unit

[0056] 212: rule adding unit                       214: feasible scheme providing unit

[0057] 216: infeasible situation prompt unit         218: conflict prompt unit

[0058] Y:The rule to be verified is feasible         N: The rule to be verified is infeasible

[0059] C:There is a conflict among incompatible 300: Computing device

[0060] rules

[0061] 302: Processor                      304: MemoryDETAILED DESCRIPTION

[0062] A subject described in this specification is discussed now with reference to exemplary implementations. It should be understood that, discussion of these implementations is merely intended to make a person skilled in the art better understand and implement the subject described in this specification, and is not intended to limit the protection scope of the claims, the applicability, or examples. Changes may be made to the functions and arrangements of the discussed elements without departing from the protection scope of the content of the present disclosure. Various processes or components may be omitted, replaced, or added in each example according to requirements. For example, the described method may be performed according to a sequence different from the sequence described herein, and all steps may be added, omitted, or combined. In addition, features described in some examples may alternatively be combined in other examples.

[0063] As used in this specification, the term "include" and variants thereof represent open terms, and means "include but is not limited to" . The term "based on" represents "at least partially based on" . The terms "one embodiment" and "an embodiment" represent "at least one embodiment" . The term "another embodiment" represents "at least one another embodiment" . The terms "first" , "second" , and the like may represent different objects or the same object. Other definitions may be included explicitly or implicitly in the following. Unless otherwise clearly specified, the definition of one term is consistent in the entire specification.

[0064] In summary, the technical solutions of the present disclosure mainly aim at the following two problems:

[0065] 1) how to automatically verify whether a rule is feasible

[0066] 2) how to ensure that there is no conflict among all incompatible rules

[0067] In view of this, the present disclosure provides a method for automatically verifying a rule in a rule engine.

[0068] According to the technical solutions of the present disclosure, in summary, one or more steps of the following process can be included.

[0069] 1) A user enters or updates a rule. For example, a rule is entered or configured by using a working platform or a configuration page.

[0070] 2) Whether the rule is feasible or is in conflict with another rule is verified.

[0071] 3) If the rule is feasible and is in no conflict with another rule, the rule is added into a rule engine, such as Drools and ThingsBoard. In addition, some possible schemes can be further presented for the user.

[0072] 4) If the rule is infeasible, or is in conflict with another rule, an error notification may be displayed to the user. In addition, the user can update the rule.

[0073] The method and apparatus for verifying the rule according to the embodiments of the present disclosure will be described below in detail in combination with the accompanying drawings.

[0074] FIG. 1 is a flowchart of an exemplary process of a method 100 for verifying a rule of a rule engine according to an embodiment of the present disclosure.

[0075] First, in step S102, a rule to be verified is received.

[0076] Specifically, a user can enter or configure a rule through a user interface.

[0077] Preferably, the rule is designed and described by using a rule language Drools. Drools is the most frequently used language in the rule engine field, and the language can be conveniently translated into another rule definition language.

[0078] In addition, the rule to be verified can be further obtained from "Thingsboard" . In the present disclosure, there is no limitation on an obtaining mode for the rule to be verified and a description language of the rule to be verified.

[0079] There is an example of a rule "generate_alarm" defined using the language Drools below.

[0080] This rule is nearly a combination of some conditions expressed using a natural language.

[0081] In the following explanation, the rule "generate_alarm" is mainly taken as an example for explanation.

[0082] Next, in step S104, variables and a constraint condition are extracted from the rule to be verified.

[0083] For example, the variables can be extracted from the above rule "generate_alarm" :

[0084] variable: bearing_rms, equipment_status

[0085] The extracted constraint condition is: bearing_rms > 20, equipment_status== true.

[0086] Next, in step S106, a value range of each variable is determined, and an incompatible rule  which is in conflict with the rule to be verified is determined in a rule engine database.

[0087] The value range of the variable may be pre-configured in the rule to be verified, or may be calculated according to historical data, or may be obtained from a connected application database.

[0088] The value range can be used for verifying whether the rule to be verified is feasible.

[0089] In this step, a rule that is in conflict with the rule to be verified needs to be determined from the rule engine database. To be specific, a rule that may not be generated simultaneously with the rule to be verified. It is referred to as an incompatible rule herein.

[0090] The rule engine database is a database used for saving rules in a system.

[0091] For example, for "generate_alarm" , an incompatible rule that is in conflict with it is "cancel_alarm" . The two rules may not be generated simultaneously.

[0092] Next, in step S108, a first model and a second model are constructed based on one or more of the variables, the constraint condition, the value ranges of the variables, and the incompatible rule which is contradictory with the rule to be verified, wherein the first model is used for verifying whether the rule to be verified is feasible, and the second model is used for verifying whether the rule to be verified is in conflict with the incompatible rule.

[0093] Specifically, the first model may use the rule to be verified as a constraint satisfaction problem, convert the rule to be verified into a constraint satisfaction model, and verify, according to the value ranges of the variables, whether the rule to be verified is feasible. The first model is simple, which will not be elaborated here.

[0094] The second model is used for verifying whether the rule to be verified is in conflict with the incompatible rule.

[0095] Specifically, the rule to be verified is combined with the incompatible rule to form a constraint satisfaction model.

[0096] The "generate_alarm" and the incompatible rule "cancel_alarm" can be combined to construct the second model. If the second model is feasible, it means that the two rules can be simultaneously satisfied. This is not proper. Thus, it indicates that there is a conflict between the two rules.

[0097] There is a specific example of a model described using language MiniZinc below. MiniZinc is a language used for explaining constrained optimization and decision for integers and real numbers.

[0098] %Use this editor as a MiniZinc scratch book

[0099] var float: bearing_rms;

[0100] var bool: equipment_status;

[0101] constraint bearing_rms > 0;

[0102] constraint (bearing_rms >= 15  / \equipment_status)  / \ (bearing_rms >= 20  / \equipment_status) ;

[0103] solve satisfy;

[0104] output ["bearing_rms: \ (bearing_rms) , equipment_status: \ (equipment_status) " ]

[0105] In this model, (bearing_rms >= 15  / \equipment_status) is the rule "cancel_alarm" , and (bearing_rms >= 20  / \equipment_status) is the rule "generate_alarm" . The two rules are combined together as a constraint condition.

[0106] At last, in step S110, the first model and the second model are solved by using a solver, and whether the rule to be verified is feasible and is in conflict with the incompatible rule is verified.

[0107] Specifically, some open source solvers can be selected to solve the constructed models, such as Gecode and Chuffed. A solver can alternatively be implemented based on a mature algorithm. There is no limitation on the specific type of the solver here.

[0108] If the second model is verified to be infeasible, it means that the rule to be verified is in no conflict with its incompatible rule. If a feasible answer can be found, it means that the two conditions can be simultaneously satisfied and there is a conflict between the two rules. In this case, any of the two rules needs to be modified.

[0109] At least three verification results below can be obtained by executing the above steps of the method for verifying the rule according to the embodiments of the present disclosure.

[0110] 1. The rule to be verified is feasible Y. It represents that when a value of a variable changes, the rubber can be triggered.

[0111] In this case, the method 100 may include step S112: the rule to be verified is added into the rule engine database.

[0112] Optionally, the method 100 further includes step S114: one or more feasible schemes of the rule to be verified are provided to a user.

[0113] 2. The rule to be verified is infeasible N. This indicates that the rule will not be triggered no matter how the value changes.

[0114] In this case, the method 100 can further include step S116, prompt information indicating that the rule to be verified is infeasible may be provided to a user, so that the user can correspondingly modify the rule.

[0115] 3. The rule to be verified is feasible, but is in conflict with another rule C. This indicates that the rule can be triggered, but is in conflict with the incompatible rule.

[0116] In this case, the method 100 can further include step S118, prompt information indicating  that the rule to be verified is in conflict with the incompatible rule is provided to a user, so that the user can correspondingly modify one or two of the rule to be verified or the incompatible rule.

[0117] There are three specific examples for verifying a rule by applying the method for verifying the rule according to an embodiment of the present disclosure below.

[0118] Example 1: Feasible rule

[0119] Name of rule generate_alarm

[0120] Condition: Bearing1. Vibration. RMS > 20 and TC5000R. Status == True (Working) It reflects that alarm will be generated when a value of a vibration speed RMS of bearing 1 is greater than 20 and in a working state.

[0121] The method for verifying the rule according to the embodiments of the present disclosure can be used to verify that the rule is feasible, and some feasible schemes of the rule can be provided, as shown in the following table.

[0122] Table 1 Possible feasible schemes of the rule

[0123] In fact, when RMS is greater than 35, another alarm should be generated. A user can see from these possible feasible schemes that the RMS in the rule is possibly greater than 35, so that the user can learn that the rule needs to be modified. To be specific, the user can make the rule feasible.

[0124] Example 2: Infeasible rule

[0125] Name of rule generate_alarm 1

[0126] Condition: (Bearing1. Vibration. RMS > 20 or temperature > 50) and (Bearing1. Vibration. RMS + Bearing1. Vibration. RMS < 70) and (Bearing2. Vibration. RMS > 60) and (Temperature < 20)

[0127] It is easily found that the rule is infeasible. Because:

[0128] First, Temperature needs to be < 20

[0129] Second, (Bearing1. Vibration. RMS > 20 or temperature > 50) can be simplified into (Bearing1. Vibration. RMS > 20)

[0130] Next, under a condition of (Bearing2. Vibration. RMS > 60) , (Bearing2. Vibration. RMS > 60) can be obtained

[0131] This is contradictory with (Bearing1. Vibration. RMS + Bearing1. Vibration. RMS < 70) in the rule.

[0132] Therefore, the rule is infeasible.

[0133] Example 3: The rule is feasible, but is conflict with another rule.

[0134] Name of rule cancel_alarm

[0135] Condition: (Bearing1. Vibration. RMS > 15) and (TC5000R. Status == True (Working) )

[0136] Incompatible rule generate_alarm

[0137] The rule cancel_alarm is feasible, but has an incompatible rule, namely, cancel_alarm and generate_alarm may not be generated simultaneously. When "bearing1. Vibration. RMS == 18 and TC5000R. Status == True" , the two rules are satisfied and will be triggered. Namely, a piece of data may simultaneously have generate_alarm and cancel_alarm. This is not proper.

[0138] At last, to sum up, according to the technical solutions of the embodiments of the present disclosure, the rule to be verified is converted into the constraint satisfaction problem to automatically verify the rule in the rule engine.

[0139] For the problem of how to automatically verify a rule is feasible, a rule to be verified is regarded as a constraint satisfaction problem; a constraint satisfaction model is constructed; a solver is used to solve the constraint satisfaction model; and if the model is feasible, it indicates that the rule can be triggered in a case.

[0140] For the problem of how to ensure that there is no conflict among all incompatible rules, a rule to be verified and its incompatible rule are combined to form a constraint satisfaction model; and if the model is feasible, it indicates that these incompatible rules can be satisfied simultaneously. Therefore, these rules are configured wrongly and needs to be appropriately modified.

[0141] The technical solutions according to the embodiments of the present disclosure at least have one or more of the following technical advantages.

[0142] The method for verifying the rule according to the embodiments of the present disclosure can automatically verify a rule, so as to ensure consistency with a service logic, without providing any test case to verify the rule, thereby achieving high verification efficiency.

[0143] The method according to the embodiments of the present disclosure can further provide a user some feasible solutions as reference.

[0144] It is hard for a user to manually verify the incompatible rule. The method according to the embodiments of the present disclosure converts the problem of conflicts of incompatible rules  into a constraint satisfaction problem. The problem is solved by using a constraint satisfaction algorithm, so that whether there is a conflict with the incompatible rule can be automatically verified.

[0145] FIG. 2 is a block diagram of an exemplary configuration of an apparatus 200 for verifying a rule of a rule engine according to an embodiment of the present disclosure. The apparatus 200 is configured to perform the method for verifying the rule of the rule engine shown in FIG. 1.

[0146] As shown in FIG. 2, the apparatus 200 for verifying the rule of the rule engine includes: a rule to be verified obtaining unit 202, an extraction unit 204, a value range and incompatible rule determining unit 206, a model construction unit 208, and a solving unit 210.

[0147] The rule to be verified obtaining unit 202 is configured to obtain a rule to be verified.

[0148] The extraction unit 204 is configured to extract variables and a constraint condition from the rule to be verified.

[0149] The value range and incompatible rule determining unit 206 is configured to determine a value range of each variable and an incompatible rule, which is in conflict with the rule to be verified, in a rule engine database.

[0150] The model construction unit 208 is configured to: construct a first model and a second model based on one or more of the variables, the constraint condition, the value ranges of the variables, and the incompatible rule which is contradictory with the rule to be verified, wherein the first model is used for verifying whether the rule to be verified is feasible, and the second model is used for verifying whether the rule to be verified is in conflict with the incompatible rule.

[0151] The solving unit 210 is configured to: solve the first model and the second model by using a solver, and verify whether the rule to be verified is feasible and is in conflict with the incompatible rule.

[0152] In a specific embodiment, the apparatus 200 further includes a rule adding unit 212, configured to: in a case that the rule to be verified is verified to be feasible, add the rule to be verified into the rule engine database.

[0153] Optionally, the apparatus 200 further includes a feasible scheme providing unit 214, configured to: in a case that the rule to be verified is verified to be feasible, provide one or more feasible schemes of the rule to be verified.

[0154] Optionally, the apparatus 200 further includes an infeasible situation prompt unit 216, configured to: in a case that the rule to be verified is verified to be infeasible, provide prompt information indicating that the rule to be verified is infeasible.

[0155] Optionally, the apparatus 200 further includes a conflict prompt unit 218, configured to: in a case that the rule to be verified is verified to be in conflict with the incompatible rule, provide prompt information indicating that the rule to be verified is in conflict with the incompatible rule.

[0156] The model construction unit 208 is configured to: convert the rule to be verified into a constraint satisfaction model to construct the first model; and combine the rule to be verified with the incompatible rule to form a constraint satisfaction model to construct the second model. The value range of each variable is obtained by at least one of the following modes:

[0157] pre-configuring the value range in the rule to be verified, calculating the value range according to historical data, and obtaining the value range from a database.

[0158] Details of operations and functions of all the parts of the apparatus 200 for verifying the rule of the rule engine can be, for example, the same as or similar to the related parts of the embodiments of the method for verifying the rule of the rule engine according to the embodiments of the present disclosure with reference to FIG. 1, and will not be described in detail here.

[0159] It should be noted that, the apparatus 200 for verifying the rule of the rule engine shown in FIG. 2 and the structures of the constituting units of the apparatus are only exemplary. A person skilled in the art can modify the structural block diagram shown in FIG. 2 as required.

[0160] Referring to FIG. 1 to FIG. 2 described above, the method and apparatus according to the embodiments of the present disclosure have been described. All the units of the apparatus for verifying the rule of the rule engine can be implemented in hardware, or can be implemented in software or a combination of hardware and software.

[0161] FIG. 3 shows a block diagram of an electronic device 300 according to an embodiment of the present disclosure. According to an embodiment, the electronic device 300 may include at least one processor 302. The processor 302 executes at least one computer-readable instruction stored or encoded in a computer-readable storage medium (namely, a memory 304) .

[0162] It should be understood that, the computer-executable instructions stored in the memory 304, when executed, cause the at least one processor 302 to perform the various operations and functions described in the foregoing embodiments of the present disclosure with reference to FIG. 1 to FIG. 2.

[0163] According to an embodiment, a non-transitory machine-readable medium is provided. The non-transitory machine-readable medium may be provided with machine-executable instructions (namely, the foregoing elements implemented in the form of software) , and the instructions, when executed by a machine, cause the machine to perform the various operations  and functions described in the foregoing embodiments of the present disclosure with reference to FIG. 1 to FIG. 2.

[0164] According to an embodiment, a computer program is provided, including computer-executable instructions. The computer-executable instructions, when executed, cause at least one processor to perform the various operations and functions described in the foregoing embodiments of the present disclosure with reference to FIG. 1 to FIG. 2.

[0165] According to an embodiment, a computer program product is provided, including computer-executable instructions. The computer-executable instructions, when executed, cause at least one processor to perform the various operations and functions described in the foregoing embodiments of the present disclosure with reference to FIG. 1 to FIG. 2.

[0166] Not all units in all the above structural diagrams are necessary, and some units may be omitted according to an actual requirement. The apparatus structure described in the embodiments may be a physical structure or a logical structure. That is, some units may be implemented by the same physical entity, or some units may be implemented by a plurality of physical entities, or may be implemented by some components in a plurality of independent devices together.

[0167] The descriptions of the content of the present disclosure are provided to allow any person of ordinary skill in the art to implement or use the content of the present disclosure. For a person of ordinary skill in the art, various modifications on the content of the present disclosure are obvious. In addition, a general principle defined in this specification may be applied to other variants without departing from the protection scope of the content of the present disclosure. Therefore, the content of the present disclosure is not limited to the examples and designs described in this specification, but is consistent with the widest range conforming to the principle and novelty disclosed in this specification.

[0168] The foregoing descriptions are merely preferred embodiments of the present disclosure, but are not intended to limit the present disclosure. Any modification, equivalent replacement, or improvement made within the spirit and principle of the present disclosure shall fall within the protection scope of the present disclosure.

[0169] The nouns and pronouns relating to persons in this patent application are not limited to specific gender.

Claims

1.A method (100) for verifying a rule for a rule engine, comprising:obtaining a rule to be verified (S102) ;extracting variables and a constraint condition from the rule to be verified (S104) ;determining a value range of each variable, and determining at least one incompatible rule in a rule engine database, which is contradictory with the rule to be verified (S106) ;constructing a first model and a second model based on one or more of the variables, the constraint condition, the value ranges of the variables, and the incompatible rule which is contradictory with the rule to be verified, wherein the first model is used for verifying whether the rule to be verified is feasible, and the second model is used for verifying whether the rule to be verified is in conflict with the incompatible rule (S108) ; andsolving the first model and the second model by using a solver, and verifying whether the rule to be verified is feasible and is in conflict with the incompatible rule (S110) .2.The method (100) according to claim 1, wherein in a case that the rule to be verified is verified to be feasible, the method further comprises: adding the rule to be verified into the rule engine database (S112) .3.The method (100) according to claim 1, wherein in a case that the rule to be verified is verified to be feasible, the method further comprises: providing one or more feasible schemes of the rule to be verified (S114) .4.The method (100) according to claim 1, wherein in a case that the rule to be verified is verified to be infeasible, the method further comprises: providing prompt information indicating that the rule to be verified is infeasible (S116) .5.The method (100) according to claim 1, wherein in a case that the rule to be verified is verified to be in conflict with the incompatible rule, the method further comprises: providing prompt information indicating that the rule to be verified is in conflict with the incompatible rule (S118) .6.The method (100) according to claim 1, wherein the constructing the first model comprises: converting the rule to be verified into a constraint satisfaction model; and the constructing the second model comprises: combining the rule to be verified with the incompatible rule to form a constraint satisfaction model.7.The method (100) according to claim 1, wherein the value range of each variable is determined by at least one of the following modes:pre-configuring the value range in the rule to be verified, calculating the value range according to historical data, and obtaining the value range from a database.8.An apparatus (200) for verifying a rule for a rule engine, comprising:a rule to be verified obtaining unit, configured to obtain a rule to be verified (202) ;an extraction unit, configured to extract variables and a constraint condition from the rule to be verified (204) ;a value range and incompatible rule determining unit, configured to determine a value range of each variable and at least one incompatible rule in a rule engine database, which is in conflict with the rule to be verified (206) ;a model construction unit, configured to: construct a first model and a second model based on one or more of the variables, the constraint condition, the value ranges of the variables, and the incompatible rule which is contradictory with the rule to be verified, wherein the first model is used for verifying whether the rule to be verified is feasible, and the second model is used for verifying whether the rule to be verified is in conflict with the incompatible rule (208) ; anda solving unit, configured to: solve the first model and the second model by using a solver, and verify whether the rule to be verified is feasible and is in conflict with the incompatible rule (210) .9.A computing device (300) , comprising:at least one processor (302) ; anda memory (304) coupled to the at least one processor (302) , wherein the memory is configured to store instructions, and the instructions, when executed by the at least one processor (302) , cause the processor 302) to perform the method according to any one of claims 1 to 7.10.A non-transitory machine-readable storage medium, having executable instructions stored thereon, wherein the instructions, when executed, cause a machine to perform the method according to any one of claims 1 to 7.11.A computer program product, tangibly stored on a computer-readable medium and comprising computer-executable instructions, wherein the computer-executable instructions, when executed, cause at least one processor to perform the method according to any one of claims 1 to 7.

Citation Information

Patent Citations

  • Rule engine verification publishing method and device, terminal equipment and medium

    CN113326049A

  • Method and device for detecting validity of security rule

    CN117596041A

  • Rule set visualization test method and device, computer equipment and medium

    CN118093387A

  • Apparatus and method for verifying detection rule

    US20170149831A1

  • Rule consistency verification device and rule consistency verification method

    WO2016110946A1