[rules-users] Guvnor search for rules based on fact attributes

Michael Anstis michael.anstis at gmail.com
Wed Jul 25 11:46:30 EDT 2012


drools-verifier (the scaffolding thereof at least) could be used in
principle.

drools-verifier builds an AST of a rule's definition that is then evaluated
by some bundled validation\verification rules.

In principle you could use the AST and your own rules to perform a search.

Guvnor uses JCR and Lucene to perform the search based on the rules'
content (sometimes DRL sometimes XML, depending on how the rule is
expressed internally).

You could, in principle, extend this however you're not really getting
anything better than regex on the DRL with the associated issues you have
already identified.

Lots of "in principles" but worth a look... :)

With kind regards,

Mike

On 25 July 2012 11:02, Stephen Masters <stephen.masters at me.com> wrote:

> Hi folks,
>
> I have been asked by my current client to evaluate search functionality
> which could in essence search for rules which are affected by a particular
> fact value.
>
> For example, if we have a number of rules similar to the following format:
>
> when
>         $req : TradeRequest(account = 10, buyCurrency = 'EUR', buyAmount >
> 5000000)
> then
>         TradeValidationResponse response = new TradeValidationResponse();
>         response.setPermitted(false);
>         response.setMessage("Account 10 is not permitted to trade more
> than 5000000 EUR");
>         insert(response);
> end
>
> What the client is interested in is being able to search for all rules
> which have been defined for account 10.
>
> I was thinking to mess around with a rather quick and dirty solution to
> grab the package source via the REST interface and pattern match rules in a
> very hard-coded way for this specific use-case. However, that does look
> like a rather fragile way of achieving this.
>
> So I was wondering whether anybody had looked at this sort of idea
> previously and might have thoughts on a 'better' or more generic solution,
> which wouldn't be massively complicated. I was thinking that it might be
> nice to extend the search mechanism in Guvnor so that I could pick a fact
> from the model and do a search for all rules which are based on the value
> of an attribute. However, every time I think about how that could be
> achieved, it seems I come up with new ways in which it would become really
> difficult to pull off.
>
> Any thoughts?
>
> Cheers,
>
> Steve
>
> _______________________________________________
> 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/20120725/b5f6eb09/attachment.html 


More information about the rules-users mailing list