Tutorials and Examples for New Users
If you're just getting started with Drools and you'd like to see some working examples or need information about writing Java-based DRL files, then this is a good place to start. We've collected our most basic introductory documentation for new users and anyone evaluating Drools. If you have an idea for documentation that you'd like covered, please let us know.
Getting Examples Running
Running examples from CVS via Maven:
Running examples from CVS via Ant:
Running examples using precompiled jars from the command line:
Also shown are the maven/ant goals for the examples
- Conway's Game Of Life Example
- Escalation Example
- Fibonacci Example
- Hello World Example
- House Example
- Miss Manners Example
- Pet Store Example
- Prime Factors Example
- State Example
Tutorials and Examples by Category
Working with DRL Files
Recursion is where one rule can assert, modify and retract facts causing itself to be run.
An Event Model is implemented to allow listeners to be executed when certain events occur; assertObject, modifyObject and retractObject events and also fire events just before and just after the execution of consequence blocks.
A Duration can given to specify the length of time a rule must be true before it fires:
JSR-94: Java Rule Engine API
Drools is a JSR-94 compliant rule engine.
For instructions on how to run Drools under the JSR-94 Technology Compatibility Kit, please see:
Large # of Rules / Large # of Facts
The Prime Factors example was created to demonstrate Drools' ability to work with a large number of rules and a large number of facts. While the example is coded to work with 170 rules and 1000 facts, the example code can easily be extended to work with any arbitrarily large number of rules and/or facts.
GUI and Swing
While drools itself does not provide a GUI API it does provide the ability to link a GUI with a rules engine via Application Data and make a reference available to the JFrame to the Working Memory.
GUI is demonstrated in the following examples: