permaculture playing cards*
The moose likes Other Open Source Projects and the fly likes How to retrieve the collection of conditions using Drools ? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » Other Open Source Projects
Bookmark "How to retrieve the collection of conditions using Drools ?" Watch "How to retrieve the collection of conditions using Drools ?" New topic
Author

How to retrieve the collection of conditions using Drools ?

Kumar Raja
Ranch Hand

Joined: Mar 18, 2010
Posts: 518
    
    2

Hi All,

Using Drools, is there any way to retrieve all the conditions from the business rules document (excel sheet used). To be more specific, please refer to the attachment (The contents are deliberately removed).

As per the attachment, we have several conditions like cond1, cond2, cond3 and actions. As far as i understand drools (have not worked before), based on the condition, action is selected. i.e , if we select cond1, act1 is selected from "action2" column. Now, does drools provides any feature that lists out all the conditions, in some kind of a Set of strings etc.

The way I see this drools is, for a unique key, we get a row from excel. Initially, I was looking for a reverse lookup, i.e for a given action, find out the condition. This does not sound logical and makes sense, as we after all do not get the Key from value. So, then I'm thinking if there is any way, drools returns the list of all the conditions.

something, like Set<String> getConditions()

Is this possible at all ? if yes, can some body throw me some light.


[Thumbnail for rules.GIF]



Regards
KumarRaja

Kumar Raja
Ranch Hand

Joined: Mar 18, 2010
Posts: 518
    
    2

Any thoughts on this
Kumar Raja
Ranch Hand

Joined: Mar 18, 2010
Posts: 518
    
    2

I'm thinking may be if I put some additional details, I would get response earlier.

For suppose I have the rules as given below in an excel sheet

--------------------------------------------------------------------------------
CONDITION | ACTION |
--------------------------------------------------------------------------------
CONDITION 1 | ACTION1 |
CONDITION 2 | ACTION2 |
CONDITION 3 | ACTION3 |
CONDITION 4 | ACTION4 |
CONDITION 5 | ACTION5 |
--------------------------------------------------------------------------------

In our code, currently we load the rules from excel sheet as below



Now I suppose ruleBase has the collection of all rules, which I assume that each row from excel is stored as a row in ruleBase, atleast as per theory. Please correct me if I'm wrong here.

Now, if I wanted to load a object, say a Map<Condition, Action> from this ruleBase. Does Drools provide any api to handle such requirement? If Drools does not have anything already available, can we accomplish that from ruleBase object in other ways. Hope I made this question as clear as possible and I would appreciate, if someone could guide me here.

By the way, the version of drools being used is 4.0.7
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to retrieve the collection of conditions using Drools ?