Defining Rules
Overview

The I/O subsystem enables the Drools Rule Language (DRL) to be used to construct rules. Without the I/O subsystem, the only way to define rules is using the Rule Assembly API. Note that the I/O subsystem is simply a single possible implementation of a rule language. Different I/O implementations could interact with the same semantic modules and use a completely different rule syntax.

Interaction with the Semantic Module Framework

As the I/O subsystem only enables the Drools Rule Language, it has no directly usable syntax. Semantic modules must be loaded, by inclusion of their jars within the applicable classpath. Semantic modules are created using the Semantic Module Framework. The Java Semantic Module and Python Semantic Module are two of the low-level modules which are each tied to a language. The Base Semantic Module provides basic components, such as default Rule and Duration implementations.

The I/O subsystem therefore enables the usage of modules created with the Semantic Module Framework with a general XML-based syntax to operate the Rule Assembly API to build rules.

General Structure

The basic structure is illustrated in the example below. Highlighted tags represent rule primitives defined within some semantic module.

<rule-set xmlns="http://drools.org/rules">
  <rule ...>
    <parameter identifier="employee">
      <object-type ...>
      </object-type>
    </parameter>
    <consequence>
      ..
    </consequence>
    <duration .../>
  </rule>
<rule-set>
Available Semantic Modules

The distribution contains a handful of low-level language-based semantic modules. Others may be written and added to a Drools-based application at any time.