CN105653268A - Rule engine debugging method and rule engine debugging system - Google Patents
Rule engine debugging method and rule engine debugging system Download PDFInfo
- Publication number
- CN105653268A CN105653268A CN201511000386.7A CN201511000386A CN105653268A CN 105653268 A CN105653268 A CN 105653268A CN 201511000386 A CN201511000386 A CN 201511000386A CN 105653268 A CN105653268 A CN 105653268A
- Authority
- CN
- China
- Prior art keywords
- rule
- analog
- engine
- business
- write
- 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.)
- Pending
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/35—Creation or generation of source code model driven
Landscapes
- Engineering & Computer Science (AREA)
- Software Systems (AREA)
- General Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Debugging And Monitoring (AREA)
Abstract
The invention discloses a rule engine debugging method, which comprises the following steps of compiling a simulation rule in advance according to a business rule provided by a business expert; converting the simulation rule into a rule supported by a rule engine; transferring the rule into the rule engine to be executed; and obtaining the execution result. The invention also discloses a rule engine debugging system, and provides a technology for compiling, debugging and verifying a JBoss Drools rule. Through the embodiment of the invention, technicians can conveniently perform rule compiling and debugging and can perform standardized management on codes, so that the development efficiency is improved, and the rule running correctness is also ensured.
Description
Technical field
The present invention relates to technical field of aerospace, particularly relate to a kind of rule engine adjustment method and system.
Background technology
Traditional IT technology aims to provide the ability of business processes information, along with the raising of IT application in enterprises degree, traditional IT architecture mode can not meet the demand of enterprise, the operation of enterprise produces many business rule, perform these rules by rule engine, meet the flexible commercial requirements fast of enterprise. For IT system, rule write and management becomes enterprise's issues that need special attention.
Manifestation and the ability to express of rule rely on specific rule engine system. Rule engine is developed by reasoning engine, is a kind of embedding assembly in the application, it is achieved that business decision-making separated from application code, and the semantic modules using predefine writes rule. The regular kind that different regular engines is supported is also different with mode, usually divides, it is possible to be divided into technical regulation, decision table rule, class natural language commercial affairs rule.
Technical regulation is the rule script using programming on bottom layer language, is mainly used in as decision table rule and class natural language commercial affairs rule provide data encasement and aftertreatment, is generally that the developer on backstage is used.
Decision table rule is a kind of figure instrument in form shape, and more for describing process judgement condition, each condition combines again, has the situation of multiple decision-making scheme mutually. Every provisional capital of decision table can be become a technical regulation by rule engine internal usually.
Class natural language commercial affairs rule is by mapping relation, and usability of program fragments is become natural language, and in program, variable is illustrated as input frame, is represented by the form of " if/so ". Class natural language rule can dynamic-configuration conditional content, it is believed that be more flexible than decision table, it is possible to a kind of technical regulation towards business people is out of shape.
In the dynamic packing platform of the many travelling products of civil aviaton, the regular engine selected be JBossDrools increase income rule engine, apply a large amount of technical regulations in actual use, these rules are organized with the document form of class Java language. But in the management of project procedure, technical regulation is compared with Java program and be there are some defects, can not support that enterprise-level application manages well, its defect is as follows: 1) technical regulation name space can not strictly be named according to bag name+rule name, preserves according to directories/files;2) technical regulation is write arbitrarily, can not carry out when writing compiling front grammer inspection, can only find mistake by running; 3) tradition Java development environment (such as Eclipse) does not support to be carried out by technical regulation grammer inspection and grammer is assisted, and development efficiency is low; 4) technical regulation code cannot find, by code optimization tool (such as Sonar), the code quality problem that rule is write; 5) part rule file cannot be debugged.
The technical problem to be solved in the present invention is the ripe Development System making full use of Java language, explain technology set up the definition of a set of Java-Rule specification by rule engine simulation execution, Java, performance history is directly write Java code, in test by rear, translation program is utilized to generate corresponding technical regulation.
Summary of the invention
For solving the technical problem of existing existence, the embodiment of the present invention provides a kind of rule engine adjustment method and system.
For achieving the above object, the technical scheme of the embodiment of the present invention is achieved in that
A kind of rule engine adjustment method, described method comprises:
Propose business rule according to business expert, write analog rule in advance;
Described analog rule is converted to the rule that rule engine is supported;
Rule is imported in rule engine and perform;
Obtain and perform result.
Wherein, described rule engine uses JBossDrools.
Wherein, according to business rule and prespecified code form, described business rule is converted to analog rule and runs, and in Eclipse, carry out code debugging and format specification.
Wherein, described in write analog rule use regular simulator adopt Java reflection technology, dynamically call appointment class by reflecting.
Wherein, described rule analog rule converting to rule engine and supporting, comprising: analog rule maker identifies the attribute in analog rule by Annotation, based on code conversion technology, analog rule translated into concrete rule.
A kind of rule engine debugging system, described system comprises:
Write module, for proposing business rule according to business expert, write analog rule in advance;
Conversion module, for converting the rule that rule engine is supported to by described analog rule;
Execution module, performs for the rule of described rule engine support being imported in rule engine;
Result module, for obtaining execution result.
Wherein, described rule engine uses JBossDrools.
Wherein, described in write module, comprise for writing analog rule in advance: according to business rule and prespecified code form, described business rule converted to analog rule and runs, and in Eclipse, carry out code debugging and format specification.
Wherein, described in write module, comprise for writing analog rule in advance: described in write analog rule use regular simulator adopt Java reflection technology, dynamically call appointment class by reflecting.
Wherein, described conversion module, for described analog rule converts to the rule that rule engine is supported, comprising: analog rule maker identifies the attribute in analog rule by Annotation, based on code conversion technology, analog rule translated into concrete rule.
Embodiments provide a technology write and debug and verify JBossDrools rule, pass through the embodiment of the present invention, technician can carry out rule easily and write, debugs, code is carried out standardized management, not only increase development efficiency, also assures that the exactness of rule operation.
Accompanying drawing explanation
In accompanying drawing (it is not necessarily drawn in proportion), similar Reference numeral can describe similar parts in different views.The similar reference numerals with different letter suffix can represent the different examples of similar component. Accompanying drawing generally shows each embodiment discussed herein by way of example and not limitation.
Fig. 1 is the schematic flow sheet of embodiment of the present invention rule engine adjustment method;
Fig. 2 is the process that the realizes schematic diagram of embodiment of the present invention rule engine adjustment method practical application;
Fig. 3 is the reflex mechanism schematic diagram of embodiment of the present invention Java language;
Fig. 4 is embodiment of the present invention debugging mode schematic diagram.
Embodiment
The technical problem that the embodiment of the present invention solves is to provide a kind of with the debugging of JBossDrools rule, automatically generation technique, utilizes execution, the note technology of analog rule engine, it is possible to realize the debugging to rule and dynamically generate.
As shown in Figure 1, the regular engine adjustment method of the embodiment of the present invention can comprise the steps:
Step 101: business expert proposes business rule;
Step 102: technician writes analog rule in this technology platform, debugging is specification code also;
Step 103: analog rule is converted to the rule that rule engine is supported;
Step 104: rule is imported in rule engine and perform;
Step 105: import input into, obtains and performs result.
In practical application, the embodiment of the present invention comprises design phase as shown in Figure 2 and operation phase.
Below the core content of the present invention is described in detail:
First, the embodiment of the present invention requires that rule engine uses JBossDrools, and business expert is abstract by business, convert the business of enterprise to business rule, usually provide in table form, such as have the air ticket sales promotion business in sale of ticket, as shown in table 1 below.
Sequence number | Departure place | Arrival point | Discount |
1 | Beijing | Shanghai | 5% |
2 | Shanghai | Guangzhou | 10% |
3 | Haikou | Beijing | 15% |
Table 1
After having had business rule description, technician just writes analog rule by the present invention, and debugs, and fortune, as shown in following table 2 code.
Table 2
According to the code form that business rule and the present invention require, business rule is converted to analog rule and runs, and in Eclipse, carry out code debugging and format specification.
On previous step basis, after test is correct, regular simulation code above is generated the code that can run in rule engine.
Table 3
As above in table 3 be exactly rule file, it is possible to rule engine in perform, when the data imported into are PEK-SHA time, discount is just set to 0.05.
Pass through the embodiment of the present invention, achieve the functions such as regular debugging and exactness checking, the embodiment of the present invention is applied in the dynamic packing platform of the many travelling products of civil aviaton, finally achieves target requirement, ensure that the complete use of rule engine in business system.
The core content of the embodiment of the present invention is undertaken by analog rule debugging and code format and analog rule generate these two portions of concrete rule. By the embodiment of the present invention, developer, by writing analog rule, passes through in the schemes generation rule engine of the embodiment of the present invention rule that can run, final exactness and the completeness ensureing rule again after debugging checking.
The entirety of rule simulator is defined as follows: this module has used the reflection technology of Java, dynamically calls appointment class by reflecting, and without the need to going manual appointment. Here, reflection technology mainly refers to that a kind of ability of its state own or behavior can be accessed, detect and be revised to program.Java reflex mechanism is in running status, for any one class, can both know all attributes and the method for this class; For any one object, its any one method and attribute can both be called; The function of this kind of information dynamically obtained and the dynamically method of allocating object is called the reflex mechanism of Java language, and detailed process is as shown in Figure 3.
The framework required according to the embodiment of the present invention writes rule, as shown in table 4 below.
Table 4
Wherein, partial code in the When in analog rule, it is necessary to run in extension rule engine, obtain operation result, if True, then performs the Then corresponding with this When. Then performs to be over, and goes to have, in inspection queue, the analog rule not executed or not, continuing to perform if had, if do not had, then exiting.
The idiographic flow of the embodiment of the present invention is as follows:
First, business personnel proposes business rule, as shown in table 5 below.
Sequence number | Departure place | Arrival point | Discount |
1 | Beijing | Shanghai | 5% |
2 | Shanghai | Guangzhou | 10% |
3 | Haikou | Beijing | 15% |
Table 5
2nd, technician writes analog rule, as shown in table 6 below;
Table 6
3rd, to test, debug and the form of check code and exactness, debugging mode is as shown in Figure 4.
Here, by static code checking tools such as checkstyle, check the standardization of code. By above step, ensure that the exactness of code and standardization.
The embodiment of the present invention has external API, it is provided that call to outside, as shown in table 7 below.
Table 7
4th, analog rule is generated concrete rule by analog rule maker.
Analog rule maker is concrete to be defined as follows: this function mainly identifies the attribute in analog rule by Annotation, then by code conversion technology, analog rule is translated into concrete rule.
5th, the rule of generation is imported rule engine into and is loaded, compiles and perform, as shown in table 8 below;
Table 8
Finally, by following general code, the rule that previous step generates being imported into rule engine, finally performs, acquisition returns results, and process is as shown in table 9 below.
Table 9
For the application of rule engine, the embodiment of the present invention devises a set of call flow, as shown in above-mentioned code, in response () method body, obtains return of value from rule engine.
The embodiment of the present invention additionally provides a kind of rule engine debugging system, and described system comprises:
Write module, for proposing business rule according to business expert, write analog rule in advance;
Conversion module, for converting the rule that rule engine is supported to by described analog rule;
Execution module, performs for the rule of described rule engine support being imported in rule engine;
Result module, for obtaining execution result.
Wherein, described rule engine uses JBossDrools.
Wherein, described in write module, comprise for writing analog rule in advance: according to business rule and prespecified code form, described business rule converted to analog rule and runs, and in Eclipse, carry out code debugging and format specification.
Wherein, described in write module, comprise for writing analog rule in advance: described in write analog rule use regular simulator adopt Java reflection technology, dynamically call appointment class by reflecting.
Wherein, described conversion module, for described analog rule converts to the rule that rule engine is supported, comprising: analog rule maker identifies the attribute in analog rule by Annotation, based on code conversion technology, analog rule translated into concrete rule.
The advantage of the embodiment of the present invention there is provided a technology write and debug and verify JBossDrools rule, pass through the embodiment of the present invention, technician can carry out rule easily and write, debugs, code is carried out standardized management, not only increase development efficiency, also assures that the exactness of rule operation.
Those skilled in the art are it should be appreciated that embodiments of the invention can be provided as method, system or computer program. Therefore, the present invention can adopt the form of hardware embodiment, software implementation or the embodiment in conjunction with software and hardware aspect. And, the present invention can adopt the form at one or more upper computer program implemented of computer-usable storage medium (including but not limited to multiple head unit and optical memory etc.) wherein including computer usable program code.
The present invention is that schema and/or skeleton diagram with reference to method according to embodiments of the present invention, equipment (system) and computer program describe. Should understand can by the combination of the flow process in each flow process in computer program instructions flowchart and/or skeleton diagram and/or square frame and schema and/or skeleton diagram and/or square frame. These computer program instructions can be provided to the treater of multi-purpose computer, special purpose computer, Embedded Processor or other programmable data processing device to produce a machine so that the instruction performed by the treater of computer or other programmable data processing device is produced for realizing the device of function specified in schema flow process or multiple flow process and/or skeleton diagram square frame or multiple square frame.
These computer program instructions also can be stored in and can guide in computer-readable memory that computer or other programmable data processing device work in a specific way, making the instruction that is stored in this computer-readable memory produce the manufacture comprising instruction device, this instruction device realizes the function specified in schema flow process or multiple flow process and/or skeleton diagram square frame or multiple square frame.
These computer program instructions also can be loaded in computer or other programmable data processing device, make on computer or other programmable devices, to perform a series of operation steps to produce computer implemented process, thus the instruction performed on computer or other programmable devices is provided for realizing the step of the function specified in schema flow process or multiple flow process and/or skeleton diagram square frame or multiple square frame.
The above, be only the better embodiment of the present invention, be not intended to limit protection scope of the present invention.
Claims (10)
1. a regular engine adjustment method, it is characterised in that, described method comprises:
Propose business rule according to business expert, write analog rule in advance;
Described analog rule is converted to the rule that rule engine is supported;
Rule is imported in rule engine and perform;
Obtain and perform result.
2. method according to claim 1, it is characterised in that, described rule engine uses JBossDrools.
3. method according to claim 1 and 2, it is characterised in that: according to business rule and prespecified code form, described business rule is converted to analog rule and runs, and in Eclipse, carry out code debugging and format specification.
4. method according to claim 1 and 2, it is characterised in that, described in write analog rule use regular simulator adopt Java reflection technology, dynamically call appointment class by reflecting.
5. method according to claim 1 and 2, it is characterized in that, described rule analog rule converting to rule engine and supporting, comprising: analog rule maker identifies the attribute in analog rule by Annotation, based on code conversion technology, analog rule translated into concrete rule.
6. a regular engine debugging system, it is characterised in that, described system comprises:
Write module, for proposing business rule according to business expert, write analog rule in advance;
Conversion module, for converting the rule that rule engine is supported to by described analog rule;
Execution module, performs for the rule of described rule engine support being imported in rule engine;
Result module, for obtaining execution result.
7. system according to claim 1, it is characterised in that, described rule engine uses JBossDrools.
8. system according to claim 6 or 7, it is characterized in that, described write module, comprise for writing analog rule in advance: according to business rule and prespecified code form, described business rule converts to analog rule run, and in Eclipse, carry out code debugging and format specification.
9. system according to claim 6 or 7, it is characterised in that, described in write module, comprise for writing analog rule in advance: described in write the reflection technology that the regular simulator that analog rule uses adopts Java, dynamically call appointment class by reflecting.
10. system according to claim 1 and 2, it is characterized in that, described conversion module, for described analog rule being converted to the rule that rule engine is supported, comprising: analog rule maker identifies the attribute in analog rule by Annotation, based on code conversion technology, analog rule translated into concrete rule.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201511000386.7A CN105653268A (en) | 2015-12-28 | 2015-12-28 | Rule engine debugging method and rule engine debugging system |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201511000386.7A CN105653268A (en) | 2015-12-28 | 2015-12-28 | Rule engine debugging method and rule engine debugging system |
Publications (1)
Publication Number | Publication Date |
---|---|
CN105653268A true CN105653268A (en) | 2016-06-08 |
Family
ID=56476994
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201511000386.7A Pending CN105653268A (en) | 2015-12-28 | 2015-12-28 | Rule engine debugging method and rule engine debugging system |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN105653268A (en) |
Cited By (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN106990967A (en) * | 2017-04-05 | 2017-07-28 | 百融(北京)金融信息服务股份有限公司 | The data processing method of regulation engine |
CN107315611A (en) * | 2017-06-26 | 2017-11-03 | 郑州云海信息技术有限公司 | A kind of application system regulation management method and device |
CN108509522A (en) * | 2018-03-12 | 2018-09-07 | 石家庄金域医学检验所有限公司 | The detection method and device of rule |
CN108920222A (en) * | 2018-07-12 | 2018-11-30 | 北京京东金融科技控股有限公司 | A kind of method and device for business processing of rule-based engine |
CN109710468A (en) * | 2018-08-03 | 2019-05-03 | 北京马上慧科技术有限公司 | A kind of engine simulation test macro based on blaze rule |
CN110109830A (en) * | 2019-04-23 | 2019-08-09 | 深圳行云创新科技有限公司 | A kind of management method of software debugging, device, system and storage medium |
CN112379872A (en) * | 2020-11-05 | 2021-02-19 | 上海汇付数据服务有限公司 | Rule engine system |
Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101958987A (en) * | 2009-07-14 | 2011-01-26 | 中国电信股份有限公司 | Method and system for dynamically converting telecommunications service data |
CN102360291A (en) * | 2011-10-07 | 2012-02-22 | 云南爱迪科技有限公司 | Service-oriented business rule design method based on business rule engine |
CN102768682A (en) * | 2012-06-28 | 2012-11-07 | 用友软件股份有限公司 | Business rule processing device and business rule processing method |
-
2015
- 2015-12-28 CN CN201511000386.7A patent/CN105653268A/en active Pending
Patent Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101958987A (en) * | 2009-07-14 | 2011-01-26 | 中国电信股份有限公司 | Method and system for dynamically converting telecommunications service data |
CN102360291A (en) * | 2011-10-07 | 2012-02-22 | 云南爱迪科技有限公司 | Service-oriented business rule design method based on business rule engine |
CN102768682A (en) * | 2012-06-28 | 2012-11-07 | 用友软件股份有限公司 | Business rule processing device and business rule processing method |
Non-Patent Citations (2)
Title |
---|
凌晨 等: ""java注释类型和APT"", 《计算机系统应用》 * |
李春芳 等: ""面向业务的Drools规则引擎改进"", 《计算机应用与软件》 * |
Cited By (8)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN106990967A (en) * | 2017-04-05 | 2017-07-28 | 百融(北京)金融信息服务股份有限公司 | The data processing method of regulation engine |
CN107315611A (en) * | 2017-06-26 | 2017-11-03 | 郑州云海信息技术有限公司 | A kind of application system regulation management method and device |
CN108509522A (en) * | 2018-03-12 | 2018-09-07 | 石家庄金域医学检验所有限公司 | The detection method and device of rule |
CN108920222A (en) * | 2018-07-12 | 2018-11-30 | 北京京东金融科技控股有限公司 | A kind of method and device for business processing of rule-based engine |
CN108920222B (en) * | 2018-07-12 | 2021-12-03 | 北京京东金融科技控股有限公司 | Business processing method and device based on rule engine |
CN109710468A (en) * | 2018-08-03 | 2019-05-03 | 北京马上慧科技术有限公司 | A kind of engine simulation test macro based on blaze rule |
CN110109830A (en) * | 2019-04-23 | 2019-08-09 | 深圳行云创新科技有限公司 | A kind of management method of software debugging, device, system and storage medium |
CN112379872A (en) * | 2020-11-05 | 2021-02-19 | 上海汇付数据服务有限公司 | Rule engine system |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN105653268A (en) | Rule engine debugging method and rule engine debugging system | |
CN111399853B (en) | Templated deployment method for machine learning model and custom operator | |
US9021440B1 (en) | System and method for automated test script generation | |
US9280442B1 (en) | System and method for generating coverage reports for software unit tests | |
US8707263B2 (en) | Using a DSL for calling APIS to test software | |
US20160170864A1 (en) | Integrated automated test case generation for safety-critical software | |
Hepp et al. | The platin tool kit-the T-CREST approach for compiler and WCET integration | |
CN103577168A (en) | Test case creation system and method | |
US20140143762A1 (en) | Symbolic execution of dynamic programming languages | |
US20130290075A1 (en) | Localization quality assurance of localized software | |
US9965252B2 (en) | Method and system for generating stateflow models from software requirements | |
US20160170714A1 (en) | Method and system of software specification modeling | |
CN104572463A (en) | Method and device for testing interface information | |
CN103810090B (en) | The method of nuclear plant digital code installation and debugging checking, rise version method and platform | |
Ono et al. | Using Coq in specification and program extraction of Hadoop MapReduce applications | |
CN106095501A (en) | A kind of application section arranging method and device | |
CN107506190A (en) | XML file amending method and device based on Spring frameworks | |
Bright et al. | Origins of the D programming language | |
CN110442344A (en) | Method, apparatus, system and medium for cross-platform conversion application | |
CN110069736A (en) | Page loading method and equipment | |
Seiger et al. | Test modeling for context-aware ubiquitous applications with feature petri nets | |
Muslim et al. | A modular and extensible framework for open learning analytics | |
CN103593199A (en) | Method and systems for data conversion | |
CN104615540A (en) | Code standard management system | |
CN106843822B (en) | Execution code generation method and equipment |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
C06 | Publication | ||
PB01 | Publication | ||
C10 | Entry into substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
RJ01 | Rejection of invention patent application after publication | ||
RJ01 | Rejection of invention patent application after publication |
Application publication date: 20160608 |