Re: JESS: Naming facts

2006-01-19 Thread Alan Moore

You could also try something like the following:

WARNING: not real code...

file: DeviceMonitor.jess

(import com.yourpackage.Device)
(defclass Device com.yourpackage.Device)

(defrule shutdown-out-of-limit-devices
   (Device (outOfLimit TRUE) (id ?deviceId) (OBJECT ?obj))
=>
   (printout t "Device " ?deviceId " is out of limit")
   (printout t "Shutting it down now...")
   (?obj shutdown)
)


file: Device.java

import java.beans.*;

public class Device
{
   private boolean outOfLimit = false;
   private java.beans.PropertyChangeSupport pcs = new 
PropertyChangeSupport(this); // or somthing...


   public Device( String deviceId )
   {
  this.deviceId = deviceId;
  pollDeviceStatus();
   }

   public String getId() { return deviceId; }

   public void shutdown() { /* whatever... */ }

   public void setOutOfLimit( boolean outOfLimit )
   {
  boolean oldValue = this.outOfLimit;
  this.outOfLimit = outOfLimit;
  pcs.firePropertyChangeEvent( "outOfLimit", new Boolean(oldValue), 
new Boolean(outOfLimit));

   }

   public boolean isOutOfLimit() { return isOutOfLimit; }

   public void pollDeviceStatus()
   {
  // get actual device status from serial port, USB, net, etc.
  boolean newStatus = getDeviceActualStatus(); // TBD
  boolean prevStatus = device.isOutOfLimit();

  if ( newStatus != prevStatus ) // prevent redundant changes
 device.setOutOfLimit( newStatus );
   }
}

file: Main.java

import jess.*;

public class Main
{
   private HashMap devices = new HashMap();

   private void createDeviceProxies()
   {
  // populate devices hashmap with your devices
  // e.g. Device device = new Device("device id 1");
  // devices.put("device id 1", device);
   }

   static public void main( String[] args )
   {
  createDeviceProxies();

  Rete rete = new Rete();
  Jesp parser = new Jesp( ... ); // plus, load your rules, etc
  // be sure your jess script does defclass for your "Device" class
  rete.reset();

  for ( Device device : devices )
  {
 rete.definstance("Device", device, true );
  }

  while ( true )
  {
 for ( Device device : devices )
 {
device.pollDeviceStatus();
 }

 // now all devices are updated, reason about what to do
 rete.run();

 // since we are polling, rest for a while
 try { Thread.sleep(1000); } catch Exception /// blah blah blah
  }
   }
}

Of course, if your devices can supply asynchronous event notifications 
you wouldn't have to do the polling as shown above - you'd simply call 
rete.runUntilHalt() in your main method and let your Device objects 
update themselves via the event handlers.


Hope this helps.

Alan



Donnelly wrote:

Given a list of device names, when a device is out of limits I want to
assert an appropriately named fact
   devicename-exceeds-limits.
If I use (assert (sym-cat ?device ?condition))  the fact becomes
  sym-cat devicename -exceeds-limits.
How can I create correctly named facts?

Stephen Donnelly


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]




Re: JESS: Firing order

2005-11-20 Thread Alan Moore

Nicolas Fortin wrote:

Hello everybody,

I am wondering if it is possible to randomize the firing order,


You can create an object that implements the jess.Strategy interface, see:

http://herzberg.ca.sandia.gov/jess/docs/70/api/jess/Strategy.html

You will implement the compare() method and Jess will call this method 
to provide an ordering between any given two activations.


You will also need to tell Jess to use your strategy by calling:

http://herzberg.ca.sandia.gov/jess/docs/70/api/jess/Rete.html#setStrategy(jess.Strategy)

or:

http://herzberg.ca.sandia.gov/jess/docs/70/functions.html#set-strategy

Your Strategy implementation will have to examine both activations and 
if the rule for each one is the same, apply a random ordering between 
the two - I think...


For any two activations that are not from the same rule, you might want 
to delegate to an existing Strategy implementation (e.g. the default one.)


Good luck!

alan


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]




Re: JESS: Debugger

2005-11-17 Thread Alan Moore

[EMAIL PROTECTED] wrote:

I think Jeffrey Davine wrote:


I'll do the research, but as a general matter, do you think the Jess API
exposes enough information (particularly concerning the rete tokens) so that
I could write such a tool?



Alan's more optimistic, but I myself don't think this can really be
done at the level you'd like without using and/or modifying private
APIs in Jess. The details of the Rete network implementation aren't
exposed as public APIs just because they change often and exposing
them would present too great a support burden.


I was speaking strictly of my old WSH debugger code and utilizing Jess' 
implementation of the Eclipse debugging API. Of course these APIs are 
not considered public since they are in the gov.sandia namespace but 
they do implement public interfaces.


However, that is far easier than modifying the Jess sources as I had to 
do way back when. The old code doesn't support viewing the Rete, etc. - 
it only does Funcall iterception for stepping through the RHS.


I hope I didn't mislead anyone and am sorry if I did...



But I'll tell you what: one enormously valuable contribution in this
area would just be writing use cases/storyboards/walkthroughs/UI
mock-ups. I personally have a hard time picturing just how this will
be integrated into the more traditional source-oriented Eclipse
debugger architecture. Remembering that the left-hand-sides of rules
can be shared in the Rete network, it would be extremely helpful for
someone to present a coherent view of how this kind of debugging would
work.


I've put my suggestions in the wiki. Hope it helps.



Personally I always imagine something like the existing Rete Network
View in the JessDE, but "live", connected to a debugged
program. Further, there's a notion of the "current Rete node" which is
highlighted in the diagram, and you can select an inspect the current
node or any other node. You can push a "step" button which somehow
shows you which tests pass and what Tokens get created, and you can
watch them go from that current node to the other nodes. But the
details are still fuzzy to me. How does this interact with stepping
through procedural parts of the program?


This sounds reasonable. On the other hand, I think many Jess users would 
be more confortable if the complexity of the Rete is hidden or 
progressively revealed to them in a way that matches their cognitive 
view of their rules.


Maybe a simplified way of drilling down via the LHS patterns into the 
(filtered) Rete state would be a place to start developing use cases.




Can we start a Wiki page about this? ... OK, here you go:

http://herzberg.ca.sandia.gov/jesswiki/view?ConstantineDebuggerPlanning

Any and all contributions welcome.


See you there!

alan


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]




Re: FW: JESS: Debugger

2005-11-16 Thread Alan Moore

Jeffrey,

I created a debugger quite a few years back (Jess version 4.xx) that I 
have not maintained. I'd have to locate the media it is archived onto 
but I've been wanting to resurrect it.


It didn't do exactly what you want and it was pretty crude since it was 
fronted by the Windows Scripting Host Debugger which I later removed as 
a dependency. It depended on custom modifications to the Jess source 
code to work. With the new 7.0 API's I think most of what it does could 
be reimplemented using public API's quite easily.


Let me know if you would like to help work on it.

alan


Jeffrey Davine wrote:
The debugging facility Im wondering about would also allow single 
stepping thorough rules as they activate with the ability to watch the 
patterns and joins.


 




*From:* [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] 
*On Behalf Of *Jeffrey Davine

*Sent:* Wednesday, November 16, 2005 10:48 AM
*To:* jess-users@sandia.gov
*Subject:* JESS: Debugger

 

Does Jess have a built-in facility to browse rules? By that I mean a way 
to check, for any rule, which if any facts match patterns in the rule 
(showing how the fact is bound to the pattern) and whether there are 
joins for each pattern?


 

Also, is there any additional information or documentation on the Jess 
debugger part of version 7 (beyond the comments in 3.2.4 of the manual)?


 


Jeff





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]




Re: JESS: Debugger

2005-11-16 Thread Alan Moore

Try this:

(view)

It displays the rete in a swing based graph.

alan


Jeffrey Davine wrote:
Does Jess have a built-in facility to browse rules? By that I mean a way 
to check, for any rule, which if any facts match patterns in the rule 
(showing how the fact is bound to the pattern) and whether there are 
joins for each pattern?


 

Also, is there any additional information or documentation on the Jess 
debugger part of version 7 (beyond the comments in 3.2.4 of the manual)?


 


Jeff




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]




Re: JESS: Jess error: Bad index

2005-11-01 Thread Alan Moore

Eunice,

Please provide the exact code and error messages you are getting. Please 
try to figure out whether the problem is with Protege, JessTab and/or 
Jess before posting to this list.


For example, copy key portions (e.g. function names, exception names) of 
the stacktrace you are getting and then try Googling for them. Often you 
will find answers listed in a FAQ or in a mailing list archive. Also, 
try searching the Protoge list archives/FAQ for JessTab. Rarely (if 
ever?) is a Protoge/JessTab related problem due to something in Jess.


Good luck!

alan


Eunice Palmeira wrote:

Well, the solution was to change the version of JessTab and Jess. Now
I use Jess 6.0b3 and JessTab1.1. However, when I run from eclipse many
errors are reported.
Can you help me?
Eunice




2005/11/1, Rich Halsey <[EMAIL PROTECTED]>:


While this reply does not deal directly with the rule under discussion, I
continue to be amazed at the approaches used to "engineer" rule-based
systems (which ultimately fail) and how little we hear from the the Olympic
geniuses who are employed by the vendors (unless you are willing to pay
$300/hr).

To me, rules engineering (at the requirements/analysis level) is a
discipline that is simple:

(1) discover the "rules" that are found/described in the textual portions of
the requirements.

(2) describe possible "information entities" that the rule's LHS uses to
test for truth and that the rule's RHS would take action with
(create/update/delete).

(3) model this information in such a way that the potential interactions
between the rules can be documented, i.e. what conditional testing by LHS
would be impacted by actions of the RHSs of other rules.

(4) elaborate on this information with a high-level "control" system to
preclude the possibility of undesirable conflicts between rules.

Ironically, much of this can be set down in an Excel spreadsheet. The
principal problem is that the merit of this approach seems to be lost on
people until they have endured multiple project failures (myself included)
and begin to look at rules engineering as something that is 180 degrees out
of phase from ordinary procedural programming - it is a radically different
paradigm that is not intuitively obvious to the uninitiated.

Once this technique becomes second nature to the rules designer, success
(and $) will follow. I offer this advice free to beginners, but as a
consultant I do not work for free.

Rich Halsey
- Original Message -
From: "James C. Owen" <[EMAIL PROTECTED]>
To: 
Sent: Monday, October 31, 2005 11:53 PM
Subject: Re: JESS: Jess error: Bad index




OK, this has been in my mail box for almost four hours and no one has
said anything - so, here goes.  FIRST - don't write B I G rules !!!
Second, half of the logic is in the right hand side (AE) of the  rule.
Why?  Third, there is absolutely NO explanation of what the  rule does or
what it is supposed to do, etc., etc. etc.  Pretty much,  this is written
like a lot of rules that I see every day.  Rules that  show a thought
process gone amok.  So, break it down, think it out,  make it simple, THEN
see what's wrong with the logic.  Actually, what  is "wrong" with the rule
is in the error message itself; apparently  Jess thinks that there is a
call to a Vector in the LHS of the rule  and that index 123 is a bad
index.  Probably is.

On the other hand, even if you fix that part of the rule, it should  still
be taken out and shot for breaking the first three guidelines  mentioned
above.  Anyway, it's almost midnight.  Time for all good  little rule boys
to be in bed.  Preferably with someone else.  :-)

SDG
jco

On Oct 31, 2005, at 8:35 PM, Eunice Palmeira wrote:



I use  Jess 6.1 p4 and JessTab 1.3, when a run big rules like the rule
below the Jess report an error:

Jess reported an error in routine ValueVector.get
   while executing rule LHS (MTELN)
   while executing rule LHS (TECT).
 Message: Bad index 123 in call to get() on this vector:
(MAIN::object (is-a :JESS-DEFTEMPLATE) (is-a-name ":JESS-DEFTEMPLATE")
(OBJECT )
(:NAME "Science_Instance_45") (:DIRECT-TYPE
)
(:DIRECT-INSTANCES ) 

RULE:
(defrule e_201_links
(object (Page-Status ?l&RECOMMENDATION|REJECTED|CLASSIFIED|
EXTRACTED|LIST)
(is-a Processing-Monitor))
   ?s <- (object (is-a Suggestion-Recognizer) (What-to-Suggest
?k&LINK|LINK-TEXT)
  (Class-to-Suggest ?c) (Cases $?cs))
 ?f <- (Result (Page-Status ?))
(not (Processed Links ?k))
   (object (is-a Agent) (treats-Class ?ca) (name ?nsa))
?g <- (object (is-a Case) (Concepts $?cb&:(> (length$ $?cb) 0))
(Keywords $?k) (Absent-Concepts $?ac))
   (test (and
  (integerp (member$ (instance-address ?g) $?cs))
(or (eq ?c ?ca) (subclassp ?c ?ca
 =>
(if (eq ?k LINK) then
(insert-link ?nsa (search-in-list (create$ (words-of-concepts
$?cb) $?k)
(slot-get [LINKS] Values) (slot-get [PAGE]
Links)) ?f ?c 201)
 else (insert-link ?nsa (search-in-list (cr

Re: JESS: Converting from/to strings

2005-10-21 Thread Alan Moore

Henrique Lopes Cardoso wrote:

Hi,

I have two problems.

---> The first:
I have a string which contains an atom. How do I convert it to an atom?
I tried this,which works:
   (bind ?string "henrique")
   (nth$ 1 (explode$ ?string))
Is there a simpler way?


I can't think of any at the moment, maybe someone else has a good 
technique to share.




---> The second:
How do I convert a fact-id into a string?
This does NOT work:
  (bind ?x (assert (this will be a string)))
  (bind ?string (implode$ ?x))
Jess complains about ?x not being a list.


The value of ?x will be the result of the (assert) function, which 
according to the manual here:


http://herzberg.ca.sandia.gov/jess/docs/70/functions.html#assert

Excerpt:

17.19. (assert +)

Arguments:
One or more facts

Returns:
A Fact, or FALSE

-

Facts look like they might be lists but they aren't. In LISP it *would* 
be because *everything* is a list in LISP ;-D


alan



Thank you.

Henrique


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]




Re: JESS: Using multifields in LHS

2005-10-21 Thread Alan Moore

Henrique,

Also, if you are not modifying the multislot values but are simply 
converting strings to multislots so that you can search for value(s) in 
the string, you can use the new Jess 7.0 regex functionality, see:


http://herzberg.ca.sandia.gov/jess/docs/70/rules.html#patterns

Here is an excerpt:

6.2. Basic Patterns

If all the patterns of a rule had to be given literally as above, Jess 
would not be very powerful. However, patterns can also include wildcards 
and various kinds of predicates (comparisons and boolean functions). You 
can specify a variable name instead of a value for a field in any of a 
rule's patterns (but not the pattern's head). A variable matches any 
value in that position within a rule.




Each such variable field in a pattern can also include any number of 
tests to qualify what it will match. Tests follow the variable name and 
are separated from it and from each other by ampersands (&) or pipes 
(|). (The variable name itself is actually optional.) Tests can be:


A literal value (in which case the variable matches only that value); 
for example, the values b and c in (a b c).




A Java regular expression surrounded by "/" characters. The field must 
match the given regular expression (regular expressions are available 
only when you're using Jess under JDK 1.4 and up.) For example, the 
pattern (a /x+y/) matches the facts (a xy), (a xxy), etc.


Good luck!

alan



Dusan Sormaz wrote:

Henrique,

Ernest addressed multislot matching  on this list in 2002. I will 
forward you his e-mail.

But, few points below

At 06:15 AM 10/21/2005, you wrote:


Your comments got me into the following:

(assert (a "nice string"))




"nice string" is not a list, it is still single value slot of type string

(a nice string)

now it becomes multivalue slot (or list). You match this using $?var 
variable (dollar sign signifies multislot).


I did run few rules and asserts to illustrate the point:

(assert (a "nice string"))

(assert (a This is very long sentence of  symbols))

(assert (a Symbol long string "long" sentence of strings "and" symbols))
(defrule r1
   (a ?x)
  =>
   (printout t "r1 fired: " ?x crlf)
)

(defrule find-long
   (a $?head long $?tail)
  =>
   (printout t "find-long fired: head " $?head  ", tail: " $?tail crlf)
)

(defrule find-string-long
   (a $?head "long" $?tail)
  =>
   (printout t "find-string-long fired: head " $?head  ", tail: " $?tail 
crlf)

)

(defrule find-fourth
   (a ?first ?sec ?third ?fourth $?tail)
  =>
   (printout t "find-fourth fired: 4th " ?fourth  ", tail: " $?tail crlf)
)

(run)

and here is the run:

Jess Version 7.0a6 3/23/2005

find-long fired: head (Symbol), tail: (string "long" sentence of strings 
"and" symbols)
find-string-long fired: head (Symbol long string), tail: (sentence of 
strings "and" symbols)

find-fourth fired: 4th long, tail: (sentence of strings "and" symbols)
find-long fired: head (This is very), tail: (sentence of symbols)
find-fourth fired: 4th long, tail: (sentence of symbols)
r1 fired: nice string


Regards,

Dusan Sormaz

*
* Duan 
ormaz, PhD, Associate Professor 

* Ohio University
* Industrial and Manufacturing Systems Engineering Department
* 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
*





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]




Re: JESS: Using multifields in LHS

2005-10-20 Thread Alan Moore

Henrique Lopes Cardoso wrote:

Hi,

I am having trouble in getting to multifields and strings.
I was trying to evaluate the contents of a string in a rule's LHS:

(assert (a "nice string"))


Note: this asserts a single ordered fact with two fields. The first one 
is an ATOM and the second one is a STRING.




(defrule r1
   (a ?x)
   ?s <- (explode$ ?x)
   ?s <- (nice ?what)
  =>
   (printout t ?what crlf)
)


There are a couple if issues with this rule:

1) It doesn't make a whole lot of sense to bind the variable ?s to two 
different facts, even if Jess lets you do this.


2) Calling (explode$) on the LHS isn't allowed, at least not like this. 
As this stands, Jess will be looking for a fact starting with an atom 
value of explode$ followed by a field that matches the value of ?x, as 
bound in the previous pattern. (I could be wrong here...)


3) The third pattern matches a fact starting with nice but you do not 
assert a facts like this so your rule won't fire.


4) The "head" of a pattern cannot be a variable and it looks like you 
are trying to do that in your rule (but I'm not sure how...)


5) It doesn't look like you are doing anything with the exploded ?x 
value. I assume you are trying to explode the string in ?x and then use 
the result to pattern match against another fact. Exploding a value on 
the LHS doesn't result in a "dynamic" pattern.


You might want to explain what you are trying to accomplish and then we 
can help you further. Until then, maybe this will help:


(reset)
(assert (a "nice string"))
(assert (b nice)) ; note: "nice" (in quotes) won't work

(defrule r1
(a ?x)
(b ?y&:(neq FALSE (member$ ?y (explode$ ?x
=>
(printout t "Found!" crlf)
)

(run)

Good luck!

alan


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]




Re: JESS: Using multifields in LHS

2005-10-20 Thread Alan Moore

Or more simply:

(assert (a "nice string"))
(assert (b nice)) ; note: "nice" (in quotes) won't work

(defrule r1
(a ?x)
(b ?y&:(member$ ?y (explode$ ?x)))
=>
(printout t "Found!" crlf)
)

(run)

i.e. a non-zero value from (member$) evaluates in the pattern above like 
a TRUE - or like (neq FALSE ...))


alan


Henrique Lopes Cardoso wrote:

Hi,

I am having trouble in getting to multifields and strings.
I was trying to evaluate the contents of a string in a rule's LHS:

(assert (a "nice string"))

(defrule r1
   (a ?x)
   ?s <- (explode$ ?x)
   ?s <- (nice ?what)
  =>
   (printout t ?what crlf)
)

I know I cannot do this. But I cannot figure out how to do something 
like this...


Thank you.

Henrique


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]




Re: JESS: Blackboard Framework

2005-10-11 Thread Alan Moore

Scott,

Someone else is likely to have a more relevant answer but I thought I'd 
give my 2 cents worth - it's been a while (15 years?!) so I hope I can 
remember this correctly...


During my graduate studies I worked with Dr. Len Myers and others at 
CalPoly SLO on a BB based system that used CLIPS (Jess' predecessor.) In 
that system, there was a distributed set of agents that worked in 
cooperation to advise a CAD system user about their current drawing.


This system worked by having each agent have it's own rulebase and 
working memory. The BB was implemented by special (bbassert) and 
(bbretract) functions that sent the facts to a central server from which 
any registered agent listeners would get a subsequent broadcast message 
with the fact(s).


The listening agents could then do whatever they wanted with the 
knowledge, usually by calling (bbassert) themselves. It was a pretty 
simple distributed blackboard system. You could probably build the 
plumbing for one of these types of systems yourself quite easily.


As I remember it, the tricky part was coordinating/arbitrating the 
agents and keeping them from, in circular fashion, asserting and 
retracting each other's facts. This task was left to a conflict resolver 
agent.


I'm sure there is a lot of theory you could read up on about this topic 
so I won't go into it here. In our system, each agent posted their 
suggestion (e.g. a value for a drawing attribute, etc) to the blackboard 
and the conflict resolver made it's decision and determined the final 
result/value. Each agent would then have to deal with the new reality.


It was fun to work on and I'm sure some CalPoly SLO staff, faculty, or 
students are on this list and could share with you what happened to that 
system or it's derivatives.


Good luck!

alan



Krasnigor, Scott L (N-AST) wrote:
I have been asked by the powers to be to investigate using Jess in 
conjunction with a blackboard framework. I was wondering if anyone out 
there has any experience with this combination and could provide some 
insight or could point me to some good resources/examples on the 
subject. Thanks.


Scott L. Krasnigor
Principal Engineer/Scientist
Atlantic Science & Technology
Lockheed Martin - MS2




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]




Re: JESS: code works from java but not clp file

2005-10-11 Thread Alan Moore

> I wonder if anyone else running Jess with RePast has encountered a
> similar problem.

When people have trouble using Jess with one java library or another, 
such as repast, the problems tend to be generic java problems, e.g. 
missing library on the classpath, methods throwing exceptions 
unexpectedly, etc.


These kinds of exception bubble up to the top level exception handler, 
which will always be Jess if you are instantiating object or calling 
methods from jess script. This doesn't mean Jess has a "problem" with 
the underlying library, Jess is simply the messenger of bad news.


My SWAG is that the repast library or something it depends on is not in 
your classpath or that a static initializer is failing somewhere along 
the way.


Good luck!

alan



Scott Moss wrote:

Hi.

In starting to sort out how to run Jess from Java as you suggested, I 
first ran the test file from Jess command line in a bash shell.  The 
error message was now:


Jess> (batch testing.clp)
(deftemplate MAIN::agent
  "$JAVA-OBJECT$ org.cfpm.markets.User"
  (declare (from-class org.cfpm.markets.User))
  (multislot attribute_demands)
  (slot class)
  (multislot location)
  (slot name)
  (slot OBJECT))
Jess reported an error in routine new
   while executing (new User "harvey")
   while executing (bind ?user-agent (new User "harvey"))
   while executing (batch testing.clp).
 Message: Constructor threw an exception.
 Program text: ( batch testing.clp )  at line 1.

Nested exception is:
uchicago/src/sim/util/Random

So from Eclipse, the nexted exception is reported as null -- I guess it 
isn't picking up the actual error -- while from the command line call it 
reports the class giving rise to the exception -- though not the 
exception itself.  So I dropped the random number generator I was using 
(from RePast) and substituted from the standard Java Random class and 
this solved the problem.


regards
scott

friedman_hill ernest j wrote:


I think Scott Moss wrote:

 


Jess reported an error in routine new
   while executing (new User "harvey")
   while executing (bind ?user-agent (new User "harvey")).
 Message: Constructor threw an exception.
 Program text: ( bind ?user-agent ( new User "harvey" ) )  at line 16.

Nested exception is:
null

   



Run Jess like this:

 java jess.Main -stacktrace myfile.clp

and you'll get a more detailed traceback. You should see the actual
stack trace of the exception the constructor throws. That will surely
give us a clue.

 





-
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]




Re: JESS: code works from java but not clp file

2005-10-11 Thread Alan Moore
Also, in testing.clp, you can place the following code to help you debug 
the exception:


;; untested...ymmv
(try
   (bind ?user-agent (new User "harvey"))
catch
   ;; ?ERROR will be the caught throwable
   (printout t "ERROR = " (?ERROR toString) crlf)
   (printout t "cause = " ((?ERROR getCause) toString) crlf)
   ;; etc...
)

alan


Scott Moss wrote:

Hi.

In starting to sort out how to run Jess from Java as you suggested, I 
first ran the test file from Jess command line in a bash shell.  The 
error message was now:


Jess> (batch testing.clp)
(deftemplate MAIN::agent
  "$JAVA-OBJECT$ org.cfpm.markets.User"
  (declare (from-class org.cfpm.markets.User))
  (multislot attribute_demands)
  (slot class)
  (multislot location)
  (slot name)
  (slot OBJECT))
Jess reported an error in routine new
   while executing (new User "harvey")
   while executing (bind ?user-agent (new User "harvey"))
   while executing (batch testing.clp).
 Message: Constructor threw an exception.
 Program text: ( batch testing.clp )  at line 1.

Nested exception is:
uchicago/src/sim/util/Random

So from Eclipse, the nexted exception is reported as null -- I guess it 
isn't picking up the actual error -- while from the command line call it 
reports the class giving rise to the exception -- though not the 
exception itself.  So I dropped the random number generator I was using 
(from RePast) and substituted from the standard Java Random class and 
this solved the problem.


I wonder if anyone else running Jess with RePast has encountered a 
similar problem.


regards
scott

friedman_hill ernest j wrote:


I think Scott Moss wrote:

 


Jess reported an error in routine new
   while executing (new User "harvey")
   while executing (bind ?user-agent (new User "harvey")).
 Message: Constructor threw an exception.
 Program text: ( bind ?user-agent ( new User "harvey" ) )  at line 16.

Nested exception is:
null

   



Run Jess like this:

 java jess.Main -stacktrace myfile.clp

and you'll get a more detailed traceback. You should see the actual
stack trace of the exception the constructor throws. That will surely
give us a clue.

 





-
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]




Re: JESS: Problems with Jess and Eclipse

2005-10-07 Thread Alan Moore

Matt,

Whoops, sorry - I didn't see your attachment.

alan


[EMAIL PROTECTED] wrote:

In the screenshot, you show that you've defined two "classpath
variables", one named source pointing to the "source" directory, and
one named "jess" pointing to jess.jar. This is no guarantee that
you've *used* those classpath variables for anything. This is like
defining a Windows environment variable named MY_JARS and expecting
them to automatically show up on the CLASSPATH: it won't happen, of
course, unless your CLASSPATH includes %MY_JARS% .

Anyway, what's really relevant is not these global preferences, but the
individual project properties. Right-click on your project and choose
"Properties." Click "Java Build Path". On the Source tab, you want to
have any source folders in your project. This would be a place you
could use your "source" variable, although this would actually be
somewhat unconventional. Eclipse should automatically put entries for
the actual source folders in your project, so your project may not be
set up properly as a Java project in the first place.



I think Matthew Hutchinson wrote:
[Charset iso-8859-1 unsupported, filtering to ASCII...]


G'day everyone,

First of all I'd like to say I'm starting to get into the programming aspect
of my PhD and its really interesting to learn JESS; great product and great
support.
Having set up eclipse with the jess plugin, I was dissapointed to find
something was not working. I've set my windows classpath to match where my
code is, and even set the project class path (in eclipse) to the same
directory. For some reason it just keeps telling me that it can't find the
"Address" class... which is quite obviously there.

Perhaps I've just missed something obvious?

Thanks,
Matt






-
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]




Re: JESS: Problems with Jess and Eclipse

2005-10-07 Thread Alan Moore

Matt,

Setting the windows classpath environment variable shouldn't be 
necessary or may not even work at all since eclipse is likely to use 
classloaders that are limited to those directories/jars specified in the 
project configuration. I'm not an eclipse expert but you might want to 
ping the eclipse mailing list/faq for answers if the following doesn't help.


You didn't mention which bit of software couldn't find your Address 
class. I'm guessing that Jess is parsing or executing some code and 
didn't find the class (e.g. is this an eclipse or Jess error message?) 
Could you please send us a copy of the error message?


Also, be sure you have told Jess about your class. Did you do an 
(import) and/or (defclass) in the file exhibiting the problem?


alan


Matthew Hutchinson wrote:

G'day everyone,

First of all I'd like to say I'm starting to get into the programming 
aspect of my PhD and its really interesting to learn JESS; great product 
and great support.
Having set up eclipse with the jess plugin, I was dissapointed to find 
something was not working. I've set my windows classpath to match where 
my code is, and even set the project class path (in eclipse) to the same 
directory. For some reason it just keeps telling me that it can't find 
the "Address" class... which is quite obviously there.


Perhaps I've just missed something obvious?

Thanks,
Matt



--
Matthew Hutchinson
Ph.D. Candidate
Department of Spatial Sciences
Curtin University of Technology
GPO Box U1987
Perth, Western Australia 6845



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]




Re: JESS: Firing on subsets (again)

2005-10-05 Thread Alan Moore

Jerome,

You can match against ordered facts like so:

(defrule myRule
   (first second ? fourth fifth ? seventh)
=>
   (printout t "Rule fired")
)

What this does is to match any of the following facts:

(assert (first second dontcare fourth fifth dontcare seventh))
(assert (first second anything fourth fifth here seventh))
(assert (first second x fourth fifth y seventh))
(assert (first second nil fourth fifth nil seventh))

The question marks in the rule above will make the rule pattern match 
facts with the specified values (e.g. first, second, etc.) at the 
positions indicated and with *any* value at ordinal position 3 and 6". 
In this case the question marks are unnamed variables that get bound to 
whatever is at those positions in the matching fact(s).


You could bind named variables like so:

(defrule myRule
   (first second ?position3 fourth fifth ?position6 seventh)
=>
   (printout t "Rule fired - values at position 3 and 6 are " 
?position3 ", " ?position6)

)

I would suggest that you try a simplified version of your rule cut down 
to just one or two fields and experiment with how the pattern matching 
works.



(defrule run-service
   ?inputservice <- (inputservice ?service ?project
?org ?analystname ?analystrole ?priority ?reldatetime
?location)
   ?newserv <- (webservice (service ?service) (project
?project) (org ?org) (analystname ?analystname)
(analystrole ?analystrole) (priority ?priority)
(reldatetime ?reldatetime) (location ?location)
(action run) )
=>
  (store RETURN "run")
  (printout t "JESS: Found an existing service = "
?service crlf)
  (printout t "JESS: The user-specified action is to
run the service! " crlf)
  (retract ?inputservice))


If this rule isn't firing for you and you think it should, try removing 
some of the slot matches in the second pattern. Maybe one or more of the 
 slot values aren't *exactly* the same in both facts and so are 
preventing them from matching. Start with only one or two slots and keep 
adding them back until the rule stops firing. For example,


(defrule run-service
   ?inputservice <- (inputservice ?service ?project ?org ?analystname 
?analystrole ?priority ?reldatetime ?location)

   ?newserv <- (webservice (service ?service) (action run) )
=>
  (store RETURN "run")
  (printout t "JESS: Found an existing service = " ?service crlf)
  (printout t "JESS: The user-specified action is to run the service! " 
crlf)

  (retract ?inputservice)
)

Good luck!

alan


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]




Re: JESS: Matching a static variable

2005-10-03 Thread Alan Moore

First, let me mention that I'm happy to see someone using the
brand-new "static imports" feature -- the thing that lets you use
(CarClass.MINI) as a constant.


[alan]
Nice, this makes things a *lot* cleaner. Thanks!


Third, let me mention, as I often do on this list (I really need to
make this point more strongly in the manual) that direct matching
should always be preferred to function calls, and anything else should
be preferred to the "test" CE; this is not only a style issue but a
performance issue.


[alan]
I'm probably missing something here but isn't this the kind of thing the 
Jess parser could (eventually) optimize out? Given a test CE with only 
one variable it seems like Jess could automatically move the conditional 
up into the pattern the variable is bound in.


Of course, this would complicate ppdefrule, etc when displaying the rule 
from the optimized form.



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]




Re: JESS: Matrixes in Jess

2005-09-30 Thread Alan Moore

Yuri,

You can use any/all facilities that Java has for matrices since Jess has 
full (reflective) access to the Java/third-party matrix APIs - see:


http://math.nist.gov/javanumerics/jama

If you want to pattern match against elements in a matrix, you can use 
multifields or ordered facts. For example:


(assert (row 1 col1 col2 col3))
(assert (row 2 col1 col2 col3))
(assert (row 3 col1 col2 col3))

(defrule find-matrix-with-all-matching-diagonal-values
   (row 1 ?colValue ? ?)
   (row 2 ? ?colValue ?)
   (row 3 ? ? ?colValue)
=>
   (printout t "Matrix has all diagonal values of " ?colValue)
)

(defrule find-identity-matrix
   (row 1 1 0 0)
   (row 2 0 1 0)
   (row 3 0 0 1)
=>
   (printout t "Matrix is the identity matrix")
)

Warning: the above is an over simplified example and could cause *huge* 
numbers of partial matches if given the wrong/large input and doesn't 
take into account reasoning over multiple matrix instances.


Of course, it gets more complicated if you need to write rules against 
matrices of arbitrary/unknown dimensions.


Good luck!

alan




Yura wrote:

Hi All
 
Does anyone know how to implement matrixes in Jess?
 
Yuri



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]




Re: JESS: firing on sub sets

2005-09-28 Thread Alan Moore

Jerome,

I'm a little confused as to why your example below would work for either 
set of facts.


First of all, your "rule" isn't a rule at all - it is a fact.

(MAIN::webservice
   (service getaddress)
   (project sage)
   (org georgetown)
   (analystname blake)
   (analystrole lead)
   (priority low)
   (reldatetime within_an_hour)
   (location dc)
   (action run)
)

You must have a rule you aren't showing.

Also, in your example, you listed both ordered and unordered facts. The 
fact above is an ordered fact and will only match a rule like this:


(defrule run-service-unordered
   (webservice
  (service ?serviceName)
  (project ?projectName)
  ;; more slots could be placed here
   )
=>
   (printout t "run-service-unordered rule fired")
)

This will fire for all facts with (service) slot values and any 
(project) slot values. If you wanted to restrict the matching facts to 
particular values, just specify the values instead of the variables, 
like so:


(defrule run-service-unordered
   (webservice
  (service inputservice)
  (project sage)
  ;; more slots could be placed here
   )
=>
   (printout t "run-service-unordered rule fired")
)

This rule will only fire for unordered facts with (service inputservice) 
and (project sage) values.


The other facts you list below would only match a rule like this:

(defrule run-service-ordered
   (inputservice getaddress sage georgetown blake lead low 
within_an_hour dc))

=>
   (printout t "run-service-ordered rule fired")
)

Also, w.r.t. nil (unknown) values in ordered templates, you can simply 
specify an unnamed variable to hold the place in the pattern, like so:


(defrule run-service-ordered
   (inputservice getaddress sage ? ? lead low within_an_hour dc))
=>
   (printout t "run-service-ordered rule fired")
)

The two question marks are unnamed variables that are bound to the 
values at those positions (4 and 5) in the fact.


I suggest that you stick to unordered facts w/ slot names - it prevents 
errors caused by accidentally leaving out a position/variable. You might 
also want to explicitly define your unordered facts using (deftemplate).


Please review the following part of the users manual for more information:

http://herzberg.ca.sandia.gov/jess/docs/70/rules.html

Good luck!

alan



Jerome Butchergreen wrote:

hey guys,
i racked my head on this for a while then we decided
just to have the engine fire on specific examples for
the demo.

so ive been working on another project and now im back
to this one and i fear that my time off will make it
impossible for me to figure this out alone so please
help!

we want this rule (already stored):
(MAIN::webservice (service getaddress) (project sage)
(org georgetown) (analystname blake) (analystrole
lead) (priority low) (reldatetime within_an_hour)
(location dc) (action run))

to fire with both of these assertions (now it only
fires for the first):
(assert (inputservice getaddress sage georgetown blake
lead low within_an_hour dc))
and
(assert (inputservice getaddress sage nil nil lead low
nil dc))

where nil is simply unspecified in the request

...even though we arent goin to implement any
functionatity in this way id also know if its possible
to have it fire if instead of nil's there were other
random values ...that for one reason or another dont
matter in this case (i realize that i can simply
replace those with nil ...but i wonder none the less)

thanks a bunch
-Jerome BG



__ 
Yahoo! Mail - PC Magazine Editors' Choice 2005 
http://mail.yahoo.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]





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]




Re: JESS: Module Question

2005-09-14 Thread Alan Moore

Scott,

My advice is to make your Regions explicit instead of using modules for 
this purpose.


You could create a Region class (in Java), create instances of these 
objects and definstance them as needed. Your rules could then pattern 
match against these Region objects.


This is essentially making explicit something that would happen 
implicitly via modules, with the added advantage of being able to 
define/control all the behavior related to the Regions w/o relying on 
Jess' rule firing mechanisms.


I did a similar thing with state machines. Initially, I wanted to use 
modules because they were there but other pieces of Java code needed to 
have access to the current state, etc. and I found having these defined 
as Java objects made that integration easier. Your mileage may vary 
depending on how Java centric your application is.


Of course you could use deftemplates instead of POJOs because the 
explicit vs. implicit design still applies.


Good luck!

alan


Krasnigor, Scott L (N-AST) wrote:

Hi all,

Quick question. I have a set of rules that I use as a template. I plan 
on having a user be able to define a region in space. Based on the 
values entered, the app will modify the set of rules in the template and 
save it as a new set of rules based on the region defined and then load 
those rules into a running engine thread. There can be multiple sets of 
regions defined and associated rules applied. Once a fact is asserted, 
the rules determine if the data associated with the fact are in a 
defined region. I need to be able to distinguish between the different 
rule sets (regions) in an engine. I was thinking of creating modules 
based on the different regions. Is this the most efficient way to do 
this? How would I make sure that once a fact is asserted (or modified), 
it gets evaluated for all the regions (modules) defined? Thanks.


Scott

Scott L. Krasnigor
Principal Engineer/Scientist
Atlantic Science & Technology
Lockheed Martin - MS2
' 856-359-3094
*_ [EMAIL PROTECTED]
* 770-2




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]




Re: JESS: Changing the value of Defglobal variables

2005-08-30 Thread Alan Moore

Richard, Kevin R. wrote:
I'm planning on using a defglobal variable to reflect the state of a 
checkbox in the UI for my application.  The value of this variable, 
therefore will be set and modified in Java.  Looking at the Jess API, I 
don't see any means of changing the value of a Defglobal object once it 
has been set.  The value of this variable will influence many of the 
rules that I'll be running.


You do not want to use a defglobal for this. You have several options, 
including:


a) Make your object a standard Java Bean(1), call definstance() on your 
Rete object passing it the bean instance(s), and have your Swing/Java 
code update the bean to reflect the state of your UI.


Your rules can then directly pattern match against the bean's 
properties. When those properties change (via PropertyChangeEvents), the 
Rete object will automagically evaluate your rules to reflect the new 
state of your UI.


b) Create your UI objects using Java and/or Jess code and then implement 
the Swing/AWT callback methods directly using Jess deffunctions to trap 
UI based events. In these deffunction handlers, you can update the Rete 
with facts or other objects as needed. Again, your rules can react the 
the changes made by the deffunctions.


To do this easily see the recently added (implement) function ;-D

In either of these cases, you will need to consider which thread your 
rules will be firing on. IMHO, you should have a dedicated thread call 
Rete#runUntilHalt() so that all you rule firings will be done on a 
single thread and your UI/handler code won't be stuck spending time 
firing rules instead of responding to the user.


There are a number of other usage patterns you could consider but these 
are fairly typical and well documented in the manual and elsewhere.



alan

(1) Primarily, implement getters/setters + PropertyChangeEvents. See the 
Jess manual and the book Jess In Action for more details and potential 
hazards.



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]




Re: JESS: Announcing the Jess Wiki

2005-08-30 Thread Alan Moore

Jason,

Nice! See you there...

alan


Jason Morris wrote:

Hello All Jess Users,

I am pleased to announce the launch of the Jess Wiki

http://herzberg.ca.sandia.gov/jesswiki/view

The Jess Wiki is a repository for a new Community of Practice centered
on the existing Jess User community.  One of its main purposes is to
archive the best practices, tips, techniques, and methodologies
employed by Jess users.

The Jess Wiki is open to the whole Jess community, though I am asking
folks with significant Jess experience to help drive this process
forward.  Whatever your Jess skill or experience level, your
participation is the key to the success of this project.

For exceptional contributors, an incentive program is being planned --
details to be announced later.  Meanwhile, feel free to browse the
existing framework, add content to existing pages, or add entirely new
pages.

Your support, feedback, and of course wiki content are always welcome!
Cheers,

Jason Morris
Co-Moderator Jess Listserver/Wiki 


-
Morris Technical Solutions LLC
www.morristechnicalsolutions.com
[EMAIL PROTECTED]
phone/fax: 503.692.1088



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]




Re: JESS: JessDE Feature Request

2005-08-30 Thread Alan Moore

[EMAIL PROTECTED] wrote:


Sorry for the delay -- I've been on vacation for a week.


No worries - hope you had a good time!


Your color-coding ideas are interesting but I think it's probably
better to do things according to precedent.  Wouldn't the "Eclipse
way" be to have you Alt-click on a variable name and be sent to the
definition? So you'd Alt-click on a variable and the cursor would move
to the place where it was first bound.


Agreed, although it might also be helpful to see all the places where a 
variable is used with the binding usage being distinguished in some way 
from the rest.


The thinking here is that if you meant to pattern match against a 
previously bound variable but fat-fingered the variable name in the 
second pattern, you would see that it failed to be highlighted (or 
whatever.)


I've just recently picked up Eclipse again after a long detour via 
NetBeans and IntelliJ but have not yet re-mastered all the "Eclipsisms". 
I have to say it has been much improved in the intervening time - 
especially with the help of JessDE ;-D


alan


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: JessDE Feature Request

2005-08-22 Thread Alan Moore

Ernest,

I've been using JessDE recently and found myself spending a considerable 
amount of time checking to make sure my variables were bound and used in 
the right places in the patterns. It seems to me that having a simple 
way to verify/highlight the bindings visually would help in this regard.


One possibility would be to add a meta-key that would toggle the font 
color of each variable and bolding the location where they are first 
bound - similar to paren highlighting. This could also be done to track 
variable binding/usage on the RHS as well.


Alternatively, the meta-key could cycle through each variable, a 
different variable each time you press it, to change the font color of 
it's binding+bold and usages in a fixed color.


Thoughts, comments?

alan


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]




RE: JESS: Jess agenda function

2004-05-03 Thread Alan Moore
Title: RE: JESS: Jess agenda function





inline...


> -Original Message-
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED]] On Behalf Of Michael Knapik
> Sent: Monday, May 03, 2004 11:19 AM
> To: [EMAIL PROTECTED]
> Subject: JESS: Jess agenda function
> 
> 
> I have a set of 5 rules defined
> 
> I place the agenda function call as follows:
> 
> (agenda)
> Rule 1 (
> )
> Rule 2 (
> )
> Rule 3(
> )
> Rule 4 (
> )
> Rule 5 (
> )


[alan]
Not sure about the above syntax, must be psudo code.


> 
> Result is a list of 0 activations!!
> 
> When I place it inside the Rule 1 defiinition (RHS) the 
> result is the set of Rule 2-5 activations but not Rule 1 
> activation. When I place it inside the Rule 2 defiinition 
> (RHS) the result is the set of Rule 3-5 activations but not 
> Rule 1/2 activations and so forth. When it is placed on any 
> LHS, the rule does not fire and no agenda is produced.


[alan]
Try placing a (printout t "Rule xxx activated") in every rule and move the (agenda) function around on the RHS and see if the behavior makes sense.

Also, placing it on the LHS is incorrect - it says, "Match a fact with the symbol 'agenda'". Jess thinks it is a pattern, not a function to be called.

From the manual:



The LHS of a rule (the "if" part) consists of patterns that match facts, NOT function calls. The actions of a rule (the "then" clause) are made up of function calls. The following rule does NOT work: 

   
Jess> (defrule wrong-rule
  (eq 1 1)
  =>
  (printout t "Just as I thought,  1 == 1!" crlf))


This rule will NOT fire just because the function call (eq 1 1) would evaluate to true. Instead, Jess will try to find a fact on the knowledge base that looks like (eq 1 1). Unless you have previously asserted such a fact, this rule will NOT be activated and will not fire. If you want to fire a rule based on the evaluation of a function, you can use the test CE. 




There is a specific syntax to allow function calls on the LHS. See:


http://herzberg.ca.sandia.gov/jess/docs/61/language.html#patterns


for more details.


alan



> 
> So when does the agenda have all 5 rules in it such that it 
> can be managed accordingly?
> 
> 
> 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: Re: Jess agenda function

2004-05-03 Thread Alan Moore
If you want to "manage" the agenda (conflict resolution) I think you will need to 
implement:

http://herzberg.ca.sandia.gov/jess/docs/61/api/jess/Strategy.html

Otherwise, you can change the default strategy with:

(set-strategy)

Does this answer your question or am I missing the point?

alan

- Original Message - 
From: "Michael Knapik" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, May 03, 2004 11:18 AM
Subject: JESS: Jess agenda function


I have a set of 5 rules defined

I place the agenda function call as follows:

(agenda)
Rule 1 (
)
Rule 2 (
)
Rule 3(
)
Rule 4 (
)
Rule 5 (
)

Result is a list of 0 activations!!

When I place it inside the Rule 1 defiinition (RHS) the result is the set of
Rule 2-5 activations but not Rule 1 activation.
When I place it inside the Rule 2 defiinition (RHS) the result is the set of
Rule 3-5 activations but not Rule 1/2 activations
and so forth.
When it is placed on any LHS, the rule does not fire and no agenda is
produced.

So when does the agenda have all 5 rules in it such that it can be managed
accordingly?


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]




RE: JESS: Re: 'mirroring' one jess process with another

2004-04-27 Thread Alan Moore
Title: RE: JESS: Re: 'mirroring' one jess process with another





Take a look at the jess event mechanism. You could use this to activate your duplication code. I don't know if all the information you would need is available via the supplied event object(s) - TBD.

Good luck!


alan



-Original Message-
From: [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: 4/27/2004 6:43 AM
Subject: JESS: Re: 'mirroring' one jess process with another


This sounds like you are trying to create a "fail-over" system. Why
don't
you just update the objects in the second system (from the first) and
only
fire the rules when the second system is activated ?


- Original Message - 
From: "amy" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, April 27, 2004 6:00 AM
Subject: JESS: 'mirroring' one jess process with another



>
> I have kind of a strange question; hope it makes sense.
>
> I would like to 'mirror' one Jess process with another by populating
> the second process-- perhaps progressively-- with information from the
> first.  Then, I'd like to be able to stop the first process, tell the
> second one to run, and have it pick up where the first
> left off.
>
> Suppose I do NOT want to use bsave/bload for this.
> That is, I'd like an approach where I can effectively load
'declarative'
> information only, such as the rule and fact base (not the serialized
> runtime state) to create this 'mirror'.
>
> In general, it does not seem like this will work very well.  Without
> maintaining the Rete net's refraction information from the first
> process, rules will fire 'again' in the 'mirror' process once its run
> cycle starts.
> (Of course it can be possible to alleviate some refiring issues by
being
> careful with the rule & fact representation, but that gets tricky in
> general and I don't want to assume it).
>
> Perhaps one way to approach this is to configure the mirror process
> to run in a 'non-action' mode during the mirroring process -- that is,
> to
> 'fire' triggered rules WITHOUT executing their actions, as new facts
> are added to its fact base during mirroring, so as to keep its
> refraction information up to date.
> Does this seem like a feasible approach?
> Would it be a relatively straightforward modification to the
> Jess code on my part to support something like this?
>
> Alternatively, does anyone have any other suggestions for how to
> accomplish this kind of thing? (aside from "just use bsave" :).
>
>    thanks,
>    Amy
>
> 
> 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: Updated 7.0 trial?

2004-04-21 Thread Alan Moore
Title: Updated 7.0 trial?





I finally had time to test out some new features in 7.0 but discovered that the download I saved has expired. Also, 7.0 no longer appears to be available for download.

Is there going to be another preview release in the near future?


Thanks in advance.


alan