Book Image

Mastering JBoss Drools 6

By : Mariano De Maio, Mauricio Salatino, Esteban Aliverti
Book Image

Mastering JBoss Drools 6

By: Mariano De Maio, Mauricio Salatino, Esteban Aliverti

Overview of this book

Mastering JBoss Drools 6 will provide you with the knowledge to develop applications involving complex scenarios. You will learn how to use KIE modules to create and execute Business Rules, and how the PHREAK algorithm internally works to drive the Rule Engine decisions. This book will also cover the relationship between Drools and jBPM, which allows you to enrich your applications by using Business Processes. You will be briefly introduced to the concept of complex event processing (Drools CEP) where you will learn how to aggregate and correlate your data based on temporal conditions. You will also learn how to define rules using domain-specific languages, such as spreadsheets, database entries, PMML, and more. Towards the end, this book will take you through the integration of Drools with the Spring and Camel frameworks for more complex applications.
Table of Contents (18 chapters)
Mastering JBoss Drools 6
Credits
About the Authors
About the Reviewer
www.PacktPub.com
Preface
Index

Queries and backward-chaining


Queries were introduced in Chapter 5, Understanding KIE Sessions, as a way to retrieve information from a KIE Session. But queries are much more powerful than that in Drools. As a matter of fact, queries are the way Drools implements what is called backward-chaining reasoning. But before entering this new topic, and given that we were already talking about PHREAK, let's see how a regular query looks in the PHREAK network.

For this section of the book, we are going to introduce a new Java class that will be used to establish a whole-part relationship between Item objects. What this means it that an Item can now be composed of other Items:

The whole-part relationship between Items is modeled as a generic class, called IsPartOf. This generic class allows us to define non-intrusive relationships, not just between Items, but also between any other types of object in our model. As an example, if we want to specify the relation between a car, an engine, and a distributor...