CN-114218286-B - Rule analysis method and rule analyzer
Abstract
The application relates to the field of financial science and technology (Fintech), and discloses a rule analysis method and a rule analyzer, wherein the rule analyzer is used for extracting variables of a webpage request which is received at the front end and is based on user triggering, if the rule analyzer is used for determining that a first variable to be checked is extracted, a target rule which is the same as the first variable to be checked is matched from a rule base, first data to be checked of the first variable to be checked in the webpage request is obtained, the rule base is obtained by configuring each set variable to be checked, the rule base comprises a plurality of rules, any rule comprises the variable to be checked and a compliance grammar specification for defining the variable value of the variable to be checked, and the rule analyzer is used for checking the first data to be checked based on the target rule. The scheme can realize compliance verification of various types of data entering each business system without writing rules in a business code in a declarative manner.
Inventors
- SHEN RONG
- CHEN RUI
- LIN YINGXUE
Assignees
- 深圳前海微众银行股份有限公司
Dates
- Publication Date
- 20260512
- Application Date
- 20211229
Claims (7)
- 1. A rule parsing method, comprising: The rule analyzer extracts variables from the webpage request based on user triggering received by the front end; The rule analyzer is used for matching a target rule with the same name as the first variable to be checked from a rule base if determining that the first variable to be checked is extracted, and obtaining first data to be checked of the first variable to be checked in the webpage request; the rule analyzer verifies the first data to be verified based on the target rule; each set variable to be verified comprises a static variable to be verified transmitted based on a first set pattern and a dynamic variable to be verified transmitted based on a second set pattern; the rule parser performs variable extraction on the webpage request received by the front end and based on user trigger, including: The rule analyzer is used for extracting variables of the received webpage request based on user triggering based on a first regular expression and a second regular expression, wherein the first regular expression is used for matching variables to be verified based on the first set style in the webpage request, and the second regular expression is used for matching variables to be verified based on the second set style in the request; the rule analyzer checks the first data to be checked based on the target rule, including: The rule analyzer analyzes the target rule based on a configured rule execution function and determines a first compliance grammar specification corresponding to the first variable to be checked; the rule analyzer checks the first data to be checked according to the first compliance grammar specification; The plurality of rules includes static rules and dynamic rules; The rule base is obtained by configuring each set variable to be verified, and comprises the following steps: Aiming at any one of the set variables to be verified, if the variables to be verified are determined to meet the static rule, configuring the variables to be verified and the methods of the variables to be verified in a rule base; and if the variable to be checked meets the dynamic rule, configuring the variable to be checked and a method for dynamically acquiring data to be checked corresponding to the variable to be checked in the rule base.
- 2. The method of claim 1, wherein the first variable to be verified comprises a first static variable to be verified; And if the rule analyzer determines that the first variable to be checked is extracted, acquiring first data to be checked of the first variable to be checked in the webpage request, wherein the first data to be checked comprises: And if the rule analyzer determines that the first static variable to be checked is extracted, acquiring data with the same name as the first static variable to be checked from service data, and taking the data as first data to be checked of the first static variable to be checked in the webpage request.
- 3. The method of claim 1, wherein the first variable to be verified comprises a first dynamic variable to be verified; And if the rule analyzer determines that the first variable to be checked is extracted, acquiring first data to be checked of the first variable to be checked in the webpage request, wherein the first data to be checked comprises: If the rule analyzer determines that the first dynamic variable to be checked is extracted, acquiring address information pointed by the first dynamic variable to be checked from the webpage request based on the target rule; the rule analyzer constructs an http request based on the address information and sends the http request; And the rule parser takes the data returned for the http request as the first data to be verified.
- 4. A method according to any one of claims 1-3, wherein the method further comprises: The rule analyzer checks the external access request, wherein the external access request is an access request which is received by a back-end server and sent in an API mode, and the rule analyzer is obtained by configuring com.eclipse.j2v8 into maven pon.xml.
- 5. A rule parser, comprising: the variable extraction unit is used for extracting variables from the webpage request which is received by the front end and is based on user triggering; The processing unit is used for matching a target rule with the same name as the first variable to be checked from a rule base if the first variable to be checked is determined to be extracted, and acquiring first data to be checked of the first variable to be checked in the webpage request; the verification unit is used for verifying the first data to be verified based on the target rule; The set variables to be verified comprise static variables to be verified transmitted based on a first set pattern and dynamic variables to be verified transmitted based on a second set pattern, wherein the variable extraction unit is specifically used for extracting variables of a received webpage request triggered by a user based on a first regular expression and a second regular expression respectively; The verification unit is specifically configured to execute a function based on a configured rule, parse the target rule, determine a first compliance grammar specification corresponding to the first variable to be verified, and verify the first data to be verified according to the first compliance grammar specification; The rule configuration unit is used for configuring the method of the variable to be checked and the variable to be checked in a rule base if the variable to be checked meets the static rule, and configuring the variable to be checked and the method of dynamically acquiring the data to be checked corresponding to the variable to be checked in the rule base if the variable to be checked meets the dynamic rule.
- 6. A computer device, comprising: A memory for storing a computer program; a processor for invoking a computer program stored in said memory, performing the method according to any of claims 1-4 in accordance with the obtained program.
- 7. A computer-readable storage medium storing computer-executable instructions for causing a computer to perform the method of any one of claims 1-4.
Description
Rule analysis method and rule analyzer Technical Field The embodiment of the application relates to the field of financial science and technology (Fintech), in particular to a rule parsing method and a rule parser. Background With the development of computer technology, more and more technologies (e.g., cloud computing, big data, or blockchain) are applied in the financial field, and the traditional financial industry is gradually changing to financial technology. Under the large environment of financial science and technology, various business systems, such as decision making systems and intelligent marketing systems, are continuously derived. During the use of the service system by the user, the service system monitors whether the information of the user meets some rules set by the user, and when the information meets the rules, the service system can better grasp the information of the user, so that a better service experience is brought to the user. Currently, each business system has a rule engine. For any business system, a technician defines a plurality of specifications, namely rules, of the business system for data required by the technician in a rule engine in advance, wherein the rules are recorded in a business code in a declarative mode. In addition, current rule engines can only verify character-type data from regular expressions. For the rules engine of the business system described above, there are the following disadvantages: 1. In addition, when the rule in the rule engine in the use state needs to be updated, the technician is required to pause the use of the service system and to re-modify the service code so as to define the new rule, which is obviously inconvenient for the normal use of the service system. 2. Since only character data can be checked at present, but cannot be expanded to check other data of more kinds, the setting of data check by the conventional rule engine is not perfect. In summary, a rule engine with high universality and strong consistency and capable of more comprehensively checking data is needed at present so as to make a reasonable and efficient judgment scheme for the data. Disclosure of Invention The application provides a rule parsing method and a rule parser for performing compliance verification on various types of data entering various service systems without writing rules in a declarative manner under the condition of service codes. The embodiment of the application provides a rule analysis method, which comprises the steps that a rule analyzer extracts variables of a webpage request received by a front end and based on user triggering, if the rule analyzer determines that a first variable to be verified is extracted, a target rule with the same name as the first variable to be verified is matched from a rule base, first data to be verified of the first variable to be verified in the webpage request is obtained, the rule base is obtained by configuring each set variable to be verified, the rule base comprises a plurality of rules, any rule comprises the variable to be verified and a rule grammar specification defining the variable value of the variable to be verified, and the rule analyzer verifies the first data to be verified based on the target rule. For an application written in JavaScript language, it is a normal operation to parse using a parser. Based on this, in the embodiment of the present application, various rules are configured in advance in the rule base, and any rule includes a variable to be checked and a compliance grammar specification for defining a variable value of the variable to be checked, so when a web page request triggered by a user enters the front end, a rule parser in the front end may parse the web page request, including performing variable extraction, determining data to be checked and a target rule for checking the data to be checked, and checking the data to be checked using the target rule, so as to determine whether the web page request meets the original purpose of application program development. In the method, the rule is configured in the rule base, and the rule analyzer is used for checking the rule, so that a corresponding rule engine is not required to be set because of different service systems, therefore, in the scheme, the JavaScript language is used for writing the service systems, so that the check of the data is not required to be repeatedly set because of different service systems, the service systems are not required to be stopped when the rule needs to be updated, and the rule is only required to be updated in the rule base. In a possible implementation method, each set variable to be verified comprises a static variable to be verified transmitted based on a first set pattern and a dynamic variable to be verified transmitted based on a second set pattern, the rule analyzer extracts variables of the webpage request received by the front end and based on user triggering, the rule analyzer extracts varia