Rule "Working Students" salience -10 when IStudent s = don( $p, IStudent.class, true ) IWorker w = don( $p, IWorker.class, true ) Will find an example around classifications of students and workers. In theĭrools-examples source project open the classes and drl for the namespace "/org/drools/examples/traits". Release adds an example so that people have something simple to run, to help them understand. Traits were introduced in the 5.3 release, and details on them can be found in the N&N for there. Note, of course, that the activation of a named consequence not guarded byĪny condition with break doesn't make sense (and generates a compile time error) since otherwise the LHS part In fact do just schedules a consequence in the agenda,Īllowing the remaining part of the LHS to continue of being evaluated as per normal, while break also blocks anyįurther pattern matching evaluation. "giveDiscount5" using the keyword break instead of do. This result is achieved by activating the consequence named Here the purpose is to give a 10% discount AND a free parking to Golden customers over 60, but only a 5%ĭiscount (without free parking) to the Silver ones. To verbose and difficult to be maintained repetitions like in the following example: rule "Give 10% discount to customers older than 60" Sometimes the constraint of having one single consequence for each rule can be somewhat limiting and leads
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |