[rules-users] [Drools Interest] Dynamic rule loading from DB

Michael Anstis michael.anstis at gmail.com
Sat Mar 26 05:48:06 EDT 2011


Have a look at org.drools.ide.common.server.util.BRDRLPersistenceTest for
examples.

With regard to using a Decision Table; if you're writing the code to
generate the decision table from a database then you could look at the
mechanisms used in
org.drools.ide.common.server.util.GuidedDTDRLPersistenceTest.

I stress again however, with whatever approach you use, you need to write
the code that'll build the required model from a database.

With kind regards,

Mike

2011/3/26 bilasini sahoo <s.bilasini at gmail.com>

> For this knid of rules in DB, Is DessionTable will help...
> Please let me know
>
> On Sat, Mar 26, 2011 at 7:01 AM, bilasini sahoo <s.bilasini at gmail.com>wrote:
>
>> Hi,
>>   I am asking about this code
>>   "We already have code that converts the RuleModel object graph into
>> DRL. However the object model is not tided to a database schema but you
>> could write a layer that maps database tables to these objects"
>>
>> can u please let me know
>>
>> Thanks
>>
>>   2011/3/26 Michael Anstis <michael.anstis at gmail.com>
>>
>>> "I am not able to get the code that creste drl file"
>>>
>>> This will be code that *you* write. Nothing is provided by the Drools
>>> project that can generate DRL from a database.
>>>
>>>
>>> 2011/3/25 bilasini sahoo <s.bilasini at gmail.com>
>>>
>>>> Hi,
>>>> Thanks for the explanation.
>>>> But i am sorry still also i am not able to see the clear pictures.
>>>> I am not able to get the code that creste drl file
>>>> Again as far i got to know Guvnor provided an UI where rules can be
>>>> configured,  which is not allowed my case.
>>>>
>>>> Please give some more deatils
>>>>
>>>>   2011/3/25 Michael Anstis <michael.anstis at gmail.com>
>>>>
>>>>> (1) If you are looking for something simple my advice would be to
>>>>> define a database schema that can record your type of query:
>>>>>
>>>>>
>>>>> (Company=CCC && Organisation=OOO and Dept=HR) OR (Country=UK)
>>>>>  (Company=CCC && Organisation=OOO )and (Dept=HR OR Country=UK)
>>>>>
>>>>> e.g.
>>>>> COMPARISON_ELEMENTS_TABLE = Field, Operator, Value
>>>>> COMPARISONS_TABLE = OpenBracket, COMPARISON_ELEMENT_ID, Connector,
>>>>> CloseBracket
>>>>>
>>>>> Then write Java code that can convert this into a DRL string that is
>>>>> then handled the normal way.
>>>>>
>>>>> (2) Firstly, I got the class name wrong. It should be
>>>>> org.drools.ide.common.client.modeldriven.brl.RuleModel.
>>>>>
>>>>> We already have code that converts the RuleModel object graph into DRL.
>>>>> However the object model is not tided to a database schema but you could
>>>>> write a layer that maps database tables to these objects.
>>>>>
>>>>> This would be quite complex but I include here to explain what I was
>>>>> trying to say.
>>>>>
>>>>>
>>>>> With kind regards,
>>>>>
>>>>> Mike
>>>>>
>>>>> 2011/3/25 bilasini sahoo <s.bilasini at gmail.com>
>>>>>
>>>>>> Hi,
>>>>>>   Thanks for the reply.
>>>>>> But i can i get some more idea how to implement this.
>>>>>>
>>>>>> I dont understand the "You could also look at writing a persistence
>>>>>> layer over FactModel which is the foregoing object model; to re-hydrate
>>>>>> direct from structured database tables with an ORM."
>>>>>>
>>>>>> Can you please guide me something simple.
>>>>>>
>>>>>> Thanks,
>>>>>> Bilasini
>>>>>>
>>>>>>  2011/3/25 Michael Anstis <michael.anstis at gmail.com>
>>>>>>
>>>>>>> The easiest suggestion would be to store DRL in your database ;)
>>>>>>>
>>>>>>> These is a (dieing) BRL XML format but I believe its use is
>>>>>>> discouraged (as it's essentially an XStream output of a object model).
>>>>>>>
>>>>>>> You could also look at writing a persistence layer over FactModel
>>>>>>> which is the foregoing object model; to re-hydrate direct from structured
>>>>>>> database tables with an ORM.
>>>>>>>
>>>>>>> Looking however at your example rules; I believe the simplest
>>>>>>> approach would be to write your own parser that generates DRL.
>>>>>>>
>>>>>>> Have you considered Guvnor which would suit your needs ideally?
>>>>>>>
>>>>>>> With kind regards,
>>>>>>>
>>>>>>> Mike
>>>>>>>
>>>>>>>   2011/3/25 bilasini sahoo <s.bilasini at gmail.com>
>>>>>>>
>>>>>>>>   Hi All,
>>>>>>>>    I am new to this Drool rule ingine use.
>>>>>>>> Normal drl is working for me.
>>>>>>>> But mu requirement is i need to configure all the rules in Data base
>>>>>>>> and from there i need to inject to the Rule engine.This is beacuse Rules can
>>>>>>>> be configured any point of time.
>>>>>>>>
>>>>>>>> Please let me know if is there any special foemat of rule
>>>>>>>> configuration is required so that creating rule file would be easier
>>>>>>>>
>>>>>>>> currently i have configured as
>>>>>>>>
>>>>>>>> (Company=CCC && Organisation=OOO and Dept=HR) OR (Country=UK)
>>>>>>>>  (Company=CCC && Organisation=OOO )and (Dept=HR OR Country=UK)
>>>>>>>>
>>>>>>>>
>>>>>>>> please advice. I am stuck with this proble since 2days
>>>>>>>>
>>>>>>>>
>>>>>>>> Thanks,
>>>>>>>> Bilasini
>>>>>>>>
>>>>>>>>
>>>>>>>> _______________________________________________
>>>>>>>> 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
>>>>>
>>>>>
>>>>
>>>> _______________________________________________
>>>> 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
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20110326/50af20e4/attachment.html 


More information about the rules-users mailing list