[rules-users] [Drools.5.0.1] insertLogical abnormalities

Mark Proctor mproctor at codehaus.org
Tue Apr 24 19:18:53 EDT 2012


On 24/04/2012 23:27, rouvas at mm.di.uoa.gr wrote:
> Thanks for the prompt reply, please see comments inline.
>
> Mark Proctor wrote:
>> this rule is invalid, can't have bindings on 'not' as you can't bind
>> something that doesn't exist.
>>
>>     not ( logg : InternalResultCode( ruleId=="5", goodNo==gnId.goodNo) )
> Sorry, I don't get it.
> The rule is certainly valid as it compiles and executes fine on Drools.
> There may be other instances of "InternalResultCode" just not with these
> values.
> The values used are binded outside the not() and not used in the rest of
> the rule.
Not talking about compilation, trying to understand your intent. You are 
binding to a single pattern inside of a not, that binding is not used 
else where within that 'not'.

Anyway check your hashcodes, and latest version of drools.

Mark
>> Make sure you implement equals/hashcode properly for logical facts. Aslo
> I haven't implemented anything. I rely solely on Drools to properly handle
> facts and it does so as expected.
>
>> make sure you understand that only one equal instance of logical
>> insertion will ever exist, futher equal insertions are ignored.
> That is understood. The RHS of the rule logicalInserts three different
> kind of facts, but only two of them are reported as inserted. Where did
> the third one go, since the RHS is executed?
>
>> Also please try it on 5.4.CR1 too, as lots of bug fixes in there.
> Changing Drools version is not feasible at the moment, although at the
> TODO list.
>
> Thank you for your time,
> -Stathis
>
>> Mark
>>
>> On 24/04/2012 18:43, Stathis Rouvas wrote:
>>> Hi List.
>>>
>>> I am using Drools.5.0.1.
>>>
>>> I am experiencing abnormalities using insertLogical(),
>>> namely that in the following code
>>>     RaResultCode and RegistryUsed are found inserted (using the relevant
>>> queries), while
>>>     InternalResultCode is not found (using the query "get ircQuery")
>>> and I cannot explain why this is hapenning.
>>>
>>> The code in question is:
>>>
>>> query "get RaCode"
>>>     rrc : RaResultCode()
>>> end
>>>
>>> query "get RaRegUsed"
>>>     regUsed : RegistryUsed()
>>> end
>>>
>>> query "get ircQuery"
>>>     irc : InternalResultCode()
>>> end
>>>
>>> rule "r5"
>>>     no-loop true
>>>     dialect "mvel"
>>> when
>>>     gnId : GoodNumbers()
>>>     not ( logg : InternalResultCode( ruleId=="5", goodNo==gnId.goodNo) )
>>>     LogicalValue : HeaderMessage( gnId.goodNo==goodNo , totalItemNo == 3
>>> )
>>>     v261 : t2206( )
>>> then
>>>     InternalResultCode irrc = new InternalResultCode();
>>>       irrc.setRuleId("5");
>>>       irrc.setGoodNo(gnId.goodNo);
>>>     insertLogical(irrc);
>>>     RaResultCode rrc = new RaResultCode();
>>>       rrc.setResultRuleId("5");
>>>       rrc.setResultGoodNo(gnId.goodNo);
>>>     insertLogical(rrc);
>>>     RegistryUsed ruv261 = new RegistryUsed();
>>>       ruv261.setResultGoodNo(gnId.goodNo);
>>>       ruv261.setRegRowId(v261.regRowId);
>>>       ruv261.setVersionId(v261.versionId);
>>>       ruv261.setRuleId("5");
>>>     insertLogical(ruv261);
>>> end
>>>
>>> Using a statefull session,
>>> the KnowledgeBase is created,
>>> then 26 facts for "t2206" and one fact for "HeaderMessage" are inserted
>>> and finally
>>> fireAllRules() is called.
>>>
>>> Afterwards the defined queries are used to gather the results, but as
>>> noted in the begininning
>>> results for "InternalResultCode", are missing.
>>> There should be one for each of the "InternalResultCode", "RaResultCode"
>>> and "RegistryUsed" entities.
>>>
>>> Can anyone shed some light?
>>>
>>> Thank you for your time,
>>> -Stathis
>>> _______________________________________________
>>> rules-users mailing list
>>> rules-users at lists.jboss.org
>>> https://lists.jboss.org/mailman/listinfo/rules-users
>> _______________________________________________
>> rules-users mailing list
>> rules-users at lists.jboss.org
>> https://lists.jboss.org/mailman/listinfo/rules-users
>>
>
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users



More information about the rules-users mailing list