SlideShare ist ein Scribd-Unternehmen logo
1 von 24
Downloaden Sie, um offline zu lesen
 
                               
Drools5 Community Training
      Sponsored by Plugtree
Module 1.5: Drools Expert 
     First Example
   Drools5 Community Training
      version: 1.0-SNAPSHOT
     Release Date: 03/16/2011
Under The Creative Common License
Module 1.5: Drools Expert First
          Example
   Drools5 Community Training Course
    by Mauricio "Salaboy" Salatino and
    Esteban Aliverti is licensed under a
    Creative Commons Attribution 3.0
              Unported License.
  Based on a work at salaboy.wordpress.
                    com.
   Permissions beyond the scope of this
     license may be available at http:
         //salaboy.wordpress.com/.
Agenda

Introduction
Business Rule Structure
Drools Expert Example Scenario
Hands on lab
Drools Expert in 2 slides

The core of Drools
Lets us express our Knowledge -> Business Rules
Lets us create Sessions -> Our World
It will be in charge of making inferences between them and
firing the correspondent actions.
Let's see how it works!
Drools Expert in 2 slides
Business Rule Structure

rule "My Rule"

      when <LHS>
        Person(name == "John") <CEs>
      then <RHS>
        System.out.println("Hi John!"); <Actions>
end
Example Scenario
Example Model

We can define that a Pet will have a name, type and a position.

For this example a Person will have a Pet which he/she can call. And
this Person can also call the fire department.

The Firefighter will know how to retrieve a Cat from a Tree.
Example Rules

   Rule "Call Cat when it is in a tree"
    When my Cat is on a limb in a tree
    Then I will call my Cat

   Rule "Call the fire department"
    When my Cat is on a limb and
                   it doesn't come down when I call
    Then call the Fire Department

   Rule "Firefighter gets the cat down"
    When the Firefighter can reach the Cat
    Then the Firefighter retrieves the Cat
Technical View of  the Model
Technical View of  the Rules

rule "Call Cat when it is in a tree"
  when
    $p: Person($pet: pet, petCallCount == 0)
    $cat: Pet(this == $pet,
              position == "on a limb",
              type == PetType.CAT)
    then
       //$cat.getName() + " come down!"
       $p.setPetCallCount($p.getPetCallCount()+1);
       update($p);
end
                   Rule "Call Cat when it is in a tree"
                    When my Cat is on a limb in a tree
                    Then I will call my Cat
Technical View of  the Rules

rule "Call the fire department"
  when
    $p: Person($pet: pet, petCallCount > 0)
    $cat: Pet(this == $pet,
              position == "on a limb",
              type == PetType.CAT)
  then
    Firefighter firefighter
                   = new Firefighter("Fred");
    insert(firefighter);
end

                 Rule "Call the fire department"
                  When my Cat is on a limb and
                         it doesn't come down when I call
                  Then call the Fire Department
Technical View of  the Rules

rule "Firefighter gets the cat down"
  when
    $f: Firefighter()
    $p: Person($pet: pet, petCallCount > 0)
    $cat: Pet(this == $pet,
              position == "on a limb",
              type == PetType.CAT)
  then
    $cat.setPosition("on the street");
    retract($f);
    update($cat);
end
                  Rule "Firefighter gets the cat down"
                   When the Firefighter can reach the Cat
                   Then the Firefighter retrieves the Cat
Active Scenario in Java

For the previous rules to fire in our Java world we need to have:
   An instance of a Person that contains a relation to its Pet
   An instance of a Pet that is on a limb

  Person person = new Person("Salaboy!");
  Pet pet = new Pet("mittens", "on a limb",
                        Pet.PetType.CAT);
  person.setPet(pet);
API's Sneak Preview
Hands On

Project Name: drools5/00-Drools5-FirstExample
Sources: https://github.com/Salaboy/Drools_jBPM5-Training-
Examples
Characteristics:
   Java Project (jar)
   Uses Maven (pom.xml)
   Drools Dependencies (core, api, compiler)
   DRL File (src/test/resources/rules.drl)
To do:
   Run the test (src/test/java/org/plugtree/example/FirstExampleTest.java)
   Get familiar with the output
Hands On

Exercise 1:
   Create a new rule that inserts a Dog (on the street) when
   there is Cat on the street too.
   Create a new rule for the situation when a Cat and a Dog are
   on the street, the Dog should chase it up to the tree and then
   the Cat should climb the limb.
Hands On - Solution
rule "Cat on the street"
    when
         Pet(position == "on the street", type == PetType.CAT)
    then
         Pet dog = new Pet("doggy", "on the street" , PetType.DOG);
         insert (dog);
end


rule "Cat on the street and a dog is around"
    when
         $cat: Pet(position == "on the street", type == PetType.CAT)
         $dog: Pet(position == "on the street", type == PetType.DOG)
    then
              modify($cat){
                 setPosition("on the limb");
              }
              modify($dog){
                 setPosition("under the tree");
              }
end
Hands On - What Happen?

Exercise 1:
   What happens with the execution? Why?
   Try to find a solution
Briefing Up

Covered Topics:
   Quick review about Drools Expert
   Project Dependencies
   A simple example that shows the key things that we need
   to have to use Drools
 
              
Questions?
Enjoy! 
Questions and Feedback are always
appreciated!
Stay Tuned!
 
                     
    Contact us at
www.plugtree.com

Weitere ähnliche Inhalte

Was ist angesagt?

Easy data-with-spring-data-jpa
Easy data-with-spring-data-jpaEasy data-with-spring-data-jpa
Easy data-with-spring-data-jpaStaples
 
Fiware IoT_IDAS_intro_ul20_v2
Fiware IoT_IDAS_intro_ul20_v2Fiware IoT_IDAS_intro_ul20_v2
Fiware IoT_IDAS_intro_ul20_v2FIWARE
 
Drools 6.0 (Red Hat Summit)
Drools 6.0 (Red Hat Summit)Drools 6.0 (Red Hat Summit)
Drools 6.0 (Red Hat Summit)Mark Proctor
 
Form認証で学ぶSpring Security入門
Form認証で学ぶSpring Security入門Form認証で学ぶSpring Security入門
Form認証で学ぶSpring Security入門Ryosuke Uchitate
 
Introduction to Drools
Introduction to DroolsIntroduction to Drools
Introduction to Droolsgiurca
 
Data Persistence in Android with Room Library
Data Persistence in Android with Room LibraryData Persistence in Android with Room Library
Data Persistence in Android with Room LibraryReinvently
 
Spring - Part 1 - IoC, Di and Beans
Spring - Part 1 - IoC, Di and Beans Spring - Part 1 - IoC, Di and Beans
Spring - Part 1 - IoC, Di and Beans Hitesh-Java
 
[pgday.Seoul 2022] 서비스개편시 PostgreSQL 도입기 - 진소린 & 김태정
[pgday.Seoul 2022] 서비스개편시 PostgreSQL 도입기 - 진소린 & 김태정[pgday.Seoul 2022] 서비스개편시 PostgreSQL 도입기 - 진소린 & 김태정
[pgday.Seoul 2022] 서비스개편시 PostgreSQL 도입기 - 진소린 & 김태정PgDay.Seoul
 
REST APIs with Spring
REST APIs with SpringREST APIs with Spring
REST APIs with SpringJoshua Long
 
[2019] Spring JPA의 사실과 오해
[2019] Spring JPA의 사실과 오해[2019] Spring JPA의 사실과 오해
[2019] Spring JPA의 사실과 오해NHN FORWARD
 
Nestjs MasterClass Slides
Nestjs MasterClass SlidesNestjs MasterClass Slides
Nestjs MasterClass SlidesNir Kaufman
 
Introduction to Spring Boot!
Introduction to Spring Boot!Introduction to Spring Boot!
Introduction to Spring Boot!Jakub Kubrynski
 
Threads 04 Variáveis atômicas
Threads 04 Variáveis atômicasThreads 04 Variáveis atômicas
Threads 04 Variáveis atômicasHelder da Rocha
 
Spring: Overview do framework mais popular para desenvolvimento em Java
Spring: Overview do framework mais popular para desenvolvimento em JavaSpring: Overview do framework mais popular para desenvolvimento em Java
Spring: Overview do framework mais popular para desenvolvimento em JavaMariana de Azevedo Santos
 
Advanced PHPUnit Testing
Advanced PHPUnit TestingAdvanced PHPUnit Testing
Advanced PHPUnit TestingMike Lively
 
Threads 10: CompletableFuture
Threads 10: CompletableFutureThreads 10: CompletableFuture
Threads 10: CompletableFutureHelder da Rocha
 

Was ist angesagt? (20)

Spring data jpa
Spring data jpaSpring data jpa
Spring data jpa
 
Easy data-with-spring-data-jpa
Easy data-with-spring-data-jpaEasy data-with-spring-data-jpa
Easy data-with-spring-data-jpa
 
Fiware IoT_IDAS_intro_ul20_v2
Fiware IoT_IDAS_intro_ul20_v2Fiware IoT_IDAS_intro_ul20_v2
Fiware IoT_IDAS_intro_ul20_v2
 
Drools 6.0 (Red Hat Summit)
Drools 6.0 (Red Hat Summit)Drools 6.0 (Red Hat Summit)
Drools 6.0 (Red Hat Summit)
 
Form認証で学ぶSpring Security入門
Form認証で学ぶSpring Security入門Form認証で学ぶSpring Security入門
Form認証で学ぶSpring Security入門
 
Introduction to Drools
Introduction to DroolsIntroduction to Drools
Introduction to Drools
 
Spring Data JPA
Spring Data JPASpring Data JPA
Spring Data JPA
 
Data Persistence in Android with Room Library
Data Persistence in Android with Room LibraryData Persistence in Android with Room Library
Data Persistence in Android with Room Library
 
Spring - Part 1 - IoC, Di and Beans
Spring - Part 1 - IoC, Di and Beans Spring - Part 1 - IoC, Di and Beans
Spring - Part 1 - IoC, Di and Beans
 
[pgday.Seoul 2022] 서비스개편시 PostgreSQL 도입기 - 진소린 & 김태정
[pgday.Seoul 2022] 서비스개편시 PostgreSQL 도입기 - 진소린 & 김태정[pgday.Seoul 2022] 서비스개편시 PostgreSQL 도입기 - 진소린 & 김태정
[pgday.Seoul 2022] 서비스개편시 PostgreSQL 도입기 - 진소린 & 김태정
 
REST APIs with Spring
REST APIs with SpringREST APIs with Spring
REST APIs with Spring
 
[2019] Spring JPA의 사실과 오해
[2019] Spring JPA의 사실과 오해[2019] Spring JPA의 사실과 오해
[2019] Spring JPA의 사실과 오해
 
Nestjs MasterClass Slides
Nestjs MasterClass SlidesNestjs MasterClass Slides
Nestjs MasterClass Slides
 
Introduction to Spring Boot!
Introduction to Spring Boot!Introduction to Spring Boot!
Introduction to Spring Boot!
 
Threads 04 Variáveis atômicas
Threads 04 Variáveis atômicasThreads 04 Variáveis atômicas
Threads 04 Variáveis atômicas
 
Spring: Overview do framework mais popular para desenvolvimento em Java
Spring: Overview do framework mais popular para desenvolvimento em JavaSpring: Overview do framework mais popular para desenvolvimento em Java
Spring: Overview do framework mais popular para desenvolvimento em Java
 
Spring Boot
Spring BootSpring Boot
Spring Boot
 
Advanced PHPUnit Testing
Advanced PHPUnit TestingAdvanced PHPUnit Testing
Advanced PHPUnit Testing
 
Threads 10: CompletableFuture
Threads 10: CompletableFutureThreads 10: CompletableFuture
Threads 10: CompletableFuture
 
Lombok
LombokLombok
Lombok
 

Andere mochten auch

Open shift
Open shiftOpen shift
Open shiftmarcolof
 
JUDCon India 2012 Drools Expert
JUDCon  India 2012 Drools ExpertJUDCon  India 2012 Drools Expert
JUDCon India 2012 Drools ExpertMark Proctor
 
2012 02-04 fosdem 2012 - guvnor and j bpm designer
2012 02-04 fosdem 2012 - guvnor and j bpm designer 2012 02-04 fosdem 2012 - guvnor and j bpm designer
2012 02-04 fosdem 2012 - guvnor and j bpm designer marcolof
 
BRM 2012 (Decision Tables)
BRM 2012 (Decision Tables)BRM 2012 (Decision Tables)
BRM 2012 (Decision Tables)Michael Anstis
 
2012 02-04 fosdem 2012 - drools planner
2012 02-04 fosdem 2012 - drools planner2012 02-04 fosdem 2012 - drools planner
2012 02-04 fosdem 2012 - drools plannerGeoffrey De Smet
 
JUDCon India 2012 Drools Fusion
JUDCon  India 2012 Drools FusionJUDCon  India 2012 Drools Fusion
JUDCon India 2012 Drools FusionMark Proctor
 

Andere mochten auch (6)

Open shift
Open shiftOpen shift
Open shift
 
JUDCon India 2012 Drools Expert
JUDCon  India 2012 Drools ExpertJUDCon  India 2012 Drools Expert
JUDCon India 2012 Drools Expert
 
2012 02-04 fosdem 2012 - guvnor and j bpm designer
2012 02-04 fosdem 2012 - guvnor and j bpm designer 2012 02-04 fosdem 2012 - guvnor and j bpm designer
2012 02-04 fosdem 2012 - guvnor and j bpm designer
 
BRM 2012 (Decision Tables)
BRM 2012 (Decision Tables)BRM 2012 (Decision Tables)
BRM 2012 (Decision Tables)
 
2012 02-04 fosdem 2012 - drools planner
2012 02-04 fosdem 2012 - drools planner2012 02-04 fosdem 2012 - drools planner
2012 02-04 fosdem 2012 - drools planner
 
JUDCon India 2012 Drools Fusion
JUDCon  India 2012 Drools FusionJUDCon  India 2012 Drools Fusion
JUDCon India 2012 Drools Fusion
 

Ähnlich wie Drools5 Community Training: Module 1.5 - Drools Expert First Example

Class and Objects in PHP
Class and Objects in PHPClass and Objects in PHP
Class and Objects in PHPRamasubbu .P
 
Drools Introduction
Drools IntroductionDrools Introduction
Drools IntroductionJBug Italy
 
Object-oriented Programming-with C#
Object-oriented Programming-with C#Object-oriented Programming-with C#
Object-oriented Programming-with C#Doncho Minkov
 
Ian 20150116 java script oop
Ian 20150116 java script oopIan 20150116 java script oop
Ian 20150116 java script oopLearningTech
 
Architecture logicielle #3 : object oriented design
Architecture logicielle #3 : object oriented designArchitecture logicielle #3 : object oriented design
Architecture logicielle #3 : object oriented designJean Michel
 
Objects, Testing, and Responsibility
Objects, Testing, and ResponsibilityObjects, Testing, and Responsibility
Objects, Testing, and Responsibilitymachuga
 
Oops implemetation material
Oops implemetation materialOops implemetation material
Oops implemetation materialDeepak Solanki
 
The things we don't see – stories of Software, Scala and Akka
The things we don't see – stories of Software, Scala and AkkaThe things we don't see – stories of Software, Scala and Akka
The things we don't see – stories of Software, Scala and AkkaKonrad Malawski
 
Kotlin+MicroProfile: Enseñando trucos de 20 años a un nuevo lenguaje
Kotlin+MicroProfile: Enseñando trucos de 20 años a un nuevo lenguajeKotlin+MicroProfile: Enseñando trucos de 20 años a un nuevo lenguaje
Kotlin+MicroProfile: Enseñando trucos de 20 años a un nuevo lenguajeVíctor Leonel Orozco López
 
Module 10-Introduction to OOP.pptx
Module 10-Introduction to OOP.pptxModule 10-Introduction to OOP.pptx
Module 10-Introduction to OOP.pptxssuserec53e73
 
Everything is Permitted: Extending Built-ins
Everything is Permitted: Extending Built-insEverything is Permitted: Extending Built-ins
Everything is Permitted: Extending Built-insAndrew Dupont
 
Effective Java with Groovy - How Language Influences Adoption of Good Practices
Effective Java with Groovy - How Language Influences Adoption of Good PracticesEffective Java with Groovy - How Language Influences Adoption of Good Practices
Effective Java with Groovy - How Language Influences Adoption of Good PracticesNaresha K
 
14 Defining classes
14 Defining classes14 Defining classes
14 Defining classesmaznabili
 
Android & Kotlin - The code awakens #03
Android & Kotlin - The code awakens #03Android & Kotlin - The code awakens #03
Android & Kotlin - The code awakens #03Omar Miatello
 
Drools5 Community Training Module 3 Drools Expert DRL Syntax
Drools5 Community Training Module 3 Drools Expert DRL SyntaxDrools5 Community Training Module 3 Drools Expert DRL Syntax
Drools5 Community Training Module 3 Drools Expert DRL SyntaxMauricio (Salaboy) Salatino
 
What's up with Prototype and script.aculo.us?
What's up with Prototype and script.aculo.us?What's up with Prototype and script.aculo.us?
What's up with Prototype and script.aculo.us?Christophe Porteneuve
 

Ähnlich wie Drools5 Community Training: Module 1.5 - Drools Expert First Example (20)

Dog Ont In Dog
Dog Ont In DogDog Ont In Dog
Dog Ont In Dog
 
PHP Classes and OOPS Concept
PHP Classes and OOPS ConceptPHP Classes and OOPS Concept
PHP Classes and OOPS Concept
 
Class and Objects in PHP
Class and Objects in PHPClass and Objects in PHP
Class and Objects in PHP
 
10 classes
10 classes10 classes
10 classes
 
Drools Introduction
Drools IntroductionDrools Introduction
Drools Introduction
 
Object-oriented Programming-with C#
Object-oriented Programming-with C#Object-oriented Programming-with C#
Object-oriented Programming-with C#
 
Ian 20150116 java script oop
Ian 20150116 java script oopIan 20150116 java script oop
Ian 20150116 java script oop
 
Architecture logicielle #3 : object oriented design
Architecture logicielle #3 : object oriented designArchitecture logicielle #3 : object oriented design
Architecture logicielle #3 : object oriented design
 
Objects, Testing, and Responsibility
Objects, Testing, and ResponsibilityObjects, Testing, and Responsibility
Objects, Testing, and Responsibility
 
Oops implemetation material
Oops implemetation materialOops implemetation material
Oops implemetation material
 
The things we don't see – stories of Software, Scala and Akka
The things we don't see – stories of Software, Scala and AkkaThe things we don't see – stories of Software, Scala and Akka
The things we don't see – stories of Software, Scala and Akka
 
Kotlin+MicroProfile: Enseñando trucos de 20 años a un nuevo lenguaje
Kotlin+MicroProfile: Enseñando trucos de 20 años a un nuevo lenguajeKotlin+MicroProfile: Enseñando trucos de 20 años a un nuevo lenguaje
Kotlin+MicroProfile: Enseñando trucos de 20 años a un nuevo lenguaje
 
Module 10-Introduction to OOP.pptx
Module 10-Introduction to OOP.pptxModule 10-Introduction to OOP.pptx
Module 10-Introduction to OOP.pptx
 
Everything is Permitted: Extending Built-ins
Everything is Permitted: Extending Built-insEverything is Permitted: Extending Built-ins
Everything is Permitted: Extending Built-ins
 
Effective Java with Groovy - How Language Influences Adoption of Good Practices
Effective Java with Groovy - How Language Influences Adoption of Good PracticesEffective Java with Groovy - How Language Influences Adoption of Good Practices
Effective Java with Groovy - How Language Influences Adoption of Good Practices
 
14 Defining classes
14 Defining classes14 Defining classes
14 Defining classes
 
Backbone intro
Backbone introBackbone intro
Backbone intro
 
Android & Kotlin - The code awakens #03
Android & Kotlin - The code awakens #03Android & Kotlin - The code awakens #03
Android & Kotlin - The code awakens #03
 
Drools5 Community Training Module 3 Drools Expert DRL Syntax
Drools5 Community Training Module 3 Drools Expert DRL SyntaxDrools5 Community Training Module 3 Drools Expert DRL Syntax
Drools5 Community Training Module 3 Drools Expert DRL Syntax
 
What's up with Prototype and script.aculo.us?
What's up with Prototype and script.aculo.us?What's up with Prototype and script.aculo.us?
What's up with Prototype and script.aculo.us?
 

Mehr von Mauricio (Salaboy) Salatino

Lessons Learnt from creating platforms on Kubernetes @ Rejekts
Lessons Learnt from creating platforms on Kubernetes @ RejektsLessons Learnt from creating platforms on Kubernetes @ Rejekts
Lessons Learnt from creating platforms on Kubernetes @ RejektsMauricio (Salaboy) Salatino
 
Building Developer Experiences for the Cloud .pdf
Building Developer Experiences for the Cloud .pdfBuilding Developer Experiences for the Cloud .pdf
Building Developer Experiences for the Cloud .pdfMauricio (Salaboy) Salatino
 
KUBEDAY - JAPAN 2022 - Building FaaS Platforms.pdf
KUBEDAY - JAPAN  2022 - Building FaaS Platforms.pdfKUBEDAY - JAPAN  2022 - Building FaaS Platforms.pdf
KUBEDAY - JAPAN 2022 - Building FaaS Platforms.pdfMauricio (Salaboy) Salatino
 
The Challenges of building Cloud Native Platforms
The Challenges of building Cloud Native PlatformsThe Challenges of building Cloud Native Platforms
The Challenges of building Cloud Native PlatformsMauricio (Salaboy) Salatino
 
Functions Working Group Update - August 2022.pdf
Functions Working Group Update - August 2022.pdfFunctions Working Group Update - August 2022.pdf
Functions Working Group Update - August 2022.pdfMauricio (Salaboy) Salatino
 
Expanding Interoperability in the CD ecosystem - CDCon - Austin, TX - 2022
Expanding Interoperability in the CD ecosystem - CDCon - Austin, TX -  2022 Expanding Interoperability in the CD ecosystem - CDCon - Austin, TX -  2022
Expanding Interoperability in the CD ecosystem - CDCon - Austin, TX - 2022 Mauricio (Salaboy) Salatino
 
Spring I/O 2022: Knative and Spring - Bringing back the `func`
Spring I/O 2022: Knative and Spring - Bringing back the `func`Spring I/O 2022: Knative and Spring - Bringing back the `func`
Spring I/O 2022: Knative and Spring - Bringing back the `func`Mauricio (Salaboy) Salatino
 
Knative Maintainers KubeConEU 22 Knative Overview and Update
Knative Maintainers KubeConEU 22 Knative Overview and UpdateKnative Maintainers KubeConEU 22 Knative Overview and Update
Knative Maintainers KubeConEU 22 Knative Overview and UpdateMauricio (Salaboy) Salatino
 
CDEventsCon Expanding Interoperability in the CD ecosystem
CDEventsCon Expanding Interoperability in the CD ecosystemCDEventsCon Expanding Interoperability in the CD ecosystem
CDEventsCon Expanding Interoperability in the CD ecosystemMauricio (Salaboy) Salatino
 
A Polyglot Developer Experience on Kubernetes - KubeCon EU Valencia
A Polyglot Developer Experience on Kubernetes - KubeCon EU ValenciaA Polyglot Developer Experience on Kubernetes - KubeCon EU Valencia
A Polyglot Developer Experience on Kubernetes - KubeCon EU ValenciaMauricio (Salaboy) Salatino
 
KCD Guatemala - Abstracciones sobre Abstracciones
KCD Guatemala - Abstracciones sobre AbstraccionesKCD Guatemala - Abstracciones sobre Abstracciones
KCD Guatemala - Abstracciones sobre AbstraccionesMauricio (Salaboy) Salatino
 
KubeCon NA - 2021 Tools That I Wish Existed 3 Years Ago To Build a SaaS Offering
KubeCon NA - 2021 Tools That I Wish Existed 3 Years Ago To Build a SaaS OfferingKubeCon NA - 2021 Tools That I Wish Existed 3 Years Ago To Build a SaaS Offering
KubeCon NA - 2021 Tools That I Wish Existed 3 Years Ago To Build a SaaS OfferingMauricio (Salaboy) Salatino
 
Cloud Native Islamabad - Getting Closer to Continuous Delivery with Knative
Cloud Native Islamabad - Getting Closer to Continuous Delivery with KnativeCloud Native Islamabad - Getting Closer to Continuous Delivery with Knative
Cloud Native Islamabad - Getting Closer to Continuous Delivery with KnativeMauricio (Salaboy) Salatino
 

Mehr von Mauricio (Salaboy) Salatino (20)

Devoxx UK - Platforms on top of K8s
Devoxx UK - Platforms on top of K8sDevoxx UK - Platforms on top of K8s
Devoxx UK - Platforms on top of K8s
 
WTF_is_SRE_DeveloperEnabledPlatforms.pdf
WTF_is_SRE_DeveloperEnabledPlatforms.pdfWTF_is_SRE_DeveloperEnabledPlatforms.pdf
WTF_is_SRE_DeveloperEnabledPlatforms.pdf
 
Lessons Learnt from creating platforms on Kubernetes @ Rejekts
Lessons Learnt from creating platforms on Kubernetes @ RejektsLessons Learnt from creating platforms on Kubernetes @ Rejekts
Lessons Learnt from creating platforms on Kubernetes @ Rejekts
 
Building Developer Experiences for the Cloud .pdf
Building Developer Experiences for the Cloud .pdfBuilding Developer Experiences for the Cloud .pdf
Building Developer Experiences for the Cloud .pdf
 
KUBEDAY - JAPAN 2022 - Building FaaS Platforms.pdf
KUBEDAY - JAPAN  2022 - Building FaaS Platforms.pdfKUBEDAY - JAPAN  2022 - Building FaaS Platforms.pdf
KUBEDAY - JAPAN 2022 - Building FaaS Platforms.pdf
 
The Challenges of building Cloud Native Platforms
The Challenges of building Cloud Native PlatformsThe Challenges of building Cloud Native Platforms
The Challenges of building Cloud Native Platforms
 
Functions Working Group Update - August 2022.pdf
Functions Working Group Update - August 2022.pdfFunctions Working Group Update - August 2022.pdf
Functions Working Group Update - August 2022.pdf
 
JBCNConf 2022: Go vs Java (Kubernetes)
JBCNConf 2022: Go vs Java (Kubernetes)JBCNConf 2022: Go vs Java (Kubernetes)
JBCNConf 2022: Go vs Java (Kubernetes)
 
Expanding Interoperability in the CD ecosystem - CDCon - Austin, TX - 2022
Expanding Interoperability in the CD ecosystem - CDCon - Austin, TX -  2022 Expanding Interoperability in the CD ecosystem - CDCon - Austin, TX -  2022
Expanding Interoperability in the CD ecosystem - CDCon - Austin, TX - 2022
 
Spring I/O 2022: Knative and Spring - Bringing back the `func`
Spring I/O 2022: Knative and Spring - Bringing back the `func`Spring I/O 2022: Knative and Spring - Bringing back the `func`
Spring I/O 2022: Knative and Spring - Bringing back the `func`
 
KnativeCon 2022 - Knative Functions
KnativeCon 2022 - Knative FunctionsKnativeCon 2022 - Knative Functions
KnativeCon 2022 - Knative Functions
 
Knative Maintainers KubeConEU 22 Knative Overview and Update
Knative Maintainers KubeConEU 22 Knative Overview and UpdateKnative Maintainers KubeConEU 22 Knative Overview and Update
Knative Maintainers KubeConEU 22 Knative Overview and Update
 
CDEventsCon Expanding Interoperability in the CD ecosystem
CDEventsCon Expanding Interoperability in the CD ecosystemCDEventsCon Expanding Interoperability in the CD ecosystem
CDEventsCon Expanding Interoperability in the CD ecosystem
 
A Polyglot Developer Experience on Kubernetes - KubeCon EU Valencia
A Polyglot Developer Experience on Kubernetes - KubeCon EU ValenciaA Polyglot Developer Experience on Kubernetes - KubeCon EU Valencia
A Polyglot Developer Experience on Kubernetes - KubeCon EU Valencia
 
Pave the Golden Path On Your Internal Platform
Pave the Golden Path On Your Internal PlatformPave the Golden Path On Your Internal Platform
Pave the Golden Path On Your Internal Platform
 
Knative and Spring - Bringing back the func.pdf
Knative and Spring - Bringing back the func.pdfKnative and Spring - Bringing back the func.pdf
Knative and Spring - Bringing back the func.pdf
 
KCD Guatemala - Abstracciones sobre Abstracciones
KCD Guatemala - Abstracciones sobre AbstraccionesKCD Guatemala - Abstracciones sobre Abstracciones
KCD Guatemala - Abstracciones sobre Abstracciones
 
KubeCon NA - 2021 Tools That I Wish Existed 3 Years Ago To Build a SaaS Offering
KubeCon NA - 2021 Tools That I Wish Existed 3 Years Ago To Build a SaaS OfferingKubeCon NA - 2021 Tools That I Wish Existed 3 Years Ago To Build a SaaS Offering
KubeCon NA - 2021 Tools That I Wish Existed 3 Years Ago To Build a SaaS Offering
 
Cloud Native Islamabad - Getting Closer to Continuous Delivery with Knative
Cloud Native Islamabad - Getting Closer to Continuous Delivery with KnativeCloud Native Islamabad - Getting Closer to Continuous Delivery with Knative
Cloud Native Islamabad - Getting Closer to Continuous Delivery with Knative
 
Intro to the Cloud with Knative (Spanish)
Intro to the Cloud with Knative (Spanish) Intro to the Cloud with Knative (Spanish)
Intro to the Cloud with Knative (Spanish)
 

Kürzlich hochgeladen

TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc
 
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 TerraformAndrey Devyatkin
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
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 SavingEdi Saputra
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsJoaquim Jorge
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
 
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 2024Rafal Los
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...apidays
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdflior mazor
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodJuan lago vázquez
 
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 Processorsdebabhi2
 
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 businesspanagenda
 
HTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesHTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesBoston Institute of Analytics
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobeapidays
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
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.pdfsudhanshuwaghmare1
 
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 educationjfdjdjcjdnsjd
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 

Kürzlich hochgeladen (20)

TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
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
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
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
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
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
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
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
 
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
 
HTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesHTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation Strategies
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
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
 
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
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 

Drools5 Community Training: Module 1.5 - Drools Expert First Example

  • 1.     Drools5 Community Training Sponsored by Plugtree
  • 2. Module 1.5: Drools Expert  First Example Drools5 Community Training version: 1.0-SNAPSHOT Release Date: 03/16/2011 Under The Creative Common License
  • 3. Module 1.5: Drools Expert First Example Drools5 Community Training Course by Mauricio "Salaboy" Salatino and Esteban Aliverti is licensed under a Creative Commons Attribution 3.0 Unported License. Based on a work at salaboy.wordpress. com. Permissions beyond the scope of this license may be available at http: //salaboy.wordpress.com/.
  • 4. Agenda Introduction Business Rule Structure Drools Expert Example Scenario Hands on lab
  • 5. Drools Expert in 2 slides The core of Drools Lets us express our Knowledge -> Business Rules Lets us create Sessions -> Our World It will be in charge of making inferences between them and firing the correspondent actions. Let's see how it works!
  • 6. Drools Expert in 2 slides
  • 7. Business Rule Structure rule "My Rule" when <LHS> Person(name == "John") <CEs> then <RHS> System.out.println("Hi John!"); <Actions> end
  • 9. Example Model We can define that a Pet will have a name, type and a position. For this example a Person will have a Pet which he/she can call. And this Person can also call the fire department. The Firefighter will know how to retrieve a Cat from a Tree.
  • 10. Example Rules Rule "Call Cat when it is in a tree" When my Cat is on a limb in a tree Then I will call my Cat Rule "Call the fire department" When my Cat is on a limb and it doesn't come down when I call Then call the Fire Department Rule "Firefighter gets the cat down" When the Firefighter can reach the Cat Then the Firefighter retrieves the Cat
  • 11. Technical View of  the Model
  • 12. Technical View of  the Rules rule "Call Cat when it is in a tree" when $p: Person($pet: pet, petCallCount == 0) $cat: Pet(this == $pet, position == "on a limb", type == PetType.CAT) then //$cat.getName() + " come down!" $p.setPetCallCount($p.getPetCallCount()+1); update($p); end Rule "Call Cat when it is in a tree" When my Cat is on a limb in a tree Then I will call my Cat
  • 13. Technical View of  the Rules rule "Call the fire department" when $p: Person($pet: pet, petCallCount > 0) $cat: Pet(this == $pet, position == "on a limb", type == PetType.CAT) then Firefighter firefighter = new Firefighter("Fred"); insert(firefighter); end Rule "Call the fire department" When my Cat is on a limb and it doesn't come down when I call Then call the Fire Department
  • 14. Technical View of  the Rules rule "Firefighter gets the cat down" when $f: Firefighter() $p: Person($pet: pet, petCallCount > 0) $cat: Pet(this == $pet, position == "on a limb", type == PetType.CAT) then $cat.setPosition("on the street"); retract($f); update($cat); end Rule "Firefighter gets the cat down" When the Firefighter can reach the Cat Then the Firefighter retrieves the Cat
  • 15. Active Scenario in Java For the previous rules to fire in our Java world we need to have: An instance of a Person that contains a relation to its Pet An instance of a Pet that is on a limb Person person = new Person("Salaboy!"); Pet pet = new Pet("mittens", "on a limb", Pet.PetType.CAT); person.setPet(pet);
  • 17. Hands On Project Name: drools5/00-Drools5-FirstExample Sources: https://github.com/Salaboy/Drools_jBPM5-Training- Examples Characteristics: Java Project (jar) Uses Maven (pom.xml) Drools Dependencies (core, api, compiler) DRL File (src/test/resources/rules.drl) To do: Run the test (src/test/java/org/plugtree/example/FirstExampleTest.java) Get familiar with the output
  • 18. Hands On Exercise 1: Create a new rule that inserts a Dog (on the street) when there is Cat on the street too. Create a new rule for the situation when a Cat and a Dog are on the street, the Dog should chase it up to the tree and then the Cat should climb the limb.
  • 19. Hands On - Solution rule "Cat on the street" when Pet(position == "on the street", type == PetType.CAT) then Pet dog = new Pet("doggy", "on the street" , PetType.DOG); insert (dog); end rule "Cat on the street and a dog is around" when $cat: Pet(position == "on the street", type == PetType.CAT) $dog: Pet(position == "on the street", type == PetType.DOG) then modify($cat){ setPosition("on the limb"); } modify($dog){ setPosition("under the tree"); } end
  • 20. Hands On - What Happen? Exercise 1: What happens with the execution? Why? Try to find a solution
  • 21. Briefing Up Covered Topics: Quick review about Drools Expert Project Dependencies A simple example that shows the key things that we need to have to use Drools
  • 22.     Questions?
  • 23. Enjoy!  Questions and Feedback are always appreciated! Stay Tuned!
  • 24.     Contact us at www.plugtree.com