Re: [rules-users] Checking for a lack of an object
Doesn't retracting all objects then inserting new objects cause the rules to be evaluated for the objects currently in working memory? Do I need to use Stateless instead of Stateful or something? Thanks, Chris On 8/19/2011 7:47 PM, Wolfgang Laun wrote: A condition based on the negated existence quantifier is true when no such object is in the WM. Once recognized as true, the rule fires, and that's it until it isn't true any more, which is a sort of rewind for the condition after which the begin of another period of absence is celebrated with another firing. Repeated stop-and-go of the rule engine does not influence this monitoring of truth. -W 2011/8/20 Chris Richmond crichm...@referentia.com mailto:crichm...@referentia.com Well..I insert some objects, fire the rules and this rule will trigger the first time (when it finds no object with those characterstis) but every time after than when I insert more objects and fire the rules, the rule never fires again. I have no idea why. Here is my simple test case. Two clasess: TestMain and TestObject and rule file Test.drl I have included below. It insterts a group of facts at one time, fires the rules, and retracts all those facts from the stream. I have an event listener on the session, as you see to verify injections and retractions are occuring. So the rule fires on the first batch, but on no other batches after that What gives Among the Inserttion and retraction events I only see: A proper object does not exist One time, during firing rules on the first batch. Why does this rule never fire again, even though every single batch of objects I insert/retract does not contain the proper rule values, and so should fire the rule. What is going on??? TestMain.java * package com.sample; import java.util.ArrayList; import java.util.List; import org.drools.KnowledgeBase; import org.drools.KnowledgeBaseConfiguration; import org.drools.KnowledgeBaseFactory; import org.drools.builder.KnowledgeBuilder; import org.drools.builder.KnowledgeBuilderError; import org.drools.builder.KnowledgeBuilderErrors; import org.drools.builder.KnowledgeBuilderFactory; import org.drools.builder.ResourceType; import org.drools.conf.EventProcessingOption; import org.drools.event.rule.ObjectInsertedEvent; import org.drools.event.rule.ObjectRetractedEvent; import org.drools.event.rule.ObjectUpdatedEvent; import org.drools.event.rule.WorkingMemoryEventListener; import org.drools.io.ResourceFactory; import org.drools.runtime.KnowledgeSessionConfiguration; import org.drools.runtime.StatefulKnowledgeSession; import org.drools.runtime.conf.ClockTypeOption; import org.drools.runtime.rule.FactHandle; import org.drools.runtime.rule.WorkingMemoryEntryPoint; public class TestMain { @SuppressWarnings(restriction) public static void main(String[] args) { try { KnowledgeSessionConfiguration config = KnowledgeBaseFactory.newKnowledgeSessionConfiguration(); config.setOption( ClockTypeOption.get(realtime) ); KnowledgeBase kbase; kbase = readKnowledgeBase(); final StatefulKnowledgeSession ksession = kbase.newStatefulKnowledgeSession(); WorkingMemoryEntryPoint myStream = ksession.getWorkingMemoryEntryPoint(My Stream); ksession.addEventListener(new WorkingMemoryEventListener(){ @Override public void objectInserted(ObjectInsertedEvent oie) { System.err.println(Inserted: + oie.toString()); } @Override public void objectRetracted(ObjectRetractedEvent arg0) { System.err.println(Retracted: + arg0.toString()); } @Override public void objectUpdated(ObjectUpdatedEvent arg0) { // TODO Auto-generated method stub } }); for (int a = 0; a 1000; a++){ ListFactHandle factHandles = new ArrayListFactHandle(); for (int x = 0; x 6; x++){ double reading = 11.3; float f = (float)reading; TestObject dr = new TestObject(Reading + x, f); FactHandle fh = myStream.insert(dr); factHandles.add(fh); } ksession.fireAllRules(); for(FactHandle fh : factHandles){ myStream.retract(fh); } Thread.sleep(4000); } } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } } @SuppressWarnings(restriction) private static KnowledgeBase readKnowledgeBase() throws Exception { KnowledgeBuilder kbuilder = KnowledgeBuilderFactory.newKnowledgeBuilder
Re: [rules-users] Checking for a lack of an object
void setReading(float reading) { this.reading = reading; } } Test.drl* #created on: Aug 19, 2011 package com.sample rule Test For Lack of Objects with criteria when not(TestObject(name==blah) from entry-point My Stream) then System.err.println(A proper object does not exist); end On 8/18/2011 8:46 PM, Wolfgang Laun wrote: On 19 August 2011 15:17, Chris Richmond crichm...@referentia.com mailto:crichm...@referentia.com wrote: How do I fire a rule if an object with certain characterstics does not exists. For example my class Foo, if I have a rule: rule Identify Foos with values when Foo(stringProp==blah, intProp==5) then System.err.println(A Foo was found!); end So how do I check for lack of existence of an object with certain characteristics I tried: rule Flag missing Foos with values when not(Foo(stringProp==blah, intProp==5)) then System.err.println(A proper foo does not exist); end That's the way to do it. I also tried: rule Flag missing Foos with values when not(exists(Foo(stringProp==blah, intProp==5))) then System.err.println(A proper foo does not exist); end Since not( Foo(...)) means if no Foo(...) exists, the addition of exists is superfluous and generally considered bad style (even though some systems accept it to mean just not. -W ___ rules-users mailing list rules-users@lists.jboss.org mailto: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] Checking for a lack of an object
How do I fire a rule if an object with certain characterstics does not exists. For example my class Foo, if I have a rule: rule Identify Foos with values when Foo(stringProp==blah, intProp==5) then System.err.println(A Foo was found!); end So how do I check for lack of existence of an object with certain characteristics I tried: rule Flag missing Foos with values when not(Foo(stringProp==blah, intProp==5)) then System.err.println(A proper foo does not exist); end I also tried: rule Flag missing Foos with values when not(exists(Foo(stringProp==blah, intProp==5))) then System.err.println(A proper foo does not exist); end ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] Checking for a lack of an object
I forgot to mention I am using a StatefulKnowledgeSession and Stream mode... On 8/19/2011 3:17 AM, Chris Richmond wrote: How do I fire a rule if an object with certain characterstics does not exists. For example my class Foo, if I have a rule: rule Identify Foos with values when Foo(stringProp==blah, intProp==5) then System.err.println(A Foo was found!); end So how do I check for lack of existence of an object with certain characteristics I tried: rule Flag missing Foos with values when not(Foo(stringProp==blah, intProp==5)) then System.err.println(A proper foo does not exist); end I also tried: rule Flag missing Foos with values when not(exists(Foo(stringProp==blah, intProp==5))) then System.err.println(A proper foo does not exist); end ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] Reclaiming memory usage
Edson, I was under the impression that this: declare ReconfigEvent @role( event ) @expires ( 5s ) end would cover that, meaning that every ReconfigEvent would expire after 5s, thus causing to no longer be needed by the engine. Thanks, Chris On 7/25/2011 12:17 PM, Edson Tirelli wrote: Chris, I haven't tried your code, but just looking at the rule, there is no temporal correlation between DataReading and ReconfigEvent, so if I am not mistaken, that will create a required interval of infinite time when the temporal reasoning is applied, meaning the engine has to keep the readings in memory forever. Adding a temporal constraint on the ReconfigEvent pattern on your rule or defining an explicit expiration policy for the DataReadings are ways to work around that. Edson 2011/7/26 Chris Richmond crichm...@referentia.com mailto:crichm...@referentia.com Hello I am performing a simple test of injecting an event every 1 millisecond like so: for (int x = 0; x 10; x++){ DataReading dr = new DataReading(Reading + x, 12.0f); myStream.insert(dr); ksession.fireAllRules(); Thread.sleep(1); } The rule that evaluates this is simple. It basically delays then for 3s to see if a followup reading is inserted and makes sure that no ReconfigEvent is active(5s expiration). So if a reading comes in and a followup reading is not inserted within 3 seconds and there is is not an existing ReconfigEvent event alive, then it should output and insert a ReconfigEvent, essentially disabling any DataReading action on those events for the next 5 seconds or so. This all works just fine as expected. My question is, how come I don't get memory back when all 100,000 of my events have been inserted. Memory goes up slowly over the course of insertions, which I can understand, but once that loop is finished, memory never reduces, so essentially, the application will eventually run out of memory after some time. I should not have to explicitly remove/retract events should I? Shouldn't they be removed from working memory as soon as they are no longer viable? What should I be doing to reclaim memory from the session/knowledgebase? I have included the full Main program here and the Sample.drl file below it. FusionMain.java* package com.sample; import org.drools.KnowledgeBase; import org.drools.KnowledgeBaseConfiguration; import org.drools.KnowledgeBaseFactory; import org.drools.builder.KnowledgeBuilder; import org.drools.builder.KnowledgeBuilderError; import org.drools.builder.KnowledgeBuilderErrors; import org.drools.builder.KnowledgeBuilderFactory; import org.drools.builder.ResourceType; import org.drools.conf.EventProcessingOption; import org.drools.io.ResourceFactory; import org.drools.logger.KnowledgeRuntimeLogger; import org.drools.logger.KnowledgeRuntimeLoggerFactory; import org.drools.runtime.KnowledgeSessionConfiguration; import org.drools.runtime.StatefulKnowledgeSession; import org.drools.runtime.conf.ClockTypeOption; import org.drools.runtime.rule.WorkingMemoryEntryPoint; public class FusionMain { @SuppressWarnings(restriction) public static void main(String[] args) { try { KnowledgeSessionConfiguration config = KnowledgeBaseFactory.newKnowledgeSessionConfiguration(); config.setOption( ClockTypeOption.get(realtime) ); KnowledgeBase kbase; kbase = readKnowledgeBase(); StatefulKnowledgeSession ksession = kbase.newStatefulKnowledgeSession(); WorkingMemoryEntryPoint myStream = ksession.getWorkingMemoryEntryPoint(My Stream); for (int x = 0; x 10; x++){ DataReading dr = new DataReading(Reading + x, 12.0f); myStream.insert(dr); ksession.fireAllRules(); Thread.sleep(1); } } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } } @SuppressWarnings(restriction) private static KnowledgeBase readKnowledgeBase() throws Exception { KnowledgeBuilder kbuilder = KnowledgeBuilderFactory.newKnowledgeBuilder(); kbuilder.add(ResourceFactory.newClassPathResource(Sample.drl), ResourceType.DRL); KnowledgeBuilderErrors errors = kbuilder.getErrors(); if (errors.size() 0) { for (KnowledgeBuilderError error: errors) { System.err.println(error); } throw new IllegalArgumentException(Could not parse knowledge.); } KnowledgeBaseConfiguration kbConfig = KnowledgeBaseFactory.newKnowledgeBaseConfiguration(); kbConfig.setOption( EventProcessingOption.STREAM
Re: [rules-users] Reclaiming memory usage
Ok, well how to make them marry only those alive(100 years old) and ensure all those over 100 years old go out of memory? Chris On 7/25/2011 2:32 PM, Edson Tirelli wrote: Chris That defines the expiration policy for ReconfigEvent, but it does not define the relationship between ReconfigEvent and DataReading. Imagine a timeline, dotted with ReconfigEvents... what your rule is saying is for each DataReading event, match it with all the periods where there is no ReconfigEvent, as the lifetime of DataReading is infinity. Maybe a simpler way of understanding it (without using the not for simplification) is think about this: declare Man @livesUpTo( 100 years ) end rule marriage when $w : Woman( age 18 ) $m : Man( ) then // marry woman and man end The rule above defines that each woman will merry every existing man, even if each of them only lives for 100 years. Edson 2011/7/26 Chris Richmond crichm...@referentia.com mailto:crichm...@referentia.com Edson, I was under the impression that this: declare ReconfigEvent @role( event ) @expires ( 5s ) end would cover that, meaning that every ReconfigEvent would expire after 5s, thus causing to no longer be needed by the engine. Thanks, Chris On 7/25/2011 12:17 PM, Edson Tirelli wrote: Chris, I haven't tried your code, but just looking at the rule, there is no temporal correlation between DataReading and ReconfigEvent, so if I am not mistaken, that will create a required interval of infinite time when the temporal reasoning is applied, meaning the engine has to keep the readings in memory forever. Adding a temporal constraint on the ReconfigEvent pattern on your rule or defining an explicit expiration policy for the DataReadings are ways to work around that. Edson 2011/7/26 Chris Richmond crichm...@referentia.com mailto:crichm...@referentia.com Hello I am performing a simple test of injecting an event every 1 millisecond like so: for (int x = 0; x 10; x++){ DataReading dr = new DataReading(Reading + x, 12.0f); myStream.insert(dr); ksession.fireAllRules(); Thread.sleep(1); } The rule that evaluates this is simple. It basically delays then for 3s to see if a followup reading is inserted and makes sure that no ReconfigEvent is active(5s expiration). So if a reading comes in and a followup reading is not inserted within 3 seconds and there is is not an existing ReconfigEvent event alive, then it should output and insert a ReconfigEvent, essentially disabling any DataReading action on those events for the next 5 seconds or so. This all works just fine as expected. My question is, how come I don't get memory back when all 100,000 of my events have been inserted. Memory goes up slowly over the course of insertions, which I can understand, but once that loop is finished, memory never reduces, so essentially, the application will eventually run out of memory after some time. I should not have to explicitly remove/retract events should I? Shouldn't they be removed from working memory as soon as they are no longer viable? What should I be doing to reclaim memory from the session/knowledgebase? I have included the full Main program here and the Sample.drl file below it. FusionMain.java* package com.sample; import org.drools.KnowledgeBase; import org.drools.KnowledgeBaseConfiguration; import org.drools.KnowledgeBaseFactory; import org.drools.builder.KnowledgeBuilder; import org.drools.builder.KnowledgeBuilderError; import org.drools.builder.KnowledgeBuilderErrors; import org.drools.builder.KnowledgeBuilderFactory; import org.drools.builder.ResourceType; import org.drools.conf.EventProcessingOption; import org.drools.io.ResourceFactory; import org.drools.logger.KnowledgeRuntimeLogger; import org.drools.logger.KnowledgeRuntimeLoggerFactory; import org.drools.runtime.KnowledgeSessionConfiguration; import org.drools.runtime.StatefulKnowledgeSession; import org.drools.runtime.conf.ClockTypeOption; import org.drools.runtime.rule.WorkingMemoryEntryPoint; public class FusionMain { @SuppressWarnings(restriction) public static void main(String[] args) { try { KnowledgeSessionConfiguration config = KnowledgeBaseFactory.newKnowledgeSessionConfiguration(); config.setOption
Re: [rules-users] order of injected events
Wolfgang, Thanks very much for that explanation, it cleared up many questions. ...If the order of your concurrently arriving events is essential, you may have to insert an ordinal as a property... Can you expand on this idea or in an general practice for handling real time streams of data that need to be processed in order they were injected? Thanks, Chris On 7/21/2011 7:54 PM, Wolfgang Laun wrote: The insertion of DataReading events happens instantaneously, without Drools regaining consciousness in between. So, when the Engine wakes up, it finds 20 activations in its agenda, with the same salience. Tie breaking is defined to use LIFO. Running the Engine in real time, these 20 events are indeed concurrently from the Engine's point of view, and any order of firings is justified; all the more so because your rule contains nothing to prefer a firing of an older event. If the order of your concurrently arriving events is essential, you may have to insert an ordinal as a property. Cheers -W On 22 July 2011 11:07, Chris Richmond crichm...@referentia.com mailto:crichm...@referentia.com wrote: I am running a simple test like so: package com.sample; import org.drools.KnowledgeBase; import org.drools.KnowledgeBaseFactory; import org.drools.builder.KnowledgeBuilder; import org.drools.builder.KnowledgeBuilderError; import org.drools.builder.KnowledgeBuilderErrors; import org.drools.builder.KnowledgeBuilderFactory; import org.drools.builder.ResourceType; import org.drools.io.ResourceFactory; import org.drools.logger.KnowledgeRuntimeLogger; import org.drools.logger.KnowledgeRuntimeLoggerFactory; import org.drools.runtime.KnowledgeSessionConfiguration; import org.drools.runtime.StatefulKnowledgeSession; import org.drools.runtime.conf.ClockTypeOption; import org.drools.runtime.rule.WorkingMemoryEntryPoint; import com.sample.DroolsTest.Message; public class FusionMain { public static final void main(String[] args) { try { KnowledgeSessionConfiguration config = KnowledgeBaseFactory.newKnowledgeSessionConfiguration(); config.setOption( ClockTypeOption.get(realtime) ); KnowledgeBase kbase; kbase = readKnowledgeBase(); final StatefulKnowledgeSession ksession = kbase.newStatefulKnowledgeSession(); WorkingMemoryEntryPoint myStream = ksession.getWorkingMemoryEntryPoint(My Stream); Thread t = new Thread(new Runnable(){ @Override public void run() { ksession.fireUntilHalt(); } }); t.start(); for (float x = 0.0f; x 20.0f; x++){ DataReading dr = new DataReading(Reading + x, x); myStream.insert(dr); } } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } } private static KnowledgeBase readKnowledgeBase() throws Exception { KnowledgeBuilder kbuilder = KnowledgeBuilderFactory.newKnowledgeBuilder(); kbuilder.add(ResourceFactory.newClassPathResource(Sample.drl), ResourceType.DRL); KnowledgeBuilderErrors errors = kbuilder.getErrors(); if (errors.size() 0) { for (KnowledgeBuilderError error: errors) { System.err.println(error); } throw new IllegalArgumentException(Could not parse knowledge.); } KnowledgeBase kbase = KnowledgeBaseFactory.newKnowledgeBase(); kbase.addKnowledgePackages(kbuilder.getKnowledgePackages()); return kbase; } } With the following rule in the sample.drl file: package com.sample import com.sample.DroolsTest.Message; import java.util.Date; declare DataReading @role( event ) end rule MyGuidedRule dialect mvel when $dr: DataReading( reading 10.0 ) from entry-point My Stream then System.err.println(Reading: + $dr.name http://dr.name + 10.0 + System.currentTimeMillis()); end know I am running fireUntilHalt on a seperate thread as you can see, but events injected fire rules out of order...in fact almost the exact opposite order in which they were inserted to the stream every time: Reading: Reading 19.0 10.0 1311325346490 Reading: Reading 18.0 10.0 1311325346491 Reading: Reading 17.0 10.0 1311325346491 Reading: Reading 16.0 10.0 1311325346491 Reading: Reading 15.0 10.0 1311325346491 Reading: Reading 14.0 10.0 1311325346491 Reading: Reading 13.0 10.0 1311325346491 Reading: Reading 12.0 10.0 1311325346491 Reading: Reading 11.0 10.0 1311325346491 I want to eventually perform temporal reasoning, but how can I expect that to work if events are not evaluated in the order they were inserted. Perhaps I am setting
[rules-users] order of injected events
I am running a simple test like so: package com.sample; import org.drools.KnowledgeBase; import org.drools.KnowledgeBaseFactory; import org.drools.builder.KnowledgeBuilder; import org.drools.builder.KnowledgeBuilderError; import org.drools.builder.KnowledgeBuilderErrors; import org.drools.builder.KnowledgeBuilderFactory; import org.drools.builder.ResourceType; import org.drools.io.ResourceFactory; import org.drools.logger.KnowledgeRuntimeLogger; import org.drools.logger.KnowledgeRuntimeLoggerFactory; import org.drools.runtime.KnowledgeSessionConfiguration; import org.drools.runtime.StatefulKnowledgeSession; import org.drools.runtime.conf.ClockTypeOption; import org.drools.runtime.rule.WorkingMemoryEntryPoint; import com.sample.DroolsTest.Message; public class FusionMain { public static final void main(String[] args) { try { KnowledgeSessionConfiguration config = KnowledgeBaseFactory.newKnowledgeSessionConfiguration(); config.setOption( ClockTypeOption.get(realtime) ); KnowledgeBase kbase; kbase = readKnowledgeBase(); final StatefulKnowledgeSession ksession = kbase.newStatefulKnowledgeSession(); WorkingMemoryEntryPoint myStream = ksession.getWorkingMemoryEntryPoint(My Stream); Thread t = new Thread(new Runnable(){ @Override public void run() { ksession.fireUntilHalt(); } }); t.start(); for (float x = 0.0f; x 20.0f; x++){ DataReading dr = new DataReading(Reading + x, x); myStream.insert(dr); } } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } } private static KnowledgeBase readKnowledgeBase() throws Exception { KnowledgeBuilder kbuilder = KnowledgeBuilderFactory.newKnowledgeBuilder(); kbuilder.add(ResourceFactory.newClassPathResource(Sample.drl), ResourceType.DRL); KnowledgeBuilderErrors errors = kbuilder.getErrors(); if (errors.size() 0) { for (KnowledgeBuilderError error: errors) { System.err.println(error); } throw new IllegalArgumentException(Could not parse knowledge.); } KnowledgeBase kbase = KnowledgeBaseFactory.newKnowledgeBase(); kbase.addKnowledgePackages(kbuilder.getKnowledgePackages()); return kbase; } } With the following rule in the sample.drl file: package com.sample import com.sample.DroolsTest.Message; import java.util.Date; declare DataReading @role( event ) end rule MyGuidedRule dialect mvel when $dr: DataReading( reading 10.0 ) from entry-point My Stream then System.err.println(Reading: + $dr.name + 10.0 + System.currentTimeMillis()); end know I am running fireUntilHalt on a seperate thread as you can see, but events injected fire rules out of order...in fact almost the exact opposite order in which they were inserted to the stream every time: Reading: Reading 19.0 10.0 1311325346490 Reading: Reading 18.0 10.0 1311325346491 Reading: Reading 17.0 10.0 1311325346491 Reading: Reading 16.0 10.0 1311325346491 Reading: Reading 15.0 10.0 1311325346491 Reading: Reading 14.0 10.0 1311325346491 Reading: Reading 13.0 10.0 1311325346491 Reading: Reading 12.0 10.0 1311325346491 Reading: Reading 11.0 10.0 1311325346491 I want to eventually perform temporal reasoning, but how can I expect that to work if events are not evaluated in the order they were inserted. Perhaps I am setting up my session/kb improperly? Thanks, Chris ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
[rules-users] Fusion confusion
I have attached my program project with my main FusionMain.java and two small classes and my rule file Sample.drl. It's a zip file i have modified to be .piz for mail server reasons. In the Main I set up and run as STREAM mode session and execute on a background thread .fireUntilHalt(). Then I inject two objects(DataReading and ConfigEvent) The Sample.drl rule has the rules: declare DataReading @role( event ) end declare ConfigEvent @role( event ) end rule Detect high data reading when $dr: DataReading(reading 10.0) from entry-point My Stream then System.err.println(Data reading 10); end rule Wait for follup config lock-on-active when $dr: DataReading(reading 10.0) from entry-point My Stream not($de: ConfigEvent(this after[0s,10s] $dr)) then System.err.println(Action); end rule Detect config event when $ce: ConfigEvent() from entry-point My Stream then System.err.println(Config Event); end What I expect is that I would see the DataReading rule fire right away(it does) then 5 seconds later when I insert the ConfigEvent I would see it's rule fire(it does) But the Wait for follup config rule fires no matter what. To me, that rule should wait and make sure no ConfigEvent object was inserted within 10 seconds after the DataReading object, but no matter what that rule fires after 10 seconds. How can I make my inserted ConfigEvent(inserted within the 10 seconds) satisfy that condition so it cancels that rule from firing? I am using the latest download from the site (5.2.0 final) binaries. Does Fusion in fact work or am I doing something wrong? The zip file has the entire runnable program and project(have to modify lib references to point to correct Drools 5.2 binaries). If the zip file does not come through I will attach the files individually next. Thanks, Chris DroolsProject.piz Description: Binary data ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] Fusion confusion
Update: the sample project may have the modifier final on the main method for some reason...I have no idea how or why that got on there, but will prevent eclipse from running it. Also, I believe i found the problem: rule Wait for follup config lock-on-active when $dr: DataReading(reading 10.0) from entry-point My Stream not($de: ConfigEvent(this after[0s,10s] $dr)) then System.err.println(Action); end Should read: rule Wait for follup config lock-on-active when $dr: DataReading(reading 10.0) from entry-point My Stream not(ConfigEvent(this after[0s,10s] $dr) from entry-point My Stream) then System.err.println(Action); end where the temporal matching predicate must also state the stream I was injecting events to. This seems to work ok, but I would still appreciate feedback. Thanks, Chris On 7/22/2011 1:47 AM, Chris Richmond wrote: I have attached my program project with my main FusionMain.java and two small classes and my rule file Sample.drl. It's a zip file i have modified to be .piz for mail server reasons. In the Main I set up and run as STREAM mode session and execute on a background thread .fireUntilHalt(). Then I inject two objects(DataReading and ConfigEvent) The Sample.drl rule has the rules: declare DataReading @role( event ) end declare ConfigEvent @role( event ) end rule Detect high data reading when $dr: DataReading(reading 10.0) from entry-point My Stream then System.err.println(Data reading 10); end rule Wait for follup config lock-on-active when $dr: DataReading(reading 10.0) from entry-point My Stream not($de: ConfigEvent(this after[0s,10s] $dr)) then System.err.println(Action); end rule Detect config event when $ce: ConfigEvent() from entry-point My Stream then System.err.println(Config Event); end What I expect is that I would see the DataReading rule fire right away(it does) then 5 seconds later when I insert the ConfigEvent I would see it's rule fire(it does) But the Wait for follup config rule fires no matter what. To me, that rule should wait and make sure no ConfigEvent object was inserted within 10 seconds after the DataReading object, but no matter what that rule fires after 10 seconds. How can I make my inserted ConfigEvent(inserted within the 10 seconds) satisfy that condition so it cancels that rule from firing? I am using the latest download from the site (5.2.0 final) binaries. Does Fusion in fact work or am I doing something wrong? The zip file has the entire runnable program and project(have to modify lib references to point to correct Drools 5.2 binaries). If the zip file does not come through I will attach the files individually next. Thanks, Chris ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] Debug as within Eclipse
Sorry Frank, I gave up on Drools and Eclipse a long time ago Chris On Wed, Dec 2, 2009 at 11:02 AM, chris richmond richmond...@gmail.comwrote: I am using Galileo. Not sure if I downloaded the EE or standard Galileo. 2009/12/2 Leonardo Gomes leonardo.f.go...@gmail.com I've been experiencing the same problem, have already tried on both windows and ubuntu and also experienced that. The problem seems to be related to Galileo and I was thinking that maybe more specifically the JEE version, but haven't had the time to test it, so far... Are you using the standard Galileo? Leo. 2009/12/2 chris richmond richmond...@gmail.com I used the upate site to update my Eclipse Galileo IDE with the drools tools, created a new drools project, had it add the hello/goodbye test class and pointed my workspace to the 5.1M binaries. It runs fine, but when I Debug As - Drools Application I get the following errors. I get this error for any drools project I try to debug as Drools application within Eclipse. Any ideas? Thanks, CHris FATAL ERROR in native method: JDWP No transports initialized, jvmtiError=AGENT_ERROR_TRANSPORT_INIT(197) ERROR: transport error 202: connect failed: Connection refused ERROR: JDWP Transport dt_socket failed to initialize, TRANSPORT_INIT(510) JDWP exit error AGENT_ERROR_TRANSPORT_INIT(197): No transports initialized [../../../src/share/back/debugInit.c:690] ___ 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] April 19th Boot Camp to be open to all
is this boot camp still open to students? Chris 2010/3/15 David Sinclair dsincl...@chariotsolutions.com Need to come to the east coast some time! 2010/3/15 Mark Proctor mproc...@codehaus.org http://blog.athico.com/2010/03/april-19th-boot-camp-to-be-open-to-all.html We will now be opening the boot camp up to all, for the last 3 days. The boot camp was previously announced herehttp://blog.athico.com/2010/03/drools-open-source-healthcare.html. The over all schedule is below. I'll be putting up a registration wiki page up on line in the next day or two, like last years which you can fine here http://community.jboss.org/wiki/DroolsBootCampSanFranciscoJune2009. Keep an eye on the blog for more info soon. We are looking for people that would like to present, take a focus group or workshop. The topics can be on drools, or how drools is applied, or on projects that use drools, or just general interesting topics for rules, workflow, event processing and ontologies - anything you think the people there would be interested in. Email me if you would like to present *Where *- San Diego, CA (meeting place tbc)* Date *- Monday the 19th of April to Friday the 23rd of April Schedule - *Mon-Tue* (medical only) The the first two days are exclusive to the medical community and only people from medical organisations or with a medical background will be allowed to attend. - *Wed* (medical focus - open to all) The third day will still maintain a medical theme, wrapping up the last two days, but we will open it up for those that want to observe or participate. We will try and cover topics that will be interesting to all there, even if not from medical background, just be aware that medical discussions take priority. - *Thu-Fri* (general topics - open to all) The last two days is open to all and will have no specific topic ___ 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] Debuggin in Eclipse
Yes, I converted it to a Drools project and I do have errors being flagged in my drools file if I have them. Still nothing. I am very frustrated I am still able to stop at breakpoints in rules files by creating a drools project from scratch and Debug As - Drools application, but something about converting an existing project and debugging it. On Wed, Dec 9, 2009 at 6:52 AM, Kris Verlaenen kris.verlae...@cs.kuleuven.be wrote: Is your project a Drools project? You can convert existing projects to a Drools projects by right-clicking the project and selecting Convert to Drools Project. This will add the Drools library (which you can remove if you don't need it) and adds a Drools Builder. This builder is crucial as it generates the necessary meta-data used for breakpoints. You should be able to see the drools builder in the .project file. Also make sure that you have not turned off caching in the Drools preferences. The structure of your process should not matter, as long as your rules are on the classpath. You can easily check whether the drools builder is working, as it should show errors for incorrect syntax in your rule files. Kris Citeren chris richmond richmond...@gmail.com: Ok, I have a project working with Eclipse Galileo 3.5.1 and it works fine. I can create new drools projects and they debug fine with the DroolsTest example. However I have a very larege existing project that does not use the src/main/java and src/main/rules src folder structure and the project runs fine, and I can Debug as Drools Application no problem, however it will never stop on any breakpoints in the rules file. Does this have anything to do with the fact that I am not using the default src/rules direcories structure? Or, is it dependent on loading the DRL file in a particular method. I am loading the file usin this method: java.io.FileInputStream fis = *new* java.io.FileInputStream( *new* java.io.File(*C:\\Path\\To\\Some\\Dir\\rules.drl*)); builder.add(ResourceFactory.*newInputStreamResource*(fis), ResourceType.*DRL*); Should I be loading the fule file using the DroolsTest sample code method like below? KnowledgeBuilder kbuilder = KnowledgeBuilderFactory.*newKnowledgeBuilder*(); kbuilder.add(ResourceFactory.*newClassPathResource*(Sample.drl), ResourceType.*DRL*); Does these even make a difference? Or any ideas why I can't get any debug breakpoints in my rule file in my custom project to go into break-time? Thanks, Chris Disclaimer: http://www.kuleuven.be/cwis/email_disclaimer.htm ___ 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] Debuggin in Eclipse
They are all source folders in eclipse, so they should be. On Mon, Dec 7, 2009 at 6:58 PM, Ross H ross...@gmail.com wrote: Using a FileInputStream works for me with a non standard folder structure. Are all your folders on the eclipse build path? chris richmond-2 wrote: Ok, I have a project working with Eclipse Galileo 3.5.1 and it works fine. I can create new drools projects and they debug fine with the DroolsTest example. However I have a very larege existing project that does not use the src/main/java and src/main/rules src folder structure and the project runs fine, and I can Debug as Drools Application no problem, however it will never stop on any breakpoints in the rules file. Does this have anything to do with the fact that I am not using the default src/rules direcories structure? Or, is it dependent on loading the DRL file in a particular method. I am loading the file usin this method: java.io.FileInputStream fis = *new* java.io.FileInputStream( *new* java.io.File(*C:\\Path\\To\\Some\\Dir\\rules.drl*)); builder.add(ResourceFactory.*newInputStreamResource*(fis), ResourceType.*DRL*); Should I be loading the fule file using the DroolsTest sample code method like below? KnowledgeBuilder kbuilder = KnowledgeBuilderFactory.*newKnowledgeBuilder*(); kbuilder.add(ResourceFactory.*newClassPathResource*(Sample.drl), ResourceType.*DRL*); Does these even make a difference? Or any ideas why I can't get any debug breakpoints in my rule file in my custom project to go into break-time? Thanks, Chris ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users -- View this message in context: http://n3.nabble.com/Debuggin-in-Eclipse-tp71134p71211.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 ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
[rules-users] Debuggin in Eclipse
Ok, I have a project working with Eclipse Galileo 3.5.1 and it works fine. I can create new drools projects and they debug fine with the DroolsTest example. However I have a very larege existing project that does not use the src/main/java and src/main/rules src folder structure and the project runs fine, and I can Debug as Drools Application no problem, however it will never stop on any breakpoints in the rules file. Does this have anything to do with the fact that I am not using the default src/rules direcories structure? Or, is it dependent on loading the DRL file in a particular method. I am loading the file usin this method: java.io.FileInputStream fis = *new* java.io.FileInputStream( *new* java.io.File(*C:\\Path\\To\\Some\\Dir\\rules.drl*)); builder.add(ResourceFactory.*newInputStreamResource*(fis), ResourceType.*DRL*); Should I be loading the fule file using the DroolsTest sample code method like below? KnowledgeBuilder kbuilder = KnowledgeBuilderFactory.*newKnowledgeBuilder*(); kbuilder.add(ResourceFactory.*newClassPathResource*(Sample.drl), ResourceType.*DRL*); Does these even make a difference? Or any ideas why I can't get any debug breakpoints in my rule file in my custom project to go into break-time? Thanks, Chris ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] Eclipse plugin with latest Galileo
How did you get the plugin. I see it in the hudson link, but where are the instructions for installing it that way and not using the eclipse update site? The standard plugin procedure did not work for me. In other words, using that Hudson download, how do I install the plugin? Thanks, Chris 2009/12/2 Ross H ross...@gmail.com Just did a quick check, works for me. I'm running Galileo on OSX. On Thu, Dec 3, 2009 at 7:35 PM, Ross H ross...@gmail.com wrote: https://hudson.jboss.org/hudson/job/drools/lastSuccessfulBuild/artifact/trunk/target/ 2009/12/3 Leonardo Gomes leonardo.f.go...@gmail.com I've seen about three posts about that lately (including mine) and no one seemed to have solved it yet. What's the URL for hudson? Thanks, Leo. 2009/12/3 Ross H ross...@gmail.com I think there was a previous post on this. Try the latest from Hudson and see if that works. 2009/12/3 chris richmond richmond...@gmail.com Is anyone successfully using the IDE plugin with the latest Galileo version of Eclipse. I cannot get it to debug using Galileo(my previous post concerning debug as) I tested instlaling the IDE plugin by using the IDE update site link on the following versions. I normally use the Galileo, but tried the other for troubleshooting this Galileo standard Galileo EE Ganymede Standard The plugin appears to install just fine with all three, and the DroolsTest.java that is added when I create a new Drools project runs fine in all three. However, I am only able to debug as Drools application using Ganymede.So is it simply not possible to use the IDE update link with the latest Eclipse(Galileo)? Thanks, Chris ___ 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 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] CEP fusion
Hello, I have this test rule that basically fires if a followup reading is not received with the appropriate value within some time. According to the fusion docs, simply using: *not*( FollowUpReading(value == $val, *this* before[0s,5s] $reading ) ) should wait 5 seconds before firing, however this does not work unless I explicitly also set: *duration*( 5s ) and if I do that, it seems to wait the 5 seconds, however it always follows what I put in the duration value and seems to compeltely ignore the time tolerances I use here.: $reading : DatarReading($val: value) *not*( FollowUpReading(value == $val, *this* before[0s,5s] $reading ) ) And if I have different values, it will fire the rule after 2 seconds and ignore the 5s in the sample below. Any ideas? * rule* my rule *duration*( 2s ) *when * $reading : DatarReading($val: value) *not*( FollowUpReading(value == $val, *this* before[0s,5s] $reading ) ) *then* System.err.println(did not receive follow up - reading value: + $val); * end * ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] CEP fusion
my zip file attachment was blocked. I will try to attach the source/rule files. modified the standard DroolsTest.java that gets created when you create a new Drools project. Thanks, Chris On Thu, Dec 3, 2009 at 3:07 PM, chris richmond richmond...@gmail.comwrote: here is my eclipse project with source and rule files. I modified test rules/class that gets created with a new drools project in eclipse. I hope the .zip file comes through 2009/12/3 Edson Tirelli ed.tire...@gmail.com Are you running your application in STREAM mode or CLOUD mode? Delaying not is a feature of the STREAM mode. If you are already running in STREAM mode, can you give me an isolated test that I can check? Thanks Edson 2009/12/3 chris richmond richmond...@gmail.com Hello, I have this test rule that basically fires if a followup reading is not received with the appropriate value within some time. According to the fusion docs, simply using: *not*( FollowUpReading(value == $val, *this* before[0s,5s] $reading ) ) should wait 5 seconds before firing, however this does not work unless I explicitly also set: *duration*( 5s ) and if I do that, it seems to wait the 5 seconds, however it always follows what I put in the duration value and seems to compeltely ignore the time tolerances I use here.: $reading : DatarReading($val: value) *not*( FollowUpReading(value == $val, *this* before[0s,5s] $reading ) ) And if I have different values, it will fire the rule after 2 seconds and ignore the 5s in the sample below. Any ideas? * rule *my rule *duration*( 2s ) *when* $reading : DatarReading($val: value) *not*( FollowUpReading(value == $val, *this* before[0s,5s] $reading ) ) *then* System.err.println( did not receive follow up - reading value: + $val); * end * ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users -- Edson Tirelli JBoss Drools Core Development JBoss by Red Hat @ www.jboss.com ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users DatarReading.java Description: Binary data DroolsTest.java Description: Binary data FollowUpReading.java Description: Binary data FusionTesing.drl Description: Binary data ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
[rules-users] Testing
Hello, My emails stopped getting through from my other emal address and as some other users had helped me discover, the filtering/spam or whatever has prevented me from asking questions in the forumn, so I am testing from another email. Thanks, Chris ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
[rules-users] Debug as within Eclipse
I used the upate site to update my Eclipse Galileo IDE with the drools tools, created a new drools project, had it add the hello/goodbye test class and pointed my workspace to the 5.1M binaries. It runs fine, but when I Debug As - Drools Application I get the following errors. I get this error for any drools project I try to debug as Drools application within Eclipse. Any ideas? Thanks, CHris FATAL ERROR in native method: JDWP No transports initialized, jvmtiError=AGENT_ERROR_TRANSPORT_INIT(197) ERROR: transport error 202: connect failed: Connection refused ERROR: JDWP Transport dt_socket failed to initialize, TRANSPORT_INIT(510) JDWP exit error AGENT_ERROR_TRANSPORT_INIT(197): No transports initialized [../../../src/share/back/debugInit.c:690] ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] Debug as within Eclipse
I am using Galileo. Not sure if I downloaded the EE or standard Galileo. 2009/12/2 Leonardo Gomes leonardo.f.go...@gmail.com I've been experiencing the same problem, have already tried on both windows and ubuntu and also experienced that. The problem seems to be related to Galileo and I was thinking that maybe more specifically the JEE version, but haven't had the time to test it, so far... Are you using the standard Galileo? Leo. 2009/12/2 chris richmond richmond...@gmail.com I used the upate site to update my Eclipse Galileo IDE with the drools tools, created a new drools project, had it add the hello/goodbye test class and pointed my workspace to the 5.1M binaries. It runs fine, but when I Debug As - Drools Application I get the following errors. I get this error for any drools project I try to debug as Drools application within Eclipse. Any ideas? Thanks, CHris FATAL ERROR in native method: JDWP No transports initialized, jvmtiError=AGENT_ERROR_TRANSPORT_INIT(197) ERROR: transport error 202: connect failed: Connection refused ERROR: JDWP Transport dt_socket failed to initialize, TRANSPORT_INIT(510) JDWP exit error AGENT_ERROR_TRANSPORT_INIT(197): No transports initialized [../../../src/share/back/debugInit.c:690] ___ 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] Eclipse plugin with latest Galileo
Is anyone successfully using the IDE plugin with the latest Galileo version of Eclipse. I cannot get it to debug using Galileo(my previous post concerning debug as) I tested instlaling the IDE plugin by using the IDE update site link on the following versions. I normally use the Galileo, but tried the other for troubleshooting this Galileo standard Galileo EE Ganymede Standard The plugin appears to install just fine with all three, and the DroolsTest.java that is added when I create a new Drools project runs fine in all three. However, I am only able to debug as Drools application using Ganymede.So is it simply not possible to use the IDE update link with the latest Eclipse(Galileo)? Thanks, Chris ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
[rules-users] Drools bootcamp schedules
Hello all, Is there a list of scheduled boot camps with dates/locations anywhere? I can't seem to find it on the site/blog. Thanks, Chris ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
[rules-users] 5.10M samples
I loaded the latest (5.1M) sample for fusion into eclipse and it builds and runs, but does anyone else get this exception from time to time? Thanks, Chris = Unexpected exception caught: [Error: cannot invoke getter: getSymbol [declr.class: org.drools.examples.broker.model.SuddenDropEvent; act.class: null]] [Near : {... Unknown }] ^ [Line: 1, Column: 0] org.drools.runtime.rule.ConsequenceException: [Error: cannot invoke getter: getSymbol [declr.class: org.drools.examples.broker.model.SuddenDropEvent; act.class: null]] [Near : {... Unknown }] ^ [Line: 1, Column: 0] at org.drools.runtime.rule.impl.DefaultConsequenceExceptionHandler.handleExcept ion(DefaultConsequenceExceptionHandler.java:23) at org.drools.common.DefaultAgenda.fireActivation(DefaultAgenda.java:980) ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
[rules-users] Decision tables
Hello, What is the most straightforward example of using a decision table for rules(CSV or Excel) within the sample code? Essentially I want to check if it would work for the usage case where I want the end user to be able to set all sorts of parameter limit values for rules on objects being evaluate by rules. Also I would like for them to be able to set limits on combinations of objects via decision tables. Allowing the user to state specifically in the decision table something like: If I have more than 3 of these objects then look at the fieldB of all these objects, if any of these have X for fieldB then look at fieldC for all of them and sum the total of all fieldC 's for all objects in memory and if that number is above Z then do something But if there are less than 3 but more than 1(essentially 2) of these objects, then simply look at fieldC for both objects and reset fieldD for whichever object has a lower value for fieldM. Can decision tables be made to handlie this sort of flexible and extensible decision matrix, or would that not be good fit for scenarios like this? Thanks, Chris ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] retrieving agenda-groups from java api
_ From: rules-users-boun...@lists.jboss.org [mailto:rules-users-boun...@lists.jboss.org] On Behalf Of Chris Richmond Sent: Tuesday, October 13, 2009 11:30 AM To: 'Rules Users List' Subject: [rules-users] retrieving agenda-groups from java api Is there a similar technique for retrieving all Agenda Groups from the session? Something along the lines of Session.getAgenda().getAgendaGroups() I can only find so far: Session.getAgenda().getAgendaGroup(groupName) But I would like to be able to retrieve all agenda groups in the session Thanks, Chris _ From: rules-users-boun...@lists.jboss.org [mailto:rules-users-boun...@lists.jboss.org] On Behalf Of Chris Richmond Sent: Wednesday, September 30, 2009 8:13 AM To: 'Rules Users List' Subject: Re: [rules-users] retrieving streams/entry points from java api Ed, Thanks a lot. I am thinking about comding to Drools boot camp in Dallas? In late October. If not that one than the next one. Will you be there? I feel it would be beneficial to have some time to get over the hump with using Drools and Fusion to it's full potential. That way I can give you guys my use cases and discuss a proper Drools strategy. Thank, Chris _ From: rules-users-boun...@lists.jboss.org [mailto:rules-users-boun...@lists.jboss.org] On Behalf Of Edson Tirelli Sent: Wednesday, September 30, 2009 4:45 AM To: Rules Users List Subject: Re: [rules-users] retrieving streams/entry points from java api Chris, That is indeed missing in the public API. I am adding it as we speak, thanks for bringing that up: https://jira.jboss.org/jira/browse/JBRULES-2285 Meanwhile, until we release the new version, the workaround is to downcast the interface: for(WorkingMemoryEntryPoint entry : session.getWorkingMemoryEntryPoints()){ System.err.println(entry point stream: + ((InternalWorkingMemoryEntryPoint)entry).getEntryPoint().getEntryPointId()); } Edson 2009/9/29 Chris Richmond crichm...@referentia.com Hello, I am trying to determine, iterate the working memory streams within my rule by doing the following: for(WorkingMemoryEntryPoint entry : session.getWorkingMemoryEntryPoints()){ System.err.println(entry point stream: + entry.toString()); } But I can find no method/way to finid the actual text name of the entry point(what is written in the rule as from entry-point ). Is there a way to do this? To list the readable names of the entry points from your session? I would like to list those entry points in a drop down as application profiles, so if they have one selected, one entry point of rules will be inserted to and so on.. Thanks, Chris ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users -- Edson Tirelli JBoss Drools Core Development JBoss by Red Hat @ www.jboss.com ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
[rules-users] setting globals in rule file
Shouldn't it be possible to set a global variable value within the rule file itself at the top. Something like? global String deviceName = myDevice; I thought you could do that, but consistently get an error saying illegal character '=' expected ( Or something along those lines. This is possible and that syntax should work, shouldn't it? Thanks, Chris ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] setting globals in rule file
Hmm. Well..I have this rule file and it seems like a darn convenient place to set some configuration settings so the user could change them in the plain text file. Otherwise I have to implement another configuration settgin system then feed that to th setGlobal. Chris _ From: rules-users-boun...@lists.jboss.org [mailto:rules-users-boun...@lists.jboss.org] On Behalf Of Wolfgang Laun Sent: Wednesday, October 14, 2009 7:50 AM To: Rules Users List Subject: Re: [rules-users] setting globals in rule file No, globals can only be set by calling the WorkingMemory method wm.setGlobal(String name, Object value) You could call this in a consequence (RHS), but it's usually not a good idea to do so. What do you want to achieve? -W 2009/10/14 Chris Richmond crichm...@referentia.com Shouldn't it be possible to set a global variable value within the rule file itself at the top. Something like? global String deviceName = myDevice; I thought you could do that, but consistently get an error saying illegal character '=' expected ( Or something along those lines. This is possible and that syntax should work, shouldn't it? Thanks, Chris ___ 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] setting globals in rule file
Hmmm..good idea. Now if I can get functions to work. :-) Thanks, Chris _ From: rules-users-boun...@lists.jboss.org [mailto:rules-users-boun...@lists.jboss.org] On Behalf Of Wolfgang Laun Sent: Wednesday, October 14, 2009 8:15 AM To: Rules Users List Subject: Re: [rules-users] setting globals in rule file You could let the user write some functions such as function String parFoo(){ return foo42; } and evaluate them in a rule firing with high priority on eval(true). -W 2009/10/14 Chris Richmond crichm...@referentia.com Hmm. Well..I have this rule file and it seems like a darn convenient place to set some configuration settings so the user could change them in the plain text file. Otherwise I have to implement another configuration settgin system then feed that to th setGlobal. Chris _ From: rules-users-boun...@lists.jboss.org [mailto:rules-users-boun...@lists.jboss.org] On Behalf Of Wolfgang Laun Sent: Wednesday, October 14, 2009 7:50 AM To: Rules Users List Subject: Re: [rules-users] setting globals in rule file No, globals can only be set by calling the WorkingMemory method wm.setGlobal(String name, Object value) You could call this in a consequence (RHS), but it's usually not a good idea to do so. What do you want to achieve? -W 2009/10/14 Chris Richmond crichm...@referentia.com Shouldn't it be possible to set a global variable value within the rule file itself at the top. Something like? global String deviceName = myDevice; I thought you could do that, but consistently get an error saying illegal character '=' expected ( Or something along those lines. This is possible and that syntax should work, shouldn't it? Thanks, Chris ___ 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] setting globals in rule file
Yeah..more fun with functions. I have the following function function String getMyValue(){ return value 1; } I have declared it at the top of the rule file right after all imports and dialect statement but before any rules imports global Services services; global String currentProfilie; # setup dialect for the semantic code to be MVEL dialect mvel function String getMyValue(){ return value 1; } I then try to call the function from another rule consequence as a test: then System.err.println(getMapRouterAddress()); other statements which work fine Now as soon as I start up and the rule file is loaded, I get a null pointer exception that isn't really helpful as it simpoly points to one of my own external objects that references the session that failed to load. I have tried using functions many times and never successfully done so. How/where do I place a simple function like this and call it? Thanks Chris From: rules-users-boun...@lists.jboss.org [mailto:rules-users-boun...@lists.jboss.org] On Behalf Of Wolfgang Laun Sent: Wednesday, October 14, 2009 8:15 AM To: Rules Users List Subject: Re: [rules-users] setting globals in rule file You could let the user write some functions such as function String parFoo(){ return foo42; } and evaluate them in a rule firing with high priority on eval(true). -W 2009/10/14 Chris Richmond crichm...@referentia.com Hmm Well..I have this rule file and it seems like a darn convenient place to set some configuration settings so the user could change them in the plain text file. Otherwise I have to implement another configuration settgin system then feed that to th setGlobal Chris From: rules-users-boun...@lists.jboss.org [mailto:rules-users-boun...@lists.jboss.org] On Behalf Of Wolfgang Laun Sent: Wednesday, October 14, 2009 7:50 AM To: Rules Users List Subject: Re: [rules-users] setting globals in rule file No, globals can only be set by calling the WorkingMemory method wm.setGlobal(String name, Object value) You could call this in a consequence (RHS), but it's usually not a good idea to do so. What do you want to achieve? -W 2009/10/14 Chris Richmond crichm...@referentia.com Shouldnt it be possible to set a global variable value within the rule file itself at the top. Something like? global String deviceName = myDevice; I thought you could do that, but consistently get an error saying illegal character = expected ( Or something along those lines. This is possible and that syntax should work, shouldnt it? Thanks, Chris ___ 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] setting globals in rule file
Great... So, can I simply switch the dialect to not use MVEL? Chris _ From: rules-users-boun...@lists.jboss.org [mailto:rules-users-boun...@lists.jboss.org] On Behalf Of Wolfgang Laun Sent: Wednesday, October 14, 2009 8:50 AM To: Rules Users List Subject: Re: [rules-users] setting globals in rule file I've used functions with Drools 5, but not with MVEL. A recent thread seemed to indicate a problem with MVEL for functions, though. What you show of your code appears to be OK. -W On Wed, Oct 14, 2009 at 8:35 PM, Chris Richmond crichm...@referentia.com wrote: Yeah..more fun with functions. I have the following function function String getMyValue(){ return value 1; } I have declared it at the top of the rule file right after all imports and dialect statement but before any rules imports global Services services; global String currentProfilie; # setup dialect for the semantic code to be MVEL dialect mvel function String getMyValue(){ return value 1; } I then try to call the function from another rule consequence as a test: then System.err.println(getMapRouterAddress()); other statements which work fine Now as soon as I start up and the rule file is loaded, I get a null pointer exception that isn't really helpful as it simpoly points to one of my own external objects that references the session that failed to load. I have tried using functions many times and never successfully done so. How/where do I place a simple function like this and call it? Thanks Chris From: rules-users-boun...@lists.jboss.org [mailto:rules-users-boun...@lists.jboss.org] On Behalf Of Wolfgang Laun Sent: Wednesday, October 14, 2009 8:15 AM To: Rules Users List Subject: Re: [rules-users] setting globals in rule file You could let the user write some functions such as function String parFoo(){ return foo42; } and evaluate them in a rule firing with high priority on eval(true). -W 2009/10/14 Chris Richmond crichm...@referentia.com Hmm. Well..I have this rule file and it seems like a darn convenient place to set some configuration settings so the user could change them in the plain text file. Otherwise I have to implement another configuration settgin system then feed that to th setGlobal. Chris From: rules-users-boun...@lists.jboss.org [mailto:rules-users-boun...@lists.jboss.org] On Behalf Of Wolfgang Laun Sent: Wednesday, October 14, 2009 7:50 AM To: Rules Users List Subject: Re: [rules-users] setting globals in rule file No, globals can only be set by calling the WorkingMemory method wm.setGlobal(String name, Object value) You could call this in a consequence (RHS), but it's usually not a good idea to do so. What do you want to achieve? -W 2009/10/14 Chris Richmond crichm...@referentia.com Shouldn't it be possible to set a global variable value within the rule file itself at the top. Something like? global String deviceName = myDevice; I thought you could do that, but consistently get an error saying illegal character '=' expected ( Or something along those lines. This is possible and that syntax should work, shouldn't it? Thanks, Chris ___ 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 mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
[rules-users] Latest Drools with Latest Eclipse
Is it possible to run all the latest Drools 5.1.0 with the latest version of Eclipse and the Elipse plugins, etc? Has anyone successfully done this? Also, I remember seeing a link to a testing framework within the IDE on the drools blog at some time, but cannot seem to locate it. Does anyone know what I am talking about and can provide the link? Thanks, Chris ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] retrieving streams/entry points from java api
Ed, Thanks a lot. I am thinking about comding to Drools boot camp in Dallas? In late October. If not that one than the next one. Will you be there? I feel it would be beneficial to have some time to get over the hump with using Drools and Fusion to it's full potential. That way I can give you guys my use cases and discuss a proper Drools strategy. Thank, Chris _ From: rules-users-boun...@lists.jboss.org [mailto:rules-users-boun...@lists.jboss.org] On Behalf Of Edson Tirelli Sent: Wednesday, September 30, 2009 4:45 AM To: Rules Users List Subject: Re: [rules-users] retrieving streams/entry points from java api Chris, That is indeed missing in the public API. I am adding it as we speak, thanks for bringing that up: https://jira.jboss.org/jira/browse/JBRULES-2285 Meanwhile, until we release the new version, the workaround is to downcast the interface: for(WorkingMemoryEntryPoint entry : session.getWorkingMemoryEntryPoints()){ System.err.println(entry point stream: + ((InternalWorkingMemoryEntryPoint)entry).getEntryPoint().getEntryPointId()); } Edson 2009/9/29 Chris Richmond crichm...@referentia.com Hello, I am trying to determine, iterate the working memory streams within my rule by doing the following: for(WorkingMemoryEntryPoint entry : session.getWorkingMemoryEntryPoints()){ System.err.println(entry point stream: + entry.toString()); } But I can find no method/way to finid the actual text name of the entry point(what is written in the rule as from entry-point ). Is there a way to do this? To list the readable names of the entry points from your session? I would like to list those entry points in a drop down as application profiles, so if they have one selected, one entry point of rules will be inserted to and so on.. Thanks, Chris ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users -- Edson Tirelli JBoss Drools Core Development JBoss by Red Hat @ www.jboss.com ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] DBC = ORF 2009
Ed and James, I would love to attend ORF to learn more about the science of rules engines in general as well. I'm not sure if I can get the company to cover the cost as well as the entire week of training days off. I also unfortunately, have a pretty large customer meeting the actual week of ORF. Now, they have said they are open to sending me to the Drools boot camp and that I don't have to necessarily be there to meet the customers that week, so I might make a pitch. One thing about the ORF though. It seems a bit intimidating. By that I mean I will be surrounded by domain experts whereas I know little to nothing about rules based systems/design. I am trying to feel out Drools within a prototype application and we do plan on using it more, but I literally haven't had the time to do some of the more theoretical background reading about algorithms(Rete and others) and other topics like this. I'm afraid I would be completely lost and unable to really contribute anything to discussions at the ORF. I also want to be able do defend the ORF as beneificial to someone like me if I am to sell it to my superiors and really believe it. What are your thoughts guys? Chris _ From: rules-users-boun...@lists.jboss.org [mailto:rules-users-boun...@lists.jboss.org] On Behalf Of James Owen Sent: Wednesday, September 30, 2009 8:40 AM To: Rules Users List Subject: [rules-users] DBC = ORF 2009 Chris: James here. From a purely selfish point of view, the Drools Boot Camp in Dallas followed by the October Rules Fest would be a GREAT opportunity for you not only to learn from the best Drools personnel, but also to learn from the absolute best in the business for rulebased systems. This is, to my knowledge, this is the ONLY conference dedicated to the practicing rulebase technical person. I really believe that you can learn more at DBC/ORF in a week than you could at 10 of the vendor schools. Where else would you get a chance to listen to Dr. Charles Forgy, Gary Riley, Tom Cooper, Dr. Richard Hicks, Paul Vincent, Carlos Seranno-Morales, Dr. Daniel Levine, John Zachman and many, many others in one week? A seminar with ANY of these would cost more than the $500 that you would pay for ORf. Most techies go through life and NEVER get to meet even one of these guys. Not only that, you will get to hear them discuss among themselves and with the attendees all of the problems that are cropping up all over the world and possible solutions. Where else would you get to ask Dr. Forgy questions, one-on-one, about the NEW algorithm called TECH that is at least 10 times faster than his Rete 2 / III? Or to get into details with him about parallel rulebased systems? And, you never know - this could be the last ORF. There might not be another one like this. Perhaps this sounds self-serving, but I can't stress enough the importance of attending NOW and not putting this off until another time. There might never be another time like this with this particular cast of speakers. SDG James Owen Founder October Rules Fest Senior Consultant / Architect KBSC http://www.kbsc.com http://www.OctoberRulesFest.org Twitter: OctRulesFest Blogs: http://JavaRules.blogspot.com [Rulebased Systems Blog] http://ORF2009.blogspot.com [October Rules Fest Blog] http://exscg.blogspot.com/ [Expert Systems Consulting Group Blog] If I have seen a little further it is by standing on the shoulders of giants. Sir Isaac Newton in a letter to Robert Hooke, 5 Feb 1676 Come to October Rules Fest and stand on the shoulders of the Giants of the industry; if only for a week. On Sep 30, 2009, at 1:13 PM, Chris Richmond wrote: Ed, Thanks a lot. I am thinking about comding to Drools boot camp in Dallas? In late October. If not that one than the next one. Will you be there? I feel it would be beneficial to have some time to get over the hump with using Drools and Fusion to it's full potential. That way I can give you guys my use cases and discuss a proper Drools strategy. Thank, Chris _ From: rules-users-boun...@lists.jboss.org [mailto:rules-users-boun...@lists.jboss.org] On Behalf Of Edson Tirelli Sent: Wednesday, September 30, 2009 4:45 AM To: Rules Users List Subject: Re: [rules-users] retrieving streams/entry points from java api Chris, That is indeed missing in the public API. I am adding it as we speak, thanks for bringing that up: https://jira.jboss.org/jira/browse/JBRULES-2285 Meanwhile, until we release the new version, the workaround is to downcast the interface: for(WorkingMemoryEntryPoint entry : session.getWorkingMemoryEntryPoints()){ System.err.println(entry point stream: + ((InternalWorkingMemoryEntryPoint)entry).getEntryPoint().getEntryPointId()); } Edson 2009/9/29 Chris Richmond crichm...@referentia.com Hello, I am
[rules-users] Understanding Fusion temporal reasoning
Hello, I am trying to make a rule to delay firing until a certain amount of time has passed without another event being received. I have set up a loop that goes every 10 seconds in my main application that takes readings and injects them into the ReadingStream. These are like sensor readings. I have a thread started at initialization that is basically calling fireUntilHalt() and I never call halt until shutdown, and that seams to be working fine. So basically any time an out of spec reading in my Reading object (15) is received, I want to wait to see if a FollowUpReading is not received in the next 5 seconds, before I fire the results(The second rule below). The first rule is there just to verify I am indeed detecting NumReadings with values 15 being injected and that works fine. Now at this point in my appication I am *never* inserting a FollowUpReading object/event, so I would expect the 2nd rule to fire all the time, however the strange thing is that it only fires the first time I receive a reading out of spec. I see rule one fire, then the seond time, but after that any subsequent out of spec readings received(I know they are out of spec, because rule 1 still fires when received) but rule 2 never fires again. It only ever fires one time! This is very confusing. These ar the only 2 rules and the only two object types being inserted to the stream. Know that rule 2 *can* fire because it does once and only once. Why won't it fire beyond the first time, even though I never insert the FollowUpReading() ? Thanks, Chris declare NumReading @role( event ) end declare FollowUpReading @role(event) end rule Determine out of spec reading when $n : NumReading($r:reading 15) from entry-point ReadingStream; then System.err.println(Fire off a follow up reading for device: + $n); end rule Missed degrading confirmation reading when $n : NumReading($r:reading 15) from entry-point ReadingStream; not (FollowUpReading(this after[0s, 5s] $n)) then System.err.println(No good reading received for: + $n); end ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
[rules-users] retrieving streams/entry points from java api
Hello, I am trying to determine, iterate the working memory streams within my rule by doing the following: for(WorkingMemoryEntryPoint entry : session.getWorkingMemoryEntryPoints()){ System.err.println(entry point stream: + entry.toString()); } But I can find no method/way to finid the actual text name of the entry point(what is written in the rule as from entry-point ). Is there a way to do this? To list the readable names of the entry points from your session? I would like to list those entry points in a drop down as application profiles, so if they have one selected, one entry point of rules will be inserted to and so on.. Thanks, Chris ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] Understanding Fusion temporal reasoning
Ok..will do. BTW.is the newgroup problem happening again? I posted this question about 3 times over the last week as well as some others, and I don't mind that people can't help all the time at all, but I know there was a problem before and I posted this again today because iI never received any responses for like a week and that doesn't happen, usuallly someone mentions something. Thanks, Chris _ From: rules-users-boun...@lists.jboss.org [mailto:rules-users-boun...@lists.jboss.org] On Behalf Of Edson Tirelli Sent: Tuesday, September 29, 2009 9:21 AM To: Rules Users List Subject: Re: [rules-users] Understanding Fusion temporal reasoning Chris, Someone found a bug a couple days ago that might be affecting you too. What happens if you write: declare NumReading @role( event ) @expires( 10s ) end ? Edson 2009/9/29 Chris Richmond crichm...@referentia.com Hello, I am trying to make a rule to delay firing until a certain amount of time has passed without another event being received. I have set up a loop that goes every 10 seconds in my main application that takes readings and injects them into the ReadingStream. These are like sensor readings. I have a thread started at initialization that is basically calling fireUntilHalt() and I never call halt until shutdown, and that seams to be working fine. So basically any time an out of spec reading in my Reading object (15) is received, I want to wait to see if a FollowUpReading is not received in the next 5 seconds, before I fire the results(The second rule below). The first rule is there just to verify I am indeed detecting NumReadings with values 15 being injected and that works fine. Now at this point in my appication I am *never* inserting a FollowUpReading object/event, so I would expect the 2nd rule to fire all the time, however the strange thing is that it only fires the first time I receive a reading out of spec. I see rule one fire, then the seond time, but after that any subsequent out of spec readings received(I know they are out of spec, because rule 1 still fires when received) but rule 2 never fires again. It only ever fires one time! This is very confusing. These ar the only 2 rules and the only two object types being inserted to the stream. Know that rule 2 *can* fire because it does once and only once. Why won't it fire beyond the first time, even though I never insert the FollowUpReading() ? Thanks, Chris declare NumReading @role( event ) end declare FollowUpReading @role(event) end rule Determine out of spec reading when $n : NumReading($r:reading 15) from entry-point ReadingStream; then System.err.println(Fire off a follow up reading for device: + $n); end rule Missed degrading confirmation reading when $n : NumReading($r:reading 15) from entry-point ReadingStream; not (FollowUpReading(this after[0s, 5s] $n)) then System.err.println(No good reading received for: + $n); end ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users -- Edson Tirelli JBoss Drools Core Development JBoss by Red Hat @ www.jboss.com ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
[rules-users] Agenda Filters usage
Would agenda filters be a good usage in this scenario. I have a set of objects I want to evaluate in stages, and so I only want certain rules to fire at certain stages. So the idea would be to have the main application do some work on those objects then updte and fire rules on them for stage 1(Agenda Filter 1) where the rule enine would set some bits based on the objects based on other fields.then the outside appliction would process some more and then update the objects and fire ther rules for stage 2(Agenda Filter 2) and so on for many stages. This would make it easier to write rules that only evaluate on the obects at certain stages and would make it easier to write rules that don't' conflict with each other(i.e. a rule I only want to evaluate stage 2 objects evaluating stage 1 objects). IF this *is* a reasonable usage scenario, is there a sample in the documentation of Firing rules on an agenda filter. I found reference to writing a rule file that puts rules in certain agendas, but not actually firing those rules from the client. Thanks, Chris ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
[rules-users] Event streams
It is my understanding that an event will be detected as soon as it is inserted into a stream.meaning that I don't have to explicitly call fireRules in order to evaluate events, but them will be evaluated as soon as I insert them into a stream, so a rule like the one below would fire as soon as I perform datastream.insert(myDataStreamObject) without having to explicitly fire rules? Is that behavior correct/intended? Declare MyDataStreamObject @role(event) End //rule detect a stream data object When MyDataStreamObject() from entry point DATA Then System.err.println(data object inserted); end Also, could I generate another event(long lived.say it lives 1 minute) so that if the above event detector fired and some condition was met, I could have it fire some event within the rule engine? Something like the following: //rule detect a stream data object When MyDataStreamObject($val: fieldValue 20) from entry point DATA Then //I want to raise an event purely from this rule that will live for one minute or so, that I can use to further refine this rule, to make sure this rule makes //sure that the MyDataStreamObject event NOT INCLUDED within the generated longer lived event lifetime. Efffectively preventing me from firing this if one of my //generated events is still living end Thanks, Chris ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] Event streams
I guess a folow up would be, would it be possible to terminate a long lived event that was generated with the arrival of another event? Thanks, Chris _ From: rules-users-boun...@lists.jboss.org [mailto:rules-users-boun...@lists.jboss.org] On Behalf Of Chris Richmond Sent: Friday, September 25, 2009 10:18 AM To: 'Rules Users List' Subject: [rules-users] Event streams It is my understanding that an event will be detected as soon as it is inserted into a stream.meaning that I don't have to explicitly call fireRules in order to evaluate events, but them will be evaluated as soon as I insert them into a stream, so a rule like the one below would fire as soon as I perform datastream.insert(myDataStreamObject) without having to explicitly fire rules? Is that behavior correct/intended? Declare MyDataStreamObject @role(event) End //rule detect a stream data object When MyDataStreamObject() from entry point DATA Then System.err.println(data object inserted); end Also, could I generate another event(long lived.say it lives 1 minute) so that if the above event detector fired and some condition was met, I could have it fire some event within the rule engine? Something like the following: //rule detect a stream data object When MyDataStreamObject($val: fieldValue 20) from entry point DATA Then //I want to raise an event purely from this rule that will live for one minute or so, that I can use to further refine this rule, to make sure this rule makes //sure that the MyDataStreamObject event NOT INCLUDED within the generated longer lived event lifetime. Efffectively preventing me from firing this if one of my //generated events is still living end Thanks, Chris ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] Event streams
So would I simply call fireUntilHalt() in a loop in a separate thread? Is Halt called by the engine when all rules have fired, or so I need to also call that explicitly? Thanks, Chris _ From: rules-users-boun...@lists.jboss.org [mailto:rules-users-boun...@lists.jboss.org] On Behalf Of Greg Barton Sent: Friday, September 25, 2009 10:30 AM To: Rules Users List Subject: Re: [rules-users] Event streams Yes to both. However to the first part (rules firing automatically) you need to use fireUntilHalt() instead of fireAllRules(). fireUntilHalt blocks (until halt is called) so you need to invoke it in a separate Thread. Then from another thread you can insert events into the entry points. For the second item (long lived event) you must use an @expires tag in your object declaration and be running in STREAM mode. _ From: Chris Richmond crichm...@referentia.com To: Rules Users List rules-users@lists.jboss.org Sent: Friday, September 25, 2009 3:17:52 PM Subject: [rules-users] Event streams It is my understanding that an event will be detected as soon as it is inserted into a stream.meaning that I don't have to explicitly call fireRules in order to evaluate events, but them will be evaluated as soon as I insert them into a stream, so a rule like the one below would fire as soon as I perform datastream.insert(myDataStreamObject) without having to explicitly fire rules? Is that behavior correct/intended? Declare MyDataStreamObject @role(event) End //rule detect a stream data object When MyDataStreamObject() from entry point DATA Then System.err.println(data object inserted); end Also, could I generate another event(long lived.say it lives 1 minute) so that if the above event detector fired and some condition was met, I could have it fire some event within the rule engine? Something like the following: //rule detect a stream data object When MyDataStreamObject($val: fieldValue 20) from entry point DATA Then //I want to raise an event purely from this rule that will live for one minute or so, that I can use to further refine this rule, to make sure this rule makes //sure that the MyDataStreamObject event NOT INCLUDED within the generated longer lived event lifetime. Efffectively preventing me from firing this if one of my //generated events is still living end Thanks, Chris ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
[rules-users] Events Temporal reasoning problem
Hello, I am trying to make a rule to delay firing until a certain amount of time has passed without another event being received. I have set up a loop that goes every 10 seconds in my main application that takes readings and injects them into the ReadingStream. These are like sensor readings. I have a thread started at initialization that is basically calling fireUntilHalt() and I never call halt until shutdown, and that seams to be working fine. So basically any time an out of spec reading in my Reading object (15) is received, I want to wait to see if a FollowUpReading is not received in the next 5 seconds, before I fire the results(The second rule below). The first rule is there just to verify I am indeed detecting NumReadings with values 15 being injected and that works fine. Now at this point in my appication I am *never* inserting a FollowUpReading object/event, so I would expect the 2nd rule to fire all the time, however the strange thing is that it only fires the first time I receive a reading out of spec. I see rule one fire, then the seond time, but after that any subsequent out of spec readings received(I know they are out of spec, because rule 1 still fires when received) but rule 2 never fires again. It only ever fires one time! This is very confusing. These ar the only 2 rules and the only two object types being inserted to the stream. Know that rule 2 *can* fire because it does once and only once. Why won't it fire beyond the first time, even though I never insert the FollowUpReading() ? Thanks, Chris declare NumReading @role( event ) end declare FollowUpReading @role(event) end rule Determine out of spec reading when $n : NumReading($r:reading 15) from entry-point ReadingStream; then System.err.println(Fire off a follow up reading for device: + $n); end rule Missed degrading confirmation reading when $n : NumReading($r:reading 15) from entry-point ReadingStream; not (FollowUpReading(this after[0s, 5s] $n)) then System.err.println(No good reading received for: + $n); end ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
[rules-users] persistent java objects in working memory
Hello, I am trying to create a set of java objects, which I insert into the session at startup. Then at regular timed iterations I want to examine the values of those objects. During the timer iteration, some fields may have been changed by the primary program. So I have a rule for now that is just trying to identify that the do indeed exist on each iteration: rule Identify Java Objects lock-on-active when $mo : MyDataObject(); then System.err.println(MYOBJECT in system: + $mo.getID + | + $mo.getTestFieldData); end As I said, at startup I insert 3 of these objects into my session, then every 10 seconds I just want to ensure they are there. However the output from this rule only fires on the firet iteration, after that the rule doesn't fire. I am not retrcating the objects or even concerning myself with the FactHandle, as I plan to leave them in working memory and change values on those 3 objects from the main application in each application loop, then make decisions in the rule engine based on the values of those 3 objects. However, for now I just nee to find out why the objects only live for my first loop and call of session.fireAllRules(). Any ideas or what I am doing wrong? Thanks, Chris ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] persistent java objects in working memory
But in your example, wouldn't the rule still not fire since the when: $mo : MyDataObject(); $c : Cycle(); Would be satisfied as far as the $c : cycle() But the $mo : MyDataObject() : would still not be satisfied would it? I am writing up a test of this, but I am confused.why would $mo : MyDataObject() suddenly be satisfied just because $c : Cycle() is? Thanks, Chris _ From: rules-users-boun...@lists.jboss.org [mailto:rules-users-boun...@lists.jboss.org] On Behalf Of Greg Barton Sent: Wednesday, September 23, 2009 10:02 AM To: Rules Users List Subject: Re: [rules-users] persistent java objects in working memory You've answered your own question. :) The rule you've given will only fire when the object is asserted or modified. (And you have to inform the engine of the modification.) You have to inform the engine that the object has been modified every cycle. (And if you want the engine to fire that rule even if the object has not been modified, you can still inform the engine. All that does is force the rules to reconsider the object.) However, the way I'd do it is to have a new object that is inserted on each iteration. Let's call it Cycle and give it a count. Then your rule would look like this: rule Identify Java Objects lock-on-active when $mo : MyDataObject(); $c : Cycle(); then System.err.println(MYOBJECT in system: + $mo.getID() + | + $mo.getTestFieldData() + on Cycle + $c.getCount()); end When the iteration is over, you would retract the Cycle object. (Only one Cycle should be in working memory at once, and it's a good idea to have a rule that enforces that invariant.) You should follow this pattern for any rule you want to guarantee to fire on each iteration. _ From: Chris Richmond crichm...@referentia.com To: Rules Users List rules-users@lists.jboss.org Sent: Wednesday, September 23, 2009 2:15:35 PM Subject: [rules-users] persistent java objects in working memory Hello, I am trying to create a set of java objects, which I insert into the session at startup. Then at regular timed iterations I want to examine the values of those objects. During the timer iteration, some fields may have been changed by the primary program. So I have a rule for now that is just trying to identify that the do indeed exist on each iteration: rule Identify Java Objects lock-on-active when $mo : MyDataObject(); then System.err.println(MYOBJECT in system: + $mo.getID + | + $mo.getTestFieldData); end As I said, at startup I insert 3 of these objects into my session, then every 10 seconds I just want to ensure they are there. However the output from this rule only fires on the firet iteration, after that the rule doesn't fire. I am not retrcating the objects or even concerning myself with the FactHandle, as I plan to leave them in working memory and change values on those 3 objects from the main application in each application loop, then make decisions in the rule engine based on the values of those 3 objects. However, for now I just nee to find out why the objects only live for my first loop and call of session.fireAllRules(). Any ideas or what I am doing wrong? Thanks, Chris ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] persistent java objects in working memory
Well my little test seems to confirm that this does indeed work, although I am not clear as to exactly why? Also, how do I prevent modifications made to a MyObject in another rule from making this one fire again? Can I do it by always having this one with the highest salience to ensure it runs first? Or would it be preferable to set a dirty flag on the object and make this rule make sure that hasn't been checked. That might not be an option an an object you can't mofidy for specific rule engine usage. Thanks, Chris _ From: rules-users-boun...@lists.jboss.org [mailto:rules-users-boun...@lists.jboss.org] On Behalf Of Greg Barton Sent: Wednesday, September 23, 2009 10:02 AM To: Rules Users List Subject: Re: [rules-users] persistent java objects in working memory You've answered your own question. :) The rule you've given will only fire when the object is asserted or modified. (And you have to inform the engine of the modification.) You have to inform the engine that the object has been modified every cycle. (And if you want the engine to fire that rule even if the object has not been modified, you can still inform the engine. All that does is force the rules to reconsider the object.) However, the way I'd do it is to have a new object that is inserted on each iteration. Let's call it Cycle and give it a count. Then your rule would look like this: rule Identify Java Objects lock-on-active when $mo : MyDataObject(); $c : Cycle(); then System.err.println(MYOBJECT in system: + $mo.getID() + | + $mo.getTestFieldData() + on Cycle + $c.getCount()); end When the iteration is over, you would retract the Cycle object. (Only one Cycle should be in working memory at once, and it's a good idea to have a rule that enforces that invariant.) You should follow this pattern for any rule you want to guarantee to fire on each iteration. _ From: Chris Richmond crichm...@referentia.com To: Rules Users List rules-users@lists.jboss.org Sent: Wednesday, September 23, 2009 2:15:35 PM Subject: [rules-users] persistent java objects in working memory Hello, I am trying to create a set of java objects, which I insert into the session at startup. Then at regular timed iterations I want to examine the values of those objects. During the timer iteration, some fields may have been changed by the primary program. So I have a rule for now that is just trying to identify that the do indeed exist on each iteration: rule Identify Java Objects lock-on-active when $mo : MyDataObject(); then System.err.println(MYOBJECT in system: + $mo.getID + | + $mo.getTestFieldData); end As I said, at startup I insert 3 of these objects into my session, then every 10 seconds I just want to ensure they are there. However the output from this rule only fires on the firet iteration, after that the rule doesn't fire. I am not retrcating the objects or even concerning myself with the FactHandle, as I plan to leave them in working memory and change values on those 3 objects from the main application in each application loop, then make decisions in the rule engine based on the values of those 3 objects. However, for now I just nee to find out why the objects only live for my first loop and call of session.fireAllRules(). Any ideas or what I am doing wrong? Thanks, Chris ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] persistent java objects in working memory
Now I am really confused, when I try to set some condition on the MyDataObject itself like this rule Identify Java Objects lock-on-active when $mo : MyDataObject($mf:testFieldData 20); $c : Cycle(); then System.err.println(MYOBJECT in system: + $mo.getID() + | + $mo.getTestFieldData()); end Then this still fires every single time, even when testFieldData is over 20.. -Chris _ From: rules-users-boun...@lists.jboss.org [mailto:rules-users-boun...@lists.jboss.org] On Behalf Of Greg Barton Sent: Wednesday, September 23, 2009 10:02 AM To: Rules Users List Subject: Re: [rules-users] persistent java objects in working memory You've answered your own question. :) The rule you've given will only fire when the object is asserted or modified. (And you have to inform the engine of the modification.) You have to inform the engine that the object has been modified every cycle. (And if you want the engine to fire that rule even if the object has not been modified, you can still inform the engine. All that does is force the rules to reconsider the object.) However, the way I'd do it is to have a new object that is inserted on each iteration. Let's call it Cycle and give it a count. Then your rule would look like this: rule Identify Java Objects lock-on-active when $mo : MyDataObject(); $c : Cycle(); then System.err.println(MYOBJECT in system: + $mo.getID() + | + $mo.getTestFieldData() + on Cycle + $c.getCount()); end When the iteration is over, you would retract the Cycle object. (Only one Cycle should be in working memory at once, and it's a good idea to have a rule that enforces that invariant.) You should follow this pattern for any rule you want to guarantee to fire on each iteration. _ From: Chris Richmond crichm...@referentia.com To: Rules Users List rules-users@lists.jboss.org Sent: Wednesday, September 23, 2009 2:15:35 PM Subject: [rules-users] persistent java objects in working memory Hello, I am trying to create a set of java objects, which I insert into the session at startup. Then at regular timed iterations I want to examine the values of those objects. During the timer iteration, some fields may have been changed by the primary program. So I have a rule for now that is just trying to identify that the do indeed exist on each iteration: rule Identify Java Objects lock-on-active when $mo : MyDataObject(); then System.err.println(MYOBJECT in system: + $mo.getID + | + $mo.getTestFieldData); end As I said, at startup I insert 3 of these objects into my session, then every 10 seconds I just want to ensure they are there. However the output from this rule only fires on the firet iteration, after that the rule doesn't fire. I am not retrcating the objects or even concerning myself with the FactHandle, as I plan to leave them in working memory and change values on those 3 objects from the main application in each application loop, then make decisions in the rule engine based on the values of those 3 objects. However, for now I just nee to find out why the objects only live for my first loop and call of session.fireAllRules(). Any ideas or what I am doing wrong? Thanks, Chris ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] persistent java objects in working memory
Yes..I have these rules and the problem was I wasn't including the $c: cycle in the second rule ( I bolded it). So any rule I write subsequently has to have that $c : cycle() check in order to fire now? Not just the first rule which identifies all in memory objects and calls update on them? That seems counterintuitive..it seems like if I simply call update() on each object in the first rule, that the second should fire withought checking the Cycle object as well. Chris rule Identify MyObject lock-on-active when $mo : MyDataObject(); $c : Cycle(); then System.err.println(MYDATAOBJECT in system: + $mo.getID() + | + $mo.getTestFieldData(); update($sb); end rule Identify Problem lock-on-active when $mo : MyDataObject($td:testFieldData 20); $c : Cycle(); then System.err.println(OUT OF SPEC MYDATAOBJECT: + $mo.getID() + | + $mo.getTestFieldData() + | + $td); end _ From: rules-users-boun...@lists.jboss.org [mailto:rules-users-boun...@lists.jboss.org] On Behalf Of Greg Barton Sent: Wednesday, September 23, 2009 11:01 AM To: Rules Users List Subject: Re: [rules-users] persistent java objects in working memory Did you inform the engine that testFieldData had changed? You need to either call update(MyDataObject) from the action of a rule, or if you're outside the engine, update() or asyncUpdate() on the session. Otherwise, as far as the engine is concerned, the value hasn't changed. _ From: Chris Richmond crichm...@referentia.com To: Rules Users List rules-users@lists.jboss.org Sent: Wednesday, September 23, 2009 3:35:46 PM Subject: Re: [rules-users] persistent java objects in working memory Now I am really confused, when I try to set some condition on the MyDataObject itself like this rule Identify Java Objects lock-on-active when $mo : MyDataObject($mf:testFieldData 20); $c : Cycle(); then System.err.println(MYOBJECT in system: + $mo.getID() + | + $mo.getTestFieldData()); end Then this still fires every single time, even when testFieldData is over 20.. -Chris _ From: rules-users-boun...@lists.jboss.org [mailto:rules-users-boun...@lists.jboss.org] On Behalf Of Greg Barton Sent: Wednesday, September 23, 2009 10:02 AM To: Rules Users List Subject: Re: [rules-users] persistent java objects in working memory You've answered your own question. :) The rule you've given will only fire when the object is asserted or modified. (And you have to inform the engine of the modification.) You have to inform the engine that the object has been modified every cycle. (And if you want the engine to fire that rule even if the object has not been modified, you can still inform the engine. All that does is force the rules to reconsider the object.) However, the way I'd do it is to have a new object that is inserted on each iteration. Let's call it Cycle and give it a count. Then your rule would look like this: rule Identify Java Objects lock-on-active when $mo : MyDataObject(); $c : Cycle(); then System.err.println(MYOBJECT in system: + $mo.getID() + | + $mo.getTestFieldData() + on Cycle + $c.getCount()); end When the iteration is over, you would retract the Cycle object. (Only one Cycle should be in working memory at once, and it's a good idea to have a rule that enforces that invariant.) You should follow this pattern for any rule you want to guarantee to fire on each iteration. _ From: Chris Richmond crichm...@referentia.com To: Rules Users List rules-users@lists.jboss.org Sent: Wednesday, September 23, 2009 2:15:35 PM Subject: [rules-users] persistent java objects in working memory Hello, I am trying to create a set of java objects, which I insert into the session at startup. Then at regular timed iterations I want to examine the values of those objects. During the timer iteration, some fields may have been changed by the primary program. So I have a rule for now that is just trying to identify that the do indeed exist on each iteration: rule Identify Java Objects lock-on-active when $mo : MyDataObject(); then System.err.println(MYOBJECT in system: + $mo.getID + | + $mo.getTestFieldData); end As I said, at startup I insert 3 of these objects into my session, then every 10 seconds I just want to ensure they are there. However the output from this rule only fires on the firet iteration, after that the rule doesn't fire. I am not retrcating the objects or even concerning myself with the FactHandle, as I plan to leave them in working memory and change values on those 3 objects from the main application in each application loop, then make decisions in the rule engine based on the values of those 3 objects. However, for now I just nee to find out why the objects only live for my first loop and call of session.fireAllRules(). Any ideas or what I am doing wrong? Thanks
Re: [rules-users] persistent java objects in working memory
update($sb) is actually udate($mo) in my code, that is a type on my example Chris _ From: rules-users-boun...@lists.jboss.org [mailto:rules-users-boun...@lists.jboss.org] On Behalf Of Chris Richmond Sent: Wednesday, September 23, 2009 11:34 AM To: 'Rules Users List' Subject: Re: [rules-users] persistent java objects in working memory Yes..I have these rules and the problem was I wasn't including the $c: cycle in the second rule ( I bolded it). So any rule I write subsequently has to have that $c : cycle() check in order to fire now? Not just the first rule which identifies all in memory objects and calls update on them? That seems counterintuitive..it seems like if I simply call update() on each object in the first rule, that the second should fire withought checking the Cycle object as well. Chris rule Identify MyObject lock-on-active when $mo : MyDataObject(); $c : Cycle(); then System.err.println(MYDATAOBJECT in system: + $mo.getID() + | + $mo.getTestFieldData(); update($sb); end rule Identify Problem lock-on-active when $mo : MyDataObject($td:testFieldData 20); $c : Cycle(); then System.err.println(OUT OF SPEC MYDATAOBJECT: + $mo.getID() + | + $mo.getTestFieldData() + | + $td); end _ From: rules-users-boun...@lists.jboss.org [mailto:rules-users-boun...@lists.jboss.org] On Behalf Of Greg Barton Sent: Wednesday, September 23, 2009 11:01 AM To: Rules Users List Subject: Re: [rules-users] persistent java objects in working memory Did you inform the engine that testFieldData had changed? You need to either call update(MyDataObject) from the action of a rule, or if you're outside the engine, update() or asyncUpdate() on the session. Otherwise, as far as the engine is concerned, the value hasn't changed. _ From: Chris Richmond crichm...@referentia.com To: Rules Users List rules-users@lists.jboss.org Sent: Wednesday, September 23, 2009 3:35:46 PM Subject: Re: [rules-users] persistent java objects in working memory Now I am really confused, when I try to set some condition on the MyDataObject itself like this rule Identify Java Objects lock-on-active when $mo : MyDataObject($mf:testFieldData 20); $c : Cycle(); then System.err.println(MYOBJECT in system: + $mo.getID() + | + $mo.getTestFieldData()); end Then this still fires every single time, even when testFieldData is over 20.. -Chris _ From: rules-users-boun...@lists.jboss.org [mailto:rules-users-boun...@lists.jboss.org] On Behalf Of Greg Barton Sent: Wednesday, September 23, 2009 10:02 AM To: Rules Users List Subject: Re: [rules-users] persistent java objects in working memory You've answered your own question. :) The rule you've given will only fire when the object is asserted or modified. (And you have to inform the engine of the modification.) You have to inform the engine that the object has been modified every cycle. (And if you want the engine to fire that rule even if the object has not been modified, you can still inform the engine. All that does is force the rules to reconsider the object.) However, the way I'd do it is to have a new object that is inserted on each iteration. Let's call it Cycle and give it a count. Then your rule would look like this: rule Identify Java Objects lock-on-active when $mo : MyDataObject(); $c : Cycle(); then System.err.println(MYOBJECT in system: + $mo.getID() + | + $mo.getTestFieldData() + on Cycle + $c.getCount()); end When the iteration is over, you would retract the Cycle object. (Only one Cycle should be in working memory at once, and it's a good idea to have a rule that enforces that invariant.) You should follow this pattern for any rule you want to guarantee to fire on each iteration. _ From: Chris Richmond crichm...@referentia.com To: Rules Users List rules-users@lists.jboss.org Sent: Wednesday, September 23, 2009 2:15:35 PM Subject: [rules-users] persistent java objects in working memory Hello, I am trying to create a set of java objects, which I insert into the session at startup. Then at regular timed iterations I want to examine the values of those objects. During the timer iteration, some fields may have been changed by the primary program. So I have a rule for now that is just trying to identify that the do indeed exist on each iteration: rule Identify Java Objects lock-on-active when $mo : MyDataObject(); then System.err.println(MYOBJECT in system: + $mo.getID + | + $mo.getTestFieldData); end As I said, at startup I insert 3 of these objects into my session, then every 10 seconds I just want to ensure they are there. However the output from this rule only fires on the firet iteration, after that the rule doesn't fire. I am not retrcating the objects or even concerning myself with the FactHandle, as I plan to leave them
[rules-users] determining what field changed
Is it possible to determine what fields from an object changed within a rule. So I am using this to determine if any DataObject has changed: //IDENTIFY ANY DATAOBJECT CHANGES rule identify any DATAOBJECT when $do : DataObject(); then System.err.println(ANY DataObject change detected: + $do); End However this also fires when any new DataObject() is injected into the system and the rules are fired. I would like to be able to only have a rule fire when an object is first created Vs. when it is modified and is there a way to detect what values of an object have changed if I don't explicitly know what fields of DataObject changed ahead of time? Thanks, Chris ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] determining what field changed
In general do you have any suggestions for getting around multiple update detects being made? In other words I have a rule to detect if my DataObject has fieldA X and if so, then modify fieldB. Then another rule that checks if fieldB = value and then updates field C. So something like: rule identify modified DATAOBJECT when do : DataObject(FieldA x); then modify(do.fieldB = value) end So something like: rule identify modified DATAOBJECT when do : DataObject(fieldB == value); then modify(do.fieldC = someValue) end rule identify modified DATAOBJECT when do : DataObject(fieldC == someValToMatchForC); then modify(do.fieldA = someNewValueForA) end But of course this leads to some sort of cross product execution as each one is run all over again after another makes a change and ramps out of control One question. I have been using modify() and I notice you had explicit: do.setN00b(false); update(do); What is the difference and will that matter to my scenario? Thanks, Chris -Original Message- From: rules-users-boun...@lists.jboss.org [mailto:rules-users-boun...@lists.jboss.org] On Behalf Of Greg Barton Sent: Wednesday, September 16, 2009 10:14 AM To: Rules Users List Subject: Re: [rules-users] determining what field changed Not really. Without modifying the objects you could do this outside the rules using a WorkingMemoryEventListener, which has objectInserted() and objectUpdated() methods. Event if you can modify the DataObject to add an I'm a new object flag, and set it immediately on insertion, then you could do differentiate with two rules: rule identify new DATAOBJECT when do : DataObject(n00b == true); then do.setN00b(false); update(do); System.err.println(DataObject assertion detected: + do); end rule identify modified DATAOBJECT when do : DataObject(n00b == false); then System.err.println(DataObject modification detected: + do); end Which would still catch a spurious modification notification on assert! At that point the semi-risky alternative is to not call update() in the identify new DATAOBJECT rule action. That way, the identify modified DATAOBJECT is not immediately activated, but it would be activated the next time update() is called on the object. I say semi-risky because it's not often a good idea to put a WM object into a state that the rete is not aware of, but in this case it would do what you want. --- On Wed, 9/16/09, Chris Richmond crichm...@referentia.com wrote: From: Chris Richmond crichm...@referentia.com Subject: [rules-users] determining what field changed To: 'Rules Users List' rules-users@lists.jboss.org Date: Wednesday, September 16, 2009, 2:41 PM Is it possible to determine what fields from an object changed within a rule. So I am using this to determine if any DataObject has changed: //IDENTIFY ANY DATAOBJECT CHANGES rule identify any DATAOBJECT when $do : DataObject(); then System.err.println(ANY DataObject change detected: + $do); End However this also fires when any new DataObject() is injected into the system and the rules are fired. I would like to be able to only have a rule fire when an object is first created Vs. when it is modified and is there a way to detect what values of an object have changed if I dont explicitly know what fields of DataObject changed ahead of time? Thanks, Chris -Inline Attachment Follows- ___ 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] detecting when an object has not been inserted
Hello, The documentation mentions detecting when an object of certain type with certain values has NOT been inserted within a certain amount of time.for instance if you have one reading above a threshold and want to see if you've received an auxillary reading within specs within the last 10 seconds or so, and if you haven't then take some other action. Is there a sample of doing this( detecting the absence of a certain object type with certain values within the last [10 seconds] or so)? Thanks, Chris ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
RE: [rules-users] firing explicit rules or agend-groups
I completely agree with everything you said and I feel I should be trying to do things in that manner myself.hence, my hesitence to create static java classes/methods for use as function libraries and rely instead on defined functions in the rule if possible(from an earlier discussion). I have been reading on the ruleflow recently and discovered that I in fact, may need to be using some fo those features isntead of a fusion-centric approach I was taking before, since I have some processes that need to be fired off during rule execution and take time to complete. Can fusion and ruleflow be used seamlessly together..or more specifically are there samples containing the melding of two. I am essentialy dealing with periodic sensor data incoming(hence my decicion to examine fusion as the solution ) but have since realized that there is a worklfow or process that needs to be kicked off and follow up processes that need to be completed in order to make further decisions on the objects in working memory(which ruleflow sounds ideal for). Also, are the bug fixes available in binary download or only in src? I have had a hell of a time getting maven to work for me. Thanks very much, Chris _ From: rules-users-boun...@lists.jboss.org [mailto:rules-users-boun...@lists.jboss.org] On Behalf Of Edson Tirelli Sent: Thursday, June 25, 2009 9:40 AM To: Rules Users List Subject: Re: [rules-users] firing explicit rules or agend-groups Sorry for the short answer... busy day. The main problem with agenda filter is that it is defined in application code and so creates a dependency in the rules from the application code. So, you break one of the biggest advantages of rules that is to have a separate lifecycle for rules. There are other small things too, but that is IMO the most limiting. I use agenda filters only for unit testing and debugging. My preferred approach is to model the rules in a way that they only fire when they should fire, using ruleflow, agenda-groups and other rule features as opposed to have the application messing with the agenda. []s Edson 2009/6/25 Chris Richmond crichm...@referentia.com Ok.well when the recognized expert says something is not their preferred approach, it begs the question .what is your preferred approach for handling this? Thanks, Chris _ From: rules-users-boun...@lists.jboss.org [mailto:rules-users-boun...@lists.jboss.org] On Behalf Of Edson Tirelli Sent: Thursday, June 25, 2009 2:30 AM To: Rules Users List Subject: Re: [rules-users] firing explicit rules or agend-groups Chris, Although not my preferred approach, you can use agenda filters as a parameter to fireAllRules(). []s Edson 2009/6/24 Chris Richmond crichm...@referentia.com Hello, I thought I had encountered a sample of performing a: session.fireAllRules(); except on explicit rules or at least on a specific agenda group.but I cannot seem to locate that in the API for sessions..did I miss something or did I imagine something before? Thanks, Chris ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users -- Edson Tirelli JBoss Drools Core Development JBoss by Red Hat @ www.jboss.com ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users -- Edson Tirelli JBoss Drools Core Development JBoss by Red Hat @ www.jboss.com ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
RE: [rules-users] Firiing explicit rules
*Excellent* description of the system operation and overall and answer to my question. Thank you very much! Chris _ From: rules-users-boun...@lists.jboss.org [mailto:rules-users-boun...@lists.jboss.org] On Behalf Of Edson Tirelli Sent: Thursday, June 25, 2009 2:28 AM To: Rules Users List Subject: Re: [rules-users] Firiing explicit rules Chris, The decision between A and B must be taken on the basis of: do you need to join objects from the different streams together? If so, you need A. If not, better go with B. Regarding threads, the engine works with a single thread, unless you activate the KnowledgeBase partitioning option (check the Drools Fusion documentation), in which case the engine spawns a pool of worker threads. The threads are not assigned to specific streams. They are used as a pool for processing of all required rules in the knowledge base. In any case, as long as you don't have multiple threads concurrently inserting facts/events into a single entry-point, everything else is thread safe. []s Edson 2009/6/24 Chris Richmond crichm...@referentia.com Hello, For performance reasons, assuming I am using STREAM mode, is it better to : A. create several streams in my rule file and inject objects into various streams depending on my needs or B. create a different session for each stream that I might have had in A. above? And if I do use option A, is my understanding correct that each stream will be processed on it's own thread? And if so, I notice that I am able to update a common statistical object that I created within my rule file and update it from consequences on different streams. If each stream is processed on it's own thread, is updating of this in rule defined statistics object synchronized/thread safe? For example in my rule file I have the following stats object: # stats object declare ObjectStats id : String @key name: String lastReadingA : int lastReadingB : int end ..then I have the following two rules.. rule update stats from objects A lock-on-active when $stats : ObjectStats( $id : id) $a : ObjectTypeA(parentId == $id, $aValue : value) from entry-point stream for objects of type a then modify($stats) { lastReadingA = $aValue }; end rule update stats from objects B lock-on-active when $stats : ObjectStats( $id : id) $b : ObjectTypeB(parentId == $id, $bValue : value) from entry-point stream for objects of type b then modify($stats) { lastReadingB= $bValue }; end This is working fine and the lock-on-active seems to be preventing me from getting the cross product problem, but is each of these streams processed independantly on their own thread? Thanks, Chris ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users -- Edson Tirelli JBoss Drools Core Development JBoss by Red Hat @ www.jboss.com ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
RE: [rules-users] firing explicit rules or agend-groups
Ok.well when the recognized expert says something is not their preferred approach, it begs the question .what is your preferred approach for handling this? Thanks, Chris _ From: rules-users-boun...@lists.jboss.org [mailto:rules-users-boun...@lists.jboss.org] On Behalf Of Edson Tirelli Sent: Thursday, June 25, 2009 2:30 AM To: Rules Users List Subject: Re: [rules-users] firing explicit rules or agend-groups Chris, Although not my preferred approach, you can use agenda filters as a parameter to fireAllRules(). []s Edson 2009/6/24 Chris Richmond crichm...@referentia.com Hello, I thought I had encountered a sample of performing a: session.fireAllRules(); except on explicit rules or at least on a specific agenda group.but I cannot seem to locate that in the API for sessions..did I miss something or did I imagine something before? Thanks, Chris ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users -- Edson Tirelli JBoss Drools Core Development JBoss by Red Hat @ www.jboss.com ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
[rules-users] Firiing explicit rules
Hello, For performance reasons, assuming I am using STREAM mode, is it better to : A. create several streams in my rule file and inject objects into various streams depending on my needs or B. create a different session for each stream that I might have had in A. above? And if I do use option A, is my understanding correct that each stream will be processed on it's own thread? And if so, I notice that I am able to update a common statistical object that I created within my rule file and update it from consequences on different streams. If each stream is processed on it's own thread, is updating of this in rule defined statistics object synchronized/thread safe? For example in my rule file I have the following stats object: # stats object declare ObjectStats id : String @key name: String lastReadingA : int lastReadingB : int end ..then I have the following two rules.. rule update stats from objects A lock-on-active when $stats : ObjectStats( $id : id) $a : ObjectTypeA(parentId == $id, $aValue : value) from entry-point stream for objects of type a then modify($stats) { lastReadingA = $aValue }; end rule update stats from objects B lock-on-active when $stats : ObjectStats( $id : id) $b : ObjectTypeB(parentId == $id, $bValue : value) from entry-point stream for objects of type b then modify($stats) { lastReadingB= $bValue }; end This is working fine and the lock-on-active seems to be preventing me from getting the cross product problem, but is each of these streams processed independantly on their own thread? Thanks, Chris ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
[rules-users] firing explicit rules or agend-groups
Hello, I thought I had encountered a sample of performing a: session.fireAllRules(); except on explicit rules or at least on a specific agenda group.but I cannot seem to locate that in the API for sessions..did I miss something or did I imagine something before? Thanks, Chris ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
RE: [rules-users] function mvel declare - possible bug
I have been completely unable to declare a function within my .drl file using mvel dialect as well..so I'm very interested in this. Thanks, Chris _ From: rules-users-boun...@lists.jboss.org [mailto:rules-users-boun...@lists.jboss.org] On Behalf Of Michal Bali Sent: Wednesday, June 24, 2009 6:01 AM To: Rules Users List Subject: [rules-users] function mvel declare - possible bug Hi, I've encountered a bizarre bug when a function is used together with a declared type and a rule with mvel dialect. To reproduce create a default 'New Drools Project' in Eclipse and replace Sample.drl with the following: -- package com.sample function void aaa() { // - comment this and it will work } declare SomeBean prop : int end rule setup dialect mvel // - comment this and it will work when eval(true) then SomeBean someBean = new SomeBean(); insert(someBean); System.out.println( setup inserted: + someBean); end rule should never fire salience -20 when not SomeBean() then System.out.println( rule that should never fire fired !!! ); end Run the DroolsTest.java and see that the last rule that should never fire is actually fired. If you comment out the 'aaa' function or change the dialect to 'java' all works fine. Note that it breaks on JDK 1.5.0_12 however it works fine on JDK 1.6.0_14. Tested on WinXP. Is it just my machine or does anybody else see this issue? Best regards, Michal ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
RE: [rules-users] unable to resolve method using strict-mode
I am using Drools 5.0.1 Final..MVEL is whatever version was downloaded with drools 5, specifically mvel2.jar. Thanks, Chris _ From: rules-users-boun...@lists.jboss.org [mailto:rules-users-boun...@lists.jboss.org] On Behalf Of Edson Tirelli Sent: Tuesday, June 23, 2009 2:07 AM To: Rules Users List Subject: Re: [rules-users] unable to resolve method using strict-mode What versions of Drools and MVEL are you using? []s Edson 2009/6/22 Chris Richmond crichm...@referentia.com I cannot seem to call a static method on one of my classes and keep getting this error: [Error: Failed to compile: 1 compilation error(s): - (1,44) unable to resolve method using strict-mode: com.aps.syslog.logging.manager.LoggingManager.runLoggingTest(java.lang.Strin g, com.aps.syslog.logging.Transaction)] [Near : {... Unknown }] When I call the static method: LoggingManager.runLoggingTest (23223, transaction); Where the first argument can be any string and the second is a custom class that I isntatiated earlier in the RHS with no problems. Is the problem strict-mode? Or something else? LogginManager.runLoggingTest is a static method but do I perhaps have to do something like: $lm : LoggingManager() Then call the static method using: $lm.runLoggingTest (23223, transaction); Or something along these lines (I did try this but it failed as well). Thanks, Chris ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users -- Edson Tirelli JBoss Drools Core Development JBoss, a division of Red Hat @ www.jboss.com ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
RE: [rules-users] unable to resolve method using strict-mode
Simply declaring as examples do for MVEL: # setup dialect for the semantic code to be MVEL dialect mvel _ From: rules-users-boun...@lists.jboss.org [mailto:rules-users-boun...@lists.jboss.org] On Behalf Of Edson Tirelli Sent: Tuesday, June 23, 2009 2:07 AM To: Rules Users List Subject: Re: [rules-users] unable to resolve method using strict-mode What versions of Drools and MVEL are you using? []s Edson 2009/6/22 Chris Richmond crichm...@referentia.com I cannot seem to call a static method on one of my classes and keep getting this error: [Error: Failed to compile: 1 compilation error(s): - (1,44) unable to resolve method using strict-mode: com.aps.syslog.logging.manager.LoggingManager.runLoggingTest(java.lang.Strin g, com.aps.syslog.logging.Transaction)] [Near : {... Unknown }] When I call the static method: LoggingManager.runLoggingTest (23223, transaction); Where the first argument can be any string and the second is a custom class that I isntatiated earlier in the RHS with no problems. Is the problem strict-mode? Or something else? LogginManager.runLoggingTest is a static method but do I perhaps have to do something like: $lm : LoggingManager() Then call the static method using: $lm.runLoggingTest (23223, transaction); Or something along these lines (I did try this but it failed as well). Thanks, Chris ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users -- Edson Tirelli JBoss Drools Core Development JBoss, a division of Red Hat @ www.jboss.com ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
[rules-users] unable to resolve method using strict-mode
I cannot seem to call a static method on one of my classes and keep getting this error: [Error: Failed to compile: 1 compilation error(s): - (1,44) unable to resolve method using strict-mode: com.aps.syslog.logging.manager.LoggingManager.runLoggingTest(java.lang.Strin g, com.aps.syslog.logging.Transaction)] [Near : {... Unknown }] When I call the static method: LoggingManager.runLoggingTest (23223, transaction); Where the first argument can be any string and the second is a custom class that I isntatiated earlier in the RHS with no problems. Is the problem strict-mode? Or something else? LogginManager.runLoggingTest is a static method but do I perhaps have to do something like: $lm : LoggingManager() Then call the static method using: $lm.runLoggingTest (23223, transaction); Or something along these lines (I did try this but it failed as well). Thanks, Chris ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
[rules-users] functions .drl file
Is it possible to create a .drl file of nothing but functions then import those into another .drl file to make it easy to maintain one file of API style functions and then beable to call them from any additional .drl files? Thanks, Chris ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
RE: [rules-users] functions
Edson, Thanks.and I am considering that option as well.but the nice thing about the functions in the drl file is the system remains much more fluid..in other words, if I can focus on doing what I want to do all within the DRL file, it proves the flexibility of the system more to me than having to have developer recompile the application itself with new classes. Does that make sense? Also, I would just like to know that I can actually make functions work for future reference. Thanks, Chris _ From: rules-users-boun...@lists.jboss.org [mailto:rules-users-boun...@lists.jboss.org] On Behalf Of Edson Tirelli Sent: Thursday, June 18, 2009 1:15 PM To: Rules Users List Subject: Re: [rules-users] functions Chris, If you are creating a function library, why don't you create it as static methods in a java class? easier to develop, to unit test and you can use import function in the DRL to import all of them. []s Edson 2009/6/18 Chris Richmond crichm...@referentia.com Ok.I am trying to build a function library in my .drl file and I added this one test function function String outputString(String sData){ return sData; } And no matter where I place this in my .drl file, I get an exception one way or the other with compiling when I try instaniate and fire my rules. The .drl file works exactly as expected if I remove this function declaration, and when I *do* try to add it, I do not actually call it anywhere.but get those errors. So my question is, where exactly do I need to place function declarations.. Thanks, Chris ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users -- Edson Tirelli JBoss Drools Core Development JBoss, a division of Red Hat @ www.jboss.com ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
[rules-users] averages on different data types
Hi guys, Building from the stockticker sample, I have been running my own average aggregates over time and window length and I have the following rule.it simply runs a last 10 average and outputs the average(in theory). rule show averages when $n : Number( doubleValue 0 ) from accumulate ( $mdo : MyDataObject($tm: delayTime) over window:length(10) from entry-point DataObject stream, average( $tm ) ) then System.err.println($tm); End I have set the limit to 0 for the average because I simply want to have it fire every time, no matter the average(they are all positive) However I get this error: Unable to build expression for 'consequence': Failed to compile: 1 compilation error(s): - (1,3) unqualified type in strict mode for: $tm ' System.err.println($tm); ' : [Rule name='show averages'] If I have the consequence System.err.println($n); Then it outputs the average no problem, but I am trying to simply output that indifidual value, delayTime which I have stored in $tm is an integer, so I cannot figure out why I cannot output this value.Similarly if I simply try as a consequence: System.err.println($ mdo.delayTime); I get a similar error. What am I doing wrong? Thanks, Chris ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
RE: [rules-users] averages on different data types
So how can I access variables that I have populated from within that scope delimiter(accumulate)? For instance if I did want to access the delayTime, what strategy should be used? Thanks, Chris _ From: rules-users-boun...@lists.jboss.org [mailto:rules-users-boun...@lists.jboss.org] On Behalf Of Edson Tirelli Sent: Wednesday, June 17, 2009 11:49 AM To: Rules Users List Subject: Re: [rules-users] averages on different data types Chris, Remember that accumulate is a scope delimiter, meaning variables bound inside accumulate are not visible outside of it. The error message you see is the MVEL way of saying: non-existing variable (I guess you are using mvel as the dialect for the consequence). If you want to know what data objects are being inserted/expired from the working memory, use a working memory listener. []s Edson 2009/6/17 Chris Richmond crichm...@referentia.com Hi guys, Building from the stockticker sample, I have been running my own average aggregates over time and window length and I have the following rule.it simply runs a last 10 average and outputs the average(in theory). rule show averages when $n : Number( doubleValue 0 ) from accumulate ( $mdo : MyDataObject($tm: delayTime) over window:length(10) from entry-point DataObject stream, average( $tm ) ) then System.err.println($tm); End I have set the limit to 0 for the average because I simply want to have it fire every time, no matter the average(they are all positive) However I get this error: Unable to build expression for 'consequence': Failed to compile: 1 compilation error(s): - (1,3) unqualified type in strict mode for: $tm ' System.err.println($tm); ' : [Rule name='show averages'] If I have the consequence System.err.println($n); Then it outputs the average no problem, but I am trying to simply output that indifidual value, delayTime which I have stored in $tm is an integer, so I cannot figure out why I cannot output this value.Similarly if I simply try as a consequence: System.err.println($ mdo.delayTime); I get a similar error. What am I doing wrong? Thanks, Chris ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users -- Edson Tirelli JBoss Drools Core Development JBoss, a division of Red Hat @ www.jboss.com ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
RE: [rules-users] averages on different data types
Ok..I was under the impression that the rule would fire for each Order object that was injected, and in that case variables apply to each Order, hence accessing them from the consequences(right side) would be from an indfividual Order. I guess I am misundertanding how it works. Thanks for the clarification. Chris _ From: rules-users-boun...@lists.jboss.org [mailto:rules-users-boun...@lists.jboss.org] On Behalf Of Edson Tirelli Sent: Wednesday, June 17, 2009 1:37 PM To: Rules Users List Subject: Re: [rules-users] averages on different data types Chris, Not sure what you mean. If you want to know what is in there for debug purposes, I guess the best way is to implement your own average() accumulate function that prints out (or do whatever you want) with the bound variables/facts. For regular use, it does not makes sense to allow access to such variable because it is bound to multiple values. For instance: $tot : Number() from accumulate( Order( $value : value ), sum( $value ) ) This pattern will sum all the values from all the Order facts in the working memory. Lets imagine that it would be possible to access the $value variable outside the accumulate, what Order would it be bound to? So, it makes no sense... []s Edson 2009/6/17 Chris Richmond crichm...@referentia.com So how can I access variables that I have populated from within that scope delimiter(accumulate)? For instance if I did want to access the delayTime, what strategy should be used? Thanks, Chris _ From: rules-users-boun...@lists.jboss.org [mailto:rules-users-boun...@lists.jboss.org] On Behalf Of Edson Tirelli Sent: Wednesday, June 17, 2009 11:49 AM To: Rules Users List Subject: Re: [rules-users] averages on different data types Chris, Remember that accumulate is a scope delimiter, meaning variables bound inside accumulate are not visible outside of it. The error message you see is the MVEL way of saying: non-existing variable (I guess you are using mvel as the dialect for the consequence). If you want to know what data objects are being inserted/expired from the working memory, use a working memory listener. []s Edson 2009/6/17 Chris Richmond crichm...@referentia.com Hi guys, Building from the stockticker sample, I have been running my own average aggregates over time and window length and I have the following rule.it simply runs a last 10 average and outputs the average(in theory). rule show averages when $n : Number( doubleValue 0 ) from accumulate ( $mdo : MyDataObject($tm: delayTime) over window:length(10) from entry-point DataObject stream, average( $tm ) ) then System.err.println($tm); End I have set the limit to 0 for the average because I simply want to have it fire every time, no matter the average(they are all positive) However I get this error: Unable to build expression for 'consequence': Failed to compile: 1 compilation error(s): - (1,3) unqualified type in strict mode for: $tm ' System.err.println($tm); ' : [Rule name='show averages'] If I have the consequence System.err.println($n); Then it outputs the average no problem, but I am trying to simply output that indifidual value, delayTime which I have stored in $tm is an integer, so I cannot figure out why I cannot output this value.Similarly if I simply try as a consequence: System.err.println($ mdo.delayTime); I get a similar error. What am I doing wrong? Thanks, Chris ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users -- Edson Tirelli JBoss Drools Core Development JBoss, a division of Red Hat @ www.jboss.com ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users -- Edson Tirelli JBoss Drools Core Development JBoss, a division of Red Hat @ www.jboss.com ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
[rules-users] multiple .drl files
Hello all, I want to create a baseline rules file with Fusion that does some basic aggregating that I know I will need later.things like keep running averages over the last minute or so of several object values. Is it possible to then inherit or at least reference those aggregates I am keeping track of from another .drl file in some way.allowing me to always keep my basic aggregation functions in one rule file and then add additional rules/functions to my rule memory space later.or must any further rules that wish to reference those aggregate or statistics objects also be contained within the same .drl file? I understand I can have multiple .drl files, but I am wondering specifically about referencing objects and variables created in another rules file. Thanks, Chris ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
[rules-users] Drools fusion memory management
Hello, I wanted to ask this question in a separate email so as to keep each email to one topic for easier thread following. Let me know if you prefer multiple questions per email next time. I am using Drools fusion basically with some success where I am at this point only running some aggregates and calling some java functions when a running average over the last 1 minute or so drops below a certain value. The sources for those values come from objects I am injecting into memory space, but I am not specifically calling retraction code since it is my understanding that I can set the policy in the rule file for how long to hold objects in memory. So for example I have this rule which simpoly outputs to out when the average goes above 100 for the last 10 items(you can tell I created mine based on the stock ticker). It seems to be working, but I have some questions to ensure I understand before moving forward. So below the declare MyObject with assigning it role event with a default expiration of 2 minutes. Is my undertanding correct that fusion will disregard thos objects that are injected without me having to take any other action? Also, in my show averages rule below, if I did ont have the declare MyObject delcaration with expiration policy set, would fusion automatially throw away MyObjects older than the last 10 based on my rule no longer needing them?If it would, then which takes priority, the expires declaration for MyObject or the no longer needed by my aggregate rule below. I am assuming that the rule would keep them beyond 2 minutes it it was necessary, but is this correct? If the rule as written would not automatically remove objects from memory space, then is there something I could do to tell the rule to do so when it is no longer needed by my aggregate? Thanks, Chris imports removed # default dialect for the semantic code will be MVEL dialect mvel # tells the engine that a object instance will assume the # role (semantics) of events and that the default retention # policy will be 2 minutes declare MyObject @role( event ) @expires( 2m ) end rule show averages when $n : Number( doubleValue 100 ) from accumulate ( $stat:MyObject($bc: byteCount, srcIPAddress == 10.5.0.4) over window:length(10) from entry-point MyObject stream, average( $bc ) ) then System.err.println(average: + $n) end ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
RE: [rules-users] The Eclipse JDT Core jar is not in the classpath error
Marcus, I only have the one version of antlr jar that comes in the /lib folder of the drools 5.0 binary distribution, however that was enough to allow me to run the stockticker fusion sample in eclipse no problem. I ported the project to Netbeans and am relying on all of the same jars from that binary distribution, but getting this error now. Perhaps there is something that is being provided by the eclipse drools plugin? Thanks, Chris -Original Message- From: rules-users-boun...@lists.jboss.org [mailto:rules-users-boun...@lists.jboss.org] On Behalf Of Marcus Ilgner Sent: Monday, June 01, 2009 11:14 PM To: Rules Users List Subject: Re: [rules-users] The Eclipse JDT Core jar is not in the classpath error 2009/6/2 Chris Richmond crichm...@referentia.com: Hello, I am using netbeans and ivy with Drools 5. I have successfully named, published the jars from drools to and could build my port of the stock ticker application in netbeans, but when I try to run it, I get the following error: java.lang.NoClassDefFoundError: org/antlr/runtime/tree/TreeNodeStream I have the antlr-runtime jar from the bin/lib on my classpath where I added all the others, but it always fails at this line In loadRuleBase() in Broker.java of the stock ticker sample builder.add( ResourceFactory.newInputStreamResource( Broker.class.getResourceAsStream( RULES_FILE ) ), ResourceType.DRL);. Does anyone have any ideas what jar I might be missing if its not the antlr-runtime? Thanks, Chris Hi, in one of my projects, I actually needed two different versions of antlr in the classpath. Did you check if the class referenced in the exception actually exists in the deployed antlr jar file? Best regards Marcus ___ 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] The Eclipse JDT Core jar is not in the classpath error
Ed, Thanks for the feedback. That's pretty much the conclusion I have come to..I will double check the higher priority reference, that sounds possible because we are using Ivy for dependencies with many package dependencies.. Thanks very much for the insights. Chris _ From: rules-users-boun...@lists.jboss.org [mailto:rules-users-boun...@lists.jboss.org] On Behalf Of Edson Tirelli Sent: Tuesday, June 02, 2009 9:42 AM To: Rules Users List Subject: Re: [rules-users] The Eclipse JDT Core jar is not in the classpath error Chris, There must be a problem with the classpath. That message only shows up when the antlr-runtime jar is not in the classpath. java.lang. NoClassDefFoundError: org/antlr/runtime/tree/TreeNodeStream Also, I successfully run examples from command line, outside of eclipse, so it is unlikely that you are being hit by some hidden dependency. Sorry for not helping you more, but continue investigating your netbeans project classpath for odd things. Oh, and BTW, antlr runtimes are not compatible between versions, so, if your netbeans has a different antlr runtime jar in the classpath in a higher priority search order, it will give you similar problems. []s Edson 2009/6/2 Chris Richmond crichm...@referentia.com Marcus, I only have the one version of antlr jar that comes in the /lib folder of the drools 5.0 binary distribution, however that was enough to allow me to run the stockticker fusion sample in eclipse no problem. I ported the project to Netbeans and am relying on all of the same jars from that binary distribution, but getting this error now. Perhaps there is something that is being provided by the eclipse drools plugin? Thanks, Chris -Original Message- From: rules-users-boun...@lists.jboss.org [mailto:rules-users-boun...@lists.jboss.org] On Behalf Of Marcus Ilgner Sent: Monday, June 01, 2009 11:14 PM To: Rules Users List Subject: Re: [rules-users] The Eclipse JDT Core jar is not in the classpath error 2009/6/2 Chris Richmond crichm...@referentia.com: Hello, I am using netbeans and ivy with Drools 5. I have successfully named, published the jars from drools to and could build my port of the stock ticker application in netbeans, but when I try to run it, I get the following error: java.lang.NoClassDefFoundError: org/antlr/runtime/tree/TreeNodeStream I have the antlr-runtime jar from the bin/lib on my classpath where I added all the others, but it always fails at this line In loadRuleBase() in Broker.java of the stock ticker sample builder.add( ResourceFactory.newInputStreamResource( Broker.class.getResourceAsStream( RULES_FILE ) ), ResourceType.DRL);. Does anyone have any ideas what jar I might be missing if it's not the antlr-runtime? Thanks, Chris Hi, in one of my projects, I actually needed two different versions of antlr in the classpath. Did you check if the class referenced in the exception actually exists in the deployed antlr jar file? Best regards Marcus ___ 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 -- Edson Tirelli JBoss Drools Core Development JBoss, a division of Red Hat @ www.jboss.com ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
[rules-users] The Eclipse JDT Core jar is not in the classpath error
Hello, I am using netbeans and ivy with Drools 5. I have successfully named, published the jars from drools to and could build my port of the stock ticker application in netbeans, but when I try to run it, I get the following error: java.lang.NoClassDefFoundError: org/antlr/runtime/tree/TreeNodeStream I have the antlr-runtime jar from the bin/lib on my classpath where I added all the others, but it always fails at this line In loadRuleBase() in Broker.java of the stock ticker sample builder.add( ResourceFactory.newInputStreamResource( Broker.class.getResourceAsStream( RULES_FILE ) ), ResourceType.DRL);. Does anyone have any ideas what jar I might be missing if it's not the antlr-runtime? Thanks, Chris ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
[rules-users] Drools 5.0 dependancies
Hello, I notice there is a license file with the drools 5.0 binary distribution, and the /lib directory contains all the dependancy libraries for drools, but I have no idea who owns these or what the license is on the numerous third party libraries in there.Does anyone have any idea what licenses apply to all of the dependancy .jars for Drools 5.0? Thanks, Chris ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
[rules-users] Dependencies readme file
I notice that all of the drools 5.0 dependency jars are in the .lib folder, but many of the versions are wrong according to the README_DEPENDENCIES.txt file. For instance API: Jaxb-impl 2.1.9 However version 2.0.3 is the one included in the jar. Can someone explain what is going on here or what I'm missing? Thanks, Chris ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
[rules-users] keeping running stats
Hello, I have modified the stockTicker fusion example to keep some running stats, you can see from the rule snippet below that it injects a stats object based on the symbol then matches them as updates come in later. You can see for now I am just updating the running counts and outputting the readings count on each stock tick and this works fine. What I would like to do however is only have the running averages,stats object reflect stock ticks that are still in memory..essentiall only stock tick items that have not expired. As it is now the count just keeps growing and growing, I want the count to only reflect the stock ticks within the expiration time in the past for stock ticks, but I cannot figure out how to make this happen?Could anyone give me a pointer on how to do this? How to make the stats object only reflect those stock ticks that have not expired? I do not know the strategy for this. Thanks, Chris # tells the engine that a StockTick instance will assume the # role (semantics) of events and that the default retention # policy will be 2 minutes declare StockTick @role( event ) @expires( 1m ) end # One can even declare helper facts to make rules easier and # simpler to write and maintain declare Statistics symbol : String @key() average : double readings : int total : double end rule Setup statistics when $c : Company( $s : symbol ) not( Statistics( symbol == $s ) ) then Statistics s = new Statistics(); s.symbol = $s; s.readings = s.readings + 1; insert( s ); end # a simple rule to show that it is possible to join # events from an entry-point (stream) with facts # present in the working memory rule Update stock stats agenda-group evaluation lock-on-active when $cp : Company( $sb : symbol ) $st : StockTick( symbol == $sb, $pr : price ) from entry-point StockTick stream $stats : Statistics( symbol == $sb ) then modify( $stats ) { readings = readings + 1}; System.err.println($stats.symbol + readings: + $stats.readings); // This shows an update on working memory facts with data from joined events //modify( $cp ) { currentPrice = $pr } // Although events are considered immutable, a common pattern is to use a class // to represent an event and enrich that event instance with data derived from other facts/events. // Bellow we enrich the event instance with the percentual change in the price, // based on the previous price //modify( $st ) { delta = $cp.delta } //modify( $st ) { readings = 5 } //System.out.println($st.delta) end ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
RE: [rules-users] moving average rule
Well I am only modifying the StockTicker example which I believe is using Stream mode and and system time. _ From: rules-users-boun...@lists.jboss.org [mailto:rules-users-boun...@lists.jboss.org] On Behalf Of Edson Tirelli Sent: Wednesday, May 27, 2009 2:22 AM To: Rules Users List Subject: Re: [rules-users] moving average rule There are 2 important concepts related to time windows. First and most important, sliding windows only work in STREAM_MODE, not in CLOUD_MODE (default). Did you set the engine to STREAM_MODE? Second, the session clock becomes really important in STREAM_MODE: what clock are you using? Real time or pseudo clock? []s Edson 2009/5/26 Chris Richmond crichm...@referentia.com Well, it never fires even though the last several values are ALL above my moving averate limit.I never see the output being written out. I modified my limit value to something very very low to ensure the average was beyond that, but still nothing. I understand what you are saying about Expert+Fusion and that was my understanding as well and I have been reading through the docs on that links, however I have not read all of the documentation exhaustively yet. There doesn't seem to be a lot of samples(syntax wise) for authoring rules taking advantage of those Fusion features. There are isolated one or two line samples, but I guess I am having a difficult time determining how to author rules based on collections of data.think of sensor data over time..so I want to author rules that work on the latest readings plus some configurable amount of readings in the past. From the Fusion features description, it seems ideal..but finding out the nuts and bolts of implementing it is eluding me thus far. I am continuing the reading as well..perhaps I have not come across it yet.. Thanks again for your help. Chris _ From: rules-users-boun...@lists.jboss.org [mailto:rules-users-boun...@lists.jboss.org] On Behalf Of Edson Tirelli Sent: Tuesday, May 26, 2009 4:24 PM To: Rules Users List Subject: Re: [rules-users] moving average rule Chris, Fusion is an extension of Drools Expert. Think about it as all Expert features + some additional features. That is why Drools Fusion docs is just a list of features explained. I assume you looked here already: http://www.jboss.org/drools/documentation.html For both, expert and fusion docs. So, back to your rule, syntax seems correct to me. Why do you say it is not working? What error or symptoms do you see? []s Edson 2009/5/26 Chris Richmond crichm...@referentia.com Hello, I am trying to write a rule for a moving average over values over the last minute using fusion. In general I can't seem to locate a detailed resource for authoring syntax for these types of rules or rules in general, but specifically, I tried to modify something from the fusion documentation for my purposes using the StockTicker fusion sample. Here is the rule entry I aded to the broker.drl: rule Alert when moving average goes below 50 when Number( doubleValue 127 ) from accumulate( StockTick( symbol == ORCL, $price: price ) over window:time( 1m ), average( $price ) ) then System.out.println(moving average has gone beyone moving average); End I basically want to be alerted any time the moving average for ORCL moves above 127 (or whatever criteria I set.I picked that based on the sample data the sample fusion project uses), but it doesn't seem to be working. I guess if I could locate the definitave samples or guide for authoring these types of rules I could use that, but it's very difficult to piece together how to author rules utilizing fusion features based on isolated snippets from the fusion guide. Can anyone point me to some reasources for learning rule authoring, especially for taking advantage of the fusion features. Thanks, Chris ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users -- Edson Tirelli JBoss Drools Core Development JBoss, a division of Red Hat @ www.jboss.com ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users -- Edson Tirelli JBoss Drools Core Development JBoss, a division of Red Hat @ www.jboss.com ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
RE: [rules-users] keeping running stats
Yes.tha's what I'm looking for and as a matter of fact I tried to implement that rule into the stocktick example thusly.I want to see the average over the last 5m..but this rule NEVER fires and I don't know why rule identify when the average is over a value when Number( doubleValue 1.0 ) from accumulate( StockTick( $pr : price, symbol == IBM ) over window:time( 5m ), average( $pr ) ) then System.out.println(average over 105); end _ From: rules-users-boun...@lists.jboss.org [mailto:rules-users-boun...@lists.jboss.org] On Behalf Of Michal Bali Sent: Wednesday, May 27, 2009 11:09 AM To: Rules Users List Subject: Re: [rules-users] keeping running stats Hi Chris, You can use 'accumulate' with sliding time window. Have a look here http://downloads.jboss.com/drools/docs/5.0.1.26597.FINAL/drools-fusion/html/ ch02.html#d0e1169 rule Sound the alarm in case temperature rises above threshold when TemperatureThreshold( $max : max ) Number( doubleValue $max ) from accumulate( SensorReading( $temp : temperature ) over window:time( 10m ), average( $temp ) ) then // sound the alarm end The engine will automatically discard any SensorReading older than 10 minutes and keep the calculated average consistent. Is that what you're looking for? Michal 2009/5/27 Chris Richmond crichm...@referentia.com Hello, I have modified the stockTicker fusion example to keep some running stats, you can see from the rule snippet below that it injects a stats object based on the symbol then matches them as updates come in later. You can see for now I am just updating the running counts and outputting the readings count on each stock tick and this works fine. What I would like to do however is only have the running averages,stats object reflect stock ticks that are still in memory..essentiall only stock tick items that have not expired. As it is now the count just keeps growing and growing, I want the count to only reflect the stock ticks within the expiration time in the past for stock ticks, but I cannot figure out how to make this happen?Could anyone give me a pointer on how to do this? How to make the stats object only reflect those stock ticks that have not expired? I do not know the strategy for this. Thanks, Chris # tells the engine that a StockTick instance will assume the # role (semantics) of events and that the default retention # policy will be 2 minutes declare StockTick @role( event ) @expires( 1m ) end # One can even declare helper facts to make rules easier and # simpler to write and maintain declare Statistics symbol : String @key() average : double readings : int total : double end rule Setup statistics when $c : Company( $s : symbol ) not( Statistics( symbol == $s ) ) then Statistics s = new Statistics(); s.symbol = $s; s.readings = s.readings + 1; insert( s ); end # a simple rule to show that it is possible to join # events from an entry-point (stream) with facts # present in the working memory rule Update stock stats agenda-group evaluation lock-on-active when $cp : Company( $sb : symbol ) $st : StockTick( symbol == $sb, $pr : price ) from entry-point StockTick stream $stats : Statistics( symbol == $sb ) then modify( $stats ) { readings = readings + 1}; System.err.println($stats.symbol + readings: + $stats.readings); // This shows an update on working memory facts with data from joined events //modify( $cp ) { currentPrice = $pr } // Although events are considered immutable, a common pattern is to use a class // to represent an event and enrich that event instance with data derived from other facts/events. // Bellow we enrich the event instance with the percentual change in the price, // based on the previous price //modify( $st ) { delta = $cp.delta } //modify( $st ) { readings = 5 } //System.out.println($st.delta) end ___ 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] keeping running stats
Notice I set the average to something very low that I know would be exceeded. _ From: rules-users-boun...@lists.jboss.org [mailto:rules-users-boun...@lists.jboss.org] On Behalf Of Michal Bali Sent: Wednesday, May 27, 2009 11:09 AM To: Rules Users List Subject: Re: [rules-users] keeping running stats Hi Chris, You can use 'accumulate' with sliding time window. Have a look here http://downloads.jboss.com/drools/docs/5.0.1.26597.FINAL/drools-fusion/html/ ch02.html#d0e1169 rule Sound the alarm in case temperature rises above threshold when TemperatureThreshold( $max : max ) Number( doubleValue $max ) from accumulate( SensorReading( $temp : temperature ) over window:time( 10m ), average( $temp ) ) then // sound the alarm end The engine will automatically discard any SensorReading older than 10 minutes and keep the calculated average consistent. Is that what you're looking for? Michal 2009/5/27 Chris Richmond crichm...@referentia.com Hello, I have modified the stockTicker fusion example to keep some running stats, you can see from the rule snippet below that it injects a stats object based on the symbol then matches them as updates come in later. You can see for now I am just updating the running counts and outputting the readings count on each stock tick and this works fine. What I would like to do however is only have the running averages,stats object reflect stock ticks that are still in memory..essentiall only stock tick items that have not expired. As it is now the count just keeps growing and growing, I want the count to only reflect the stock ticks within the expiration time in the past for stock ticks, but I cannot figure out how to make this happen?Could anyone give me a pointer on how to do this? How to make the stats object only reflect those stock ticks that have not expired? I do not know the strategy for this. Thanks, Chris # tells the engine that a StockTick instance will assume the # role (semantics) of events and that the default retention # policy will be 2 minutes declare StockTick @role( event ) @expires( 1m ) end # One can even declare helper facts to make rules easier and # simpler to write and maintain declare Statistics symbol : String @key() average : double readings : int total : double end rule Setup statistics when $c : Company( $s : symbol ) not( Statistics( symbol == $s ) ) then Statistics s = new Statistics(); s.symbol = $s; s.readings = s.readings + 1; insert( s ); end # a simple rule to show that it is possible to join # events from an entry-point (stream) with facts # present in the working memory rule Update stock stats agenda-group evaluation lock-on-active when $cp : Company( $sb : symbol ) $st : StockTick( symbol == $sb, $pr : price ) from entry-point StockTick stream $stats : Statistics( symbol == $sb ) then modify( $stats ) { readings = readings + 1}; System.err.println($stats.symbol + readings: + $stats.readings); // This shows an update on working memory facts with data from joined events //modify( $cp ) { currentPrice = $pr } // Although events are considered immutable, a common pattern is to use a class // to represent an event and enrich that event instance with data derived from other facts/events. // Bellow we enrich the event instance with the percentual change in the price, // based on the previous price //modify( $st ) { delta = $cp.delta } //modify( $st ) { readings = 5 } //System.out.println($st.delta) end ___ 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] keeping running stats
I think the problem is that the stockticks aren't being processed unless I use the: From entry-point StockTick stream But I can't combine from accumulate with that from statement successfully in that sample I sent. I think that is the problem . The sample I sent, none of those ever get processed since it is not looking at the proper entry point. _ From: rules-users-boun...@lists.jboss.org [mailto:rules-users-boun...@lists.jboss.org] On Behalf Of Michal Bali Sent: Wednesday, May 27, 2009 11:09 AM To: Rules Users List Subject: Re: [rules-users] keeping running stats Hi Chris, You can use 'accumulate' with sliding time window. Have a look here http://downloads.jboss.com/drools/docs/5.0.1.26597.FINAL/drools-fusion/html/ ch02.html#d0e1169 rule Sound the alarm in case temperature rises above threshold when TemperatureThreshold( $max : max ) Number( doubleValue $max ) from accumulate( SensorReading( $temp : temperature ) over window:time( 10m ), average( $temp ) ) then // sound the alarm end The engine will automatically discard any SensorReading older than 10 minutes and keep the calculated average consistent. Is that what you're looking for? Michal 2009/5/27 Chris Richmond crichm...@referentia.com Hello, I have modified the stockTicker fusion example to keep some running stats, you can see from the rule snippet below that it injects a stats object based on the symbol then matches them as updates come in later. You can see for now I am just updating the running counts and outputting the readings count on each stock tick and this works fine. What I would like to do however is only have the running averages,stats object reflect stock ticks that are still in memory..essentiall only stock tick items that have not expired. As it is now the count just keeps growing and growing, I want the count to only reflect the stock ticks within the expiration time in the past for stock ticks, but I cannot figure out how to make this happen?Could anyone give me a pointer on how to do this? How to make the stats object only reflect those stock ticks that have not expired? I do not know the strategy for this. Thanks, Chris # tells the engine that a StockTick instance will assume the # role (semantics) of events and that the default retention # policy will be 2 minutes declare StockTick @role( event ) @expires( 1m ) end # One can even declare helper facts to make rules easier and # simpler to write and maintain declare Statistics symbol : String @key() average : double readings : int total : double end rule Setup statistics when $c : Company( $s : symbol ) not( Statistics( symbol == $s ) ) then Statistics s = new Statistics(); s.symbol = $s; s.readings = s.readings + 1; insert( s ); end # a simple rule to show that it is possible to join # events from an entry-point (stream) with facts # present in the working memory rule Update stock stats agenda-group evaluation lock-on-active when $cp : Company( $sb : symbol ) $st : StockTick( symbol == $sb, $pr : price ) from entry-point StockTick stream $stats : Statistics( symbol == $sb ) then modify( $stats ) { readings = readings + 1}; System.err.println($stats.symbol + readings: + $stats.readings); // This shows an update on working memory facts with data from joined events //modify( $cp ) { currentPrice = $pr } // Although events are considered immutable, a common pattern is to use a class // to represent an event and enrich that event instance with data derived from other facts/events. // Bellow we enrich the event instance with the percentual change in the price, // based on the previous price //modify( $st ) { delta = $cp.delta } //modify( $st ) { readings = 5 } //System.out.println($st.delta) end ___ 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] moving average rule
Hello, I am trying to write a rule for a moving average over values over the last minute using fusion. In general I can't seem to locate a detailed resource for authoring syntax for these types of rules or rules in general, but specifically, I tried to modify something from the fusion documentation for my purposes using the StockTicker fusion sample. Here is the rule entry I aded to the broker.drl: rule Alert when moving average goes below 50 when Number( doubleValue 127 ) from accumulate( StockTick( symbol == ORCL, $price: price ) over window:time( 1m ), average( $price ) ) then System.out.println(moving average has gone beyone moving average); End I basically want to be alerted any time the moving average for ORCL moves above 127 (or whatever criteria I set.I picked that based on the sample data the sample fusion project uses), but it doesn't seem to be working. I guess if I could locate the definitave samples or guide for authoring these types of rules I could use that, but it's very difficult to piece together how to author rules utilizing fusion features based on isolated snippets from the fusion guide. Can anyone point me to some reasources for learning rule authoring, especially for taking advantage of the fusion features. Thanks, Chris ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users