<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Drools</title><link rel="stylesheet" href="../shared/css/html.css" type="text/css"><meta name="generator" content="DocBook XSL Stylesheets Vsnapshot_6797"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="book" lang="en"><div class="titlepage"><div><div><h1 class="title"><a name="d0e1"></a>Drools</h1></div><div><h2 class="subtitle">Drools Documentation</h2></div><div><div class="author"><h3 class="author"><span class="firstname">Mark</span> <span class="surname">Proctor</span></h3></div></div><div><div class="author"><h3 class="author"><span class="firstname">Michael</span> <span class="surname">Neale</span></h3></div></div><div><div class="author"><h3 class="author"><span class="firstname">Michael</span> <span class="surname">Frandsen</span></h3></div></div><div><div class="author"><h3 class="author"><span class="firstname">Sam</span> <span class="surname">Griffith Jr.</span></h3></div></div><div><div class="author"><h3 class="author"><span class="firstname">Edson</span> <span class="surname">Tirelli</span></h3></div></div><div><div class="author"><h3 class="author"><span class="firstname">Fernando</span> <span class="surname">Meyer</span></h3></div></div><div><div class="author"><h3 class="author"><span class="firstname">Kris</span> <span class="surname">Verlaenen</span></h3></div></div><div><p class="releaseinfo">4.0.4</p></div></div><hr></div><div class="toc"><dl><dt><span class="preface"><a href="#preface">Preface</a></span></dt><dt><span class="part"><a href="#d0e54">I. Reference Manual</a></span></dt><dd><dl><dt><span class="chapter"><a href="#d0e57">1. Drools 4.0 Release Notes</a></span></dt><dd><dl><dt><span class="section"><a href="#d0e60">1.1. What is new in Drools 4.0</a></span></dt><dd><dl><dt><span class="section"><a href="#d0e65">1.1.1. Language Expressiveness Enhancements</a></span></dt><dt><span class="section"><a href="#d0e102">1.1.2. Core Engine Enhancements</a></span></dt><dt><span class="section"><a href="#d0e142">1.1.3. IDE Enhancements</a></span></dt><dt><span class="section"><a href="#d0e158">1.1.4. Business Rules Management System - BRMS</a></span></dt><dt><span class="section"><a href="#d0e189">1.1.5. Miscellaneous Enhancements</a></span></dt></dl></dd><dt><span class="section"><a href="#d0e196">1.2. Upgrade tips from Drools 3.0.x to Drools 4.0.x</a></span></dt><dd><dl><dt><span class="section"><a href="#d0e203">1.2.1. API changes</a></span></dt><dd><dl><dt><span class="section"><a href="#d0e208">1.2.1.1. Working Memory creation</a></span></dt><dt><span class="section"><a href="#d0e227">1.2.1.2. Working Memory Actions</a></span></dt></dl></dd><dt><span class="section"><a href="#d0e260">1.2.2. Rule Language Changes</a></span></dt><dd><dl><dt><span class="section"><a href="#d0e265">1.2.2.1. Working Memory Actions</a></span></dt><dt><span class="section"><a href="#d0e297">1.2.2.2. Primitive support and unboxing</a></span></dt></dl></dd><dt><span class="section"><a href="#d0e319">1.2.3. Drools Update Tool</a></span></dt><dt><span class="section"><a href="#d0e345">1.2.4. DSL Grammars in Drools 4.0</a></span></dt><dt><span class="section"><a href="#d0e362">1.2.5. Rule flow Update for 4.0.2</a></span></dt></dl></dd></dl></dd><dt><span class="chapter"><a href="#d0e373">2. The Rule Engine</a></span></dt><dd><dl><dt><span class="section"><a href="#d0e376">2.1. What is a Rule Engine?</a></span></dt><dd><dl><dt><span class="section"><a href="#d0e379">2.1.1. Introduction and Background</a></span></dt></dl></dd><dt><span class="section"><a href="#d0e476">2.2. Why use a Rule Engine?</a></span></dt><dd><dl><dt><span class="section"><a href="#d0e497">2.2.1. Advantages of a Rule Engine</a></span></dt><dt><span class="section"><a href="#d0e540">2.2.2. When should you use a Rule Engine?</a></span></dt><dt><span class="section"><a href="#d0e574">2.2.3. When not to use a Rule Engine</a></span></dt><dt><span class="section"><a href="#d0e581">2.2.4. Scripting or Process Engines</a></span></dt><dt><span class="section"><a href="#d0e594">2.2.5. Strong and Loose Coupling</a></span></dt></dl></dd><dt><span class="section"><a href="#d0e599">2.3. Knowledge Representation</a></span></dt><dd><dl><dt><span class="section"><a href="#d0e603">2.3.1. First Order Logic</a></span></dt></dl></dd><dt><span class="section"><a href="#d0e665">2.4. Rete Algorithm</a></span></dt><dt><span class="section"><a href="#d0e738">2.5. The Drools Rule Engine</a></span></dt><dd><dl><dt><span class="section"><a href="#d0e741">2.5.1. Overview</a></span></dt><dt><span class="section"><a href="#d0e766">2.5.2. Authoring</a></span></dt><dt><span class="section"><a href="#d0e848">2.5.3. RuleBase</a></span></dt><dt><span class="section"><a href="#d0e900">2.5.4. WorkingMemory and Stateful/Stateless Sessions</a></span></dt><dd><dl><dt><span class="section"><a href="#d0e913">2.5.4.1. Facts</a></span></dt><dt><span class="section"><a href="#d0e918">2.5.4.2. Insertion</a></span></dt><dt><span class="section"><a href="#d0e934">2.5.4.3. Retraction</a></span></dt><dt><span class="section"><a href="#d0e941">2.5.4.4. Update</a></span></dt><dt><span class="section"><a href="#d0e948">2.5.4.5. Globals</a></span></dt><dt><span class="section"><a href="#d0e961">2.5.4.6. Shadow Facts</a></span></dt><dt><span class="section"><a href="#d0e986">2.5.4.7. Property Change Listener</a></span></dt><dt><span class="section"><a href="#d0e997">2.5.4.8. Initial Fact</a></span></dt></dl></dd><dt><span class="section"><a href="#d0e1004">2.5.5. StatefulSession</a></span></dt><dt><span class="section"><a href="#d0e1022">2.5.6. Stateless Session</a></span></dt><dt><span class="section"><a href="#d0e1065">2.5.7. Agenda</a></span></dt><dd><dl><dt><span class="section"><a href="#d0e1097">2.5.7.1. Conflict Resolution</a></span></dt><dt><span class="section"><a href="#d0e1110">2.5.7.2. Agenda Groups</a></span></dt><dt><span class="section"><a href="#d0e1119">2.5.7.3. Agenda Filters</a></span></dt></dl></dd><dt><span class="section"><a href="#d0e1149">2.5.8. Truth Maintenance with Logical Objects</a></span></dt><dd><dl><dt><span class="section"><a href="#d0e1180">2.5.8.1. Example Scenario</a></span></dt><dt><span class="section"><a href="#d0e1191">2.5.8.2. Important note: Equality for Java objects</a></span></dt></dl></dd><dt><span class="section"><a href="#d0e1198">2.5.9. Event Model</a></span></dt><dt><span class="section"><a href="#d0e1249">2.5.10. Sequential Mode</a></span></dt></dl></dd></dl></dd><dt><span class="chapter"><a href="#d0e1288">3. Installation and Setup (Core and IDE)</a></span></dt><dd><dl><dt><span class="section"><a href="#d0e1291">3.1. Installing and using</a></span></dt><dd><dl><dt><span class="section"><a href="#d0e1303">3.1.1. Dependencies and jars</a></span></dt><dt><span class="section"><a href="#d0e1329">3.1.2. Runtime</a></span></dt><dt><span class="section"><a href="#d0e1334">3.1.3. Installing IDE (Rule Workbench)</a></span></dt><dd><dl><dt><span class="section"><a href="#d0e1341">3.1.3.1. Installing GEF (a required dependency)</a></span></dt><dt><span class="section"><a href="#d0e1366">3.1.3.2. Installing from zip file</a></span></dt><dt><span class="section"><a href="#d0e1371">3.1.3.3. Installing from the update site</a></span></dt></dl></dd></dl></dd><dt><span class="section"><a href="#d0e1463">3.2. Setup from source</a></span></dt><dt><span class="section"><a href="#d0e1522">3.3. Source Checkout</a></span></dt><dt><span class="section"><a href="#d0e1573">3.4. Build</a></span></dt><dd><dl><dt><span class="section"><a href="#d0e1576">3.4.1. Building the Source</a></span></dt><dt><span class="section"><a href="#d0e1608">3.4.2. Building the Manual</a></span></dt></dl></dd><dt><span class="section"><a href="#d0e1680">3.5. Eclipse</a></span></dt><dd><dl><dt><span class="section"><a href="#d0e1683">3.5.1. Generating Eclipse Projects</a></span></dt