Table of Contents

Engine

Hammurapi Rules Engine is an implementation of the Specification. It features

Resources and downloads

Implementation notes

In the current release the following features are not implemented:

Configuration

Currently the engine doesn't support any rule set configuration parameters. These parameters shall be provided through configuration context at runtime. Support of assembly-time rule set configuration will be added in the future versions (see 28).

The code snippet below shows how to create a forward reasoning rule session:

RuleClient.java
ThreadPoolExecutor executor = new ThreadPoolExecutor(10, 15, 20, TimeUnit.SECONDS, new PriorityBlockingQueue<Runnable>());
SimpleMutableContext sc = new SimpleMutableContext();
sc.register(Executor.class, executor);	
factoryConfig.setContext(new CompositeContext(new DefaultContext(Tutorial.class.getClassLoader(), null), sc));		
ForwardReasoningSessionFactoryImpl<Relative> factory = new ForwardReasoningSessionFactoryImpl<Relative>(new File(args[0]), factoryConfig); 				
ForwardReasoningSession<Relative> session = factory.createSession(null);

Troubleshooting

There are the following ways for troubleshooting rule sets:

Logging

The engine uses java.util.logging.Logger.

To troubleshoot, enable logging at FINE level.

Create file logging.properties with the content as shown below

handlers= java.util.logging.ConsoleHandler

#handlers= java.util.logging.FileHandler, java.util.logging.ConsoleHandler

.level= INFO

############################################################
# Handler specific properties.
# Describes specific configuration info for Handlers.
############################################################

# default file output is in user's home directory.
java.util.logging.FileHandler.pattern = %h/java%u.log
java.util.logging.FileHandler.limit = 50000
java.util.logging.FileHandler.count = 1
java.util.logging.FileHandler.formatter = java.util.logging.XMLFormatter

# Limit the message that are printed on the console to INFO and above.
java.util.logging.ConsoleHandler.level = FINE
java.util.logging.ConsoleHandler.formatter = java.util.logging.SimpleFormatter


############################################################
# Facility specific properties.
# Provides extra control for each logger.
############################################################

# For example, set the com.xyz.foo logger to only log SEVERE
# messages:
com.hammurapi.level = FINE

Then add -Djava.util.logging.config.file=logging.properties to the list of start-up parameters.

1) When kbDoc is available, see 21