Rule conflict detection methods, apparatus, electronic devices, and readable storage media
By normalizing the rule set and judging the selected value set, the complexity problem in rule conflict detection is solved, realizing intelligent rule conflict detection and modification prompts, and improving the processing efficiency of network security devices.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-02-22
- Publication Date
- 2026-03-13
AI Technical Summary
As packet classification rule sets become more multidimensional and complex, conflicts between rules lead to chaotic network traffic processing by network security devices, necessitating intelligent rule conflict detection solutions.
By obtaining the original candidate value set of the rule to be detected and its rule dimensions, and performing normalization processing, the selected value set of the rule is determined. Based on the selected value set, rule conflicts are judged, and a modification prompt message is generated to resolve the conflict.
It achieves intelligent detection of rule conflicts, reduces detection complexity, and improves detection efficiency by unifying different candidate value formats.
Smart Images

Figure CN116226666B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of computer technology, and in particular to a rule conflict detection method, apparatus, electronic device, and readable storage medium. Background Technology
[0002] Packet classification technology is based on rule sets configured in a packet classification engine. As classification demands increase, rules evolve from one-dimensional to multi-dimensional, the number of rules in the rule set grows, and the relationships between rules become increasingly complex. This inevitably leads to rule conflicts. When performing packet classification, if a data packet matches two (or more) rules simultaneously, it indicates a rule conflict. Due to rule conflicts, network security devices may process network traffic in ways contrary to the network administrator's intentions, causing management chaos. Therefore, rule conflict detection within the packet classification rule set is highly valuable.
[0003] Therefore, there is an urgent need for a solution that can intelligently detect rule conflicts. Summary of the Invention
[0004] To provide a solution for intelligently detecting rule conflicts, this application provides a rule conflict detection method, apparatus, electronic device, and readable storage medium.
[0005] Firstly, a rule conflict detection method is provided, the method comprising:
[0006] Obtain the first rule and the second rule to be detected, as well as at least one rule dimension corresponding to the first rule and the second rule;
[0007] For each rule dimension, obtain the original candidate value set corresponding to the rule dimension, and normalize the original candidate value set to obtain the target candidate value set;
[0008] Based on the target candidate value set, determine the first selected value set corresponding to the first rule in the rule dimension, and the second selected value set corresponding to the second rule in the rule dimension;
[0009] Based on the first set of selected values and the second set of selected values, the conflict results of the first rule and the second rule in the rule dimension are determined.
[0010] In one possible implementation, if both the first set of selected values and the second set of selected values contain positive selected values...
[0011] The step of determining the conflict result of the first rule and the second rule on the rule dimension based on the first selected value set and the second selected value set includes:
[0012] Determine whether the first set of selected values and the second set of selected values have any intersection;
[0013] If the first set of selected values and the second set of selected values have an intersection, the conflict result between the first rule and the second rule on the rule dimension is determined to be a conflict.
[0014] In one possible implementation, if the selected values in both the first set of selected values and the second set of selected values are inverted values...
[0015] The step of determining the conflict result of the first rule and the second rule on the rule dimension based on the first selected value set and the second selected value set includes:
[0016] A first positive selection value set is determined based on the target candidate value set and the first selected value set, wherein the first positive selection value set includes the selected values in the target candidate value set other than the selected values in the first selected value set;
[0017] A second set of positive values is determined based on the target candidate value set and the second selected value set, wherein the second set of positive values includes the selected values in the target candidate value set other than the selected values in the second selected value set;
[0018] Determine whether the first set of positive selection values and the second set of positive selection values have any intersection;
[0019] If the first set of positive values and the second set of positive values have an intersection, the conflict result between the first rule and the second rule on the rule dimension is determined to be a conflict.
[0020] In one possible implementation, if the selected value in the first set of selected values is a positive selection value, and the selected value in the second set of selected values is a negative selection value.
[0021] The step of determining the conflict result of the first rule and the second rule on the rule dimension based on the first selected value set and the second selected value set includes:
[0022] A target selected value set is constructed based on the first selected value set and the second selected value set, wherein the target selected value set contains all selected values in the first selected value set and the second selected value set;
[0023] Based on the target selected value set and the second selected value set, a third positive selected value set corresponding to the second selected value set is determined, wherein the third positive selected value set includes selected values in the target selected value set other than the selected values in the second selected value set;
[0024] Determine whether there is an intersection between the first set of selected values and the third set of positive values;
[0025] If there is an intersection between the first set of selected values and the third set of positive selected values, the conflict result between the first rule and the second rule in the rule dimension is determined to be a conflict.
[0026] In one possible implementation, the method further includes:
[0027] Obtain the conflict results of the first rule and the second rule across all rule dimensions;
[0028] If the conflict results are all in all rule dimensions, then the first rule and the second rule are determined to be in conflict.
[0029] In one possible implementation, if the conflict result is that the first rule and the second rule conflict on the rule dimension, the method further includes:
[0030] Obtain the first information corresponding to the first rule and the second information corresponding to the second rule;
[0031] A modification prompt message is generated based on the first information and the second information, and the modification prompt message is sent, wherein the modification prompt message is used to prompt modification of the first rule and the second rule.
[0032] Secondly, a rule conflict detection device is provided, the device comprising:
[0033] The acquisition module is used to acquire the first rule and the second rule to be detected, as well as at least one rule dimension corresponding to the first rule and the second rule;
[0034] The normalization processing module is used to obtain the original candidate value set corresponding to each rule dimension for each rule dimension, and to perform normalization processing on the original candidate value set to obtain the target candidate value set.
[0035] The first determining module is used to determine, based on the target candidate value set, a first selected value set corresponding to the first rule in the rule dimension, and a second selected value set corresponding to the second rule in the rule dimension;
[0036] The second determining module is used to determine the conflict result of the first rule and the second rule in the rule dimension based on the first selected value set and the second selected value set.
[0037] In one possible implementation, if both the first set of selected values and the second set of selected values contain positive selected values...
[0038] The second determining module is specifically used for:
[0039] Determine whether the first set of selected values and the second set of selected values have any intersection;
[0040] If the first set of selected values and the second set of selected values have an intersection, the conflict result between the first rule and the second rule on the rule dimension is determined to be a conflict.
[0041] In one possible implementation, if the selected values in both the first set of selected values and the second set of selected values are inverted values...
[0042] The second determining module is further configured to:
[0043] A first positive selection value set is determined based on the target candidate value set and the first selected value set, wherein the first positive selection value set includes the selected values in the target candidate value set other than the selected values in the first selected value set;
[0044] A second set of positive values is determined based on the target candidate value set and the second selected value set, wherein the second set of positive values includes the selected values in the target candidate value set other than the selected values in the second selected value set;
[0045] Determine whether the first set of positive selection values and the second set of positive selection values have any intersection;
[0046] If the first set of positive values and the second set of positive values have an intersection, the conflict result between the first rule and the second rule on the rule dimension is determined to be a conflict.
[0047] In one possible implementation, if the selected value in the first set of selected values is a positive selection value, and the selected value in the second set of selected values is a negative selection value.
[0048] The second determining module is further configured to:
[0049] A target selected value set is constructed based on the first selected value set and the second selected value set, wherein the target selected value set contains all selected values in the first selected value set and the second selected value set;
[0050] Based on the target selected value set and the second selected value set, a third positive selected value set corresponding to the second selected value set is determined, wherein the third positive selected value set includes selected values in the target selected value set other than the selected values in the second selected value set;
[0051] Determine whether there is an intersection between the first set of selected values and the third set of positive values;
[0052] If there is an intersection between the first set of selected values and the third set of positive selected values, the conflict result between the first rule and the second rule in the rule dimension is determined to be a conflict.
[0053] In one possible implementation, the device further includes a third determining module for:
[0054] Obtain the conflict results of the first rule and the second rule across all rule dimensions;
[0055] If the conflict results are all in all rule dimensions, then the first rule and the second rule are determined to be in conflict.
[0056] In one possible implementation, if the conflict result is that the first rule and the second rule conflict on the rule dimension, the apparatus further includes a modification module for:
[0057] Obtain the first information corresponding to the first rule and the second information corresponding to the second rule;
[0058] A modification prompt message is generated based on the first information and the second information, and the modification prompt message is sent, wherein the modification prompt message is used to prompt modification of the first rule and the second rule.
[0059] Thirdly, an electronic device is provided, including a processor, a communication interface, a memory, and a communication bus, wherein the processor, the communication interface, and the memory communicate with each other through the communication bus;
[0060] Memory, used to store computer programs;
[0061] When a processor executes a program stored in memory, it implements any of the steps described in the first aspect.
[0062] Fourthly, a computer-readable storage medium is provided, characterized in that the computer-readable storage medium stores a computer program, which, when executed by a processor, implements the steps of any of the methods described in the first aspect.
[0063] Fifthly, a computer program product containing instructions is provided, which, when run on a computer, causes the computer to execute any of the rule conflict detection methods described above.
[0064] Beneficial effects of the embodiments in this application:
[0065] This application provides a rule conflict detection method, apparatus, electronic device, and readable storage medium. The method involves: first, obtaining a first rule and a second rule to be detected, and at least one rule dimension corresponding to the first and second rules; then, for each rule dimension, obtaining an original candidate value set corresponding to that rule dimension, and normalizing the original candidate value set to obtain a target candidate value set; and based on the target candidate value set, determining a first selected value set corresponding to the first rule on that rule dimension, and a second selected value set corresponding to the second rule on that rule dimension; finally, based on the first selected value set and the second selected value set, determining the conflict result between the first rule and the second rule on that rule dimension. This achieves intelligent detection of rule conflicts. Furthermore, because the original candidate value set corresponding to the rule dimension is normalized before rule conflict detection, candidate values of the same concept but different forms can be unified into the same form, thereby reducing the complexity of subsequent rule conflict detection.
[0066] Of course, implementing any product or method of this application does not necessarily require achieving all of the advantages described above at the same time. Attached Figure Description
[0067] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this application and, together with the description, serve to explain the principles of this application.
[0068] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, for those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0069] Figure 1 A flowchart of a rule conflict detection method provided in an embodiment of this application;
[0070] Figure 2 A flowchart of another rule conflict detection method provided in the embodiments of this application;
[0071] Figure 3 A flowchart of another rule conflict detection method provided in the embodiments of this application;
[0072] Figure 4 A flowchart of another rule conflict detection method provided in the embodiments of this application;
[0073] Figure 5 This is a schematic diagram of the structure of a rule conflict detection device provided in an embodiment of this application;
[0074] Figure 6 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application. Detailed Implementation
[0075] To make the objectives, technical solutions, and advantages of the embodiments of this application clearer, the technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0076] The rule conflict detection method provided in this application will be explained and described below with reference to the accompanying drawings and specific embodiments. The embodiments do not constitute a limitation on the embodiments of this application.
[0077] See Figure 1 This is a flowchart illustrating an embodiment of a rule conflict detection method provided in this application. Figure 1 As shown, the process may include the following steps:
[0078] S101, obtain the first rule and the second rule to be detected, and at least one rule dimension corresponding to the first rule and the second rule.
[0079] This application provides a rule conflict detection method for detecting whether there are conflicts among rules in a rule set, wherein the first rule and the second rule are any two rules in the rule set. The rule set corresponds to at least one rule dimension, and all rules in the rule set have specific dimensional requirements set based on these rule dimensions.
[0080] For example, for a rule set used to process ad delivery, the corresponding rule dimensions include ad type and device type. In this rule set, rule 1 is to deliver ad type a1 to device type b1, rule 2 is to deliver ad type a2 to device type b2, and so on.
[0081] S102, for each rule dimension, obtain the original candidate value set corresponding to the rule dimension, and normalize the original candidate value set to obtain the target candidate value set.
[0082] In practical applications, for each rule dimension, a pre-defined set of original candidate values is provided, containing all selectable candidate values for that rule dimension. These candidate values are the values that the user can choose when setting specific rules.
[0083] For example, a rule set used to process ad delivery might have rule dimensions including ad type and device type. For the ad type dimension, the original candidate value set includes types a1, a2, and a3, etc., while for the device type dimension, the original candidate value set includes types b1, b2, and b3, etc. Users can then select any one or more types in the ad type dimension and any one or more types in the device type dimension to set specific rules.
[0084] Because different users may use different formats for candidate values of the same concept when setting rules—for example, some users might use type a1 to represent boot-up ads, while others might use type a2—the computational complexity is high when performing rule conflict detection.
[0085] Based on this, in this embodiment, each candidate value in the original candidate value set is normalized to obtain the target candidate value set. This unifies candidate values of the same concept but different forms in the original candidate value set into the same form. For example, in the target candidate value set, boot-up ads are uniformly represented as 2, and ads inserted during TV dramas are uniformly represented as 4. This reduces the complexity of subsequent rule conflict detection.
[0086] S103, based on the target candidate value set, determine the first selected value set corresponding to the first rule in the rule dimension, and the second selected value set corresponding to the second rule in the rule dimension.
[0087] The selected value refers to the candidate value chosen by the user on the corresponding rule dimension. This selected value can be a positive or negative selection. In practical applications, users formulate corresponding rules by selecting candidate values as selected values on various rule dimensions.
[0088] For example, the target candidate value set corresponding to the ad type dimension contains ten candidate values: 1, 2, 3, 4, 5, 6, 7, 8, 9, and 10. Users can set a rule to display ads of types 6, 8, and 10, in which case 6, 8, and 10 are positive selection values; or they can set a rule to not display ads of types 1, 2, 3, 4, and 5, in which case 1, 2, 3, 4, and 5 are negative selection values. It can be understood that the meaning of this rule is essentially the same as the meaning of displaying ads of types 6, 7, 8, 9, and 10.
[0089] It should be noted that when a user does not select any candidate value as the selected value on a certain rule dimension, it is considered that the user has selected all candidate values on that rule dimension as the positive selection value.
[0090] Based on this, in the embodiments of this application, the first selected value set corresponding to the first rule in the rule dimension and the second selected value set corresponding to the second rule in the rule dimension can be determined based on the target candidate value set.
[0091] S104, based on the first set of selected values and the second set of selected values, determine the conflict result of the first rule and the second rule in the rule dimension.
[0092] In this embodiment of the application, after determining the first set of selected values and the second set of selected values, the conflict result of the first rule and the second rule on the rule dimension can be determined based on the first set of selected values and the second set of selected values. The conflict result includes conflict and non-conflict.
[0093] As for how to determine the conflict result of the first rule and the second rule in the rule dimension based on the first set of selected values and the second set of selected values, it will be explained in detail through the following embodiments, and will not be described in detail here.
[0094] In another embodiment of this application, the method may further include the following steps: if the conflict result is that the first rule and the second rule conflict in the rule dimension, obtain the first information corresponding to the first rule and the second information corresponding to the second rule, generate a modification prompt message based on the first information and the second information, and send the modification prompt message, wherein the modification prompt message is used to prompt the modification of the first rule and the second rule.
[0095] The first information contains the selected values of the first rule across each rule dimension, and the second information contains the selected values of the second rule across each rule dimension.
[0096] This scheme allows for the generation of a modification prompt message based on the first information corresponding to the first rule and the second information corresponding to the second rule. This message is then sent to the user to prompt them to modify the first and second rules so that they no longer conflict.
[0097] In another embodiment of this application, the method may further include the following steps: obtaining the conflict results of the first rule and the second rule in all rule dimensions, and determining that the first rule and the second rule are in conflict when the conflict results in all rule dimensions are all in conflict.
[0098] As described above, a conflict is determined when the first rule and the second rule are in conflict across all rule dimensions. Thus, a conflict between two rules can be directly determined based on the conflict results across all rule dimensions.
[0099] In this embodiment, firstly, a first rule and a second rule to be detected, as well as at least one rule dimension corresponding to the first rule and the second rule, are obtained. Then, for each rule dimension, an original candidate value set corresponding to the rule dimension is obtained, and the original candidate value set is normalized to obtain a target candidate value set. Based on the target candidate value set, a first selected value set corresponding to the first rule on the rule dimension and a second selected value set corresponding to the second rule on the rule dimension are determined. Finally, based on the first selected value set and the second selected value set, the conflict result of the first rule and the second rule on the rule dimension is determined. Thus, intelligent detection of rule conflicts is achieved. Furthermore, because the original candidate value set corresponding to the rule dimension is normalized before rule conflict detection, candidate values of the same concept but different forms can be unified into the same form, thereby reducing the complexity of subsequent rule conflict detection.
[0100] See Figure 2 This is a flowchart illustrating an embodiment of another rule conflict detection method provided in this application. Figure 2 The process shown above Figure 1 Based on the illustrated process, this section describes how to determine the conflict results between the first rule and the second rule on the rule dimension, based on the first set of selected values and the second set of selected values. Figure 2 As shown, the process may include the following steps:
[0101] S201, determine whether there is an intersection between the first set of selected values and the second set of selected values.
[0102] S202, if there is an intersection between the first set of selected values and the second set of selected values, determine that the conflict result between the first rule and the second rule in the rule dimension is a conflict.
[0103] The following provides a unified explanation of S201 and S202:
[0104] In this embodiment, both the selected values in the first and second selected value sets are positive selections. In this case, the conflict result of the first rule and the second rule on that rule dimension can be determined by whether there is an intersection between the first and second selected value sets. Specifically, if there is an intersection between the first and second selected value sets, the conflict result of the first rule and the second rule on the rule dimension is determined to be a conflict; if there is no intersection between the first and second selected value sets, the conflict result of the first rule and the second rule on the rule dimension is determined to be a non-conflict. Thus, the conflict result of the first rule and the second rule on the rule dimension is determined even when both the selected values in the first and second selected value sets are positive selections.
[0105] See Figure 3 This is a flowchart illustrating an embodiment of another rule conflict detection method provided in this application. Figure 3 The process shown above Figure 1 Based on the illustrated process, this section describes how to determine the conflict results between the first rule and the second rule on the rule dimension, based on the first set of selected values and the second set of selected values. Figure 3 As shown, the process may include the following steps:
[0106] S301, a first positive selection value set is determined based on the target candidate value set and the first selected value set, wherein the first positive selection value set includes the selected values in the target candidate value set other than the selected values in the first selected value set.
[0107] S302, a second positive selection value set is determined based on the target candidate value set and the second selected value set, wherein the second positive selection value set includes the selected values in the target candidate value set other than the selected values in the second selected value set.
[0108] S303, determine whether there is an intersection between the first set of positive selection values and the second set of positive selection values.
[0109] S304, if there is an intersection between the first set of positive selection values and the second set of positive selection values, determine that the conflict result between the first rule and the second rule in the rule dimension is a conflict.
[0110] The following provides a unified explanation of S301-S304:
[0111] In this embodiment, the selected values in both the first and second selected value sets are inverted selection values. First, a first positive selection value set is determined based on the target candidate value set and the first selected value set. This first positive selection value set includes all selected values in the target candidate value set except those in the first selected value set. Then, a second positive selection value set is determined based on the target candidate value set and the second selected value set. This second positive selection value set includes all selected values in the target candidate value set except those in the second selected value set. In this way, a first positive selection value set with the same substantive meaning as the first selected value set, and a second positive selection value set with the same substantive meaning as the second selected value set, can be determined.
[0112] Then, by determining whether the first set of positive selection values and the second set of positive selection values have an intersection, the conflict result of the first rule and the second rule in the rule dimension is determined. Specifically, if the first set of positive selection values and the second set of positive selection values have an intersection, the conflict result of the first rule and the second rule in the rule dimension is determined to be a conflict; if the first set of positive selection values and the second set of positive selection values do not have an intersection, the conflict result of the first rule and the second rule in the rule dimension is determined to be a non-conflict. In this way, the conflict result of the first rule and the second rule in the rule dimension is determined when the selected values in both the first set of selected values and the second set of selected values are negative selection values.
[0113] See Figure 4 This is a flowchart illustrating an embodiment of another rule conflict detection method provided in this application. Figure 4 The process shown above Figure 1 Based on the illustrated process, this section describes how to determine the conflict results between the first rule and the second rule on the rule dimension, based on the first set of selected values and the second set of selected values. Figure 4 As shown, the process may include the following steps:
[0114] S401, construct a target selected value set based on the first selected value set and the second selected value set, wherein the target selected value set contains all selected values in the first selected value set and the second selected value set.
[0115] S402, based on the target selected value set and the second selected value set, determine the third positive selected value set corresponding to the second selected value set, wherein the third positive selected value set includes the selected values in the target selected value set other than the selected values in the second selected value set.
[0116] S403, determine whether there is an intersection between the first selected value set and the third positive value set.
[0117] S404, if there is an intersection between the first set of selected values and the third set of positive selected values, determine that the conflict result between the first rule and the second rule in the rule dimension is a conflict.
[0118] The following provides a unified explanation of S401-S404:
[0119] In this embodiment of the application, the selected values in the first set of selected values are positive selection values, and the selected values in the second set of selected values are negative selection values. At this time, firstly, the first set of selected values and the second set of selected values can be merged to obtain the target set of selected values. The target set of selected values contains all the selected values in the first set of selected values and the second set of selected values. That is, the target set of selected values is the union of the first set of selected values and the second set of selected values.
[0120] Then, based on the target selected value set and the second selected value set, a third positive selected value set corresponding to the second selected value set is determined, wherein the third positive selected value set includes the selected values in the target selected value set other than the selected values in the second selected value set.
[0121] For example, if the first set of selected values contains 1, 2, 3, 4, 5, and 6, and the second set of selected values contains 5, 6, 7, 8, 9, and 10, then the target set of selected values contains 1, 2, 3, 4, 5, 6, 7, 8, 9, and 10. Therefore, the third set of positive selected values contains 1, 2, 3, and 4.
[0122] Finally, the conflict result of the first rule and the second rule in the rule dimension is determined by whether there is an intersection between the first set of selected values and the third set of positive values. Specifically, if there is an intersection between the first set of selected values and the third set of positive values, the conflict result of the first rule and the second rule in the rule dimension is determined to be a conflict; if there is no intersection between the first set of selected values and the third set of positive values, the conflict result of the first rule and the second rule in the rule dimension is determined to be a non-conflict.
[0123] This scheme enables the determination of conflicts between the first and second rules at the rule dimension when the selected values in the first set of selected values are positive and the selected values in the second set of selected values are negative. Furthermore, when converting the set of negative selected values (i.e., the second set of selected values) to the set of positive selected values (i.e., the third set of positive selected values), this scheme does not require conversion through all candidate values (i.e., the target candidate value set); it only considers the positive and negative selected values in the first and second rules. This effectively reduces the computational scale and resolves conflict detection when the complete set of candidate values is unknown.
[0124] Based on the same technical concept, embodiments of this application also provide a rule conflict detection device, such as... Figure 5As shown, the device includes:
[0125] The acquisition module 501 is used to acquire the first rule and the second rule to be detected, as well as at least one rule dimension corresponding to the first rule and the second rule;
[0126] The normalization processing module 502 is used to obtain the original candidate value set corresponding to each rule dimension for each rule dimension, and to perform normalization processing on the original candidate value set to obtain the target candidate value set.
[0127] The first determining module 503 is used to determine, based on the target candidate value set, the first selected value set corresponding to the first rule in the rule dimension, and the second selected value set corresponding to the second rule in the rule dimension;
[0128] The second determining module 504 is used to determine the conflict result of the first rule and the second rule in the rule dimension based on the first selected value set and the second selected value set.
[0129] In one possible implementation, if both the first set of selected values and the second set of selected values contain positive selected values...
[0130] The second determining module is specifically used for:
[0131] Determine whether the first set of selected values and the second set of selected values have any intersection;
[0132] If the first set of selected values and the second set of selected values have an intersection, the conflict result between the first rule and the second rule on the rule dimension is determined to be a conflict.
[0133] In one possible implementation, if the selected values in both the first set of selected values and the second set of selected values are inverted values...
[0134] The second determining module is further configured to:
[0135] A first positive selection value set is determined based on the target candidate value set and the first selected value set, wherein the first positive selection value set includes the selected values in the target candidate value set other than the selected values in the first selected value set;
[0136] A second set of positive values is determined based on the target candidate value set and the second selected value set, wherein the second set of positive values includes the selected values in the target candidate value set other than the selected values in the second selected value set;
[0137] Determine whether the first set of positive selection values and the second set of positive selection values have any intersection;
[0138] If the first set of positive values and the second set of positive values have an intersection, the conflict result between the first rule and the second rule on the rule dimension is determined to be a conflict.
[0139] In one possible implementation, if the selected value in the first set of selected values is a positive selection value, and the selected value in the second set of selected values is a negative selection value.
[0140] The second determining module is further configured to:
[0141] A target selected value set is constructed based on the first selected value set and the second selected value set, wherein the target selected value set contains all selected values in the first selected value set and the second selected value set;
[0142] Based on the target selected value set and the second selected value set, a third positive selected value set corresponding to the second selected value set is determined, wherein the third positive selected value set includes selected values in the target selected value set other than the selected values in the second selected value set;
[0143] Determine whether there is an intersection between the first set of selected values and the third set of positive values;
[0144] If there is an intersection between the first set of selected values and the third set of positive selected values, the conflict result between the first rule and the second rule in the rule dimension is determined to be a conflict.
[0145] In one possible implementation, the device further includes a third determining module for:
[0146] Obtain the conflict results of the first rule and the second rule across all rule dimensions;
[0147] If the conflict results are all in all rule dimensions, then the first rule and the second rule are determined to be in conflict.
[0148] In one possible implementation, if the conflict result is that the first rule and the second rule conflict on the rule dimension, the apparatus further includes a modification module for:
[0149] Obtain the first information corresponding to the first rule and the second information corresponding to the second rule;
[0150] A modification prompt message is generated based on the first information and the second information, and the modification prompt message is sent, wherein the modification prompt message is used to prompt modification of the first rule and the second rule.
[0151] In this embodiment, firstly, a first rule and a second rule to be detected, as well as at least one rule dimension corresponding to the first rule and the second rule, are obtained. Then, for each rule dimension, an original candidate value set corresponding to the rule dimension is obtained, and the original candidate value set is normalized to obtain a target candidate value set. Based on the target candidate value set, a first selected value set corresponding to the first rule on the rule dimension and a second selected value set corresponding to the second rule on the rule dimension are determined. Finally, based on the first selected value set and the second selected value set, the conflict result of the first rule and the second rule on the rule dimension is determined. Thus, intelligent detection of rule conflicts is achieved. Furthermore, because the original candidate value set corresponding to the rule dimension is normalized before rule conflict detection, candidate values of the same concept but different forms can be unified into the same form, thereby reducing the complexity of subsequent rule conflict detection.
[0152] Based on the same technical concept, embodiments of this application also provide an electronic device, such as... Figure 6 As shown, it includes a processor 111, a communication interface 112, a memory 113, and a communication bus 114, wherein the processor 111, the communication interface 112, and the memory 113 communicate with each other through the communication bus 114.
[0153] Memory 113 is used to store computer programs;
[0154] When processor 111 executes a program stored in memory 113, it performs the following steps:
[0155] Obtain the first rule and the second rule to be detected, as well as at least one rule dimension corresponding to the first rule and the second rule;
[0156] For each rule dimension, obtain the original candidate value set corresponding to the rule dimension, and normalize the original candidate value set to obtain the target candidate value set;
[0157] Based on the target candidate value set, determine the first selected value set corresponding to the first rule in the rule dimension, and the second selected value set corresponding to the second rule in the rule dimension;
[0158] Based on the first set of selected values and the second set of selected values, the conflict results of the first rule and the second rule in the rule dimension are determined.
[0159] The communication bus mentioned in the above electronic devices can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. This communication bus can be divided into address bus, data bus, control bus, etc. For ease of illustration, only one thick line is used to represent it in the diagram, but this does not mean that there is only one bus or one type of bus.
[0160] The communication interface is used for communication between the aforementioned electronic devices and other devices.
[0161] The memory may include random access memory (RAM) or non-volatile memory (NVM), such as at least one disk storage device. Optionally, the memory may also be at least one storage device located remotely from the aforementioned processor.
[0162] The processors mentioned above can be general-purpose processors, including central processing units (CPUs), network processors (NPs), etc.; they can also be digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components.
[0163] In another embodiment provided in this application, a computer-readable storage medium is also provided, which stores a computer program that, when executed by a processor, implements the steps of any of the rule conflict detection methods described above.
[0164] In another embodiment provided in this application, a computer program product containing instructions is also provided, which, when run on a computer, causes the computer to execute any of the rule conflict detection methods described in the above embodiments.
[0165] In the above embodiments, implementation can be achieved entirely or partially through software, hardware, firmware, or any combination thereof. When implemented using software, it can be implemented entirely or partially in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, all or part of the processes or functions described in the embodiments of this application are generated. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another. For example, the computer instructions can be transmitted from one website, computer, server, or data center to another website, computer, server, or data center via wired (e.g., coaxial cable, fiber optic, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) means. The computer-readable storage medium can be any available medium that a computer can access or a data storage device such as a server or data center that integrates one or more available media. The available medium can be a magnetic medium (e.g., floppy disk, hard disk, magnetic tape), an optical medium (e.g., DVD), or a semiconductor medium (e.g., solid state disk (SSD)).
[0166] It should be noted that, in this document, relational terms such as "first" and "second" are used merely to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.
[0167] The above description is merely a specific embodiment of this application, enabling those skilled in the art to understand or implement this application. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of this application. Therefore, this application is not to be limited to the embodiments shown herein, but is to be accorded the widest scope consistent with the principles and novel features claimed herein.
Claims
1. A rule conflict detection method characterized by, The method comprises: obtaining a first rule and a second rule to be detected, and at least one rule dimension corresponding to the first rule and the second rule; for each rule dimension, obtaining a set of original candidate values corresponding to the rule dimension, and performing normalization processing on the set of original candidate values to obtain a set of target candidate values; determining, based on the set of target candidate values, a first selected value set corresponding to the first rule on the rule dimension, and a second selected value set corresponding to the second rule on the rule dimension; based on the first selected value set and the second selected value set, determining a conflict result of the first rule and the second rule on the rule dimension; wherein if a selected value in the first selected value set is a positive selected value, and a selected value in the second selected value set is a negative selected value, the determining, based on the first selected value set and the second selected value set, of the conflict result of the first rule and the second rule on the rule dimension comprises: constructing a target selected value set based on the first selected value set and the second selected value set, wherein the target selected value set contains all selected values in the first selected value set and the second selected value set; determining, based on the target selected value set and the second selected value set, a third positive selected value set corresponding to the second selected value set, wherein the third positive selected value set contains selected values in the target selected value set except for selected values in the second selected value set; determining whether there is an intersection between the first selected value set and the third positive selected value set; in a case where there is an intersection between the first selected value set and the third positive selected value set, determining that the conflict result of the first rule and the second rule on the rule dimension is conflict.
2. The method of claim 1, wherein, if the selected values in the first selected value set and the second selected value set are all positive selected values, the determining, based on the first selected value set and the second selected value set, of the conflict result of the first rule and the second rule on the rule dimension comprises: determining whether there is an intersection between the first selected value set and the second selected value set; in a case where there is an intersection between the first selected value set and the second selected value set, determining that the conflict result of the first rule and the second rule on the rule dimension is conflict.
3. The method of claim 1, wherein, if the selected values in the first selected value set and the second selected value set are all negative selected values, the determining, based on the first selected value set and the second selected value set, of the conflict result of the first rule and the second rule on the rule dimension comprises: determining, based on the target candidate value set and the first selected value set, a first positive selected value set, wherein the first positive selected value set contains selected values in the target candidate value set except for selected values in the first selected value set; determining, based on the target candidate value set and the second selected value set, a second positive selected value set, wherein the second positive selected value set contains selected values in the target candidate value set except for selected values in the second selected value set; determine whether the first selected value set and the second selected value set have an intersection; in a case where the first selected value set and the second selected value set have an intersection, determine that the conflict result of the first rule and the second rule on the rule dimension is conflict.
4. The method of claim 1, wherein, The method further includes: obtaining the conflict result of the first rule and the second rule on all rule dimensions; in a case where the conflict result on all rule dimensions is conflict, determining that the first rule and the second rule conflict.
5. The method of claim 1, wherein, If the conflict result is that the first rule and the second rule conflict on the rule dimension, the method further includes: obtaining first information corresponding to the first rule and second information corresponding to the second rule; generating a modification prompt message based on the first information and the second information, and sending the modification prompt message, wherein the modification prompt message is used to prompt modification of the first rule and the second rule.
6. A rule conflict detection apparatus characterized by comprising: The apparatus includes: an obtaining module, configured to obtain a first rule and a second rule to be detected, and at least one rule dimension corresponding to the first rule and the second rule; a normalization processing module, configured to, for each rule dimension, obtain an original candidate value set corresponding to the rule dimension, and perform normalization processing on the original candidate value set to obtain a target candidate value set; a first determining module, configured to determine, based on the target candidate value set, a first selected value set corresponding to the first rule on the rule dimension, and a second selected value set corresponding to the second rule on the rule dimension; a second determining module, configured to determine, based on the first selected value set and the second selected value set, a conflict result of the first rule and the second rule on the rule dimension; wherein, if a selected value in the first selected value set is a positive selected value, and a selected value in the second selected value set is a negative selected value, the second determining module is specifically configured to: construct a target selected value set based on the first selected value set and the second selected value set, wherein the target selected value set contains all selected values in the first selected value set and the second selected value set; determine, based on the target selected value set and the second selected value set, a third positive selected value set corresponding to the second selected value set, wherein the third positive selected value set contains selected values in the target selected value set except for selected values in the second selected value set; determine whether the first selected value set and the third positive selected value set have an intersection; in a case where the first selected value set and the third positive selected value set have an intersection, determine that the conflict result of the first rule and the second rule on the rule dimension is conflict.
7. The apparatus of claim 6, wherein, If the selected values in the first selected value set and the second selected value set are all positive selected values, the second determining module is specifically configured to: determine whether the first selected value set and the second selected value set have an intersection; In a case where the first selected value set and the second selected value set have an intersection, the conflict result of the first rule and the second rule in the rule dimension is determined as conflict.
8. An electronic device, comprising: The device comprises a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory communicate with each other through the communication bus. The memory is used for storing a computer program. The processor is used for executing the program stored on the memory, and realizes the method steps in any one of claims 1-5.
9. A computer-readable storage medium, characterized in that, The computer readable storage medium stores a computer program, and the computer program is executed by the processor to realize the method steps in any one of claims 1-5.
Citation Information
Patent Citations
Network configuration rule processing method and related equipment
CN114840133A