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

Stephen Masters stephen.masters at me.com
Wed Jul 25 06:02:44 EDT 2012


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



More information about the rules-users mailing list