SlideShare ist ein Scribd-Unternehmen logo
1 von 65
Obey the Rules! ,[object Object],[object Object],[object Object]
What is a rules engine?
Rules engines  ,[object Object],[object Object],[object Object],[object Object]
[object Object],[object Object],Business rules Business process : keep stores well stocked. Business rule : If the number of shirts in a store gets below 15, order more.
[object Object],[object Object],[object Object],[object Object],Keep ‘em Separated
 
Why use a rules engine in your application? ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
How are rules defined and implemented?
Typical workflow from business to technology The organization defines the business processes.
Typical workflow from business to technology A business analyst translates business practices into business rule statements, constraints and actions.
Typical workflow from business to technology The software developer implements the rules engine component in the application. The actions and triggers are implemented by the developer. The application is deployed by a developer with the rules externalized
Typical workflow from business to technology The organization changes some business processes.
Typical workflow from business to technology If the business process doesn’t require new actions, anyone, including this silly intern with a small desk, can update the rules engine.  Win.
Why use a  client-side  rules engine in your Flex RIA? ,[object Object],[object Object],[object Object],[object Object]
How do rules engines work?
Rules Engine Anatomy ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Rules Engine Anatomy: t-shirt inventory Facts Rules Conditions Actions ,[object Object],[object Object],[object Object]
Rules Engine Anatomy: clown alarm system Facts Rules Conditions Actions ,[object Object],[object Object],[object Object],[object Object],[object Object],http://www.axecop.com
Examples!
Real world use case 1 FormBuilderUI:  AS3 rules engine under the hood AS3 rules engine under the hood ,[object Object],[object Object],[object Object]
 
 
The Stack...
The Rules... < rule  id = &quot;isFemale&quot; > < statement ><![CDATA[  @info.sex equalTo 'Female'  ]]></ statement > < actions > < visibleAction  questionIDs = &quot;areYouPregnant&quot; /> </ actions > </ rule > < rule  id = &quot;isTeenager&quot; > < statement ><![CDATA[ @info.age greaterThanOrEqualTo '13' AND  @info.age lessThan '18'  ]]></ statement > < actions > </ actions > </ rule > < rule  id = &quot;isTeenageGirl&quot; > < statement ><![CDATA[ $isTeenager AND $isFemale  ]]></ statement > < actions > < urlAction  url = &quot; http://www.seventeen.com &quot;  /> </ actions > </ rule >
Regular Expressions public   static   var  andOrTrueFalsePattern:RegExp =  /AND|OR|true|false/ gi; public   static   var  ruleTokenPattern:RegExp =  /([a-zA-Z0-9_]+)/ g; public   static   var  propertyTokenPattern:RegExp =  /([a-zA-Z0-9_.]+)/ g; public   static   var  nonSpaceGroups:RegExp =  /([a-zA-Z0-9_.'&quot;]+)([^ ])/ gi; public   static   var  quotesPattern:RegExp =  /'|&quot;/ gi;
Pattern matching a rule...
Boolean parsing using short circuit ,[object Object],var  matches:Array = [ true ,  &quot;AND&quot; ,  false ,  &quot;AND&quot; ,  true ,  &quot;OR&quot;   true ]; var  operator:String;  var  nextValue:Boolean; var  overallValue:Boolean = matches[0]; var i:int = 1; while  (i < matches.length - 1) { operator=matches[i]; nextValue=StringUtil.stringToBoolean(matches[i + 1]); if  (isAndOperator(operator)) { overallValue=(overallValue && nextValue); if  (overallValue ==  false ) return   false ; }  else   if  (isOrOperator(operator)) { overallValue=(overallValue || nextValue); if  (overallValue ==  true ) return   true ; } i = i + 2; }
Hamcrest API - Matchers: public   static   const  EQUAL_TO:String =  &quot;equalTo&quot; ; public   static   const  NOT_EQUAL_TO:String =  &quot;notEqualTo&quot; ; public   static   const  LESS_THAN:String =  &quot;lessThan&quot; ; public   static   const  LESS_THAN_OR_EQUAL_TO:String =  &quot;lessThanOrEqualTo&quot; ; public   static   const  GREATER_THAN:String =  &quot;greaterThan&quot; ; public   static   const  GREATER_THAN_OR_EQUAL_TO:String =  &quot;greaterThanOrEqualTo&quot; ; public   static   const  CONTAINS:String =  &quot;contains&quot; ;
Hamcrest API:  Get your facts straight! public   static   function  evaluateCondition(target:*, operator:String, source:*):Boolean { try  { switch  (operator) { case  Matchers.EQUAL_TO: assertThat(target, equalTo(source)); break ; case  Matchers.NOT_EQUAL_TO: assertThat(target, not(equalTo(source))); break ; case  Matchers.LESS_THAN: assertThat(Number(target), lessThan(Number(source))); break ; default : throw   new  RuleError( &quot;No matcher found for this operator!” ); } }  catch  (e:Error) { if  (e.errorID != RuleError.ILLEGAL_OPERATOR_ERROR) { value= false ; }  else  { _logger.error(e.message, e.errorID); } }
Type of Rules engines ,[object Object]
[object Object],[object Object],[object Object],[object Object],Engine types:  production(inference)
Engine types:  reactive ,[object Object],[object Object],[object Object],[object Object],[object Object]
[object Object],[object Object],Rule Processing Algorithms
Basic Algorithm ,[object Object],[object Object],[object Object],[object Object]
Basic Algorithm Fact condition A Action Fact cB cC cD AND OR Fact Optimizations can give priority to certain conditions, wait to process until all facts are run through conditions, etc.
Rete Algorithm ,[object Object],[object Object],[object Object],[object Object]
Rete Algorithm ,[object Object],[object Object],[object Object],[object Object]
Rete Algorithm ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Rete Algorithm Fact1 condition A Action Fact3 cB cC cD AND OR ,[object Object],[object Object],[object Object],[object Object],[object Object],Fact2
Real world use case 2: Herff Jones Order Manager Herff Jones Order Manager ,[object Object],[object Object],[object Object]
 
 
Technical Challenges ,[object Object],[object Object],[object Object],[object Object],[object Object]
Core Components ,[object Object],[object Object],[object Object],[object Object]
Core UI ,[object Object],[object Object],[object Object],[object Object],[object Object]
Rule XML Sample <!-- Rule definition --> < rule > < getValue  key = &quot;Metal Quality&quot; >< containsString  value = &quot;Gold&quot; /></ getValue > < addValueOption  key = &quot;Metal Finish&quot;  value = &quot;Gold-on-Gold&quot;  meta = &quot;code:2&quot; /> </ rule >
Macro XML Sample: pricing a stone <!-- Macro definition --> < defineMacro  name = &quot;priceStone&quot; > < rule > < allOf > < getValue  key = &quot;$stoneKey&quot; >< equalTo  value = &quot;$stoneValue&quot; /></ getValue > < getValue  key = &quot;$stoneSizeKey&quot; >< equalTo  value = &quot;$stoneSizeValue&quot; /></ getValue > </ allOf > < addPrice  label = &quot;$stoneKey: $stoneValue&quot;  amount = &quot;$amount&quot; /> </ rule > </ defineMacro > <!-- Macro implementation --> < priceStone  stoneKey = &quot;Royal Stone&quot;  stoneValue = &quot;Birthstones - Alexandrite (Jun)&quot;  stoneSizeKey = &quot;Royal Stone Size&quot;  stoneSizeValue = &quot;12 Point&quot;  amount = &quot;4208&quot; />
Real world use case 3: A Statewide Agency  Government Benefits Application (GBA) Government Benefits Application (GBA) Government Benefits Application (GBA) ,[object Object],[object Object],[object Object]
GBA Overview Overview ,[object Object]
Functionality ,[object Object],[object Object],[object Object]
Technical Challenges ,[object Object],[object Object],[object Object]
Core Components ,[object Object],[object Object],[object Object]
...Core Components ,[object Object],[object Object],[object Object]
GBA Rules engine architecture Fact (change event) Conditions Actions User Questions Data Model Binding! Binding! Binding!
Core UI ,[object Object],[object Object],[object Object],[object Object]
Question XML < question  id = &quot;362&quot; controlType = &quot;ComboBox&quot; inlineHelp = &quot;Does anyone receive money from elsewhere?&quot; label = &quot;Other Employment&quot; optionsID = &quot;R00013&quot; target = &quot;Household.Income.OtherIncome&quot; />
Condition XML ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Rule XML < rule  id = &quot;doesAnyoneHasOtherEmployment&quot; > < statement > $hasOtherEmployment </ statement > < actions > < visibleAction  questionGroupIDs = &quot;income_other&quot; /> </ actions > </ rule > < rule  id = &quot;NoEmployment&quot; > < statement > $IsOnStrike OR ($NoFutureEmployment AND $NoCurrentEmployment AND $NoPastEmployment AND $NoOtherIncome) </ statement > < actions > < visibleAction  questionIDs = &quot;364&quot; /> </ actions > </ rule >
Data Abstraction
Dynamic Binding using ObjectProxy ,[object Object],[object Object],[object Object],[object Object],[object Object]
What next? ,[object Object],[object Object]
Forward Chaining (modus ponens) ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Forward Chaining ,[object Object],[object Object],[object Object],[object Object],[object Object]
Forward Chaining:  definition ,[object Object],[object Object],[object Object],[object Object],[object Object]
Thanks for obeying. Drew McLean twitter:  TunnelVisionary [email_address] RJ Owen twitter: rjowen [email_address]

Weitere ähnliche Inhalte

Andere mochten auch

Andere mochten auch (6)

Best practices webinar
Best practices webinarBest practices webinar
Best practices webinar
 
Developing a Real-time Engine with Akka, Cassandra, and Spray
Developing a Real-time Engine with Akka, Cassandra, and SprayDeveloping a Real-time Engine with Akka, Cassandra, and Spray
Developing a Real-time Engine with Akka, Cassandra, and Spray
 
Drools
DroolsDrools
Drools
 
Rule Engine & Drools
Rule Engine & DroolsRule Engine & Drools
Rule Engine & Drools
 
Programming the Physical World with Device Shadows and Rules Engine
Programming the Physical World with Device Shadows and Rules EngineProgramming the Physical World with Device Shadows and Rules Engine
Programming the Physical World with Device Shadows and Rules Engine
 
Them's the Rules - Using a Rules Engine to Wrangle Complexity
Them's the Rules - Using a Rules Engine to Wrangle ComplexityThem's the Rules - Using a Rules Engine to Wrangle Complexity
Them's the Rules - Using a Rules Engine to Wrangle Complexity
 

Ähnlich wie Obey The Rules: Implementing a Rules Engine in Flex

Rules Programming tutorial
Rules Programming tutorialRules Programming tutorial
Rules Programming tutorial
Srinath Perera
 
Biz Talk Demo slideshare
Biz Talk Demo slideshareBiz Talk Demo slideshare
Biz Talk Demo slideshare
erios
 
Spring Transaction
Spring TransactionSpring Transaction
Spring Transaction
patinijava
 
Business Process Execution Language
Business Process Execution LanguageBusiness Process Execution Language
Business Process Execution Language
招政 蔣
 
ABPerformance Quick Tour
ABPerformance Quick TourABPerformance Quick Tour
ABPerformance Quick Tour
Active Base
 
Priority Quick Tour
Priority Quick TourPriority Quick Tour
Priority Quick Tour
Active Base
 
Drools Presentation for Tallink.ee
Drools Presentation for Tallink.eeDrools Presentation for Tallink.ee
Drools Presentation for Tallink.ee
Anton Arhipov
 

Ähnlich wie Obey The Rules: Implementing a Rules Engine in Flex (20)

Droolsand Rule Based Systems 2008 Srping
Droolsand Rule Based Systems 2008 SrpingDroolsand Rule Based Systems 2008 Srping
Droolsand Rule Based Systems 2008 Srping
 
Aug Xml Net Forum Dynamics Integration
Aug Xml Net Forum Dynamics IntegrationAug Xml Net Forum Dynamics Integration
Aug Xml Net Forum Dynamics Integration
 
Practical catalyst
Practical catalystPractical catalyst
Practical catalyst
 
Rules Programming tutorial
Rules Programming tutorialRules Programming tutorial
Rules Programming tutorial
 
Biz Talk Demo slideshare
Biz Talk Demo slideshareBiz Talk Demo slideshare
Biz Talk Demo slideshare
 
Design Summit - Advanced policy state management - John Hardy
Design Summit - Advanced policy state management - John HardyDesign Summit - Advanced policy state management - John Hardy
Design Summit - Advanced policy state management - John Hardy
 
Puppeting in a Highly Regulated Industry
Puppeting in a Highly Regulated IndustryPuppeting in a Highly Regulated Industry
Puppeting in a Highly Regulated Industry
 
Spring Transaction
Spring TransactionSpring Transaction
Spring Transaction
 
Sap grc process control 10.0
Sap grc process control 10.0Sap grc process control 10.0
Sap grc process control 10.0
 
Boston 16 03
Boston 16 03Boston 16 03
Boston 16 03
 
Business Process Execution Language
Business Process Execution LanguageBusiness Process Execution Language
Business Process Execution Language
 
Oracle Sql Tuning
Oracle Sql TuningOracle Sql Tuning
Oracle Sql Tuning
 
Michiel Overeem (AFAS) - Enterprise software schaalbaar maken met Service Fab...
Michiel Overeem (AFAS) - Enterprise software schaalbaar maken met Service Fab...Michiel Overeem (AFAS) - Enterprise software schaalbaar maken met Service Fab...
Michiel Overeem (AFAS) - Enterprise software schaalbaar maken met Service Fab...
 
ABPerformance Quick Tour
ABPerformance Quick TourABPerformance Quick Tour
ABPerformance Quick Tour
 
Priority Quick Tour
Priority Quick TourPriority Quick Tour
Priority Quick Tour
 
Observability foundations in dynamically evolving architectures
Observability foundations in dynamically evolving architecturesObservability foundations in dynamically evolving architectures
Observability foundations in dynamically evolving architectures
 
ASP.NET MVC introduction
ASP.NET MVC introductionASP.NET MVC introduction
ASP.NET MVC introduction
 
Intelligent Supermarket using Apriori
Intelligent Supermarket using AprioriIntelligent Supermarket using Apriori
Intelligent Supermarket using Apriori
 
Java Script Isn\'t a Toy Anymore
Java Script Isn\'t a Toy AnymoreJava Script Isn\'t a Toy Anymore
Java Script Isn\'t a Toy Anymore
 
Drools Presentation for Tallink.ee
Drools Presentation for Tallink.eeDrools Presentation for Tallink.ee
Drools Presentation for Tallink.ee
 

Mehr von RJ Owen

Moral designfinal
Moral designfinalMoral designfinal
Moral designfinal
RJ Owen
 
Flex4 component lifecycle
Flex4 component lifecycleFlex4 component lifecycle
Flex4 component lifecycle
RJ Owen
 

Mehr von RJ Owen (7)

Moral Design (Denver Startup Week)
Moral Design (Denver Startup Week)Moral Design (Denver Startup Week)
Moral Design (Denver Startup Week)
 
Moral designfinal
Moral designfinalMoral designfinal
Moral designfinal
 
Flex4 component lifecycle
Flex4 component lifecycleFlex4 component lifecycle
Flex4 component lifecycle
 
Flex 4 Overview
Flex 4 OverviewFlex 4 Overview
Flex 4 Overview
 
Adobe Flex 3 Component Life Cycle
Adobe Flex 3 Component Life CycleAdobe Flex 3 Component Life Cycle
Adobe Flex 3 Component Life Cycle
 
Flex3 Deep Dive Final
Flex3 Deep Dive FinalFlex3 Deep Dive Final
Flex3 Deep Dive Final
 
Adobe Flex Component Lifecycle
Adobe Flex Component LifecycleAdobe Flex Component Lifecycle
Adobe Flex Component Lifecycle
 

Kürzlich hochgeladen

Kürzlich hochgeladen (20)

Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your Business
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 

Obey The Rules: Implementing a Rules Engine in Flex

  • 1.
  • 2. What is a rules engine?
  • 3.
  • 4.
  • 5.
  • 6.  
  • 7.
  • 8. How are rules defined and implemented?
  • 9. Typical workflow from business to technology The organization defines the business processes.
  • 10. Typical workflow from business to technology A business analyst translates business practices into business rule statements, constraints and actions.
  • 11. Typical workflow from business to technology The software developer implements the rules engine component in the application. The actions and triggers are implemented by the developer. The application is deployed by a developer with the rules externalized
  • 12. Typical workflow from business to technology The organization changes some business processes.
  • 13. Typical workflow from business to technology If the business process doesn’t require new actions, anyone, including this silly intern with a small desk, can update the rules engine. Win.
  • 14.
  • 15. How do rules engines work?
  • 16.
  • 17.
  • 18.
  • 20.
  • 21.  
  • 22.  
  • 24. The Rules... < rule id = &quot;isFemale&quot; > < statement ><![CDATA[ @info.sex equalTo 'Female' ]]></ statement > < actions > < visibleAction questionIDs = &quot;areYouPregnant&quot; /> </ actions > </ rule > < rule id = &quot;isTeenager&quot; > < statement ><![CDATA[ @info.age greaterThanOrEqualTo '13' AND @info.age lessThan '18' ]]></ statement > < actions > </ actions > </ rule > < rule id = &quot;isTeenageGirl&quot; > < statement ><![CDATA[ $isTeenager AND $isFemale ]]></ statement > < actions > < urlAction url = &quot; http://www.seventeen.com &quot; /> </ actions > </ rule >
  • 25. Regular Expressions public static var andOrTrueFalsePattern:RegExp = /AND|OR|true|false/ gi; public static var ruleTokenPattern:RegExp = /([a-zA-Z0-9_]+)/ g; public static var propertyTokenPattern:RegExp = /([a-zA-Z0-9_.]+)/ g; public static var nonSpaceGroups:RegExp = /([a-zA-Z0-9_.'&quot;]+)([^ ])/ gi; public static var quotesPattern:RegExp = /'|&quot;/ gi;
  • 27.
  • 28. Hamcrest API - Matchers: public static const EQUAL_TO:String = &quot;equalTo&quot; ; public static const NOT_EQUAL_TO:String = &quot;notEqualTo&quot; ; public static const LESS_THAN:String = &quot;lessThan&quot; ; public static const LESS_THAN_OR_EQUAL_TO:String = &quot;lessThanOrEqualTo&quot; ; public static const GREATER_THAN:String = &quot;greaterThan&quot; ; public static const GREATER_THAN_OR_EQUAL_TO:String = &quot;greaterThanOrEqualTo&quot; ; public static const CONTAINS:String = &quot;contains&quot; ;
  • 29. Hamcrest API: Get your facts straight! public static function evaluateCondition(target:*, operator:String, source:*):Boolean { try { switch (operator) { case Matchers.EQUAL_TO: assertThat(target, equalTo(source)); break ; case Matchers.NOT_EQUAL_TO: assertThat(target, not(equalTo(source))); break ; case Matchers.LESS_THAN: assertThat(Number(target), lessThan(Number(source))); break ; default : throw new RuleError( &quot;No matcher found for this operator!” ); } } catch (e:Error) { if (e.errorID != RuleError.ILLEGAL_OPERATOR_ERROR) { value= false ; } else { _logger.error(e.message, e.errorID); } }
  • 30.
  • 31.
  • 32.
  • 33.
  • 34.
  • 35. Basic Algorithm Fact condition A Action Fact cB cC cD AND OR Fact Optimizations can give priority to certain conditions, wait to process until all facts are run through conditions, etc.
  • 36.
  • 37.
  • 38.
  • 39.
  • 40.
  • 41.  
  • 42.  
  • 43.
  • 44.
  • 45.
  • 46. Rule XML Sample <!-- Rule definition --> < rule > < getValue key = &quot;Metal Quality&quot; >< containsString value = &quot;Gold&quot; /></ getValue > < addValueOption key = &quot;Metal Finish&quot; value = &quot;Gold-on-Gold&quot; meta = &quot;code:2&quot; /> </ rule >
  • 47. Macro XML Sample: pricing a stone <!-- Macro definition --> < defineMacro name = &quot;priceStone&quot; > < rule > < allOf > < getValue key = &quot;$stoneKey&quot; >< equalTo value = &quot;$stoneValue&quot; /></ getValue > < getValue key = &quot;$stoneSizeKey&quot; >< equalTo value = &quot;$stoneSizeValue&quot; /></ getValue > </ allOf > < addPrice label = &quot;$stoneKey: $stoneValue&quot; amount = &quot;$amount&quot; /> </ rule > </ defineMacro > <!-- Macro implementation --> < priceStone stoneKey = &quot;Royal Stone&quot; stoneValue = &quot;Birthstones - Alexandrite (Jun)&quot; stoneSizeKey = &quot;Royal Stone Size&quot; stoneSizeValue = &quot;12 Point&quot; amount = &quot;4208&quot; />
  • 48.
  • 49.
  • 50.
  • 51.
  • 52.
  • 53.
  • 54. GBA Rules engine architecture Fact (change event) Conditions Actions User Questions Data Model Binding! Binding! Binding!
  • 55.
  • 56. Question XML < question id = &quot;362&quot; controlType = &quot;ComboBox&quot; inlineHelp = &quot;Does anyone receive money from elsewhere?&quot; label = &quot;Other Employment&quot; optionsID = &quot;R00013&quot; target = &quot;Household.Income.OtherIncome&quot; />
  • 57.
  • 58. Rule XML < rule id = &quot;doesAnyoneHasOtherEmployment&quot; > < statement > $hasOtherEmployment </ statement > < actions > < visibleAction questionGroupIDs = &quot;income_other&quot; /> </ actions > </ rule > < rule id = &quot;NoEmployment&quot; > < statement > $IsOnStrike OR ($NoFutureEmployment AND $NoCurrentEmployment AND $NoPastEmployment AND $NoOtherIncome) </ statement > < actions > < visibleAction questionIDs = &quot;364&quot; /> </ actions > </ rule >
  • 60.
  • 61.
  • 62.
  • 63.
  • 64.
  • 65. Thanks for obeying. Drew McLean twitter: TunnelVisionary [email_address] RJ Owen twitter: rjowen [email_address]