Re: [rules-users] Help on writing a rule
Well... On 22/10/2013, Demian Calcaprina calcacue...@gmail.com wrote: Yes! I receive many price change events.. but, as I am using window length = 1, I would expect to have the activation cancelled for the previous one? I am not sure how to express this: when there is some price change, and some signal, and there has not been any order over the last minute, then place an order The price change and signal are like existence facts.. If there is some price change change.. if there is some signal ... there ist the exists CE,well documented in Expert's section 4.8.3.6.4. But then you'll have trouble accessing the order id of this anonymous existence. Again, I recommend using what I call an auxiliary peephole fact to keep track of the latest pair of PriceChange and Signal, possibly with a reference to the OrderCreated. Also, the magic if value 1234 doesn't look kosher to me, too. -W Would this be another way to achieve what I am trying to do? Thanks, Demian PS: This is a simple rule, but then, the idea is to have more complex rules.. like, if there has been 10 signals in the last time, place an order, etc. On Tue, Oct 22, 2013 at 5:40 PM, Davide Sottara dso...@gmail.com wrote: Am I wrong or do you have two PriceChange events - 392 and 394 ? If so, you can expect two activations.. when you fire al rules, one of the two will insert the OrderCreated, which in turn will cancel the other On 10/22/2013 01:34 PM, calcacuervo wrote: Hi Guys. I have one quesiton on how could I implement my rule. I have this rule: when t : PriceChange() over window:length(1) signal : Signal( id == 1234 ) over window:length(1) not OrderCreated( id == 1234 ) over window:time (1m) then insert(new OrderCreated(1234)); Basically, when there is some signal and some price change, create a new order if there has no been any other order in the last minute. But this sometimes is being fired twice: 12:31:01,121 INFO [org.drools.audit.WorkingMemoryConsoleLogger] (Camel (camel-1) thread #4 - JmsConsumer[marketDataTopic]) ACTIVATION CREATED rule:ertetr activationId:ertetr [393, 392, 0] declarations: t=PriceChange [](392); signal=Signal@1413ddef(393) 12:31:01,160 INFO [org.drools.audit.WorkingMemoryConsoleLogger] (Camel (camel-1) thread #4 - JmsConsumer[marketDataTopic]) ACTIVATION CREATED rule:ertetr activationId:ertetr [393, 394, 0] declarations: t=PriceChange [](394); signal=Signal@1413ddef(393) I think that, when the 1m window have passed, it creates twice the activations, as I have not called fire all rules yet. Does is make sense? Do you have some idea on how could I implement this rule? when there has been some price change and some signal, and I did not create a new order in the last minute, just create a new order. Thanks in advance! Demian -- View this message in context: http://drools.46999.n3.nabble.com/Help-on-writing-a-rule-tp4026461.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 mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
[rules-users] Help on writing a rule
Hi Guys. I have one quesiton on how could I implement my rule. I have this rule: when t : PriceChange() over window:length(1) signal : Signal( id == 1234 ) over window:length(1) not OrderCreated( id == 1234 ) over window:time (1m) then insert(new OrderCreated(1234)); Basically, when there is some signal and some price change, create a new order if there has no been any other order in the last minute. But this sometimes is being fired twice: 12:31:01,121 INFO [org.drools.audit.WorkingMemoryConsoleLogger] (Camel (camel-1) thread #4 - JmsConsumer[marketDataTopic]) ACTIVATION CREATED rule:ertetr activationId:ertetr [393, 392, 0] declarations: t=PriceChange [](392); signal=Signal@1413ddef(393) 12:31:01,160 INFO [org.drools.audit.WorkingMemoryConsoleLogger] (Camel (camel-1) thread #4 - JmsConsumer[marketDataTopic]) ACTIVATION CREATED rule:ertetr activationId:ertetr [393, 394, 0] declarations: t=PriceChange [](394); signal=Signal@1413ddef(393) I think that, when the 1m window have passed, it creates twice the activations, as I have not called fire all rules yet. Does is make sense? Do you have some idea on how could I implement this rule? when there has been some price change and some signal, and I did not create a new order in the last minute, just create a new order. Thanks in advance! Demian -- View this message in context: http://drools.46999.n3.nabble.com/Help-on-writing-a-rule-tp4026461.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] Help on writing a rule
Am I wrong or do you have two PriceChange events - 392 and 394 ? If so, you can expect two activations.. when you fire al rules, one of the two will insert the OrderCreated, which in turn will cancel the other On 10/22/2013 01:34 PM, calcacuervo wrote: Hi Guys. I have one quesiton on how could I implement my rule. I have this rule: when t : PriceChange() over window:length(1) signal : Signal( id == 1234 ) over window:length(1) not OrderCreated( id == 1234 ) over window:time (1m) then insert(new OrderCreated(1234)); Basically, when there is some signal and some price change, create a new order if there has no been any other order in the last minute. But this sometimes is being fired twice: 12:31:01,121 INFO [org.drools.audit.WorkingMemoryConsoleLogger] (Camel (camel-1) thread #4 - JmsConsumer[marketDataTopic]) ACTIVATION CREATED rule:ertetr activationId:ertetr [393, 392, 0] declarations: t=PriceChange [](392); signal=Signal@1413ddef(393) 12:31:01,160 INFO [org.drools.audit.WorkingMemoryConsoleLogger] (Camel (camel-1) thread #4 - JmsConsumer[marketDataTopic]) ACTIVATION CREATED rule:ertetr activationId:ertetr [393, 394, 0] declarations: t=PriceChange [](394); signal=Signal@1413ddef(393) I think that, when the 1m window have passed, it creates twice the activations, as I have not called fire all rules yet. Does is make sense? Do you have some idea on how could I implement this rule? when there has been some price change and some signal, and I did not create a new order in the last minute, just create a new order. Thanks in advance! Demian -- View this message in context: http://drools.46999.n3.nabble.com/Help-on-writing-a-rule-tp4026461.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] Help on writing a rule
Just curious here, why do you have this - signal : Signal( id == 1234 ) over window:length(1)? On Tue, Oct 22, 2013 at 9:40 PM, Davide Sottara dso...@gmail.com wrote: Am I wrong or do you have two PriceChange events - 392 and 394 ? If so, you can expect two activations.. when you fire al rules, one of the two will insert the OrderCreated, which in turn will cancel the other On 10/22/2013 01:34 PM, calcacuervo wrote: Hi Guys. I have one quesiton on how could I implement my rule. I have this rule: when t : PriceChange() over window:length(1) signal : Signal( id == 1234 ) over window:length(1) not OrderCreated( id == 1234 ) over window:time (1m) then insert(new OrderCreated(1234)); Basically, when there is some signal and some price change, create a new order if there has no been any other order in the last minute. But this sometimes is being fired twice: 12:31:01,121 INFO [org.drools.audit.WorkingMemoryConsoleLogger] (Camel (camel-1) thread #4 - JmsConsumer[marketDataTopic]) ACTIVATION CREATED rule:ertetr activationId:ertetr [393, 392, 0] declarations: t=PriceChange [](392); signal=Signal@1413ddef(393) 12:31:01,160 INFO [org.drools.audit.WorkingMemoryConsoleLogger] (Camel (camel-1) thread #4 - JmsConsumer[marketDataTopic]) ACTIVATION CREATED rule:ertetr activationId:ertetr [393, 394, 0] declarations: t=PriceChange [](394); signal=Signal@1413ddef(393) I think that, when the 1m window have passed, it creates twice the activations, as I have not called fire all rules yet. Does is make sense? Do you have some idea on how could I implement this rule? when there has been some price change and some signal, and I did not create a new order in the last minute, just create a new order. Thanks in advance! Demian -- View this message in context: http://drools.46999.n3.nabble.com/Help-on-writing-a-rule-tp4026461.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 -- - MyJourney @ http://salaboy.com http://salaboy.wordpress.com - Co-Founder @ http://www.jugargentina.org - Co-Founder @ http://www.jbug.com.ar - Salatino Salaboy Mauricio - ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] Help on writing a rule
Yes! I receive many price change events.. but, as I am using window length = 1, I would expect to have the activation cancelled for the previous one? I am not sure how to express this: when there is some price change, and some signal, and there has not been any order over the last minute, then place an order The price change and signal are like existence facts.. If there is some price change change.. if there is some signal ... Would this be another way to achieve what I am trying to do? Thanks, Demian PS: This is a simple rule, but then, the idea is to have more complex rules.. like, if there has been 10 signals in the last time, place an order, etc. On Tue, Oct 22, 2013 at 5:40 PM, Davide Sottara dso...@gmail.com wrote: Am I wrong or do you have two PriceChange events - 392 and 394 ? If so, you can expect two activations.. when you fire al rules, one of the two will insert the OrderCreated, which in turn will cancel the other On 10/22/2013 01:34 PM, calcacuervo wrote: Hi Guys. I have one quesiton on how could I implement my rule. I have this rule: when t : PriceChange() over window:length(1) signal : Signal( id == 1234 ) over window:length(1) not OrderCreated( id == 1234 ) over window:time (1m) then insert(new OrderCreated(1234)); Basically, when there is some signal and some price change, create a new order if there has no been any other order in the last minute. But this sometimes is being fired twice: 12:31:01,121 INFO [org.drools.audit.WorkingMemoryConsoleLogger] (Camel (camel-1) thread #4 - JmsConsumer[marketDataTopic]) ACTIVATION CREATED rule:ertetr activationId:ertetr [393, 392, 0] declarations: t=PriceChange [](392); signal=Signal@1413ddef(393) 12:31:01,160 INFO [org.drools.audit.WorkingMemoryConsoleLogger] (Camel (camel-1) thread #4 - JmsConsumer[marketDataTopic]) ACTIVATION CREATED rule:ertetr activationId:ertetr [393, 394, 0] declarations: t=PriceChange [](394); signal=Signal@1413ddef(393) I think that, when the 1m window have passed, it creates twice the activations, as I have not called fire all rules yet. Does is make sense? Do you have some idea on how could I implement this rule? when there has been some price change and some signal, and I did not create a new order in the last minute, just create a new order. Thanks in advance! Demian -- View this message in context: http://drools.46999.n3.nabble.com/Help-on-writing-a-rule-tp4026461.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 mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] Help on writing a rule
Mauricio, In fact, I used to have this and the price change without window:length.. but when t : PriceChange() signal : Signal( id == 1234 ) not OrderCreated( id == 1234 ) over window:time (1m) But this will cause more and more duplicates orders (and it have sense!). I added the length window to 1, as I would only like to create an order if there is some signal in the window, it can place an order.. On Tue, Oct 22, 2013 at 5:42 PM, Mauricio Salatino sala...@gmail.comwrote: Just curious here, why do you have this - signal : Signal( id == 1234 ) over window:length(1)? On Tue, Oct 22, 2013 at 9:40 PM, Davide Sottara dso...@gmail.com wrote: Am I wrong or do you have two PriceChange events - 392 and 394 ? If so, you can expect two activations.. when you fire al rules, one of the two will insert the OrderCreated, which in turn will cancel the other On 10/22/2013 01:34 PM, calcacuervo wrote: Hi Guys. I have one quesiton on how could I implement my rule. I have this rule: when t : PriceChange() over window:length(1) signal : Signal( id == 1234 ) over window:length(1) not OrderCreated( id == 1234 ) over window:time (1m) then insert(new OrderCreated(1234)); Basically, when there is some signal and some price change, create a new order if there has no been any other order in the last minute. But this sometimes is being fired twice: 12:31:01,121 INFO [org.drools.audit.WorkingMemoryConsoleLogger] (Camel (camel-1) thread #4 - JmsConsumer[marketDataTopic]) ACTIVATION CREATED rule:ertetr activationId:ertetr [393, 392, 0] declarations: t=PriceChange [](392); signal=Signal@1413ddef(393) 12:31:01,160 INFO [org.drools.audit.WorkingMemoryConsoleLogger] (Camel (camel-1) thread #4 - JmsConsumer[marketDataTopic]) ACTIVATION CREATED rule:ertetr activationId:ertetr [393, 394, 0] declarations: t=PriceChange [](394); signal=Signal@1413ddef(393) I think that, when the 1m window have passed, it creates twice the activations, as I have not called fire all rules yet. Does is make sense? Do you have some idea on how could I implement this rule? when there has been some price change and some signal, and I did not create a new order in the last minute, just create a new order. Thanks in advance! Demian -- View this message in context: http://drools.46999.n3.nabble.com/Help-on-writing-a-rule-tp4026461.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 -- - MyJourney @ http://salaboy.com http://salaboy.wordpress.com - Co-Founder @ http://www.jugargentina.org - Co-Founder @ http://www.jbug.com.ar - Salatino Salaboy Mauricio - ___ 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] help in writing this rule logic
Hello, Please guide me to implement following rule. I would like to found out the city where absence of either Male or Female found for same age. I also need to have ref to those Men and Female of that city in collection to use it RHS. Also there will be max of one male female for same age. Male{ String name; int age; String city } Female{ String name; int age; String city } Thanks -- View this message in context: http://www.nabble.com/help-in-writing-this-rule-logic-tp22817412p22817412.html Sent from the drools - user 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] help in writing this rule logic
techy wrote: Hello, Please guide me to implement following rule. I would like to found out the city where absence of either Male or Female found for same age. I also need to have ref to those Men and Female of that city in collection to use it RHS. Also there will be max of one male female for same age. Male{ String name; int age; String city } Female{ String name; int age; String city } $city : City( name == paris ) not Person( age == 25, sex == female, city == $city ) For the other Qs look into collect and accumulate. Mark Thanks ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users