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 ...

Get Mastering JBoss Drools 6 now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.