RE: JESS: < strange behavior

2007-02-14 Thread Skeptic 2000
> > Hi,> >> > I have a rule looking something like :> >> > (defrule wcooo ; 
> > exemple pour un while> > (MyShadowfact (OBJECT ?o))> > (test (< (str-length 
> > (?o methodreturningastring "param")) 3))> > =>> > (printout t "rulefired" 
> > (str-length (?o methodreturningastring > > "param")) crlf))> >> > And I 
> > strangly get the rulefired message with values like 4, 5, 6, ...> >> > 
> > Remember that pattern-matching is driven by facts being asserted, > 
> > retracted, or modified. In particular, the test above will be > evaluated 
> > only when the object is first put into working memory, or > when a change 
> > event or modify call causes it to be reevaluated. My > guess is that your 
> > method methodreturningastring returns a value > which changes over time 
> > without Jess being notified in any way about > the change. You will need to 
> > tell Jess when this value changes -- for > example, by using the 
> > Rete.updateObject() method
 
If I do an updateObject but :
1) none of the properties of the bean have changed
2) the methodreturningastring now returns a different value
 
Does the pattern matching occurs ? (the answer seems to be no)
 
JF
_
Soyez parmi les premiers à essayer Windows Live Mail.
http://ideas.live.com/programpage.aspx?versionId=5d21c51a-b161-4314-9b0e-4911fb2b2e6d

RE: JESS: < strange behavior

2007-01-19 Thread Skeptic 2000
 
I always do a jess.updateObject(myShadowFact) before the jess.run() call but 
I'll look again at it.
Thanks.



> From: [EMAIL PROTECTED]> Subject: Re: JESS: < strange behavior> Date: Fri, 19 
> Jan 2007 09:42:21 -0500> To: jess-users@sandia.gov> > > On Jan 19, 2007, at 
> 12:00 AM, Skeptic 2000 wrote:> > >> > Hi,> >> > I have a rule looking 
> something like :> >> > (defrule wcooo ; exemple pour un while> > 
> (MyShadowfact (OBJECT ?o))> > (test (< (str-length (?o methodreturningastring 
> "param")) 3))> > =>> > (printout t "rulefired" (str-length (?o 
> methodreturningastring > > "param")) crlf))> >> > And I strangly get the 
> rulefired message with values like 4, 5, 6, ...> >> > Remember that 
> pattern-matching is driven by facts being asserted, > retracted, or modified. 
> In particular, the test above will be > evaluated only when the object is 
> first put into working memory, or > when a change event or modify call causes 
> it to be reevaluated. My > guess is that your method methodreturningastring 
> returns a value > which changes over time without Jess being notified in any 
> way about > the change. You will need to tell Jess when this value changes -- 
> for > example, by using the Rete.updateObject() method.> > 
> -> Ernest 
> Friedman-Hill> Advanced Software Research Phone: (925) 294-2154> Sandia 
> National Labs FAX: (925) 294-2234> PO Box 969, MS 9012 [EMAIL PROTECTED]> 
> Livermore, CA 94550 http://www.jessrules.com> > 
> > To 
> unsubscribe, send the words 'unsubscribe jess-users [EMAIL PROTECTED]'> in 
> the BODY of a message to [EMAIL PROTECTED], NOT to the list> (use your own 
> address!) List problems? Notify [EMAIL PROTECTED]> 
> > 
_
Soyez parmi les premiers à essayer Windows Live Mail.
http://ideas.live.com/programpage.aspx?versionId=5d21c51a-b161-4314-9b0e-4911fb2b2e6d

Re: JESS: < strange behavior

2007-01-19 Thread Ernest Friedman-Hill


On Jan 19, 2007, at 12:00 AM, Skeptic 2000 wrote:



Hi,

I have a rule looking something like :

(defrule wcooo ; exemple pour un while
(MyShadowfact (OBJECT ?o))
(test (< (str-length (?o methodreturningastring "param")) 3))
=>
(printout t "rulefired" (str-length (?o methodreturningastring  
"param")) crlf))


And I strangly get the rulefired message with values like 4, 5, 6, ...



Remember that pattern-matching is driven by facts being asserted,  
retracted, or modified. In particular, the test above will be  
evaluated only when the object is first put into working memory, or  
when a change event or modify call causes it to be reevaluated. My  
guess is that your method methodreturningastring returns a value  
which changes over time without Jess being notified in any way about  
the change. You will need to tell Jess when this value changes -- for  
example, by using the Rete.updateObject() method.


-
Ernest Friedman-Hill
Advanced Software Research  Phone: (925) 294-2154
Sandia National LabsFAX:   (925) 294-2234
PO Box 969, MS 9012 [EMAIL PROTECTED]
Livermore, CA 94550 http://www.jessrules.com


To unsubscribe, send the words 'unsubscribe jess-users [EMAIL PROTECTED]'
in the BODY of a message to [EMAIL PROTECTED], NOT to the list
(use your own address!) List problems? Notify [EMAIL PROTECTED]




JESS: < strange behavior

2007-01-19 Thread Skeptic 2000
Hi, 
 
I have a rule looking something like :
 
(defrule wcooo ; exemple pour un while
(MyShadowfact (OBJECT ?o))
(test (< (str-length (?o methodreturningastring "param")) 3))
=>
(printout t "rulefired" (str-length (?o methodreturningastring "param")) crlf))
 
And I strangly get the rulefired message with values like 4, 5, 6, ...
Can someone help ?Thanks





> From: [EMAIL PROTECTED]> Subject: Re: JESS: Decorators> Date: Thu, 18 Jan 
> 2007 10:43:47 -0500> To: jess-users@sandia.gov> > Do the decorators actually 
> enlarge the API of the defclassed class? > In that case, you'll only be able 
> to match those additional > properties using Java method calls. Otherwise, 
> things would work out > fine; you could even just defclass the interface, if 
> that's how > things are structured. Otherwise, can you give us a concrete 
> example > to discuss?> > On Jan 18, 2007, at 9:17 AM, Krasnigor, Scott L 
> (N-AST) wrote:> > > I am curious what the implications are of defclassing a 
> class with > > many decorators associated with it? I need to be able to match 
> > > various attributes of the class that are part of the decorators. Is > > 
> there a correct/best way to handle this case? Any advice would be > > 
> appreciated. Thanks.> >> >> >> > Scott> >> >> >> >> > 
> -> Ernest 
> Friedman-Hill> Advanced Software Research Phone: (925) 294-2154> Sandia 
> National Labs FAX: (925) 294-2234> PO Box 969, MS 9012 [EMAIL PROTECTED]> 
> Livermore, CA 94550 http://www.jessrules.com> > 
> > To 
> unsubscribe, send the words 'unsubscribe jess-users [EMAIL PROTECTED]'> in 
> the BODY of a message to [EMAIL PROTECTED], NOT to the list> (use your own 
> address!) List problems? Notify [EMAIL PROTECTED]> 
> > 
_
Soyez parmi les premiers à essayer Windows Live Mail.
http://ideas.live.com/programpage.aspx?versionId=5d21c51a-b161-4314-9b0e-4911fb2b2e6d

Re: JESS: Strange behavior when using Jess modules

2003-08-26 Thread ejfried
I think Felix H. Bachmann wrote:
> A few days ago I posted a question concerning the use of modules and
> so far I did not get  any answer. Is there really no one who could
> help me to figure out what is wrong with the following
> example?

Probably because many people didn't bother to read it the first
time. A pet peeve of mine: as you can see below, your message is
pretty much incomprehensible for those of us who use normal plaintext
MUAs. If you're going to send HTML mail to a mailing list (or frankly,
to anyone) you should either make sure ahead of time they're
interested in receiving it, or check the "send as both HTML and
plaintext" box in your MUA.

But this time, I fired up Mozilla to read it, and so I can explain
what you're seeing. There's nothing "wrong" at all; you may not
understand the rules Jess uses for module lookup. They're explained in
section 2.10.2 of the manual, or page 125 of JIA.

Specifically, as applied to your example: when parsing a rule like this:

(defrule A::forA
  (MAIN::initial-fact)
  =>
  (assert (testfact A in A))
  (assert (testfact B in A)))

Jess has to decide what module "testfact" is in. The procedure is
really simple: Jess looks in module A, and if the template is not there,
Jess looks in MAIN. If it's not there, then it gets created in the
current module. In your program, this is A, and there's no
MAIN::testfact, so A::testfact is created and used on the rule's RHS.

Now, when Jess parses this rule:

(defrule B::forB
  (initial-fact)
  (MAIN::testfact B in MAIN)
  =>
  (assert (testfact A in B))
  (assert (testfact B in B)))

when Jess sees the MAIN::testfact pattern, this implied deftemplate is
created in MAIN. Now on the RHS, Jess follows the same search
procedure as when parsing the rule A::forA, but now the deftemplate
MAIN::testfact is found, so it is used, and no new testfact template
is created in the current module.

[ Original message below. ]

I think Felix H. Bachmann wrote:
> 
> 
> 
> 
> 
>  style="font-size:10pt">Hi,
> a few 
> days ago I posted a question concerning the use of modules and so far I did not get 
> any answer.  Is there really no one who could help me to figure out what is 
> wrong with 
> the following example?
> 
> 
>  style="font-size:10pt">Felix
> 
> 
> Here an 
> interesting issue. (I hope)
> 
> Assume the rules are 
> structured into 3 modules (MAIN, A, and B) which contain 
> statements to assert ordered facts as shown in this example:
> 
> ;
> ; 
> c:/jess/test/A.clp
>  style="font-size:10pt">;
> (defmodule 
> A)
> 
> (defrule 
> forA
>  style="font-size:10pt">(MAIN::initial-fact)
>  style="font-size:10pt">=>
> (assert 
> (testfact A in A))
> (assert 
> (testfact B in A)))
>  style="font-size:10pt">;
> ; 
> c:/jess/test/B.clp
>  style="font-size:10pt">;
> (defmodule 
> B)
> 
> (defrule 
> forB
>  style="font-size:10pt">(initial-fact)
>  style="font-size:10pt">(MAIN::testfact B in MAIN) ; < This causes the 
> trouble
>  style="font-size:10pt">=>
> (assert 
> (testfact A in B))
> (assert 
> (testfact B in B)))
>  style="font-size:10pt">;
> ; 
> c:/jess/test/MAIN.clp
>  style="font-size:10pt">;
> 
> (batch 
> c:/jess/test/A.clp)
> (batch 
> c:/jess/test/B.clp)
>  style="font-size:10pt">(reset)
>  style="font-size:10pt">(set-current-module MAIN)
> (assert 
> (testfact A in MAIN))
> (assert 
> (testfact B in MAIN))
> (focus A 
> B)
> 
> Module B contains a rule 
> that matches a fact from module MAIN (see the mark). After 
> loading MAIN.clp and running this little program jess displays the following 
> facts:
> -Result 
> with the marked statement
> Jess> 
> (facts *)
>  style="font-size:10pt">f-0   (MAIN::initial-fact)
>  style="font-size:10pt">f-1   (MAIN::testfact A in MAIN)
>  style="font-size:10pt">f-2   (MAIN::testfact B in MAIN)
>  style="font-size:10pt">f-3   (A::testfact A in A)
>  style="font-size:10pt">f-4   (A::testfact B in A)
>  style="font-size:10pt">f-5   (MAIN::testfact A in B)
>  style="font-size:10pt">f-6   (MAIN::testfact B in B)
> For a total 
> of 7 facts.
>  style="font-size:10pt">Jess>
> 
> f-5 and f-6 should not be 
> facts in module MAIN but in module B. After removing that 
> marked pattern from the rule ForB, facts are created as expected:
> 
> -Result without the marked 
> statement
> Jess> 
> (facts *)
>  style="font-size:10pt">f-0   (MAIN::initial-fact)
>  style="font-size:10pt">f-1   (MAIN::testfact A in MAIN)
>  style="font-size:10pt">f-2   (MAIN::testfact B in MAIN)
>  style="font-size:10pt">f-3   (A::testfact A in A)
>  style="font-size:10pt">f-4   (A::testfact B in A)
>  style="font-size:10pt">f-5   (B::testfact A in B)
>  style="font-size:10pt">f-6   (B::testfact B in B)
> For a total 
> of 7 facts.
>  style="font-size:10pt">Jess>
> 
> Can anybody tell me what I 
> am doing wrong here?
> 
> Felix
> Felix 
> Bachmann
> Carnegie 
> Mellon 
>  
> Voice: +1 (412) 268 6194
> Software 
> Engineering 
> Institute   
>  
> FAX:   +1 (412) 268 5

Re: JESS: Strange behavior when using Jess modules

2003-08-26 Thread Felix H. Bachmann



Hi,
a few days ago I posted a question concerning the use of modules and so far I did not get 
any answer.  Is there really no one who could help me to figure out what is wrong with 
the following example?


Felix


Here an interesting issue. (I hope)

Assume the rules are structured into 3 modules (MAIN, A, and B) which contain 
statements to assert ordered facts as shown in this example:

;
; c:/jess/test/A.clp
;
(defmodule A)

(defrule forA
(MAIN::initial-fact)
=>
(assert (testfact A in A))
(assert (testfact B in A)))
;
; c:/jess/test/B.clp
;
(defmodule B)

(defrule forB
(initial-fact)
(MAIN::testfact B in MAIN) ; < This causes the trouble
=>
(assert (testfact A in B))
(assert (testfact B in B)))
;
; c:/jess/test/MAIN.clp
;

(batch c:/jess/test/A.clp)
(batch c:/jess/test/B.clp)
(reset)
(set-current-module MAIN)
(assert (testfact A in MAIN))
(assert (testfact B in MAIN))
(focus A B)

Module B contains a rule that matches a fact from module MAIN (see the mark). After 
loading MAIN.clp and running this little program jess displays the following facts:
-Result with the marked statement
Jess> (facts *)
f-0   (MAIN::initial-fact)
f-1   (MAIN::testfact A in MAIN)
f-2   (MAIN::testfact B in MAIN)
f-3   (A::testfact A in A)
f-4   (A::testfact B in A)
f-5   (MAIN::testfact A in B)
f-6   (MAIN::testfact B in B)
For a total of 7 facts.
Jess>

f-5 and f-6 should not be facts in module MAIN but in module B. After removing that 
marked pattern from the rule ForB, facts are created as expected:

-Result without the marked statement
Jess> (facts *)
f-0   (MAIN::initial-fact)
f-1   (MAIN::testfact A in MAIN)
f-2   (MAIN::testfact B in MAIN)
f-3   (A::testfact A in A)
f-4   (A::testfact B in A)
f-5   (B::testfact A in B)
f-6   (B::testfact B in B)
For a total of 7 facts.
Jess>

Can anybody tell me what I am doing wrong here?

Felix
Felix Bachmann
Carnegie Mellon  
Voice: +1 (412) 268 6194
Software Engineering Institute    
FAX:   +1 (412) 268 5758
Pittsburgh, PA 15213







To unsubscribe, send the words 'unsubscribe jess-users [EMAIL PROTECTED]'
in the BODY of a message to [EMAIL PROTECTED], NOT to the list
(use your own address!) List problems? Notify [EMAIL PROTECTED]




JESS: Strange behavior when using Jess modules

2003-08-25 Thread Felix H. Bachmann



Here an interesting issue. (I hope)


Assume the rules are structured into 3 modules (MAIN, A, and B) which contain 
statements to assert ordered facts as shown in this example:


;
; c:/jess/test/A.clp
;
(defmodule A)


(defrule forA
(MAIN::initial-fact)
=>
(assert (testfact A in A))
(assert (testfact B in A)))
;
; c:/jess/test/B.clp
;
(defmodule B)


(defrule forB
(initial-fact)
(MAIN::testfact B in MAIN) ; < This causes the trouble
=>
(assert (testfact A in B))
(assert (testfact B in B)))
;
; c:/jess/test/MAIN.clp
;


(batch c:/jess/test/A.clp)
(batch c:/jess/test/B.clp)
(reset)
(set-current-module MAIN)
(assert (testfact A in MAIN))
(assert (testfact B in MAIN))
(focus A B)


Module B contains a rule that matches a fact from module MAIN (see the mark). After 
loading MAIN.clp and running this little program jess displays the following facts:
-Result with the marked statement
Jess> (facts *)
f-0   (MAIN::initial-fact)
f-1   (MAIN::testfact A in MAIN)
f-2   (MAIN::testfact B in MAIN)
f-3   (A::testfact A in A)
f-4   (A::testfact B in A)
f-5   (MAIN::testfact A in B)
f-6   (MAIN::testfact B in B)
For a total of 7 facts.
Jess>


f-5 and f-6 should not be facts in module MAIN but in module B. After removing that 
marked pattern from the rule ForB, facts are created as expected:

-Result without the marked statement
Jess> (facts *)
f-0   (MAIN::initial-fact)
f-1   (MAIN::testfact A in MAIN)
f-2   (MAIN::testfact B in MAIN)
f-3   (A::testfact A in A)
f-4   (A::testfact B in A)
f-5   (B::testfact A in B)
f-6   (B::testfact B in B)
For a total of 7 facts.
Jess>


Can anybody tell me what I am doing wrong here?


Felix
Felix Bachmann
Carnegie Mellon  
Voice: +1 (412) 268 6194
Software Engineering Institute    
FAX:   +1 (412) 268 5758
Pittsburgh, PA 15213





To unsubscribe, send the words 'unsubscribe jess-users [EMAIL PROTECTED]'
in the BODY of a message to [EMAIL PROTECTED], NOT to the list
(use your own address!) List problems? Notify [EMAIL PROTECTED]