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