ok
But i think I do not need to differentiate
them.
I try to explain it better.
I have got a set of "Contract" class Facts. All
of them inserted into the working memory.
But Just one of them is the "main contract", all
the others all "related contracts".
So , when i write a rule I need to distinguish
between a "main contract" (which is unique along the session)
and a "related contract".
I should write rules like the
followings:
when
$mc: Contract() from
maincontract
then
#rule fired over "the"
main contract
end
when
$rc: Contract() from
relatedcontract
then
#rule fired over "a" related
contract
end
I think the only solution to do that is to make
"maincontract" and "relatedcontracr" globals.
But, if I make them globals, then the rule
engine will not be notified about their changes and
I do want it to be notified about it.
Should I make them "globals" and "facts" as
well?
Can globals be inserted into the WM as well? Is
it too horrible? :D
Thank u anyway.
Massi
----- Original Message -----
Sent: Saturday, January 05, 2008 12:00
PM
Subject: Re: [rules-users] Checking
fact "id"
What attribute differentiates A1 from A2?
Such scenarios usually are solved by an additional
constraint...
[]s
Edson
2008/1/4, Massi Gmail < mmquelo@gmail.com>:
Hi guys,
Now I am strugglin' with "fact id
checking" or whatever we can call it.... :D
Let's take into account the followong
scenario:
I have class A (it's just a name) javabeans
to be inserted into the WM.
I define two objects of class A: A1 and
A2.
Somewhere I do "insert(A1)" and "insert(A2)"
( let's say I do it in the same package of R1 and R2..see below...)
Then I define two different rules R1 and R2
that reason over class "A" facts (let's say R1 and R2 are in the
same package) .
The point is.... I want R1 to fire only
on A1 and R2 only on A2.
Is that possible in drools? Is there a sort
of "fact id" I can reason over?
I do not think globals will be of any help,
cause in the guide i have read that globals should never be used within
LHS.
We should never reason over globals.
Let me know.
Massi
_______________________________________________
rules-users
mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users
--
Edson Tirelli
JBoss Drools
Core Development
Office: +55 11
3529-6000
Mobile: +55 11 9287-5646
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