Drools - Architectural Summary

来源:百度文库 编辑:神马文学网 时间:2024/04/27 18:35:41
Architectural Summary
Drools is a forward chaining inference expert system implementation based on Charles Forgy‘sRete algorithm. Drools is modular in design with each part of the system being treated as a self contained projects, tied together via a top level project - this is made possible via maven‘s multi-project ability. While Maven is the preferred build system we maintain an Ant build system in parallel.
The Rete algorithm is contained in the drools-core module, org.drools.reteoo, it is mostly package protected and is exposed via the [SPI] layer. drools-smf,Semantics Module Framework, facilitates the creation of rule-sets via a collection of factories providing implementations for the various spi interfaces; although it is possible to create rules directly as implementations of the spi interfaces, referred to as "native" rules. drools-smf is configured at runtime, where the various semantic modules are registered, using the given namespace for lookup, against the appropriate factory within the semantic module repository.
Drools Modules

Drools currently has four semantic implementations; python, groovy, java and pojo which all depend on drools-base for common functionality. To compliment this we have drools-io which is an XML driven system to create rule-sets. drools-io itself knows nothing about these semantic implementations instead it creates a Configuration object ,a hierarchical representation of the element, which is then passed to a looked up factory. The factory is determined by the local name of the semantic module which itself retrieved from the semantic repository via the namespace.
Drools also offers a certified JSR-94 compatible API which is a standardized way to access a rule system - it does not standardize the way in which the rules themselves are written. It mostly takes the form of wrappers and helper methods for the drools-core and drools-io.
To understand how the drools modules relate to the user its helps to think of it in terms of layers.
Drools Layers

The above diagram shows that drools-core is the root of the system and, as previously mentioned, exposes itself via the spi layer. Code can be written directly against the spi layer or it can leverage the smf layer - where the smf layer includes the various implementations shown below. The smf layer can then be driven by the currently provided xml driver or third party driver - as drools matures it is hoped that none-xml based drivers with less verbosity and closer alignment with java will be offered.
Drools Semantic Modules

Drools also has two modules for examples which are covered inTutorials and Examples
drools-examples drools-examples-jdk5
_xyz