JESS: Bload question

2006-01-19 Thread Krasnigor, Scott L (N-AST)
Title: Bload question






I performed a bsave from an engine that contains only shadow facts (and some simple rules). If I do a bload with that file into a new engine, are the facts that are loaded via the bload command remain shadow facts? Or do I need to re-definstance them in order to see modifications to the facts in working memory from my java app? Thanks.

Scott






RE: JESS: Jess70b5 and Eclipse 3.1.1

2006-01-10 Thread Krasnigor, Scott L (N-AST)
Did you try to run eclipe with -clean after extracting the files? This worked 
for me. 

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Jean-Frangois 
Lebeau
Sent: Tuesday, January 10, 2006 2:32 PM
To: jess-users@sandia.gov
Subject: JESS: Jess70b5 and Eclipse 3.1.1

Hi,

I'm a new JESS user, I'm trying to install the eclipse plug-in of Jess70b5 into 
Eclipse 3.1.1 and it doesn't seem to work. (Nothing new after I extract the 
files and I run eclipse again).

Is there a version issue here ?

Thanks for help.

Jean-Frangois Lebeau
Universiti of Sherbrooke, Qc, Canada.


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]




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: Modifying JavaBeans

2005-08-31 Thread Krasnigor, Scott L (N-AST)
Title: Modifying JavaBeans






Sorry to bother everyone. I am trying to play around with JESS embedded in Java to get an understanding of JESS. I created a simple Java bean which contains two properties: range and qualRng. I create the fact within Jess utilizing defclass and definstance. Executing engine.facts() shows that the fact has been created in Jess's memory with the appropriate slots. I created a simple rule to check to see if range is below 20, if true, modify the qualRng slot to TRUE. I added code to main() decrement the initial value of range in order to fire the rule. Watching the results shows that the range slot decrements properly and the rule fires, but the qualRng field never gets updated to show TRUE. I am sure it is something simple, but I just don't see the problem. I've modified the RHS of the rule with all the different iterations I could think of but to no avail. The code is listed below (minus the java bean class). Thanks for your assistance.

import jess.*;


public class testFacts 

{

 public static void main(String[] args) 

 {

  Value fact;

  try

  {

   Rete engine = new Rete();

   engine.watchAll();


   engine.defclass(testTrkClass, testTrack, null);

   testTrack trkOne = new testTrack(30, 45, 5);

   fact = engine.definstance(testTrkClass, trkOne, true);

   

   // Load rules clip file

   engine.executeCommand((batch testTrk.clp));

   engine.run();

   

   // change range until it triggers a dummy doct rule


   int i;

   for(i = trkOne.getRange(); i  5; i--)

   {

trkOne.setRange(i);

try 

{

 Thread.sleep(500);

}

catch (InterruptedException ie){}

   }

  }

  catch (JessException je)

  {

   System.out.print(An error occurred at line  + je.getLineNumber());

   System.out.println( which looks like  + je.getProgramText());

   System.out.println(Message:  + je.getMessage());

  }

 }


}


The clp file:


(defrule dummy-range-doctrine

 ;; set qualRng to true if trk is in range

 ?fact - (testTrkClass (range ?x:(= ?x 20)))

 =

 (modify ?fact (qualRng TRUE)))




Scott L. Krasnigor

Principal Engineer/Scientist

Atlantic Science  Technology

Lockheed Martin - MS2

' 856-359-3094

* [EMAIL PROTECTED]

* 770-2





RE: JESS: Modifying JavaBeans

2005-08-31 Thread Krasnigor, Scott L (N-AST)
Thanks. Works like a champ. I had a feeling that it was something
simple. 

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
On Behalf Of [EMAIL PROTECTED]
Sent: Wednesday, August 31, 2005 1:31 PM
To: jess-users@sandia.gov
Subject: Re: JESS: Modifying JavaBeans

Hi Scott, 

Rules only fire during a call to run(). Your call to run() returns
immediately because when you call it, there are no rules eligible to
fire yet. Then you make some changes to the fact, and the
PropertyChangeEvents update the working memory, but you never call
run() again, so even when it is activated, the rule never fires.

You could call run() in your for loop, and then the rule would fire and
update the slot as expected. Note that it makes sense for this rule to
fire only once -- no reason to fire once the qualRng slot is TRUE, so
you might write the pattern like this:


 (defrule dummy-range-doctrine
 ;; set qualRng to true if trk is in range
 ?fact - (testTrkClass (range ?x:(= ?x 20)) (qualRng ~TRUE))
 =
 (modify ?fact (qualRng TRUE)))


I think Krasnigor, Scott L (N-AST) wrote:
 Sorry to bother everyone. I am trying to play around with JESS 
 embedded in Java to get an understanding of JESS. I created a simple 
 Java bean which contains two properties: range and qualRng. I create 
 the fact within Jess utilizing defclass and definstance. Executing 
 engine.facts() shows that the fact has been created in Jess's memory 
 with the appropriate slots. I created a simple rule to check to see if

 range is below 20, if true, modify the qualRng slot to TRUE. I added 
 code to
 main() decrement the initial value of range in order to fire the rule.
 Watching the results shows that the range slot decrements properly and

 the rule fires, but the qualRng field never gets updated to show TRUE.

 I am sure it is something simple, but I just don't see the problem. 
 I've modified the RHS of the rule with all the different iterations I 
 could think of but to no avail. The code is listed below (minus the 
 java bean class). Thanks for your assistance.
 
 import jess.*;
 
 public class testFacts
 {
   public static void main(String[] args) 
   {
   Value fact;
   try
   {
   Rete engine = new Rete();
   engine.watchAll();
 
   engine.defclass(testTrkClass, testTrack,
null);
   testTrack trkOne = new testTrack(30, 45, 5);
   fact = engine.definstance(testTrkClass,
 trkOne, true);
   
   // Load rules clip file
   engine.executeCommand((batch testTrk.clp));
   engine.run();
   
   // change range until it triggers a dummy doct
rule
 
   int i;
   for(i = trkOne.getRange(); i  5; i--)
   {
   trkOne.setRange(i);
   try 
   {
   Thread.sleep(500);
   }
   catch (InterruptedException ie){}
   }
   }
   catch (JessException je)
   {
   System.out.print(An error occurred at line  + 
 je.getLineNumber());
   System.out.println( which looks like  +
je.getProgramText());
   System.out.println(Message:  +
 je.getMessage());
   }
   }
 
 }
 
 The clp file:
 
 (defrule dummy-range-doctrine
 ;; set qualRng to true if trk is in range
 ?fact - (testTrkClass (range ?x:(= ?x 20)))
 =
 (modify ?fact (qualRng TRUE)))
 
 
 
 Scott L. Krasnigor
 Principal Engineer/Scientist
 Atlantic Science  Technology
 Lockheed Martin - MS2
 ' 856-359-3094
 * [EMAIL PROTECTED]
 * 770-2
 



-
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://herzberg.ca.sandia.gov


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]



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]