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@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@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users