Disclosure of Invention
In view of the foregoing, it is desirable to provide a rule configuration method, a rule configuration device, and a method for determining reliability of the result.
A rule configuration method, the method comprising: receiving an index creation instruction sent by a user, and creating a plurality of indexes, wherein the indexes comprise index names and parameters, the index creation instruction comprises index creation information, and the indexes are defined according to the index creation information to obtain target indexes; receiving a sub-rule creation instruction sent by a user, opening a sub-rule creation page, and receiving the target index, the operator and the threshold range selected by the user to form a sub-rule; and receiving the sub-rule and the logic symbol selected by the user to obtain a target rule.
In one embodiment, the parameter is a real parameter.
In one embodiment, the receiving an index creation instruction sent by a user creates a plurality of indexes, where the indexes include index names and parameters, the index creation instruction includes index creation information, and the plurality of indexes are defined according to the index creation information to obtain a target index, and specifically includes: receiving an index creation instruction sent by a user, wherein the index creation instruction comprises index creation information; creating a plurality of indexes according to the index creation instruction, wherein the indexes comprise index names and parameters, the parameters comprise parameter names and parameter value fields, the indexes are defined as a type of service characteristics, and the parameters are used for calculating values represented by the indexes in a script; and defining the plurality of indexes according to the index creation information to obtain a target index.
In one embodiment, the index further comprises a reference index, wherein the reference index comprises a reference index name and a reference index parameter, and the reference index parameter comprises a reference index parameter name and a reference index parameter value range.
In one embodiment, the target rule is composed of a logical layer composed of one or more sub-rules.
In one embodiment, after receiving the sub-rule and the logical symbol selected by the user, the method further includes: and judging the number of logic layers of the target rule expected to be iterated, and if the number of the logic layers is greater than three, creating a new target index, wherein the new target index is used for replacing one logic layer.
A rule configuration device, comprising an index creation module, a rule creation module and a rule generation module, wherein: the index creation module is used for receiving an index creation instruction sent by a user, creating a plurality of indexes, wherein the indexes comprise index names and parameters, the index creation instruction comprises index creation information, and defining the plurality of indexes according to the index creation information to obtain target indexes; the rule creation module is used for receiving a sub-rule creation instruction sent by a user, opening a sub-rule creation page, and receiving the target index, the operator and the threshold range selected by the user to form a sub-rule; the rule generating module is used for receiving the sub-rule and the logic symbol selected by the user to obtain a target rule.
In one embodiment, the index creation module includes a receiving unit, a creation unit, and a definition unit, where: the receiving unit is used for receiving an index creation instruction sent by a user, wherein the index creation instruction comprises index creation information; the creation unit is used for creating a plurality of indexes according to the index creation instruction, wherein the indexes comprise index names and parameters, the parameters comprise parameter names and parameter value fields, the indexes are defined as a type of service characteristics, and the parameters are used for calculating values represented by the indexes in a script; the definition unit is used for defining the plurality of indexes according to the index creation information to obtain target indexes.
A method for determining reliability of a rule result, based on a rule configuration method described in the foregoing embodiments, the method comprising: judging whether the two sides of the logic symbol of the target rule are reliable or not; if both sides of the logic symbol of the target rule are reliable, the target rule is reliable; if both sides of the logic symbol of the target rule are unreliable, the target rule is unreliable; if the logic symbol of the target rule is unreliable and only one side of the logic symbol is unreliable, judging whether the result of the unreliable side affects the result of the target rule, if so, indicating that the target rule is unreliable, and if not, indicating that the target rule is reliable.
In one embodiment, the determining whether the two sides of the logical symbol of the target rule are reliable is specifically: acquiring all the target indexes of each of two sides of a logic symbol of the target rule; judging whether the target index contains a default value or not; if the target index contains a default value, the side of the target index containing the default value is unreliable, otherwise, the side of the target index containing the default value is reliable.
The rule configuration method, the rule configuration device and the result reliability judging method thereof include the target rule including all sub rules; each sub-rule binds a plurality of target indexes and transmits the target indexes to all parameters of the target indexes, and only the parameter values in the target indexes are derived from the target rules in actual service. The design can use the business index at the bottom layer, and the rule layer is realized by transmitting the real parameters and multiplexing the target index; even if the target rule changes later, the target rule does not need to be realized again as long as the original target index of the bottom layer can be covered. Therefore, the multiplexing rate of the rule to the index script is improved, redundant codes are reduced, and the coupling between the rule and the service index is reduced. And the reliability of the rule result is clarified by checking the target index using the default value in the rule.
Detailed Description
In order to make the objects, technical solutions and advantages of the present invention more apparent, the present invention will be further described in detail by the following detailed description with reference to the accompanying drawings. It should be understood that the specific embodiments described herein are for purposes of illustration only and are not intended to limit the scope of the invention.
In one embodiment, as shown in fig. 1, a rule configuration method is provided, including the steps of:
s110, receiving an index creation instruction sent by a user, creating a plurality of indexes, wherein the indexes comprise index names and parameters, the index creation instruction comprises index creation information, and defining the plurality of indexes according to the index creation information to obtain target indexes.
Specifically, an index creation instruction sent by a user is received, an index creation interface is opened, a plurality of indexes are created, the indexes comprise index names and parameters, index creation information is included in the index creation instruction, and according to the received index creation information, the indexes of the index creation interface are defined, so that target indexes are obtained. The parameters herein are redefinable.
In one embodiment, step S110 is specifically: receiving an index creation instruction sent by a user, wherein the index creation instruction comprises index creation information; according to an index creation instruction, creating a plurality of indexes, wherein the indexes comprise index names and parameters, the parameters comprise parameter names and parameter value fields, the indexes are defined as a type of service characteristics, and the parameters are used for calculating values represented by the indexes in a script; and defining a plurality of indexes according to the index creation information to obtain a target index. Specifically, after receiving an index creation instruction sent by a user, index creation information in the index creation instruction is obtained, an index creation page is opened first, an index is created, an index name and a parameter need to be defined, the parameter of the index includes a parameter name and a parameter value field, the index is defined as a feature of a service, a value represented by the index is a feature value, the parameter is used for calculating the feature value, the index is defined according to the received index creation information, the index name and the parameter are defined according to the received index creation information, for example, in a certain service rule, an index a represents "tax amount", the same service feature (tax amount) of different objects (enterprise X and enterprise Y) may have a plurality of different instances (for example, tax amount of about 3 months X and tax amount of about 1 year Y) but they all point to an index a ". The index is not bound with the business rules, but the parameters in the index are bound with the business rules, because no matter how long the tax amount of the enterprise X or the enterprise Y should be paid, the index A can be used for representing the tax amount, and the parameters in specific business conditions are different.
In one embodiment, the index includes parameters that are real parameters. Specifically, because the parameters in the index are bound with the actual business rules, the parameter values in the index come from real parameters configured by the rule layer.
In one embodiment, the index further comprises a reference index, wherein the reference index comprises a reference index name and a reference index parameter, and the reference index parameter comprises a reference index parameter name and a reference index parameter value range. Specifically, the value represented by one index is calculated by the same parameter, but the parameter itself can also be one index, namely the reference index is used, the representation value of the same reference index is calculated by the parameter, namely the reference index parameter is used at the moment, and the parameter also comprises a parameter name and a parameter value field, and the corresponding reference index parameter name and the reference index parameter value field in the step are used.
S120, receiving a sub-rule creation instruction sent by a user, opening a sub-rule creation page, and receiving a target index, an operator and a threshold range selected by the user to form a sub-rule.
Specifically, the sub-rule is composed of an index, an operator and a threshold value, so that a sub-rule creation instruction sent by a user is received, a sub-rule creation page is opened first, then a target index, an operator and a threshold value range selected by the user are received, and the target index, the operator and the threshold value range selected by the user are utilized to compose the sub-rule.
S130, receiving the sub-rule and the logic symbol selected by the user to obtain the target rule.
Specifically, a specific business rule can be abstracted into a logic operation of an independent business index and a threshold value, and additional conditions of the business index in various application scenes can be realized through real-parameter input of a rule configuration interface, so that a sub-rule and a logic symbol selected by a user are received, and the selected sub-rule is subjected to the logic operation according to the logic symbol, and a target rule is obtained.
In one embodiment, the target rule is composed of a logical layer composed of one or more sub-rules. Specifically, each rule is composed of logic layers, and can be directly composed of one logic layer or composed of multiple logic layers through logic iteration; and each layer of logic is composed of one or several rows of sub-rules.
In one embodiment, after step S130, further includes: judging the number of logic layers of the needed iteration of the target rule, if the number of the logic layers is greater than three, creating a new target index which is used for replacing one logic layer. Specifically, each rule may iterate at most 3 layers of logic (and/or not), and if it is found that the expected required logic layer is greater than 3 layers when constructing the target rule, then a new target indicator may be selected to be created, and the value represented by this target indicator may be substituted for the value represented by one logic layer, thereby reducing the number of layers iterated.
In the above embodiment, the target rule is obtained by using the target index, the operator and the threshold value to form the sub-rule, then using the sub-rule to perform logic operation, calculating the value represented by the index through the changeable parameter, and binding the index parameter with the business rule; the target index is used at the bottom layer, the rule layer is realized by transmitting the real parameters and multiplexing the target index, and even if the target rule changes later, the target index does not need to be realized again as long as the original target index of the bottom layer can be covered, so that the multiplexing rate of the rule to the index script is improved, redundant codes are reduced, and the coupling between the rule and the service index is reduced.
In one embodiment, as shown in fig. 2, a rule configuration apparatus 200 is provided, which includes an index creation module 210, a rule creation module 220, and a rule generation module 230, wherein:
the index creation module 210 is configured to receive an index creation instruction sent by a user, create a plurality of indexes, where the indexes include index names and parameters, the index creation instruction includes index creation information, and define the plurality of indexes according to the index creation information to obtain a target index;
the rule creation module 220 is configured to receive a sub-rule creation instruction sent by a user, open a sub-rule creation page, and receive a target index, an operator, and a threshold range selected by the user to form a sub-rule;
the rule generating module 230 is configured to receive the sub-rule and the logic symbol selected by the user, and obtain the target rule.
In one embodiment, as shown in fig. 3, the index creation module 210 includes a receiving unit 211, a creation unit 212, and a definition unit 213, wherein: the receiving unit 211 is configured to receive an index creation instruction sent by a user, where the index creation instruction includes index creation information; the creating unit 212 is configured to create a plurality of indexes according to an index creation instruction, where the indexes include index names and parameters, the parameters include parameter names and parameter value fields, the indexes are defined as a class of service features, and the parameters are used to calculate values represented by the indexes in the script; the defining unit 213 is configured to define a plurality of indexes according to the index creation information, and obtain a target index.
In one embodiment, as shown in fig. 4, there is provided a method for determining reliability of a rule result, which is based on a rule configuration method in the above embodiments, including the steps of:
s310 judges whether both sides of the logical symbol of the target rule are reliable.
Specifically, since the target rule actually appears as a logical symbol and two expressions located on both sides of the logical symbol, judging whether the target rule is reliable requires specifically judging whether the expressions on both sides of the logical symbol are each reliable.
In one embodiment, step S310 is specifically: acquiring all target indexes of each of two sides of a logic symbol of a target rule; judging whether the target index contains a default value or not; if the target index contains a default value, the side of the target index containing the default value is unreliable, otherwise, the side is reliable. Specifically, the reliability is determined, which is essentially to determine whether a default value is included, and the default value is an initial value of an attribute or a parameter before being modified. If the target index takes a default value in calculation, the target index is unreliable; if the target index does not take a default value at the time of calculation, the target index is reliable. Therefore, if there is a default value, the result of the expression indicating the side on which the target index containing the default value is located is not reliable.
S320, if both sides of the logical symbol of the target rule are reliable, the target rule is reliable.
Specifically, if the left and right expressions of the target rule are reliable, it is indicated that the default value does not exist, and it is indicated that the rule is reliable.
S330, if both sides of the logical symbol of the target rule are unreliable, the target rule is unreliable.
Specifically, if neither the left nor right expressions of the target rule are reliable, indicating that default values exist, the rule is unreliable.
If the logical symbol of the target rule is not reliable and only one side is unreliable in S340, it is determined whether the result of the unreliable side affects the result of the target rule.
Specifically, if the target rule has an unreliable expression and only one side of the expression is unreliable, a determination needs to be made as to whether the result will affect the result of the target rule. The result type of the expression is boolean, i.e., true/false, i.e., true or false.
If the influence is made in S341, the target rule is not reliable.
Specifically, if the boolean value of the expression changes, the boolean value of the entire target rule also changes, indicating that the target rule is unreliable.
If S342 is not affected, the target rule is reliable.
Specifically, if the boolean value of the expression changes and the boolean value of the entire target rule does not change, then the target rule is declared to be reliable.
For example, rule (1) is: a > B. Wherein rule (1) is unreliable as long as there is an unreliable indicator in A, B;
if rule (2) is: (A > B) and (C < 1), wherein (A > B) is considered as an M expression and (C < 1) is considered as an N expression.
When rule (2) =true, i.e., the result of rule (2) is true, both the M and N expressions are true, i.e., both M and N have an effect on the final result; the reliability determination of rule (2) in all possible cases is explained as follows:
m=t & & n=t, push out rule (2) =t
M=t & & n=f, push out rule (2) =f
M=f &n=t, push out rule (2) =f
M=f &n=f, push out rule (2) =f
If rule (2) =false, i.e. the result of rule (2) is false, both the M and N expressions are false, i.e. both M and N have an effect on the final result; the reliability determination of rule (2) in all possible cases is explained as follows:
m=t & & n=t, push out rule (2) =t
M=t & & n=f, push out rule (2) =f
M=f &n=t, push out rule (2) =f
M=f &n=f, push out rule (2) =f
If rule (2) =false, M expression-! The expression =n, i.e. false in M and N has an effect on the final result; the reliability of rule (2) is the same as the reliability of the sub-expression false;
assume that: m expression=false, N expression=true, and m=t, push rule (3) =t;
m expression=false, N expression=true, and m=f, pushing out rule (3) =f;
for example, rule (3): (A > B) or (C < 1), where (A > B) is considered an M expression and (C < 1) is considered an N expression.
If rule (3) =true, both the M expression and the N expression are true, i.e., the results in M and N are true and have an influence on the final result; the reliability determination of rule (3) is described as follows in all possible cases:
m=t||n=t, and the push rule (3) =t
M=t||n=f, and the push rule (3) =t
M=f||n=t, and the push rule (3) =t
M=f||n=f, and the push rule (3) =f
If rule (3) =true, M expression-! The reliability of rule (3) is the same as the reliability of the sub-expression true, =n expression;
assume that: m expression=true, N expression=false, and m=t, pushing out rule (3) =t;
m expression=true, N expression=false, and m=f, pushing out rule (3) =f;
if rule (3) =false, both the M expression and the N expression are false, the reliability determination of rule (3) in all possible cases is described as follows:
m=t & & n=t, push out rule (3) =t
M=t & & n=f, push out rule (3) =f
M=f &n=f, push out rule (3) =f
M=f &n=t, push out rule (3) =f
The foregoing is a further detailed description of the invention in connection with specific embodiments, and is not intended to limit the practice of the invention to such descriptions. It will be apparent to those skilled in the art that several simple deductions or substitutions may be made without departing from the spirit of the invention, and these should be considered to be within the scope of the invention.