CN107220098A - The implementation method and device of regulation engine - Google Patents
The implementation method and device of regulation engine Download PDFInfo
- Publication number
- CN107220098A CN107220098A CN201710448421.4A CN201710448421A CN107220098A CN 107220098 A CN107220098 A CN 107220098A CN 201710448421 A CN201710448421 A CN 201710448421A CN 107220098 A CN107220098 A CN 107220098A
- Authority
- CN
- China
- Prior art keywords
- rule
- input data
- determinant attribute
- value
- attribute
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Granted
Links
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F8/00—Arrangements for software engineering
- G06F8/30—Creation or generation of source code
- G06F8/37—Compiler construction; Parser generation
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F8/00—Arrangements for software engineering
- G06F8/30—Creation or generation of source code
- G06F8/31—Programming languages or programming paradigms
- G06F8/315—Object-oriented languages
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F8/00—Arrangements for software engineering
- G06F8/40—Transformation of program code
- G06F8/41—Compilation
- G06F8/43—Checking; Contextual analysis
Abstract
The invention provides a kind of implementation method of regulation engine and device, method therein includes:Receive input data;The input data is matched in the rule set of the regulation engine, wherein, the rule set includes many rules, and the rule is the rule configured based on JSON forms;For the rule, if the input data includes regular corresponding determinant attribute, line discipline verification is then entered to the input data according to the determinant attribute, and operation is updated to the input data according to the rule, if not including the determinant attribute in the input data, then object is extracted from the input data, utilize Java reflex mechanisms, get the corresponding property value of the object, and line discipline verification is entered to the input data according to the object and property value, and operation is updated to the input data according to rule.The present invention can rule of simplification engine development process, improve efficiency.
Description
Technical field
The present invention relates to computer and Internet technical field, the implementation method and dress of more particularly to a kind of regulation engine
Put.
Background technology
Regulation engine is developed by inference engine, is a kind of component of insertion in the application, and business is determined in realization
Plan is separated from application code, and writes operational decision making using predefined semantic modules.The work of regulation engine
Flow can be understood as:Receive data input first, then explain business rule, make business finally according to business rule and determine
Plan.
For operation system, complicated and changeable business rule, if the support without regulation engine, it is difficult to accomplish
The decoupling of service code, it is impossible to timely respond to the change of business.Existing regulation engine, the Drools (JBoss such as increased income
Rules, a kind of easily accessed business strategy, the Business Rule Engine of increasing income for being easy to adjust and being easily managed), configuration is to be based on
Xml (Extensible Markup Language, extensible markup language) and distinctive Drl files (extend entitled drl.'s
File) to realize, the visual edit degree of Drools rule configurations is not high, is safeguarded mainly by backstage developer, so visually
Melt hair and maintenance cost is higher.
The content of the invention
For the exploitation of rule of simplification engine, the embodiment of the present invention provides the implementation method and device of a kind of regulation engine.
According to an aspect of the present invention there is provided a kind of implementation method of regulation engine, including:Receive input data;Will
The input data is matched in the rule set of the regulation engine, wherein, the rule set includes many rules, and the rule
It is then the rule configured based on JSON forms;For the rule, if the input data includes regular corresponding key
Attribute, then enter line discipline verification to the input data according to the determinant attribute, and according to the rule to the input number
According to operation is updated, if not including the determinant attribute in the input data, extracted from the input data
Object, using Java reflex mechanisms, gets the corresponding property value of the object, and according to the object and property value to described
Input data enters line discipline verification, and is updated operation to the input data according to rule.
Optionally, the rule includes conditional object and performs object, and methods described also includes:Based on JSON forms, match somebody with somebody
Put the conditional object and perform object;Wherein, the conditional object includes field parameter, operation item parameter and value
The JSON arrays of parameter composition, the execution object includes the JSON arrays of field parameter and arranges value parameter composition.
Optionally, it is described according to the determinant attribute input data is entered line discipline verification include:It is excellent according to rule
First level gets the rule of highest priority;For the rule currently obtained, according to the regular conditional object include it is each
Item parameter, it is determined that the determinant attribute form being made up of a parameter or multiple parameters;The input data is parsed, is extracted described
The corresponding determinant attribute of determinant attribute form;If in the corresponding value of the determinant attribute of input data and the conditional object
Determinant attribute value is consistent, it is determined that pass through for rule verification.
Optionally, it is described operation is updated to the input data according to the rule to include:According in the rule
The parameters that object includes are performed, it is determined that the determinant attribute form being made up of a parameter or multiple parameters;Parse described defeated
Enter data, extract the corresponding determinant attribute of the determinant attribute form;According to the determinant attribute in the execution conditional object
Value updates the value of the determinant attribute of the input data.
Optionally, it is described to be extracted from the input data if not including the determinant attribute in the input data
Go out object, the corresponding property value of the object is got using Java reflex mechanisms include:Parse the field parameter for pair
As the form of/attribute, and object is got from the input data;Using Java reflex mechanisms, from the input data
The object is extracted, and the object's property value is obtained using the Get/Set methods of the object.
Optionally, the rule is that structure is cached in a distributed manner.
According to another aspect of the present invention there is provided a kind of device of realizing of regulation engine, including:Input data receives single
Member, for receiving input data;Rule match unit, for by the input data in the rule set of the regulation engine
Match somebody with somebody, wherein, the rule set includes many rules, and the rule is the rule configured based on JSON forms;Rule verification and
Execution unit, for for the rule, if the input data includes regular corresponding determinant attribute, according to described
Determinant attribute enters line discipline verification to the input data, and is updated operation to the input data according to the rule,
If not including the determinant attribute in the input data, object is extracted from the input data, it is anti-using Java
Mechanism is penetrated, the corresponding property value of the object is got, and professional etiquette is entered to the input data according to the object and property value
Then verify, and operation is updated to the input data according to rule.
Optionally, the rule includes conditional object and performs object, and described device also includes:Object dispensing unit, is used
In based on JSON forms, the configuration conditional object and execution object;Wherein, the conditional object includes field parameter, behaviour
Make the JSON arrays of item argument and value parameter composition, the execution object includes field parameter and arranges value parameter
The JSON arrays of composition.
Optionally, the rule verification and execution unit include:Rule verification subelement, for being obtained according to rule prioritization
Get the rule of highest priority;For the rule currently obtained, the parameters included according to the regular conditional object,
It is determined that the determinant attribute form being made up of a parameter or multiple parameters;The input data is parsed, the crucial category is extracted
The corresponding determinant attribute of personality formula;If the corresponding value of the determinant attribute of input data and the crucial category in the conditional object
Property value it is consistent, it is determined that for rule verification pass through.
Optionally, the rule verification and execution unit include:Rule performs subelement, for being held according in the rule
The parameters that row object includes, it is determined that the determinant attribute form being made up of a parameter or multiple parameters;The parsing input
Data, extract the corresponding determinant attribute of the determinant attribute form;Determinant attribute in the execution conditional object takes
Value updates the value of the determinant attribute of the input data.
Optionally, if not including the determinant attribute in the input data, the rule verification and execution unit bag
Include:Reflection processing subelement, for parsing the form that the field parameter is object/attribute, and from the input data
Get object;Using Java reflex mechanisms, the object is extracted from the input data, and utilize the Get/ of the object
Set methods obtain the object's property value.
It is preferred that, the rule is that structure is cached in a distributed manner.
It can be seen that, regulation engine of the present invention is realized based on JSON and reflex mechanism, the Rule rule configurations based on JSON, is
The front end visual development of regulation engine is provided convenience so that the regulation engine, which is configured, more facilitates clear;In Rule
Configuration on it is clear, it is simple in realization efficiently.Using data interchange language JSON and the Java reflex mechanism of lightweight,
The business rule that can be frequently changed by dynamically configuring quick response is adjusted, and is reduced exploitation and O&M cost, is improved system
Flexibility;Rule is cached using distributed frame, the resource consumption that reduction resolution rules are caused improves regulation engine operation effect
Rate.The regulation engine implementation provides quick response for the audit policy of the related services such as video, picture and text, can be very big
Mitigate the workload of examination & verification, save examination & verification human cost and development cost.
Brief description of the drawings
Fig. 1 is a kind of implementation method flow chart for regulation engine that one embodiment of the invention is provided;
Fig. 2 is regulation engine class diagram intention in a kind of regulation engine that another embodiment of the present invention is provided;
Fig. 3 is a kind of implementation method flow chart for regulation engine that another embodiment of the present invention is provided;
Fig. 4 is that a kind of regulation engine that one embodiment of the invention is provided realizes apparatus structure schematic diagram.
Embodiment
In order to facilitate the understanding of the purposes, features and advantages of the present invention, it is below in conjunction with the accompanying drawings and specific real
Applying mode, the present invention is further detailed explanation.
It is a kind of implementation method flow chart of regulation engine provided in an embodiment of the present invention referring to Fig. 1, this method includes:
S101:Receive input data;
S102:Input data is matched in the rule set of regulation engine, wherein, rule set includes many rules, and rule
It is then the rule configured based on JSON forms;
S103:Judge whether include regular corresponding determinant attribute in input data, if including performing step S104, such as
Fruit does not include, and performs step S105;
S104:Line discipline verification is entered to input data according to determinant attribute, and input data is updated according to rule
Operation;
S105:Object is extracted from input data, using Java reflex mechanisms, the corresponding property value of object is got,
And line discipline verification is entered to input data according to object and property value, and operation is updated to input data according to rule.
It can be seen that, the present invention frequently changes the scene of service logic based on auditing system, proposes a kind of realization rapidly and efficiently
Mode, using lightweight data interchange language JSON (JavaScript Object Notation, JS object tag) and
Java reflex mechanisms, it is convenient to be integrated and visual exploitation in existing system, it is easy to which that developer and business personnel tie up jointly
Protect and use.Above-mentioned also to mention, strictly all rules configuration of the invention is that, based on JSON technologies, JSON is JavaScript original
Raw form, it means that handle JSON data in JavaScript and do not need any special API or kit, so can letter
Change front end exploitation.
In an optional implementation, input data refers to the data of Map (String, Object) type, the data
Form flexibly supports all types of data, and any type of data can be deposited again inside it, thus improves the flexibility of scheme.
Skilled in the art realises that, the minimum unit performed in regulation engine is rule set (RuleSet), a rule
Collection is made up of many rules (Rule).One Rule is by a conditional object (Condition) and multiple execution objects
(Action) constitute.
In an optional mode, with Memcached distributed frame storage rules, holding for regulation engine thus can be improved
Line efficiency.
In an optional implementation, rule includes conditional object and performs object, therefore specific to the configuration of rule
Including:Based on JSON forms, configuration condition object and execution object;Wherein, conditional object includes field parameter, operation item
The JSON arrays of parameter and value parameter composition, performing object includes the JSON of field parameter and arranges value parameter composition
Array.
In an optional mode, entering line discipline verification to input data according to the determinant attribute includes:According to rule
Priority gets the rule of highest priority;For the rule currently obtained, the items included according to regular conditional object
Parameter, it is determined that the determinant attribute form being made up of a parameter or multiple parameters;Input data is parsed, determinant attribute lattice are extracted
The corresponding determinant attribute of formula;If the corresponding value of the determinant attribute of input data and the determinant attribute value one in conditional object
Cause, it is determined that pass through for rule verification.
In an optional mode, being updated operation to input data according to rule includes:According to execution pair in rule
As including parameters, it is determined that the determinant attribute form being made up of a parameter or multiple parameters;Input data is parsed, is extracted
Go out the corresponding determinant attribute of determinant attribute form;The pass of input data is updated according to the determinant attribute value performed in conditional object
The value of key attribute.
In an optional mode, if not including regular corresponding determinant attribute in input data, using reflex mechanism
The specific steps handled include:The form that field parameter is object/attribute is parsed, and is got from input data pair
As;Using Java reflex mechanisms, the object is extracted from input data, and obtain using the Get/Set methods of the object
The object's property value.
It can be seen that, in the new implementation of regulation engine proposed by the present invention, based on JSON and reflection technology, and optionally
Based on more popular Spring frameworks at present, quickly it can integrate and realize in existing business system.For business rule
Frequently change and need the scene come into force in time, for example, needing dynamically to adjust machine according to migration efficiency in auditing system
Corresponding strategies (including task priority strategy, machine conclude fruit strategy, flow of task strategy etc.) are examined, the regulation engine can height
The reply of effect, specifically, using the regulation engine flexibly input and output, the demand of most of business scenarios is disclosure satisfy that,
And utilize caching technology and java reflection technologies, can efficient executing rule, realize efficient process.Meanwhile, simply it is easy to reason
The visual configuration of solution, has been also convenient for developer and non-developer is used in conjunction with.
With reference to Fig. 2-3, another embodiment of the present invention is introduced.
The implementation process of regulation engine mainly includes three below step:
1. it is ready for data.In the optional mode of the embodiment of the present invention, input data form be Map (String,
Object) type, the data format flexibly supports all types of data.Total input is defined as Map forms, because this form has
Very big flexibility, any type of data can be deposited again inside it.
2. verifying Rule, the required value of rule is obtained according to input data, judges whether to meet condition.
3. Action is performed, the specific behavior that execution Action is specified if rule is met, returning result, otherwise directly
Skip.
Below from the master-plan of regulation engine, the setting of conditional object and execution object, conditional object and execution object
Execution flow, the embodiment of the present invention is introduced.
The minimum unit performed in regulation engine is rule set RuleSet, and a rule set is by many rule Rule groups
Into.One Rule performs object by a Condition conditional object and multiple Action and constituted.Rule set performs reality
Existing two kinds of strategies, one kind is to meet, and is jumped out, and another is to go to bottom.In addition, the rule in rule set is supported according to priority
Sequence.
Regulation engine also add Memcached distributed cachings, be greatly improved the execution efficiency of regulation engine.Referring to
Fig. 2, is regulation engine class diagram intention.In Fig. 2, regulation engine includes multiple RuleSet, and each RuleSet includes a plurality of
Rule, a Rule perform object by a Condition conditional object and multiple Action and constituted, wherein, one
Condition is made up of ConditionItem and ConditionGroup, and RuleInputOutput is used for configuring Conditon
In the corresponding parameter types of field, applied during convenient reflection.
It is the implementation process flow chart of regulation engine in the present embodiment with reference to Fig. 3.
Fig. 3 includes step:
S301:Receive input data;
S302:Executing rule collection RuleSet;
S303:According to Rule priority, choose a Rule and verify;
S304:Conditon is performed to judge:The actual value and Configuration Values that object is got from input data are compared, such as
Fruit matching then performs S305, otherwise returns and performs S303;
S305:Perform action:According to Action config update attributes;
S306:Judgment rule collection type, then jumps out if meeting, then goes to S306;If bottom is gone to, then turn
S303;
S307:Terminate and output result.
As already described, the present invention is configured based on JSON to Conditon and Action, and JSON is that one kind is completely independent
In the text formatting of language, the access of data is simplified, is easy to front end to develop.
For example, Conditon form is as shown in table 1.
Table 1
It is ConditionGroup arrays that groups attributes are corresponding in Conditon, and the inside can continue to include
ConditionGroup or ConditonItem.
ConditonItem format samples such as table 2.
Table 2
The json arrays that Action is then made up of following Item, [{ item0 } ..., { itemn }].
Item format samples are as shown in table 3.
Table 3
After Conditon and Action configuration is carried out, that is, Rule configuration is completed, subsequently to input data
When being matched, matched according to Conditon and Action configuration.
Regular input data be Map (String, Object) form, the field attributes in configuration, as
Key goes in Map to retrieve.
For example, field attributes are field above defined in ConditionItem, i.e. some in business rule configuration
Condition KEY (determinant attribute), for example, ID (user's mark), a such as complete rule is probably such:" user
Then video auditing result is to pass through to ID=1 ".So, ID=1 is ConditionItem, wherein, " ID " is
Field, " 1 " is value." video auditing result is to pass through " is Action, wherein, " video auditing result " is field, " logical
Cross " it is value.
If directly hitting a rule, Condtion situation is to take out corresponding value, and according to the behaviour of configuration
Make type op and Configuration Values value and carry out logic judgment;Action then sets the corresponding value values of current key according to configuration.
If in recklessly, field attributes to be resolved to the form of " object name attribute-names ", according to object name from input
Object is got in data, the corresponding property values of Get/Set are removed using java reflex mechanisms.
Resolving to the principle of the form of " object name attribute-names " is:Still such as the " video if ID=1 of that rule above
Auditing result is to pass through " exemplified by, since to judge ID, that must be by user profile input rule engine, and defining User is
User object, wherein including id attributes.So input data can be Map.put (" User ", new User ()), that is, include
Key is " User ", and Value is a Map data of User objects.
The principle for removing the corresponding property values of Get/Set using java reflex mechanisms is:There is each attribute in Java object
Corresponding Get/Set methods, Get is acquired value, and Set is arranges value.Reflex mechanism is the Basic API that Java is provided, Ke Yigen
Go dynamically to call according to method name and specific object, so as to obtain or change the specific object of the object.
Below with a specific example explanation.
As it was previously stated, a rule is appreciated that, to be made up of Conditon and Action, (to work as front lay for a rule
It is for the KEY in input data Map during the rule therein hit and do not said in losing one's life is hit or lost one's life for then)
For (determinant attribute).
For example:The Map data of input are:
KEY therein is exactly " key1 "/" User.id "/" User " three, wherein User corresponding is a Java object.
If now a rule Conditon is (only comprising a ConditonItem):{"groups":[{"
field":"User.id","op":"==", " value ":"3"}],"op":"or"}
When input data performs rule Condtion parts, first field is taken from Conditon, herein for
" User.id ", goes to look for input value in input data with this field as key.As a result match and deposited in input data above
In the Key of " User.id ", then taking-up value is 2, because there is the key directly configured, now also not from object User
Reflect id value.
If now input data is revised as:
The key of the inside only has two:At this moment or above rule " key1 "/" User ", are first used when execution
field:" User.id " goes in input data to find as key, it is impossible to directly find corresponding value, will will at this time be somebody's turn to do
Field resolves to the form of " object name attributes ", and that object name goes input data to look for corresponding object as key.Above
Row are exactly to go to search as key by " User ", so as to get User objects, are then got according to reflection from object
Id value.
Action execution principle is also in this way, for example the Action parts of that rule are above:[{"field":"
User.name","value":" Zhang San " }], the meaning of this rule completely is exactly " by its title if ID is 3
It is revised as Zhang San ".
It is also first to take field during execution:" User.name " goes in Map data to search as the key of an entirety, if
Have directly cover in original value (this is exactly simple Map assignment), the input data of this example and there is no key "
User.name ", so the form of " object name attributes " will be resolved to, with object name " User " go in Map to look into as key
Look for, at this time have found an object, then using reflex mechanism, the name attributes of object are set to " Zhang San ".
It can be seen that, in the embodiment of the present invention, regulation engine is realized based on JSON and reflex mechanism, the Rule rule based on JSON
Then configure, be that the front end visual development of regulation engine is provided convenience so that the regulation engine, which is configured, more facilitates clear
It is clear;It is clear in Rule configuration, it is simple in realization efficient.Can frequently it be changed by dynamically configuring quick response
Business rule adjustment, reduce exploitation and O&M cost, improve system flexibility;Using rule cache strategy, reduction parsing rule
The resource consumption then caused, improves regulation engine operational efficiency.The regulation engine implementation is for the related industry such as video, picture and text
The audit policy of business provides quick response, can greatly mitigate the workload of examination & verification, saves examination & verification human cost and develops into
This.
It should be noted that for embodiment of the method, in order to be briefly described, therefore it to be all expressed as to a series of action group
Close, but those skilled in the art should know, the embodiment of the present invention is not limited by described sequence of movement, because according to
According to the embodiment of the present invention, some steps can be carried out sequentially or simultaneously using other.Secondly, those skilled in the art also should
Know, embodiment described in this description belongs to alternative embodiment, the involved action not necessarily present invention is implemented
Necessary to example.
Reference picture 4, is a kind of apparatus structure schematic diagram provided in an embodiment of the present invention.The device includes:
Input data receiving unit 401, for receiving input data;
Rule match unit 402, for the input data to be matched in the rule set of the regulation engine, wherein,
The rule set includes many rules, and the rule is the rule configured based on JSON forms;
Rule verification and execution unit 403, for for the rule, if the input data includes rule correspondence
Determinant attribute, then according to the determinant attribute input data is entered line discipline verification, and according to it is described rule to described
Input data is updated operation, if not including the determinant attribute in the input data, from the input data
Object is extracted, using Java reflex mechanisms, the corresponding property value of the object is got, and according to the object and property value
Enter line discipline verification to the input data, and operation is updated to the input data according to rule.
Optionally, the rule includes conditional object and performs object, and described device also includes:
Object dispensing unit 404, for based on JSON forms, configuring the conditional object and performing object;Wherein, it is described
Conditional object includes the JSON arrays of field parameter, operation item parameter and value parameter composition, the execution object bag
Include the JSON arrays of field parameter and arranges value parameter composition.
Optionally, the rule verification and execution unit 403 include:
Rule verification subelement 4031, the rule for getting highest priority according to rule prioritization;For current
The rule of acquisition, the parameters included according to the regular conditional object, it is determined that being made up of a parameter or multiple parameters
Determinant attribute form;The input data is parsed, the corresponding determinant attribute of the determinant attribute form is extracted;If input
The corresponding value of determinant attribute of data is consistent with the determinant attribute value in the conditional object, it is determined that logical for rule verification
Cross.
Optionally, the rule verification and execution unit 403 include:
Rule performs subelement 4032, for performing the parameters that object includes according in the rule, it is determined that by one
The determinant attribute form of individual parameter or multiple parameters composition;The input data is parsed, the determinant attribute form pair is extracted
The determinant attribute answered;Determinant attribute value in the execution conditional object updates the determinant attribute of the input data
Value.
Optionally, if not including the determinant attribute in the input data, the rule verification and execution unit 403
Including:
Reflection processing subelement 4033, for parsing the form that the field parameter is object/attribute, and from described defeated
Enter and object is got in data;Using Java reflex mechanisms, the object is extracted from the input data, and utilize this pair
The Get/Set methods of elephant obtain the object's property value.
Optionally, the rule is that structure is cached in a distributed manner.
For device embodiment, because it is substantially similar to embodiment of the method, so description is fairly simple, it is related
Part illustrates referring to the part of embodiment of the method.
Each embodiment in this specification is described by the way of progressive, what each embodiment was stressed be with
Between the difference of other embodiment, each embodiment identical similar part mutually referring to.
It should be understood by those skilled in the art that, the embodiment of the embodiment of the present invention can be provided as method, device or calculate
Machine program product.Therefore, the embodiment of the present invention can using complete hardware embodiment, complete software embodiment or combine software and
The form of the embodiment of hardware aspect.Moreover, the embodiment of the present invention can use it is one or more wherein include computer can
With in the computer-usable storage medium (including but is not limited to magnetic disk storage, CD-ROM, optical memory etc.) of program code
The form of the computer program product of implementation.
The embodiment of the present invention is with reference to method according to embodiments of the present invention, terminal device (system) and computer program
The flow chart and/or block diagram of product is described.It should be understood that can be by computer program instructions implementation process figure and/or block diagram
In each flow and/or square frame and the flow in flow chart and/or block diagram and/or the combination of square frame.These can be provided
Computer program instructions are set to all-purpose computer, special-purpose computer, Embedded Processor or other programmable data processing terminals
Standby processor is to produce a machine so that held by the processor of computer or other programmable data processing terminal equipments
Capable instruction is produced for realizing in one flow of flow chart or multiple flows and/or one square frame of block diagram or multiple square frames
The device for the function of specifying.
These computer program instructions, which may be alternatively stored in, can guide computer or other programmable data processing terminal equipments
In the computer-readable memory worked in a specific way so that the instruction being stored in the computer-readable memory produces bag
The manufacture of command device is included, the command device is realized in one flow of flow chart or multiple flows and/or one side of block diagram
The function of being specified in frame or multiple square frames.
These computer program instructions can be also loaded into computer or other programmable data processing terminal equipments so that
Series of operation steps is performed on computer or other programmable terminal equipments to produce computer implemented processing, so that
The instruction performed on computer or other programmable terminal equipments is provided for realizing in one flow of flow chart or multiple flows
And/or specified in one square frame of block diagram or multiple square frames function the step of.
Although having been described for the alternative embodiment of the embodiment of the present invention, those skilled in the art once know base
This creative concept, then can make other change and modification to these embodiments.So, appended claims are intended to be construed to
Including alternative embodiment and fall into having altered and changing for range of embodiment of the invention.
Finally, in addition it is also necessary to explanation, herein, such as first and second or the like relational terms be used merely to by
One entity or operation make a distinction with another entity or operation, and not necessarily require or imply these entities or operation
Between there is any this actual relation or order.Moreover, term " comprising ", "comprising" or its any other variant meaning
Covering including for nonexcludability, so that process, method, article or terminal device including a series of key elements are not only wrapped
Those key elements, but also other key elements including being not expressly set out are included, or also include being this process, method, article
Or the intrinsic key element of terminal device.In the absence of more restrictions, by wanting that sentence "including a ..." is limited
Element, it is not excluded that also there is other identical element in the process including the key element, method, article or terminal device.
Above to the implementation method and device of a kind of regulation engine provided by the present invention, it is described in detail, herein
In apply specific case the principle and embodiment of the present invention be set forth, the explanation of above example is only intended to side
The method and its core concept of the assistant solution present invention;Simultaneously for those of ordinary skill in the art, the think of according to the present invention
Think, will change in specific embodiments and applications, in summary, this specification content should not be construed as pair
The limitation of the present invention.
Claims (12)
1. a kind of implementation method of regulation engine, it is characterised in that including:
Receive input data;
The input data is matched in the rule set of the regulation engine, wherein, the rule set includes many rules, and
The rule is the rule configured based on JSON forms;
For the rule, if the input data includes regular corresponding determinant attribute, according to the determinant attribute
Enter line discipline verification to the input data, and operation be updated to the input data according to the rule,
If not including the determinant attribute in the input data, object is extracted from the input data, is utilized
Java reflex mechanisms, get the corresponding property value of the object, and according to the object and property value to the input data
Enter line discipline verification, and operation is updated to the input data according to rule.
2. the method as described in claim 1, it is characterised in that the rule includes conditional object and performs object, the side
Method also includes:
Based on the JSON forms, configure the conditional object and perform object;Wherein, the conditional object includes field ginseng
The JSON arrays of number, operation item parameter and value a parameter composition, the execution object includes field parameter and arranges value
The JSON arrays of item parameter composition.
3. method as claimed in claim 2, it is characterised in that described to be carried out according to the determinant attribute to the input data
Rule verification includes:
The rule of highest priority is got according to rule prioritization;
For the rule currently obtained, the parameters included according to the regular conditional object, it is determined that by a parameter or
The determinant attribute form of multiple parameters composition;
The input data is parsed, the corresponding determinant attribute of the determinant attribute form is extracted;
If the corresponding value of the determinant attribute of input data is consistent with the determinant attribute value in the conditional object, it is determined that
Pass through for rule verification.
4. method as claimed in claim 2, it is characterised in that described to be updated according to the rule to the input data
Operation includes:
According to the parameters that object includes are performed in the rule, it is determined that the crucial category being made up of a parameter or multiple parameters
Personality formula;
The input data is parsed, the corresponding determinant attribute of the determinant attribute form is extracted;
Determinant attribute value in the execution conditional object updates the value of the determinant attribute of the input data.
5. method as claimed in claim 2, it is characterised in that if not including the determinant attribute in the input data,
It is described that object is extracted from the input data, the corresponding property value bag of the object is got using Java reflex mechanisms
Include:
Parse the field parameter and be the form of object/attribute, and object is got from the input data;
Using Java reflex mechanisms, the object is extracted from the input data, and utilize the Get/Set methods of the object
Obtain the object's property value.
6. the method as described in claim any one of 1-5, it is characterised in that the rule is that structure is cached in a distributed manner.
7. a kind of regulation engine realizes device, it is characterised in that including:
Input data receiving unit, for receiving input data;
Rule match unit, for the input data to be matched in the rule set of the regulation engine, wherein, the rule
Collection includes many rules, and the rule is the rule configured based on JSON forms;
Rule verification and execution unit, for for the rule, if the input data includes regular corresponding key
Attribute, then enter line discipline verification to the input data according to the determinant attribute, and according to the rule to the input number
According to operation is updated, if not including the determinant attribute in the input data, extracted from the input data
Object, using Java reflex mechanisms, gets the corresponding property value of the object, and according to the object and property value to described
Input data enters line discipline verification, and is updated operation to the input data according to rule.
8. device as claimed in claim 7, it is characterised in that the rule includes conditional object and performs object, the dress
Putting also includes:
Object dispensing unit, for based on the JSON forms, configuring the conditional object and performing object;Wherein, the bar
Part object includes the JSON arrays of field parameter, operation item parameter and value parameter composition, and the execution object includes
The JSON arrays of field parameter and arranges value parameter composition.
9. device as claimed in claim 8, it is characterised in that the rule verification and execution unit include:
Rule verification subelement, the rule for getting highest priority according to rule prioritization;For the rule currently obtained
Then, the parameters included according to the regular conditional object, it is determined that the crucial category being made up of a parameter or multiple parameters
Personality formula;The input data is parsed, the corresponding determinant attribute of the determinant attribute form is extracted;If the pass of input data
The corresponding value of key attribute is consistent with the determinant attribute value in the conditional object, it is determined that pass through for rule verification.
10. device as claimed in claim 8, it is characterised in that the rule verification and execution unit include:
Rule performs subelement, for performing the parameters that include of object according in the rule, it is determined that by a parameter or
The determinant attribute form of multiple parameters composition;The input data is parsed, the corresponding key of the determinant attribute form is extracted
Attribute;Determinant attribute value in the execution conditional object updates the value of the determinant attribute of the input data.
11. device as claimed in claim 8, it is characterised in that if not including the determinant attribute in the input data,
The rule verification and execution unit include:
Reflection processing subelement, for parsing the form that the field parameter is object/attribute, and from the input data
Get object;Using Java reflex mechanisms, the object is extracted from the input data, and utilize the Get/ of the object
Set methods obtain the object's property value.
12. the device as described in claim any one of 7-11, it is characterised in that the rule is that structure is cached in a distributed manner
's.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201710448421.4A CN107220098B (en) | 2017-06-14 | 2017-06-14 | Method and device for implementing rule engine |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201710448421.4A CN107220098B (en) | 2017-06-14 | 2017-06-14 | Method and device for implementing rule engine |
Publications (2)
Publication Number | Publication Date |
---|---|
CN107220098A true CN107220098A (en) | 2017-09-29 |
CN107220098B CN107220098B (en) | 2020-06-19 |
Family
ID=59948559
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201710448421.4A Active CN107220098B (en) | 2017-06-14 | 2017-06-14 | Method and device for implementing rule engine |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN107220098B (en) |
Cited By (9)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN107844291A (en) * | 2017-10-23 | 2018-03-27 | 丹露成都网络技术有限公司 | A kind of regular verification framework of high scalability |
CN108628947A (en) * | 2018-04-02 | 2018-10-09 | 阿里巴巴集团控股有限公司 | A kind of business rule matched processing method, device and processing equipment |
CN108920222A (en) * | 2018-07-12 | 2018-11-30 | 北京京东金融科技控股有限公司 | A kind of method and device for business processing of rule-based engine |
CN109271261A (en) * | 2018-08-29 | 2019-01-25 | 中国建设银行股份有限公司 | Method, equipment and storage medium is uniformly processed in a kind of event |
CN109344170A (en) * | 2018-09-04 | 2019-02-15 | 阿里巴巴集团控股有限公司 | Stream data processing method, system, electronic equipment and readable storage medium storing program for executing |
CN110019651A (en) * | 2019-03-01 | 2019-07-16 | 广州亚美信息科技有限公司 | A kind of streaming regulation engine and business data processing method |
CN111722863A (en) * | 2020-06-23 | 2020-09-29 | 上海冰鉴信息科技有限公司 | Method and device for updating wind control model |
CN113384899A (en) * | 2021-07-05 | 2021-09-14 | 在线途游(北京)科技有限公司 | Rule-based operation method and system |
CN113535146A (en) * | 2021-07-14 | 2021-10-22 | 浙江集享电子商务有限公司 | Rule checking method and device, electronic device and storage medium |
Citations (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
KR20150019491A (en) * | 2013-08-14 | 2015-02-25 | 광운대학교 산학협력단 | Rule engine and implementation method of web-based process complaints forecasting and countermeasures derived system using user-driven case-based reasoning engine |
CN106372778A (en) * | 2016-08-23 | 2017-02-01 | 江苏亿科达科技发展有限公司 | Vehicle scheduling system and method based on dynamic rule engine |
-
2017
- 2017-06-14 CN CN201710448421.4A patent/CN107220098B/en active Active
Patent Citations (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
KR20150019491A (en) * | 2013-08-14 | 2015-02-25 | 광운대학교 산학협력단 | Rule engine and implementation method of web-based process complaints forecasting and countermeasures derived system using user-driven case-based reasoning engine |
CN106372778A (en) * | 2016-08-23 | 2017-02-01 | 江苏亿科达科技发展有限公司 | Vehicle scheduling system and method based on dynamic rule engine |
Non-Patent Citations (2)
Title |
---|
刘超: ""中小型企业中业务规则管理系统开发与应用研究"", 《万方数据》 * |
费腾: ""银行下一代交互式系统中规则引擎平台的设计与实现"", 《中国优秀硕士学位论文全文数据库 信息科技辑》 * |
Cited By (13)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN107844291A (en) * | 2017-10-23 | 2018-03-27 | 丹露成都网络技术有限公司 | A kind of regular verification framework of high scalability |
CN108628947A (en) * | 2018-04-02 | 2018-10-09 | 阿里巴巴集团控股有限公司 | A kind of business rule matched processing method, device and processing equipment |
CN108628947B (en) * | 2018-04-02 | 2022-07-15 | 创新先进技术有限公司 | Business rule matching processing method, device and processing equipment |
CN108920222B (en) * | 2018-07-12 | 2021-12-03 | 北京京东金融科技控股有限公司 | Business processing method and device based on rule engine |
CN108920222A (en) * | 2018-07-12 | 2018-11-30 | 北京京东金融科技控股有限公司 | A kind of method and device for business processing of rule-based engine |
CN109271261A (en) * | 2018-08-29 | 2019-01-25 | 中国建设银行股份有限公司 | Method, equipment and storage medium is uniformly processed in a kind of event |
CN109271261B (en) * | 2018-08-29 | 2022-03-11 | 中国建设银行股份有限公司 | Event unified processing method, device and storage medium |
CN109344170B (en) * | 2018-09-04 | 2022-04-12 | 创新先进技术有限公司 | Stream data processing method, system, electronic device and readable storage medium |
CN109344170A (en) * | 2018-09-04 | 2019-02-15 | 阿里巴巴集团控股有限公司 | Stream data processing method, system, electronic equipment and readable storage medium storing program for executing |
CN110019651A (en) * | 2019-03-01 | 2019-07-16 | 广州亚美信息科技有限公司 | A kind of streaming regulation engine and business data processing method |
CN111722863A (en) * | 2020-06-23 | 2020-09-29 | 上海冰鉴信息科技有限公司 | Method and device for updating wind control model |
CN113384899A (en) * | 2021-07-05 | 2021-09-14 | 在线途游(北京)科技有限公司 | Rule-based operation method and system |
CN113535146A (en) * | 2021-07-14 | 2021-10-22 | 浙江集享电子商务有限公司 | Rule checking method and device, electronic device and storage medium |
Also Published As
Publication number | Publication date |
---|---|
CN107220098B (en) | 2020-06-19 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN107220098A (en) | The implementation method and device of regulation engine | |
CN109543086A (en) | A kind of network data acquisition and methods of exhibiting towards multi-data source | |
CN104881490B (en) | A kind of WEB form data access method and system | |
CN110192210A (en) | Building and processing are used for the calculating figure of dynamic, structured machine learning model | |
US20160162596A1 (en) | System and Method for Real-time Search Engine Optimization Issue Detection and Correction | |
CN107766532A (en) | A kind of front end Node.js automates positive static method | |
US20050262063A1 (en) | Method and system for website analysis | |
US20130159839A1 (en) | Semantic compression of cascading style sheets | |
CN105205080B (en) | Redundant file method for cleaning, device and system | |
US20210089426A1 (en) | Parsing hierarchical session log data for search and analytics | |
CN107506190A (en) | XML file amending method and device based on Spring frameworks | |
CN106528169A (en) | Web system development reusable method based on AnGo dynamic evolution model | |
Dayley et al. | Node. js, MongoDB and Angular Web Development: The definitive guide to using the MEAN stack to build web applications | |
CN108304483A (en) | A kind of Web page classification method, device and equipment | |
DE112019005382T5 (en) | DESIGN AND PERFORMANCE OF A CHARACTER PATTERN RECOGNITION IN A CIRCUIT AT THE DATA LEVEL | |
US20120124555A1 (en) | Optimization of Compiled Control Objects | |
CN109634569A (en) | Process implementation method, device, equipment and readable storage medium storing program for executing based on note | |
CN108365976A (en) | The optimization method and device of network service | |
JP4909882B2 (en) | Web document style changing system and method | |
Smith | Go Web Scraping Quick Start Guide: Implement the power of Go to scrape and crawl data from the web | |
CN106293862B (en) | A kind of analysis method and device of expandable mark language XML data | |
US20220318034A1 (en) | Framework for linearizing interviews while permitting user backtracking and provisionally storing answers for repopulating responses | |
CA2505370A1 (en) | Method and system for website analysis | |
US20150067473A1 (en) | Web application framework | |
US20170011016A1 (en) | Automated document generation with xqml |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |