SlideShare une entreprise Scribd logo
1  sur  20
Télécharger pour lire hors ligne
Rule Engine– Java & Ruby
Drools & Ruleby




               Ing. Martín Cabrera
               martin.cabrera@moove-it.com
               Moove-IT
Content
   Rules Engine ? What is this ?
   When to use ?
   RETE algorithm
   In Java - JBoss Drools
       features
       Syntax
   In ruby ?
Motor de Reglas ¿what a #@!$ ?

                    Application




                    Rule engine




    Rule def.
                            knowledge base
         Rule def
When to use?
   Infrastructure decoupled from the source
   System to allow the final user to define their rules
    and change them dynamically
       Developers are not the primary responsibility for changing
        rules
   Moderate or high complexity of business rules
   Performance !

   Conclusion: down the rules of your system, so that
    they can be reused, decouple the code and allow the
    user to know the rules ... to modify !
Tipical Code
01     if ((user.isMemberOf(AdministratorGroup) && user.isMemberOf(teleworkerGroup)) ||
02             user.isSuperUser() {
03         // more checks for specific cases
04         if ((expenseRequest.code().equals("B203") ||
05                 (expenseRequest.code().equals("A903") && (totalExpenses < 200) &&
06                      (bossSignOff > totalExpenses)) && (deptBudget.notExceeded)) {
07             // issue payments
08         }
09         else if {
10             // check lots of other conditions
11         }
12     }
                                                          Change this rules ! ... %&”@    !
13     else {
14         // even more business logic
15     }
16 }
Rete Algorithm – the
Solution !
   Pattern matching algorithm for implementing
    production rule systems (wikipedia)
       http://en.wikipedia.org/wiki/Rete_algorithm
   replaces if ... Then with an optimized logic network
Rete 2
   RETE – characteristics:
       It reduces or eliminates certain types of redundancy through the use of
        node sharing.
       It stores partial matches when performing joins between different fact
        types.
       It allows for efficient removal of memory elements when facts are
        retracted from working memory.
   Widely used to implement matching functionality within pattern-
    matching engines that exploit a match-resolve-act cycle to
    support forward and backward chaining and inferencing.
       Forward-chaining (facts -> goals)
       Backguard chaining (goals -> facts)
Drools –
   http://jboss.org/drools

   Introduction video -
    http://blog.athico.com/2010/03/fosdem-50-minute-introduction-into.h

   Introduction
       Rules engine framework for java
       It is used in other jboss projects like JBPM, SEAM, Jboss ESB and
        others
       The rules can be written in Java, Python, Groovy Ruby and your own
        rule language
       Jboss tools – plugin Eclipse to use this framework
Eclipse & Drools
Syntax or rules definition

rule “<name>”
   <attribute> <value>
   when
      <LHS>
   then
      <RHS>
end
Example – rule definition
 rule.drl

package com.mooveit.rule

import com.mooveit.rule.Global

global Global global;

rule "r1 - first rule"

            when
                   instance : Entity( field1 > 2010)
            then
                   ...
end
Example
                                Business Action

                                                         1
StatefulSession session = getRulesBase().newStatefulSession();
session.setGlobal("rulesImpl", this);

session.insert(instance);
session.fireAllRules();


                                            2

                            3                     knowledge base
                                                      +instance




      Execute the “then” part for the instance that match the facts
Drools Schema
Rules files
                Repository of
                instances




                   assert
                   modify
                   retract
JBoss Rules Overview
                                                                     Agenda
Rule                                                                Activation
 Rule
   Rule       1.Parse DRL        RuleBase                 Rule                       Fact
     Rule
      Rule
                                                                    Activation
                                                                                   Fact




                                   2. Create
                                                          Rule                      Fact



Fact
 Fact
   Fact      3. Assert Facts   WorkingMemory
     Fact
      Fact                                                          Fact
                                                                     Fact
                                                                       Fact




                                                     es
                                                                         Fact



                                                   ul
                                                   R
                                                                          Fact

                                               ll
                                               A
                                              re           Rule         (5) activation
                                           Fi
                                                            Rule      -> consequence
                                        4.


                                                              Rule
                                                                Rule
                                                                 Rule
Examples in our projects

   (demo)
Rule Engine in
Rules Engine In ruby
   Ruleby - https://github.com/codeaspects/ruleby
       Rule engine for Ruby
       Active project but with few people dedicated
       October 11 of 2010 last push in the master branch
       Install: gem install ruleby
   Others
       Ruby Rools - http://rools.rubyforge.org/
           Last activity (ago 2009 in rools users)
           Status: Beta
           2 members
       A few projects without activity: rein, ruby-rules
       Treetop
           language for describing languages
           It's not a pure rule engine ... but can serve
Ruleby Description
   Provide a pure Ruby Domain Specific Language (DSL)
     rule [m.status == :HELLO] do |v|
       puts v[:m].message
     end


   (LHS) Left hand side of the production (the ‘when’) is
    represented by the Array parameter
   (RHS) The right hand side (the ‘then’) is represented by the
    block.
      engine :hello_engine do |e|
        HelloWorldRulebook.new(e).rules
        assert e, Message.new(:HELLO, ‘Hello World’)
        e.match
      end

   Result:Hello World
Ruleby links

   The Ruleby DSL for more information.
       https://github.com/codeaspects/ruleby/wiki/The-Ruleby
   Download
       http://gemcutter.org/gems/ruleby
   User Group
       http://groups-beta.google.com/group/ruleby
That's it !

Contenu connexe

Tendances

Kicking ass with redis
Kicking ass with redisKicking ass with redis
Kicking ass with redis
Dvir Volk
 

Tendances (12)

Geospatial Indexing at Scale: The 15 Million QPS Redis Architecture Powering ...
Geospatial Indexing at Scale: The 15 Million QPS Redis Architecture Powering ...Geospatial Indexing at Scale: The 15 Million QPS Redis Architecture Powering ...
Geospatial Indexing at Scale: The 15 Million QPS Redis Architecture Powering ...
 
UML
UMLUML
UML
 
UML
UMLUML
UML
 
Treinamento de SQL Básico
Treinamento de SQL BásicoTreinamento de SQL Básico
Treinamento de SQL Básico
 
Javascript Orientado a Objeto
Javascript Orientado a ObjetoJavascript Orientado a Objeto
Javascript Orientado a Objeto
 
Kicking ass with redis
Kicking ass with redisKicking ass with redis
Kicking ass with redis
 
Aula de SQL - Básico
Aula de SQL - BásicoAula de SQL - Básico
Aula de SQL - Básico
 
Maximize Dynamics AX System Performance with a Health Check
Maximize Dynamics AX System Performance with a Health CheckMaximize Dynamics AX System Performance with a Health Check
Maximize Dynamics AX System Performance with a Health Check
 
[Games on AWS 2019] AWS 사용자를 위한 만랩 달성 트랙 | Aurora로 게임 데이터베이스 레벨 업! - 김병수 AWS ...
[Games on AWS 2019] AWS 사용자를 위한 만랩 달성 트랙 | Aurora로 게임 데이터베이스 레벨 업! - 김병수 AWS ...[Games on AWS 2019] AWS 사용자를 위한 만랩 달성 트랙 | Aurora로 게임 데이터베이스 레벨 업! - 김병수 AWS ...
[Games on AWS 2019] AWS 사용자를 위한 만랩 달성 트랙 | Aurora로 게임 데이터베이스 레벨 업! - 김병수 AWS ...
 
MySQL Ecosystem in 2023 - FOSSASIA'23 - Alkin.pptx.pdf
MySQL Ecosystem in 2023 - FOSSASIA'23 - Alkin.pptx.pdfMySQL Ecosystem in 2023 - FOSSASIA'23 - Alkin.pptx.pdf
MySQL Ecosystem in 2023 - FOSSASIA'23 - Alkin.pptx.pdf
 
[AIS 2018] [Team Tools_Advanced] Confluence 100배 활용하기 - 커브
[AIS 2018] [Team Tools_Advanced] Confluence 100배 활용하기 - 커브[AIS 2018] [Team Tools_Advanced] Confluence 100배 활용하기 - 커브
[AIS 2018] [Team Tools_Advanced] Confluence 100배 활용하기 - 커브
 
ULA Unidade Lógica Aritmética
ULA Unidade Lógica AritméticaULA Unidade Lógica Aritmética
ULA Unidade Lógica Aritmética
 

En vedette

Business Rule Engine
Business Rule EngineBusiness Rule Engine
Business Rule Engine
Ankur Singhal
 
UX en proyectos de moove-it
UX en proyectos de moove-itUX en proyectos de moove-it
UX en proyectos de moove-it
martincabrera
 
Node js presentation
Node js presentationNode js presentation
Node js presentation
martincabrera
 

En vedette (17)

Ruleby
RulebyRuleby
Ruleby
 
Business Rule Engine
Business Rule EngineBusiness Rule Engine
Business Rule Engine
 
Drools
DroolsDrools
Drools
 
UX en proyectos de moove-it
UX en proyectos de moove-itUX en proyectos de moove-it
UX en proyectos de moove-it
 
Presentación Juego para el plan ceibal
Presentación Juego para el plan ceibalPresentación Juego para el plan ceibal
Presentación Juego para el plan ceibal
 
Drools5 Community Training module 4 RETE Algorithm Introduction
Drools5 Community Training module 4 RETE Algorithm IntroductionDrools5 Community Training module 4 RETE Algorithm Introduction
Drools5 Community Training module 4 RETE Algorithm Introduction
 
Communication with our_clients
Communication with our_clientsCommunication with our_clients
Communication with our_clients
 
Rules engine
Rules engineRules engine
Rules engine
 
Obey The Rules: Implementing a Rules Engine in Flex
Obey The Rules: Implementing a Rules Engine in FlexObey The Rules: Implementing a Rules Engine in Flex
Obey The Rules: Implementing a Rules Engine in Flex
 
Drools expert-docs
Drools expert-docsDrools expert-docs
Drools expert-docs
 
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
 
Node js presentation
Node js presentationNode js presentation
Node js presentation
 
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
 
Docker for developers
Docker for developersDocker for developers
Docker for developers
 
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
 

Similaire à Rules Engine - java(Drools) & ruby(ruleby)

[Pilarczyk] Adrenaline programing implementing - SOA and BPM in your application
[Pilarczyk] Adrenaline programing implementing - SOA and BPM in your application[Pilarczyk] Adrenaline programing implementing - SOA and BPM in your application
[Pilarczyk] Adrenaline programing implementing - SOA and BPM in your application
javablend
 
Introduction to Drools
Introduction to DroolsIntroduction to Drools
Introduction to Drools
giurca
 

Similaire à Rules Engine - java(Drools) & ruby(ruleby) (20)

JBoss Business Rules Management System (BRMS) Primer
JBoss Business Rules Management System (BRMS) PrimerJBoss Business Rules Management System (BRMS) Primer
JBoss Business Rules Management System (BRMS) Primer
 
October Rules Fest 2008 - Distributed Data Processing with ILOG JRules
October Rules Fest 2008 - Distributed Data Processing with ILOG JRulesOctober Rules Fest 2008 - Distributed Data Processing with ILOG JRules
October Rules Fest 2008 - Distributed Data Processing with ILOG JRules
 
[Pilarczyk] Adrenaline programing implementing - SOA and BPM in your application
[Pilarczyk] Adrenaline programing implementing - SOA and BPM in your application[Pilarczyk] Adrenaline programing implementing - SOA and BPM in your application
[Pilarczyk] Adrenaline programing implementing - SOA and BPM in your application
 
SenchaCon 2016: Handling Undo-Redo in Sencha Applications - Nickolay Platonov
SenchaCon 2016: Handling Undo-Redo in Sencha Applications - Nickolay PlatonovSenchaCon 2016: Handling Undo-Redo in Sencha Applications - Nickolay Platonov
SenchaCon 2016: Handling Undo-Redo in Sencha Applications - Nickolay Platonov
 
Introduction to Drools
Introduction to DroolsIntroduction to Drools
Introduction to Drools
 
Module Rules. Overview, use cases, API
Module Rules. Overview, use cases, APIModule Rules. Overview, use cases, API
Module Rules. Overview, use cases, API
 
Rules
RulesRules
Rules
 
Project Description Of Incident Management System Developed by PRS (CRIS) , N...
Project Description Of Incident Management System Developed by PRS (CRIS) , N...Project Description Of Incident Management System Developed by PRS (CRIS) , N...
Project Description Of Incident Management System Developed by PRS (CRIS) , N...
 
EuroAD 2021: ChainRules.jl
EuroAD 2021: ChainRules.jl EuroAD 2021: ChainRules.jl
EuroAD 2021: ChainRules.jl
 
Rules SDK IBM WW BPM Forum March 2013
Rules SDK IBM WW BPM Forum March 2013Rules SDK IBM WW BPM Forum March 2013
Rules SDK IBM WW BPM Forum March 2013
 
Spring Batch Behind the Scenes
Spring Batch Behind the ScenesSpring Batch Behind the Scenes
Spring Batch Behind the Scenes
 
MarGotAspect - An AspectC++ code generator for the mARGOt framework
MarGotAspect - An AspectC++ code generator for the mARGOt frameworkMarGotAspect - An AspectC++ code generator for the mARGOt framework
MarGotAspect - An AspectC++ code generator for the mARGOt framework
 
Rule Responder Nccu Taipei Mar2008 Talk [Compatibility Mode]
Rule Responder Nccu Taipei Mar2008 Talk [Compatibility Mode]Rule Responder Nccu Taipei Mar2008 Talk [Compatibility Mode]
Rule Responder Nccu Taipei Mar2008 Talk [Compatibility Mode]
 
Build Java Web Application Using Apache Struts
Build Java Web Application Using Apache Struts Build Java Web Application Using Apache Struts
Build Java Web Application Using Apache Struts
 
Building React Applications with Redux
Building React Applications with ReduxBuilding React Applications with Redux
Building React Applications with Redux
 
Flex 360 Rules Engine
Flex 360 Rules EngineFlex 360 Rules Engine
Flex 360 Rules Engine
 
Flex 360 Rules Engine
Flex 360 Rules EngineFlex 360 Rules Engine
Flex 360 Rules Engine
 
Java EE7
Java EE7Java EE7
Java EE7
 
Strategy and Template Pattern
Strategy and Template PatternStrategy and Template Pattern
Strategy and Template Pattern
 
TY.BSc.IT Java QB U6
TY.BSc.IT Java QB U6TY.BSc.IT Java QB U6
TY.BSc.IT Java QB U6
 

Dernier

Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Victor Rentea
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
panagenda
 

Dernier (20)

Six Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal OntologySix Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal Ontology
 
Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​
 
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
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
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot ModelMcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
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
 
WSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering DevelopersWSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering Developers
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf
 

Rules Engine - java(Drools) & ruby(ruleby)

  • 1. Rule Engine– Java & Ruby Drools & Ruleby Ing. Martín Cabrera martin.cabrera@moove-it.com Moove-IT
  • 2. Content  Rules Engine ? What is this ?  When to use ?  RETE algorithm  In Java - JBoss Drools  features  Syntax  In ruby ?
  • 3. Motor de Reglas ¿what a #@!$ ? Application Rule engine Rule def. knowledge base Rule def
  • 4. When to use?  Infrastructure decoupled from the source  System to allow the final user to define their rules and change them dynamically  Developers are not the primary responsibility for changing rules  Moderate or high complexity of business rules  Performance !  Conclusion: down the rules of your system, so that they can be reused, decouple the code and allow the user to know the rules ... to modify !
  • 5. Tipical Code 01 if ((user.isMemberOf(AdministratorGroup) && user.isMemberOf(teleworkerGroup)) || 02 user.isSuperUser() { 03 // more checks for specific cases 04 if ((expenseRequest.code().equals("B203") || 05 (expenseRequest.code().equals("A903") && (totalExpenses < 200) && 06 (bossSignOff > totalExpenses)) && (deptBudget.notExceeded)) { 07 // issue payments 08 } 09 else if { 10 // check lots of other conditions 11 } 12 } Change this rules ! ... %&”@ ! 13 else { 14 // even more business logic 15 } 16 }
  • 6. Rete Algorithm – the Solution !  Pattern matching algorithm for implementing production rule systems (wikipedia)  http://en.wikipedia.org/wiki/Rete_algorithm  replaces if ... Then with an optimized logic network
  • 7. Rete 2  RETE – characteristics:  It reduces or eliminates certain types of redundancy through the use of node sharing.  It stores partial matches when performing joins between different fact types.  It allows for efficient removal of memory elements when facts are retracted from working memory.  Widely used to implement matching functionality within pattern- matching engines that exploit a match-resolve-act cycle to support forward and backward chaining and inferencing.  Forward-chaining (facts -> goals)  Backguard chaining (goals -> facts)
  • 8. Drools –  http://jboss.org/drools  Introduction video - http://blog.athico.com/2010/03/fosdem-50-minute-introduction-into.h  Introduction  Rules engine framework for java  It is used in other jboss projects like JBPM, SEAM, Jboss ESB and others  The rules can be written in Java, Python, Groovy Ruby and your own rule language  Jboss tools – plugin Eclipse to use this framework
  • 10. Syntax or rules definition rule “<name>” <attribute> <value> when <LHS> then <RHS> end
  • 11. Example – rule definition rule.drl package com.mooveit.rule import com.mooveit.rule.Global global Global global; rule "r1 - first rule" when instance : Entity( field1 > 2010) then ... end
  • 12. Example Business Action 1 StatefulSession session = getRulesBase().newStatefulSession(); session.setGlobal("rulesImpl", this); session.insert(instance); session.fireAllRules(); 2 3 knowledge base +instance Execute the “then” part for the instance that match the facts
  • 13. Drools Schema Rules files Repository of instances assert modify retract
  • 14. JBoss Rules Overview Agenda Rule Activation Rule Rule 1.Parse DRL RuleBase Rule Fact Rule Rule Activation Fact 2. Create Rule Fact Fact Fact Fact 3. Assert Facts WorkingMemory Fact Fact Fact Fact Fact es Fact ul R Fact ll A re Rule (5) activation Fi Rule -> consequence 4. Rule Rule Rule
  • 15. Examples in our projects  (demo)
  • 17. Rules Engine In ruby  Ruleby - https://github.com/codeaspects/ruleby  Rule engine for Ruby  Active project but with few people dedicated  October 11 of 2010 last push in the master branch  Install: gem install ruleby  Others  Ruby Rools - http://rools.rubyforge.org/  Last activity (ago 2009 in rools users)  Status: Beta  2 members  A few projects without activity: rein, ruby-rules  Treetop  language for describing languages  It's not a pure rule engine ... but can serve
  • 18. Ruleby Description  Provide a pure Ruby Domain Specific Language (DSL) rule [m.status == :HELLO] do |v| puts v[:m].message end  (LHS) Left hand side of the production (the ‘when’) is represented by the Array parameter  (RHS) The right hand side (the ‘then’) is represented by the block. engine :hello_engine do |e| HelloWorldRulebook.new(e).rules assert e, Message.new(:HELLO, ‘Hello World’) e.match end  Result:Hello World
  • 19. Ruleby links  The Ruleby DSL for more information.  https://github.com/codeaspects/ruleby/wiki/The-Ruleby  Download  http://gemcutter.org/gems/ruleby  User Group  http://groups-beta.google.com/group/ruleby