[rules-users] Custom UI to create rules and inserting them via REST API

Michael Anstis michael.anstis at gmail.com
Tue Jan 29 04:57:03 EST 2013


Hello,

If your UI needs to be able to edit existing rules authored with it then
you'll need to convert from the persistent format back to whatever model
your UI uses.

Guvnor already has this, as you have found, with it's *internal* BRL format
and related classes. Guvnor stores RuleModel as XML (XStream of RuleModel)
and uses this for it's UI.

When Guvnor needs DRL (e.g when building a package or when the users wants
to view the source) it uses BRDRLPersistence to translate RuleModel to DRL.

Will rules authored in your UI also be editable in Guvnor - in which case
use of BRL would also be a good choice.

Guvnor 6.0 might have the ability to round-trip between DRL and RuleModel
removing BRL altogether. If you elect to pursue this then storing the Rule
from your UI as DRL could also work provided your UI used RuleModel.

With kind regards,

Mike

On 29 January 2013 09:38, benq2188 <bengisaglam at gmail.com> wrote:

> Thanks for the reply,
>
> It seems with this way I need to create my own rule parser to have "DRL"
> type asset since the rules will be created by users.
>
> My aim is to facilitate from Guvnor api as much as I can, instead of
> creating my parser I though that there might be some class which helps to
> create rules. For now I havent decided yet between "BRL" or "DRL" type
> asset
> to create rules, from customized UI the output should be the rule itself
> and
> I need to POST it by using REST API. So in this point what do you suggest?
> Do you think org.drools.ide.common.client.modeldriven.brl.RuleModel class
> may an option to represent rules which are created by users?(and after that
> persisting them using  BRDRLPersistance class to store in guvnor repository
> via REST) or instead, could it be an option to create "BRL" type asset from
> my UI using guvnor API?
>
> Please
>
> Regards,
>
> Bengi.
>
>
>
>
> manstis wrote
> > DRL assets in Guvnor are stored as plain text.
> >
> > You should be able to use the REST API to create a new "DRL" type asset
> > and
> > POST the text.
> >
> > On 29 January 2013 08:40, Esteban Aliverti &lt;
>
> > esteban.aliverti@
>
> > &gt;wrote:
> >
> >> As far as I know, there is no API for DRL creation.
> >>
> >> Best Regards,
> >>
> >>
> >> XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
> >>
> >> Esteban Aliverti
> >> - Blog @ http://ilesteban.wordpress.com
> >>
> >>
> >> On Mon, Jan 28, 2013 at 2:32 PM, benq2188 &lt;
>
> > bengisaglam@
>
> > &gt; wrote:
> >>
> >>> Esteban thanks for the quick reply, so in this case my question is,
> >>> which
> >>> object is the key in the API to create .drl rule ? Should I create
> >>> RuleModel?
> >>>
> >>> Also how can I store that .drl via POST method of the REST?
> >>>
> >>> Regards,
> >>>
> >>> Bengi.
> >>>
> >>>
> >>> Esteban wrote
> >>> > If you are not planning to use Guvnor to author your rules, there is
> >>> no
> >>> > need to store them in BRL format. You can store your rules as
> >>> 'technical
> >>> > rules' directly.
> >>> >
> >>> > Best Regards,
> >>> >
> >>> >
> >>> > XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
> >>> >
> >>> > Esteban Aliverti
> >>> > - Blog @ http://ilesteban.wordpress.com
> >>> >
> >>> >
> >>> > On Mon, Jan 28, 2013 at 2:10 PM, benq2188 &lt;
> >>>
> >>> > bengisaglam@
> >>>
> >>> > &gt; wrote:
> >>> >
> >>> >> Hi everyone,
> >>> >>
> >>> >> I would like to implement an Expert System which I can have my own
> UI
> >>> to
> >>> >> generate user defined rules, and I am planning to use REST API to
> >>> >> insert/update/delete the rules,which are in the guvnor repository.
> >>> Inside
> >>> >> the guvnor, I would like to store my rules in .drl format. So I was
> >>> >> wondering two thing:
> >>> >>
> >>> >> - Is that possible to create a brl file in XStream xml format as
> >>> output
> >>> >> of
> >>> >> the UI, and store it in the repository as .drl format?. (I know the
> >>> >> conversion from .brl to .drl is possible by using BRDRLPersistance
> >>> >> object.)
> >>> >> If it is possible then which object is the key point to create it
> >>> from
> >>> >> the
> >>> >> "package org.drools.ide.common.client.modeldriven.brl"?
> >>> >>
> >>> >> -Another problem, by using REST API I can update and retrieve an
> >>> asset
> >>> in
> >>> >> text/plain format, however I could not succeed to insert new asset
> >>> into
> >>> >> repository by using POST method. So how can I insert a new .drl rule
> >>> into
> >>> >> repository via REST.
> >>> >>
> >>> >> I will appreciate if you have some sample code for any of them and
> >>> will
> >>> >> be
> >>> >> greatful for any help,
> >>> >>
> >>> >> Thanks,
> >>> >>
> >>> >> Bengi.
> >>> >>
> >>> >>
> >>> >>
> >>> >> --
> >>> >> View this message in context:
> >>> >>
> >>>
> http://drools.46999.n3.nabble.com/Custom-UI-to-create-rules-and-inserting-them-via-REST-API-tp4021848.html
> >>> >> Sent from the Drools: User forum mailing list archive at Nabble.com.
> >>> >> _______________________________________________
> >>> >> rules-users mailing list
> >>> >>
> >>>
> >>> > rules-users at .jboss
> >>>
> >>> >> https://lists.jboss.org/mailman/listinfo/rules-users
> >>> >>
> >>> >
> >>> > _______________________________________________
> >>> > rules-users mailing list
> >>>
> >>> > rules-users at .jboss
> >>>
> >>> > https://lists.jboss.org/mailman/listinfo/rules-users
> >>>
> >>>
> >>>
> >>>
> >>>
> >>> --
> >>> View this message in context:
> >>>
> http://drools.46999.n3.nabble.com/Custom-UI-to-create-rules-and-inserting-them-via-REST-API-tp4021848p4021851.html
> >>> Sent from the Drools: User forum mailing list archive at Nabble.com.
> >>> _______________________________________________
> >>> rules-users mailing list
> >>>
>
> > rules-users at .jboss
>
> >>> https://lists.jboss.org/mailman/listinfo/rules-users
> >>>
> >>
> >>
> >> _______________________________________________
> >> rules-users mailing list
> >>
>
> > rules-users at .jboss
>
> >> https://lists.jboss.org/mailman/listinfo/rules-users
> >>
> >>
> >
> > _______________________________________________
> > rules-users mailing list
>
> > rules-users at .jboss
>
> > https://lists.jboss.org/mailman/listinfo/rules-users
>
>
>
>
>
> --
> View this message in context:
> http://drools.46999.n3.nabble.com/Custom-UI-to-create-rules-and-inserting-them-via-REST-API-tp4021848p4021911.html
> Sent from the Drools: User forum 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/20130129/04627077/attachment.html 


More information about the rules-users mailing list