decision tables and prologa [email protected] modelling business rules
TRANSCRIPT
Decision TablesDecision Tablesand Prologaand Prologa
MModelling Business Rulesodelling Business Rules
What is a decision table ?
Completeness criterion
Exclusivity criterion
Table Representing complete set of conditional expressions where expressions are mutually exclusive In a predefined area
Decision TablesDecision Tables
condition entries (condition states)
condition stub (condition subjects)
action stub (action subjects) action entries (action values)
Decision TablesDecision Tables
What kinds of knowledge ?What kinds of knowledge ?
Regulations, legislation, …Regulations, legislation, … Business rules, corporate policy, ...Business rules, corporate policy, ...
» accept/refuse ordersaccept/refuse orders
» discountsdiscounts
» ……
ExpertiseExpertise Classification knowledgeClassification knowledge
» types of customerstypes of customers
» risk categoriesrisk categories
» ……
– Powerful visualisationPowerful visualisation
– Preventing errors is easierPreventing errors is easier
– Modular knowledge organisationModular knowledge organisation
– PerformancePerformance
Compact and structured presentation
Avoid incompleteness and inconsistency
Group rules into single table
Fast decision tree execution
Why use decision tables ?Why use decision tables ?
if (credit limit = 'Ok') and (customer = 'Good') and (Stock Sufficient)if (credit limit = 'Ok') and (customer = 'Good') and (Stock Sufficient) then Execute Orderthen Execute Order
if (customer = 'Not Good') and (credit limit = 'Not Ok') then Refuse Orderif (customer = 'Not Good') and (credit limit = 'Not Ok') then Refuse Order
if (credit limit = 'Not Ok')if (credit limit = 'Not Ok') and (customer = 'Good') and (customer = 'Good') and and not(Stock Sufficient) not(Stock Sufficient) then Put On Waiting Listthen Put On Waiting List
if (Customer = 'Good') and (Stock Sufficient) then Execute Orderif (Customer = 'Good') and (Stock Sufficient) then Execute Order
if (Customer = 'Good') and not(Stock Sufficient) and (credit limit = 'Ok') then Put On Waiting Listif (Customer = 'Good') and not(Stock Sufficient) and (credit limit = 'Ok') then Put On Waiting List
if (credit limit = 'Ok') and (Customer = 'Not Good') and not(Stock Sufficient) then Put On Waiting Listif (credit limit = 'Ok') and (Customer = 'Not Good') and not(Stock Sufficient) then Put On Waiting List
if (credit limit = 'Ok') and (Stock Sufficient) and (Customer = 'Not Good') then Execute Orderif (credit limit = 'Ok') and (Stock Sufficient) and (Customer = 'Not Good') then Execute Order
Why use decision tables ?Why use decision tables ?
The number of holidays depends on age and years of service. Every employee receives at least 22 days. Additional days are provided according to the following criteria:
Only employees younger than 18 or at least 60 years, or employees with at least 30 years of service will receive 5 extra days.
Employees with at least 30 years of service and also employees of age 60 or more, receive 3 extra days, on top of possible additional days already supplied.
If the employee has at least 15 but less than 30 years of service, 2 extra days are given. These 2 days are also provided for employees of age 45 or more. The 2 extra days can not be combined with the 5 extra days.
ExampleExample
Empty decision tableEmpty decision table
Decision rulesDecision rules Every employee receives at least 22 days.
Only employees younger than 18 or at least 60 years, or employees with at least 30 years of service will receive 5 extra days.
Rule 2: 5 extra days generally if only age < 18 or age >= 60 or service >= 30;
Rule 1: assign 22 days definitely if always;
Rule 3: 3 extra days generally if age >= 60 or service >= 30;
Employees with at least 30 years of service and also employees of age 60 or more, receive 3 extra days, on top of possible additional days already supplied.
If the employee has at least 15 but less than 30 years of service, 2 extra days are given. These 2 days are also provided for employees of age 45 or more. The 2 extra days can not be combined with the 5 extra days.
Rule 4: 2 extra days generally if (45 <= age < 60 or age >= 60 or 15 <= service < 30) minus rule 2;
From common sense knowledge, it is clear that an employee younger than 18 years can not have 15 or more years of service. The impossible condition combinations should be discarded from the table by adding the rule:
Rule 5: impossible definitely if age < 18 and (15 <= service < 30 or service >= 30);
Rule 1: assign 22 days definitely if always;
Rule 2: 5 extra days generally if only age < 18 or age >= 60 or service >= 30;
Rule 3: 3 extra days generally if age >= 60 or service >= 30;
Rule 4: 2 extra days generally if (45 <= age < 60 or age >= 60 or 15 <= service < 30) minus rule 2;
Rule 5: impossible definitely if age < 18 and (15 <= service < 30 or service >= 30);
Expanded decision tableExpanded decision table
Contracted decision tableContracted decision table
Kinds of tablesKinds of tablestable w ith non-exclusive columns
decision table
rule table or decision grid chart
"c lassic" multiple hit table
the table representa tion of a ll singledecision columns
the compact table representa tion of a lldecision columns for a given conditionorder
the compact table representa tion of a lldecision columns for the optimalcondition order (cf. infra)
M H/AA ll H it
M H/FFirst H it
M HM ultiple H it
SH /XE xpanded
SH /CC ontrac ted
SH /OO ptimized
SHSingle H it
Holidays (multiple hit, all hits)Holidays (multiple hit, all hits)
Holidays (multiple hit, first hit)Holidays (multiple hit, first hit)
Holidays (single hit contracted)Holidays (single hit contracted)
System of decision tablesSystem of decision tables Customer
Orders
Execute
Application areasApplication areas
1960 1970 1980 1990 2000
automation of construction
application field enlargement
advanced preprocessors
algorithms
initial preprocessors
initial developments
transformations
knowledge validation
knowledge engineering
conditional logic experiments
3 aspects of a decision situation3 aspects of a decision situation
Specification(construction)
Representation(verification)
Implementation(decision making)
InterfacesInterfaces
Text
Program Code
Rules
Decision Trees
ConsultationEnvironment
Expert SystemShells
Decision Tables
CasesExamples
Decision Tables?Decision Tables?
Decision Tables and PROLOGADecision Tables and PROLOGA
FeaturesFeatures
ExperiencesExperiences
PROcedural LOGic Analyzer
PrologaProloga
PrologaProloga from...from... “a rule-based design tool for computer-
supported construction and manipulation of decision tables”
to…to…
“a tool environment that uses decision tables for knowledge modelling, validation, optimization and implementation”
Knowledge Modelling Tool Uses Decision Tables Integrated V&V Features Knowledge Optimization Consultation Engine Import/Export Facilities
To/From other knowledge representations
What is the PROLOGA system?What is the PROLOGA system?
Decision tables
Rules
Conditions
Actions
Table structures
Dependency graph
The Prologa system - PreviewThe Prologa system - Preview
– Modelling featuresModelling features
– Verification & ValidationVerification & Validation
– Optimization featuresOptimization features
– Implementation featuresImplementation features
All table manipulations (fill by rules, refined specification language, compose, optimization)
Structures of tables, modularization
(Intra)tabular and intertabular
Minimal columns, minimal rules, interfaces
Why use Prologa?Why use Prologa?
Modelling Features (1)Modelling Features (1)
Building & manipulating decision tablesBuilding & manipulating decision tables– specify conditions & actionsspecify conditions & actions– reorder by drag & dropreorder by drag & drop– specify input rules :specify input rules :
Actions [generally] if condition combinationsNot action definitely if condition combinationsAction only possible if condition combinationsAction definitely if and only if condition combination
– fill in entries by mousefill in entries by mouse
Building Tables ; Screen Building Tables ; Screen Example Example
Modelling Features (2)Modelling Features (2)
Structures of tablesStructures of tables– Condition subtables :Condition subtables :
subtables that determine the state of a subtables that determine the state of a condition (e.g. when do you consider condition (e.g. when do you consider someone a good customer?)someone a good customer?)
– Action subtables :Action subtables : subtables that further elaborate on what additional subtables that further elaborate on what additional
knowledge holds for certain cases (e.g. what knowledge holds for certain cases (e.g. what discount to give if an order is accepted)discount to give if an order is accepted)
Table Structures ; ExampleTable Structures ; Example
"Execute Order" subtable"Execute Order" subtable
main tablemain table
"Customer" subtable"Customer" subtable
subtable further specifies what is understoodsubtable further specifies what is understood by the notion of a "good" customer by the notion of a "good" customer
"Execute Order" subtable is only applicable"Execute Order" subtable is only applicable in cases where Credit Limit = Ok in cases where Credit Limit = Ok and/or Customer = Good and/or Customer = Good
Modelling Features (3)Modelling Features (3)
Support for automatic modularizationSupport for automatic modularization
Our Modularization ApproachOur Modularization Approach
Rule 1 Rule 2
Rule 4
Rule 6
Rule 3
Rule 5
Rule 8
Rule 7
Rule 11
Rule 10
Rule 9
decomposing knowledge intomultiple-table structure
““Order”Order”
““Execute Order”Execute Order”
Working with ProjectsWorking with Projects
a “project” is a collection of related tablesa “project” is a collection of related tables consists of :consists of :
» prj-fileprj-file» MS Access database-fileMS Access database-file» tab-filestab-files
file management is handled by Prologafile management is handled by Prologa table linking based on logical table & variable table linking based on logical table & variable
names instead of tab-filenamesnames instead of tab-filenames consultation environmentconsultation environment other representation formalisms than tables other representation formalisms than tables
(future Prologa versions)(future Prologa versions)
Although the use of decision tables has been proposed before in V&V literature (Cragun, Puuronen), our viewpoint differs from these other approaches
decision tables as a modelling technique on its own, and not merely as a means towards verification of rule-based systems
As pointed out in (Preece 94), tools that verify rule-bases after operationalizing them into decision table format, generally fail to find anomalies that stretch beyond simple pairs of rules
full V&V between tables
Prologa and V&VProloga and V&V
V&V FeaturesV&V Features
Intra-tabular verification : verify each tableIntra-tabular verification : verify each table– single-hit decision tablessingle-hit decision tables– contradiction messagescontradiction messages– verification reportverification report
Inter-tabular verification : verify different Inter-tabular verification : verify different (sub)tables with respect to each other(sub)tables with respect to each other
(topic of a current thesis)(topic of a current thesis)
inter-tabularinter-tabular
intra-tabularintra-tabular
V&V ; ExampleV&V ; Example
The cleanroom approach
Inconsistency or contradictionsAvoided by modelling tables
IncompletenessAvoided by automatic generation
RedundancyAvoided by table mechanism
Prologa and V&V experiencesProloga and V&V experiences
Optimization FeaturesOptimization Features
Table contractionTable contraction– merge columns with identical action partsmerge columns with identical action parts
Row order optimizationRow order optimization– less columns by changing order of condition less columns by changing order of condition
rowsrows Export to minimal rulesExport to minimal rules
– improved rule notationimproved rule notation
OptimizationOptimization
Problem
(DGC)If Then Rules
Extended Rules(XDGC)
Decision Table
Exp
Contr
OptC
Optimal Execution Tree
Display
Execution Tree
Minimal Rules
Examples
Shell
Implementation FeaturesImplementation Features
Prologa’s consultation environmentProloga’s consultation environment AionDS generationAionDS generation Export to …Export to …
» PascalPascal
» CobolCobol
» Optimal codeOptimal code
What’s next ? What’s next ? » use Prologa to build Web-based applications (JAVA)use Prologa to build Web-based applications (JAVA)
» Prologa as OLE Server or Delphi-componentProloga as OLE Server or Delphi-component
Consultation Session ; ExampleConsultation Session ; Example
AionDS Generation ; ExampleAionDS Generation ; Example
Credit_Limit CustomerGood Stock_Sufficient ExecuteOrder Refuse_Order Put_On_Waiting_List
ok y y x - -
ok y n - - xnot ok y y x - -
RuleNoNo
Subject Value1 Credit_Limit Ok1 Stock_Sufficient Y1 ExecuteOrder x2 Credit_Limit Ok2 Stock_Sufficient N2 Put_On_Waiting_List x3 Credit_Limit Not_Ok
…
VANTHIENEN J., WETS G., Integration of the Decision Table Formalism with a Relational Database Environment, Information Systems, 20 (7), pp. 595-616, 1995.
Storing the DT as a relational tableStoring the DT as a relational table
– Storing rules as dataStoring rules as data
Storing persistent decision tablesStoring persistent decision tables