[rules-users] Hierarchical rules and rules selection

Wolfgang Laun wolfgang.laun at gmail.com
Thu Nov 5 02:21:03 EST 2009


There's two issues to consider.

First, the selection of a group of rules files. The usefulness of
restricting the
set of rules for a session depends on the way the RBS is going to be used,
such as: Does a user just deal with sports cars (and never with trucks)?
Only such a use case would merit a restriction.

Now, with all the rules being in the session, the other issue is how to
match the appropriate rule for a fact of type SportsCar. IMHO, this is best
achieved by creating the fact as an object of the appropriate subclass and
by writing the rules against these class names, e.g.

rule FastLane SportsCar( hp > 300,... ) then...
rule Convoy Truck( tons > 20,... ) then ...

I find this more readable than using the class property of any Object.
Drools lets you write rules using interfaces, too. Assuming that several
(but not all) vehicle types might be leased:

rule Leasing LeasingStatus( rateOverdue == true,... )

HTH
-W

On Wed, Nov 4, 2009 at 6:53 PM, D Brock <David_Brock at mentor.com> wrote:

>
> I need my end user to be able to specify a set of hierchical rules. As a
> contrived example, conceptually  we would define rule files called
> "Common.drl", "Truck.,drl", "Car.drl", "4-wheel drive.drl",
> "Sports-Car.drl".
>
> "4-wheel drive.drl" should include rules from "Truck.drl", which in turn
> should rules from "Common.drl".
> "Sports-Car.drl" should include rules from "Car.drl", which in turn should
> rules from "Common.drl".
>
> Now when a Vehicle object is inserted into memory, based on "class"
> property
> = "4-wheel drive" it would execute against the rules of "4-wheel drive.drl"
> and all of it's hierarchically included rules.
>
> Similarly when a Vehicle object is inserted into memory, based on "class"
> property = "Sports-Car" it would execute against the rules of
> "Sports-Car.drl" and all of it's hierarchically included rules.
>
> Is this possible, and if so how would it be best implemented?  It seems
> like
> there should be an "include" keyword in the DRL language that would include
> contents from another DRL file.  But even with this there would be the
> issue
> if selected which rules should be used.
>
> Would appreciate any help you can give....Thanks
>
> --
> View this message in context:
> http://old.nabble.com/Hierarchical-rules-and-rules-selection-tp26201268p26201268.html
> Sent from the drools - user mailing list archive at Nabble.com.
>
> _______________________________________________
> 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/20091105/6c84aae3/attachment.html 


More information about the rules-users mailing list