Tuesday, January 03, 2006

JBPM

JBPM is an open source business rules and workflow engine (from JBOSS) which impressed me.
You can download the starter kit and find instructions on how to use it.
Enjoy :-)


DROOLS III

In DROOLS we can give fields a constraint:
e.g. Where a rule applies to Person where attribute Person.name must equal "john" we can
express this as Person(name=="john")
Further we can bind a field to a variable as in
Person(name:name) we can then refer to the value of Person.name in our rule definition as name.
or even (if I have understood this correctly :-) Person(name:name="john") would mean in a rules constraint apply where Person.name=="john" and bind that to the variable name.
We can also bind facts to variables as in john:Person(name=="john").

You can find the whole of Mark's Javapolis presentation
in power point here
And in Acrobat here

Finally Mark mentioned that Drools 3 is aiming to have a rule repository which:
  • Handles rule definitions
  • Rules can be changed with no re-deploy
  • That uses JMS under the covers





Friday, December 23, 2005

DROOLS II

DROOLS takes a forward chaining approach e.g. rather than asking questions and infering facts it (Is it raining? You need an umbrella! It can just state "You need an umbrella"). It does this by implementing a Rete algorithm.


A Rule in DROOLS is described in XML and must have constraints on the Left Hand Side and actions on the right.

For example (taken from the DROOLS 1 minute tutorial)



< rule-set name="cheese rules"
xmlns="http://drools.org/rules"
xmlns:java="http://drools.org/semantics/java"
xmlns:xs="http://www.w3.org/2001/XMLSchema-instance"
xs:schemaLocation="http://drools.org/rules rules.xsd
http://drools.org/semantics/java java.xsd" >

< rule name="Bob Likes Cheese" >
< parameter identifier="bob" >
< class > org.drools.examples.simple.Bob < /class >
< /parameter >
< java:condition > bob.likesCheese() == true < /java:condition >
< java:consequence >
System.out.println( "Bob likes cheese." );
< /java:consequence >
< /rule >

< /rule-set >



In this example we state that for an instance of the Class Bob where the
likesCheese() returns true the Java code System.out.println("Likes
cheese") is executed.


This is clearly very powerful. We could envisage a situation where, say, a complex graph of objects that
represent the state of an Applicant was sent to a Java program.
The business rules that express the services for which that applicant was elligable
(e.g. Applicant is 21, lives in wales and is a housholder and not a current customer return houshold insurance products
with new customer and low crime discounts) could be expressed as a number of rules and when each one fires a
method on a business component is executed with a resultant set of appropriate products added to the object graph
for return to a client system.



Wednesday, December 21, 2005

DROOLS I

Mark Procter talked on DROOLS - his OS project recently taken up by JBoss.
This good lecture introduced the concepts of :
  • Declaritive Programming
  • Examples of rules, how they are declared in XML and
  • how conflicts between rules are resolved on the way by use of a Fibonacci example
  • The way rules are grouped into rule sets that become them part of the rule base, I jotted this diagram down in my pad to show the relationship (tho' it may not be correct)
  • (FYI I knockedup this diagram with gmodeler :-)
  • Gotta run now so more to come on this subject.....later




What this blog is for

This blog is the place I am using to review my experiences at Javapolis 2005 which I attended recently