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) )
Make sure you implement equals/hashcode properly for logical facts. Aslo
make sure you understand that only one equal instance of logical
insertion will ever exist, futher equal insertions are ignored.
Also please try it on 5.4.CR1 too, as lots of bug fixes in there.
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(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users