Re: [rules-users] drl execution problem
Thanks manstis. it was really helpful -- View this message in context: http://drools.46999.n3.nabble.com/drl-execution-problem-tp3866929p3877788.html Sent from the Drools: User forum mailing list archive at Nabble.com. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] drl execution problem
e.g. add an ID field to Person that is incremental in value on subsequent "people" person1: Person( $firstName1: firstName, $id : id ) person2: Person( firstName != $firstName1, id > $id ) This ensures only one match of person1 and person2 will occur, not person2 and person1. On 29 March 2012 12:43, arup wrote: > Hi laune > Thanks for the solution. but i am confused a bit with point (b). > how to add a constraint asserting an ordering between Persons in drl. sorry > it may seem silly Qs but i'm new to drools and really want to know that. > Can > u explain in detail. Thanks again for the solution. > > -- > View this message in context: > http://drools.46999.n3.nabble.com/drl-execution-problem-tp3866929p3867432.html > Sent from the Drools: User forum mailing list archive at Nabble.com. > ___ > 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
Re: [rules-users] drl execution problem
Hi laune Thanks for the solution. but i am confused a bit with point (b). how to add a constraint asserting an ordering between Persons in drl. sorry it may seem silly Qs but i'm new to drools and really want to know that. Can u explain in detail. Thanks again for the solution. -- View this message in context: http://drools.46999.n3.nabble.com/drl-execution-problem-tp3866929p3867432.html Sent from the Drools: User forum mailing list archive at Nabble.com. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] drl execution problem
You have, say, Person( "Joe" ) Person( "Jim" ) This happens: person1 <- match any Person: (1) match Joe, and (2) match Jim person2 <- match any Person name2!=name1: when (1) then match Jim, when (2) then match Joe To avoid this, you can (a) retract person2 in rule "FirstNameDifference" (b) add a constraint asserting an ordering between Persons, e.g., some unique number (c) use compareTo with names, test for -1 (d) post-process dataDifferenceVO.getDataDiffArray() -W On 29/03/2012, arup wrote: > i have one drl like below: > > rule "FirstNameDifference" > no-loop true > lock-on-active true > when > person1: Person( $firstName1: firstName ) > person2: Person( firstName != $firstName1 ) > > then > dataDifferenceVO.getDataDiffArray().add("Person/FirstName"); > end > > i'm passing a list of objects in which i have 2 person type objects. my aim > is to check if the firstnames are same or different. if its different i need > to add one String to the DataDiffArray that is declared inside > DataDifferenceVO class. > > but as i pass 2 person objects in the WM the rule is getting executed twice. > i.e, the string "Person/FirstName" is getting added twice in the array list. > why is this happening?... the rule should compare 2 firstnames and return > one String...is not that?... what step should i take to achive what i > want > Thanks a lot i advance... :) :) :) > > -- > View this message in context: > http://drools.46999.n3.nabble.com/drl-execution-problem-tp3866929p3866929.html > Sent from the Drools: User forum mailing list archive at Nabble.com. > ___ > 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
Re: [rules-users] drl execution problem
Thanks manstis. Yes i think u r right. but how can i get it working for only once??? -- View this message in context: http://drools.46999.n3.nabble.com/drl-execution-problem-tp3866929p3866995.html Sent from the Drools: User forum mailing list archive at Nabble.com. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] drl execution problem
I suspect Person 1 and Person 2, plus Person 2 and Person 1 are matching. Try putting a sysout in the RHS showing the people matched to confirm. sent on the move On 29 Mar 2012 08:16, "arup" wrote: > i have one drl like below: > > rule "FirstNameDifference" > no-loop true > lock-on-active true >when >person1: Person( $firstName1: firstName ) >person2: Person( firstName != $firstName1 ) > >then >dataDifferenceVO.getDataDiffArray().add("Person/FirstName"); > end > > i'm passing a list of objects in which i have 2 person type objects. my aim > is to check if the firstnames are same or different. if its different i > need > to add one String to the DataDiffArray that is declared inside > DataDifferenceVO class. > > but as i pass 2 person objects in the WM the rule is getting executed > twice. > i.e, the string "Person/FirstName" is getting added twice in the array > list. > why is this happening?... the rule should compare 2 firstnames and return > one String...is not that?... what step should i take to achive what i > want > Thanks a lot i advance... :) :) :) > > -- > View this message in context: > http://drools.46999.n3.nabble.com/drl-execution-problem-tp3866929p3866929.html > Sent from the Drools: User forum mailing list archive at Nabble.com. > ___ > 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] drl execution problem
i have one drl like below: rule "FirstNameDifference" no-loop true lock-on-active true when person1: Person( $firstName1: firstName ) person2: Person( firstName != $firstName1 ) then dataDifferenceVO.getDataDiffArray().add("Person/FirstName"); end i'm passing a list of objects in which i have 2 person type objects. my aim is to check if the firstnames are same or different. if its different i need to add one String to the DataDiffArray that is declared inside DataDifferenceVO class. but as i pass 2 person objects in the WM the rule is getting executed twice. i.e, the string "Person/FirstName" is getting added twice in the array list. why is this happening?... the rule should compare 2 firstnames and return one String...is not that?... what step should i take to achive what i want Thanks a lot i advance... :) :) :) -- View this message in context: http://drools.46999.n3.nabble.com/drl-execution-problem-tp3866929p3866929.html Sent from the Drools: User forum mailing list archive at Nabble.com. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users