[rules-users] Writing rules using java from template

drools newbie techluver007 at gmail.com
Wed Oct 8 09:03:59 EDT 2008


Thanks again Mark.

If anyone had done this before, Please share your ideas.

If not, drools experts, Please give me some idea how we can do this. Since
I'm new to drools, I'm not sure where to start. I have short deadline.

Thanks in advance.

Mark Proctor wrote:
> 
> drools newbie wrote:
>> Thanks Mark.
>> I looked the unit tests. I'm looking for something different
>> I would have different rules that compares varying fields(rather fixed
>> set
>> of fields) and those are all defined in the database.
>> Ex:
>> 1.Rule1 conditions are f1='a' & f2='b' in db
>> 2. Rule2 conditions are f3='c' or f4='d' in db.
>>
>> how can I create rules programmatically and feed into rule engine?
>>   
> If you need something more flexible, you'll either need to write your 
> own or figure out how to extend drools-template - if you do the later, 
> please don't forget to send in a patch.
>> Please provide some guidance with examples?
>> Thanks again.
>>
>>
>>
>>
>> Mark Proctor wrote:
>>   
>>> drools newbie wrote:
>>>     
>>>> Hello,
>>>> Actually I want to do the same way Sandeep has described..
>>>> 1. Can someone please post some example to generate the drl from
>>>> template?
>>>>   
>>>>       
>>> Drools 5.0, which you can see in the M2 release, has drools-templates. 
>>> You'll need to look at the unit tests on how it works, but it's very
>>> simple.
>>>     
>>>> 2.This thread is more than a 1 1/2 year old. Does drools have in-built
>>>> template concept now instead of using a template langauge such 
>>>> velocity, freemarker or stringtemplate ? if so,please pinpoint on the
>>>> topic
>>>> name.
>>>>   
>>>>       
>>> yes drools-templates, which is built on MVEL.
>>>     
>>>> Thanks
>>>>
>>>>
>>>> Mark Proctor wrote:
>>>>   
>>>>       
>>>>> Just generate a drl from your model using a template langauge such 
>>>>> velocity, freemarker or stringtemplate. you can generate and load the 
>>>>> drl at runtime, this is what the decision table does. You can program 
>>>>> agains the API yourself, but its quite complex, and certainly not 
>>>>> recommended for a noobie.
>>>>>
>>>>> Mark
>>>>> Kolla, Sandeep wrote:
>>>>>     
>>>>>         
>>>>>> Hi Rahul,
>>>>>>
>>>>>> Its not about storing the whole file into the database.
>>>>>>
>>>>>> I would have a Table representing the parameteres required to 
>>>>>> construct a rule.
>>>>>>
>>>>>> For example.
>>>>>>
>>>>>> Tables:
>>>>>>
>>>>>> *RuleSetTable:*
>>>>>> Ruleset_id
>>>>>> Ruleset_name
>>>>>>
>>>>>> *RuleTable:*
>>>>>> Rule_id
>>>>>> Rule_name
>>>>>> Rule_saliance
>>>>>> Rule_condition
>>>>>> Rule_consequence
>>>>>> Ruleset_id
>>>>>>
>>>>>> Now while loading the rules the application basically should read
>>>>>> from 
>>>>>> the DB, and construct the rules, as everything required to construct 
>>>>>> the rules is avaliable in the tables.
>>>>>>
>>>>>> This requirement had come up because as the rules keep changing quite 
>>>>>> frequently, we don't want to bring down the application to load a new 
>>>>>> DRL file.
>>>>>>
>>>>>> Hope you understood what I want to achieve.
>>>>>>
>>>>>> Thanks much,
>>>>>> Sandeep.
>>>>>>
>>>>>>
>>>>>>
>>>>>> ------------------------------------------------------------------------
>>>>>>
>>>>>> _______________________________________________
>>>>>> 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
>>>>>
>>>>>
>>>>>     
>>>>>         
>>>>   
>>>>       
>>> _______________________________________________
>>> 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
> 
> 

-- 
View this message in context: http://www.nabble.com/Writing-rules-using-java..-tp9274440p19878172.html
Sent from the drools - user mailing list archive at Nabble.com.




More information about the rules-users mailing list