[rules-users] [guvnor] How to use a rule in a java application

Michael Anstis michael.anstis at gmail.com
Wed Apr 20 08:09:13 EDT 2011


Hi,

Guvnor is an authoring and repository environment not a runtime environment.

Please read about KnowledgeBuilder and its related "addResource" methods
together with the ResourceType.PKG. You can also look at using
KnowledgeAgent but for now an understanding of KnowledgeBuilder will
suffice. I also recommend you read about rule invocation, as your example of
how you expect operation "rules.execute" suggests you have not read the
"Expert" documentation.

With kind regards,

Mike

On 20 April 2011 12:39, Mario Viertel <Mario.Viertel at medav.de> wrote:

> Hi all,
>
> I am new in Guvnor and have a lot of questions.
> I have created a decision table with the Guvnor web app. I have also
> created some test. All seems to be fine.
>
> Now I want to use the rules in a web application. Unfortunately Guvnor
> doesn't provide a web service interface so I must develop an own web
> service to deal with the rules. But thats not so easy ...
>
> In the Guvnor documentation I can see how to create KnowledgeBases and
> builders and how to fire rules. But I cannot see how to receive rule
> results.
>
> Example:
>
> The decision table looks similar like this:
>
> rule 1 "under age"
> if person.age < 18 then "under age"
>
> rule 2 "pensioner female"
> if person.age > 64 and person.gender == "female" then "pensioner"
>
> rule 3 "pensioner male"
> if person.age > 67 and person.gender == "male" then "pensioner"
>
> rule 4 "full age"
> * then "full age"
>
>
> In my java application I create a person object:
>
> Person p = new Person();
> p.setBirthday(...);
> p.setGender(...);
>
> Now I miss a method in the Guvnor api to exectute the rules and receive
> the result like this:
>
> Person result = (Person) rules.execute(p);
>
> Can somebody explain how to execute a rule and receive the result.
>
> Thanks in Advance
> Mario Viertel
> Germany
> _______________________________________________
> 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/20110420/6d37231d/attachment.html 


More information about the rules-users mailing list