SlideShare a Scribd company logo
1 of 27
Overview
Rule
 Rule engine introduction & Working
 Why use a Rule Engine?
 ReteOO
 Introduction to Drools
 Drools Expert & Drools Rule Formats
 Drools Rule Language Details
 Drools Eclipse IDE &
 Drools Guvnor Overview
 Drools Flow Overview
 Rule Bean
 Constraints for above rule
 Object type constraint - Applicant Object Type.
 Field constraints - age < 18
 An object type constraint plus its zero or more field
constraints is referred to as a pattern.
 The process of matching patterns against the inserted data
is, referred to as pattern matching.
rule "Is of valid age"
when
$a : Applicant( age < 18 ) 
Constraints
then
$a.setValid( false );
 Action
end
 The rule engine is the computer program that
delivers Knowledge Representation and
Reasoning(KRR) functionality to the
developer. At a high level it has three
components:
 Ontology (“Things” e.g java Classes/Beans )
 Rules
 Data
 Separates application from dynamic logic
 Rules can be modified by different groups
 No need to recompile or redeploy
 All rules are in one place
Declarative Programming
– Readable and Anyone can easily modify rules.
Centralization of Knowledge
- Repository of business policy
Speed and Scalability
- Rete algorithm, Leaps algorithm
 Rete algorithm was invented by Dr. Charles
Forgy.
 Rete algorithm can be broken into 2 parts:
rule compilation and runtime execution.
 Rule base is compiled into discrimination
network.
Discrimination network is used to filter data as it propagates
through the network.
 rule 1
 when
 Cheese( $cheddar : name == "cheddar" )
 $person : Person( favouriteCheese ==
$cheddar )
 then
 System.out.println( $person.getName() + "
likes cheddar" );
 end
 rule 2
 when
 Cheese( $cheddar : name == "cheddar" )
 $person : Person( favouriteCheese != $cheddar )
 then
 System.out.println( $person.getName() + " not likes cheddar" );
 end
 Drools introduces the Business Logic integration
Platform which provides a unified and integrated
platform for Rules, Workflow and Event
Processing
 Drools consist out of several projects:
Drools Expert (rule Engine)
Drools Guvnor (Business Rule Manager)
jBPM (Process/Workflow)
Drools Fusion (event processing /temporal reasoning)
Drools Planner (automated planning)
 Drools has an enhanced and optimized
implementation of the Rete algorithm for object
oriented systems called as ReteOO.
 Drools Expert is a declarative, rule based, coding
environment.
 Drools Rule Formats
 Drools Rule Language (DRL)
 Domain-specific language (DSL)
 Decision tables
 Guided rule editor
 XML
 DSL are written in natural language statements.
 Domain experts (such as business analysts) can validate and do changes as per
requirements.
 DSL definitions consists of transformations from DSL "sentences" to DRL
constructs.
 DRL
Cheese(age < 5, price == 20, type=="stilton", country=="ch")
 DSL
[when]There is a Cheese with=Cheese()
[when]- age is less than {age}=age<{age}
[when]- type is '{type}'=type=='{type}‘
[when]- country equal to '{country}'=country=='{country}'
 DSLR
There is a Cheese with
- age is less than 42
- type is 'stilton'
 DRL & DSL mapping
[when]Something is {colour}=Something(colour=="{colour}")
 Decision tables are a "precise yet compact"
(ref. Wikipedia) way of representing
conditional logic, and are well suited to
business level rules.
 spreadsheet format (XLS), and CSV.
 Decision tables are not recommended for
rules that do not follow a set of templates, or
where there are a small number of rules
 Each row in spreadsheet is a rule
 Decision tables are essentially a tool to
generate DRL rules automatically
 A Knowledge Base is what we call our collection of
compiled definitions, such as rules and processes,
which are compiled using the KnowledgeBuilder
KnowledgeBuilder knowledgeBuilder = KnowledgeBuilderFactory.newKnowledgeBuilder();
Add DRL file to Knowledge Builder , it parses and compiles DRL
files
knowledgeBuilder.add(drlFileAsResource, ResourceType.DRL);
Collection pkgs = knowledgeBuilder.getKnowledgePackages();
knowledgeBase = KnowledgeBaseFactory.newKnowledgeBase();
knowledgeBase.addKnowledgePackages(pkgs);
 KnowledgeSession provides the way of
exposing objects to be ruled.
StatelessKnowledgeSession ksession = kbase.newStatelessKnowledgeSession();
Applicant applicant = new Applicant( “Rajesh Kumar", 16 );
ksession.execute( applicant );
assertFalse( applicant.isValid() );
StatelessKnowledgeSession ksession = kbase.newStatelessKnowledgeSession();
Applicant applicant = new Applicant( “Rajesh Kumar", 16 );
knowledgeSession.insert(applicant);
knowledgeSession.fireAllRules();
 Knowledge base can be updated inside rule’s body
insert()
 Inserted object will be used by rules engines inside current session
update()
 Updates existing in working memory object for the rest of rules
delete()
 Removed object will not be ruled on current execution
 The Eclipse based IDE provides users with an
environment to edit and test rules in various
formats, and integrate it deeply with their
applications.
 Required plugins
 GEF plugin , GEF is the Eclipse Graphical Editing Framework.

http://download.eclipse.org/tools/gef/updates/r
eleases/
 Drools Eclipse IDE plugin

http://download.jboss.org/drools/release/5.4.0.
Final/org.drools.updatesite/
 Go to windows preferences
 under the Drools category,
select "Installed Drools runtimes“
 use the default jar files as included in
the Drools Eclipse plugin
by clicking "Create a new Drools 5 runtime“
 Drools Homepage
 http://www.jboss.org/drools/
 Drools Blog
 http://blog.athico.com/
 Drools Chat
 irc.codehaus.org #drools
 Drools Mailing List
 rules-users@lists.jboss.org

More Related Content

What's hot

What's hot (20)

Drools Ecosystem
Drools EcosystemDrools Ecosystem
Drools Ecosystem
 
Drools 6.0 (Red Hat Summit)
Drools 6.0 (Red Hat Summit)Drools 6.0 (Red Hat Summit)
Drools 6.0 (Red Hat Summit)
 
Drools
DroolsDrools
Drools
 
Developing Complex Business Rules with Drools Integration
Developing Complex Business Rules with Drools IntegrationDeveloping Complex Business Rules with Drools Integration
Developing Complex Business Rules with Drools Integration
 
Rules Engine - java(Drools) & ruby(ruleby)
Rules Engine - java(Drools) & ruby(ruleby)Rules Engine - java(Drools) & ruby(ruleby)
Rules Engine - java(Drools) & ruby(ruleby)
 
Drools and jBPM 6 Overview
Drools and jBPM 6 OverviewDrools and jBPM 6 Overview
Drools and jBPM 6 Overview
 
Drools Expert and Fusion Intro : London 2012
Drools Expert and Fusion Intro  : London 2012Drools Expert and Fusion Intro  : London 2012
Drools Expert and Fusion Intro : London 2012
 
Drools et les moteurs de règles
Drools et les moteurs de règlesDrools et les moteurs de règles
Drools et les moteurs de règles
 
Introduction into ES6 JavaScript.
Introduction into ES6 JavaScript.Introduction into ES6 JavaScript.
Introduction into ES6 JavaScript.
 
Flask – Python
Flask – PythonFlask – Python
Flask – Python
 
Clean architecture with ddd layering in php
Clean architecture with ddd layering in phpClean architecture with ddd layering in php
Clean architecture with ddd layering in php
 
JUDCon London 2011 - Bin packing with drools planner by example
JUDCon London 2011 - Bin packing with drools planner by exampleJUDCon London 2011 - Bin packing with drools planner by example
JUDCon London 2011 - Bin packing with drools planner by example
 
7 rules of simple and maintainable code
7 rules of simple and maintainable code7 rules of simple and maintainable code
7 rules of simple and maintainable code
 
Angular Data Binding
Angular Data BindingAngular Data Binding
Angular Data Binding
 
Postgresql tutorial
Postgresql tutorialPostgresql tutorial
Postgresql tutorial
 
Class 7 - PHP Object Oriented Programming
Class 7 - PHP Object Oriented ProgrammingClass 7 - PHP Object Oriented Programming
Class 7 - PHP Object Oriented Programming
 
Asp.net MVC training session
Asp.net MVC training sessionAsp.net MVC training session
Asp.net MVC training session
 
Introduction to AngularJS
Introduction to AngularJSIntroduction to AngularJS
Introduction to AngularJS
 
Drools5 Community Training: Module 1.5 - Drools Expert First Example
Drools5 Community Training: Module 1.5 - Drools Expert First ExampleDrools5 Community Training: Module 1.5 - Drools Expert First Example
Drools5 Community Training: Module 1.5 - Drools Expert First Example
 
Vue.js
Vue.jsVue.js
Vue.js
 

Similar to Drools rule Concepts

Developing applications with rules, workflow and event processing (it@cork 2010)
Developing applications with rules, workflow and event processing (it@cork 2010)Developing applications with rules, workflow and event processing (it@cork 2010)
Developing applications with rules, workflow and event processing (it@cork 2010)
Geoffrey De Smet
 
Optimizing Application Architecture (.NET/Java topics)
Optimizing Application Architecture (.NET/Java topics)Optimizing Application Architecture (.NET/Java topics)
Optimizing Application Architecture (.NET/Java topics)
Ravi Okade
 
10 ways to make your code rock
10 ways to make your code rock10 ways to make your code rock
10 ways to make your code rock
martincronje
 
Dynamic Object-Oriented Requirements System (DOORS)
Dynamic Object-Oriented Requirements System (DOORS)Dynamic Object-Oriented Requirements System (DOORS)
Dynamic Object-Oriented Requirements System (DOORS)
David Groff
 

Similar to Drools rule Concepts (20)

JavaCro'14 - Drools Decision tables – form of human-readable rules – Dragan J...
JavaCro'14 - Drools Decision tables – form of human-readable rules – Dragan J...JavaCro'14 - Drools Decision tables – form of human-readable rules – Dragan J...
JavaCro'14 - Drools Decision tables – form of human-readable rules – Dragan J...
 
Developing applications with rules, workflow and event processing (it@cork 2010)
Developing applications with rules, workflow and event processing (it@cork 2010)Developing applications with rules, workflow and event processing (it@cork 2010)
Developing applications with rules, workflow and event processing (it@cork 2010)
 
Green dao
Green daoGreen dao
Green dao
 
Vital AI MetaQL: Queries Across NoSQL, SQL, Sparql, and Spark
Vital AI MetaQL: Queries Across NoSQL, SQL, Sparql, and SparkVital AI MetaQL: Queries Across NoSQL, SQL, Sparql, and Spark
Vital AI MetaQL: Queries Across NoSQL, SQL, Sparql, and Spark
 
Being RDBMS Free -- Alternate Approaches to Data Persistence
Being RDBMS Free -- Alternate Approaches to Data PersistenceBeing RDBMS Free -- Alternate Approaches to Data Persistence
Being RDBMS Free -- Alternate Approaches to Data Persistence
 
Schema webinar
Schema webinarSchema webinar
Schema webinar
 
Optimizing Application Architecture (.NET/Java topics)
Optimizing Application Architecture (.NET/Java topics)Optimizing Application Architecture (.NET/Java topics)
Optimizing Application Architecture (.NET/Java topics)
 
Document Validation in MongoDB 3.2
Document Validation in MongoDB 3.2Document Validation in MongoDB 3.2
Document Validation in MongoDB 3.2
 
Droolsand Rule Based Systems 2008 Srping
Droolsand Rule Based Systems 2008 SrpingDroolsand Rule Based Systems 2008 Srping
Droolsand Rule Based Systems 2008 Srping
 
Oleksandr Valetskyy - DI vs. IoC
Oleksandr Valetskyy - DI vs. IoCOleksandr Valetskyy - DI vs. IoC
Oleksandr Valetskyy - DI vs. IoC
 
Modern Database Development Oow2008 Lucas Jellema
Modern Database Development Oow2008 Lucas JellemaModern Database Development Oow2008 Lucas Jellema
Modern Database Development Oow2008 Lucas Jellema
 
NoSQL Endgame DevoxxUA Conference 2020
NoSQL Endgame DevoxxUA Conference 2020NoSQL Endgame DevoxxUA Conference 2020
NoSQL Endgame DevoxxUA Conference 2020
 
GDSC Backend Bootcamp.pptx
GDSC Backend Bootcamp.pptxGDSC Backend Bootcamp.pptx
GDSC Backend Bootcamp.pptx
 
Introduction to NoSQL Database
Introduction to NoSQL DatabaseIntroduction to NoSQL Database
Introduction to NoSQL Database
 
Drools & jBPM Info Sheet
Drools & jBPM Info SheetDrools & jBPM Info Sheet
Drools & jBPM Info Sheet
 
Rules With Drools
Rules With DroolsRules With Drools
Rules With Drools
 
Rules with Drools
Rules with DroolsRules with Drools
Rules with Drools
 
10 ways to make your code rock
10 ways to make your code rock10 ways to make your code rock
10 ways to make your code rock
 
Dynamic Object-Oriented Requirements System (DOORS)
Dynamic Object-Oriented Requirements System (DOORS)Dynamic Object-Oriented Requirements System (DOORS)
Dynamic Object-Oriented Requirements System (DOORS)
 
Integrating DROOLS With Mule ESB
Integrating DROOLS With Mule ESBIntegrating DROOLS With Mule ESB
Integrating DROOLS With Mule ESB
 

More from RaviShankar Mishra (7)

Mulesoft meetup 29.06
Mulesoft meetup 29.06Mulesoft meetup 29.06
Mulesoft meetup 29.06
 
Hyderbad meetup 19th jan
Hyderbad meetup 19th janHyderbad meetup 19th jan
Hyderbad meetup 19th jan
 
Token Management using Stormpath inside Mule
Token Management using Stormpath inside MuleToken Management using Stormpath inside Mule
Token Management using Stormpath inside Mule
 
Send email attachment using smtp in mule esb
Send email attachment using smtp in mule esbSend email attachment using smtp in mule esb
Send email attachment using smtp in mule esb
 
Data weave in Mule
Data weave in MuleData weave in Mule
Data weave in Mule
 
Creating restful api using mule esb
Creating restful api using mule esbCreating restful api using mule esb
Creating restful api using mule esb
 
Connecting to salesforce and using database in mule
Connecting to salesforce and using database in muleConnecting to salesforce and using database in mule
Connecting to salesforce and using database in mule
 

Recently uploaded

Cara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak Hamil
Cara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak HamilCara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak Hamil
Cara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak Hamil
Cara Menggugurkan Kandungan 087776558899
 
notes on Evolution Of Analytic Scalability.ppt
notes on Evolution Of Analytic Scalability.pptnotes on Evolution Of Analytic Scalability.ppt
notes on Evolution Of Analytic Scalability.ppt
MsecMca
 
Call Girls in South Ex (delhi) call me [🔝9953056974🔝] escort service 24X7
Call Girls in South Ex (delhi) call me [🔝9953056974🔝] escort service 24X7Call Girls in South Ex (delhi) call me [🔝9953056974🔝] escort service 24X7
Call Girls in South Ex (delhi) call me [🔝9953056974🔝] escort service 24X7
9953056974 Low Rate Call Girls In Saket, Delhi NCR
 
Standard vs Custom Battery Packs - Decoding the Power Play
Standard vs Custom Battery Packs - Decoding the Power PlayStandard vs Custom Battery Packs - Decoding the Power Play
Standard vs Custom Battery Packs - Decoding the Power Play
Epec Engineered Technologies
 
"Lesotho Leaps Forward: A Chronicle of Transformative Developments"
"Lesotho Leaps Forward: A Chronicle of Transformative Developments""Lesotho Leaps Forward: A Chronicle of Transformative Developments"
"Lesotho Leaps Forward: A Chronicle of Transformative Developments"
mphochane1998
 

Recently uploaded (20)

Thermal Engineering -unit - III & IV.ppt
Thermal Engineering -unit - III & IV.pptThermal Engineering -unit - III & IV.ppt
Thermal Engineering -unit - III & IV.ppt
 
Cara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak Hamil
Cara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak HamilCara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak Hamil
Cara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak Hamil
 
Bridge Jacking Design Sample Calculation.pptx
Bridge Jacking Design Sample Calculation.pptxBridge Jacking Design Sample Calculation.pptx
Bridge Jacking Design Sample Calculation.pptx
 
HAND TOOLS USED AT ELECTRONICS WORK PRESENTED BY KOUSTAV SARKAR
HAND TOOLS USED AT ELECTRONICS WORK PRESENTED BY KOUSTAV SARKARHAND TOOLS USED AT ELECTRONICS WORK PRESENTED BY KOUSTAV SARKAR
HAND TOOLS USED AT ELECTRONICS WORK PRESENTED BY KOUSTAV SARKAR
 
notes on Evolution Of Analytic Scalability.ppt
notes on Evolution Of Analytic Scalability.pptnotes on Evolution Of Analytic Scalability.ppt
notes on Evolution Of Analytic Scalability.ppt
 
Call Girls in South Ex (delhi) call me [🔝9953056974🔝] escort service 24X7
Call Girls in South Ex (delhi) call me [🔝9953056974🔝] escort service 24X7Call Girls in South Ex (delhi) call me [🔝9953056974🔝] escort service 24X7
Call Girls in South Ex (delhi) call me [🔝9953056974🔝] escort service 24X7
 
Hazard Identification (HAZID) vs. Hazard and Operability (HAZOP): A Comparati...
Hazard Identification (HAZID) vs. Hazard and Operability (HAZOP): A Comparati...Hazard Identification (HAZID) vs. Hazard and Operability (HAZOP): A Comparati...
Hazard Identification (HAZID) vs. Hazard and Operability (HAZOP): A Comparati...
 
data_management_and _data_science_cheat_sheet.pdf
data_management_and _data_science_cheat_sheet.pdfdata_management_and _data_science_cheat_sheet.pdf
data_management_and _data_science_cheat_sheet.pdf
 
Standard vs Custom Battery Packs - Decoding the Power Play
Standard vs Custom Battery Packs - Decoding the Power PlayStandard vs Custom Battery Packs - Decoding the Power Play
Standard vs Custom Battery Packs - Decoding the Power Play
 
kiln thermal load.pptx kiln tgermal load
kiln thermal load.pptx kiln tgermal loadkiln thermal load.pptx kiln tgermal load
kiln thermal load.pptx kiln tgermal load
 
"Lesotho Leaps Forward: A Chronicle of Transformative Developments"
"Lesotho Leaps Forward: A Chronicle of Transformative Developments""Lesotho Leaps Forward: A Chronicle of Transformative Developments"
"Lesotho Leaps Forward: A Chronicle of Transformative Developments"
 
Computer Networks Basics of Network Devices
Computer Networks  Basics of Network DevicesComputer Networks  Basics of Network Devices
Computer Networks Basics of Network Devices
 
Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...
Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...
Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...
 
Thermal Engineering Unit - I & II . ppt
Thermal Engineering  Unit - I & II . pptThermal Engineering  Unit - I & II . ppt
Thermal Engineering Unit - I & II . ppt
 
Online electricity billing project report..pdf
Online electricity billing project report..pdfOnline electricity billing project report..pdf
Online electricity billing project report..pdf
 
Computer Lecture 01.pptxIntroduction to Computers
Computer Lecture 01.pptxIntroduction to ComputersComputer Lecture 01.pptxIntroduction to Computers
Computer Lecture 01.pptxIntroduction to Computers
 
HOA1&2 - Module 3 - PREHISTORCI ARCHITECTURE OF KERALA.pptx
HOA1&2 - Module 3 - PREHISTORCI ARCHITECTURE OF KERALA.pptxHOA1&2 - Module 3 - PREHISTORCI ARCHITECTURE OF KERALA.pptx
HOA1&2 - Module 3 - PREHISTORCI ARCHITECTURE OF KERALA.pptx
 
Thermal Engineering-R & A / C - unit - V
Thermal Engineering-R & A / C - unit - VThermal Engineering-R & A / C - unit - V
Thermal Engineering-R & A / C - unit - V
 
Minimum and Maximum Modes of microprocessor 8086
Minimum and Maximum Modes of microprocessor 8086Minimum and Maximum Modes of microprocessor 8086
Minimum and Maximum Modes of microprocessor 8086
 
Double Revolving field theory-how the rotor develops torque
Double Revolving field theory-how the rotor develops torqueDouble Revolving field theory-how the rotor develops torque
Double Revolving field theory-how the rotor develops torque
 

Drools rule Concepts

  • 1.
  • 2. Overview Rule  Rule engine introduction & Working  Why use a Rule Engine?  ReteOO  Introduction to Drools  Drools Expert & Drools Rule Formats  Drools Rule Language Details  Drools Eclipse IDE &  Drools Guvnor Overview  Drools Flow Overview
  • 3.  Rule Bean  Constraints for above rule  Object type constraint - Applicant Object Type.  Field constraints - age < 18  An object type constraint plus its zero or more field constraints is referred to as a pattern.  The process of matching patterns against the inserted data is, referred to as pattern matching. rule "Is of valid age" when $a : Applicant( age < 18 )  Constraints then $a.setValid( false );  Action end
  • 4.  The rule engine is the computer program that delivers Knowledge Representation and Reasoning(KRR) functionality to the developer. At a high level it has three components:  Ontology (“Things” e.g java Classes/Beans )  Rules  Data
  • 5.
  • 6.  Separates application from dynamic logic  Rules can be modified by different groups  No need to recompile or redeploy  All rules are in one place Declarative Programming – Readable and Anyone can easily modify rules. Centralization of Knowledge - Repository of business policy Speed and Scalability - Rete algorithm, Leaps algorithm
  • 7.  Rete algorithm was invented by Dr. Charles Forgy.  Rete algorithm can be broken into 2 parts: rule compilation and runtime execution.  Rule base is compiled into discrimination network.
  • 8. Discrimination network is used to filter data as it propagates through the network.
  • 9.  rule 1  when  Cheese( $cheddar : name == "cheddar" )  $person : Person( favouriteCheese == $cheddar )  then  System.out.println( $person.getName() + " likes cheddar" );  end
  • 10.  rule 2  when  Cheese( $cheddar : name == "cheddar" )  $person : Person( favouriteCheese != $cheddar )  then  System.out.println( $person.getName() + " not likes cheddar" );  end
  • 11.  Drools introduces the Business Logic integration Platform which provides a unified and integrated platform for Rules, Workflow and Event Processing  Drools consist out of several projects: Drools Expert (rule Engine) Drools Guvnor (Business Rule Manager) jBPM (Process/Workflow) Drools Fusion (event processing /temporal reasoning) Drools Planner (automated planning)
  • 12.  Drools has an enhanced and optimized implementation of the Rete algorithm for object oriented systems called as ReteOO.  Drools Expert is a declarative, rule based, coding environment.  Drools Rule Formats  Drools Rule Language (DRL)  Domain-specific language (DSL)  Decision tables  Guided rule editor  XML
  • 13.
  • 14.  DSL are written in natural language statements.  Domain experts (such as business analysts) can validate and do changes as per requirements.  DSL definitions consists of transformations from DSL "sentences" to DRL constructs.  DRL Cheese(age < 5, price == 20, type=="stilton", country=="ch")  DSL [when]There is a Cheese with=Cheese() [when]- age is less than {age}=age<{age} [when]- type is '{type}'=type=='{type}‘ [when]- country equal to '{country}'=country=='{country}'  DSLR There is a Cheese with - age is less than 42 - type is 'stilton'  DRL & DSL mapping [when]Something is {colour}=Something(colour=="{colour}")
  • 15.
  • 16.
  • 17.  Decision tables are a "precise yet compact" (ref. Wikipedia) way of representing conditional logic, and are well suited to business level rules.  spreadsheet format (XLS), and CSV.  Decision tables are not recommended for rules that do not follow a set of templates, or where there are a small number of rules  Each row in spreadsheet is a rule  Decision tables are essentially a tool to generate DRL rules automatically
  • 18.
  • 19.
  • 20.
  • 21.
  • 22.  A Knowledge Base is what we call our collection of compiled definitions, such as rules and processes, which are compiled using the KnowledgeBuilder KnowledgeBuilder knowledgeBuilder = KnowledgeBuilderFactory.newKnowledgeBuilder(); Add DRL file to Knowledge Builder , it parses and compiles DRL files knowledgeBuilder.add(drlFileAsResource, ResourceType.DRL); Collection pkgs = knowledgeBuilder.getKnowledgePackages(); knowledgeBase = KnowledgeBaseFactory.newKnowledgeBase(); knowledgeBase.addKnowledgePackages(pkgs);
  • 23.  KnowledgeSession provides the way of exposing objects to be ruled. StatelessKnowledgeSession ksession = kbase.newStatelessKnowledgeSession(); Applicant applicant = new Applicant( “Rajesh Kumar", 16 ); ksession.execute( applicant ); assertFalse( applicant.isValid() ); StatelessKnowledgeSession ksession = kbase.newStatelessKnowledgeSession(); Applicant applicant = new Applicant( “Rajesh Kumar", 16 ); knowledgeSession.insert(applicant); knowledgeSession.fireAllRules();
  • 24.  Knowledge base can be updated inside rule’s body insert()  Inserted object will be used by rules engines inside current session update()  Updates existing in working memory object for the rest of rules delete()  Removed object will not be ruled on current execution
  • 25.  The Eclipse based IDE provides users with an environment to edit and test rules in various formats, and integrate it deeply with their applications.  Required plugins  GEF plugin , GEF is the Eclipse Graphical Editing Framework.  http://download.eclipse.org/tools/gef/updates/r eleases/  Drools Eclipse IDE plugin  http://download.jboss.org/drools/release/5.4.0. Final/org.drools.updatesite/
  • 26.  Go to windows preferences  under the Drools category, select "Installed Drools runtimes“  use the default jar files as included in the Drools Eclipse plugin by clicking "Create a new Drools 5 runtime“
  • 27.  Drools Homepage  http://www.jboss.org/drools/  Drools Blog  http://blog.athico.com/  Drools Chat  irc.codehaus.org #drools  Drools Mailing List  rules-users@lists.jboss.org