Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to retrieve the collection of conditions using Drools ?

 
Kumar Raja
Ranch Hand
Posts: 547
2
Hibernate Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
rules.GIF
[Thumbnail for rules.GIF]
 
Kumar Raja
Ranch Hand
Posts: 547
2
Hibernate Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Any thoughts on this
 
Kumar Raja
Ranch Hand
Posts: 547
2
Hibernate Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic