Very well,

When I say is not working, what I mean is that the rule is never fired
and should fire, because I have facts in the working memory for that.
Anyway, I give you the really code of the rule and the facts that are in
the database.

For a total of 5 facts in module MAIN.
f-0   (MAIN::initial-fact)
f-1   (MAIN::Entity (absoluteSpeed 11.905696218853354) (allRecords
<Java-Object:java.util.Vector>) (class <Java-Object:java.lang.Class>)
(entityType <Java-Object:tools.types.EntityType>) (id 1) (intentionType
<Java-Object:tools.types.IntentionType>) (lastRecord
<Java-Object:engines.InputDataEngine.KinematicsRecord>) (manoeuvre
<Java-Object:tools.types.Manoeuvre>) (name "UNKNOWN") (position
<Java-Object:tools.modules.Position>) (speed
<Java-Object:tools.modules.Speed>) (time 1.2071231184415078E9)
(trackStatus <Java-Object:tools.types.TrackStatus>) (OBJECT
<Java-Object:tools.modules.Entity>))
f-2   (MAIN::Entity (absoluteSpeed 8.979319067861903) (allRecords
<Java-Object:java.util.Vector>) (class <Java-Object:java.lang.Class>)
(entityType <Java-Object:tools.types.EntityType>) (id 3) (intentionType
<Java-Object:tools.types.IntentionType>) (lastRecord
<Java-Object:engines.InputDataEngine.KinematicsRecord>) (manoeuvre
<Java-Object:tools.types.Manoeuvre>) (name "UNKNOWN") (position
<Java-Object:tools.modules.Position>) (speed
<Java-Object:tools.modules.Speed>) (time 1.2071231240553708E9)
(trackStatus <Java-Object:tools.types.TrackStatus>) (OBJECT
<Java-Object:tools.modules.Entity>))
f-3   (MAIN::Area (class <Java-Object:java.lang.Class>) (id 10) (name
"Area_1") (numberOfPoints 4) (polygon <Java-Object:java.awt.Polygon>)
(OBJECT <Java-Object:tools.modules.Area>))
f-4   (MAIN::Area (class <Java-Object:java.lang.Class>) (id 11) (name
"Area_2") (numberOfPoints 4) (polygon <Java-Object:java.awt.Polygon>)
(OBJECT <Java-Object:tools.modules.Area>))
For a total of 5 facts in module MAIN.


*(defrule entity-out-side-lane
   "if the entity is sailing outside ot the sea-lane"
   (Area {name == "Area_1"} (OBJECT ?Area1))
   (Area {name == "Area_2"} (OBJECT ?Area2))
   (Entity (OBJECT ?Entity &:(?Area1 entityIsOutsideArea ?Entity) &:
(?Area2 entityIsOutsideArea ?Entity)))
   =>
   (add (new Anomaly "entity-out-side-lane" 24 ?Entity "if the entity
is sailing outside ot the sea-lane" 1)))
*
Now if you look to the facts f3 and f4, you will see that I have two
areas, one named "Area_1", other "Area_2".  Fact f1 and f2 are two
entities. One of the entities is both outside of "Area_1" and "Area_2",
so I guess the rule should be fired. But don't . Any ideas?

Regards,

Joao

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: [EMAIL PROTECTED]
* 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:[EMAIL PROTECTED]
title:THALES NETHERLANDS B.V.
tel;work:2640
note:-unclassified mail-
version:2.1
end:vcard

Reply via email to