gdlc 2.5.4.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: bf71a25860d9fb2a4fbb6467c90464b655d4e2d2
4
+ data.tar.gz: 04b244d92630df7b766f00ac32a2ce1334a51fec
5
+ SHA512:
6
+ metadata.gz: c321260a949ac14d8e22eb73e0a939c8e41ea8d663d1138f6ec8307a1cfea75ae88903fb0117c456eeca43657ea8b0d3ab74db8665f530643797994df6582bf9
7
+ data.tar.gz: d09826e9099c4f78883e40d2ce4aeda69f26321961ab674e04289e26d28f285a2f332f5b8dfd37c9cd4d1036a1c2cc86478e5594c4a89724c23e82c9e942baeb
@@ -0,0 +1,17 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --color
2
+ #--format progress
3
+ --format documentation
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in gdlc.gemspec
4
+ gemspec
@@ -0,0 +1,15 @@
1
+ Copyright (C) 2015 Jeff McAffee
2
+
3
+ This program is free software: you can redistribute it and/or modify
4
+ it under the terms of the GNU General Public License as published by
5
+ the Free Software Foundation, either version 3 of the License, or
6
+ (at your option) any later version.
7
+
8
+ This program is distributed in the hope that it will be useful,
9
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
10
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
+ GNU General Public License for more details.
12
+
13
+ You should have received a copy of the GNU General Public License
14
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
15
+
@@ -0,0 +1,149 @@
1
+ # GDLC
2
+
3
+ This gem provides a rubygem wrapper around the Java based Guideline Compiler (GDLC).
4
+
5
+ ## Installation
6
+
7
+ Add this line to your project's Gemfile:
8
+
9
+ gem 'gdlc'
10
+
11
+ And then execute:
12
+
13
+ $ bundle install
14
+
15
+ Or install it yourself as:
16
+
17
+ $ gem install gdlc
18
+
19
+ ## Usage
20
+
21
+ Here's an example rake file, stored in my project's `rakelib/` directory
22
+ so rake auto-loads it.
23
+
24
+ _compile.rake_:
25
+
26
+ ```ruby
27
+
28
+ require 'gdlc'
29
+ require 'pathname'
30
+
31
+ # Constants populated in Rakefile:
32
+ # BUILDDIR - location generated .xml files are placed
33
+ # SRCDIR - location of main .gdl guideline files
34
+ # COMDIR - location of common .gdl files
35
+ # CSVDIR - location of PowerLookup .csv files
36
+ #
37
+
38
+ # Use config dir in root of project
39
+ GFLAGS = ["--Cconfig"]
40
+
41
+ # Guideline include dirs to be searched by compiler.
42
+ GDL_INC_DIRS = [ CSVDIR,
43
+ SRCDIR,
44
+ "#{SRCDIR}/inc",
45
+ "#{COMDIR}/inc",
46
+ ]
47
+
48
+
49
+ namespace :compile do
50
+
51
+ ##
52
+ # Map a .gdl file to a .xml file in BUILDDIR
53
+ #
54
+
55
+ def target_file_from_source(srcfile)
56
+ target_file = srcfile.pathmap("%{.gdl,.xml}f")
57
+ target_dir = Pathname(BUILDDIR)
58
+ target_path = target_dir + target_file
59
+ target_path.to_s
60
+ end
61
+
62
+ ##
63
+ # Compile a guideline into XML
64
+ #
65
+
66
+ def compile_guideline gdlfile, gflags = [], incdirs = []
67
+ gdlfile += '.gdl' unless gdlfile.end_with?('.gdl')
68
+
69
+ unless File.exists? gdlfile
70
+ gdlfile = File.join(SRCDIR, gdlfile)
71
+ end
72
+
73
+ puts "Compiling: #{gdlfile}"
74
+
75
+ # Set compiler flags
76
+ gflags = Array(gflags)
77
+ gflags.each do |flag|
78
+ Gdlc::GDLC.add_flag flag
79
+ end
80
+
81
+ # Set compiler include dirs
82
+ inc_dirs = Array(inc_dirs)
83
+ if inc_dirs.empty?
84
+ puts "WARNING: No include directories have been provided."
85
+ end
86
+ Gdlc::GDLC.add_include_dirs inc_dirs
87
+
88
+ # Compile
89
+ Gdlc::GDLC.compile(gdlfile, target_file_from_source(gdlfile))
90
+ end
91
+
92
+ ##
93
+ # Create a compile task for each *.gdl file in the root SRCDIR.
94
+ #
95
+
96
+ gdl_files = Dir["#{SRCDIR}/*.gdl"]
97
+ gdl_files.each do |gdl|
98
+ #desc "compile#{File.basename(gdl,'.gdl').to_sym}"
99
+ task File.basename(gdl,'.gdl').to_sym => [BUILDDIR] do
100
+ compile_guideline gdl, GFLAGS, GDL_INC_DIRS
101
+ end
102
+ end
103
+
104
+ ##
105
+ # A task to compile all 'main' guidelines
106
+ #
107
+
108
+ desc 'Compile all guidelines'
109
+ task :all do
110
+
111
+ gdl_files = Dir["#{SRCDIR}/*.gdl"]
112
+ gdl_files.each do |gdl|
113
+ compile_guideline gdl, GFLAGS, GDL_INC_DIRS
114
+ end
115
+ end
116
+
117
+ ##
118
+ # A task to compile an individual guideline
119
+ #
120
+
121
+ desc 'Compile a GDL file'
122
+ task :file, [:gdlfile] => [BUILDDIR] do |t, args|
123
+ args.with_defaults(:gdlfile => nil)
124
+ if args[:gdlfile].nil?
125
+ puts "ERROR: Full path to file required (unless it's located within the src dir)."
126
+ puts
127
+ puts 'usage: rake compile:file[path/to/file]'
128
+ puts ' OR'
129
+ puts ' rake compile:gdlname'
130
+ puts ' where gdlname is the basename of a gdl located in the src dir.'
131
+ exit
132
+ end
133
+
134
+ if BUILDDIR.nil?
135
+ puts 'ERROR: BUILDDIR must be set.'
136
+ exit
137
+ end
138
+
139
+ compile_guideline args[:gdlfile], GFLAGS, GDL_INC_DIRS
140
+ end
141
+
142
+ end # namespace :compile
143
+ ```
144
+
145
+ ## Contributing
146
+
147
+ This gem is a subset of the GDLC project. To contribute, see the parent
148
+ project at https://github.com/jmcaffee/gdlc.
149
+
@@ -0,0 +1,2 @@
1
+ require "bundler/gem_tasks"
2
+
@@ -0,0 +1,19 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'gdlc'
4
+ res = File.expand_path('../../res/', __FILE__)
5
+
6
+ gdlc_jar = "#{res}/gdlc.jar"
7
+
8
+ #puts "res: #{res}"
9
+ #puts "gdlc_jar: #{gdlc_jar}"
10
+
11
+ args = ARGV
12
+ #puts "---ARGV---"
13
+ #args.each do |a|
14
+ # puts a
15
+ #end
16
+ #puts "---END ARGV---"
17
+ args = ARGV.join ' '
18
+
19
+ system "java -jar #{gdlc_jar} #{args}"
@@ -0,0 +1,1262 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head><title>GDLC User Manual</title></head>
4
+
5
+ <style media="screen" type="text/css">
6
+ <!--
7
+ body {
8
+ font-family: Arial, sans-serif;
9
+ }
10
+
11
+ .content {
12
+ margin: 0 auto;
13
+ min-height: 100%;
14
+ padding: 0 0 100px;
15
+ width: 980px;
16
+ border: 1px solid #ccc;
17
+ border-radius: 5px;
18
+ }
19
+
20
+ .rendered-content {
21
+ padding: 10px;
22
+ }
23
+
24
+ /* Fancy HR styles based on http://css-tricks.com/examples/hrs/ */
25
+ hr {
26
+ border: 0;
27
+ height: 1px;
28
+ background-image: -webkit-linear-gradient(left, rgba(200,200,200,1), rgba(200,200,200,0.5), rgba(200,200,200,0));
29
+ background-image: -moz-linear-gradient(left, rgba(200,200,200,1), rgba(200,200,200,0.5), rgba(200,200,200,0));
30
+ background-image: -ms-linear-gradient(left, rgba(200,200,200,1), rgba(200,200,200,0.5), rgba(200,200,200,0));
31
+ background-image: -o-linear-gradient(left, rgba(200,200,200,1), rgba(200,200,200,0.5), rgba(200,200,200,0));
32
+ }
33
+
34
+ h1 {
35
+ font-size: 24px;
36
+ font-weight: normal;
37
+ line-height: 1.25;
38
+ }
39
+
40
+ h2 {
41
+ font-size: 20px;
42
+ font-weight: normal;
43
+ line-height: 1.5;
44
+ }
45
+
46
+ h3 {
47
+ font-size: 16px;
48
+ font-weight: bold;
49
+ line-height: 1.5625;
50
+ }
51
+
52
+ h4 {
53
+ font-size: 14px;
54
+ font-weight: bold;
55
+ line-height: 1.5;
56
+ }
57
+
58
+ h5 {
59
+ font-size: 12px;
60
+ font-weight: bold;
61
+ line-height: 1.66;
62
+ text-transform: uppercase;
63
+ }
64
+
65
+ h6 {
66
+ font-size: 12px;
67
+ font-style: italic;
68
+ font-weight: bold;
69
+ line-height: 1.66;
70
+ text-transform: uppercase;
71
+ }
72
+
73
+ pre {
74
+ margin-left: 2em;
75
+ display: block;
76
+ background: #f5f5f5;
77
+ font-family: monospace;
78
+ border: 1px solid #ccc;
79
+ border-radius: 2px;
80
+ padding: 1px 3px;
81
+ }
82
+
83
+ code {
84
+ background: #f5f5f5;
85
+ font-family: monospace;
86
+ border: 1px solid #ccc;
87
+ border-radius: 2px;
88
+ padding: 1px 3px;
89
+ }
90
+
91
+ pre, code {
92
+ font-size: 12px;
93
+ line-height: 1.4;
94
+ }
95
+
96
+ pre code {
97
+ border: 0;
98
+ padding: 0;
99
+ }
100
+
101
+ ul.toc li {
102
+ list-style: none;
103
+ font-size: 14px;
104
+ }
105
+
106
+ ul.toc li span.h3toc {
107
+ margin-left: 20px;
108
+ }
109
+
110
+ ul.toc li span.h4toc {
111
+ margin-left: 40px;
112
+ }
113
+
114
+ ul.toc li span.h5toc {
115
+ margin-left: 60px;
116
+ }
117
+
118
+ ul.toc li span.h6toc {
119
+ margin-left: 80px;
120
+ }
121
+ -->
122
+ </style>
123
+
124
+
125
+ <body>
126
+ <div class="content">
127
+ <div class="rendered-content">
128
+
129
+ <a name="Guideline.Compiler.User.Manual"></a>
130
+ <h1>Guideline Compiler User Manual</h1>
131
+
132
+ <a name="Summary"></a>
133
+ <h2>Summary</h2>
134
+
135
+ <p>GDLC is a guideline compiler. It was created to allow guidelines to be written using text files and a simple language. The compiler parses and compiles the text files (called source files) into an XML version of the guideline. This XML file can be uploaded directly into the application using the normal upload procedure.</p>
136
+
137
+ <hr>
138
+
139
+ <a name="TOC"></a>
140
+ <h2>Table of Contents</h2>
141
+
142
+ <ul class="toc">
143
+ <li><span class="h2toc"><a href="#Running.GDLC.from.the.command.line">Running GDLC from the command line</a></span></li>
144
+ <li><span class="h2toc"><a href="#Compiler.Options">Compiler Options</a></span></li>
145
+ <li><span class="h3toc"><a href="#Inclusion.Paths">Inclusion Paths</a></span></li>
146
+ <li><span class="h3toc"><a href="#Configuration.Paths">Configuration Paths</a></span></li>
147
+ <li><span class="h2toc"><a href="#Documentation.Conventions">Documentation Conventions</a></span></li>
148
+ <li><span class="h2toc"><a href="#GDL.Syntax">GDL Syntax</a></span></li>
149
+ <li><span class="h3toc"><a href="#Keywords">Keywords</a></span></li>
150
+ <li><span class="h3toc"><a href="#Identifiers">Identifiers</a></span></li>
151
+ <li><span class="h3toc"><a href="#Operators">Operators</a></span></li>
152
+ <li><span class="h4toc"><a href="#Equality.Operators">Equality Operators</a></span></li>
153
+ <li><span class="h4toc"><a href="#Boolean.Operators">Boolean Operators</a></span></li>
154
+ <li><span class="h4toc"><a href="#Mathematical.Operators">Mathematical Operators</a></span></li>
155
+ <li><span class="h2toc"><a href="#Variables">Variables</a></span></li>
156
+ <li><span class="h3toc"><a href="#PPMs">PPMs</a></span></li>
157
+ <li><span class="h4toc"><a href="#Definitions">Definitions</a></span></li>
158
+ <li><span class="h5toc"><a href="#Examples">Examples</a></span></li>
159
+ <li><span class="h5toc"><a href="#Types">Types</a></span></li>
160
+ <li><span class="h5toc"><a href="#AppXML.Source">AppXML Source</a></span></li>
161
+ <li><span class="h3toc"><a href="#DPMs">DPMs</a></span></li>
162
+ <li><span class="h4toc"><a href="#Definitions.0">Definitions</a></span></li>
163
+ <li><span class="h5toc"><a href="#Examples.0">Examples</a></span></li>
164
+ <li><span class="h5toc"><a href="#Types.0">Types</a></span></li>
165
+ <li><span class="h4toc"><a href="#References">References</a></span></li>
166
+ <li><span class="h3toc"><a href="#DSMs">DSMs</a></span></li>
167
+ <li><span class="h4toc"><a href="#Definitions.1">Definitions</a></span></li>
168
+ <li><span class="h5toc"><a href="#Examples.1">Examples</a></span></li>
169
+ <li><span class="h4toc"><a href="#References.0">References</a></span></li>
170
+ <li><span class="h3toc"><a href="#LOS.Restrictions">LOS Restrictions</a></span></li>
171
+ <li><span class="h2toc"><a href="#Lookups">Lookups</a></span></li>
172
+ <li><span class="h3toc"><a href="#Definitions.2">Definitions</a></span></li>
173
+ <li><span class="h3toc"><a href="#References.1">References</a></span></li>
174
+ <li><span class="h2toc"><a href="#PowerLookups">PowerLookups</a></span></li>
175
+ <li><span class="h3toc"><a href="#Definitions.3">Definitions</a></span></li>
176
+ <li><span class="h3toc"><a href="#References.2">References</a></span></li>
177
+ <li><span class="h2toc"><a href="#Rules">Rules</a></span></li>
178
+ <li><span class="h3toc"><a href="#Definitions.4">Definitions</a></span></li>
179
+ <li><span class="h3toc"><a href="#References.3">References</a></span></li>
180
+ <li><span class="h2toc"><a href="#Rulesets">Rulesets</a></span></li>
181
+ <li><span class="h3toc"><a href="#Definitions.5">Definitions</a></span></li>
182
+ <li><span class="h3toc"><a href="#References.4">References</a></span></li>
183
+ <li><span class="h2toc"><a href="#Conditions">Conditions</a></span></li>
184
+ <li><span class="h3toc"><a href="#Definitions.6">Definitions</a></span></li>
185
+ <li><span class="h3toc"><a href="#References.5">References</a></span></li>
186
+ <li><span class="h3toc"><a href="#Defining.Categories">Defining Categories</a></span></li>
187
+ <li><span class="h3toc"><a href="#Defining.PriorTos">Defining PriorTos</a></span></li>
188
+ <li><span class="h3toc"><a href="#Telling.the.Compiler.about.your.Properties">Telling the Compiler about your Properties</a></span></li>
189
+ <li><span class="h2toc"><a href="#Messages">Messages</a></span></li>
190
+ <li><span class="h3toc"><a href="#Message.Types">Message Types</a></span></li>
191
+ <li><span class="h4toc"><a href="#DPMs.in.Messages">DPMs in Messages</a></span></li>
192
+ <li><span class="h4toc"><a href="#Exception.messages">Exception messages</a></span></li>
193
+ <li><span class="h4toc"><a href="#Findings.messages">Findings messages</a></span></li>
194
+ <li><span class="h2toc"><a href="#Aliases">Aliases</a></span></li>
195
+ <li><span class="h3toc"><a href="#Variables.0">Variables</a></span></li>
196
+ <li><span class="h3toc"><a href="#Rules.0">Rules</a></span></li>
197
+ <li><span class="h3toc"><a href="#Rulesets.0">Rulesets</a></span></li>
198
+ <li><span class="h2toc"><a href="#Guideline.Definitions">Guideline Definitions</a></span></li>
199
+ <li><span class="h2toc"><a href="#Including.Source.Files">Including Source Files</a></span></li>
200
+ <li><span class="h2toc"><a href="#Importing.Files">Importing Files</a></span></li>
201
+ <li><span class="h3toc"><a href="#Lookup.Files">Lookup Files</a></span></li>
202
+ <li><span class="h3toc"><a href="#PowerLookup.Files">PowerLookup Files</a></span></li>
203
+ <li><span class="h2toc"><a href="#XML.Functions">XML Functions</a></span></li>
204
+ <li><span class="h3toc"><a href="#Definitions.7">Definitions</a></span></li>
205
+ <li><span class="h3toc"><a href="#References.6">References</a></span></li>
206
+ <li><span class="h2toc"><a href="#Miscellaneous">Miscellaneous</a></span></li>
207
+ <li><span class="h3toc"><a href="#Inserting.a.Pricing.Guideline..special.rule.">Inserting a Pricing Guideline (special rule)</a></span></li>
208
+ </ul>
209
+
210
+
211
+ <hr>
212
+
213
+ <a name="Running.GDLC.from.the.command.line"></a>
214
+ <h2>Running GDLC from the command line</h2>
215
+
216
+ <p>Typing GDLC without any parameters (or with the -h option) will result in the following usage message:</p>
217
+
218
+ <pre><code>======================================================================
219
+ GDLC GuideLine Compiler
220
+ Usage: GDLC inFile [outFile] [-switch]* [--I]* [--C]*
221
+
222
+ [] = optional
223
+ * = 0 or more, separated by spaces
224
+
225
+ inFile name of file to compile.
226
+ outFile name of XML output file. (default is guideline name)
227
+
228
+ --switches--
229
+ -h, -help show usage instructions.
230
+ -version display the application version.
231
+
232
+ -no,-nooutput do not generate output.
233
+ -r, -raw force output of all rules/sets/lookups.
234
+ outFile is a required parameter when -raw is used.
235
+ -v, -verbose show all status messages.
236
+ -vp, show parse tree.
237
+
238
+ -validxml output valid xml.
239
+
240
+ --parameters--
241
+ --Ipath path to include dir. Default: current dir
242
+ --Cpath path to search for config files.
243
+
244
+ ======================================================================
245
+ </code></pre>
246
+
247
+ <p>The <code>-raw</code> option is not available at this time.</p>
248
+
249
+ <hr>
250
+
251
+ <a name="Compiler.Options"></a>
252
+ <h2>Compiler Options</h2>
253
+
254
+ <a name="Inclusion.Paths"></a>
255
+ <h3>Inclusion Paths</h3>
256
+
257
+ <p>Inclusion Paths are directory paths the compiler will search to find files <code>import</code>ed
258
+ or <code>include</code>d by your source files.</p>
259
+
260
+ <p>Inclusion paths are set using the <code>--I</code> command line parameter. Multiple
261
+ directories can be added to the inclusion path list with repeated use of
262
+ the <code>--I</code> flag.</p>
263
+
264
+ <p>Example:</p>
265
+
266
+ <pre><code>gdlc my_rules.gdl my_output.xml --Irelative/path/to/my/include/dir --I/another/path
267
+ </code></pre>
268
+
269
+ <a name="Configuration.Paths"></a>
270
+ <h3>Configuration Paths</h3>
271
+
272
+ <p>Configuration Paths are directory paths the compiler will search to find
273
+ configuration files.</p>
274
+
275
+ <p>Configuration paths are set using the <code>--C</code> command line parameter. Multiple
276
+ directories can be added to the configuration path list with repeated use of
277
+ the <code>--C</code> flag similar to the Inclusion Paths above.</p>
278
+
279
+ <hr>
280
+
281
+ <a name="Documentation.Conventions"></a>
282
+ <h2>Documentation Conventions</h2>
283
+
284
+ <p>Text surrounded with square brackets [] is optional.
285
+ Text formatted like <code>this</code> indicates a <em>keyword</em>.</p>
286
+
287
+ <hr>
288
+
289
+ <a name="GDL.Syntax"></a>
290
+ <h2>GDL Syntax</h2>
291
+
292
+ <p><strong>Notes:</strong></p>
293
+
294
+ <ul>
295
+ <li>GDL is CaSe sEnSitiVe.</li>
296
+ <li>
297
+ <em>Definitions</em> mean the objects are being <strong>defined</strong>
298
+ </li>
299
+ <li>
300
+ <em>References</em> mean previously defined objects are being <strong>referenced</strong>
301
+ </li>
302
+ <li>Most reference statements must be terminated with <code>;</code>
303
+ </li>
304
+ <li>
305
+ <code>rule</code>, <code>ruleset</code>, and <code>guideline</code> definition statements must be terminated with <code>end</code>.</li>
306
+ <li>Comments may be placed into the guideline source code in one of two ways:
307
+
308
+ <ul>
309
+ <li>
310
+ <em>Single line comments:</em> Any text from <code>//</code> to the end of a line is considered a comment</li>
311
+ <li>
312
+ <em>Multi line comments:</em> All text within a <code>/* ... */</code> pair is considered a comment.</li>
313
+ </ul>
314
+ </li>
315
+ </ul>
316
+
317
+
318
+ <a name="Keywords"></a>
319
+ <h3>Keywords</h3>
320
+
321
+ <pre><code>alias app boolean condition continue
322
+ crd date decision dpm dsm
323
+ else end false guideline if
324
+ import IN include InsertPricingGuideline lookup
325
+ message money numeric OUT percentage
326
+ PL powerlookup ppm prd rule
327
+ ruleset text then true xmlfunc
328
+ </code></pre>
329
+
330
+ <a name="Identifiers"></a>
331
+ <h3>Identifiers</h3>
332
+
333
+ <p>Variable, <code>rule</code>, <code>ruleset</code> and <code>condition</code> identifiers (names) are limited to the
334
+ string lengths listed below. Spaces and special characters (such as <code>&amp;, *, and @</code>)
335
+ are not allowed as part of the identifier. The <strong>only</strong> special characters that
336
+ are allowed (other than alphanumeric characters) are <code>_</code> (the underscore) and
337
+ <code>-</code> (the dash). Identifiers must start with a letter.</p>
338
+
339
+ <p>DPM/DSM variable names/aliases are limited to a maximum character length of 50.</p>
340
+
341
+ <a name="Operators"></a>
342
+ <h3>Operators</h3>
343
+
344
+ <p>These operators are available for use in the guidelines.</p>
345
+
346
+ <a name="Equality.Operators"></a>
347
+ <h4>Equality Operators</h4>
348
+
349
+ <p>Equality operators can only be used inside of <code>if</code> statements.</p>
350
+
351
+ <pre><code>&lt; &lt;= &gt;
352
+ &gt;= == !=
353
+ &lt;&gt; in ??
354
+ </code></pre>
355
+
356
+ <a name="Boolean.Operators"></a>
357
+ <h4>Boolean Operators</h4>
358
+
359
+ <p>Boolean operators can only be used inside of if statements.</p>
360
+
361
+ <pre><code>&amp;&amp; and || or ( )
362
+ </code></pre>
363
+
364
+ <a name="Mathematical.Operators"></a>
365
+ <h4>Mathematical Operators</h4>
366
+
367
+ <p>Mathematical operators can only be used on the right hand side of assignment (<code>=</code>) statements.</p>
368
+
369
+ <pre><code>+ - * / ^ ( )
370
+ </code></pre>
371
+
372
+ <hr>
373
+
374
+ <a name="Variables"></a>
375
+ <h2>Variables</h2>
376
+
377
+ <p>All variable definition statements must be terminated with a <code>;</code>.</p>
378
+
379
+ <a name="PPMs"></a>
380
+ <h3>PPMs</h3>
381
+
382
+ <p>PPM variables are primary parameter variables. They are considered <em>read only</em>
383
+ by the application. The application initializes PPM variables with values from
384
+ the engine based on their XPath definition.</p>
385
+
386
+ <a name="Definitions"></a>
387
+ <h4>Definitions</h4>
388
+
389
+ <pre><code>ppm valueType ppmType identifier ["alias"];
390
+ </code></pre>
391
+
392
+ <a name="Examples"></a>
393
+ <h5>Examples</h5>
394
+
395
+ <pre><code>ppm text prd pProgramName "Program Name";
396
+ ppm text app pUserType "User Type";
397
+ ppm money crd pMortgagePayoffs "Mortgage Payoffs";
398
+ </code></pre>
399
+
400
+ <a name="Types"></a>
401
+ <h5>Types</h5>
402
+
403
+ <p><strong>valueType:</strong></p>
404
+
405
+ <p>The type of data the PPM will return:</p>
406
+
407
+ <ul>
408
+ <li><code>boolean</code></li>
409
+ <li><code>date</code></li>
410
+ <li><code>money</code></li>
411
+ <li><code>numeric</code></li>
412
+ <li><code>percentage</code></li>
413
+ <li><code>text</code></li>
414
+ </ul>
415
+
416
+
417
+ <a name="AppXML.Source"></a>
418
+ <h5>AppXML Source</h5>
419
+
420
+ <p><strong>ppmType:</strong></p>
421
+
422
+ <p>What section of the AppXML is the PPM sourced from:</p>
423
+
424
+ <ul>
425
+ <li>
426
+ <code>app</code>: application</li>
427
+ <li>
428
+ <code>prd</code>: product</li>
429
+ <li>
430
+ <code>crd</code>: credit</li>
431
+ </ul>
432
+
433
+
434
+ <a name="DPMs"></a>
435
+ <h3>DPMs</h3>
436
+
437
+ <p>DPM variables are derived parameter variables. These variables are considered
438
+ <em>read/write</em> by the application (the value that they contain can be modified
439
+ by guideline rules).</p>
440
+
441
+ <a name="Definitions.0"></a>
442
+ <h4>Definitions</h4>
443
+
444
+ <pre><code>dpm valueType identifier ["alias"];
445
+ </code></pre>
446
+
447
+ <a name="Examples.0"></a>
448
+ <h5>Examples</h5>
449
+
450
+ <pre><code>dpm numeric creditGradeScore;
451
+ dpm text docTypeAbbrev;
452
+ dpm money loanAmount "Loan Amount";
453
+ </code></pre>
454
+
455
+ <a name="Types.0"></a>
456
+ <h5>Types</h5>
457
+
458
+ <p>The type of data the variable will contain:</p>
459
+
460
+ <ul>
461
+ <li><code>boolean</code></li>
462
+ <li><code>date</code></li>
463
+ <li><code>money</code></li>
464
+ <li><code>numeric</code></li>
465
+ <li><code>percentage</code></li>
466
+ <li><code>text</code></li>
467
+ <li><code>datetime</code></li>
468
+ </ul>
469
+
470
+
471
+ <p>TALK ABOUT NUMERIC PRECISION</p>
472
+
473
+ <a name="References"></a>
474
+ <h4>References</h4>
475
+
476
+ <a name="DSMs"></a>
477
+ <h3>DSMs</h3>
478
+
479
+ <p>DSM variables are a special subset of DPM variables. They are indicated by the
480
+ <code>decision</code> keyword that begins the variable definition. Refer to the DPM variable
481
+ description for further restrictions/applications.</p>
482
+
483
+ <a name="Definitions.1"></a>
484
+ <h4>Definitions</h4>
485
+
486
+ <pre><code>decision dpm valueType identifier ["alias"];
487
+ </code></pre>
488
+
489
+ <a name="Examples.1"></a>
490
+ <h5>Examples</h5>
491
+
492
+ <pre><code>decision dpm numeric testDsm "Test DSM Alias";
493
+ </code></pre>
494
+
495
+ <a name="References.0"></a>
496
+ <h4>References</h4>
497
+
498
+ <a name="LOS.Restrictions"></a>
499
+ <h3>LOS Restrictions</h3>
500
+
501
+ <p><strong>LOS Guideline Engine Restriction</strong></p>
502
+
503
+ <p>The guidelines must initialize a DPM/DSM variable to a value
504
+ <strong>before it is referenced in any way</strong> (other than an assignment), or an application
505
+ level error will be thrown.</p>
506
+
507
+ <p><em>This restriction does not apply to the AMS Guideline Engine.</em></p>
508
+
509
+ <hr>
510
+
511
+ <a name="Lookups"></a>
512
+ <h2>Lookups</h2>
513
+
514
+ <a name="Definitions.2"></a>
515
+ <h3>Definitions</h3>
516
+
517
+ <pre><code>lookup("Lookup Name", xParameterVariable, yParameterVariable);
518
+ </code></pre>
519
+
520
+ <a name="References.1"></a>
521
+ <h3>References</h3>
522
+
523
+ <p>This statement defines a lookup and returns the looked-up value. It can be used
524
+ on the right hand side of an assignment ( <code>=</code> ) statement.</p>
525
+
526
+ <pre><code>aValue = lookup("FHA-ClosingCostState", pSubjectPropertyState, globalParam);
527
+ </code></pre>
528
+
529
+ <p>When a lookup is defined, the compiler searches for the lookup data in memory.
530
+ An error will be thrown if the data does not exist. See the <code>import</code> statement
531
+ for how to load lookup data.</p>
532
+
533
+ <p>All lookup definition/reference statements must be terminated with a <code>;</code>.</p>
534
+
535
+ <hr>
536
+
537
+ <a name="PowerLookups"></a>
538
+ <h2>PowerLookups</h2>
539
+
540
+ <a name="Definitions.3"></a>
541
+ <h3>Definitions</h3>
542
+
543
+ <p>Need more info here.</p>
544
+
545
+ <pre><code>Example needed.
546
+ </code></pre>
547
+
548
+ <a name="References.2"></a>
549
+ <h3>References</h3>
550
+
551
+ <hr>
552
+
553
+ <a name="Rules"></a>
554
+ <h2>Rules</h2>
555
+
556
+ <a name="Definitions.4"></a>
557
+ <h3>Definitions</h3>
558
+
559
+ <p>Rule definitions consist of an if statement block surrounded with
560
+ the <code>rule</code> and <code>end</code> keywords:</p>
561
+
562
+ <pre><code>rule RuleIdentifier()
563
+
564
+ // if statement block
565
+
566
+ end
567
+ </code></pre>
568
+
569
+ <p>Note the required parenthises at the end of the rule identifier.</p>
570
+
571
+ <p>An <code>if</code> block is made up of the keywords <code>if</code>, <code>then</code>, <code>else</code> (optional)
572
+ and <code>end</code> to close it.</p>
573
+
574
+ <pre><code>rule SomeRule()
575
+
576
+ if( /* conditional statements */ )
577
+ then
578
+
579
+ // assignment statements (if conditionals equate to true)
580
+
581
+ else
582
+
583
+ // assignment statements (if conditionals equate to false)
584
+
585
+ end // end of if block
586
+
587
+ end // end of rule block
588
+ </code></pre>
589
+
590
+ <p>Conditional statements <strong>must</strong> be surrounded by parenthesis. If multiple
591
+ conditional statements are used (combined with <code>or</code>, <code>||</code>, <code>and</code>, or <code>&amp;&amp;</code>) then
592
+ each conditional statement is surrounded, as is the group.</p>
593
+
594
+ <p>Single conditional example:</p>
595
+
596
+ <pre><code>rule SingleConditionalRule()
597
+
598
+ if( a == b )
599
+ then
600
+ a = c;
601
+ end
602
+
603
+ end
604
+ </code></pre>
605
+
606
+ <p>The statement above does not contain the optional <code>else</code> statement. While
607
+ the <code>else</code> (if false) block is optional, the true block is not.</p>
608
+
609
+ <p>Also note that assignments (<code>=</code>) cannot be used in the conditional section of an
610
+ <code>if</code> statement, only the boolean operators listed elsewhere.</p>
611
+
612
+ <p>Multiple conditional example:</p>
613
+
614
+ <pre><code>rule MultipleConditionalRule()
615
+
616
+ if(
617
+ ( a == b ) &amp;&amp;
618
+ ( b == c )
619
+ )
620
+ then
621
+ a = d;
622
+ end
623
+
624
+ end
625
+ </code></pre>
626
+
627
+ <p>This rule could also be written as:</p>
628
+
629
+ <pre><code>rule MultipleConditionalRule()
630
+
631
+ if(
632
+ ( a == b ) and
633
+ ( b == c )
634
+ )
635
+ then
636
+ a = d;
637
+ end
638
+
639
+ end
640
+ </code></pre>
641
+
642
+ <p>Here's a more complicated example:</p>
643
+
644
+ <pre><code>rule ComplicatedMultipleConditionalRule()
645
+
646
+ if(
647
+ (
648
+ ( a == b ) and
649
+ ( b == c )
650
+ ) or
651
+ (
652
+ ( a != b ) and
653
+ ( b != c )
654
+ )
655
+ )
656
+ then
657
+ a = d;
658
+ end
659
+
660
+ end
661
+ </code></pre>
662
+
663
+ <p>For readability purposes, if you use <code>and</code>, and <code>or</code> in your statements,
664
+ do not combine them with <code>&amp;&amp;</code> and <code>||</code>. The compiler won't complain; it is
665
+ acceptable syntax, but can be confusing to the reader.</p>
666
+
667
+ <p>Here's that rule again using the alternative operators:</p>
668
+
669
+ <pre><code>rule ComplicatedMultipleConditionalRule()
670
+
671
+ if(
672
+ (
673
+ ( a == b ) &amp;&amp;
674
+ ( b == c )
675
+ ) ||
676
+ (
677
+ ( a != b ) &amp;&amp;
678
+ ( b != c )
679
+ )
680
+ )
681
+ then
682
+ a = d;
683
+ end
684
+
685
+ end
686
+ </code></pre>
687
+
688
+ <p>The end result is the same.</p>
689
+
690
+ <p>A more realistic example of a simple rule:</p>
691
+
692
+ <pre><code>rule SetAppraisedValue()
693
+ if(pReviewValue != 0)
694
+ then
695
+ appraisedValue = pReviewValue;
696
+ else
697
+ appraisedValue = purchasePrice;
698
+ end
699
+ end
700
+ </code></pre>
701
+
702
+ <a name="References.3"></a>
703
+ <h3>References</h3>
704
+
705
+ <p>When referencing a rule, either in a ruleset or a guideline, where the rule
706
+ has already been defined, use this syntax:</p>
707
+
708
+ <pre><code>rule SetAppraisalValue();
709
+ </code></pre>
710
+
711
+ <hr>
712
+
713
+ <a name="Rulesets"></a>
714
+ <h2>Rulesets</h2>
715
+
716
+ <a name="Definitions.5"></a>
717
+ <h3>Definitions</h3>
718
+
719
+ <p>Missing info about 'PL' modifier keyword.</p>
720
+
721
+ <pre><code>ruleset InitAppraisedValue(continue)
722
+
723
+ rule SetAppraisedValue()
724
+ if(pLoanAmount == pLoanAmount)
725
+ then
726
+ appraisedValue = pAppraisalValue;
727
+ end
728
+ end
729
+
730
+ // ------------------------
731
+
732
+ rule SetBPOValue()
733
+ if(pReviewValue != 0)
734
+ then
735
+ BPOValue = pReviewValue;
736
+ end
737
+ end
738
+
739
+ end // ruleset
740
+ </code></pre>
741
+
742
+ <p>Both rule references, and rule definitions can be used within a ruleset.</p>
743
+
744
+ <a name="References.4"></a>
745
+ <h3>References</h3>
746
+
747
+ <hr>
748
+
749
+ <a name="Conditions"></a>
750
+ <h2>Conditions</h2>
751
+
752
+ <pre><code>condition identifier("SystemName", CategoryType, PriorToType, "Image Doc Type", "Visibility", "Condition message");
753
+ </code></pre>
754
+
755
+ <p><strong>SystemName:</strong> Name of the condition when displayed in the GUI conditions interface.</p>
756
+
757
+ <p><strong>CategoryType:</strong> Category of condition. By default, the following are available:</p>
758
+
759
+ <ul>
760
+ <li>asset</li>
761
+ <li>income</li>
762
+ <li>property</li>
763
+ <li>purchase</li>
764
+ <li>title</li>
765
+ </ul>
766
+
767
+
768
+ <p><strong>PriorToType:</strong> Stage where condition should be cleared 'prior to'.
769
+ By default, the following are available:</p>
770
+
771
+ <ul>
772
+ <li>docs</li>
773
+ <li>funding</li>
774
+ <li>approval</li>
775
+ </ul>
776
+
777
+
778
+ <p><strong>Image Doc Type:</strong> Name of the 'type' of document the condition is expecting.</p>
779
+
780
+ <p><strong>Visibility:</strong> Visibility of the condition.</p>
781
+
782
+ <ul>
783
+ <li>"" <blank> = default visibility</blank>
784
+ </li>
785
+ <li>Internal = Internally visible - Not visible from the Borrower Portal</li>
786
+ <li>External = Externally visible - Can be seen in the Borrower Portal</li>
787
+ </ul>
788
+
789
+
790
+ <p><strong>Condition message:</strong> Actual text of the condition/stipulation.</p>
791
+
792
+ <p>Condition definition statements must be terminated with a <code>;</code>.</p>
793
+
794
+ <p>Condition reference statements must be terminated with <code>();</code>.</p>
795
+
796
+ <p>Condition message definitions contain a number of required parameters used by
797
+ the system to generate 'underwriter' conditions. If a condition message is
798
+ redefined only the last definition will be used (uploaded) regardless of
799
+ where the definition occurred within the guideline.</p>
800
+
801
+ <p><em>A warning message will be generated by the compiler so you know this has happened.</em></p>
802
+
803
+ <p>Condition message references can only be used within the 'if-true' or
804
+ 'if-false' sections of rule definitions.</p>
805
+
806
+ <a name="Definitions.6"></a>
807
+ <h3>Definitions</h3>
808
+
809
+ <pre><code>condition DeathCertificate("Death Certificate", Legal, Qualification, "Death Certificate", "External",
810
+ "Death Certificate");
811
+ </code></pre>
812
+
813
+ <a name="References.5"></a>
814
+ <h3>References</h3>
815
+
816
+ <pre><code>condition DeathCertificate();
817
+ </code></pre>
818
+
819
+ <a name="Defining.Categories"></a>
820
+ <h3>Defining Categories</h3>
821
+
822
+ <p>To define your own categories, create a file named <code>category.properties</code>.
823
+ Populate it with key/value pairs.</p>
824
+
825
+ <pre><code>Disability-Co:3
826
+ HardshipPackage-Co:2
827
+ Property:4
828
+ Property-Other:6
829
+ Borrower:7
830
+ Financials:8
831
+ Authorizations:9
832
+ Financials-Co:10
833
+ Retirement:11
834
+ HardshipPackage:12
835
+ Maintenance:13
836
+ Legal:14
837
+ Disability:15
838
+ Other:16
839
+ </code></pre>
840
+
841
+ <p>Each key/value pair must be separated with <code>:</code> or <code>=</code>. White space does not
842
+ matter, with the understanding that trailing white space at the end of the
843
+ line is discarded.</p>
844
+
845
+ <p>Another example (these are all valid):</p>
846
+
847
+ <pre><code>Property :4
848
+ Property-Other: 6
849
+ Borrower = 7
850
+ Financials=8
851
+ </code></pre>
852
+
853
+ <p><em>Note:</em><br>
854
+ The <code>value</code> part of the key/value pair is a DB ID. To determine which IDs to
855
+ use, the Factory Defaults document should be referenced.</p>
856
+
857
+ <a name="Defining.PriorTos"></a>
858
+ <h3>Defining PriorTos</h3>
859
+
860
+ <p>To define your own Prior To types, create a file named <code>priorto.properties</code>.
861
+ Populate it with key/value pairs.</p>
862
+
863
+ <pre><code>Processing:8
864
+ Submission:9
865
+ Qualification:10
866
+ TrialPeriod:11
867
+ LoanModification:12
868
+ </code></pre>
869
+
870
+ <p>The same requirements/restrictions from above (Categories) apply to PriorTos.</p>
871
+
872
+ <p><em>Note:</em><br>
873
+ The <code>value</code> part of the key/value pair is a DB ID. To determine which IDs to
874
+ use, the Factory Defaults document should be referenced.</p>
875
+
876
+ <a name="Telling.the.Compiler.about.your.Properties"></a>
877
+ <h3>Telling the Compiler about your Properties</h3>
878
+
879
+ <p>Use the <code>--C</code> flag to tell the compiler what directory to search for
880
+ your properties files.</p>
881
+
882
+ <pre><code>--Cpath/to/my/properties/dir
883
+ </code></pre>
884
+
885
+ <hr>
886
+
887
+ <a name="Messages"></a>
888
+ <h2>Messages</h2>
889
+
890
+ <pre><code>message (messageType, "Message text to display.");
891
+ </code></pre>
892
+
893
+ <a name="Message.Types"></a>
894
+ <h3>Message Types</h3>
895
+
896
+ <p>Exception type messages are used to indicate a failure of some
897
+ sort. Exception messages are displayed on the decision results. Message types
898
+ other than exceptions are used to convey information to the user. The following
899
+ types are available:</p>
900
+
901
+ <p><strong>messageType:</strong></p>
902
+
903
+ <ul>
904
+ <li><code>exception</code></li>
905
+ <li><code>findings</code></li>
906
+ <li><code>observation</code></li>
907
+ <li><code>credit</code></li>
908
+ </ul>
909
+
910
+
911
+ <p><strong>Message text:</strong> Actual text of the message that will be displayed.</p>
912
+
913
+ <a name="DPMs.in.Messages"></a>
914
+ <h4>DPMs in Messages</h4>
915
+
916
+ <p>DPM variable values can be incorporated into the message text by surrounding
917
+ the variable name with <code>&lt;DPM&gt; &lt;/DPM&gt;</code> tags.
918
+ When using DPM variables within messages, if the DPM/DSM has an alias
919
+ defined, the alias must be used; the engine only recognizes/knows about the
920
+ alias.</p>
921
+
922
+ <p>TODO:IS THIS STILL TRUE (ABOUT ALIASES)?</p>
923
+
924
+ <p>TODO:DISCUSS THE ABILITY TO UNDERSTAND ALIAS' WHEN PULLING FROM PLKS.</p>
925
+
926
+ <p>Message definition statements must be terminated with a <code>;</code>.</p>
927
+
928
+ <p>Message definitions can only be used within the 'if-true' or 'if-false'
929
+ sections of rule definitions.</p>
930
+
931
+ <a name="Exception.messages"></a>
932
+ <h4>Exception messages</h4>
933
+
934
+ <pre><code>message(exception, "LTV of &lt;DPM&gt;LTV&lt;/DPM&gt; is greater than 70%.");
935
+ </code></pre>
936
+
937
+ <p>Exception messages are only displayed in the application in the case of a
938
+ decline, or decision failure (<code>Decision != "Pass"</code>).</p>
939
+
940
+ <a name="Findings.messages"></a>
941
+ <h4>Findings messages</h4>
942
+
943
+ <pre><code>message(findings, "The borrower has a payoff on their credit report.");
944
+ </code></pre>
945
+
946
+ <p>Findings messages (including all non-exception messages) are only displayed
947
+ in the applicaation when there's <strong>no</strong> decision failure (<code>Decision == "Pass"</code>).</p>
948
+
949
+ <hr>
950
+
951
+ <a name="Aliases"></a>
952
+ <h2>Aliases</h2>
953
+
954
+ <p>Aliases were designed so the developer could write GDL code using valid
955
+ identifier names even though the application is expecting an identifier
956
+ that contains spaces. This is especially important for PPMs (because
957
+ they cannot be renamed in the system). Aliases are also used with DSMs
958
+ for the same reasons.</p>
959
+
960
+ <p>For example, application expects a DSM named <code>Price Adj-Total</code>. With an alias,
961
+ this is no problem. The rules can reference a <code>dpm</code> named <code>priceAdj-total</code>
962
+ (notice there are no spaces) and the uploaded XML will reference the dpm
963
+ as <code>Price Adj-Total</code>.</p>
964
+
965
+ <p>Aliases can be used with variables, rulesets and rule identifiers. Please
966
+ note that the alias itself must be in quotes in <strong>all</strong> cases, regardless of
967
+ whether or not it contains spaces.</p>
968
+
969
+ <p>All alias statements must be terminated with a <code>;</code>.</p>
970
+
971
+ <a name="Variables.0"></a>
972
+ <h3>Variables</h3>
973
+
974
+ <p>Variable aliases are created during variable definition. The alias is the part
975
+ of the definition in quotes.</p>
976
+
977
+ <pre><code>// A DPM
978
+ dpm text someHumanName "Some Human Name Alias";
979
+
980
+ // A DSM
981
+ decision dpm numeric(3) modRate "Mod Rate";
982
+
983
+ // A PPM
984
+ ppm crd pCreditScore "Credit Score";
985
+ </code></pre>
986
+
987
+ <a name="Rules.0"></a>
988
+ <h3>Rules</h3>
989
+
990
+ <pre><code>alias ( rule, Identifier, "Alias name" );
991
+ </code></pre>
992
+
993
+ <p>A rule alias statement consists of the <code>alias</code> keyword, an alias type of <code>rule</code>,
994
+ the rule identifier and the rule alias.</p>
995
+
996
+ <pre><code>alias(rule, SimpleAliasRule1, "Alias Rule 1");
997
+ </code></pre>
998
+
999
+ <a name="Rulesets.0"></a>
1000
+ <h3>Rulesets</h3>
1001
+
1002
+ <pre><code>alias ( ruleset, Identifier, "Alias name" );
1003
+ </code></pre>
1004
+
1005
+ <p>A ruleset alias statement consists of the <code>alias</code> keyword, an alias type of
1006
+ <code>ruleset</code>, the ruleset identifier and the ruleset alias. Because a
1007
+ powerlookup is just a ruleset, they can be aliased as well. <em>In fact, this
1008
+ is how they are generated when PLK .csv files are imported.</em></p>
1009
+
1010
+ <pre><code>alias(ruleset, SimpleAliasRuleset1, "Alias Ruleset 1");
1011
+ </code></pre>
1012
+
1013
+ <hr>
1014
+
1015
+ <a name="Guideline.Definitions"></a>
1016
+ <h2>Guideline Definitions</h2>
1017
+
1018
+ <pre><code>guideline("Guideline Name")
1019
+
1020
+ ...
1021
+
1022
+ end
1023
+ </code></pre>
1024
+
1025
+ <p>The guideline statement defines the rules, rulesets, powerlookups and lookups
1026
+ that are within a guideline object. The order of all contained statements
1027
+ will be preserved.</p>
1028
+
1029
+ <p>A guideline is the main vehicle for outputting XML. When the compiler is
1030
+ run in its default mode (no output file specified), the guideline name will
1031
+ be used as the filename of the output file. An extension of .XML will be added
1032
+ as a suffix.</p>
1033
+
1034
+ <p>The <code>guideline</code> statement must have a matching <code>end</code> statement to terminate
1035
+ the guideline definition.</p>
1036
+
1037
+ <hr>
1038
+
1039
+ <a name="Including.Source.Files"></a>
1040
+ <h2>Including Source Files</h2>
1041
+
1042
+ <pre><code>include("includeFileName.gdl");
1043
+ </code></pre>
1044
+
1045
+ <p>Included files are parsed and compiled at the point that they are included
1046
+ within the parent file. <em>Including</em> a file more than once will only result in
1047
+ the file being parsed one time. It will be ignored if included again.</p>
1048
+
1049
+ <p>The include statement must be terminated with a <code>;</code>.</p>
1050
+
1051
+ <p>Files to be included must reside in a directory that has been added to the
1052
+ inclusion path list. Filenames can also include a relative path from a
1053
+ directory on the inclusion path list:</p>
1054
+
1055
+ <p>Given the following directory structure:</p>
1056
+
1057
+ <pre><code>/proj
1058
+ |-my_rules.gdl
1059
+ |
1060
+ |-src
1061
+ | |-inc
1062
+ | | |-includeFileName
1063
+ </code></pre>
1064
+
1065
+ <p>and the following compiler command line is run from <code>/proj</code>:</p>
1066
+
1067
+ <pre><code>gdlc my_rules.gdl my_output.xml --Isrc
1068
+ </code></pre>
1069
+
1070
+ <p>then the following statements would work:</p>
1071
+
1072
+ <pre><code>include("inc/includeFileName.gdl");
1073
+
1074
+ include("src/inc/includeFileName.gdl");
1075
+ </code></pre>
1076
+
1077
+ <p>but this would not:</p>
1078
+
1079
+ <pre><code>include("includeFileName.gdl");
1080
+ </code></pre>
1081
+
1082
+ <p>To make this statement work, you could add its directory to the inclusion
1083
+ path list like so:</p>
1084
+
1085
+ <pre><code>gdlc my_rules.gdl my_output.xml --Isrc --Isrc/inc
1086
+ </code></pre>
1087
+
1088
+ <p>Note that the current directory is added to the inclusion list by default so
1089
+ the following would also work:</p>
1090
+
1091
+ <pre><code>gdlc my_rules.gdl my_output.xml
1092
+ </code></pre>
1093
+
1094
+ <p>with</p>
1095
+
1096
+ <pre><code>include("src/inc/includeFileName.gdl");
1097
+ </code></pre>
1098
+
1099
+ <hr>
1100
+
1101
+ <a name="Importing.Files"></a>
1102
+ <h2>Importing Files</h2>
1103
+
1104
+ <pre><code>import( importType, "csvFileToImport.csv" );
1105
+ </code></pre>
1106
+
1107
+ <p><strong>importType:</strong></p>
1108
+
1109
+ <ul>
1110
+ <li><code>lookup</code></li>
1111
+ <li><code>powerlookup</code></li>
1112
+ </ul>
1113
+
1114
+
1115
+ <p>The <code>import</code> statement is used to load <code>lookup</code> and <code>powerlookup</code> data into the
1116
+ compiler. Lookup data must be imported before a lookup definition statement
1117
+ referencing the data is instantiated. The compiler will throw an error if
1118
+ the lookup is referenced prior to import.</p>
1119
+
1120
+ <p>The <code>import</code> statement can only load CSV files. Non CSV files should not be
1121
+ referenced by the <code>import</code> statement. The CSV file extension must be included
1122
+ as part of the filename.</p>
1123
+
1124
+ <p>The <code>import</code> statement must be terminated with a <code>;</code>.</p>
1125
+
1126
+ <p>Imported files must also be on the inclusion path.</p>
1127
+
1128
+ <hr>
1129
+
1130
+ <a name="Lookup.Files"></a>
1131
+ <h3>Lookup Files</h3>
1132
+
1133
+ <pre><code>import( lookup, "TestLookups.csv");
1134
+ </code></pre>
1135
+
1136
+ <p>The <code>lookup</code> import type will import Lookup matricies from a CSV file.</p>
1137
+
1138
+ <hr>
1139
+
1140
+ <a name="PowerLookup.Files"></a>
1141
+ <h3>PowerLookup Files</h3>
1142
+
1143
+ <pre><code>import( powerlookup, "TestPowerLookups.csv");
1144
+ </code></pre>
1145
+
1146
+ <p>The <code>powerlookup</code> import type will import PowerLookups from a CSV file. After
1147
+ a <code>powerlookup</code> has been imported, its ruleset can be referenced the same as
1148
+ any other ruleset.</p>
1149
+
1150
+ <p>Powerlookups are automatically aliased as they are imported: Spaces are
1151
+ removed, dashes and underscores are left in place.</p>
1152
+
1153
+ <p>Given a PLK named <code>Test My_Power-Lookup PLK</code> in the file <code>TestPowerLookups.csv</code>,
1154
+ its use would be as follows:</p>
1155
+
1156
+ <pre><code>import(powerlookup, "TestPowerLookups.csv");
1157
+
1158
+ // ...
1159
+
1160
+ guideline("MyGuideline")
1161
+
1162
+ ruleset SomeRuleset();
1163
+
1164
+ // ...
1165
+
1166
+ ruleset TestMy_Power-LookupPLK();
1167
+
1168
+ // ...
1169
+
1170
+ end // guideline MyGuideline
1171
+ </code></pre>
1172
+
1173
+ <hr>
1174
+
1175
+ <a name="XML.Functions"></a>
1176
+ <h2>XML Functions</h2>
1177
+
1178
+ <pre><code>xmlfunc identifier( [IN|OUT] dpmVariable, [IN|OUT] "constant", [IN|OUT] 15.5 );
1179
+ </code></pre>
1180
+
1181
+ <p>XML Functions are defined and provided by the engine. The compiler does not
1182
+ know whether or not a function is available. It is up to the user to verify
1183
+ the function exists before using it in your guideline.</p>
1184
+
1185
+ <p>To use an XML function, it must first be defined. The compiler does check the
1186
+ argument count against the function definition when it is referenced within a
1187
+ rule. Errors will be thrown if the argument count doesn't match.</p>
1188
+
1189
+ <p>In both definitions and references, the <code>IN</code> and <code>OUT</code> keywords can be used in
1190
+ front of each argument. These keywords are optional. They affect nothing and
1191
+ are only used as an indicator for the user as to whether the variable is used
1192
+ for INput to the function or OUTput from the function. <code>IN</code> and <code>OUT</code> can be
1193
+ used in either definitions, or references, or both.</p>
1194
+
1195
+ <p>DPM variables, PPM variables, numbers and constants (values surrounded with
1196
+ quotes) can be used as arguments. Inline expressions are not allowed as
1197
+ arguments to the function. Assigning values to variables before using them
1198
+ within a function <em>can be done within the same rule</em>.</p>
1199
+
1200
+ <p>Function <em>definition</em> statements must be terminated with a <code>;</code>.</p>
1201
+
1202
+ <p>Function <em>reference</em> statements must also be terminated with <code>;</code> (the same as
1203
+ any other assignment operation).</p>
1204
+
1205
+ <a name="Definitions.7"></a>
1206
+ <h3>Definitions</h3>
1207
+
1208
+ <p>Argument <em>types</em> are not checked by the compiler. Because of this, it is usually
1209
+ helpful to use constants in the argument list of the definition that describe
1210
+ what the argument should be.</p>
1211
+
1212
+ <pre><code>xmlfunc Floor( IN "NumToBeFloored", IN "Multiple" );
1213
+ </code></pre>
1214
+
1215
+ <a name="References.6"></a>
1216
+ <h3>References</h3>
1217
+
1218
+ <p>XML function references are used on the right hand side of assignment
1219
+ operations. The <code>xmlfunc</code> keyword is <em>not</em> used in references.</p>
1220
+
1221
+ <pre><code>rule SetAppraisedValue()
1222
+ if(pReviewValue != 0)
1223
+ then
1224
+ appraisedValue = Floor( IN pReviewValue, IN 100 );
1225
+ else
1226
+ appraisedValue = purchasePrice;
1227
+ end
1228
+ end
1229
+ </code></pre>
1230
+
1231
+ <hr>
1232
+
1233
+ <a name="Miscellaneous"></a>
1234
+ <h2>Miscellaneous</h2>
1235
+
1236
+ <a name="Inserting.a.Pricing.Guideline..special.rule."></a>
1237
+ <h3>Inserting a Pricing Guideline (special rule)</h3>
1238
+
1239
+ <p>This keyword is only of use with LOS guidelines. It generates a special rule
1240
+ that tells the application where to insert the pricing guideline (into the
1241
+ eligibility/program guideline) for the current product.</p>
1242
+
1243
+ <pre><code>InsertPricingGuideline();
1244
+ </code></pre>
1245
+
1246
+ <p>Example</p>
1247
+
1248
+ <pre><code>...
1249
+
1250
+ rule SomeRule();
1251
+ ruleset MyRuleset();
1252
+
1253
+ InsertPricingGuideline(); // &lt;--- The pricing/product guideline will be inserted here.
1254
+
1255
+ ruleset AnotherRuleset();
1256
+
1257
+ ...
1258
+ </code></pre>
1259
+ </div> <!-- .content -->
1260
+ </div> <!-- .rendered-content -->
1261
+ </body>
1262
+ </html>