Thanks Greg\Barton. I will try it out and get back to you. Regards, cabear
2009/11/8 Wolfgang Laun <wolfgang.l...@gmail.com> > Another proposal, with perhaps more emphasize on "rulishness". > > Given > class Item { T1 s1;... Tn sn;... } > let's add > enum Criterium { C1, C2,... Cn; } > class Request { EnumSet<Criterium> criteria; HashSet<Item> results; } > > To launch a request, insert a Request object with an appropriate setting > for criteria. Then, match all Item facts against rules, one for each Ci: > > rule "Check C1" > when > $request : Request( criteria contains Criterium.C1 ) > $item : Item( s1 <op> <value> ) # the constraint defining "valid" > then > $request.getResults().add( $item ); # no modify! > end > > //...same for C2 ... Cn > > rule "Return results" > salience -100 > when > $request : Request() > then > ... send $request.getResults() back to User > retract( $request ); > end > > You could have two rules here, one testing for success (getResults().size() > == getCriteria().size()), the other one firing for failure, but it might be > preferable to handle it in the presentation layer. > > Although I've used similar approaches, the code here is just off the cuff. > -W > > 2009/11/8 Wishing Carebear <wishing.careb...@gmail.com> > >> Hello: >> There are n selection criteria from s1 .. sn for each item i1.. in. Each >> item can have a subset of criteria which applies to them. >> >> The end user, can choose a subset of criteria like c1 and c5 and only the >> item that has c1 and c5 valid should be returned. For example: if item i1 >> and i2 have criterias valid for c1, c2, c5, c6, c8 since the request is only >> for criteria c1 and c5, i1 and i2 must be returned. >> >> Is it possible to write a rule using drools for this requirement. >> >> Thanks for your help and time, >> cabear >> >> _______________________________________________ >> rules-users mailing list >> rules-users@lists.jboss.org >> https://lists.jboss.org/mailman/listinfo/rules-users >> >> > > _______________________________________________ > rules-users mailing list > rules-users@lists.jboss.org > https://lists.jboss.org/mailman/listinfo/rules-users > >
_______________________________________________ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users