[rules-users] DSL for multiple 'OR'

Stephen Masters stephen.masters at me.com
Tue Jan 31 07:34:03 EST 2012


Hi Mike,

I watched your blog/video about the BRL fragment functionality in decision tables (http://blog.athico.com/2012/01/guided-decision-table-supports-brl.html) a few weeks back. It sounds like it provides some of the template capabilities I remember from working with Fico Blaze Adviser a little while back. I was wondering why I was struggling to reproduce it, but I guess I need to wait for 5.4 to go live as I don't think using a beta version would be a great idea here!

I think that for now I'll opt for multiple rules, as there *should* not be too many. With some sensible use of categories and work items, hopefully I can keep the interface clean enough for now.

However I reckon I'll have a go at running up a 5.4.0.beta2 environment to try this out. I'd like to see whether I can take advantage of it to improve things ready for an update when things go final.

Thanks for the pointers.

Steve


On Jan 31, 2012, at 12:00 PM, Michael Anstis <michael.anstis at gmail.com> wrote:

Hi,

Starting from 5.4.0.beta2 you can use BRL fragments in decision tables.

This will allow you to define a column like this:-

$c : Cucumber()
Cucumber( this == $c, numberOfWormHoles > {@holes} )
Cucumber( this == $c, curvaturePerLengthUnit > {@curvature} )
Cucumber( this == $c, hue < {@minHue} || > {@maxHue} )

You will then be presented with columns for each of the "variables" ({@XXX} in the above).

If you do not specify *all* values for a pattern the pattern will not be included in the generated rules. For example:-

@holes=0, @curvature=<empty>, @minHue=90, @maxHue=150 would generate:-

$c : Cucumber()
Cucumber( this == $c, numberOfWormHoles > 0 )
Cucumber( this == $c, hue < 90 || > 150 )

You could equally define multiple BRL fragment columns like this:-

Column 1 - $c : Cucumber()
Column 2 - Cucumber( this == $c, numberOfWormHoles > {@holes} )
Column 3 - Cucumber( this == $c, curvaturePerLengthUnit > {@curvature} )
Column 4 - Cucumber( this == $c, hue < {@minHue} || > {@maxHue} )

Resulting in the same operation.

The || requirement makes using a decision table pre-5.4.0.beta2 impossible, however if you could re-think your logic to use &&'s it is possible but messier.

With kind regards,

Mike

2012/1/30 Stephen Masters <stephen.masters at me.com>
Hi folks,

I'm trying to create a DSL (to drive a Guvnor guided editor), for which a rule could be written as:
Given a cucumber
- containing one or more worm holes
- or with a curvature greater than 10mm per 10 cm length
- or with a hue of less than 90 degrees
- or with a hue of greater than 150 degrees
Do not put that cucumber on the supermarket shelf

(note: I'm actually developing a banking risk management system looking at different types of counterparty ratings, rather than a fruit&veg quality control system, but hopefully the above example is more readable!)

Is there a decent metaphor that could be used by a business user in Guvnor to manage such rules in one place? Or is it likely to be necessary to create multiple rules?

As far as I understand, every condition added to a rule through such DSLRs adds itself to the filter. i.e. They are AND rather than OR.

The other metaphor I could think of is the decision table as a neat interface for generating multiple rules, but that seems to be geared towards creating rules based on multiple values of a single attribute rather than multiple conditions.

I'm trying to keep the user interface as simple as possible, so any thoughts would be appreciated.

Cheers,

Steve


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


_______________________________________________
rules-users mailing list
rules-users at lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20120131/bd1ff11c/attachment.html 


More information about the rules-users mailing list