I can answer one of the questions: how to achieve rule template instantiation without spreadsheets for the actual parameters: Based on the API  in the preliminary 5.0.0 relase, I wrote a few simple classes that let you instantiate templates from Bean-style objects or property maps. I'm sure that this would meet your requirements since you can control the contents of the parameter objects any way you want, and you aren't stuck with a spreadsheet for instantiation.

I've passed this on to the Drools development team two or three of weeks ago, but I haven't seen it merged into the codebase yet. It definitly won't make the first "official" 5.0 release that'S due any minute now, but there's no reason why you shouldn't have these classes for experiments and planning, now.

-W



On Thu, Apr 23, 2009 at 10:26 AM, Tim Langford <tim.langford@gmail.com> wrote:
Hello All,

I am very new to Drools and thinking about using it in a project.
Apologies if these questions are naive - I have read the excellent
documentation and written and run some examples but am still feeling a
little lost.

Due to the nature of the existing system the project will depend on we
want to utilize the engine such that it operates and behaves like a
'function':

1) The system will always assert a single hierarchical object into the
working memory of the required type.
2) Global variables will be attached to the working memory to provide
visibility of system objects ; and also defined a set of return
objects (to be retrieved by the host system after execution.
3) The rules will be execute to produce a set of results that will
then be acted on externally by the host system.

For example:

We assert a 'Journey' (or another object) into a working memory with
the following rule:

rule "Journey No Charge Cancellation Option"
   dialect "java"
       when
               # There are at least "{days}" days before the journey begins
               $journey : Journey( )
               eval(daysToDeparture($itinerary) > 30)
       then
               >toDebugLog("Journey 'no charge' cancellation.", logger);
               >CancelOption option =
instanceOfCancellationOption(kcontext.getRule().getName(),
"CancelProcessor", 0);
               >cancelOptions.add(option);
end


function CancelOption instanceOfCancellationOption(
               String ruleName,
               String targetProcessor,
               Integer percentageBasedCharge) {

               CancelOption option = new CancelOption();
               option.setInvokingRule(ruleName);
               option.setTargetProcessor(targetProcessor);
               option.setDepositBasedChargePercentage(percentageBasedCharge);

               return option;
}


The system must support different users from different companies - so
these rules need to be 'templated'. We need to allow users to define
their own instances and constraints on any of the template rules
defined. Furthermore, they maybe from different countries so system
must use the DSL functionality to wrap the rules and parameters in
something meaningfully to them. Finally, we need to be to be able add
constraints over the rules to ensure users do not misconfigure the
rules and rules values (for example only a set of date ranges for
canceling a journey that don't overlap). We don't want to use the
spreadsheet templating mechanism. Rule configuration will have to be
provided in our weblication (and backed by the guvnor).

I could easily achieve this in pure java, groovy, etc. but would like
to condsider drools due to 1) Wanting it to be a bit more dynamic than
java (whilst not being so dynamic a user can easily make a mistake or
get confused); 2) Getting the DSL features; 3) taking advantage of the
all the rule versioning and management performed by the RMS.

Sorry for the long introduction. My questions are:

1) Is Drools an overkill such functionality? (I am no expert).
2) Is there an example that uses templating (without spreadsheets) and
DSL's somewhere? Does this work with the 'guvnor'? I have tested most
Drools functionality, but don't seem to be able to get a handle on
using all together to achieve this goal.


Any insight or recommendations will be greatully recieved.

Thanks

Tim
_______________________________________________
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users