JP6000213B2 - Code generation system, code generation method, and code generation program - Google Patents

Code generation system, code generation method, and code generation program Download PDF

Info

Publication number
JP6000213B2
JP6000213B2 JP2013194447A JP2013194447A JP6000213B2 JP 6000213 B2 JP6000213 B2 JP 6000213B2 JP 2013194447 A JP2013194447 A JP 2013194447A JP 2013194447 A JP2013194447 A JP 2013194447A JP 6000213 B2 JP6000213 B2 JP 6000213B2
Authority
JP
Japan
Prior art keywords
rule
unit
evaluation
program code
character string
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.)
Active
Application number
JP2013194447A
Other languages
Japanese (ja)
Other versions
JP2015060445A (en
Inventor
賢一 小池
賢一 小池
弘治 宮嵜
弘治 宮嵜
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Mitsubishi Electric Corp
Mitsubishi Electric Information Systems Corp
Original Assignee
Mitsubishi Electric Corp
Mitsubishi Electric Information Systems Corp
Priority date (The priority date 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 date listed.)
Filing date
Publication date
Application filed by Mitsubishi Electric Corp, Mitsubishi Electric Information Systems Corp filed Critical Mitsubishi Electric Corp
Priority to JP2013194447A priority Critical patent/JP6000213B2/en
Publication of JP2015060445A publication Critical patent/JP2015060445A/en
Application granted granted Critical
Publication of JP6000213B2 publication Critical patent/JP6000213B2/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Landscapes

  • Stored Programmes (AREA)

Description

この発明は、論理式によりルールを記述し、記述したルールをプログラムコードに変換する技術に関する。   The present invention relates to a technique for describing a rule by a logical expression and converting the written rule into a program code.

特許文献1には、スプレッドシートにルールを記述し、記述されたルールをプログラムコードに変換することが記載されている。そして、特許文献1には、変換したプログラムコードをサーバで実行してルールを評価することが記載されている。   Patent Document 1 describes that a rule is described in a spreadsheet, and the written rule is converted into a program code. Patent Document 1 describes that a converted program code is executed by a server and a rule is evaluated.

特表2010−524134号公報Special table 2010-524134

単純にルールをプログラムコードに変換しただけでは、ルールが増えるに従い、サーバで実行されるプログラムコードが増えてしまい、ルールを評価する処理にかかる時間が増えてしまう。
この発明は、ルールが増えた場合におけるルールを評価する処理の時間を短くすることを目的とする。
If the rules are simply converted into program codes, the number of program codes executed on the server increases as the number of rules increases, and the time required for processing to evaluate the rules increases.
An object of the present invention is to shorten the processing time for evaluating rules when the number of rules increases.

この発明に係るコード生成システムは、
複数の論理式を組み合わせたルールを定義するルール定義部と、
前記ルール定義部が定義したルールをプログラムコードに変換するプログラムコード生成部と、
前記プログラムコード生成部が生成したプログラムコードを実行して、ルールを評価するルール評価部と
を備え、
前記プログラムコード生成部は、
前記ルールを構成する論理式から文字列を抽出して、抽出した文字列をキーとして、キーと前記ルールとを対応付けたルール表を生成するルール表生成部と、
前記ルールをプログラムコードに変換するルール変換部と
を有し、
前記ルール評価部は、
前記ルールに対する評価値を含む評価要求を受信する評価要求受信部と、
前記評価要求受信部によって受信された評価要求に含まれる評価値から文字列を抽出して、抽出した文字列をキーとして、前記ルール表生成部が生成したルール表を検索し、検索されたルールが変換されたプログラムコードに、前記評価要求に含まれる評価値を入力して評価する評価処理部と
を有することを特徴とする。
A code generation system according to the present invention includes:
A rule definition section for defining a rule combining a plurality of logical expressions;
A program code generation unit that converts the rule defined by the rule definition unit into a program code;
A rule evaluation unit that executes the program code generated by the program code generation unit and evaluates a rule;
The program code generator is
A rule table generating unit that extracts a character string from a logical expression constituting the rule, generates a rule table in which the extracted character string is a key, and associates the key with the rule;
A rule conversion unit that converts the rule into a program code;
The rule evaluation unit
An evaluation request receiving unit that receives an evaluation request including an evaluation value for the rule;
A character string is extracted from the evaluation value included in the evaluation request received by the evaluation request receiving unit, the rule table generated by the rule table generating unit is searched using the extracted character string as a key, and the searched rule And an evaluation processing unit that inputs and evaluates an evaluation value included in the evaluation request in the converted program code.

この発明に係るコード生成システムでは、ルールをプログラムコードに変換する時にルール表を生成しておく。そして、プログラムコードを実行してルールの評価を行うときに、評価要求に含まれる評価値に基づきルール表を引いて、実行する必要があるルールを絞り込む。そのため、ルールが増えた場合であっても実行するプログラムコードの数を抑えることができ、ルールを評価する処理の時間を短くすることができる。   In the code generation system according to the present invention, a rule table is generated when a rule is converted into a program code. Then, when executing the program code to evaluate the rules, the rule table is drawn based on the evaluation value included in the evaluation request to narrow down the rules that need to be executed. Therefore, even if the number of rules increases, the number of program codes to be executed can be suppressed, and the processing time for evaluating the rules can be shortened.

実施の形態1に係るコード生成システム10の構成図。1 is a configuration diagram of a code generation system 10 according to a first embodiment. 実施の形態1に係るルール定義部20の処理を示すフローチャート。5 is a flowchart showing processing of a rule definition unit 20 according to the first embodiment. 実施の形態1に係るプログラムコード生成部30の処理を示すフローチャート。5 is a flowchart showing processing of a program code generation unit 30 according to the first embodiment. 実施の形態1に係るルール評価部40及び評価要求入力部50の処理を示すフローチャート。5 is a flowchart showing processing of a rule evaluation unit 40 and an evaluation request input unit 50 according to the first embodiment. スプレッドシート71に記述したルールの例を示す図。The figure which shows the example of the rule described in the spreadsheet 71. FIG. 図5に示すルールに対するテスト値72の例を示す図。The figure which shows the example of the test value 72 with respect to the rule shown in FIG. ルールの記述規則の例を示す図。The figure which shows the example of the description rule of a rule. 基本ルールの入力例を示す図。The figure which shows the example of input of a basic rule. andルールの入力例を示す図。The figure which shows the example of input of an and rule. orルールの入力例を示す図。The figure which shows the example of input of an or rule. 否定ルールの入力例を示す図。The figure which shows the input example of a negative rule. 条件分岐ルールの入力例を示す図。The figure which shows the example of input of a conditional branch rule. 変換ルールの入力例を示す図。The figure which shows the example of an input of a conversion rule. 計算ルールの入力例を示す図。The figure which shows the example of input of a calculation rule. 属性情報の説明図。Explanatory drawing of attribute information. マッピング情報73の説明図。Explanatory drawing of the mapping information 73. FIG. マッピング情報73の説明図。Explanatory drawing of the mapping information 73. FIG. マッピング情報73の例を示す図。The figure which shows the example of the mapping information 73. ルールコントローラ74を生成する処理の説明図。Explanatory drawing of the process which produces | generates the rule controller 74. FIG. JVルール76を生成する処理の説明図。Explanatory drawing of the process which produces | generates the JV rule 76. FIG. 評価要求の説明図。Explanatory drawing of an evaluation request. 評価要求の例を示す図。The figure which shows the example of an evaluation request | requirement. 評価結果の説明図。Explanatory drawing of an evaluation result. 評価結果の例を示す図。The figure which shows the example of an evaluation result. キーとして利用した文字列の項目についての論理式は、プログラムコードに含めず、残りの論理式のみプログラムコードに変換する例を示す図。The figure which shows the example which does not include the logical expression about the item of the character string used as a key in a program code, and converts only the remaining logical expressions into a program code. 一部の条件を示すルールを別欄に記述するようにした例を示す図。The figure which shows the example which made the rule which shows a part of conditions describe in another column. 実施の形態1に示したルール定義部20、プログラムコード生成部30、ルール評価部40、評価要求入力部50の各装置のハードウェア構成の例を示す図。3 is a diagram illustrating an example of a hardware configuration of each device of the rule definition unit 20, the program code generation unit 30, the rule evaluation unit 40, and the evaluation request input unit 50 illustrated in the first embodiment.

実施の形態1.
図1は、実施の形態1に係るコード生成システム10の構成図である。
コード生成システム10は、ルール定義部20、プログラムコード生成部30、ルール評価部40、評価要求入力部50を備える。
ルール定義部20、プログラムコード生成部30、ルール評価部40は、それぞれ別の装置として構成されていてもよいし、1つの装置として構成されていてもよい。ルール定義部20、プログラムコード生成部30、ルール評価部40は、それぞれ別の装置として構成されていている場合には、ルール定義部20とプログラムコード生成部30とは、ネットワークにより接続されており、プログラムコード生成部30とルール評価部40とは、ネットワークにより接続されている。
また、ルール評価部40と評価要求入力部50とは、ネットワークにより接続されている。
Embodiment 1 FIG.
FIG. 1 is a configuration diagram of a code generation system 10 according to the first embodiment.
The code generation system 10 includes a rule definition unit 20, a program code generation unit 30, a rule evaluation unit 40, and an evaluation request input unit 50.
The rule definition unit 20, the program code generation unit 30, and the rule evaluation unit 40 may be configured as separate devices, or may be configured as one device. When the rule definition unit 20, the program code generation unit 30, and the rule evaluation unit 40 are configured as separate devices, the rule definition unit 20 and the program code generation unit 30 are connected by a network. The program code generation unit 30 and the rule evaluation unit 40 are connected by a network.
The rule evaluation unit 40 and the evaluation request input unit 50 are connected by a network.

ルール定義部20には表示装置61、入力装置62が接続されており、ルール定義部20はルールの管理をする業務管理者によって操作される。また、評価要求入力部50には表示装置63、入力装置64が接続されており、評価要求入力部50はルールの評価を依頼するユーザによって操作される。   A display device 61 and an input device 62 are connected to the rule definition unit 20, and the rule definition unit 20 is operated by a business administrator who manages rules. Further, a display device 63 and an input device 64 are connected to the evaluation request input unit 50, and the evaluation request input unit 50 is operated by a user who requests rule evaluation.

ルール定義部20は、ルール入力部21、構文解析部22、総合検証部23、個別検証部24、検証結果表示部25を備える。
ルール入力部21は、1つ以上のスプレッドシート71と、テスト値72と、マッピング情報73とを入力する。
The rule definition unit 20 includes a rule input unit 21, a syntax analysis unit 22, a comprehensive verification unit 23, an individual verification unit 24, and a verification result display unit 25.
The rule input unit 21 inputs one or more spreadsheets 71, a test value 72, and mapping information 73.

プログラムコード生成部30は、スプレッドシート管理部31、マッピング情報管理部32、構文解析部33、ルールコントローラ生成部34、JVルール生成部35を備える。
スプレッドシート管理部31は、ルール入力部21によって入力されたスプレッドシート71を管理する。マッピング情報管理部32は、ルール入力部21によって入力されたマッピング情報73を管理する。ルールコントローラ生成部34は、ルールコントローラ74(評価処理部)を生成する。ルールコントローラ74には、ルール表75が含まれている。JVルール生成部35は、JVルール76(Java(登録商標)ルール)を生成する。
The program code generation unit 30 includes a spreadsheet management unit 31, a mapping information management unit 32, a syntax analysis unit 33, a rule controller generation unit 34, and a JV rule generation unit 35.
The spreadsheet management unit 31 manages the spreadsheet 71 input by the rule input unit 21. The mapping information management unit 32 manages the mapping information 73 input by the rule input unit 21. The rule controller generator 34 generates a rule controller 74 (evaluation processor). The rule controller 74 includes a rule table 75. The JV rule generation unit 35 generates a JV rule 76 (Java (registered trademark) rule).

ルール評価部40は、評価要求受信部41、評価結果返信部42、JVルール管理部43、十進数演算部44を備える。
JVルール管理部43は、ルールコントローラ74とJVルール76とを管理する。
The rule evaluation unit 40 includes an evaluation request reception unit 41, an evaluation result reply unit 42, a JV rule management unit 43, and a decimal number calculation unit 44.
The JV rule management unit 43 manages the rule controller 74 and the JV rule 76.

評価要求入力部50は、評価要求送信部51、評価結果受信部52、評価結果表示部53を備える。   The evaluation request input unit 50 includes an evaluation request transmission unit 51, an evaluation result reception unit 52, and an evaluation result display unit 53.

図2から図4は、実施の形態1に係るコード生成システム10の処理を示すフローチャートである。
図2は、実施の形態1に係るルール定義部20の処理を示すフローチャートである。図3は、実施の形態1に係るプログラムコード生成部30の処理を示すフローチャートである。図4は、実施の形態1に係るルール評価部40及び評価要求入力部50の処理を示すフローチャートである。
2 to 4 are flowcharts showing processing of the code generation system 10 according to the first embodiment.
FIG. 2 is a flowchart showing processing of the rule definition unit 20 according to the first embodiment. FIG. 3 is a flowchart showing processing of the program code generation unit 30 according to the first embodiment. FIG. 4 is a flowchart showing processing of the rule evaluation unit 40 and the evaluation request input unit 50 according to the first embodiment.

まず、図2に基づき、ルール定義部20の処理について説明する。
(S11:ルール入力処理)
ルール入力部21は、入力装置62を介した業務管理者の操作に従い、スプレッドシート71にルールを入力する。ルールは、予め定められた記述規則に従い論理式によって記述される。また、ルール入力部21は、ルールとともに、ルールに付随する属性情報も入力する。
First, the processing of the rule definition unit 20 will be described with reference to FIG.
(S11: Rule input process)
The rule input unit 21 inputs rules to the spreadsheet 71 according to the operation of the business manager via the input device 62. The rule is described by a logical expression according to a predetermined description rule. The rule input unit 21 also inputs attribute information accompanying the rule together with the rule.

(S12:テスト値入力処理)
ルール入力部21は、入力装置62を介した業務管理者の操作に従い、S11で入力されたルールを簡易的にテストするためのテスト値72を入力する。
(S12: Test value input process)
The rule input unit 21 inputs a test value 72 for simply testing the rule input in S11 in accordance with the operation of the business manager via the input device 62.

(S13:構文解析処理)
構文解析部22は、S11で入力されたルールの構文を解析する。
構文を解析するとは、ルールが記述規則に従っているか、変数の型が一致しているか等、ルールが構文上正しいかを検証することである。構文解析部22の機能は、これに限るものではないが、例えば、スプレッドシートのアプリケーションソフトウェアに予め搭載されている、数式等のチェック機能により実現される。
(S13: Parsing process)
The syntax analysis unit 22 analyzes the syntax of the rule input in S11.
Analyzing the syntax means verifying whether the rule is syntactically correct, such as whether the rule conforms to the description rule or whether the variable types match. The function of the syntax analysis unit 22 is not limited to this. For example, the function of the syntax analysis unit 22 is realized by a check function for mathematical expressions or the like that is pre-installed in spreadsheet application software.

(S14:総合検証処理)
総合検証部23は、S11で入力されたルールに対して、S12で入力されたテスト値72を入力して、ルールを検証する。
(S14: Comprehensive verification process)
The comprehensive verification unit 23 inputs the test value 72 input in S12 to the rule input in S11 and verifies the rule.

(S15:個別検証処理)
個別検証部24は、S11で入力されたルールを構成する各論理式に対して、S12で入力されたテスト値72を入力して、各論理式を検証する。
(S15: Individual verification process)
The individual verification unit 24 inputs the test value 72 input in S12 to each logical expression constituting the rule input in S11, and verifies each logical expression.

(S16:検証結果表示処理)
検証結果表示部25は、S13における構文を解析した結果と、S14におけるルールを検証した結果と、S15における各論理式を検証した結果とを、ルールを入力したスプレッドシートに示して、表示装置61に表示する。
(S16: Verification result display process)
The verification result display unit 25 shows the result of analyzing the syntax in S13, the result of verifying the rule in S14, and the result of verifying each logical expression in S15 in the spreadsheet into which the rule is input, and displays the display device 61. To display.

業務管理者は、S16で表示された結果が、所望の結果となっていない場合には、処理をS11へ戻して、ルールやテスト値72等を修正して、再び検証した結果を確認する。これを繰り返すことにより、概ね想定した通りの、誤り(バグ)のないルールを作成することができる。   If the result displayed in S16 is not the desired result, the business administrator returns the process to S11, corrects the rule, the test value 72, etc., and confirms the verified result again. By repeating this, it is possible to create a rule having no error (bug) as generally assumed.

(S17:マッピング情報入力処理)
ルール入力部21は、入力装置62を介した業務管理者の操作に従い、マッピング情報73を入力する。
マッピング情報73とは、スプレッドシートで使用するルールの名称と、プログラムコードで使用するクラスや関数との対応関係を示す情報である。
(S17: Mapping information input process)
The rule input unit 21 inputs the mapping information 73 in accordance with the operation of the business manager via the input device 62.
The mapping information 73 is information indicating the correspondence between the name of the rule used in the spreadsheet and the class or function used in the program code.

図5は、スプレッドシート71に記述したルールの例を示す図である。図6は、図5に示すルールに対するテスト値72の例を示す図である。
図5では、スプレッドシートの各行に1つのルールが記述されている。各ルールは、属性情報(ここでは、ID、名称、エラーコード、ルールタイプ)とともに記述されている。
そして、スプレッドシートの各行には、その行に記述されたルールに対してテスト値72を入力して、ルールが評価された結果を示す評価結果と、その行に記述されたルールを構成する各論理式に対してテスト値72を入力して、各論理式が評価された結果を示す個別評価結果とが表示されている。
つまり、S11でルール及び属性情報の欄が入力され、S12でテスト値72が入力される。すると、S14でルールが評価された結果がS16で評価結果の欄に表示され、S15で各論理式が評価された結果がS16で個別評価結果の欄に表示される。
なお、図5では示されていないが、S13で構文に誤りがあることが確認されると、S16でルールの欄、評価結果の欄、個別評価結果の欄に、構文に誤りがあることが表示される。
FIG. 5 is a diagram illustrating an example of rules described in the spreadsheet 71. FIG. 6 is a diagram showing an example of the test value 72 for the rule shown in FIG.
In FIG. 5, one rule is described in each row of the spreadsheet. Each rule is described together with attribute information (here, ID, name, error code, rule type).
Then, in each row of the spreadsheet, a test value 72 is input to the rule described in the row, and an evaluation result indicating a result of evaluating the rule and each of the rules described in the row A test value 72 is input to the logical expression, and an individual evaluation result indicating a result of evaluating each logical expression is displayed.
That is, the rule and attribute information fields are input in S11, and the test value 72 is input in S12. Then, the result of evaluating the rule in S14 is displayed in the evaluation result column in S16, and the result of evaluating each logical expression in S15 is displayed in the individual evaluation result column in S16.
Although not shown in FIG. 5, if it is confirmed that there is an error in the syntax in S13, there may be an error in the syntax in the rule column, the evaluation result column, and the individual evaluation result column in S16. Is displayed.

図7は、ルールの記述規則の例を示す図である。
図7では、ルールの記述規則として、基本ルール、andルール、orルール、否定ルール、条件分岐ルール、変換ルール、計算ルールが規定されている。
基本ルールは、基本的な記述規則を規定したものであり、Excel(登録商標)等の一般的なスプレッドシートのアプリケーションソフトで用いられている数式の記述規則と同じである。andルールは、and条件の記述を規定したものであり、「基本ルール and 基本ルール and・・・」のように記述することが規定されている。orルールは、or条件の記述を規定したものであり、「基本ルール or 基本ルール or・・・」のように記述することが規定されている。否定ルールは、否定形の記述を規定したものであり、「NOT(基本ルール)」のように記述することが規定されている。条件分岐ルールは、条件分岐の記述を規定したものであり、「IF(条件式,値,値)」のように記述することが規定されている。変換ルールは、文字列等の変換の記述を規定したものであり、例えば、「予定日年&予定日月&予定日日」のように記述することが規定されている。計算ルールは、計算式の記述を規定したものであり、例えば「料金*(1−割引率)」のように記述することが規定されている。
FIG. 7 is a diagram illustrating an example of a rule description rule.
In FIG. 7, basic rules, and rules, or rules, negative rules, conditional branch rules, conversion rules, and calculation rules are defined as rule description rules.
The basic rule defines the basic description rule, and is the same as the description rule of the mathematical formula used in general spreadsheet application software such as Excel (registered trademark). The and rule defines the description of the and condition, and is defined to be described as “basic rule and basic rule and...”. The or rule defines the description of the or condition, and is described as “basic rule or basic rule or...”. The negative rule specifies a negative description, and it is specified to be described as “NOT (basic rule)”. The conditional branch rule defines the description of the conditional branch, and is defined as “IF (conditional expression, value, value)”. The conversion rule defines a description of conversion of a character string or the like, and is defined to be described as “scheduled date / year / scheduled date / month / scheduled date / day”, for example. The calculation rule defines the description of the calculation formula, and for example, it is defined to be described as “fee * (1-discount rate)”.

図8から図14は、基本ルール、andルール、orルール、否定ルール、条件分岐ルール、変換ルール、計算ルールそれぞれの入力例を示す図である。図8から図14では、評価結果及び個別評価結果も示している。
なお、図8(c)に示すように、入力されたルールに構文の誤りがあると、ルールの欄、評価結果の欄、個別評価結果の欄に、構文に誤りがあることが表示される。ここでは、ルールの欄に誤りがあることを示す印が表示されるとともに、評価結果の欄、個別評価結果の欄に、名称に誤りがあることを示す“#NAME?”という表示がされている。
スプレッドシートのアプリケーションソフトウェアに予め搭載されている機能によって構文解析部22の機能が実現されているため、構文に誤りがあった場合に表示される情報は、業務管理者がスプレッドシートのアプリケーションソフトを使用し慣れていれば非常に分かり易い。したがって、プログラムのコンパイラによって出力された構文の誤りに関するエラーに基づきルールを修正する場合に比べ、容易にルールの修正を行うことができる。
FIG. 8 to FIG. 14 are diagrams showing input examples of the basic rule, the and rule, the or rule, the negative rule, the conditional branch rule, the conversion rule, and the calculation rule. 8 to 14 also show evaluation results and individual evaluation results.
As shown in FIG. 8C, if there is a syntax error in the input rule, it is displayed that there is an error in the syntax in the rule column, evaluation result column, and individual evaluation result column. . Here, a mark indicating that there is an error is displayed in the rule column, and “#NAME?” Indicating that there is an error in the name is displayed in the evaluation result column and the individual evaluation result column. Yes.
Since the function of the syntax analysis unit 22 is realized by the function pre-installed in the spreadsheet application software, the information displayed when there is an error in the syntax is displayed by the business administrator using the spreadsheet application software. It is very easy to understand if you are used to it. Therefore, the rule can be easily corrected as compared with the case where the rule is corrected based on an error related to a syntax error output by the compiler of the program.

図15は、属性情報の説明図である。
図15では、属性情報として、ID、名称、エラーコード、ルールタイプが規定されている。
IDは、ルールを一意に識別するための識別子である。名称は、ルールの評価結果を他のルールから参照するときに利用されるルールの名称である。エラーコードは、ルールが成立したときに、どのルールが成立したかをアプリケーションのユーザに通知するためのコードである。ルールタイプは、どのタイミングで実行するルールかを指定する情報である。
属性情報は、業務管理者がルールを管理するために使用される。ルールタイプ等の一部の属性情報は、ルールの適用条件として使用される場合がある。
なお、属性情報は、図15に示すものに限らず、適用期間や適用職種等、ルールを適用する条件となるその他の属性等が規定されていてもよい。
FIG. 15 is an explanatory diagram of attribute information.
In FIG. 15, ID, name, error code, and rule type are defined as attribute information.
The ID is an identifier for uniquely identifying the rule. The name is the name of the rule used when referring to the evaluation result of the rule from another rule. The error code is a code for notifying the user of the application which rule is established when the rule is established. The rule type is information specifying at which timing the rule is executed.
The attribute information is used by the business administrator to manage the rules. Some attribute information such as the rule type may be used as a rule application condition.
Note that the attribute information is not limited to that shown in FIG. 15, and other attributes that are conditions for applying the rule, such as an application period and an applicable job type, may be defined.

図16、図17は、マッピング情報73の説明図であり、図18は、マッピング情報73の例を示す図である。
マッピング情報73には、スプレッドシートで使用する、日本語等で記述されたルールの名称と、プログラムコードで使用するJava(登録商標)のクラスや関数との対応関係を規定するものである。図16から図18では、マッピング情報73をXML形式で規定している。図16から図18は、マッピング情報73の定義の例を示すものであり、マッピング情報73は他の形式で規定されていてもよい。
FIGS. 16 and 17 are explanatory diagrams of the mapping information 73, and FIG. 18 is a diagram illustrating an example of the mapping information 73.
The mapping information 73 defines the correspondence between the name of the rule described in Japanese or the like used in the spreadsheet and the Java (registered trademark) class or function used in the program code. 16 to 18, the mapping information 73 is defined in the XML format. 16 to 18 show examples of the definition of the mapping information 73, and the mapping information 73 may be defined in other formats.

次に、図3に基づき、プログラムコード生成部30の処理について説明する。
(S21:スプレッドシート取得処理)
スプレッドシート管理部31は、ルール入力部21が入力したスプレッドシート71を取得して、記憶装置に記憶する。
Next, the processing of the program code generation unit 30 will be described with reference to FIG.
(S21: Spreadsheet acquisition process)
The spreadsheet management unit 31 acquires the spreadsheet 71 input by the rule input unit 21 and stores it in the storage device.

(S22:マッピング情報取得処理)
マッピング情報管理部32は、ルール入力部21が入力したマッピング情報73を取得して、記憶装置に記憶する。
(S22: Mapping information acquisition process)
The mapping information management unit 32 acquires the mapping information 73 input by the rule input unit 21 and stores it in the storage device.

(S23:ルールコントローラ生成処理)
ルールコントローラ生成部34は、S21で取得されたスプレッドシート71に基づき、ルール表75を有するルールコントローラ74を生成する。ルールコントローラ74は、ルール表75を引くことにより、実行するJVルール76を絞り込むプログラムである。
(S23: Rule controller generation process)
The rule controller generation unit 34 generates a rule controller 74 having a rule table 75 based on the spreadsheet 71 acquired in S21. The rule controller 74 is a program that narrows down the JV rules 76 to be executed by drawing the rule table 75.

(S24:JVルール生成処理)
JVルール生成部35は、S21で取得されたスプレッドシート71に記述されたルールを、S22で取得されたマッピング情報73に基づき、Java(登録商標)のプログラムコードに変換しコンパイルして、JVルール76を生成する。
(S24: JV rule generation process)
The JV rule generation unit 35 converts the rules described in the spreadsheet 71 acquired in S21 into Java (registered trademark) program code based on the mapping information 73 acquired in S22, and compiles the JV rules. 76 is generated.

S24のコンパイル時に、構文解析部33は、S21で取得されたルールの構文を解析する。
ここで実行される構文の解析は、基本的にS13で構文解析部22によって実行された構文の解析と同じである。
しかし、構文解析部22の機能が、スプレッドシートのアプリケーションソフトウェアに予め搭載されている機能によって実現されるのに対して、構文解析部33の機能は、これに限るものではないが、例えば、コンパイラの構文解析機能により実現される。そのため、S13では一部の構文上の誤りに関しては発見できない可能性があるが、S23では、S13では発見できないような構文上の誤りも発見できる。
構文に誤りがある場合には、ファイル等にエラーが出力される。エラーが出力された場合、改めてS11へ処理が戻され、ルールの修正が行われる。
At the time of compilation in S24, the syntax analysis unit 33 analyzes the syntax of the rule acquired in S21.
The syntax analysis executed here is basically the same as the syntax analysis executed by the syntax analysis unit 22 in S13.
However, while the function of the syntax analysis unit 22 is realized by a function that is preinstalled in the application software of the spreadsheet, the function of the syntax analysis unit 33 is not limited to this. This is realized by the parsing function. Therefore, although there is a possibility that some syntax errors cannot be found in S13, in S23, syntax errors that cannot be found in S13 can also be found.
If the syntax is incorrect, an error is output to the file. If an error is output, the process is returned to S11 and the rule is corrected.

なお、一般的には、S24で生成されたJVルール76に対して、JUnit等のツールを用いて単体テストが実施される。もし、単体テストで誤りが発見されれば、改めてS11へ処理が戻され、ルールの修正が行われる。   In general, a unit test is performed on the JV rule 76 generated in S24 using a tool such as JUnit. If an error is found in the unit test, the process is returned to S11 and the rule is corrected.

図19は、ルールコントローラ74を生成する処理の説明図である。
ルールコントローラ生成部34は、スプレッドシート71に記述されたルールから、and条件で結ばれた論理式において、条件として指定された文字列を抽出する。ルールコントローラ生成部34は、抽出した文字列を連結してキーとして、キーとルールとを対応付けて記憶したルール表75を生成する。なお、ルールコントローラ生成部34は、連結した文字列のハッシュ値を計算して、計算したハッシュ値をキーとしてもよい。
図19であれば、and条件で、「保険種類=“個人保険”」と、「旅行先=“アメリカ”」と、「目的=“ビジネス”」と、「保険金額>1000」との論理式が指定されている。そのため、各論理式で条件として指定された文字列である“個人保険”と“アメリカ”と“ビジネス”とが抽出される。「保険金額>1000」において条件として指定された1000に関しては、文字列ではなく数値であるため、抽出されない。抽出された“個人保険”と“アメリカ”と“ビジネス”とが連結されてキーとされ、キーとRule001とが対応付けられる。
FIG. 19 is an explanatory diagram of processing for generating the rule controller 74.
The rule controller generation unit 34 extracts a character string designated as a condition from the rules described in the spreadsheet 71 in the logical expression connected by the and condition. The rule controller generation unit 34 generates a rule table 75 in which the extracted character strings are concatenated and used as keys to store the keys and rules in association with each other. The rule controller generation unit 34 may calculate a hash value of the concatenated character string and use the calculated hash value as a key.
In the case of FIG. 19, a logical expression of “insurance type =“ personal insurance ””, “travel destination =“ USA ””, “purpose =“ business ””, and “insurance amount> 1000” under the and condition. Is specified. Therefore, “personal insurance”, “America”, and “business”, which are character strings designated as conditions in each logical expression, are extracted. 1000 specified as the condition in “insurance amount> 1000” is not a character string but a numerical value, and is not extracted. The extracted “personal insurance”, “USA”, and “business” are connected to form a key, and the key and Rule001 are associated with each other.

そして、ルールコントローラ生成部34は、生成したルール表75を引いて、該当するルールを特定するルールコントローラ74を生成する。なお、ルールコントローラ74の機能を実現するソースプログラム自体は、予め作成されており、ルールコントローラ生成部34は、予め作成されていたソースプログラムに対して、生成したルール表75を入力として指定して、通常のJava(登録商標)のコンパイラによりコンパイルすることにより、ルールコントローラ74を生成する。   Then, the rule controller generation unit 34 generates a rule controller 74 that specifies the corresponding rule by drawing the generated rule table 75. Note that the source program itself that realizes the function of the rule controller 74 is created in advance, and the rule controller generation unit 34 designates the generated rule table 75 as an input for the previously created source program. The rule controller 74 is generated by compiling with a normal Java (registered trademark) compiler.

なお、ルールとして、or条件が含まれている場合、1つのルールに対して複数のキーが生成される場合がある。
例えば、ルールが「保険種類=“個人保険”」and「旅行先=“アメリカ”」and(「目的=“ビジネス”」or「目的=“観光”」)and「保険金額>1000」となっている場合、「保険種類=“個人保険”」と、「旅行先=“アメリカ”」と、「目的=“ビジネス”」とにおける文字列“個人保険”と“アメリカ”と“ビジネス”とが抽出され、キーが生成される。また、「保険種類=“個人保険”」と、「旅行先=“アメリカ”」と、「目的=“観光”」とにおける文字列“個人保険”と“アメリカ”と“観光”とが抽出され、キーが生成される。そして、このルールは、ルール表において、生成された2つのキーの両方に対応付けられる。
Note that when an or condition is included as a rule, a plurality of keys may be generated for one rule.
For example, the rules are “insurance type =“ personal insurance ”” and “travel destination =“ USA ”” and (“purpose =“ business ”” or “purpose =“ tourism ””) and “insurance amount> 1000”. If "Insurance Type =" Individual Insurance "", "Destination =" America "" and "Purpose =" Business "", the strings "Individual Insurance", "America" and "Business" are extracted. And a key is generated. In addition, the character strings “personal insurance”, “USA” and “tourism” in “insurance type =“ personal insurance ””, “travel destination =“ USA ””, and “purpose =“ tourism ”” are extracted. A key is generated. This rule is associated with both of the two generated keys in the rule table.

図20は、JVルール76を生成する処理の説明図である。
JVルール生成部35は、スプレッドシート71に記述されたルールに含まれる各名称を、マッピング情報73に基づき、クラス名や関数名に変更する。そして、JVルール生成部35は、予め定められたロジックに従い、ルールをJava(登録商標)のプログラムコードに変換する。そして、JVルール生成部35は、変換したプログラムコードを、通常のJava(登録商標)のコンパイラによりJVルール76を生成する。
なお、プログラムコードに変換する際、JVルール生成部35は、各属性情報を、プログラムコードにコメントとして所定の形式で含めておく。これは、後にプログラムコードから、スプレッドシート71を逆生成することができるようにするためである。
FIG. 20 is an explanatory diagram of a process for generating the JV rule 76.
The JV rule generation unit 35 changes each name included in the rules described in the spreadsheet 71 to a class name or a function name based on the mapping information 73. Then, the JV rule generation unit 35 converts the rule into a Java (registered trademark) program code in accordance with a predetermined logic. Then, the JV rule generation unit 35 generates a JV rule 76 from the converted program code using a normal Java (registered trademark) compiler.
When converting into a program code, the JV rule generation unit 35 includes each attribute information as a comment in a predetermined format in the program code. This is so that the spreadsheet 71 can be reversely generated later from the program code.

次に、図4に基づき、ルール評価部40及び評価要求入力部50の処理について説明する。
(S31:コード取得処理)
JVルール管理部43は、ルールコントローラ生成部34によって生成されたルールコントローラ74と、JVルール生成部35によって生成されたJVルール76とを取得して、記憶装置に記憶する。
Next, processing of the rule evaluation unit 40 and the evaluation request input unit 50 will be described with reference to FIG.
(S31: Code acquisition process)
The JV rule management unit 43 acquires the rule controller 74 generated by the rule controller generation unit 34 and the JV rule 76 generated by the JV rule generation unit 35 and stores them in the storage device.

(S32:評価要求送信処理)
評価要求送信部51は、入力装置64を介したユーザの操作に従い、評価要求をネットワークを介してルール評価部40へ送信する。評価要求には、ルールに対する入力となる評価値が含まれている。
(S32: Evaluation request transmission process)
The evaluation request transmission unit 51 transmits an evaluation request to the rule evaluation unit 40 via the network in accordance with a user operation via the input device 64. The evaluation request includes an evaluation value that is an input to the rule.

(S33:評価要求受信処理)
評価要求受信部41は、S32で送信された評価要求を受信する。
(S33: Evaluation request reception process)
The evaluation request receiving unit 41 receives the evaluation request transmitted in S32.

(S34:ルール特定処理)
JVルール管理部43は、ルールコントローラ74を実行する。すると、ルールコントローラ74は、S33で受信された評価要求に含まれる評価値から、文字列を抽出して、抽出した文字列を連結してキーを生成する。そして、ルールコントローラ74は、生成したキーにより、ルール表75を引いて、該当するルールを特定する。
(S34: Rule specifying process)
The JV rule management unit 43 executes the rule controller 74. Then, the rule controller 74 extracts a character string from the evaluation value included in the evaluation request received in S33, and generates a key by concatenating the extracted character strings. Then, the rule controller 74 draws the rule table 75 with the generated key to identify the corresponding rule.

(S35:コード実行処理)
JVルール管理部43は、S33で受信された評価要求に含まれる評価値を入力として、S34で特定されたルールから生成されたJVルール76を実行する。
この際、JVルール管理部43は、JVルール76に数値演算が含まれる場合には、十進数演算部44により数値演算をさせる。十進数演算部44は、数値演算をCPUの浮動小数点演算の機能を利用せず、十進数により数値演算を行う。浮動小数点演算を行うと、演算に誤差が発生する場合があり、その結果、ルールでの判定が間違う恐れがある。そこで、十進数演算部44を用いて、浮動小数点演算を行うことなく、十進数により数値演算を行うことで、ルールでの判定を正しく行う。
(S35: Code execution process)
The JV rule management unit 43 receives the evaluation value included in the evaluation request received in S33, and executes the JV rule 76 generated from the rule specified in S34.
At this time, the JV rule management unit 43 causes the decimal number calculation unit 44 to perform numerical calculation when the JV rule 76 includes numerical calculation. The decimal arithmetic unit 44 performs numerical arithmetic using a decimal number without using the floating point arithmetic function of the CPU. When a floating point operation is performed, an error may occur in the operation, and as a result, there is a possibility that the determination by the rule is wrong. Therefore, by using the decimal number arithmetic unit 44 and performing the numerical operation with the decimal number without performing the floating point calculation, the determination by the rule is correctly performed.

(S36:評価結果送信処理)
評価結果返信部42は、S35でJVルール76が実行された結果をネットワークを介して評価要求入力部50へ送信する。
(S36: Evaluation result transmission process)
The evaluation result reply unit 42 transmits the result of the execution of the JV rule 76 in S35 to the evaluation request input unit 50 via the network.

(S37:評価結果受信処理)
評価結果受信部52は、S36で送信された評価結果を受信する。
(S37: Evaluation result reception process)
The evaluation result receiving unit 52 receives the evaluation result transmitted in S36.

(S38:評価結果表示処理)
評価結果表示部53は、S37で受信された評価結果を表示装置63に表示する。
(S38: Evaluation result display process)
The evaluation result display unit 53 displays the evaluation result received in S37 on the display device 63.

図21は、評価要求の説明図であり、図22は、評価要求の例を示す図である。
図21、図22では、評価要求には、評価値として、期日と、入力データ1〜nとが含まれている。入力データ1〜nについては、それぞれ何を設定する欄であるかが予め定められる。例えば、図22では、入力データ1には国、入力データ2には性別、入力データnには年齢が設定されている。
FIG. 21 is an explanatory diagram of an evaluation request, and FIG. 22 is a diagram illustrating an example of an evaluation request.
21 and 22, the evaluation request includes a due date and input data 1 to n as evaluation values. For the input data 1 to n, it is determined in advance what is the column to be set. For example, in FIG. 22, the country is set for the input data 1, the gender is set for the input data 2, and the age is set for the input data n.

S34では、ルールコントローラ74は、評価値から文字列を抽出して、抽出した文字列を連結してキーを生成するとした。ここで、入力データ1〜nのどの入力データに設定された文字列を連結してキーを生成するかが予め定められているとしてもよい。また、入力データ1〜nに含まれる文字列の全ての組合せをキーとして生成し、各キーに基づき該当するルールを特定してもよい。   In S34, the rule controller 74 extracts a character string from the evaluation value and concatenates the extracted character strings to generate a key. Here, it may be determined in advance which input data of the input data 1 to n is connected to the character string set to generate the key. Further, all combinations of character strings included in the input data 1 to n may be generated as keys, and the corresponding rule may be specified based on each key.

図23は、評価結果の説明図であり、図24は、評価結果の例を示す図である。
図23、図24では、評価結果には、出力データ1〜nが含まれている。出力データ1〜nについては、それぞれどのルールの結果を設定する欄であるかが予め定められる。例えば、図24では、出力データ1にはルール1の結果、出力データ2にはルール2の結果、出力データ3にはルール3の結果、出力データnにはルールnの結果が設定されている。
なお、評価結果には、S35でJVルール76が実行されたルールに関する結果だけが設定される。
FIG. 23 is an explanatory diagram of the evaluation result, and FIG. 24 is a diagram illustrating an example of the evaluation result.
23 and 24, the evaluation results include output data 1 to n. For the output data 1 to n, it is determined in advance which rule results are set for. For example, in FIG. 24, the result of rule 1 is set for output data 1, the result of rule 2 for output data 2, the result of rule 3 for output data 3, and the result of rule n for output data n. .
In the evaluation result, only the result regarding the rule for which the JV rule 76 is executed in S35 is set.

以上のように、実施の形態1に係るコード生成システム10では、ルールをプログラムコードに変換する時にルール表75を含むルールコントローラ74を生成しておく。そして、プログラムコードを実行してルールの評価を行うときに、評価要求に含まれる評価値に基づきルールコントローラ74がルール表75を引いて、実行する必要があるルールを絞り込む。そのため、ルールが増えた場合であっても実行するプログラムコードの数を抑えることができ、ルールを評価する処理の時間を短くすることができる。   As described above, in the code generation system 10 according to the first embodiment, the rule controller 74 including the rule table 75 is generated when a rule is converted into a program code. When executing the program code and evaluating the rules, the rule controller 74 draws the rule table 75 based on the evaluation value included in the evaluation request to narrow down the rules that need to be executed. Therefore, even if the number of rules increases, the number of program codes to be executed can be suppressed, and the processing time for evaluating the rules can be shortened.

また、実施の形態1に係るコード生成システム10では、andやor等で連結した論理式を、さらにandやor等で連結して複雑なルールをスプレッドシートに記述することもできる。また、条件分岐を含む複雑なルールをスプレッドシートに記述することもできる。そのため、非常に利便性が高い。
一方で、このように複雑なルールを記述すると、記述したルールに誤りが含まれる可能性が高くなる。しかし、実施の形態1に係るコード生成システム10では、ルールをプログラムコードに変換する前に、テスト値72を入力として、ルール全体を評価した結果や、ルールを構成する各論理式を評価した結果を簡易的に得ることができる。そのため、ルールの誤りに早期に気づくことができ、手戻りの発生を減らし効率的にルールの記述を行うことができる。
Further, in the code generation system 10 according to the first exemplary embodiment, it is possible to describe a complex rule in a spreadsheet by further connecting logical expressions connected with and or or and the like with and and or or the like. Also, complex rules including conditional branches can be described in the spreadsheet. Therefore, it is very convenient.
On the other hand, when such a complicated rule is described, there is a high possibility that the described rule includes an error. However, in the code generation system 10 according to the first exemplary embodiment, the result of evaluating the entire rule and the result of evaluating each logical expression constituting the rule with the test value 72 as an input before converting the rule into the program code Can be easily obtained. Therefore, it is possible to notice an error in a rule early, and it is possible to reduce the occurrence of rework and efficiently describe the rule.

つまり、一般的には、JVルール生成部35で生成されたJVルール76に対して、単体テストが実施され、この時点で初めてルールの誤りに気づくことになる。この場合、改めてスプレッドシートのルールを修正して、再びJVルール生成部35がJVルール76を生成して、単体テストが実施されることになる。
これに対して、実施の形態1に係るコード生成システム10では、スプレッドシートにルールを記述し、テスト値72を入力した時点で、ルールに誤りがあることに気づくことができる。そのため、手戻りの発生を減らし効率的にルールの記述を行うことができる。
もちろん、テスト値72による検証は簡易的なものであるため、単体テストが実施されれば、新たに誤りが発見される場合がある。しかし、テスト値72による検証が行われているため、単体テストで発見される誤りの数は少なくなり、手戻りの発生は少なくなる。
That is, generally, a unit test is performed on the JV rule 76 generated by the JV rule generation unit 35, and the rule error is first noticed at this point. In this case, the spreadsheet rule is corrected again, the JV rule generation unit 35 generates the JV rule 76 again, and the unit test is performed.
On the other hand, in the code generation system 10 according to the first embodiment, when a rule is described in a spreadsheet and the test value 72 is input, it can be recognized that there is an error in the rule. Therefore, it is possible to describe rules efficiently by reducing the occurrence of rework.
Of course, verification by the test value 72 is simple, and if a unit test is performed, a new error may be found. However, since the verification by the test value 72 is performed, the number of errors found in the unit test is reduced, and the occurrence of rework is reduced.

また、スプレッドシート71には、ルールを評価した結果だけでなく、各論理式を評価した結果も表示されるため、誤りのある箇所の特定が容易に行える。そのため、効率的にルールの記述を行うことができる。   Moreover, since not only the result of evaluating the rules but also the result of evaluating each logical expression is displayed on the spreadsheet 71, it is possible to easily identify an erroneous part. Therefore, rules can be described efficiently.

なお、上記説明では、S24でJVルール生成部35は、単純にルールをプログラムコードに変換していた。しかし、ルール表75を引いて該当するルールを特定した時点で、既にルール表75を引く際に使用した条件については満たしていることが確認できているとみなすことができる。そこで、JVルール生成部35は、ルールをプログラムコードに変換する際、キーとして利用した文字列についての論理式は、プログラムコードに含めず、残りの論理式のみプログラムコードに変換するとしてもよい。   In the above description, in S24, the JV rule generation unit 35 simply converts the rules into program codes. However, when the rule table 75 is drawn and the corresponding rule is specified, it can be considered that the conditions used when the rule table 75 is drawn are already satisfied. Therefore, when converting the rule into the program code, the JV rule generation unit 35 may convert only the remaining logical expression into the program code without including the logical expression for the character string used as the key.

図25は、キーとして利用した文字列の項目についての論理式は、プログラムコードに含めず、残りの論理式のみプログラムコードに変換する例を示す図である。図25では、図19に示すRule001をプログラムコードに変換する例を示している。
図19では、Rule001から、“個人保険”と“アメリカ”と“ビジネス”とが抽出され、“個人保険”と“アメリカ”と“ビジネス”とが連結されてキーとされた。そのため、図25に示すように、JVルール生成部35は、これらの文字列の抽出元の論理式である「保険種類=“個人保険”」と、「旅行先=“アメリカ”」と、「目的=“ビジネス”」とについては、プログラムコードには変換せず、残りの「保険金額>1000」のみをプログラムコードに変換する。
この場合、S34でルール表75を引いて該当するルールを特定することにより、「保険種類=“個人保険”」and「旅行先=“アメリカ”」and「目的=“ビジネス”」については、該当すると判定されたとみなされ、S35で残りの「保険金額>1000」についての判定がされる。
FIG. 25 is a diagram illustrating an example in which a logical expression for a character string item used as a key is not included in a program code, and only the remaining logical expressions are converted into a program code. FIG. 25 shows an example of converting Rule001 shown in FIG. 19 into a program code.
In FIG. 19, “Individual Insurance”, “America”, and “Business” are extracted from Rule 001, and “Individual Insurance”, “America”, and “Business” are linked to form a key. Therefore, as shown in FIG. 25, the JV rule generation unit 35 has “insurance type =“ personal insurance ””, “travel destination =“ USA ””, and “ The purpose = “business” is not converted into a program code, but only the remaining “insurance amount> 1000” is converted into a program code.
In this case, by subtracting the rule table 75 in S34 and specifying the corresponding rule, “insurance type =“ personal insurance ”” and “travel destination =“ USA ”” and “purpose =“ business ”” are applicable. Then, it is considered that the determination has been made, and the determination regarding the remaining “insurance amount> 1000” is made in S35.

また、上記説明では、図5に示すように、ルールの記述を汎用的に行えるように、スプレッドシートのルール欄に論理式で全てのルールを記述するようにした。しかし、例えば、多くのルールで利用される条件があるような場合には、その条件に関しては別途欄を設けて記述するようにしてもよい。これにより、ルールの記述が容易になり、ルールの記述に誤りが含まれる可能性が低くなる。   Further, in the above description, as shown in FIG. 5, all rules are described by logical formulas in the rule column of the spreadsheet so that the rules can be generally written. However, for example, when there are conditions used in many rules, the conditions may be provided with a separate column. This facilitates the description of the rule and reduces the possibility that the rule description contains an error.

図26は、一部の条件を示すルールを別欄に記述するようにした例を示す図である。
図26では、保険種類、旅行先、目的について別欄を設けている。保険種類、旅行先、目的については、各欄に記述された文字列であるか否かがand条件で判定される。例えば、1行目に記述されたルールは、図19に示すRule001と同様に、「保険種類=“個人保険”」and「旅行先=“アメリカ”」and「目的=“ビジネス”」and「保険金額>1000」というルールを示している。
FIG. 26 is a diagram illustrating an example in which rules indicating some conditions are described in another column.
In FIG. 26, separate fields are provided for the insurance type, travel destination, and purpose. For the insurance type, travel destination, and purpose, whether or not the character string is described in each column is determined by the and condition. For example, the rule described in the first line is “insurance type =“ individual insurance ”” and “travel destination =“ USA ”” and “purpose =“ business ”” and “insurance” as in Rule 001 shown in FIG. The rule “amount> 1000” is shown.

一部の条件を示すルールを別欄に記述する場合、別欄に記述したルールの文字列を連結してルール表75のキーとしてもよい。   When a rule indicating some conditions is described in a separate column, a rule character string described in the separate column may be concatenated as a key of the rule table 75.

また、ルールの記述としては、図7に示すルールの記述規則からも分かるように、真偽値を返すルール、文字列を返すルール、数値を返すルールを記述することができる。また、一定の値を返すルールだけでなく、条件により返す値が変わる条件分岐を含むルールを記述することができる。また、あるルールの評価結果は他のルールの入力として利用することができ、複数のルール間の関係を記述した相関ルールを記述することができる。   As can be seen from the rule description rule shown in FIG. 7, the rule description can include a rule that returns a true / false value, a rule that returns a character string, and a rule that returns a numerical value. Further, not only a rule that returns a constant value, but also a rule that includes a conditional branch that changes a value to be returned depending on a condition can be described. Moreover, the evaluation result of a certain rule can be used as an input for another rule, and an association rule describing the relationship between a plurality of rules can be described.

また、例えば、2つの日が指定された場合に、2つの日の間の日数をカウントする関数等、ルールで使用する関数が必要な場合には、その関数のプログラムコードを別途開発しておき、ルールから呼び出して利用できるようにしておいてもよい。   Also, for example, when two days are specified, if a function used in a rule is required, such as a function that counts the number of days between two days, the program code for that function must be developed separately. You may make it available by calling from the rule.

図27は、実施の形態1に示したルール定義部20、プログラムコード生成部30、ルール評価部40、評価要求入力部50の各装置のハードウェア構成の例を示す図である。
各装置はコンピュータであり、各装置の各要素をプログラムで実現することができる。
各装置のハードウェア構成としては、バスに、演算装置901、外部記憶装置902、主記憶装置903、通信装置904、入出力装置905が接続されている。
FIG. 27 is a diagram illustrating an example of a hardware configuration of each device of the rule definition unit 20, the program code generation unit 30, the rule evaluation unit 40, and the evaluation request input unit 50 illustrated in the first embodiment.
Each device is a computer, and each element of each device can be realized by a program.
As a hardware configuration of each device, an arithmetic device 901, an external storage device 902, a main storage device 903, a communication device 904, and an input / output device 905 are connected to the bus.

演算装置901は、プログラムを実行するCPU(Central Processing Unit)等である。外部記憶装置902は、例えばROM(Read Only Memory)やフラッシュメモリ、ハードディスク装置等である。主記憶装置903は、例えばRAM(Random Access Memory)等である。通信装置904は、例えば通信ボード等である。入出力装置905は、例えばマウス、キーボード、ディスプレイ装置等である。   The arithmetic device 901 is a CPU (Central Processing Unit) that executes a program. The external storage device 902 is, for example, a ROM (Read Only Memory), a flash memory, a hard disk device, or the like. The main storage device 903 is, for example, a RAM (Random Access Memory). The communication device 904 is, for example, a communication board. The input / output device 905 is, for example, a mouse, a keyboard, a display device, or the like.

プログラムは、通常は外部記憶装置902に記憶されており、主記憶装置903にロードされた状態で、順次演算装置901に読み込まれ、実行される。
プログラムは、ルール入力部21、構文解析部22、総合検証部23、個別検証部24、検証結果表示部25、スプレッドシート管理部31、マッピング情報管理部32、構文解析部33、ルールコントローラ生成部34、JVルール生成部35、評価要求受信部41、評価結果返信部42、JVルール管理部43、十進数演算部44、評価要求送信部51、評価結果受信部52、評価結果表示部53として説明している機能を実現するプログラムである。
更に、外部記憶装置902にはオペレーティングシステム(OS)も記憶されており、OSの少なくとも一部が主記憶装置903にロードされ、演算装置901はOSを実行しながら、上記プログラムを実行する。
また、実施の形態1〜5の説明において、「〜の入力」、「〜の解析」、「〜の検証」、「〜の表示」、「〜の取得」、「〜の生成」、「〜の受信」、「〜の送信」、「〜の実行」等として説明している処理の結果を示す情報やデータや信号値や変数値が主記憶装置903にファイルとして記憶されている。
The program is normally stored in the external storage device 902, and is loaded into the main storage device 903 and sequentially read into the arithmetic device 901 and executed.
The program includes a rule input unit 21, a syntax analysis unit 22, a comprehensive verification unit 23, an individual verification unit 24, a verification result display unit 25, a spreadsheet management unit 31, a mapping information management unit 32, a syntax analysis unit 33, and a rule controller generation unit. 34, JV rule generation unit 35, evaluation request reception unit 41, evaluation result reply unit 42, JV rule management unit 43, decimal number calculation unit 44, evaluation request transmission unit 51, evaluation result reception unit 52, and evaluation result display unit 53 It is a program that realizes the functions described.
Furthermore, an operating system (OS) is also stored in the external storage device 902. At least a part of the OS is loaded into the main storage device 903, and the arithmetic device 901 executes the above program while executing the OS.
In the description of the first to fifth embodiments, “to input”, “analysis of”, “verification of”, “display of”, “acquisition of”, “generation of”, “to” Information, data, signal values, and variable values indicating the results of the processing described as “reception of”, “transmission of”, “execution of”, and the like are stored in the main storage device 903 as files.

なお、図27の構成は、あくまでも各装置のハードウェア構成の一例を示すものであり、各装置のハードウェア構成は図27に記載の構成に限らず、他の構成であってもよい。   Note that the configuration in FIG. 27 is merely an example of the hardware configuration of each device, and the hardware configuration of each device is not limited to the configuration described in FIG. 27 but may be another configuration.

10 コード生成システム、20 ルール定義部、21 ルール入力部、22 構文解析部、23 総合検証部、24 個別検証部、25 検証結果表示部、30 プログラムコード生成部、31 スプレッドシート管理部、32 マッピング情報管理部、33 構文解析部、34 ルールコントローラ生成部、35 JVルール生成部、40 ルール評価部、41 評価要求受信部、42 評価結果返信部、43 JVルール管理部、44 十進数演算部、50 評価要求入力部、51 評価要求送信部、52 評価結果受信部、53 評価結果表示部、61 表示装置、62 入力装置、63 表示装置、64 入力装置、71 スプレッドシート、72 テスト値、73 マッピング情報、74 ルールコントローラ、75 ルール表、76 JVルール。   10 code generation system, 20 rule definition unit, 21 rule input unit, 22 syntax analysis unit, 23 comprehensive verification unit, 24 individual verification unit, 25 verification result display unit, 30 program code generation unit, 31 spreadsheet management unit, 32 mapping Information management unit, 33 Parsing unit, 34 Rule controller generation unit, 35 JV rule generation unit, 40 Rule evaluation unit, 41 Evaluation request reception unit, 42 Evaluation result reply unit, 43 JV rule management unit, 44 Decimal number calculation unit, 50 evaluation request input unit, 51 evaluation request transmission unit, 52 evaluation result reception unit, 53 evaluation result display unit, 61 display device, 62 input device, 63 display device, 64 input device, 71 spreadsheet, 72 test value, 73 mapping Information, 74 rule controller, 75 rule table, 76 JV rule.

Claims (7)

複数の論理式を組み合わせたルールを定義するルール定義部と、
前記ルール定義部が定義したルールをプログラムコードに変換するプログラムコード生成部と、
前記プログラムコード生成部が生成したプログラムコードを実行して、ルールを評価するルール評価部と
を備え、
前記プログラムコード生成部は、
前記ルールを構成する論理式から文字列を抽出して、抽出した文字列をキーとして、キーと前記ルールとを対応付けたルール表を生成するルール表生成部と、
前記ルールをプログラムコードに変換するルール変換部と
を有し、
前記ルール評価部は、
前記ルールに対する評価値を含む評価要求を受信する評価要求受信部と、
前記評価要求受信部によって受信された評価要求に含まれる評価値から文字列を抽出して、抽出した文字列をキーとして、前記ルール表生成部が生成したルール表を検索し、検索されたルールが変換されたプログラムコードに、前記評価要求に含まれる評価値を入力して評価する評価処理部と
を有することを特徴とするコード生成システム。
A rule definition section for defining a rule combining a plurality of logical expressions;
A program code generation unit that converts the rule defined by the rule definition unit into a program code;
A rule evaluation unit that executes the program code generated by the program code generation unit and evaluates a rule;
The program code generator is
A rule table generating unit that extracts a character string from a logical expression constituting the rule, generates a rule table in which the extracted character string is a key, and associates the key with the rule;
A rule conversion unit that converts the rule into a program code;
The rule evaluation unit
An evaluation request receiving unit that receives an evaluation request including an evaluation value for the rule;
A character string is extracted from the evaluation value included in the evaluation request received by the evaluation request receiving unit, the rule table generated by the rule table generating unit is searched using the extracted character string as a key, and the searched rule A code generation system comprising: an evaluation processing unit that inputs an evaluation value included in the evaluation request and evaluates the program code into which the program is converted.
前記ルール表生成部は、前記ルールを構成する論理式から、and条件で結ばれた論理式における文字列を抽出し、
前記評価処理部は、前記評価要求に含まれる評価値から、前記and条件で結ばれた論理式に対する評価値を抽出し、抽出した評価値をキーとして、前記ルール表生成部が生成したルール表を検索する
ことを特徴とする請求項1に記載のコード生成システム。
The rule table generation unit extracts a character string in a logical expression connected by an AND condition from a logical expression constituting the rule,
The evaluation processing unit extracts an evaluation value for the logical expression connected by the and condition from the evaluation value included in the evaluation request, and the rule table generated by the rule table generation unit using the extracted evaluation value as a key. The code generation system according to claim 1, wherein the code generation system is searched.
前記ルール変換部は、前記ルールから前記文字列を抽出した論理式を除いた残りの論理式のみをプログラムコードに変換して、前記ルールから変換したプログラムコードとすることを特徴とする請求項1又は2に記載のコード生成システム。   The rule conversion unit converts only the remaining logical expression excluding the logical expression obtained by extracting the character string from the rule into a program code, and sets the converted program code from the rule. Or the code generation system of 2. 前記ルール定義部は、
前記ルールをスプレッドシートに入力するルール入力部と、
前記ルール入力部によって入力されたルールに対するテスト値を入力するテスト値入力部と、
前記テスト値入力部によって入力されたテスト値を前記ルールに入力して検証する総合検証部と
前記テスト値を前記ルールを構成する各論理式に入力して検証する個別検証部と、
前記総合検証部及び前記個別検証部が検証した結果を前記スプレッドシートに表示する検証結果表示部と
を有することを特徴とする請求項1から3までのいずれかに記載のコード生成システム。
The rule definition unit
A rule input unit for inputting the rules into a spreadsheet;
A test value input unit for inputting a test value for the rule input by the rule input unit;
An overall verification unit that inputs and verifies the test value input by the test value input unit into the rule; and an individual verification unit that inputs and verifies the test value into each logical expression constituting the rule;
4. The code generation system according to claim 1, further comprising: a verification result display unit that displays a result verified by the comprehensive verification unit and the individual verification unit on the spreadsheet. 5.
前記ルール定義部は、前記ルールとともに、前記ルールの属性情報を定義し、
前記プログラムコード生成部は、前記ルールをプログラムコードに変換する際、前記ルールの属性情報をコメントとして前記プログラムコードに含める
ことを特徴とする請求項1から4までのいずれかに記載のコード生成システム。
The rule definition unit defines attribute information of the rule together with the rule,
5. The code generation system according to claim 1, wherein, when the rule is converted into a program code, the attribute information of the rule is included in the program code as a comment. 6. .
処理装置が、複数の論理式を組み合わせたルールを定義するルール定義工程と、
処理装置が、前記ルール定義工程で定義したルールをプログラムコードに変換するプログラムコード生成工程と、
処理装置が、前記プログラムコード生成工程で生成したプログラムコードを実行して、ルールを評価するルール評価工程と
を備え、
前記プログラムコード生成工程は、
前記ルールを構成する論理式から文字列を抽出して、抽出した文字列をキーとして、キーと前記ルールとを対応付けたルール表を生成するルール表生成工程と、
前記ルールをプログラムコードに変換するルール変換工程と
を有し、
前記ルール評価工程は、
前記ルールに対する評価値を含む評価要求を受信する評価要求受信工程と、
前記評価要求受信工程によって受信された評価要求に含まれる評価値から文字列を抽出して、抽出した文字列をキーとして、前記ルール表生成工程で生成したルール表を検索し、検索されたルールが変換されたプログラムコードに、前記評価要求に含まれる評価値を入力して評価する評価処理工程と
を有することを特徴とするコード生成方法。
A rule definition process in which the processing device defines a rule combining a plurality of logical expressions;
A processing code, a program code generation step of converting the rule defined in the rule definition step into a program code;
A processing device includes a rule evaluation step for executing a program code generated in the program code generation step and evaluating a rule,
The program code generation step includes
A rule table generation step of generating a rule table in which a character string is extracted from a logical expression constituting the rule, and the key and the rule are associated with each other using the extracted character string as a key;
A rule conversion step of converting the rule into a program code,
The rule evaluation process includes
An evaluation request receiving step of receiving an evaluation request including an evaluation value for the rule;
A character string is extracted from the evaluation value included in the evaluation request received by the evaluation request receiving step, the rule table generated in the rule table generation step is searched using the extracted character string as a key, and the searched rule A code generation method comprising: an evaluation processing step of inputting and evaluating an evaluation value included in the evaluation request to a program code converted from.
複数の論理式を組み合わせたルールを定義するルール定義処理と、
前記ルール定義処理で定義したルールをプログラムコードに変換するプログラムコード生成処理と、
前記プログラムコード生成処理で生成したプログラムコードを実行して、ルールを評価するルール評価処理と
をコンピュータに実行させ、
前記プログラムコード生成処理は、
前記ルールを構成する論理式から文字列を抽出して、抽出した文字列をキーとして、キーと前記ルールとを対応付けたルール表を生成するルール表生成処理と、
前記ルールをプログラムコードに変換するルール変換処理と
を有し、
前記ルール評価処理は、
前記ルールに対する評価値を含む評価要求を受信する評価要求受信処理と、
前記評価要求受信処理によって受信された評価要求に含まれる評価値から文字列を抽出して、抽出した文字列をキーとして、前記ルール表生成処理で生成したルール表を検索し、検索されたルールが変換されたプログラムコードに、前記評価要求に含まれる評価値を入力して評価する評価処理と
を有することを特徴とするコード生成プログラム。
Rule definition processing that defines a rule that combines multiple logical expressions,
A program code generation process for converting the rule defined in the rule definition process into a program code;
Executing the program code generated by the program code generation process, causing the computer to execute a rule evaluation process for evaluating a rule,
The program code generation process includes:
A rule table generation process for generating a rule table in which a character string is extracted from a logical expression constituting the rule, and the extracted character string is used as a key and the key and the rule are associated;
A rule conversion process for converting the rule into a program code,
The rule evaluation process is:
An evaluation request receiving process for receiving an evaluation request including an evaluation value for the rule;
A character string is extracted from the evaluation value included in the evaluation request received by the evaluation request reception process, and the rule table generated by the rule table generation process is searched using the extracted character string as a key, and the searched rule A code generation program comprising: an evaluation process in which an evaluation value included in the evaluation request is input and evaluated to the program code converted from.
JP2013194447A 2013-09-19 2013-09-19 Code generation system, code generation method, and code generation program Active JP6000213B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2013194447A JP6000213B2 (en) 2013-09-19 2013-09-19 Code generation system, code generation method, and code generation program

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2013194447A JP6000213B2 (en) 2013-09-19 2013-09-19 Code generation system, code generation method, and code generation program

Publications (2)

Publication Number Publication Date
JP2015060445A JP2015060445A (en) 2015-03-30
JP6000213B2 true JP6000213B2 (en) 2016-09-28

Family

ID=52817907

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2013194447A Active JP6000213B2 (en) 2013-09-19 2013-09-19 Code generation system, code generation method, and code generation program

Country Status (1)

Country Link
JP (1) JP6000213B2 (en)

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP3502543B2 (en) * 1998-04-23 2004-03-02 株式会社東芝 Test case generation system and test case generation method
JP2001005654A (en) * 1999-06-24 2001-01-12 Nec Corp Business rule management device
US8069129B2 (en) * 2007-04-10 2011-11-29 Ab Initio Technology Llc Editing and compiling business rules

Also Published As

Publication number Publication date
JP2015060445A (en) 2015-03-30

Similar Documents

Publication Publication Date Title
EP3631618B1 (en) Automated dependency analyzer for heterogeneously programmed data processing system
JP6165741B2 (en) System and method for generating a schema representing multiple data sources
KR102411550B1 (en) Specifying and applying logical validation rules to data
US9576037B2 (en) Self-analyzing data processing job to determine data quality issues
JP5690349B2 (en) Managing record format information
US8452754B2 (en) Static analysis framework for database applications
US20140067836A1 (en) Visualizing reporting data using system models
Müller et al. Automated analysis of conflicts in WS-agreement
US9552348B2 (en) System and method for operating a computer application with spreadsheet functionality
Nguyen et al. Cross-language program slicing for dynamic web applications
CN103577168A (en) Test case creation system and method
US8869125B2 (en) Systems and methods for demarcating information related to one or more blocks in an application
KR101770292B1 (en) Computer-executable model reverse engineering method and apparatus performing the same
US9367432B2 (en) Testing system
US20170300405A1 (en) Method, apparatus, and computer-readable medium for performing functional testing of software
US7996763B2 (en) Generating metrics on data representations
US11144430B2 (en) System and method for evaluating and facilitating customized guidelines using usability code pattern analysis
US20140359258A1 (en) Declarative Configuration Elements
JP6000213B2 (en) Code generation system, code generation method, and code generation program
Wille et al. Identifying variability in object-oriented code using model-based code mining
JP6336922B2 (en) Business impact location extraction method and business impact location extraction device based on business variations
CN112667202A (en) Software design method and device combining MDA (model-driven architecture) and BPMN (Business Process management)
Chodarev et al. Development of custom notation for XML-based language: A model-driven approach
US20220180258A1 (en) Method and system for efficiently creating and assessing work and data flows
Vaderna et al. A domain-specific language for service level agreement specification

Legal Events

Date Code Title Description
A621 Written request for application examination

Free format text: JAPANESE INTERMEDIATE CODE: A621

Effective date: 20151026

A977 Report on retrieval

Free format text: JAPANESE INTERMEDIATE CODE: A971007

Effective date: 20160720

TRDD Decision of grant or rejection written
A01 Written decision to grant a patent or to grant a registration (utility model)

Free format text: JAPANESE INTERMEDIATE CODE: A01

Effective date: 20160802

A61 First payment of annual fees (during grant procedure)

Free format text: JAPANESE INTERMEDIATE CODE: A61

Effective date: 20160830

R150 Certificate of patent or registration of utility model

Ref document number: 6000213

Country of ref document: JP

Free format text: JAPANESE INTERMEDIATE CODE: R150

R250 Receipt of annual fees

Free format text: JAPANESE INTERMEDIATE CODE: R250

R250 Receipt of annual fees

Free format text: JAPANESE INTERMEDIATE CODE: R250

R250 Receipt of annual fees

Free format text: JAPANESE INTERMEDIATE CODE: R250

R250 Receipt of annual fees

Free format text: JAPANESE INTERMEDIATE CODE: R250

R250 Receipt of annual fees

Free format text: JAPANESE INTERMEDIATE CODE: R250

S111 Request for change of ownership or part of ownership

Free format text: JAPANESE INTERMEDIATE CODE: R313117

R250 Receipt of annual fees

Free format text: JAPANESE INTERMEDIATE CODE: R250

R371 Transfer withdrawn

Free format text: JAPANESE INTERMEDIATE CODE: R371

S111 Request for change of ownership or part of ownership

Free format text: JAPANESE INTERMEDIATE CODE: R313117

S531 Written request for registration of change of domicile

Free format text: JAPANESE INTERMEDIATE CODE: R313531

R350 Written notification of registration of transfer

Free format text: JAPANESE INTERMEDIATE CODE: R350