Hi Frank,<br><br>It's good to have feedback :)<br><br>Closing the loop will help others who Google for similar issues at some future date.<br><br>At least you no longer have to stare at your code getting bored!<br><br>
With kind regards,<br><br>Mike<br><br><div class="gmail_quote">On 8 March 2011 11:31, FrankVhh <span dir="ltr"><<a href="mailto:frank.vanhoenshoven@agserv.eu">frank.vanhoenshoven@agserv.eu</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
I know etiquette stipulates to avoid small talk, but since there is no<br>
"resolved" button, I think this can be useful.<br>
<br>
You suspected rightly, manstis, removing lock-on-active and replacing it<br>
with extra constraints in the LHS indeed solved the problem.<br>
<br>
Thanks for the quick (and correct) response :-).<br>
<div class="im"><br>
<br>
manstis wrote:<br>
><br>
> I suspect your use of lock-on-active.<br>
><br>
> Expert's documentation states: "Whenever ... an agenda-group receives the<br>
> focus, any rule within that group that has lock-on-active set to true will<br>
> not be activated any more; irrespective of the origin of the update, the<br>
> activation of a matching rule is discarded". Both rules are in the default<br>
> MAIN agenda group so when the first inserts a new Price the update to WM<br>
> (insert in your case) is not visible to the other rule. Inserting a new<br>
> Price before calling fireAllRules or commenting out the price constraint<br>
> in<br>
> the LHS alters the Facts\Patterns needing to be matched for activation to<br>
> occur.<br>
><br>
> So, try removing lock-on-active (or making the two rules in different<br>
> agenda<br>
> groups).<br>
><br>
> With kind regards,<br>
><br>
> Mike<br>
><br>
</div><div><div></div><div class="h5">> On 8 March 2011 09:53, FrankVhh wrote:<br>
><br>
>> Hi all,<br>
>><br>
>> Since yesterday, I am having a problem with reading inserted objects from<br>
>> memory. I don't know why it does not go as planned, because it should be<br>
>> quite straightforward. It is getting boring to stare at the code, so<br>
>> maybe<br>
>> one of you can detect an error.<br>
>><br>
>> There are 2 kinds of rules. One kind inserts price objects into working<br>
>> memory (as in example 1). THe other kind detects whether the price exists<br>
>> and adapts it to a product (as in example 2).<br>
>><br>
>> Example 1 seems to work, but the engine does not seem to recognize them<br>
>> as<br>
>> a<br>
>> Price object. All original price attributes of the products remain<br>
>> unchanged<br>
>> unless:<br>
>> - I manually insert a Prce object before calling fireAllRules()<br>
>> or<br>
>> - Checking for an existing price is commented out in the LHS<br>
>><br>
>> Removing constraints from $price (just checking for existance of a price)<br>
>> does not help.<br>
>><br>
>> Any idea what has been going wrong?<br>
>><br>
>> Thanks in advance.<br>
>><br>
>> ==============Example 1=================<br>
>> rule "Prices_17"<br>
>><br>
>> lock-on-active true<br>
>> when<br>
>> then<br>
>> Price $price = new Price();<br>
>> $price.setName("Blue autumn");<br>
>> $price.setPrice(6);<br>
>> insert($price);<br>
>> System.out.println("Price " + $price.getName() + "<br>
>> inserted");<br>
>> end<br>
>> =============Example of usage=========================<br>
>><br>
>> rule "Products_36"<br>
>><br>
>> lock-on-active true<br>
>> when<br>
>> $product: Product(colour == "Blue")<br>
>> Season(season == Season.AUTUMN)<br>
>> $price: Price(name == "Blue autumn")<br>
>> then<br>
>> $product.setPrice($price.getPrice());<br>
>> update($product);<br>
>> System.out.println("Rule executed");<br>
>> end<br>
>> ===================================================<br>
>><br>
>> --<br>
>> View this message in context:<br>
>> <a href="http://drools-java-rules-engine.46999.n3.nabble.com/Object-insertion-on-runtime-tp2650219p2650219.html" target="_blank">http://drools-java-rules-engine.46999.n3.nabble.com/Object-insertion-on-runtime-tp2650219p2650219.html</a><br>
>> Sent from the Drools - User mailing list archive at Nabble.com.<br>
>> _______________________________________________<br>
>> rules-users mailing list<br>
>> <a href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a><br>
>> <a href="https://lists.jboss.org/mailman/listinfo/rules-users" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-users</a><br>
>><br>
><br>
> _______________________________________________<br>
> rules-users mailing list<br>
> <a href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a><br>
> <a href="https://lists.jboss.org/mailman/listinfo/rules-users" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-users</a><br>
><br>
<br>
<br>
--<br>
</div></div>View this message in context: <a href="http://drools-java-rules-engine.46999.n3.nabble.com/Object-insertion-on-runtime-tp2650219p2650454.html" target="_blank">http://drools-java-rules-engine.46999.n3.nabble.com/Object-insertion-on-runtime-tp2650219p2650454.html</a><br>
<div><div></div><div class="h5">Sent from the Drools - User mailing list archive at Nabble.com.<br>
_______________________________________________<br>
rules-users mailing list<br>
<a href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a><br>
<a href="https://lists.jboss.org/mailman/listinfo/rules-users" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-users</a><br>
</div></div></blockquote></div><br>