I discovered the problem. Somehow, jess doesn't like the comparisson
like { name == "Area_1"}, but instead if I use (name /Area_1/) it works.
This sounds very weird because for only one line comparison it works,
but to subsequent lines doesn't. I mean:
(defrule
(Area {name=="area1"}(OBJECT ?Area1))
=>
it works. But if I make this
(defrule
(Area {name=="area1"}(OBJECT ?Area1))
(Area {name=="area2"}(OBJECT ?Area2))
=>
doesn't. Now if I use this
(Area (name /area1/)(OBJECT ?Area1)
(Area (name /area2/)(OBJECT ?Area2)
=>
it works just fine. Strange but it happens.
Dusan Sormaz wrote:
> Joao,
>
> can you show the complete rule? Your code snippet is missing a
> parenthesis at the end of the first Area line.
>
> Also when you say: "it is not working" it is not enough to understand
> the possible error. show either error messages or explain what is
> shown, for example, does error show when you load (compile) rules, or
> when you try to run them.
>
> Dusan Sormaz
>
> At 05:39 AM 4/1/2008, you wrote:
>
>> Hello,
>>
>> My question is about if it is possible to assign the same class of
>> objects several times in the same rule. I mean, let say i have a class
>> "Area" and I have multiple facts containing objects of the class "Area"
>> in the working memory. Can I do something like this:
>>
>> (defrule
>> (Area {name=="area1"}(OBJECT ?Area1)
>> (Area {name=="area2"}(OBJECT ?Area2)
>> ....
>> and then I can work with these objects. I tested and is not working. It
>> seems that jess refuses to assign two times the same class in the rule.
>> Of course I had import my class "Area" to jess, it can recognize it. Can
>> you help me about this?
>>
>> Thanks,
>>
>> Joao Mourao
>>
>> --------------------------------------------
>> Unclassified email
>>
>>
>>
>>
>>
> *********************************************************************
> * Dusan Sormaz PhD, Associate Professor
> * Ohio University
> * Department of Industrial and Systems Engineering
> * 277 Stocker Center, Athens, OH 45701-2979
> * phone: (740) 593-1545
> * fax: (740) 593-0778
> * e-mail:
sormaz@...
> * url:
http://www.ent.ohiou.edu/~sormaz> <
http://www.ent.ohiou.edu/%7Esormaz>
> *********************************************************************
>
begin:vcard
fn;quoted-printable:Jo=C3=A3o Mour=C3=A3o
n;quoted-printable;quoted-printable:Mour=C3=A3o;Jo=C3=A3o
org:Thales;Above Water Systems
adr:;;;Hengelo;;;Netherlands
email;internet:
joao.mourao@...
title:THALES NETHERLANDS B.V.
tel;work:2640
note:-unclassified mail-
version:2.1
end:vcard