This document provides an overview of rule-based programming and the Drools rule engine. It discusses how rule engines allow users to specify requirements and logic declaratively using rules. Drools is introduced as a popular open-source rule engine that uses the Rete algorithm for efficient forward-chaining rule execution. The document explains key concepts like the anatomy of rules, different rule types, and how Drools represents facts and rules. It also discusses when rule engines are suitable and compares their performance to other approaches.
Developing Configurable and High Performance Apps in Drools Ajay Mahajan
Rules Engine are being increasingly used in the enterprise applications to write complex business processing tasks in configurable manner without sacrificing performance. This session will focus on sharing experiences of using Open source Drools rules engine to write business logic for some banking applications. The session will also explore ways to write DSLs to make business rules very end user friendly and use of decision tables for users to give rules in excel
Developing Configurable and High Performance Apps in Drools Ajay Mahajan
Rules Engine are being increasingly used in the enterprise applications to write complex business processing tasks in configurable manner without sacrificing performance. This session will focus on sharing experiences of using Open source Drools rules engine to write business logic for some banking applications. The session will also explore ways to write DSLs to make business rules very end user friendly and use of decision tables for users to give rules in excel
Developing Complex Business Rules with Drools IntegrationBonitasoft
Create rich and dynamic rule driven business process applications with the Bonita Open Solution BPM Suite.
Learn how to add business rules to your process transitions easily with decision tables in the Bonita Studio for process modeling, and for more complex rules, use the Drools Connector to call shared rules.
Presented at Web Unleashed on September 16-17, 2015 in Toronto, Canada
More info at www.fitc.ca/webu
Why TypeScript?
with Jeff Francis
OVERVIEW
TypeScript is a type-checked superset of JavaScript that benefits medium-sized to complex JavaScript projects. Why would you want to learn a new language, instead of another JavaScript framework? You have all this existing JavaScript code, so how can you adopt something new without throwing the old stuff out?
This session is about the benefits of using TypeScript on top of JavaScript in your projects, and demonstrate step by step ways of migrating an existing JavaScript project to TypeScript. We will dive into code generated by the compiler and look at resources and tools that make working in TypeScript a pleasurable experience.
OBJECTIVE
To understand when it’s a good idea to use TypeScript.
TARGET AUDIENCE
JavaScript developers.
ASSUMED AUDIENCE KNOWLEDGE
Intermediate JavaScript experience.
FIVE THINGS AUDIENCE MEMBERS WILL LEARN
The basics of TypeScript – types, classes, modules, and functions
How TypeScript’s design makes getting started simple and helps projects
What compiled TypeScript looks like and how to debug
What tools can help take advantage of TypeScript’s type information
How to migrate a JavaScript project to TypeScript
Svelte is a new JS framework to build really reactive web pages. This is an introductory presentation on Svelte and its new features that come with the latest version.
NestJS (https://nestjs.com/) is a Node.js framework for building server-side applications. This slide give you a brief introduction of Nest, and shows the examples like Service, Middleware, and Pipe, etc.
Exploring the power of Gradle in android studio - Basics & BeyondKaushal Dhruw
In this presentation we will explore the official build system of android studio. Gradle. We will discuss about Gradle basics, Gradle Wrapper and its usage in android studio. We will explore the possibilities with gradle by covering beginner and advanced level topics.
What you can expect:
1. Just enough gradle to get started.
2. Creating simple and custom gradle tasks.
3. Gradle in android studio
4. Exploring product flavors
5. Using product flavors to our advantage.
6. facebook's stetho debug bridge and configuration via flavors.
Best practices in deploying IBM Operation Decision Manager Standard 8.8.0Pierre Feillet
This session was presented at Interconnect 2016 in session bdm-4361. It covers ODM 8.8.0 version. This deck explains the basics of ODM architecture and guides deployment for DevOps.
Building microservices with Scala, functional domain models and Spring BootChris Richardson
In this talk you will learn about a modern way of designing applications that’s very different from the traditional approach of building monolithic applications that persist mutable domain objects in a relational database.We will talk about the microservice architecture, it’s benefits and drawbacks and how Spring Boot can help. You will learn about implementing business logic using functional, immutable domain models written in Scala. We will describe event sourcing and how it’s an extremely useful persistence mechanism for persisting functional domain objects in a microservices architecture.
A walkthrough the main principles to reach solid NodeJS Applications with TypeScript language, Jest as Test Runner and NestJS as framework for structure.
Callbacks, Promises, and Coroutines (oh my!): Asynchronous Programming Patter...Domenic Denicola
This talk takes a deep dive into asynchronous programming patterns and practices, with an emphasis on the promise pattern.
We go through the basics of the event loop, highlighting the drawbacks of asynchronous programming in a naive callback style. Fortunately, we can use the magic of promises to escape from callback hell with a powerful and unified interface for async APIs. Finally, we take a quick look at the possibilities for using coroutines both in current and future (ECMAScript Harmony) JavaScript.
Explanation of the fundamentals of Redux with additional tips and good practices. Presented in the Munich React Native Meetup, so the sample code is using React Native. Additional code: https://github.com/nacmartin/ReduxIntro
Asynchronous JavaScript Programming with Callbacks & PromisesHùng Nguyễn Huy
This presentation is about JavaScript Promise. Topics covered in this session are:
1. Asynchronous processing in JavaScript
2. Callbacks and Callback hell
3. Promises arrive in JavaScript!
4. Constructing a Promise
5. Promise states
6. Promises chaining and transformation
7. Error handling
8. Promise.all() and Promise.race()
Drools is a Rule Engine that uses the rule-based approach to implement an Expert System
The inference engine matches the rules against the facts (objects) in memory and can match the next set of rules based on the changed facts.
Please use the presentation and the source code referred in the presentation to get started on what a rule engine is and how to use JBoss Drools for inference based rules using the Java programming language.
Developing Complex Business Rules with Drools IntegrationBonitasoft
Create rich and dynamic rule driven business process applications with the Bonita Open Solution BPM Suite.
Learn how to add business rules to your process transitions easily with decision tables in the Bonita Studio for process modeling, and for more complex rules, use the Drools Connector to call shared rules.
Presented at Web Unleashed on September 16-17, 2015 in Toronto, Canada
More info at www.fitc.ca/webu
Why TypeScript?
with Jeff Francis
OVERVIEW
TypeScript is a type-checked superset of JavaScript that benefits medium-sized to complex JavaScript projects. Why would you want to learn a new language, instead of another JavaScript framework? You have all this existing JavaScript code, so how can you adopt something new without throwing the old stuff out?
This session is about the benefits of using TypeScript on top of JavaScript in your projects, and demonstrate step by step ways of migrating an existing JavaScript project to TypeScript. We will dive into code generated by the compiler and look at resources and tools that make working in TypeScript a pleasurable experience.
OBJECTIVE
To understand when it’s a good idea to use TypeScript.
TARGET AUDIENCE
JavaScript developers.
ASSUMED AUDIENCE KNOWLEDGE
Intermediate JavaScript experience.
FIVE THINGS AUDIENCE MEMBERS WILL LEARN
The basics of TypeScript – types, classes, modules, and functions
How TypeScript’s design makes getting started simple and helps projects
What compiled TypeScript looks like and how to debug
What tools can help take advantage of TypeScript’s type information
How to migrate a JavaScript project to TypeScript
Svelte is a new JS framework to build really reactive web pages. This is an introductory presentation on Svelte and its new features that come with the latest version.
NestJS (https://nestjs.com/) is a Node.js framework for building server-side applications. This slide give you a brief introduction of Nest, and shows the examples like Service, Middleware, and Pipe, etc.
Exploring the power of Gradle in android studio - Basics & BeyondKaushal Dhruw
In this presentation we will explore the official build system of android studio. Gradle. We will discuss about Gradle basics, Gradle Wrapper and its usage in android studio. We will explore the possibilities with gradle by covering beginner and advanced level topics.
What you can expect:
1. Just enough gradle to get started.
2. Creating simple and custom gradle tasks.
3. Gradle in android studio
4. Exploring product flavors
5. Using product flavors to our advantage.
6. facebook's stetho debug bridge and configuration via flavors.
Best practices in deploying IBM Operation Decision Manager Standard 8.8.0Pierre Feillet
This session was presented at Interconnect 2016 in session bdm-4361. It covers ODM 8.8.0 version. This deck explains the basics of ODM architecture and guides deployment for DevOps.
Building microservices with Scala, functional domain models and Spring BootChris Richardson
In this talk you will learn about a modern way of designing applications that’s very different from the traditional approach of building monolithic applications that persist mutable domain objects in a relational database.We will talk about the microservice architecture, it’s benefits and drawbacks and how Spring Boot can help. You will learn about implementing business logic using functional, immutable domain models written in Scala. We will describe event sourcing and how it’s an extremely useful persistence mechanism for persisting functional domain objects in a microservices architecture.
A walkthrough the main principles to reach solid NodeJS Applications with TypeScript language, Jest as Test Runner and NestJS as framework for structure.
Callbacks, Promises, and Coroutines (oh my!): Asynchronous Programming Patter...Domenic Denicola
This talk takes a deep dive into asynchronous programming patterns and practices, with an emphasis on the promise pattern.
We go through the basics of the event loop, highlighting the drawbacks of asynchronous programming in a naive callback style. Fortunately, we can use the magic of promises to escape from callback hell with a powerful and unified interface for async APIs. Finally, we take a quick look at the possibilities for using coroutines both in current and future (ECMAScript Harmony) JavaScript.
Explanation of the fundamentals of Redux with additional tips and good practices. Presented in the Munich React Native Meetup, so the sample code is using React Native. Additional code: https://github.com/nacmartin/ReduxIntro
Asynchronous JavaScript Programming with Callbacks & PromisesHùng Nguyễn Huy
This presentation is about JavaScript Promise. Topics covered in this session are:
1. Asynchronous processing in JavaScript
2. Callbacks and Callback hell
3. Promises arrive in JavaScript!
4. Constructing a Promise
5. Promise states
6. Promises chaining and transformation
7. Error handling
8. Promise.all() and Promise.race()
Drools is a Rule Engine that uses the rule-based approach to implement an Expert System
The inference engine matches the rules against the facts (objects) in memory and can match the next set of rules based on the changed facts.
Please use the presentation and the source code referred in the presentation to get started on what a rule engine is and how to use JBoss Drools for inference based rules using the Java programming language.
Knowledge is Power: Visualizing JIRA's Performance DataAtlassian
When you have a JIRA instance with thousands of users and multiple plugins, you want your users to have seamless experience. Discover how our log analyzer tool gives you crystal ball-like insight into potential issues and overall performance, and how you can interpret performance graphs to make informed decisions and plan ahead.
Personalisatie is geen nieuwe manier van zakendoen maar een nieuwe manier
van denken: het vereist dat leveranciers hun klanten centraal brengen
in plaats van het eigen product of dienst. Ondersteun de klant individueel
op basis van voorkeuren en permissies. Veel CRM-implementaties, die
personalisatie als doel hebben, mislukken omdat er geen gebruik gemaakt
wordt van een Business Rules aanpak. Oplossingen worden nog steeds
geprogrammeerd wat de wendbaarheid van organisaties dramatisch doet
afnemen. Tijdens deze sessie wordt de toegevoegde waarde van een Business
Rules aanpak binnen een CRM oplossing besproken.
Presenter: Kenn Knowles, Software Engineer, Google & Apache Beam (incubating) PPMC member
Apache Beam (incubating) is a programming model and library for unified batch & streaming big data processing. This talk will cover the Beam programming model broadly, including its origin story and vision for the future. We will dig into how Beam separates concerns for authors of streaming data processing pipelines, isolating what you want to compute from where your data is distributed in time and when you want to produce output. Time permitting, we might dive deeper into what goes into building a Beam runner, for example atop Apache Apex.
The JBoss Drools platform at BeJUG: Drools Expert, Drools Guvnor, Drools IDE, Drools Planner, Drools Flow and Drools Fusion.
By Geoffrey De Smet and Kris Verlaenen.
Core Java Programming Language (JSE) : Chapter IV - Expressions and Flow Cont...WebStackAcademy
Expressions perform operations on data and move data around. Some expressions will be evaluated for their results, some for their side effects, some for both. An expression can have three kinds of result:
a value, such as the result of: (4 * i)
a variable, such as the result of: i = 4
nothing (in the case of an invocation of a method declared as void)
An expression that results in a variable is called an lvalue in C++ and many other languages. A variable expression in Java is the same thing, the Java Language Specification just uses the name variable instead of lvalue. Such an expression can be used on the left hand side of an assignment operator. Side effects come about when an expression includes an assignment, increment, decrement, or method invocation.
In Java language there are several keywords that are used to alter the flow of the program. Statements can be executed multiple times or only under a specific condition. The if, else, and switch statements are used for testing conditions, the while and for statements to create cycles, and the break and continue statements to alter a loop.
When the program is run, the statements are executed from the top of the source file to the bottom. One by one.
EffectiveUI Senior Developer RJ Owen and Software Architect Drew McLean explain the basics of Adobe Flex 360 Rules Engine. This presentation covers how to understand business rules processing theory and walks through a simple client-side rules processing engine written in Flex 3.0.
Smart solutions for productivity gain IQA conference 2017Steve Franklin
Presentation by Steve Franklin of Cement & Aggregate Consulting at the 2017 IQA conference in Toowoomba covering use of drones and quarry planning and scheduling tools.
Obey The Rules: Implementing a Rules Engine in FlexRJ Owen
A presentation I gave with Drew McLean at 360|Flex 2010 in San Jose. The presentation covers how to develop a client-side rules engine using Adobe Flex. We discuss rules engine theory and give three sample implementations. I apologize that I cannot upload source files here - please contact us for more information.
Determining the root cause of performance issues is a critical task for Operations. In this webinar, we'll show you the tools and techniques for diagnosing and tuning the performance of your MongoDB deployment. Whether you're running into problems or just want to optimize your performance, these skills will be useful.
Guidelines and Best Practices for Sencha ProjectsAmitaSuri
This presentation lists some useful guidelines and best practices to be followed while developing Sencha projects. These points would surely increase the performance of an Ext JS application in terms of memory and time.
Test Driven Development, or TDD, is the mainstream in many areas of software development, but what about the database? In this session, we explore TDD, the benefits of automated testing, and how testing data projects differs from other types of development. We introduce the tSQLt testing framework and demonstrate its use with a live coding example. Finally, we will discuss some lessons learned in doing TDD with SQL Server.
Originally presented by Steve Fibich and David Moore at Richmond SQL Server Users Group on January 11, 2018
JBoss Drools and Drools Fusion (CEP): Making Business Rules react to RTEtsurdilovic
This session will introduce JBoss Drools - Popular business rules engine and JBoss Drools Fusion - a complex event processing engine which is an extension to business rules.
Business Rules bring in a new paradigm of programming which helps effectively separate business policies and application code. Enterprises can now build agile applications that quickly react to change in market conditions or internal operations.
Bringing in complex event processing into the same paradigm, these applications can now react to real time events in the business environment. Essentially with the use of Business Rules and CEP enterprise applications can be lot more agile than ever before.
Grails has great performance characteristics but as with all full stack frameworks, attention must be paid to optimize performance. In this talk Lari will discuss common missteps that can easily be avoided and share tips and tricks which help profile and tune Grails applications.
Neoito — Design patterns and depenedency injectionNeoito
Dependency injection is a software design pattern that allows someone to remove hard-coded dependencies and makes it possible to change them. Dependencies can be injected to the object via the constructor or via defined method or a setter property.
Faiz Mohamed Haneef is currently the CEO and Chief Technology Architect at Neoito. He's a former Architect at Lowe's, Hallmark and Infosys.
Book: Software Architecture and Decision-MakingSrinath Perera
Uncertainty is the leading cause of mistakes made by practicing software architects. The primary goal of architecture is to handle uncertainty arising from user cases as well as architectural techniques. The book discusses how to make architectural decisions and manage uncertainty. From the book, You will learn common problems while designing a system, a default solution for each, more complex alternatives, and 5Q & 7P (Five Questions and Seven Principles) that help you choose.
Book, https://amzn.to/3v1MfZX
Blog: http://tinyurl.com/swdmblog
Six min video - https://youtu.be/jtnuHvPWlYU
We have critically evaluated how AI will shape integration use cases, their feasibility, and timelines. Emerging Technology Analysis Canvas (ETAC), a framework built to analyze emerging technologies, is the methodology of our study.
We observe that AI can significantly impact integration use cases and identify 13 AI-based use case classes for integration. Points to note include:
Enabling AI in an enterprise involves collecting, cleaning up, and creating a single representation of data as well as enforcing decisions and exposing data outside, each of which leads to many integration use cases. Hence, AI indirectly creates demand for integration.
AI needs data, which in some cases lead to significant competitive advantages. The need to collect data would drive vendors to offer most AI products in the cloud through APIs.
Due to lack of expertise and data, custom AI model building will be limited to large organizations. It is hard for small and medium size organization to build and maintain custom models.
The Role of Blockchain in Future IntegrationsSrinath Perera
We have critically evaluated blockchain-based integration use cases, their feasibility, and timelines. Emerging Technology Analysis Canvas (ETAC), a framework built to analyze emerging technologies, is the methodology of our study. Based on our analysis, we observe that blockchain can significantly impact integration use cases.
In our paper, we identify 30-plus blockchain-based use cases for integration and four architecture patterns. Notably, each use case we identified can be implemented using one of the architecture patterns. Furthermore, we also discuss challenges and risks posed by blockchains that would affect these architecture patterns.
Our webinar presents a critical analysis of serverless technology and our thoughts about its future. We use Emerging Technology Analysis Canvas (ETAC), a framework built to analyze emerging technologies, as the methodology of our study. Based on our analysis, we believe that serverless can significantly impact applications and software development workflows.
We’ve also made two further observations:
Limitations, such as tail latencies and cold starts, are not deal breakers for adoption. There are significant use cases that can work with existing serverless technologies despite these limitations.
We see a significant gap in required tooling and IDE support, best practices, and architecture blueprints. With proper tooling, it is possible to train existing enterprise developers to program with serverless. If proper tools are forthcoming, we believe serverless can cross the chasm in 3-5 years.
A detailed analysis can be found here: A Survey of Serverless: Status Quo and Future Directions. Join our webinar as we discuss this study, our conclusions, and evidence in detail.
1. Blockchain potential impact is real. If successful, Blockchain technologies can transform the way we live our day to day lives.
2. We believe technology is ready for limited applications in Digital Currency, Lightweight financial systems, Ledgers (of identity, ownership, status, and authority), Provenance (e.g. supply chains and other B2B scenarios) and Disintermediation, which we believe will happen in next three years.
3. However, with other use cases, blockchain faces significant challenges such as performance, irrevocability, need for regulation and lack of census mechanisms. These are hard problems and
4. It is not clear whether blockchain can sustain the current level of effort for extended period of 5+ years. There are many startups and they run the risk of running out of money before markets are ready. Failure of startups can inhibit further funding and investments.
5. Value and need of decentralization compared to centralized and semi-centralized alternatives is not clear.
A Visual Canvas for Judging New TechnologiesSrinath Perera
In the fast-changing technology world, the technology landscape shifts faster and faster. The agents of thses changes are new emerging technologies, which sometimes even create, destroy, or transform segments. In a shifting world, prevailing advantages are fleeting. Organizations that can master change and ride technology waves owns the future.
Not all emerging technologies live up to their promise. Every year, as a part of annual planning, most organizations need to decide relevance, impact, and the probability of success of emerging technologies and pick their bets. Although it is a regular decision there is no widely accepted framework for evaluating emerging technologies.
As a solution to this problem, we present “Emerging Technology Analysis Canvas” (ETAC), a framework to assess an individual emerging technology as a solution to this problem. Inspired by the Business Model Canvas, It represents different aspects of technology visually on a single page. This approach includes a set of questions that probe the technology arranged around a logical narrative. The visual representation is concise, compact, and comprehensible in a glance.
The talk discusses how analytics can attack privacy and what we can do about it. It discusses the legal responses (e.g. GDPR) as well technical responses ( differential privacy and homomorphic encryption).
The video is in https://www.facebook.com/eduscopelive/videos/314847475765297/ from 1.18.
Blockchain is often cited as one of the most impactful technology along with AI. It has attracted many startups, venture investments, and academic research. If successful, Blockchain technologies can transform the way, we live our day to day lives.
However, blockchain faces significant challenges such as performance, irrevocability, need for regulation and lack of census mechanisms. They are hard problems, and likely it will take at least 5-10 years to find answers to those problems.
Given the risk involved as well as the significant potential returns, we recommend a cautiously optimistic approach for blockchain with the focus on concrete use cases.
Today's Technology and Emerging Technology LandscapeSrinath Perera
We have seen the rise and fall of many technologies, some disappearing without a trace while others redefining the world. Collectively they have shaped our world beyond recognition. In this talk, Srinath will start with past technologies exploring their behavior. Then he will explore current middleware landscape, its composition, and relationships between different segments. He will discuss significant developments and discuss their future. Further, he will discuss emerging technologies, forces that shape them, and the promise of each technology, and finally, speculate about their evolution. You will walk away with knowledge on the evolution of middleware, the status quo, and discussion about how, at WSO2, we think those technologies will evolve.
Some died, some get by, but some have woven themselves to today's middleware so much that we do not notice them. The point I want to make is that not all emerging technologies are fads. Some are, and some are too early, like AI. But some are lasting.
The Rise of Streaming SQL and Evolution of Streaming ApplicationsSrinath Perera
First-generation stream processors, such as Apache Storm, wanted us to write code. It was a great start. However, when building real-world apps, which are used for a long time and evolve, writing code gets us into trouble.
If we want to query a database or query data stored in storage with Hadoop, we use SQL. Why can't we query data streaming using SQL? We can. Almost all open source stream processors, including Storm, Flink, and Kafka, have switched to SQL.
In this webinar, Srinath will talk about the evolution of stream processing, streaming SQL, the status quo, and what this means to stream applications. He will also dissect the experience of building streaming applications by exploring common patterns and pitfalls.
Analytics and AI: The Good, the Bad and the UglySrinath Perera
Analytics let us question the data, which in effect questions the world around us. This let us understand, monitor, and shape the world. AI let us discover connections, predict the possible futures and automate tasks.
These twin technologies can change the world around us. On one hand, make us efficient, connected, and fulfilled. At the same time, the change of status quo can replace jobs, affect lives and build biases into our systems that can marginalize millions.
In this talk, we will discuss core ideas behind analytics and AI, their possible impact, both good and bad outcomes, and challenges.
The dawn of digital businesses is upon us, with reimagined business models that make the best use of digital technologies such as automation, analytics, integration and cloud. Digital businesses are efficient, continuously optimizing, proactive, flexible and are able to fully understand their customers. Analytics is a key technology that helps in doing so. It acts as the eyes and ears of the system and provides a holistic view on the past and present so that decision-makers can predict what will happen in the future. This webinar will explore
Why becoming a digital business is not a choice
The role of analytics in digital transformation with examples
How best to leverage state of the art analytics technology
SoC Keynote:The State of the Art in Integration TechnologySrinath Perera
This talk discusses Outline of the state of the art of Enterprise Software and how we get there, as I see it. Also second part describes Ballerina, a new programming language WSO2 has built for Enterprise Computing.
It is presented as a Keynote at 11th Symposium and Summer School On Service-Oriented Computing.
2. Rule based Systems
● Expert Systems / Business
rules engine / Production
Systems / Inference Engines
are used to address rule
engines based on their
implementations and use.
● Something most people like to
have, although not many
people know why they need it.
3. Rules
● Allow users to specify the requirements/
knowledge about processing using
– Declarative (Say what should happen, not how to
do it)
– Logic based languages.
4. Types of Rules
● Four types of rules (from
http://www.w3.org/2000/10/swap/doc/rule-systems)
– Derivation or Deduction Rules – Each rules express if
some statements are true, another statement must be
true. Called logical implication. E.g. Prolog
– Transformation Rules- transform between knowledge
bases, e.g. theorem proving
– Integrity Constraints – verification rules
– Reaction or Event-Condition-Action (ECA) Rules –
includes a actions in addition to inference. e.g. Drools
5. Two types of Rule Engines
● Forward Chaining – starts with facts/data and
trigger actions or output conclusions
● Backward chaining – starts with goals and
search how to satisfy that (e.g. Prolog)
6. Production Systems
● Drools belongs to the category of rule engines called
production systems [1] (which execute actions based
on conditions)
● Drools use forward chaining[2] (start with data and
execute actions to infer more data )
● Priorities assigned to rules are used to decide the
order of rule execution
● They remember all results and use that to optimize
new derivations (dynamic programming like)
http://en.wikipedia.org/wiki/AI_production
http://en.wikipedia.org/wiki/Forward_chaining
7. Big Picture
● Usually a Rule engine
usually includes three
parts.
– Facts represented as
working memory
– Set of rules that
declaratively define
conditions or situations
e.g. Prolog route(X,Z) <-
road(X,Z)
– Actions executed or
inference derived based
on the rules
8. Why rule engines?
● Simplify complicated requirements with
declarative logic, raising the level of abstraction
of the system
● Externalize the business logic (which are too
dynamic) from comparatively static code base
● Intuitive and readable than code, easily
understood by business people/ non technical
users
http://en.wikipedia.org/wiki/AI_production
http://en.wikipedia.org/wiki/Forward_chaining
9. Why rule engines? [Contd.]
● Create complex interactions which can have
powerful results, even from simple facts and rules.
● Different approach to the problem, some problem
are much easier using rules.
● Can solve hard problems (Problems we only
understand partially)
● Fast and scalable when there is a data set that
changes little by little
10. When to use Rules?
● When there is no satisfactory traditional
programming approach to solve the problem!
● To separate code and business logic
● The problem is beyond any obvious algorithmic
solution. (not fully understood)
● When the logic changes often
● When Domain experts are none technical.
1. Real-World Rule Engines
http://www.infoq.com/articles/Rule-Engines
2. Why are business rules better than traditional code?
http://www.edmblog.com/weblog/2005/11/why_are_busines.html
3. Rules-based Programming with JBoss Rules/Drools
www.codeodor.com
11. When not to use rule engines?
● It is slower then usual code most of the time, so
unless one of the following is true is should not
be used
– Complexity of logic is hard to tackle
– Logic changes too often
– Required to use by non technical users
– It is a usecase where rules are faster.
● Interactions between rules could be quite
complex, and one mistake could change the
results drastically and unexpected way e.g.
recursive rules
● Due to above testing and debugging is required,
so if results are hard to verified it should not be
used.
12. Drools Rule Engine
● Forward chaining, production system based on
Rete algorithm.
● Written in Java, and support OOP based
model
● Open source/ Apache License compatible
● Backed up JBoss, also called JBoss rules
● Link http://jboss.org/drools
13. Model
● Facts as a Object repository of java objects
● New objects can be added, removed or updated
● support if <query> then <action> type rules
● Queries use OOP format
15. Anatomy of a Rule
● Has two parts
rule "rule-name"
when
<query in a Object query
language>
then
<any java code>
end
● When condition is satisfied, action is carried
out.
16. Business Rules
● Working Memory
– Insert, retract, update
● Stateful sessions
● Stateless sessions
● Queries -
QueryResults results = ksession.getQueryResults(
"my query", new Object[] { "string" } );
● Globals ksession.setGlobal("list", list);
● Agenda filters makes sure only selected rules are
fired. ksession.fireAllRules( new
RuleNameEndsWithAgendaFilter( "Test" ) );
17. Rete Algorithm
● Dr Charles L. Forgy's Ph.D. Thesis, 1974
● Creates a tree representing rules, and data
propagate through the tree and out put actions.
● Partial results are saved in memory.
18. A Sample Rule
Following rule increase the premium by 15% if driver is
less than 25 and drives a sport car.
rule "MinimumAge"
when
$d : Customer(age < 25)
$c : Car(vin=$d.vin && model =
“sport”)
then
c.IncreasePrimium(15);
end
19. Actions
● Any java code goes in the then clause
● Also support some level of scripts
● Operations on working memory
– update(object); will tell the engine that an object has
changed
– insert(new Something()); will place a new object of
your creation into the Working Memory.
– insertLogical(new Something()); is similar to insert,
but the object will be automatically retracted when
there are no more facts to support the truth of the
currently firing rule.
– retract(handle); removes an object from Working
Memory.
20. Rule Patterns
Following rule reject all customers whose age less than 17.
rule "MinimumAge"
when
c : Customer(age < 17)
then
c.reject();
end
Conditions support <, >, ==, <=, >=, matches / not matches,
contains / not contains. And following rules provide a discount
if customer is married or older than 25.
rule "Discount"
when
c : Customer( married == true || age > 25)
then
c.addDiscount(10);
end
21. Joins
Following rule increase the premium by 15% if driver is
less than 25 and drives a sport car.
rule "MinimumAge"
when
$d : Customer(age < 25)
$c : Car(vin=$d.vin && model =
“sport”)
then
c.IncreasePrimium(15);
end
23. OR, AND
● OR – true if either of the statements true
– E.g. Customer(age > 50) or Vehicle( year > 2000)
● AND – provide logical, if no connectivity is define
between two statements, “and” is assumed by default.
For an example.
c : Customer( timeSinceJoin > 2);
not (Accident(customerid == c.name))
and
c : Customer( timeSinceJoin > 2) and
not (Accident(customerid == c.name))
are the same.
24. eval(..)
● eval(boolean expressions) – with eval(..) any
Boolean expression can be used.
– E.g. C:Customer(age > 20)
eval(C.calacuatePremium() > 1000)
● Can not hold partial results for eval(..) so
Drools going to recalculate eval(..)
statements and what ever trigged from that.
● So it is going to be inefficient, so use
sparingly
25. Not
● Not – negation or none can be found. E.g.
not Plan( type = “home”)
is true if no plan of type home is found. Following
is true if customer has take part in no accidents.
rule "NoAccident"
when
c : Customer( timeSinceJoin > 2);
not (Accident(customerid == c.name))
then
c.addDiscount(10);
end
26. For all
● True if all objects selected by first part of the
query satisfies rest of the conditions. For an
example following rule give 25 discount to
customers who has brought every type of plans
offered.
rule "OtherPlans"
when
forall ($plan : PlanCategory() c : Customer(plans
contains $plan))
then
c.addDiscount(25);
end
27. Exists
● True if at least one matches the query,
● This is Different for just having Customer(), which is
like for each which get invoked for each matching set.
● Following rule give a discount for each family where
two members having plans
rule “FamilyMembers"
when
$c : Customer()
exists (Customer( name contains $c.family))
then
c.addDiscount(5);
end
28. From
● True if at least one matches the query,
● This is Different for just having Customer(), which is
like for each which get invoked for each matching
set.
● Following rule give a discount for each family where
two members having plans
rule "validate zipcode"
when
Person( $personAddress : address )
Address( zipcode == "23920W") from $personAddress
then
# zip code is ok
end
29. Collect
● True if at least one matches the query,
● This is Different for just having Customer(), which is
like for each which get invoked for each matching set.
● Following rule give a discount for each family where
two members having plans
rule "Raise priority if system has more than 3 pending alarms"
when
$system : System()
$alarms : ArrayList( size >= 3 )
from collect( Alarm( system == $system, status == 'pending' ) )
then
# Raise priority, because system $system has
# 3 or more alarms pending. The pending alarms
# are $alarms.
end
30. Accumulate
● True if at least one matches the query,
● This is Different for just having Customer(), which is like
for each which get invoked for each matching set.
● Following rule give a discount for each family where two
members having plans
rule "Apply 10% discount to orders over US$ 100,00"
when
$order : Order()
$total : Number( doubleValue > 100 )
from accumulate( OrderItem( order == $order, $value : value ),
init( double total = 0; ),
action( total += $value; ),
reverse( total -= $value; ),
result( total ) )
then
# apply discount to $order
end
31. Conflict resolution
• Each rule may define attributes There are other parameters
you can found from [1]. E.g.
rule "MinimumAge"
salience = 10
when
c : Customer(age < 17)
then
c.reject();
end
• salience define priority of the rule and decide their activation
order.
1. http://labs.jboss.com/drools/documentation.html
32. WSO2 Deployment as an
Example
● There are our product Instances (e.g. WSAS, Greg,
IS, ESB) etc, which has been mapped to a facts in
the rule system, and it is updated using a system
management solution.
● They have a role property, that says what is there
role. e.g. ESB role=”lb” means it is a load balancer.
● Each host is represented by Host() object, and each
server have a property called host.
● Each server has a state, which is Up, Down
33. Question 1:
● A system is considered healthy if there is One ESB,
two WSAS instances, one load balance instance, one
BPS server, and one Identity server.
● Write a rule to detect if system is healthy and print it.
When
ESB(role !=”lb”);
List(size ==2) from collect (WSAS());
ESB(role==”lb”);
BPS();
IS();
then
System.out.println(“System Healthy”);
end
34. Question 2:
● If any server has failed but the host is up, restart the
server using a rule. Assume there is
system.restart(service-name, host).
When
wsas:WSAS(state=”Down”);
host:Host(state=”Up” && wsas.host=name);
then
system.restart(wsas);
end
35. Question 3:
● If a host has failed, start the servers in the host using
a rule. Assume there is system.start(service-name,
host).
When
wsas:WSAS();
host:Host(state=”Down” && wsas.host=name);
then
system.start(wsas);
end
36. Question 4:
● Assume there are cluster of 10 WSAS nodes, if the
average TPS is > 300, add a new node to the cluster.
Assume WASA expose TPS via a property called tps.
rule "Apply 10% discount to orders over US$ 100,00"
when
$order : Order()
$total : Number( doubleValue > 300)
from accumulate( WSAS( $tps : tps),
init( double tpstot = 0; int count = 0; ),
action( tpstot += $tps; count++ ),
reverse( tpstot -= $tps; count-- ),
result( tpstot/count ) )
then
# apply discount to $order
end
37. Drools Performance
• Measuring Rule engine performance is tricky.
• Main factors are number of objects and number of rules. But results
depends on nature of rules.
• A user feedback [1] claims Drools about 4 times faster than JRules [4].
(SequentialRete)
rules Objects Drools JRules
1219 100 4ms/4ms 16ms/15ms
• [2] shows a comparison between Drools, Jess [5] and Microsoft rule
engine. Overall they are comparable in performance.
1. http://blog.athico.com/2007/08/drools-vs-jrules-performance-and-future.html
2. http://geekswithblogs.net/cyoung/articles/54022.aspx
1. Jess - http://herzberg.ca.sandia.gov/jess/
2. JRules http://www.ilog.com/products/jrules/
38. Drools Performance Contd.
I have ran the well known rule engine bench mark [1] implementation provided with Drools. (On linbox3 - 1GB memory, 4 CPU
•
3.20GHz )
Bench Marks Rule Count Object Time (ms)
Count
Waltz 31 958 1582
31 3873 9030
Waltz DB 34 393 420
34 697 956
34 1001 1661
34 1305 2642
http://www.cs.utexas.edu/ftp/pub/ops5-benchmark-suite/HOW.TO.USE
1.