Re: [rules-users] Comparing Objects of same class.
This is one of the scenarios that can be handled using CEP (Complex Event Processing) - basically rule logic with some extensions to make time based reasoning more convenient. In Drools, you have @event to declare a fact type as an event type, temporal operators to establish temporal relations between events, windows to select recently arrived subsets of facts, etc. Much depends on whether you need to handle this in real time or whether it's going to be handled over a bulk of historic data. All my hints on mapping facts to days are useless - you may have to use floating intervals or an approach that's triggered by the first smell of a certain crime... -W On 18/06/2014, naresh.t nareshthota...@gmail.com wrote: Dear Wolfgang, Thanks for your patience and understandings. Let me clear our requirement. Actually we are not working any student psychology thing. I thought to simplify the problem in terms of Student example but it is getting complicated. What we are trying to achieve is... We have some RAW logs(windows event logs like login success, login failed, bad user name and password etc., along with date and time) in our DB. We are trying get trend of some particular events like bad user name and password. If these type of events are happening in less span of time, then we will find those user names and do some activity on them. In our existing application, we have achieved this by using java with hard coded inputs. Means we are getting those events, if any 5 events occurred in 3 minutes. Now we are trying to add some dynamism for these type of requirements. We are exploring Drools Rule Engines to check that is it compatible with these type of rules. If you have any other Rule Engines in your mind, please suggest us. Thanks Naresh -- View this message in context: http://drools.46999.n3.nabble.com/Comparing-Objects-of-same-class-tp4030073p4030088.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] Comparing Objects of same class.
HI Team, We came in situation where we need to compare our objects of same class. For example, we have a class like SampleData.java. It has fields like 1) No 2) Student Name 3) DOJ(date of join) Now, we want to write a Rule to get the Student Details like 1) if any 5 students joined in 2 days of span This rule might changed dynamically like for now it is 2 days but in future it may be 1 day or 3 days etc., Please provide any suggestions on this... Thanks Regards Naresh -- View this message in context: http://drools.46999.n3.nabble.com/Comparing-Objects-of-same-class-tp4030073.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] Comparing Objects of same class.
What have you tried so far? And, please, clarify what you mean by any 5 in 2 days. For instance: If A, B, C, D, E, F join on 5/24, is this a match? And if G, H, J join additionally on 5/25, is this another match? -W On 17/06/2014, naresh.t nareshthota...@gmail.com wrote: HI Team, We came in situation where we need to compare our objects of same class. For example, we have a class like SampleData.java. It has fields like 1) No 2) Student Name 3) DOJ(date of join) Now, we want to write a Rule to get the Student Details like 1) if any 5 students joined in 2 days of span This rule might changed dynamically like for now it is 2 days but in future it may be 1 day or 3 days etc., Please provide any suggestions on this... Thanks Regards Naresh -- View this message in context: http://drools.46999.n3.nabble.com/Comparing-Objects-of-same-class-tp4030073.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] Comparing Objects of same class.
Hi, more details... lets take a rule like If any 5 students joined in 5 days of span... NoNameDOJ 1 A*5/24* 2 B* 5/25* 3 C *5/27* 4 D *5/23* 5 E 5/30 6 F 5/20 7 G 5/15 If we take, A,B,C and D details, these 4 students are joined in =5 days of span(lowest date :-D:5/23 and highest date :-c:5/27 -- diff is 4 days). If any other student joined in these =5 days (5/23 to 5/27 ) then we need those all 5 students details. If we take F, A, B and D, these 4 students also joined in = 5 days...but no.of 5 students condition is missing. As we said we are able to work on static rules like if student joined =5/23 !=5/30 etc. Thanks Regards Naresh -- View this message in context: http://drools.46999.n3.nabble.com/Comparing-Objects-of-same-class-tp4030073p4030079.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] Comparing Objects of same class.
Let S be the (nonempty) set of all students and d the length of the span of days. There exists a student s0 so that s0.doj is the minimum over all S. Then accumulate and count students x over S so that s0.doj = x.doj and x.doj s0.doj + d. If this count exceeds the threshold t: display the students. Finally, remove all students y from S where y.doj = s0.doj. Repeat until S is empty. I don't see any particular reason for doing this in Drools, although it's feasible with just a handful of rules. But it is a ridiculously simply exercise in Java. Does this have any practical value? Students' behaviour is notoriously erratic. Is this for a brand new branch of behavioural psychology?! -W On 17/06/2014, naresh.t nareshthota...@gmail.com wrote: Hi, more details... lets take a rule like If any 5 students joined in 5 days of span... NoNameDOJ 1 A*5/24* 2 B* 5/25* 3 C *5/27* 4 D *5/23* 5 E 5/30 6 F 5/20 7 G 5/15 If we take, A,B,C and D details, these 4 students are joined in =5 days of span(lowest date :-D:5/23 and highest date :-c:5/27 -- diff is 4 days). If any other student joined in these =5 days (5/23 to 5/27 ) then we need those all 5 students details. If we take F, A, B and D, these 4 students also joined in = 5 days...but no.of 5 students condition is missing. As we said we are able to work on static rules like if student joined =5/23 !=5/30 etc. Thanks Regards Naresh -- View this message in context: http://drools.46999.n3.nabble.com/Comparing-Objects-of-same-class-tp4030073p4030079.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] Comparing Objects of same class.
Dear Wolfgang, Thanks for your patience and understandings. Let me clear our requirement. Actually we are not working any student psychology thing. I thought to simplify the problem in terms of Student example but it is getting complicated. What we are trying to achieve is... We have some RAW logs(windows event logs like login success, login failed, bad user name and password etc., along with date and time) in our DB. We are trying get trend of some particular events like bad user name and password. If these type of events are happening in less span of time, then we will find those user names and do some activity on them. In our existing application, we have achieved this by using java with hard coded inputs. Means we are getting those events, if any 5 events occurred in 3 minutes. Now we are trying to add some dynamism for these type of requirements. We are exploring Drools Rule Engines to check that is it compatible with these type of rules. If you have any other Rule Engines in your mind, please suggest us. Thanks Naresh -- View this message in context: http://drools.46999.n3.nabble.com/Comparing-Objects-of-same-class-tp4030073p4030088.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