Re: JESS: JessML and non-ruleset statements/funcalls

2005-09-08 Thread Alan Moore

[EMAIL PROTECTED] wrote:
Also, section 16.3 of the manual indicates that defqueries are not 
supported - is that referring to the alpha or will the final release of 
JessML not include defquery?



Well, let's talk about this. What I was thinking was that JessML is a
rule exchange mechanism -- a standard way to exchange rules between
Jess and other rule languages or rule engines. I definitely don't
intend for anyone to actually program in JessML, nor did I think of it
as a way to represent entire Jess programs, either for export or
internal use.

>

If JessML included queries, then into what other languages could those
queries be effectively translated? Similarly, procedural code outside
of rules can't be represented in most rule languages, so there was
little point in supporting that.

I guess I don't want JessML to support more than it needs to, unless
there are some good reasons why it should. But I'm listening!


My immediate interest in JessML is as a target for Jess code generation 
by a tool. Other alternatives include generating Jess syntax or 
composing Jess constructs/statements directly via the Jess API.


In the more general case, a tool could use JessML (or something like it) 
as *input*, e.g. Jess unit test generator, and having an XML 
representation of a complete Jess program would be very convenient.


The XMLPrinter could be expanded to output/generate these other XML 
artifacts in a separate file/stream/etc if that would help decouple the 
stardardization aspects of JessML.


alan




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




JESS: JessML and non-ruleset statements/funcalls

2005-09-08 Thread Alan Moore

Ernest,

I was using XMLPrinter to write out some existing Jess code and found 
that some statements/funcalls were not being output. The output 
contained the rules from the input file but lacked top level statements 
(e.g. (assert), (reset), (do-backward-chaining), etc.)


Are these items going to be supported in the final release?

Also, section 16.3 of the manual indicates that defqueries are not 
supported - is that referring to the alpha or will the final release of 
JessML not include defquery?


Thanks in advance.

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: How to stop firing rules??

2005-07-27 Thread Alan Moore
Filix,

I'm really surprised (halt) doesn't stop the engine - are you sure your thread 
doesn't call Rete#runUntilHalt() again or another thread is calling 
runUntilHalt() also, or something like that?

One way to do what you want is to create a list of Facts/Strings/Objects you 
want to assert "all at once" (between rule firings) and then pass this list, or 
an iterator over it, into the Rete instance so that your rules can pattern 
match against it.

Then, one of your rules, running on the thread that called Rete#runUntilHalt() 
will fire and on the RHS run a loop to assert/definstance your required list of 
facts/strings/objects, etc.

Generally, like this:

ThreadA.java:

Rete rete = ;
rete.runUtilHalt();

ThreadB.java:

List transaction = new LinkedList();
transaction.add( obj1 );
transaction.add( obj2 );
... etc.

Rete rete = getReteInstance(); // whatever...
rete.definstance("Iterator", transaction.iterator(), false);

In myRules.jess:

(defrule transactionalDefinstance
   ?f1 <- (Iterator (OBJECT ?iterator))
=>
   (while (?iterator hasNext)
  (bind ?obj (?iterator next))
  (definstance "ObjectTypeName" ?obj static) ;; whatever...
   )
   (retract ?f1) ;; done with the transaction
)

Disclaimer: the code above is not complete or tested.

Since the rule will run on ThreadA no other rules will fire while this rule is 
asserting/definstancing the objects.

Obviously, you will want to make this more specific to your application but I 
think you understand the general pattern.

Hope this helps...

alan

> -Original Message-
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] On Behalf Of Filix Gsmez Cordero
> Sent: Wednesday, July 27, 2005 1:04 PM
> To: jess-users@sandia.gov
> Subject: Re: JESS: How to stop firing rules??
> 
> 
> Hi Alan,
> 
> I'm sorry, when I've read my mail againg I've realize that it 
> was confused. I will try to explain my problem clearer. I'm 
> using  runUntilHalt function on my one thread program. I stop 
> the engine calling halt from a rule with an established 
> salience of -100. This rule is fired when there is no one 
> else left. As I said in my last mail, I have to assert facts 
> by groups and these groups of facts have dependences between 
> them therefore I can't allow the engine to fire rules while 
> I'm asserting those facts. If I assert all those facts in 
> once, instead of  whaching some facts status and make the 
> assertions by steps there is no problem. But when I run the 
> engine to check some fact's status (I'm forced to do this) 
> and I keep asseting, then I get errors because there are some 
> facts with miss references due to they have to wait for the 
> rest of  facts assertion.
> 
> I had thought about adding one constraint at the begining 
> of each rule, something like you said. That could prevent 
> them from being fired while I'm asserting more facts. That 
> would work but I would like to fix the problem using a 
> different solution, if that is possible and not too much 
> annoying for you, of course .Or at least I'd like knowing 
> what I was doing wrongly and why I can not stop the engine 
> totally once I've run it the first time. Thanks a million for 
> your help,
> 
> Filix.
> 
> 
> 
> 
> - Original Message - 
> From: "Alan Moore" <[EMAIL PROTECTED]>
> To: 
> Sent: Tuesday, July 26, 2005 11:52 PM
> Subject: RE: JESS: How to stop firing rules??
> 
> 
> > Felix,
> >
> > You have not given us much information about your problem 
> so we will 
> > need more detailed information before we can help you.
> >
> > In general:
> >
> > 1) If you have one thread that has called the Rete#runUntilHalt() 
> > method, calling the halt() method (on another thread), or 
> having one 
> > of your Jess rules/functions call the (halt) function, will 
> cause the 
> > first thread to exit the #runUntilHalt() method.
> >
> > 2) Since the Rete class and it's methods are thread-safe, you don't 
> > need to halt the firing of Jess rules while you are 
> asserting facts. 
> > If you are getting unexpected results, your rules might need to be 
> > rewritten to protect themselves against firing when only 
> some of your 
> > facts have been asserted.
> >
> > 3) Many people use Jess without calling the Rete#runUntilHalt() 
> > method. If this applies to you, just assert your facts, call 
> > Rete#run(), get your results as needed, assert more facts, call 
> > Rete#run(), etc. etc.
> >
> > 4) Use the (watch) function to help debug your rules.
> >
> > Please send more information about 

RE: JESS: How to stop firing rules??

2005-07-26 Thread Alan Moore
Felix,

You have not given us much information about your problem so we will need more 
detailed information before we can help you.

In general:

1) If you have one thread that has called the Rete#runUntilHalt() method, 
calling the halt() method (on another thread), or having one of your Jess 
rules/functions call the (halt) function, will cause the first thread to exit 
the #runUntilHalt() method.

2) Since the Rete class and it's methods are thread-safe, you don't need to 
halt the firing of Jess rules while you are asserting facts. If you are getting 
unexpected results, your rules might need to be rewritten to protect themselves 
against firing when only some of your facts have been asserted.

3) Many people use Jess without calling the Rete#runUntilHalt() method. If this 
applies to you, just assert your facts, call Rete#run(), get your results as 
needed, assert more facts, call Rete#run(), etc. etc.

4) Use the (watch) function to help debug your rules.

Please send more information about your specific problem and we will try to 
help.

alan


-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Filix Gsmez 
Cordero
Sent: Tuesday, July 26, 2005 2:18 PM
To: jess-users@sandia.gov
Subject: JESS: How to stop firing rules??


Hello everybody and thanks in advanced,

I've got the next problem, once I've run the engine to check some facts status 
I would need to add more facts and they are dependents between them so there 
are some functions which have miss references because of all the necessaries 
facts to make it works properly are not still asserted. My query is, how can I 
stop runing the engine in order to assert a group of facts?? I've tryed to use 
halt() on the engine in many diferents ways but no one works... Any idea?? 
Thanks,


Filix.



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: Remove all references pointing to the retracted fact from the slots

2005-06-29 Thread Alan Moore
Try this:

(deftemplate Person
   (slot Name (type STRING))
   (multislot Ancestors)
)

(assert
 (Person (Name "a")
(Ancestors (assert (Person (Name "b")))
 (assert (Person (Name "c")))
)
 )
)

(defrule removePersonReferences
   (remove-person ?name)
   ?person <- (Person (Name ?name))
   ?decendent <- (Person (Ancestors $?pre ?person $?post))
=>
   (modify
  ?decendent (Ancestors (create$ ?pre ?post))
   )
)

(defrule removePerson
   ?trigger <- (remove-person ?name)
   ?person <- (Person (Name ?name))
   (not (Person (Ancestors $?pre ?person $?post)))
=>
   (retract ?person)
   (retract ?trigger)
)


Output from run:

Jess> (watch all)
TRUE
Jess> (batch "..\\test2.jess")
 ==> f-0 (MAIN::Person (Name "b") (Ancestors ))
 ==> f-1 (MAIN::Person (Name "c") (Ancestors ))
 ==> f-2 (MAIN::Person (Name "a") (Ancestors  ))
MAIN::removePersonReferences: +1+1+1+1+2+1+2+t
MAIN::removePerson: =1=1=1=1=2=1+2+t
TRUE
Jess> (assert (remove-person "c"))
 ==> f-3 (MAIN::remove-person "c")
==> Activation: MAIN::removePersonReferences :  f-3, f-1, f-2

Jess> (run)
FIRE 1 MAIN::removePersonReferences f-3, f-1, f-2
==> Activation: MAIN::removePerson :  f-3, f-1,
 <=> f-2 (MAIN::Person (Name "a") (Ancestors ))
FIRE 2 MAIN::removePerson f-3, f-1,
 <== f-1 (MAIN::Person (Name "c") (Ancestors ))
 <== f-3 (MAIN::remove-person "c")
2
Jess> (facts)
f-0   (MAIN::Person (Name "b") (Ancestors ))
f-2   (MAIN::Person (Name "a") (Ancestors ))
For a total of 2 facts.
Jess> 

You will have to arrange to have one of your rules assert the
(remove-person) fact.

Also, you could use a defquery to find all related (Person) facts that
reference to-be-removed person fact and then modify each of the returned
facts and their Ancestor multifields.

Good luck!

alan

> -Original Message-
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] On Behalf Of portalguy
> Sent: Wednesday, June 29, 2005 10:01 AM
> To: jess-users@sandia.gov
> Subject: JESS: Remove all references pointing to the 
> retracted fact from the slots
> 
> 
> Hi,
> I'm trying to find the quickest way to setting references in 
> slots to a retracted fact to nil or remove them if in a 
> multislot. For instance if I have the following template:
> 
> (deftemplate Person
> (slot Name (type STRING))
> (multislot Ancestors)
> )
> 
> and the following facts:
> 
> (assert
>  (Person (Name "a")
>   (Ancestors (assert (Person (Name "b")))
>(assert (Person (Name "c")))
>   )
>  )
> )
> 
> f-0   (MAIN::initial-fact)
> f-1   (MAIN::Person (Name "b") (Ancestors ))
> f-2   (MAIN::Person (Name "c") (Ancestors ))
> f-3   (MAIN::Person (Name "a") (Ancestors  ))
> For a total of 4 facts in module MAIN.
> 
> Now if I remove say fact 1 I need to remove it from ancestors 
> in fact 3 but if I only do (retract 1) I end up with the 
> following and as you can see fact 3 still hold reference to 
> none existing fact 1:
> f-0   (MAIN::initial-fact)
> f-2   (MAIN::Person (Name "c") (Ancestors ))
> f-3   (MAIN::Person (Name "a") (Ancestors  ))
> For a total of 3 facts in module MAIN.
> 
> The question is what is the quickest way to clean up the 
> reference issue, other than going through every slot and 
> verifying that it is not pointing to a none existing fact.
> 
> Thanks
> 
> 
> 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: Problem when modify facts when the facts is from a java object.

2005-06-06 Thread Alan Moore
Why didn't this happen in your test? Well, this leads us to another problem 
which is:
 
[alan]
Sorry, this sentence should have been deleted - as Ernest pointed out, your 
object is not firing PropertyChangeEvents.
 
<>

RE: JESS: Problem when modify facts when the facts is from a java object.

2005-06-06 Thread Alan Moore
Warning: HTML/RTF email - sorry for the broken mailer. I *promise* to get this 
fixed ASAP.
 
There are several problems with your logic here:
 
1) Your rule should have triggered an endless loop of firing default-rule 
because the RHS modifies a fact matched on the LHS. See the Jess docs for the 
(declare (no-loop TRUE)) construct for how to prevent this.
 
Why didn't this happen in your test? Well, this leads us to another problem 
which is:
 
2) Your (modify) statement doesn't modify the value bound to the ?name variable 
so (printout) shows the original pattern matched value, not the modified 
object's name property.

3) Your use of ?factId <- (TestModify) and (modify ?factId) should be replaced 
with the logic as shown below:
 
(defrule default-rule 
"Testing rule for modify java object." 
(TestModify (name ?name) (OBJECT ?obj)) 
=> 
(?obj setName "Modified")
(printout t ?name crlf) 
)

You will need to rethink your test case to avoid the endless loop.
 
An example (not actually tested w/ Jess) you might try is this:

(reset)
(watch all)

(defclass TestModify test.TestModify dynamic)
(defrule default-rule
   (declare (no-loop TRUE))
   (TestModify (name ?name) (OBJECT ?obj))
=>
   (printout t "TestModify object updated.")
   (printout t "?name variable = " ?name))
   (printout t "getName = " (?obj getName))
   (?obj setName "Modified") ;; note: no-loop prevents this from triggering 
another default-rule activation
   (printout t "?name variable = " ?name))
   (printout t "getName = " (?obj getName))
)

(bind ?obj (new test.TestModify))
(?obj setName "Hello")
(definstance TestModify ?obj)
(run)
(?obj setName "World")
(run)

I think what you really need to do is to create a more meaningful test case. I 
hope this helps you.

Good luck!
 
alan
__
Bleib immer locker



From: [EMAIL PROTECTED] on behalf of [EMAIL PROTECTED]
Sent: Mon 6/6/2005 10:49 AM
To: jess-users@sandia.gov
Subject: JESS: Problem when modify facts when the facts is from a java object.



Dear All 

I have created a java object 

/* 
 * Created on Jun 7, 2005 
 * 
 * To change the template for this generated file go to 
 * Window>Preferences>Java>Code Generation>Code and Comments 
 */ 
package test; 

import java.beans.PropertyChangeListener; 
import java.beans.PropertyChangeSupport; 

/** 
 * @author Samuel Tsang 
 * 
 * To change the template for this generated type comment go to 
 * Window>Preferences>Java>Code Generation>Code and Comments 
 */ 
public class TestModify { 

private String name; 

protected PropertyChangeSupport m_pcs = new PropertyChangeSupport(this); 

public void addPropertyChangeListener(PropertyChangeListener p) { 
m_pcs.addPropertyChangeListener(p); 
} 

public void removePropertyChangeListener(PropertyChangeListener p) { 
m_pcs.removePropertyChangeListener(p); 
} 

/** 
 * @return Returns the name. 
 */ 
public String getName() { 
return name; 
} 
/** 
 * @param name The name to set. 
 */ 
public void setName(String name) { 
this.name = name; 
} 
} 

And a jess code 

(reset) 

(watch all) 
(defclass TestModify test.TestModify dynamic) 

(bind ?obj (new test.TestModify)) 
(call ?obj setName "Hello") 
(definstance TestModify ?obj) 

(facts) 

(defrule default-rule 
"Testing rule for modify java object." 
?factId <- (TestModify (name ?name)) 
=> 
(modify ?factId (name "Modified")) 
(printout t ?name crlf) 
) 

(run) 

(facts) 

and get the following result. 

Jess, the Rule Engine for the Java Platform 
Copyright (C) 2004 Sandia Corporation 
Jess Version 7.0a6 3/23/2005 

This copy of Jess will expire in 26 day(s). 
 ==> f-1 (MAIN::TestModify (class ) (name 
"Hello") (OBJECT )) 
f-0   (MAIN::initial-fact) 
f-1   (MAIN::TestModify (class ) (name 
"Hello") (OBJECT )) 
For a total of 2 facts in module MAIN. 
==> Activation: MAIN::default-rule :  f-1 
MAIN::default-rule: +1+1+t 
FIRE 1 MAIN::default-rule f-1 
Hello 
 <== Focus MAIN 
f-0   (MAIN::initial-fact) 
f-1   (MAIN::TestModify (class ) (name 
"Hello") (OBJECT )) 
For a total of 2 facts in module MAIN. 

I expected that the rule will modify the Java Object but it turn out to be no 
modification at all. 

Thanks for any response. 

Samuel
<>

RE: JESS: Put a jess output into JTextArea

2005-06-06 Thread Alan Moore
This depends on what output you want to place into the JTextArea:
 
If you want to put a value/variable holding a string into it, you can pretty 
much translate directly from java like so:
 
myJTextArea.append( myStringVariable );
 
would then become:
 
(?myJTextArea append ?myStringVariable)
 
However, if you want all of Jess' output (or the output from a particular 
router, for example) to go into a JTextArea, then I suggest you look at the 
ConsolePanel.java class in the jess package for an example (it uses the 
TextArea class but it should get you started.)
 
Also, Jess In Action has some examples of both of these.
 
Good luck!
 
alan
__
Bleib immer locker



From: [EMAIL PROTECTED] on behalf of Pedro Pinheiro
Sent: Mon 6/6/2005 2:42 AM
To: jess-users@sandia.gov
Subject: JESS: Put a jess output into JTextArea



I have two classes. One for the jess code and other with a java swing
GUI. I want to put the jess output (results) into JTextArea. How can i
do that?

Thanks!!


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: WG: JESS: multithread test on multiprocessor machine

2005-05-20 Thread Alan Moore
This is an older article but it might be a good starting point:
=20
http://java.sun.com/developer/technicalArticles/JavaTechandLinux/RedHat/
=20
alan
__
Bleib immer locker



From: [EMAIL PROTECTED] on behalf of Negoita, Cristian
Sent: Fri 5/20/2005 12:46 AM
To: jess-users@sandia.gov
Subject: AW: WG: JESS: multithread test on multiprocessor machine

Actually, the test I presented was executed on a single processor =
machine, my local Windows station.=20

And here comes the wierd part: if I execute on 4 processor Redhat, the =
times are even bad: arround 6000 ms per thread. Here are the averages =
values, also with 4 threads:

Windows 1 Processor  20-Threads 2000 ms
Redhat  4 Processors 20-Threads 6000 ms
Windows 1 Processor  4-Threads  500  ms
Redhat  4 Processors 4-Threads  700-800 ms
Windows 1 Processor  1-Thread   297  ms
Redhat  4 Processors 1-Thread   327  ms

Any additional data about how good the linux machine scales I don't =
have.
The value of 6000 looks quite strange.

Cris


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: WG: JESS: multithread test on multiprocessor machine

2005-05-20 Thread Alan Moore
Sorry for the HTML email - broken mailer again...
 
There are a number of factors that can affect your threading performance and 
there have been changes to Linux threads over the years. I didn't see in your 
email which version of RH/Linux kernel you are using but there could be room 
for improvement if you are using an older kernel. Also, some kernels are tuned 
to support a large number of threads which can affect the performance of 
applications using a small number of threads - TBD.
 
Also, you need to be careful how you measure performance - are you including 
thread creation as part of your timing? Thread creation and exit can be 
expensive. Again, this depends on the version of the kernel you are using.
 
You might want to post your message (after searching the archives) to one of 
the linux and/or java mailing lists to see if you get any hits.
 
Good luck!
 
alan
__
Bleib immer locker



From: [EMAIL PROTECTED] on behalf of Negoita, Cristian
Sent: Fri 5/20/2005 12:46 AM
To: jess-users@sandia.gov
Subject: AW: WG: JESS: multithread test on multiprocessor machine



Actually, the test I presented was executed on a single processor machine, my 
local Windows station. 

And here comes the wierd part: if I execute on 4 processor Redhat, the times 
are even bad: arround 6000 ms per thread. Here are the averages values, also 
with 4 threads:

Windows 1 Processor  20-Threads 2000 ms
Redhat  4 Processors 20-Threads 6000 ms
Windows 1 Processor  4-Threads  500  ms
Redhat  4 Processors 4-Threads  700-800 ms
Windows 1 Processor  1-Thread   297  ms
Redhat  4 Processors 1-Thread   327  ms

Any additional data about how good the linux machine scales I don't have.
The value of 6000 looks quite strange.

Cris


<>

RE: JESS: Java servlets

2005-05-19 Thread Alan Moore
I'm not sure I'm getting your question properly but servlets are
generally associated with web based interfaces and not standalone GUI
clients.

In any case, if you are using servlets, I suggest that you maintain a
Rete object instance in your HttpSession. If your application needs to
scale to large numbers of users, you might consider sharing one or more
Rete instances between sessions and/or requests.

If you are talking about a Swing client, there are examples in the Jess
distribution that show how to integrate the two.

Also, Jess In Action, the book by the author of Jess, has examples of
both types of applications.

see:

http://www.manning.com/friedman-hill

Good luck!

alan


> -Original Message-
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] On Behalf Of David Booth
> Sent: Thursday, May 19, 2005 12:04 PM
> To: jess-users@sandia.gov
> Subject: JESS: Java servlets
> 
> 
> Hi,
> 
> I am a new comer to Jess but not to expert systems. I'd like 
> some getting started advice on how to set up a simple GUI 
> based jess expert system using servlets. A simple example 
> would be useful.
> 
> many thanks
> 
> David Booth, Senior Lecturer in Computing, CCTM
> London Metropolitan University, 100 Minories, London EC3N 1JY
> 
> 
> 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: Jess with natural language

2005-04-19 Thread Alan Moore
Your description doesn't specify whether or not you are using console
input or a swing/GUI or the "hosting/container" environment (e.g.
browser/applet, java application, web services etc.) but I think you
will find it easy to integrate Jess into just about any application.

Your subject line mentions natural language - I don't have any
experience with that but my initial take is to avoid using Jess as your
parser per-se. There are well known techniques for doing that and I
suspect you have existing code that already does this. Using Jess as a
plug-in (if such a thing exists) to an existing NLP engine could be a
good approach - TBD.

I'm assuming the Command Pattern is being used since you mentioned "user
commands". In this case, you can have your command processor delegate
validations to a plain old java object that makes calls to Jess, etc.
The rest of your existing code will not need to know anything about
Jess. I suggest that you look into the Struts validation framework as a
place for inspiration and/or implementation.

Good luck!

alan


> -Original Message-
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] On Behalf Of 
> [EMAIL PROTECTED]
> Sent: Tuesday, April 19, 2005 9:02 AM
> To: jess-users@sandia.gov
> Cc: 'Ahmed Noor'
> Subject: JESS: Jess with natural language
> 
> 
> We are working with interfaces to existing programs, in which 
> user input needs to be checked for a number of conditions 
> (such as valid range, that the operation is currently 
> permissible... etc)
> 
> Using standard coding practices, the number of conditions is 
> large and the code becomes hard to maintain. We are hoping to 
> use a rule-based system to manage this condition checking, 
> where each rule would represent a specific condition,  and 
> where the conditions could be automatically checked as new 
> assertions (user commands) were made.  
> 
> Has anyone been using JESS or another rule based system for a 
> similar application? Or does anyone have any thoughts on this subject?
> 
> Thanks,
> 
> Jeanne Peters and Sam Preston
> Old Dominion University
> 600 Butler Farm Rd. Suite 200
> Hampton, VA 23666
> phone: 757-766-5227
> email: [EMAIL PROTECTED]
> email: [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]
> 
> 
> 


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: Rule not firing

2005-04-15 Thread Alan Moore
Did you check the return value from assertFact()? It might be failing.
 
alan
__
Bleib immer locker



From: [EMAIL PROTECTED] on behalf of Matthew Hutchinson
Sent: Fri 4/15/2005 8:28 AM
To: jess-users@sandia.gov
Subject: JESS: Rule not firing



Hi everyone,

To get used to Jess, I have been executing commands at the Jess
prompt, and then trying the same commands using the API.

After doing all the usual things (new rete engine, creating a
deftemplate, populating the slots and adding the template) everything
works fine when asserting a particular fact using executeCommand - and
my rule fires. However, when I try and assert the fact using the API
(same slot values, head name etc.), the rule does not fire.

This code works:
engine.executeCommand("(assert (conventionalAddress (number_prefix
NIL) (street_number 48) (street_name Marlow) (street_type Street)
(suburb_name Wembley) (city_name Perth) (state_name WA) (post_code
6014) ))");

but the API equivalent does not:
Fact f = new Fact("conventionalAddress", engine);
f.setSlotValue("number_prefix", new Value("", RU.STRING) );
f.setSlotValue("street_number", new Value("48", RU.STRING) );
f.setSlotValue("street_name", new Value("Marlow", RU.STRING) );
f.setSlotValue("street_type", new Value("Street", RU.STRING) );
f.setSlotValue("suburb_name", new Value("Wembley", RU.STRING) );
f.setSlotValue("city_name", new Value("Perth", RU.STRING) );
f.setSlotValue("state_name", new Value("WA", RU.STRING) );
f.setSlotValue("post_code", new Value("6014", RU.STRING) );
engine.assertFact(f);

Regardless of which is used, this is the rule I'm trying to fire:
engine.executeCommand("(defrule find-suburb (conventionalAddress
(post_code 6014) (suburb_name ?s) ) => (store RESULT ?s ) )");

I just can't see how the fact is any different when done via the API!


Thanks, and I hope I haven't been posting the mailing list too much. (!)
Best wishes,
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: Creating rules using the Jess API

2005-04-13 Thread Alan Moore
Jess 7.0 also provides a way to create rules via XML (JessML) which,
depending on your requirements, may be the easiest (and possibly the
slowest) way to go.

See:

   jess.xml.JessSAXParser

and:

   Jess70a4\examples\xml\sticks
   Jess70a4\examples\xml\mab

I've not used this feature (yet) but I suspect it works as advertised.

Good luck!

alan

> -Original Message-
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] On Behalf Of 
> [EMAIL PROTECTED]
> Sent: Wednesday, April 13, 2005 4:07 PM
> To: jess-users@sandia.gov
> Subject: Re: JESS: Creating rules using the Jess API
> 
> 
> I think M H wrote:
> [Charset iso-8859-1 unsupported, filtering to ASCII...]
> > Hi,
> > 
> > Chapter 18 of the book "Jess in Action" is great, but
> > nothing is really mentioned regarding creating rules
> > using the Jess API.
> 
> Jess 6 (and earlier) don't support creating rules except by 
> evaluating a "defrule" construct in the Jess language. Jess 7 
> does actually support this, although I'm really at a loss as 
> to why anyone would want to do it. 
> 
> Many people come to Jess and this is the first thing they 
> want to do, though; it just seems natural to a Java 
> programmer, I suppose, so solve a problem by writing only 
> Java code. My advice to you -- before you delve into the 
> as-yet-undocumented Jess 7 APIs for rule creation
> -- is to work with Jess for a while and get used to the kinds 
> of things you can do. Then when you look at the Java APIs, 
> you'll understand just how expressive the Jess language is in 
> its domain. For rules of even moderate complexity, the Java 
> code to create a rule will be ten times as long as the 
> equivalent Jess code -- or more; and it will be no more 
> efficient, because Jess's parser is quite fast, and the time 
> to parse and construct a rule is less than the time it takes 
> to compile a rule into a Rete network (which will also have 
> to be done for rules created using the API.)
> 
> 
> 
> 
> -
> 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: using Userfunctions

2005-03-22 Thread Alan Moore
To return more than one column value in a single UserFunction#call, you can 
create a "container" Value object and place all your returned columns into it. 
For example, your #call method could return:
 
1) A plain-old-java Iterator/array/Collection, etc. (RU.EXTERNAL_ADDRESS) that 
contains your columns as plain-old-java-objects.
2) A List (RU.LIST)
3) A multi-slot (RU.MULTISLOT)
 
If you need to return more than one row per #call, you can have your user 
function return a row Iterator/Collection (RU.EXTERNAL_ADDRESS) that contains 
nested columns of Object values.
 
Or, you can return your JDBC RowSet object as an RU.EXTERNAL_ADDRESS.
 
alan
__
Bleib immer locker



From: [EMAIL PROTECTED] on behalf of sivan k
Sent: Tue 3/22/2005 6:24 AM
To: jess-users@sandia.gov
Subject: Re: JESS: using Userfunctions


I am still having problems but I going to sit on it for now (I just hope I am 
not overlooking something very minor). Meanwhile as I mentioned earlier I want 
to work with a Mysql database. I have managed to connect to the data base using 
a Userfunction and insert values in a table. 
 
How would I be able to return multiple values of different types (eg. a client 
record - client id, name, address etc) to my Jess program without using 
multiple userfunctions (one for each value) after retrieving the values from 
the database.
 
Thanks
Jenny
 

[EMAIL PROTECTED] wrote:

I think sivan k wrote:

> Regarding the no such variable text error - I have not used
> ?text variable outside the function if I have understood you
> correctly. 

Well, I don't know. I was curious enough to take your code and run it.
It works for me with your "test.java" exactly as shown (adding an
"import jess.*", of course), and with a few lines of initialization
added to the Jess code. I can select something from the combo box,
press the button, and get that thing printed. Because Jess 7 includes
some changes in how Context works, I tried this with both Jess 6 and
7; it works with both.

Here's my complete Jess program:

; --
(load-function test)
(import javax.swing.*)

(defglobal ?*argcombo* = (new JComboBox (create$ A B C)))
(defg! lobal ?*ok* = (new JButton OK))

(bind ?frame (new JFrame))
((?frame getContentPane) add ?*ok* "South")
((?frame getContentPane) add ?*argcombo* "Center")
(?frame pack)
(?frame setVisible TRUE)

(deffunction inputstring (?EVENT)
(bind ?arg (sym-cat (?*argcombo* getSelectedItem)))
(compute ?text ?arg)
(printout t ?text))

(bind ?handler (new jess.awt.ActionListener inputstring(engine)))

(?*ok* addActionListener ?handler)





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






Do you Yahoo!?
Yahoo! Small Business - Try our new resources site! 
  
<>

RE: JESS: Batch file question (unicode supported ?) (NOT text/plain - sorry)

2005-03-16 Thread Alan Moore
WARNING: HTML/RTF message - sorry, my crappy company provided mail client is 
broken and can't send text/plain... D-;
 
Depending on the URI you pass into the (batch) command, you will read data from 
either a FileInputReader (file path) or from an InputStreamReader (URL). Either 
way, I think you are going to be ok.
 
For more info on unicode and java see:
 
http://www.javaworld.com/javaworld/jw-01-1998/jw-01-indepth_p.html
 
If you *really* need more control over the handling of input etc. you can 
always do something like this (not compiled/tested):
 
; specify which file
(bind ?mypath "c:\\unicodeFile.jess")
 
; build input/reader
(bind ?in (new java.io.FileInputStream (new java.io.FileReader ?mypath))) ; 
your choice here...
 
; check the encoding
(printout t "Using encoding : " (?in getEncoding))
 
; parse the input into (engine)
(bind ?jesp (new Jesp ?in (engine))
(?jesp parse false)
 
This will parse the ?mypath file into the current engine...
 
Good luck!
 
alan
__
Bleib immer locker



From: [EMAIL PROTECTED] on behalf of Dasch
Sent: Wed 3/16/2005 5:06 PM
To: Jess Users Email Discussion Forum
Subject: JESS: Batch file question (unicode supported ?)



Hi,

I was wondering if it is possible to use batch files (files loaded with
the batch command) encoded in Unicode ?
If it is possible, could you tell me how to do it ? Is there a specific
argument to use ?

Thanks in advance,
Dasch


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: batch routine error

2005-03-16 Thread Alan Moore
I don't know if this will help but you might try enclosing your file path in 
double quotes:
 
(batch "/home//rulebase.clp")
 
alan
__
Bleib immer locker



From: [EMAIL PROTECTED] on behalf of Nicolas Fortin
Sent: Wed 3/16/2005 6:06 AM
To: jess-users@sandia.gov
Subject: JESS: batch routine error



Hello everybody,

I first developed a Java application that embeds the Jess library, with
Eclipse on a Windows environment. Everything was functional. After that, I
decided to bring it on Linux Fedora. However, I got an error when I loaded
my program's rules (stored in a clp file) in the Jess engine. You will see
below the error raised by the "batch" routine.

I am pretty sure that the file location is correct
(/home/nicolas/workspace/simulation/src/knowledge/rules_base.clp).
Nevertheless, the "batch" routine seems to slip up with this path, because
in the message reported, it is written : "Jess reported an error in routine
batch while executing (batch *A STRANGE CHARACTER HERE*
nicolas/workspace/simulation/src/knowledge/rules_base.clp)". This *STRANGE
CHARACTER HERE* is just like a little rectangle with circles inside.

I would appreciate any help with this problem !

Regards,

Nicolas

Jess reported an error in routine batch
while executing (batch *A STRANGE CHARACTER HERE*
nicolas/workspace/simulation/src/knowledge/rules_base.clp).
  Message: Cannot open file.
  Program text: ( batch home
nicolas/workspace/simulation/src/knowledge/rules_base.clp )  at line 1.
at jess.Batch.findDocument(Batch.java:67)
at jess.Batch.batch(Batch.java:32)
at jess.Batch.call(Batch.java:87)
at jess.FunctionHolder.call(FunctionHolder.java:30)
at jess.Funcall.execute(Funcall.java:280)
at jess.Jesp.parseAndExecuteFuncall(Jesp.java:1916)
at jess.Jesp.parseExpression(Jesp.java:299)
at jess.Jesp.promptAndParseOneExpression(Jesp.java:174)
at jess.Jesp.parse(Jesp.java:162)
at jess.Rete.executeCommand(Rete.java:1470)
at knowledge.RulesBase.defineAll(RulesBase.java:106)
at knowledge.ExpertSystem.initialize(ExpertSystem.java:75)
at simulation.MainFrame.performSimulateButtonClick(MainFrame.java:965)
at simulation.MainFrame.access$2(MainFrame.java:923)
at simulation.MainFrame$2.actionPerformed(MainFrame.java:321)
at 
javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1786)
at
javax.swing.AbstractButton$ForwardActionEvents.actionPerformed(AbstractButto
n.java:1839)
at
javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:4
20)
at 
javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:258)
at
javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener
java:245)
at 
java.awt.AWTEventMulticaster.mouseReleased(AWTEventMulticaster.java:231)
at java.awt.Component.processMouseEvent(Component.java:5100)
at java.awt.Component.processEvent(Component.java:4897)
at java.awt.Container.processEvent(Container.java:1569)
at java.awt.Component.dispatchEventImpl(Component.java:3615)
at java.awt.Container.dispatchEventImpl(Container.java:1627)
at java.awt.Component.dispatchEvent(Component.java:3477)
at 
java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:3483)
at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3198)
at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3128)
at java.awt.Container.dispatchEventImpl(Container.java:1613)
at java.awt.Window.dispatchEventImpl(Window.java:1606)
at java.awt.Component.dispatchEvent(Component.java:3477)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:456)
at
java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.ja
va:201)
at
java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java
:151)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:145)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:137)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:100)
Caused by: java.io.FileNotFoundException:  (No such file or directory)
at java.io.FileInputStream.open(Native Method)
at java.io.FileInputStream.(FileInputStream.java:106)
at java.io.FileInputStream.(FileInputStream.java:66)
at java.io.FileReader.(FileReader.java:41)
at jess.Batch.findDocument(Batch.java:57)
... 38 more


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 for a Data Quality project

2005-03-03 Thread Alan Moore
> 2) can scan a very large database trying to find exceptions

[alan]
The jess user contrib library:

http://herzberg.ca.sandia.gov/jess/user.shtml

has excellent framework written by Thomas Barnekow that you might want
to take a look at.

> 3) where the rules used to identify exceptions can be entered 
> or changed flexibly (possibly by the end users)

[alan]
I'd consider using or creating a rule generator for the end users - a
fairly simple one would do just fine. You can create a generator that
uses a subset of jess's capabilities in a controlled fashion, probably
in conjunction with a set of rules you write to support the end user
generated code/data. The more you model the user's input as data and
write more of the rules yourself, the less likely you will run into
problems but may have additional performance overhead.

> We haven't started formalizing the rules yet, but my 
> experience with the users suggests that rules can be complex, 
> with many branches, frequently not clearly defined and based 
> on stochastic variables.

[alan]
Can't help you there...

> 
> Has anybody used a ruled-based engine for Data Quality systems?

[alan]
I am in the process of designing a jess based system to check the
quality of data - only in our case, it's a spectrographic data generated
by an instrument and not business data. Your task will be easier than
mine so if you run into trouble, I'm  D-;


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: executeCommand

2005-02-22 Thread Alan Moore
To trap jess events, such as rule firing, facts asserting, etc. see:
 
http://herzberg.ca.sandia.gov/jess/docs/61/api/jess/JessListener.html
 
alan
__
Bleib immer locker



From: [EMAIL PROTECTED] on behalf of Andreas Holzbach
Sent: Tue 2/22/2005 5:31 PM
To: jess-users@sandia.gov
Subject: JESS: executeCommand



Hello,
iB4m using the executeCommand Method from the ReteClass.
My problem is: How can I get the results of the commands back,
like when using Jess with the command line?
Currently iB4m using the Value.toString Method, but
thatB4s not really the same.
For example: (facts) returns just nil and (run) returns also not
the same informations like when using the command line.
I actually just want to use the executeCommand Method or
at least as less as possible jess specific classes and methods.
ThatB4s because I integrated Jess in an OSGi environment and
the rule engine should be as exchangeable as possible.
I need to know when a specific rule has been fired,
or when a fact has been asserted. With the feedback
i get back with the value.toString i actually canB4t really work with.

I hope you can help me.

Andi


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: Java GUI in Jess: forgot to include Classpath

2005-02-08 Thread Alan Moore
Without the exact error message you are getting it is hard to help you. Can you 
please include your error message.
 
It is possible that your classpath is pointing to an older version of your 
NamePAss class which does not contain the buildConstraints method. You might 
consider searching your entire system and make sure there is only one 
NamePAss.class file.
 
Also, I'm see that you are not importing the NamePAss class or the entire 
package it is contained in. If your class isn't in a package, you might 
consider puting it in one, just for good coding style/form.
 
alan
__
Bleib immer locker



From: [EMAIL PROTECTED] on behalf of sivan k
Sent: Tue 2/8/2005 1:04 AM
To: jess-users@sandia.gov
Subject: Re: JESS: Java GUI in Jess: forgot to include Classpath



I corrected the spelling for buildConstraints though that is not giving me the 
current problem ie method buildContraints is not found though class NamePAss 
is found.

 

I have given the java class and the jess code below.  

 

import java.awt.*;

import javax.swing.*;

import java.awt.event.*;

 

public class NamePAss extends JFrame

{

public void buildConstraints(GridBagConstraints gbc, int gx, int 
gy, int gw,  int gh, int wx, int wy)

{

gbc.gridx=gx;

gbc.gridy=gy;

gbc.gridwidth =gw;

gbc.gridheight =gh;

gbc.weightx=wx;

gbc.weighty=wy;

}

}

 

jess code:

 

(import javax.swing.*)

(import java.awt.*)

(import java.awt.event.*)

 

;; Main window

(defglobal ?*frame* = (new JFrame "Interface"))

(?*frame* setDefaultCloseOperation (get-member JFrame EXIT_ON_CLOSE))

(?*frame* setSize 520 100)

(?*frame* setVisible TRUE)

 

(defglobal ?*gridbag* = (new GridBagLayout))

(defglobal ?*constraints* = (new GridBagConstraints))

(defglobal ?*pane* = (new JPanel))

(?*pane* setLayout ?*gridbag*)

 

(defglobal ?*passname* = (new NamePAss))

(?*passname* buildConstraints ?*constraints* 1 0 1 1 90 0)

(set-member ?*constraints* fill GridBagContsraints.NONE)

(set-member ?*constraints* anchor GridBagContsraints.EAST)

 

(defglobal ?*label* = (new JLabel Name))

 

((?*frame* getContentPane) add ?*pane* (get-member BorderLayout SOUTH))

(?*frame* validate)

(?*frame* repaint)

  

(reset)

(run-until-halt)

 

Thankyou

Jenny



Dusan Sormaz <[EMAIL PROTECTED]> wrote: 

Let me try to guess:

Now your method is called  buildConstraints

and in old snippet you posted it was 

(?*passname* buildContraints ?*contraints* 1 0 1 1 90 0)

note spelling difference. This is sufficient for your error.

If my guess was wrong, then I suggest that you post the code again for  
everybody to see it.

Regarding public-ity of method, if it was NOTpublic it would be a 
problem.

I hope that this again helps.

Dusan Sormaz


At 02:01 PM 2/7/2005, you wrote:


hello Professor Sormaz
 
Regarding my problem ie. class not found error in Jess program.
 
I had not specified the classpath for the folder containing my 
java classes hence the class not found error. Once I specified the classpath 
the class was found
 
But now the program can't find the one and only method 
buildConstraints which  I defined in the class NamePAss.
I defined the method as public. Is this the problem. 
 
Suggestion from others welcome!
Jenny
 
 
 
 
 
 


Do you Yahoo!?
Yahoo! Search presents - Jib Jab's 'Second Term' 

  


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

*** 



Do you Yahoo!?
Yahoo! Search presents - Jib Jab's 'Second Term' 

 
<>

JESS: RE: Jess dependency on org.xml.sax.SAXException

2004-09-27 Thread Alan Moore
Uh, hold the phone... that class is supposed to be in JDK 1.4.2 and
that's what I *should* be running against.

I'll check my environment again.

alan

> -Original Message-
> From: Alan Moore 
> Sent: Monday, September 27, 2004 3:08 PM
> To: '[EMAIL PROTECTED]'
> Subject: Jess dependency on org.xml.sax.SAXException
> 
> 
> I was testing Jess70a1 with some existing code and found the 
> following exception:
> 
>  Caused by: java.lang.NoClassDefFoundError: org/xml/sax/SAXException
>  at jess.Funcall.loadIntrinsics(Funcall.java:118)
> 
> Old code that does not have this class on the classpath no 
> longer work.
> 
> You might want to mention this new dependency in the release 
> notes somewhere.
> 
> 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: Jess dependency on org.xml.sax.SAXException

2004-09-27 Thread Alan Moore
I was testing Jess70a1 with some existing code and found the following
exception:

 Caused by: java.lang.NoClassDefFoundError: org/xml/sax/SAXException
 at jess.Funcall.loadIntrinsics(Funcall.java:118)

Old code that does not have this class on the classpath no longer work.

You might want to mention this new dependency in the release notes
somewhere.

alan


> -Original Message-
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] On Behalf Of Ross Judson
> Sent: Monday, September 27, 2004 11:21 AM
> To: [EMAIL PROTECTED]
> Subject: RE: JESS: JessDE parse problem
> 
> 
> Will do when I get home...don't have the stuff here at work.  
> I like the shape of the new editor...very convenient.
> 
> I really wish that Eclipse supported tree views with a 
> variable number of columns...there's so much wasted 
> whitespace in a standard tree view...
> 
> I know you're hard at work on the debugger.  For me, the 
> single most important thing I need to know is which parts of 
> a rule's LHS have been satisfied, and which aren't...I spend 
> most of my time figuring that out ;)
> 
> RJ
>  
> 
> 
> 
> 
> 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: Jess, pervasive computing,sensor networks and system requirements.

2004-09-08 Thread Alan Moore
I've done some reading about Jess and it looks like it's powerful enough
to express the sort of rules we need in this project. For example, what
the sensors should do when the river depth goes about a certain level
and stuff like that. However, I haven't actually used Jess yet so is
Jess really powerful enough to do so?

[alan]
Yes.

I know it's a pretty vague question but bear with me pls! This is a
pervasive computing project so system and resource requirements is
vitally important. Could someone tell me what the system requirements
are for Jess?

[alan]
As for the Jess engine itself, the jar file is ~372KB. In some devices
this can be prohibitive in and of itself. I suppose this could be
optimized so that only the most essential Jess classes are included in
your deployment but that might be hard to do correctly and might not get
you the savings you require - YMMV.

Working memory usage can vary greatly depending on your rule/fact
structure. From your problem description, it doesn't sound like your
working memory needs would be very large unless every sensor needs to
know about and reason about every other sensor in a large network.

My final question is how easily can Jess couple into Java? For example,
how easily can we bring sensor reading through into Jess to refer to in
the rules?

[alan]
Jess integrates *very* easily with Java.

I would really appreciate your help in this. Thank you and have a good
day.

[alan]
You too!




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: Muilti-line comments

2004-09-07 Thread Alan Moore
> -Original Message-
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] On Behalf Of 
> [EMAIL PROTECTED]
> Sent: Friday, September 03, 2004 10:52 AM
> To: [EMAIL PROTECTED]
> Subject: Re: JESS: Muilti-line comments
>
> Another thing I will do in the engine is provide "rule 
> properties"; you could thereby turn existing rules on or off. 
> This works in a running system, which is even better.

Is this similar to attributes in other languages?

Can jess code define custom attributes/properties?

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: (reset) and (initial-fact)

2004-08-16 Thread Alan Moore
Title: RE: JESS: (reset) and (initial-fact)





Could you introduce a new constructor with a switch controlling this behavior? The existing constructor could maintain the old behavior and anyone wanting the new behavior could use it explicitly.

Alternatively, could you have a derived Rete (or delegating wrapper) class that has this behavior as the default?


Other possibilities:


1) ReteFactory (or Rete factory methods) to configure the engine prior to use
2) System properties
3) etc. - you get the idea


I know these suggestions are ugly hacks but it would allow compatibility with old code.


alan


P.S.: Sorry for the HTML email - broken email client in use. I've changed all my setting so that everything should be plain text but to no avail.

> -Original Message-
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED]] On Behalf Of 
> [EMAIL PROTECTED]
> Sent: Monday, August 16, 2004 1:45 PM
> To: Jess Mailing List
> Subject: JESS: (reset) and (initial-fact)
> 
> 
> One of the more annoying bits of Jess's CLIPS legacy is that 
> it starts up with an empty working memory, but for many kinds 
> of rules to work properly, the (initial-fact) asserted by 
> (reset) has to be there. We saw someone else bothered by this 
> problem on the list today.
> 
> I was just wondering: would it be a good idea to have a Rete 
> object be born in such a state as if (reset) had just been 
> called? In addition, should (clear) call (reset) after wiping 
> everything out?
> 
> I know there are some of Jess's functional tests that would 
> fail and would need changing, and a few bits and pieces of 
> the book would then be "wrong" as far as describing how Jess 
> actually behaves. But does anyone have any nontrivial code 
> that would suffer if this change were made? I think it would 
> save a lot of newbies a lot of grief.
> 
> -
> 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://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: forall conditional element

2004-08-16 Thread Alan Moore
Title: RE: JESS: forall conditional element





Did you do a (reset) before (run)?


alan


-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] On Behalf Of Nicolas Fortin
Sent: Monday, August 16, 2004 12:16 PM
To: [EMAIL PROTECTED]
Subject: JESS: forall conditional element



Hi everybody,


It is written in "The Jess Language" section that the forall conditional rule : 


Jess> (defrule forall-example
    (not (and (a ?x) (not (b ?x
    =>)


would be activated, if for every fact (a ?x), there is a fact (b ?x). However, after I added the forall rule and the following facts :

(assert (a c))
(assert (b c)) 


there is no activation if I look in the agenda. What is wrong ? I am not sure to understand this condition. Which facts should I add to activate the rule ?

Thanks in advance for reading my question,


Nicolas





RE: JESS: Charlemagne info

2004-07-28 Thread Alan Moore
Title: RE: JESS: Charlemagne info





Sweet! Can't wait... uh, er, I guess I have to.


alan


> -Original Message-
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED]] On Behalf Of 
> [EMAIL PROTECTED]
> Sent: Wednesday, July 28, 2004 2:35 PM
> To: Jess Mailing List
> Subject: JESS: Charlemagne info
> 
> 
> Folks,
> 
> There's some new details and a screen shot of the upcoming Charlemagne
> release of Jess on the "Jess 7 Preview" page at 
> 
  http://herzberg.ca.sandia.gov/jess/charlemagne.shtml


More to come.


-
Ernest Friedman-Hill  
Science and Engineering PSEs    Phone: (925) 294-2154
Sandia National Labs    FAX:   (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: Very simple defquery question

2004-07-21 Thread Alan Moore
Title: RE: JESS: Very simple defquery question





JZ,


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


This section of the manual has both a jess and java version of iterating through the query results - scroll down a bit, if necessary, to see the java code.

See also:


http://www.manning.com/friedman-hill



alan


Disclaimer: My company provided me with this broken mailer - my apologies in advance if this is not plain text...



-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] On Behalf Of Jeremic Zoran
Sent: Tuesday, July 20, 2004 8:31 AM
To: [EMAIL PROTECTED]
Subject: JESS: Very simple defquery question



I have batch file as follow:
(deftemplate lesson 
(slot ordinalNumber (type INTEGER))
(slot ID (type INTEGER))
(slot difficultyLevel (type INTEGER))
(slot belongs-to-concept (type INTEGER)))


(defquery find-lessons 
(declare (variables ?currConc ?diffLevel)) 
(lesson (difficultyLevel ?p&: (eq ?p ?diffLevel)) ( belongs-to-concept ?s&: (eq ?s ?currConc


and I need to run query from Java and read values of lesson's slots for all choosen lessons. I have tried to write something like this:


public void runQueryFindLessons(int currConc, int diffLev) {
try {
ValueVector vv = new ValueVector();
vv.add(new Value(currConc, RU.INTEGER));
vv.add(new Value(diffLev, RU.INTEGER));
Iterator it = engine.runQuery("find-lessons", vv);
System.out.println("Funkcija runQueryFindLessons klase DiscoursePlanner");
try {
   while (it.hasNext()) {
    System.out.println(" in this part I need to read lesson slots");
 }
  }  catch (NoSuchElementException ex) {
 }
   }
catch (JessException je) {
    }
   }





RE: JESS: Optimization Question

2004-07-07 Thread Alan Moore
Title: RE: JESS: Optimization Question





Also, the following *might* be even faster - TBD:


(defrule prevent-logout
   (ActionForward (path ?url&:(neq (str-index "Logout.do" ?url) FALSE)))
=>
)


You can move the _expression_ in the (test) up into the pattern if your _expression_ doesn't depend on variables from another pattern bound lower in the pattern list.

Warning: In general, don't move the patterns around on the LHS to bind the variable earlier if doing so would greatly increase the number of partial matches. A careful analysis of your actual patterns and data will determine whether this can/should be done. The patterns with the fewest matches should be listed first on the LHS to reduce partial matches.

Good luck!


alan


-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] On Behalf Of John Aronson
Sent: Wednesday, July 07, 2004 4:04 PM
To: [EMAIL PROTECTED]
Subject: FW: JESS: Optimization Question



Thanks for the response. The class loading time wasn't a one time thing, it was a constant drag when I was running from 100 up to 1 reps. 10,000 reps was taking over an hour so I didn't run that one a lot ;)

 
I did solve the problem though. I found that it was a lot faster to use Jess methods within the LHS part of my rules as opposed to making Java calls. For example, I was looking for a static string inside another string in the test clause of a rule.

 
;variable ?url is String variable defined by an earlier clause
 
;this is the slow version, using indexOf method in String class
(test (> (?url indexOf "Logout.do") -1))
 
;this is the fast version, using Jess method str-index
(test (neq (str-index "Logout.do" ?url) FALSE))
 
Changing to the fast version caused Jess to perform about 100 times faster and made it much less sensitive to the number of rules in the rule base. 

 
I looked through your book and the online docs but I didn't see anything about this performance cost. I might have missed it.

 
John Aronson 
Senior Software Engineer 
Xaffire Inc. 
(303) 642-4481 office 
(720) 294-1235 fax
 
[EMAIL PROTECTED] 
www.xaffire.com
 
 
-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] 
Sent: Wednesday, July 07, 2004 4:47 PM
To: [EMAIL PROTECTED]
Subject: Re: JESS: Optimization Question
 
I think John Aronson wrote:
 
> The profiler reports that that almost all the execution time is spent
> loading classes. I'm hoping that fact means that there's something wrong
> with my code which I could fix to improve the performance.
 
It does look like a lot of time is being spent loading classes during
calls to "definstance" and something in ReflectFunctions; these are
clearly your application classes that Jess is, for some reason,
loading very slowly.
 
I suspect this is a "microbenchmark", and the problem may just be that
loading your classes is intrinsically slow -- for example, the first
Swing class loaded can often take a really long time because it can
drag in hundreds of other classes. In that case, I'd say you should
just run the thing 50,000 times instead of 1,000 times, and see if the
class loading time doesn't disappear down into the noise (because it
only happens once.) Based on your description, your benchmark likely
takes only a fraction of a second to run, discounting the JVM startup
time and any anomolous class loading behavior.
 
But in any case, Jess doesn't define its own class loader, or do
anything odd that would force the same class to be reloaded multiple
times.
 
 
-
Ernest Friedman-Hill  
Science and Engineering PSEs    Phone: (925) 294-2154
Sandia National Labs    FAX:   (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: ant task for checking rule file syntax

2004-07-07 Thread Alan Moore
Title: RE: JESS: ant task for checking rule file syntax





If your script to be checked does not call (run) or (run-until-halt) and contains primarily deffunction/defquery/defrule statements you can try:


   
  
   




   
   
   



disclaimer: not tested...


All this does is run jess' Main with the script as an argument. Jess will parse the file and then exit.


Good luck!


alan


> -Original Message-
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED]] On Behalf Of [EMAIL PROTECTED]
> Sent: Wednesday, July 07, 2004 1:28 PM
> To: [EMAIL PROTECTED]
> Subject: JESS: ant task for checking rule file syntax
> 
> 
> 
> Hi,
> 
> Is there any ant tool which can check the syntax in clip files?
> 
> 
> Thanks
> Bhaskar
> 
> 
> 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: Least favorite error messages

2004-07-07 Thread Alan Moore
Title: RE: JESS: Least favorite error messages





The worst error message is a silent failure...


Here's one:


Given a java class named "Disbelief" with a boolean property called "really":


(defrule jess-rules
   (Disbelief (really FASLE))
=>
)


The parser doesn't detect that the misspelled FASLE (FALSE) will never match.


Also, I've seen the parser ignore extra characters on a line after a closing ")", for example:


(deffunction test (?args)
   (bind ?hello (new String "hello world")) ignored text
   (printout t ?hello)
)


However,


(deffunction test (?args)
   (bind ?hello (new String "hello world")) ?notignored
   (printout t ?hello)
)


Results in a parse error on ?notignored = "No such variable notignored."


alan



> -Original Message-
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED]] On Behalf Of 
> [EMAIL PROTECTED]
> Sent: Wednesday, July 07, 2004 8:37 AM
> To: Jess Mailing List
> Subject: JESS: Least favorite error messages
> 
> 
> Hi Folks,
> 
> Work progresses on Jess 7. I'm making a sweep through the 
> code looking at error messages, in particular looking for 
> ones that are hard to understand. I'd love it if people could 
> help me by sharing small snippets of code that evoke Jess 
> error messages that don't make sense or seem inappropriate -- 
> especially parser errors that don't point to the real source 
> of a problem. You can post them here or just send them 
> directly to me. Speaking up now guarantees that there will be 
> improvements! 
> 
> -
> Ernest Friedman-Hill  
> Science and Engineering PSEs    Phone: (925) 294-2154
> Sandia National Labs    FAX:   (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: Java bean binding and definstance

2004-07-06 Thread Alan Moore
Title: RE: JESS: Java bean binding and definstance





First, the first argument to rete.definstance() ("ds" in the example below) must match the name you give in the first argument to the (defclass) ("dimmer" in the example below.)

Second, in order to bind to an object you have definstanced, you will need to either create a defule or a defquery. I don't use defquery much but you should be able to use defrule like so:

(defrule print-dimmer-brightness
   (dimmer (brightness ?b) (OBJECT ?myObj) )
=>
   (printout t "brightness of object " ?myObj " is " ?b)
)


disclaimer: code above has not been checked for syntax...


alan


> -Original Message-
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED]] On Behalf Of [EMAIL PROTECTED]
> Sent: Tuesday, July 06, 2004 4:32 PM
> To: [EMAIL PROTECTED]
> Subject: JESS: Java bean binding and definstance
> 
> 
> 
> Hi,
> 
> I have in rules file
> (defclass dimmer DimmerSwitchDynamic)
> 
> I want to create a new instance and bind that to it in java file.
> 
> I am calling
> rete.definstance("ds", dimmerObject, false);
> 
> in clp file I have
> 
> (printout t "brightness" (call ?ds getBrightness)  crlf).
> 
> But I need to have
> 
>  (bind ?ds (new DimmerSwitchDynamic) ) in clp file
> 
> This creates new instance but it prints out 0 not the one I 
> set the value in definstance dimmerObject.
> 
> How can I bind from Java an instance of bean to a variable 
> name as in above example?
> 
> 
> Thanks
> Bhaskar
> 
> 
> 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 and instances

2004-06-30 Thread Alan Moore
Title: RE: JESS: JESS and instances





> > How can I share facts between different instances of Rete?
> 
> You can duplicate them, but not share them.


However, you can share (via definstance) an instance of a java object between two instances of Rete. Your question was about "facts" which, as Ernest pointed out, cannot be shared.

You could do this like so:


MyObject sharedInstance = new MyObject(); // whatever...
Rete rete1 = new Rete();
Rete rete2 = new Rete();
configure( rete1 ); // define/declare "MyObject" type to jess - see defclass/import
configure( rete2 ); // same...
rete1.definstance( "MyObject", sharedInstance, true );
rete2.definstance( "MyObject", sharedInstance, true );


This could be useful in some circumstances, I suppose, but it is not a common practice.


alan





JESS: Minor documentation error

2004-06-18 Thread Alan Moore
Title: Minor documentation error





The users manaual has a small error. See section 8.75 - the get-salience-evaluation function is listed without () chars...

8.75. get-salience-evaluation


should be:


8.75. (get-salience-evaluation)


alan





JESS: Context.push()

2004-06-02 Thread Alan Moore
Title: Context.push()





I'm trying to do the following:


Context functionContext = engine.getGlobalContext().push();
functionContext.setVariable( "xyz", new Value(myObj) );
Value retval = function.call(vv, functionContext);
Object realRetval = retval.resolveValue(functionContext).externalAddressValue(functionContext);


but getting the following:


Jess reported an error in routine Context.getVariable
    while executing (str-cat ?xyz ":" ?arg)
    while executing (return (str-cat ?xyz ":" ?arg))
    while executing deffunction echo.
Message: No such variable xyz.


The deffunction being called is:


(deffunction echo (?arg)
   (return (str-cat ?xyz ":" ?arg))
)


There are several places where a Context needs to be supplied and I wasn't sure which context to provide in each call. In the example shown above, I create a "local" context for the function by calling Context#push() (per the javadoc); however, this doesn't seem to define the variable "xyz" in the context of the called deffunction.

If I simply skip calling push() and just use the global Context, the deffunction executes without error.


However, I don't want the local/temporary "xyz" to pollute the global context and don't want multiple threads to share a global "xyz" variable should this logic be used concurrently.

Should I be calling push() and am I using Context correctly?


Which Context should I provide when calling resolvingValue() on the returned Value object?


I assume that since the returning value may be a complex _expression_ (i.e. str-cat) that the local context containing the xyz variable should be provided.

I tested this using Jess 6.1p7.


Thanks in advance.


alan





RE: JESS: Listening to Jess Events

2004-06-01 Thread Alan Moore
Title: RE: JESS: Listening to Jess Events





First, I'm sorry for the HTML email - I can't seem to get this *broken* mail client to do the right thing.


Secondly, in the following:


"Your problem above could be due to an error in your (batch) statements (FileNotFoundException?) or a runtime error in the LHS of one of your rules."

I meant "RHS of one of your rules." Of course, it is possible that there is an error on the LHS as well but that is more rare.

alan



-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] On Behalf Of Alan Moore
Sent: Tuesday, June 01, 2004 12:21 PM
To: '[EMAIL PROTECTED]'
Subject: RE: JESS: Listening to Jess Events



> 3.  Instantiate a Rete object with engine = new 
> Rete(Someclass.class) to register the context with engine. 
[alan] 
This isn't required to sink jess events. This constructor is for applets or EJB-style containers (I think.) 
> 3. 
>  Register that class to receive events via 
> engine.addJessListener(). 
[alan] 
This is required. 
> 4.  Call engine.setEventMask() for 
> each event that I want to receive. 
[alan] 
I assume you are combining the event mask(s) so that you only call setEventMask() once. 
> 
> I tried all this and didn't have any luck, so I'm obviously 
> missing something. 
> 
> Now, for simplicity sake, let's say that Someclass contains a 
> method called 
> process() where: 
> 
> public void process() { 
>   engine.executeCommand("(batch main.clp)"); 
>   engine.executeCommand("(batch resolve.clp)"); 
>   engine.executeCommand("(batch schedule.clp)"); 
>   engine.reset(); 
>   engine.runUntilHalt(); 
> } 
[alan] 
When do you call Rete#addJessListener()? You proly already know this but it needs to be called before Rete#runUntilHalt();

> 
> Now, I have a slew of questions: 
> 
> 1.  While runUntilHalt() is executing, does the listening 
> class need to be listening on another thread to receive 
> events while the engine is running? 
[alan] 
No, your listener method will be called back via the thread initiating the Rete activity. In your case, it will most likely be the thread that calls Rete#runUntilHalt().

> 2.  Does it matter at all 
> that process() is running Jess script via 
> engine.executeCommand() instead of executing API code 
> directly? 
[alan] 
Nope, shouldn't matter. 
> 3.  Is this an acceptable way of programming in 
> Jess?  Should all the script be in one file? 
[alan] 
It's *all* good. 
> 4.  My main 
> reason for wanting the events produced by Jess was to log 
> them for debugging. (Jess is being used in a webapp here, and 
> I am using Apache Jakarta Log4J as the logger.) 
[alan] 
I use it for exactly this purpose as well. 
>  My initial 
> thought was to put logging statements in the implementation 
> of eventHappened() like this: 
> 
> public void eventHappened(JessEvent je) throws JessException { 
> switch (je.getType()) { 
> case JessEvent.ACTIVATION: 
> Activation activation = (Activation) je.getObject(); 
> String ruleName = 
> activation.getRule().getDisplayName(); 
> logger.info("Activation: " + ruleName 
> + " was activated or deactivated."); 
> break; 
> // ... more code 
> } 
> 
> What's the best way of logging Jess output and events when 
> Jess is embedded in a web application? (I don't mean 
> generating JSP views for input/output - that I've got fine.) 
[alan] 
I use a jess listener to log structured information, such as rule firing, etc. However, you will find life much easier if you add an output router and send the output to your log file also.

Your problem above could be due to an error in your (batch) statements (FileNotFoundException?) or a runtime error in the LHS of one of your rules. Check your webapp/container logs for errors. Also, put a try/catch around the body of process() to catch any errors being thrown by jess.

Good luck! 
alan 



> 
> Thanks! 
> -JM 
> 
>  
> 
> Jason Morris 
> Morris Technical Solutions [EMAIL PROTECTED] 
> www.morristechnicalsolutions.com 
> fax/phone: 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] 
>  
> 





RE: JESS: Listening to Jess Events

2004-06-01 Thread Alan Moore
Title: RE: JESS: Listening to Jess Events





> 3.  Instantiate a Rete object with engine = new 
> Rete(Someclass.class) to register the context with engine.


[alan]
This isn't required to sink jess events. This constructor is for applets or EJB-style containers (I think.)


> 3. 
>  Register that class to receive events via 
> engine.addJessListener().


[alan]
This is required.


> 4.  Call engine.setEventMask() for 
> each event that I want to receive.


[alan]
I assume you are combining the event mask(s) so that you only call setEventMask() once.


> 
> I tried all this and didn't have any luck, so I'm obviously 
> missing something.
> 
> Now, for simplicity sake, let's say that Someclass contains a 
> method called
> process() where:
> 
> public void process() {
>   engine.executeCommand("(batch main.clp)");
>   engine.executeCommand("(batch resolve.clp)");
>   engine.executeCommand("(batch schedule.clp)");
>   engine.reset();
>   engine.runUntilHalt();
> }


[alan]
When do you call Rete#addJessListener()? You proly already know this but it needs to be called before Rete#runUntilHalt();

> 
> Now, I have a slew of questions:
> 
> 1.  While runUntilHalt() is executing, does the listening 
> class need to be listening on another thread to receive 
> events while the engine is running?


[alan]
No, your listener method will be called back via the thread initiating the Rete activity. In your case, it will most likely be the thread that calls Rete#runUntilHalt().

> 2.  Does it matter at all 
> that process() is running Jess script via
> engine.executeCommand() instead of executing API code 
> directly?


[alan]
Nope, shouldn't matter.


> 3.  Is this an acceptable way of programming in 
> Jess?  Should all the script be in one file?


[alan]
It's *all* good.


> 4.  My main 
> reason for wanting the events produced by Jess was to log 
> them for debugging. (Jess is being used in a webapp here, and 
> I am using Apache Jakarta Log4J as the logger.)


[alan]
I use it for exactly this purpose as well.


>  My initial 
> thought was to put logging statements in the implementation 
> of eventHappened() like this:
> 
> public void eventHappened(JessEvent je) throws JessException {
> switch (je.getType()) {
> case JessEvent.ACTIVATION:
> Activation activation = (Activation) je.getObject();
> String ruleName = 
> activation.getRule().getDisplayName();
> logger.info("Activation: " + ruleName
> + " was activated or deactivated.");
> break;
> // ... more code
> }
> 
> What's the best way of logging Jess output and events when 
> Jess is embedded in a web application? (I don't mean 
> generating JSP views for input/output - that I've got fine.)


[alan]
I use a jess listener to log structured information, such as rule firing, etc. However, you will find life much easier if you add an output router and send the output to your log file also.

Your problem above could be due to an error in your (batch) statements (FileNotFoundException?) or a runtime error in the LHS of one of your rules. Check your webapp/container logs for errors. Also, put a try/catch around the body of process() to catch any errors being thrown by jess.

Good luck!


alan



> 
> Thanks!
> -JM
> 
> 
> 
> Jason Morris
> Morris Technical Solutions [EMAIL PROTECTED]
> www.morristechnicalsolutions.com
> fax/phone: 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]
> 
> 





RE: JESS: Newbie Question: Pattern Matching ordered facts

2004-05-25 Thread Alan Moore
Title: RE: JESS: Newbie Question: Pattern Matching ordered facts





Try:


(deftemplate commitment
   (slot debtor)
   (slot creditor) 
   (slot cond)
)


(assert (commitment (debtor Amit) (creditor Jane) (cond money)))


(defrule resolve-commitment
   (commitment (cond ?x))
=>
   (printout t "resolved" crlf )
)


(run)


Good luck!


alan



> -Original Message-
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED]] On Behalf Of Amit Chopra
> Sent: Tuesday, May 25, 2004 3:17 PM
> To: [EMAIL PROTECTED]
> Subject: JESS: Newbie Question: Pattern Matching ordered facts
> 
> 
> Hi,
> 
> I have been using Jess for a couple of weeks now.  I am stuck 
> with some pattern matching problems. Basically I do this at 
> the jess prompt
> 
>  > (deftemplate commitment (slot debtor) (slot creditor) 
> (slot cond))  > (assert (commitment (debot Amit) (creditor 
> Jane) (cond money))  > (assert (money))
> 
> Everything goes fine till here. Then,
> 
>  > defrule resolve-commitment
>    (and (?x) (commitment (cond ?x))) => (printout t 
> "resolved" crlf))
> 
> Basically I'm trying to match a condition of the commitment 
> (money) with an event (money). If such an event is found, the 
> commitment is said to be resolved. I expect ?x to be bound to 
> money when the rule fires.
> 
> However, I'm getting  exceptions with the defrule. I tried 
> removing the brackets around ?x, but still problematic. Any 
> ideas how to do get it to work will be greatly appreciated.
> 
> Of course, I tried an alternate scenario where  I have a 
> (deftemplate event (slot name)) and asserting (event (name 
> money)). Then if I modify the defrule to have (event (name 
> ?x)) instead of (?x), it works fine. However, I want to learn 
> how to pattern match ordered facts.
> 
> Sincerely,
> Amit.
> 
> 
> 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: Java Beans

2004-05-21 Thread Alan Moore
Title: RE: JESS: Java Beans





> If that is the case, why is the listener required in any scenario?


If the bean's properties are changed by your java code, jess needs to know about it. Unless your java code calls Rete#modify(), not likely, your bean will need to inform jess via the bean's property change events.

alan


> 
> 
> - Original Message - 
> From: <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Friday, May 21, 2004 1:49 PM
> Subject: Re: JESS: Java Beans
> 
> 
> > I think Brenda K Hamilton wrote:
> > > What I need is to have a Java program, may or may not be a bean, 
> > > load Jess and a set of rules and 'pass' some object, a 
> DOM document 
> > > is a good example, and have the rules process the object. 
>  For a DOM 
> > > document, the processing would take the form of doing a 
> left depth 
> > > first traversal and extract selected information.
> > >
> > > >From the documentation and examples, it seems like 
> objects that are
> > > manipulated by Jess have to provide a change listener and chance 
> > > support.  Is this correct?
> > >
> >
> > There are two different ways to "manipulate" Java objects 
> in Jess. One 
> > way is just as in Java -- writing code that calls methods and 
> > otherwise does things explicitly. There are no requirements 
> at all on 
> > such objects.
> >
> > The other thing you can do is pattern-match on objects -- 
> i.e., write 
> > rules that directly react to them.  Jess can pattern-match 
> objects to 
> > the extent that they are JavaBeans -- i.e., only JavaBean-like 
> > properties can be matched.
> >
> > PropertyChangeEvent support is not required, but if a Bean doesn't 
> > support it, then Jess will be working with a "snapshot" of 
> the object
> > -- if code outside of Jess changes a property of such an 
> object, Jess 
> > won't know about the new value until Rete.reset() or
> > Rete.updateObject() are called. If, on the other hand, a 
> Bean support 
> > PropertyChangeEvents, then Jess will know immediately when such 
> > changes are made.
> >
> > So the answer is no, support for PropertyChangeEvents is 
> not required. 
> > For static objects, such as a tree of XML nodes, they 
> wouldn't matter 
> > even if they were there. PropertyChangeEvents are useful when Beans 
> > are connected to some time-varying information source 
> outside of Jess.
> >
> >
> > -
> > Ernest Friedman-Hill
> > Science and Engineering PSEs    Phone: (925) 294-2154
> > Sandia National Labs    FAX:   (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: Java Beans

2004-05-21 Thread Alan Moore
Title: RE: JESS: Java Beans





> What I need is to have a Java program, may or may not be a 
> bean, load Jess and a set of rules and 'pass' some object, a 
> DOM document is a good example, and have the rules process 
> the object.


The manual has several places where this is documented, see:


Jess Functions:


(batch)
(definstance)
(store)
(fetch)


API docs:


Jesp.parse()
Rete#definstance()
Rete#store()
Rete#fetch()


Also, Ernest's most excellent book has extensive examples of integration between jess and java.


http://www.manning.com/catalog/view.php?book=friedman-hill



> >From the documentation and examples, it seems like objects that are
> manipulated by Jess have to provide a change listener and 
> chance support.  Is this correct?  


(definstance) and Rete#definstance() both allow either dynamic (beans that support PropertyChangeEventListern interface) or static java objects.

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: keeping jess in a different file?

2004-05-20 Thread Alan Moore
Title: RE: JESS: keeping jess in a different file?





I use a main.jess (or main.clp if you prefer) in a well known location and my java code just tells jess to parse that file.

In main.jess, I (batch "xyz.jess") all the other rules/files that might be needed.


alan



-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] On Behalf Of MAtt Farmer
Sent: Thursday, May 20, 2004 2:32 PM
To: [EMAIL PROTECTED]
Subject: JESS: keeping jess in a different file?



Thanks Ernest, for your prompt email..:)


I had another question. When using Jess in large java applications, is there a way to store all the rules and facts and stuff in a separate file, so that they can be changed at a 

later date, without affecting the rest of the system. I was thinking maybe we could store them in a  .clp file and then just call that from java to set up the rules and facts///

and then they can run when run is called.
I need some opinion on this.


Thanks much,
~Matt.. 



Do you Yahoo!?
Yahoo! Domains - Claim yours for only $14.70/year





RE: JESS: Newbie Problem running Jess

2004-03-24 Thread Alan Moore
Title: RE: JESS: Newbie Problem running Jess





> As an aside, Jess actually *can* execute operating-system commands for 
> you using the "system" command:
>
> Jess> (system java -classpath jess.jar jess.Main examples/fullmab.clp)
>
> would run the example in a new Java Virtual Machine, which would then 
> exit, returning you to original Jess command prompt.


OK


I am in Jess at the Jess prompt.


I type


(system java -classpath jess.jar jessMain Jess61p6/examples/fullmab.clp)


[alan]
This isn't something you would normally do. I think Ernest was just letting you know that it is *possible* to run a system command (i.e. java.exe) from within jess.

>Yet my classpath is set as you instructed as follows
>
>USER var
>CLASSPATH
>;.;C:\Jess\Jess61p6\jess.jar
>
>Path c:\j2sdk1.4.2_04\bin;c:\Sun\AppServer\bin;.;C:\Jess\Jess61p6\jess.jar
>
>System var
>Path %SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;C:\Program
>Files\Sonic\MyDVD;C:\Program Files\Common Files\Adaptec Shared\System;C:\MSSQL7\BINN;C:\Program Files\ATI Technologies\ATI Control Panel;C:\j2sdk1.4.2_04\bin;.;C:\Jess\Jess61p6\jess.jar

[alan]
By having c:\Jess\Jess61p6\jess.jar in your CLASSPATH environment variable, you can run jess from anywhere. In this case, I think you ran it from c:\Jess, not from c:\Jess\Jess61p6 so your "relative" path would be rooted at c:\Jess and requires you to include the Jess61p6 prefix like so:

c:\Jess>java jess.Main Jess61p6/examples/fullmab.clp


note: c:\Jess> is the MS-DOS prompt, not jess' jess> prompt.


To reduce confusion about which prompt you are looking at, try setting your PROMPT environment variable to something like "CMD:" like so:

set PROMPT=CMD:


It is generally not a good idea to have the "current directory" in your CLASSPATH. Before you know it, you will be picking up classes from all kinds of unintended places. In fact, I'd even go so far as to suggest not depending on the CLASSPATH environment variable at all. You can create a batch file to run the jess examples that forces your environment to be well known and explicit.

rem  RunJessExample.bat 
set CLASSPATH=
set JESS_HOME=c:\Jess\Jess61p6
java -classpath $JESS_HOME\jess.jar jess.Main $JESS_HOME/examples/%1


With this, you should be able to type:


CMD:RunJessExample.bat fullmab.clp


Also, having jess.jar on your PATH is not very useful.


Good luck!


alan





RE: JESS: Re: Charlemagne engine preview

2004-03-24 Thread Alan Moore
Title: RE: JESS: Re: Charlemagne engine preview





>> Also, is there any pre-release documentation on the use of the 
>> "single-slot-activation" feature?
>
>Download the software, and look in the release notes from the manual:
>
>  The "slot-specific" declaration for templates.  Deftemplate
>  definitions can now include a "declare" section just as defrules
>  can. There are several different properties that can be declared. One
>  is "slot-specific". A template with this declaration will be matched
>  in a special way: if a fact, created from such a template, which
>  matches the left-hand-side of a rule is modified, the result depends
>  on whether the modified slot is named in the pattern used to match the
>  fact. As an example, consider the following:


So how does this work for defclass? Can we supply a declare section in the defclass and it will be propagated to the generated deftemplate or do we need to create another deftemplate that extends the defclass?

alan





RE: JESS: Re: Charlemagne engine preview

2004-03-23 Thread Alan Moore
Title: RE: JESS: Re: Charlemagne engine preview





>> 2. XML syntax and API for creating rules. This will make things a lot 
>> simpler when we eventually need to create our own rule syntax. Haven't 
>> looked at this in detail yet, but one minor sugestion: Instead of 
>> name="MAIN::foo", name="foo" package="MAIN" may be easier to deal with 
>> in many situations.
>
>
>Yes, you're right. Actually, just the regular Jess API should work this way too, but unfortunately >it gre in a different direction. 

>
>I was actually thinking of
>
> 
>   
>
> with modules that could be opened and closed as needed. Which is better, do you think?


[alan]
For what its worth, I once heard Don Box (of Develop Mentor & SOAP fame) comment that the one thing he learned from doing SOAP and using XML/Schema was to not use attributes for data, only meta-data. I don't know if I interpreted his comment correctly or whether the general principle applies here but following that advice would result in:

   
  MAIN
  
 foo
  
   


This is obviously more verbose and cumbersome for humans but might be better suited to automation of various sorts (e.g. XSL transforms, DTD/Schema validation, etc.) The content model of attributes is rather simple and not very extensible.

I guess it all depends on who you expect to produce and consume the XML and how much or what kinds of extensibility is required. I'm not sure in this case that the extra structure is worth hassling with or that there is a compelling use case to support it's overhead.

> 
> >From what I can see there isn't any new functionality for better
> handling of java.util.Collections or automatically asserting nested 
> objects, but I gave up working with complex objects quite a while ago 
> anyways :-)


>Not yet, but it's coming.


[alan]
Great!


Also, is there any pre-release documentation on the use of the "single-slot-activation" feature?





RE: JESS: Jess Examples

2004-03-18 Thread Alan Moore
Title: RE: JESS: Jess Examples





Robert,


I can't share my code with you because it is the property of my employer.


If you have a specific problem, go ahead and post it to the list and often times you will get "sample code" in a response. 

Also, troll the list archives as there is a lot of discussion/code that has accumulated there over the years.


alan


-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] On Behalf Of Robert Brown
Sent: Thursday, March 18, 2004 12:19 PM
To: [EMAIL PROTECTED]
Subject: JESS: Jess Examples



Hello all,


I was wondering where I could find additional Jess examples other than in the examples folder or "Jess in Action?"


Thanks



Robert Brown, CCIE





RE: JESS: JESS web service

2004-03-09 Thread Alan Moore
Title: RE: JESS: JESS web service





I've created web services (e.g. SOAP services) that use jess internally but there is nothing special about them. The code that uses jess is just like any other java program, just that it is invoked via a SOAP packet.

I used Apache Axis to create the services. If you are planning to use Axis and your web service API needs to maintain jess/state across more than one method invocation, you might want to look into the Axis "session scope" service deployment option. You can keep an instance of jess around in the service object (or in the underlying HttpSession object) so that your methods can access jess and maintain state across your API method calls.

Good luck!


alan


-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] On Behalf Of [EMAIL PROTECTED]
Sent: Tuesday, March 09, 2004 9:06 AM
To: [EMAIL PROTECTED]
Subject: Re: JESS: JESS web service



No.  But I did use CLIPS a a configurator for a [once] popular computer maker in Dakota.  As you selected pc components on their website, the configurator insured that the selected parts were compatible.  Although the implementation might vary, conceptually the design would be similar when using Jess.

> 
> From: "Duncomb Robert Contr AFRL/IFSA" <[EMAIL PROTECTED]>
> Date: 2004/03/09 Tue AM 09:13:55 EST
> To: "'[EMAIL PROTECTED]'" <[EMAIL PROTECTED]>
> Subject: JESS: JESS web service
> 
> Has anyone used JESS in developing a web service?  I'd be interested 
> in knowing the application and implementation details.
> 
> Bob Duncomb
> 
> 
> 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: Case Based Reasoning with Rules

2004-02-27 Thread Alan Moore
Way back in the day (circa 1990), I worked on the ICADS (now called CADRC)
project at CalPoly SLO that did similar things for Architectural design CAD
systems. Pretty cool...

See:

http://www.cadrc.calpoly.edu/

I'm sure this can be done for other domains as well.

alan

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On
Behalf Of Jason Morris
Sent: Friday, February 27, 2004 4:04 PM
To: [EMAIL PROTECTED]
Subject: RE: JESS: Case Based Reasoning with Rules


Hi Rich,

Hybrid (case-based/rule-based) systems are an absolutely fascinating
concept, and I have been wondering about their implications and
possibilities for some time also.

My original interest in expert systems came by way of involvement in
developing online performance-support tools for mid-range, computer-aided
design software.  My though was:  Why can't CAD software really help an
engineer do "engineering" while he or she is creating geometry.  Right now,
CAD tools are reaching a feature-functionality parity where they basically
do all the same things inside the same performance envelope.  I was looking
for innovative product differentiators, and I saw an opportunity to add real
design intelligence to the tools.

As an example, picture a CAD tool that could:

[]  Interactively and in real-time monitor your geometry creation and point
out potential stress concentrations, point out violations of ASME  or
company standards, or other conflicts with other design constraints not
related to geometry.

[] Apply "design patterns" from existing designs or "best-practices" (use
cases), or compare geometry creation intent to standard
design-for-manufacturing (DFM) or design-for-assembly (DFA) principles to
catch problems before they occur, or deduce a best design approach given
company standards and methods (use rules).

Does this sound too far fetched?  I didn't think so then... and with tools
like Jess and FuzzyJess, I certainly don't now.  Is it a big undertaking?
Without question!  I have no illusions about how huge this would be to do.

Management will always say, "That's cool, but what's the business case? What
customer problem are you trying to solve?"  I think that one could claim
that such a system, by folding actual engineering knowledge into the
geometry creation process and leveraging accumulated corporate knowledge,
would:

* Reduce time-to-market by collapsing the overall time to design and
prototype a viable system (promote design reuse).
* Reduce manufacturing and assembly costs by catching conflicts before they
hit the production floor.
* Push risky processes further up the development process where they can be
caught and eliminated quickly before they cause problems down-stream.

Given the esoteric and very non-conventional nature of the proposal,
convincing management about the ROI enough that it ever got funded as a
project was impossible.  I hate to accuse management of being narrow-minded,
but as in most industries, there are long-established ways of doing things
in CAD, and the powers that be were (and are) loath to deviate from
following them.

So, at the time, I didn't have the programming or knowledge engineering
experience to even prototype such a system, but now I do.  I'd give my
eye-teeth to work on such a project!  I'd be very interested to hear your
further thoughts as well as anyone else's on the general hybrid subject.

Q. What companies are applying hybrid systems to mechanical design?  Does
anyone have some examples?

BTW - thanks for all your replies on other threads so far.

-JM
--
Jason Morris
Morris Technical Solutions [EMAIL PROTECTED]
www.morristechnicalsolutions.com
fax/phone: 503.692.1088
-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Behalf Of Rich Halsey
Sent: Friday, February 27, 2004 8:51 AM
To: [EMAIL PROTECTED]
Subject: JESS: Case Based Reasoning with Rules


Hi All,

I have been thinking about Case Based Reasoning (CBR) and it would seem that
if a rule-based system could (1) determine which objects it was matching on,
(2) use Java reflection to list the object methods used for the predicates,
and (3) retrieve within some repository all the objects that fit  (1) and
(2)  and assert them into working memory, then CBR would be a natural
extension of a rule-based system.

Any thoughts ??

Rich Halsey


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: Creating functions with the same name

2003-11-21 Thread Alan Moore
Not sure if this helps you but...

While (deffunctions) cannot be overloaded, you can write a Userfunction (in
Java) which receives a variable number of arguments via the ValueVector
parameter.

alan

-Original Message-
From: [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: 11/21/2003 5:34 AM
Subject: Re: JESS: Creating functions with the same name

I think Sander Rensen wrote:
> 
> My question is, if it is possible to make 2 functions with the same
name, but not with the same arguments ??
> 

No. You can't have overloaded deffunctions.



-
Ernest Friedman-Hill  
Science and Engineering PSEsPhone: (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: Help on Jess under the hood! :) ..

2003-11-05 Thread Alan Moore
For a graphical view of a modern Rete network try:

(load-package jess.ViewFunctions)
(view)

alan

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Behalf Of Dusan Sormaz
Sent: Wednesday, November 05, 2003 4:50 PM
To: [EMAIL PROTECTED]
Subject: Re: JESS: Help on Jess under the hood! :) ..


Let me make acomment on Rete network.

Though, algorithm is rather old, 20 years, not many books gave examples and
graphs of the network. Few exceptions are:
Brownston at all, Programming Expert Systems in OPS5, Addison, 1985
Russel, Norvig, AIMA, Prentice, 1995
Freidman, JIA, Manning, 2003

Dusan Sormaz

At 04:15 PM 11/5/2003 -0800, you wrote:

I think =?ISO-8859-1?Q?Antonio_Avi=F1a?= wrote:
> 

First, let me suggest you read chapter 8 of the manual or
(coincidentally) the chapter with the same number in "Jess in Action",
because they answer all these questions. The rest of the manual (and
especially of the book) contains lots more information about how Jess
works. 


[.. rest omitted ...]


***
* Dusan Sormaz, 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: Jess routers

2003-10-17 Thread Alan Moore
With just the (printout) command, I was able to print the values on the
webpage. But after adding the codes to execute a clips file, the
following error came up.

org.apache.jasper.JasperException: Error on input stream

[alan]
A full stack trace (including nested cause) would help us help you.


-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
On Behalf Of [EMAIL PROTECTED]
Sent: Friday, October 17, 2003 11:33 PM
To: [EMAIL PROTECTED]
Subject: Re: JESS: Jess routers

I think Anthony Wong wrote:
> Hi. I'm trying to get the 'printout' from Jess statement and put them
> into JSP. Does anyone have any example on that? Need some help.
> 
>  
> 
> Supposedly, I have this command in the clips file - (printout t "Hello
> World' crlf) on the RHS of a rule. Would it be possible to get this
> output "Hello World" on the web page? 
> 
>  
> 
> I had tried the following. The example I had were pretty similar to
the
> TekMart from the book Jess in Action. I have the same BaseServlet to
> initialize the Rete object and to make a batch call to the clips file.
> 


Well, what you're doing here looks OK except that if this code is
cut-and-pastes, then you're not issuing any printouts between defining
the router and forwarding the request, so the string will be
empty. You have to define the router -before- printing to it, just
like you have to open a file -before- writing data into it.


>  
> 
> Then I have another servlet, say TestRequest
> 
>  
> 
> checkInitialized();
> 
>
> 
>   ServletContext servletContext = getServletContext();
> 
>   Rete engine = (Rete) servletContext.getAttribute("engine");
> 
> 
> 
>   StringWriter sw = new StringWriter();
> 
>   engine.addOutputRouter("t", sw);
> 
>
> 
>   String myString = sw.toString();   
> 
>   request.setAttribute("testString", myString);
> 
>
> 
>   dispatch(request, response, "/test.jsp");
> 
>  
> 
> on test.jsp, I have
> 
>  
> 
> <%= request.getAttribute("testString").toString() %>
> 
>  
> 
> Does any of the above make sense?
> 
>  
> 
> Thanks.
> 
>  
> 
> Anthony
> 
>  
> 



-
Ernest Friedman-Hill  
Distributed Systems ResearchPhone: (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]



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 article at TheServerSide

2003-10-08 Thread Alan Moore
Good to see Jess getting wider exposure. Are you going on a speaking tour
next?

How about a series of "No Fluff, Just Jess" conferences ;-D

alan

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Sent: Tuesday, October 07, 2003 1:55 PM
To: Jess Mailing List
Subject: JESS: Jess article at TheServerSide


Hi Folks,

There's a new Jess article (actually an excerpt adapted from the book)
at http://www.theserverside.com/resources/article.jsp?l=Jess .

-
Ernest Friedman-Hill  
Distributed Systems ResearchPhone: (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]




Aspects and rules (was RE: JESS: Jason Morris interview)

2003-10-02 Thread Alan Moore
Right on. Good interview - I like the bits about "back to the future" ;-D

Speaking of the future, I was lurking on aosd-discuss and the discussion:

http://aosd.net/pipermail/discuss/2003-August/000887.html

was about event vs. aspect oriented programming and I posted asking about
how those compare to rule based programming. A paper by Filman and Friedman
(no relation?) was quoted as saying:

Long quote from:
http://ic.arc.nasa.gov/~filman/text/oif/aop-is.pdf

"Rule-based systems like OPS-5[4] or, to a lesser extent, Prolog are
programming with purely dynamically quantified statements... If we all
programmed with rules, we wouldn't have AOP discussions. We would just talk
about how rules that expressed concerns X, Y, and Z could be added to the
original system, with some mention of the tricks involved in getting those
rules to run in the right order and to communicate with each other. The base
idea that other things could be going on besides the main flow of control
wouldn't be the least bit strange.

But by and large, people don't program with rule-based systems... They've
destroyed the fundamental sequentially of almost everything. The sequential,
local, unitary style is really very good for expressing most things. The
cleverness of classical AOP is augmenting conventional sequentially with
quantification, rather than supplanting it wholesale."

R.E. Filman and D.P. Friedman, "Aspect-Oriented Programming is
Quantification and Obliviousness", Workshop on Advanced Separation of
Concerns, OOPSLA 2000, October 2000, Minneapolis.

As it turns out, it isn't as hard as all that - especially with jess. It
appears that these are complimentary rather than conflicting technologies.

Aspects help create events or the aforementioned control structures from
which rules can reason. The noisy work of maintaining "computed" value/state
can also be lifted out the rules and data model and sliced in via aspects
leaving a cleaner rule set. Rule oblivious components can be easily
integrated via aspects - today.

"What are you waiting for?" (tm)

alan

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Sent: Wednesday, October 01, 2003 6:18 PM
To: Jess Mailing List
Cc: [EMAIL PROTECTED]
Subject: JESS: Jason Morris interview


Hi all,

Jason Morris has done an interview with me that he's prepping for
publication; you can see an excerpt along with a handsome photograph
of yours truly at http://www.morristechnicalsolutions.com/ .

-
Ernest Friedman-Hill  
Distributed Systems ResearchPhone: (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: AW: JESS: Working with collections

2003-09-17 Thread Alan Moore
This might be a good application for aspects (e.g. aspectj) or any of the
various byte code weaving tools.

I've often thought about jess' requirement on definstanced (dynamic) objects
to implement property change events. This *could* be implemented at runtime
by byte code weaving for existing objects that doesn't fire property change
events. Obviously, this complicates the class loading issues in some
environments, but for simple applications it just might do the trick.

There are lots of other possibilities that wouldn't be all that hard to
implement and would be a good fit between aspects and jess. One could
automatically, for example, definstance all objects of a particular type or
that matched a given pattern, etc. by using aspects.

For details on aspectj see:

http://www.aspectj.org

alan

-Original Message-
From: Mark Egloff [mailto:[EMAIL PROTECTED]
Sent: Wednesday, September 17, 2003 1:33 PM
To: [EMAIL PROTECTED]
Subject: AW: AW: JESS: Working with collections




-Urspr|ngliche Nachricht-
Von: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Im
Auftrag von [EMAIL PROTECTED]
Gesendet: Dienstag, 16. September 2003 23:21
An: [EMAIL PROTECTED]
Betreff: Re: AW: JESS: Working with collections


>The idea of creating standard wrappers for various Collections is a
>reasonable one. It won't help people who will want to be able to use
>unwrapped Collection objects, too, but it's a reasonable approach.

I don't see any other possibilities; otherwise you have to extend the
underlying JVM ;). 

However, I also think you don't need too many wrappers. Most collection
types are working properly with the Collection Interface, so I suggest
to do the following wrappers:

- Collection
- Iterator (may be not needed)
- Map
- Bean Wrapper (works internally with Java Reflection)

This should be enough for the first release. But may be there are more
So if somewhere is out there, add your comments.

Regards
Mark


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: Finding Facts by name within a Jess User Defined Functi on

2003-09-11 Thread Alan Moore
Correction: 

"JIA book section 17.7"

should read:

"JIA book section 7.7"

As it turns out, section 17.7 also discusses (defquery) - a lucky
coincidence.

alan

-Original Message-----
From: Alan Moore 
Sent: Thursday, September 11, 2003 10:44 AM
To: '[EMAIL PROTECTED]'
Subject: RE: JESS: Finding Facts by name within a Jess User Defined Functi
on


Use (defquery)

See the manual:

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

or the JIA book section 17.7

alan

-Original Message-
From: Jim VanDragt [mailto:[EMAIL PROTECTED]
Sent: Thursday, September 11, 2003 10:09 AM
To: [EMAIL PROTECTED]
Subject: JESS: Finding Facts by name within a Jess User Defined Function



I want to write a function that needs to find a fact by name. For example I
need to find the fact "MAIN::work-surface" and evaluate it's slot values.
Is there a way to search through all the facts to find a certain one? 

  f-0   (MAIN::initial-fact) 
  f-1   (MAIN::vocabulary (product work-surface)) 
  f-2   (MAIN::work-surface (shape rectangular) (product-line 2) (depth
24) (width 62) (order-string "Z2R,BUL,G4,62,24E,1X,CO,ED") (shape-code R)
(top-material L) (top-finish 1X) (top-finish-entered not-defined)
(front-edge E) (front-edge-finish ED) (side-edge not-defined)
(side-edge-finish CO) (secondary-finish BU) (b ack-edge-cord-drop G4)
(support-type not-defined)) 
  For a total of 3 facts. 

TIA 

Jim Van Dragt
Herman Miller Inc.
(616) 654-5285


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: Finding Facts by name within a Jess User Defined Functi on

2003-09-11 Thread Alan Moore



Use (defquery)
 
See 
the manual:
 
http://herzberg.ca.sandia.gov/jess/docs/61/language.html#queries
 
or the 
JIA book section 17.7
 
alan
 
-Original Message-From: Jim VanDragt 
[mailto:[EMAIL PROTECTED]Sent: Thursday, September 11, 
2003 10:09 AMTo: [EMAIL PROTECTED]Subject: JESS: 
Finding Facts by name within a Jess User Defined 
FunctionI want to write a 
function that needs to find a fact by name. For example I need to find the fact 
"MAIN::work-surface" and evaluate it's slot values.  Is there a way to 
search through all the facts to find a certain one?       f-0   
(MAIN::initial-fact)     
  f-1   (MAIN::vocabulary (product work-surface))       f-2   (MAIN::work-surface 
(shape rectangular) (product-line 2) (depth 24) (width 62) (order-string 
"Z2R,BUL,G4,62,24E,1X,CO,ED") (shape-code R) (top-material L) (top-finish 1X) 
(top-finish-entered not-defined) (front-edge E) (front-edge-finish ED) 
(side-edge not-defined) (side-edge-finish CO) (secondary-finish BU) (b 
ack-edge-cord-drop G4) (support-type not-defined))       For a total of 3 facts. 
TIA Jim Van DragtHerman Miller Inc.(616) 
654-5285


RE: JESS: Defrule ordering woes

2003-09-05 Thread Alan Moore
Opps, sorry. I didn't think I was implying that jess isn't threadsafe.

Quite the opposite, my experience has been that jess is *more* threadsafe
than my own code D-;

alan

-Original Message-
From: [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: 9/5/2003 11:24 AM
Subject: Re: JESS: Defrule ordering woes

I think Alan Moore wrote:
> 
> I've employed this pattern repeatedly and it works like a charm. Throw
in a
> FutureResult for good measure and you've got a fast, reliable,
thread-safe
> system.

This is indeed a good way to get the grouping semantic we're talking
about; I did want to point out that Jess is normally thread-safe
anyway even if assertions and rule-firings happen in different
threads (just in case anyone got a different impression from your
message.)  

> 
> alan
> 

-
Ernest Friedman-Hill  
Distributed Systems ResearchPhone: (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: Defrule ordering woes

2003-09-04 Thread Alan Moore
> My only concern is whether to expose the complexity to the user. On
> the one hand, control is good; on the other hand, hard-to-understand
> features don't get used. Here, I'm tempted to simply make the entire
> RHS of every rule "atomic" in this sense, w.r.t. the agenda, because,
> consider this: no other rules can fire, anyway, while a rule is
> firing; the atomicity will -only- affect performance, not any
> observable behavior.

This works for threads running rules and asserting/definstancing on the RHS.
If a thread that isn't firing a rule does multiple asserts or definstances
then it won't benefit from the RHS agenda locking.

One way to work around this is to:

1) Create a single object to contain all the data elements that need to be
placed into working memory.

2) Definstance that object in the context of the non-rule-firing thread.

3) Let a rule, running on the runUntilHalt() thread, do the asserts or
definstances of the various data elements as required.

This way, all mods to working memory and all rule firing is done by the
runUntilHalt() thread - except, of course, for the definstance in step 2.
This data element holding object is, in effect, a transaction object usually
with a name like MyXYZRequest or My123Event.

I've employed this pattern repeatedly and it works like a charm. Throw in a
FutureResult for good measure and you've got a fast, reliable, thread-safe
system.

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: Enhancement request - (import)

2003-09-04 Thread Alan Moore
Would it be possible to have the (import) function fail or give a warning
when the specified package and/or class doesn't exist. Currently,

(import com.package.doesnt.exist.MyMispeledClass)

doesn't give any indication that something is wrong.

alan

Alan Moore - mailto:[EMAIL PROTECTED]
Ciphergen Biosystems - http://www.ciphergen.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]




RE: JESS: Defrule ordering woes

2003-09-03 Thread Alan Moore
Sorry to revisit this issue but I had a couple of comments. See below.

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Sent: Monday, August 25, 2003 8:12 PM
To: [EMAIL PROTECTED]
Subject: Re: JESS: Defrule ordering woes



Now, the underlying Jess behavior that causes this is something we've
talked about on the list before.  Basically, what Jess does now is
allow rules to initiate firing on one thread during pattern matching
occurring on another thread; if a single fact activates three rules,
then the first activation can fire before the second rule is even
placed on the agenda. This has very good liveness characteristics, but
leads to inversions like what Mitch is seeing here.

An alternative is for the agenda to be locked during pattern-matching,
so that the run-until-halt thread would not be able to pop an activation
from the agenda until after all the activations from a single
assertion event were present. This would make Mitch's problem go away,
but with a potential performance loss in densely multithreaded
operation.

Anyone want to comment?

[alan]
Could you selectively lock the agenda on a per-assert basis by having the
thread asserting facts be able to run a "transaction" during which the
agenda is locked?

This could be done explicitly like this:

(defrule abc
...
=>
   ((engine) startTransaction)
   (assert (123))
   (assert (456))
   ((engine) endTransaction)
)

or like this:

(defrule abc
...
=>
   (transaction
  (assert (123))
  (assert (456))
   rollback
  (...)
   )
)

Another possibility - since the (assert) function can take more than one
fact, it could be extended to assert all the supplied facts atomically like
so:

   (assert (?fact1) (?fact2) TRUE) ; optional "atomic" argument

In addition, a new jess API method could be added to take an array of Facts
like so:

   Rete#assertFacts( Fact[] factArray, Context context, boolean atomic );

to match the modified behavior of (assert).

BTW - there isn't an Rete#assertFacts(Fact[] facts, Context context ) method
to mirror the existing behavior of (assert).

I know I'm referring to multiple facts being asserted but I think the
problem of "salience/agenda inversion" for a single fact can be generalized
to more than one fact.

The granularity allowed here is similar to field/record/table/database level
locking in databases. FWIW, an interesting high-concurrency approach found
in PostgreSQL is described here:

http://www.linuxgazette.com/issue68/mitchell.html

My 2cts worth.

alan


I think Mitch Christensen wrote:
[Charset iso-8859-1 unsupported, filtering to ASCII...]
> Hey,
> 
> I'm having trouble understanding why reordering 'defrule' statements in a
> Jess script changes how the program runs.
> 
> Specifically, I've created a UserFunction timer that asserts a
> 'temporal-event' fact every second (source attached).  Then I have a
simple
> Jess script (also attached) that loads and executes the UserFunction, and
> then defines 3 debugging rules.  These rules do a printout at each second,
> quarter-minute and minute (there is also a rule to retract old facts).
> 
> My problem is that the seconds rule always fires, while quarter-minute and
> minute rules are sporadic (sometimes they fire sometimes not).  If I
simply
> re-order the rules, putting the minute rule first, the quarter-minute rule
> next and the second rule last, things seem to work fine.
> 
> Now, if I understood why, I'd be in pretty good shape. ;)
> 
> Any suggestions?
> 
> -Mitch
> 
> P.S. 'ctm' is for CurrentTimeMillis.  It's the only way I could find to
keep
> rules from firing more than once, i.e. "only fire if this fact has the
> lowest ctm in working memory" and to fire in the proper order should
> multiple temporal-event facts be asserted between (runs).
> 

[Attachment, skipping...]

[Attachment, skipping...]



-
Ernest Friedman-Hill  
Distributed Systems ResearchPhone: (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: "Single-slot activations"

2003-08-28 Thread Alan Moore
Another question...

Given patterns like:

(defclass MyObject com.myco.MyObject (activate PER-SLOT))

(defrule does-this-match
   (MyObject)
=>
)

(defrule should-activate-when-object-exists
   (other)
   (not (MyObject))
=>
)

How would these patterns work? Since *no* slots are mentioned it isn't clear
what would happen.

alan

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Sent: Wednesday, August 27, 2003 8:28 PM
To: Jess Mailing List
Subject: JESS: "Single-slot activations"


Hi Folks,

So I've got a partial implementation of this thing we've been calling
"single-slot activations"; this is the Jess mode in which if a fact is
matched by a rule, and some slot in that fact which is not explicitly
mentioned in the rule's patterns is modified, the rule's activation
state is unchanged.

This is going to be a property of certain deftemplates --
i.e., you can say

  (deftemplate foo (declare (xyzzy TRUE)) (slot x) (slot y))

to get a template that will behave this way. 

My dilemma: I don't have a catchy name for this. I actually have been
coding it up using the nonce word "xyzzy", just as shown in the
example. What should this be called instead? "single-slot-activation"
is kind of ungainly. I want to change this, finish the implementation,
and have a "technology preview release" to let people play with it and
get some feedback. Suggestions welcome.

-
Ernest Friedman-Hill  
Distributed Systems ResearchPhone: (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: "Single-slot activations"

2003-08-28 Thread Alan Moore
How about:

(declare (activation SLOT|TEMPLATE))

or

(declare (activate PER-SLOT|PER-TEMPLATE))

or something similar.

I suggest that you don't use the boolean form because, in the future, you
might decide to add another activation strategy:

(declare (activation SLOT|TEMPLATE|KARMA))

Also, how will this work with the automatically generated deftemplates for
java classes? Can we specify this somehow when using (defclass)?

alan

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Sent: Wednesday, August 27, 2003 8:28 PM
To: Jess Mailing List
Subject: JESS: "Single-slot activations"


Hi Folks,

So I've got a partial implementation of this thing we've been calling
"single-slot activations"; this is the Jess mode in which if a fact is
matched by a rule, and some slot in that fact which is not explicitly
mentioned in the rule's patterns is modified, the rule's activation
state is unchanged.

This is going to be a property of certain deftemplates --
i.e., you can say

  (deftemplate foo (declare (xyzzy TRUE)) (slot x) (slot y))

to get a template that will behave this way. 

My dilemma: I don't have a catchy name for this. I actually have been
coding it up using the nonce word "xyzzy", just as shown in the
example. What should this be called instead? "single-slot-activation"
is kind of ungainly. I want to change this, finish the implementation,
and have a "technology preview release" to let people play with it and
get some feedback. Suggestions welcome.

-
Ernest Friedman-Hill  
Distributed Systems ResearchPhone: (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: Defrule ordering woes

2003-08-27 Thread Alan Moore
You are going to hate me for suggesting this, but... how about the
do-it-both-ways option - "make it configurable".

(defrule xyz
   (declare (affinity global|module|thread|...))
)

or something like that. A configurable default behavior would also be handy.

Another option, similar to the existing Strategy interface, is to delegate
to an interface which can be overridden by the application (e.g. replace the
existing HeapPriorityQueue.)

I've run into the inversion myself and had to create/manage facts that
control the rule firing. It would be great to be able to get rid of that
noise.

alan

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Sent: Monday, August 25, 2003 8:12 PM
To: [EMAIL PROTECTED]
Subject: Re: JESS: Defrule ordering woes


Basically, the problem is that salience doesn't mean much in a
multithreaded system. A rule may have very low salience, but if it is
activated before other rules of higher salience are activated, then it
may be fired (on the run thread, different from the thread where the
rule was activated) before those other rules have a change to displace
it from the top of the agenda.

In this case, your low-salience delete-timer-events rule is firing as
fast as the new facts appear, before the quarter-minute and minute
rules have a chance to fire. delete-timer-facts matches every
temporal-event fact as soon as it appears, and furthermore, the
patterns are identical to those of the rule show-seconds, so both of
those are being activated together, and salience makes show-seconds
fire first. But the other two rules have slightly different patterns,
so they're activated at a slightly different time (the order here is
arbitrary and, as you've seen, depends on the order in which the rules
are defined.)

One more definite solution, rather than yours which depends on
undefined behavior, is to modify delete-timer-facts so that it allows
a few timer facts to stay around before deleting them -- i.e.,
something like 

(defrule delete-timer-events "Delete any old temporal-event facts"
(declare (salience -100))
?t <- (temporal-event (ctm ?ctm))
(not (temporal-event (ctm ?ctm2&:(> (- ?ctm 1) ?ctm2
=>
;;(printout t "Retracting " ?t crlf)
(retract ?t))

Now, the underlying Jess behavior that causes this is something we've
talked about on the list before.  Basically, what Jess does now is
allow rules to initiate firing on one thread during pattern matching
occurring on another thread; if a single fact activates three rules,
then the first activation can fire before the second rule is even
placed on the agenda. This has very good liveness characteristics, but
leads to inversions like what Mitch is seeing here.

An alternative is for the agenda to be locked during pattern-matching,
so that the run-until-halt thread would not be able to pop an activation
from the agenda until after all the activations from a single
assertion event were present. This would make Mitch's problem go away,
but with a potential performance loss in densely multithreaded
operation.

Anyone want to comment?


I think Mitch Christensen wrote:
[Charset iso-8859-1 unsupported, filtering to ASCII...]
> Hey,
> 
> I'm having trouble understanding why reordering 'defrule' statements in a
> Jess script changes how the program runs.
> 
> Specifically, I've created a UserFunction timer that asserts a
> 'temporal-event' fact every second (source attached).  Then I have a
simple
> Jess script (also attached) that loads and executes the UserFunction, and
> then defines 3 debugging rules.  These rules do a printout at each second,
> quarter-minute and minute (there is also a rule to retract old facts).
> 
> My problem is that the seconds rule always fires, while quarter-minute and
> minute rules are sporadic (sometimes they fire sometimes not).  If I
simply
> re-order the rules, putting the minute rule first, the quarter-minute rule
> next and the second rule last, things seem to work fine.
> 
> Now, if I understood why, I'd be in pretty good shape. ;)
> 
> Any suggestions?
> 
> -Mitch
> 
> P.S. 'ctm' is for CurrentTimeMillis.  It's the only way I could find to
keep
> rules from firing more than once, i.e. "only fire if this fact has the
> lowest ctm in working memory" and to fire in the proper order should
> multiple temporal-event facts be asserted between (runs).
> 

[Attachment, skipping...]

[Attachment, skipping...]



-
Ernest Friedman-Hill  
Distributed Systems ResearchPhone: (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 pr

RE: JESS: Problems Combining Jess Variables

2003-08-27 Thread Alan Moore
Try:

 (bind ?combinded-ostring (str-cat ?ostring ?answer))

alan

-Original Message-
From: Jim VanDragt [mailto:[EMAIL PROTECTED]
Sent: Tuesday, August 26, 2003 6:51 PM
To: [EMAIL PROTECTED]
Subject: JESS: Problems Combining Jess Variables



Good Evening All, 

I'm attempting my first Jess script tonight and need a little help.  I'm
trying to create a new variable (see Problem Line below) by combining
?ostring and ?answer. When I (run) this batch file I receive a Jess error
(see below). 

How do you combine to variables such as ?ostring and ?answer ? 

TIA 




--- Script Snippet  

(deftemplate work-surface 
(slot shape (default rectangular)) 
(slot product-line (default not-defined)) 
(slot order-string (default Z)) 
(slot shape-code (default R)) 
(slot top-material (default not-defined)) 
(slot front-edge (default not-defined)) 
(slot question-to-ask (default product-line)) 
) 


(defrule rectangular-work-surface-front-edge-laminate "For top material
Laminate" 
(vocabulary (product work-surface)) 
?ws <- (work-surface (shape rectangular) (order-string ?ostring)
(question-to-ask ?question) (top-material l)) 
(test (eq ?question front-edge)) 
  => 

(printout t crlf "Select Front Edge Material" crlf) 
(printout t "===" crlf) 
(printout t "A - Square-Edge Front, Vinyl" crlf) 
(printout t "C - Square-Edge Front, Wood" crlf) 
(printout t "D - Bullnose Front, Laminate" crlf) 
(printout t "E - Bullnose Front, Wood" crlf) 
(printout t "F - Bullnose Front, Vinyl" crlf) 
(printout t "G - Passage Edge Front, Vinyl" crlf) 
(printout t "K - Contoured Edge Front, Vinyl" crlf) 
(printout t "" crlf) 


(bind ?answer (read)) 

(modify ?ws (top-material ?answer) (question-to-ask nil)) 
(bind ?combinded-ostring (+ ?ostring ?answer))<<<
 Problem Line 

) 


--- Error Snippet -- 

Jess reported an error in routine Value.numericValue 
... 
  Message: Not a number: "Z" (type = ATOM). 
  Program text: ( batch /jess61p4/jimsjess/firstone.clp ) 
. 




Jim Van Dragt
Herman Miller Inc.
(616) 654-5285


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: Newbie problem description and help request

2003-07-21 Thread Alan Moore
The new "Jess in Action" book has a number of examples that can help you.

The hardcopy isn't available yet, but the e-book works great for me!

alan


-Original Message-
From: PECK, JOSH (SBCSI)
To: '[EMAIL PROTECTED]'
Sent: 7/21/2003 7:01 AM
Subject: JESS: Newbie problem description and help request


Hi,

I believe that I've got a rules-engine problem that JESS would be a good
fit
for, but I wanted to get some additional input.  I've gone through the
JESS
documentation and have a basic understanding of how the system works.
Unfortunately, I've been programming in an object oriented and
procedural
manner for so long, that it's difficult for me to visualize how to
approach
problems in a declarative framework like JESS.

Problem statement:

I would like to develop an expert system that can notify customers which
Packages and Products they can purchase based on their pre-existing
Package
and Product selections.  

Packages are simply lists of Products and/or other Packages.  Below,
Packages are denoted as "Package-n" and Products are just single
alpha-characters, a,b,c, etc.  Package contents are static and cannot be
changed by the user.  However, over time, new Packages, Products, and
rules
will be added, modified, deleted, etc.

Inputs:

1)  A list of packages and products that a customer already has
selected.

Example:  

Package-1:  x, y, z
Package-4:  a, b, c, Package-2
t
s

2)  A list of Packages and/or Products that a customer wants to
purchase:

Example:  

Package-5:  d, e, f, Package-3
w
x
q


Rules:

Rules exist that disallow, require, or modify Package and Product
description. 

Rule-1:  If customer has Package-1 they CANNOT select Products w
and
q separately, or in another Package.
Rule-2:  If customer has Package-1 they CANNOT select Package-10
Rule-3:  If customer has Package-4 they MUST have Package-1
Rule-4:  Customers in California can only have Packages-1
through
Package-5
Rule-5:  Customers with promo code 12345 get a 10% discount on
Package-3
etc

Output:

1) TRUE:  Everything matches ok, no need to change selection
2) FALSE:  There are some conflicts.  These are:  (list some text or
code
that describes conflict)


% % % %

I know that JESS can tackle this problem, but will it be relatively
efficient (as compared to just writing it in straight Java, looping over
if/thens, etc) ?  Also, if someone could help me get started with a
basic
approach description, that would be fantastic.  I think I can build
facts
and structures in JESS that represent the Packages and Products ok, it's
the
rules and functions that would make it run that I'm having trouble with
:)

Note:  Rules-4 and 5 listed above are more advanced and I can probably
figure them out if I get the basic system set up.


Thanks (a lot) in advance,
Josh Peck


P.s. So far I've found the system very easy to use and very well
documented.
Installing JESS and running the examples was a breeze.  I'm really
impressed
with the tool so far!  Very nicely done.  I really hope that I can use
it
for my application.
   


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: Open Source Java IDE

2003-06-30 Thread Alan Moore
I prefer NetBeans (http://www.netbeans.org) primarily because it does other
things besides java, e.g. .jsp/html editing.

Maybe I haven't downloaded all the right bits for eclipse so there might be
some plug-ins I don't know about yet.

alan

-Original Message-
From: [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: 6/30/2003 7:38 AM
Subject: Re: JESS: Open Source Java IDE

I think sorokinru wrote:
> Hello jess-users,
> 
>   I understand that this question is not quite correct, but I whant to
>   know jess-users opinion that I rate much highly. Shortly, what is a
>   best free open-source Java IDE?
> 


Eclipse (www.eclipse.org) is the best open-source IDE, without
question. The editor is very nice and very smart, and it has good
integration with JUnit, Ant, and CVS right out of the box.

Eclipse is, however, really just a wan imitation of IntelliJ IDEA
(www.intellij.com.) The one place where Eclipse is better than IDEA is
in the availability of third-party extensions (plug-ins) -- there are
many more available for Eclipse. But in terms of core functionality,
IDEA reigns.

-
Ernest Friedman-Hill  
Distributed Systems ResearchPhone: (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: retracting a fact based on time?

2003-06-11 Thread Alan Moore
You could assert a checkpoint fact, such as (checkpoint ?timestamp), and
then later retract all facts asserted after this timestamp by comparing the
fact-id of the checkpoint fact.

This technique assumes:

a) fact-id's are increasing numeric values
b) you haven't reached the max fact-id value (wrap-around)

but otherwise, it should work.

alan

-Original Message-
From: Nik Joshi [mailto:[EMAIL PROTECTED]
Sent: Wednesday, June 11, 2003 3:13 PM
To: [EMAIL PROTECTED]
Subject: JESS: retracting a fact based on time?


Is there any way to retract a fact (inside JESS) based on time?  I want to
be able to phase out facts that are older than some user set threshold of
time.  I could do the phase out inside of Java but it would be nice if I
could do it in JESS.  Any help is highly appreciated.  Thanks!

- Nik.


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: Convert a string to integer

2003-06-11 Thread Alan Moore
try:

(bind ?x (call Integer parseInt "25"))

(disclaimer: not tested - your mileage may vary)

alan

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Sent: Wednesday, June 11, 2003 12:44 PM
To: [EMAIL PROTECTED]
Subject: JESS: Convert a string to integer


Hi all,

This might seem silly but I **really** cannot figure this one out.

Is there a jess command/function to convert a string to an integer?

ex >(bind ?x "25")

I need to be able to convert the string "25" to an integer to be
able to do some comparisons.
ex (a ?x&:(= ?x 25))

I looked up the function list and found 2 functions:
1. (integer ) -> but this needs a numeric
expression
2. (long ) Longs in Jess are "second class citizens"
in the sense that you ** can't directly do math ** on them.

Thanks in advance.

Kapil Dukle
Masters Computer Science
University of South Carolina


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: more effecient jess debuging

2003-05-30 Thread Alan Moore
All java based debuggers work with java only. So that means that you can
debug the jess engine itself (obviously) but not jess script/code.

There are new features of the java jvm/debugging api's/class file format
that allow non-java languages that compile down into java to be debugged at
the source level in the original (and/or intermediate) languages. For
example, JSP, which compiles into servlets can be debugged at the jsp page
level instead of down in the translated servlet.

I've thought long and hard about compiling jess script into java but
inevitably run into type problems. Short of adding another level of
reflection and/or dynamic proxy thunking, it just isn't very easy to do with
the current implementation of jess. I've even modified the jess parser to do
some of the prerequisites such as validating LHS/RHS variable
names/bindings, etc. I was planning to allow the user to write java code on
the RHS and debug in the native jess source, ala jsp.

I think jess is about to undergo a parser refactoring and I'm hoping the
result will lend itself to this kind of transformation/validation. I'm
willing to help here... hint hint...

In any case, debugging RHS script won't help someone who's rules aren't
firing. That's another debugging story altogether.

alan


-Original Message-
From: James Owen [mailto:[EMAIL PROTECTED]
Sent: Thursday, May 29, 2003 8:08 PM
To: [EMAIL PROTECTED]
Subject: RE: JESS: more effecient jess debuging


Question:  Will jdb or some of the other shareware (freeware) debugging
tools work with Jess.  I haven't tried them yet but I know that there are
some that will work with other rulebased systems out there.  Just wondered
if anyone else had tried any of these.  
 
SDG
jco
 
James C. Owen
Senior Knowledgebase Consultant
6314 Kelly Circle
Garland, TX   75044
972.530.2895 
214.684.5272 (cell)
 
-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On
Behalf Of Ryan Crumley
Sent: Thursday, May 29, 2003 6:30 PM
To: [EMAIL PROTECTED]
Subject: JESS: more effecient jess debuging
 
I have recently inherited a bit of code that is pretty complex. So far
watch-all has not been able to help me find the problems I am tracking down.
Can anyone suggest other debug methods for jess rulesets? 
watch-all will tell me what rules fire, but more importantly I am looking
for why a rule didnt fire. I examinted the facts that a particular rule was
matching against and went through all the guards and they look like they
should work but the rule doesn't seem to be firing. Adding (printout t
'message' crlf) after each rule also didnt yeild any results (atleast it
didnt result in any messages in the output file I am redirecting 't' to). 
Are there any other methods you have used to debug a rule? 
Thanks, 
ryan 
 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: more effecient jess debuging

2003-05-30 Thread Alan Moore
Also, for simple "stop when this statement is reached" kinds of debugging, I
have resorted to creating a userfunction called, not surprisingly,
(breakpoint).

In this userfunction, I set a breakpoint in the java call() method and
anywhere it is encountered in the jess script, it stops in my java debugger.
You can look at the jess Context etc. from there.

It is embarrassingly crude but when you are *really* desperate it can help.

alan

-Original Message-
From: James Owen [mailto:[EMAIL PROTECTED]
Sent: Thursday, May 29, 2003 8:08 PM
To: [EMAIL PROTECTED]
Subject: RE: JESS: more effecient jess debuging


Question:  Will jdb or some of the other shareware (freeware) debugging
tools work with Jess.  I haven't tried them yet but I know that there are
some that will work with other rulebased systems out there.  Just wondered
if anyone else had tried any of these.  
 
SDG
jco
 
James C. Owen
Senior Knowledgebase Consultant
6314 Kelly Circle
Garland, TX   75044
972.530.2895 
214.684.5272 (cell)
 
-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On
Behalf Of Ryan Crumley
Sent: Thursday, May 29, 2003 6:30 PM
To: [EMAIL PROTECTED]
Subject: JESS: more effecient jess debuging
 
I have recently inherited a bit of code that is pretty complex. So far
watch-all has not been able to help me find the problems I am tracking down.
Can anyone suggest other debug methods for jess rulesets? 
watch-all will tell me what rules fire, but more importantly I am looking
for why a rule didnt fire. I examinted the facts that a particular rule was
matching against and went through all the guards and they look like they
should work but the rule doesn't seem to be firing. Adding (printout t
'message' crlf) after each rule also didnt yeild any results (atleast it
didnt result in any messages in the output file I am redirecting 't' to). 
Are there any other methods you have used to debug a rule? 
Thanks, 
ryan 
 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: more effecient jess debuging (long)

2003-05-30 Thread Alan Moore
You can certainly debug Jess under any Java debugger, but obviously
you're going to be debugging at a low level. Our friend Alan Moore was
workign on a Jess debugger at one point; not sure what happened to
that project, Alan?

[alan]
I have written several versions of this.

The coolest one was fully integrated into COM. Jess could talk to COM
objects and/or java objects. As part of this, I embedded jess in a wrapper
that made it a COM ActiveScripting Engine. As such, one of the things you
could do was to write HTML pages with 

RE: JESS: more effecient jess debuging

2003-05-30 Thread Alan Moore
Try the (view) command as explained in the users manual.

Good luck!

alan


-Original Message-
From: Ryan Crumley [mailto:[EMAIL PROTECTED]
Sent: Thursday, May 29, 2003 4:30 PM
To: [EMAIL PROTECTED]
Subject: JESS: more effecient jess debuging


I have recently inherited a bit of code that is pretty complex. So far
watch-all has not been able to help me find the problems I am tracking down.
Can anyone suggest other debug methods for jess rulesets? 
watch-all will tell me what rules fire, but more importantly I am looking
for why a rule didnt fire. I examinted the facts that a particular rule was
matching against and went through all the guards and they look like they
should work but the rule doesn't seem to be firing. Adding (printout t
'message' crlf) after each rule also didnt yeild any results (atleast it
didnt result in any messages in the output file I am redirecting 't' to). 
Are there any other methods you have used to debug a rule? 
Thanks, 
ryan 
 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: Is it for me... (long)

2003-04-01 Thread Alan Moore
Comments are always welcome ;-D

Did you notice that I tried to hedge that comment with "rely too much" and
"design some" so as not to make the remarks universal and unqualified. Maybe
I should have left that one out...

My short experience with writing jess rules is derived mainly from using it
for state management and control so goals appear, at least to my untrained
eye, to be less relevant. My problem domain is that of state management and
control.

I'm sure, given more experience and time, I could reduce my problem to a
goal directed approach and it would be more
. Suggestions or references as to how to do
this would be greatly appreciated.

For newbies like me, making *some* things explicit can be helpful until we
can grok the goal approach and actually pull it off.

I know that this sounds like a crutch but it works for small implementations
like mine, is very easy to explain to other java programmers, validate
against use case descriptions, and is easy to add/modify system behavior.
Your mileage *will* vary...

It's only 2:30 here, I'm on my second cup and I really shouldn't have had
the first one as witnessed by the verbosity of my posts - apologies in
advance.

alan

-Original Message-
From: James C. Owen [mailto:[EMAIL PROTECTED]
Sent: Tuesday, April 01, 2003 1:22 PM
To: [EMAIL PROTECTED]
Subject: Re: JESS: Is it for me... (long)


Sorry, couldn't let this one go by without a comment.  (And then I really,
really have to get back to work...  :-)  Alan, I cut out all but one
paragraph
of your response.  I was in complete agreement with the rest of it.  A
well-designed, goal-oriented approach actually uses (not salience - hate
that
one) recency as a control strategy.  Just to name-drop a little bit, but I
got
hooked on this approach back in 1999 working with Dr. Charles Forgy on a
project
at Ericsson.  I also worked with him later on a JRules project where he took
the
time to re-write the JRules version Monkeys-and-Bananas (which used
priorities
to the extreme) to a goal-oriented approach.  That may not be what you meant
in
the paragraph below, but I just thought I'd have one final comment and then
go
get my third cup of coffee for the day.  It's 3:20 and I deserve it.



Alan Moore wrote:

> Try not to let your rules don't rely too much on implicit control
structures,
> like salience for example. Take the time to design some explicit
> system/computation state components, or use modules or other strategies
that
> can be employed to partition your rules and to control their activation,
etc.
> This advice may be controversial among some rule purists but it has helped
me
> immeasurably.
>

--
SDG
jco

-
James C. Owen
Senior KE
Knowledgebased Systems Corporation
6314 Kelly Circle
Garland, TX   75044
972.530.2895


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: Is it for me... (long)

2003-04-01 Thread Alan Moore
Jeff,

My two cents worth and likely stating the obvious...

Once you decide that you want to use a rule engine, be sure your execution
is as good as your decision. Some things that can help are:

Make a clear distinction between policy and mechanism -- which is just
another way of saying that you need good rule design.

This is true whether or not you implement your rules using java or jess code
and is the most important design constraint you can make. For obvious
reasons, your policy belongs in the rules and the mechanisms to support them
belong in java.

To make the argument to management, and to the team, identify the most
complex part of your system and create two quick and dirty prototypes, one
using java only and one using jess -- often the jess implementation can
reuse the java-only components.

Next, go through the process of adding another requirement or aspect to the
system. Compare the process and first convince yourself that moving forward
using jess is simpler and more transparent. Pay careful attention to how the
design might enhance parallel development and validation and to what kinds
of defects you introduce and fix as you proceed. Then, and only then, take
your case to others. FUD can be hard to fight without a concrete example on
your side.

Try not to let your rules don't rely too much on implicit control
structures, like salience for example. Take the time to design some explicit
system/computation state components, or use modules or other strategies that
can be employed to partition your rules and to control their activation,
etc. This advice may be controversial among some rule purists but it has
helped me immeasurably.

Also, you need a clear strategy, or pattern, for interaction between your
jess code and your java code. This invariably includes control strategies,
threading requirements, data modeling, synchronous vs. asynchronous
operations, etc. Think long and hard about your architectural requirements
and how they might affect this strategy. If you have done your homework
right, the java code in your system will not even be aware that a rule
engine is being employed. Doing this will reduce the frustration that can
arise in the java-only camp.

Those engineers who do not take to the jess coding style would be more
effective if they built the java code to support the other engineers who are
adept at using jess. This often includes persistent storage, interfaces to
external systems, complex calculations, data centric manipulations, high
performance components, etc. Depending on your talent pool and target
system, you are better off with fewer rule engineers and more java support
than the other way around.

Also, no matter what, be sure everyone is or becomes competent in java
first. Especially, don't try to throw in an EJB container for good measure
unless your goal is to home grow a number expert EJB engineers in-house.
There are simpler alternatives to EJB if your requirements allow them.

Good luck!

alan

-Original Message-
From: Jeff Richley [mailto:[EMAIL PROTECTED]
Sent: Tuesday, April 01, 2003 6:22 AM
To: [EMAIL PROTECTED]
Subject: JESS: Is it for me...


I have a project that has roughly 10,000 business
rules.  Another major factor is that there are 13
programmers (not including myself) and I am the only
one that has ever programmed in Java.  The powers that
be have decided that we are going to write the entire
program in Java.  There are some very good reasons for
this decisions that I won't go into right now.

My question is, would JESS be a good solution for
all of these rules.  I haven't really gotten a good
handle on exactly what is required to use Jess.
Is this something that I would be able to give a
statement like "if all of the planes were unmanned
then field x must be equal to 'q'"?  Or is it
something that I would actually have to program that statement?

__
Do you Yahoo!?
Yahoo! Tax Center - File online, calculators, forms, and more
http://platinum.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]




JESS: Problem with (not (exists (XYZ)))

2003-02-19 Thread Alan Moore
Ernest,

There appears to be a problem with the (not (exists (XYZ))) pattern.

Here is an example:

(deftemplate processing-state
   (slot currentTaskId)
)

(deftemplate task
   (slot id)
   (slot complete)
)

(deftemplate futureResult
   (slot done)
)

(deffacts initial-tasks
   (task (id 1) (complete FALSE))
   (task (id 2) (complete FALSE))
   (task (id 3) (complete FALSE))
   (task (id 4) (complete FALSE))
   (processing-state (currentTaskId 1))
)

(defrule start-task
   (processing-state (currentTaskId ?taskId))
   (task (id ?taskId) (complete FALSE))
   (not (exists (futureResult)))
=>
   (printout t "Starting task " ?taskId)
   (assert (futureResult (done FALSE)))
)

(defrule process-task
   ?f <- (futureResult (done FALSE))
=>
   (printout t " processing... ")
   (modify ?f (done TRUE))
)

(defrule task-ended
   ?f1 <- (processing-state (currentTaskId ?taskId))
   ?f2 <- (task (id ?taskId) (complete FALSE))
   ?f3 <- (futureResult (done TRUE))
=>
   (printout t "done!" crlf)
   (bind ?nextTaskId (+ ?taskId 1))
   (modify ?f1 (currentTaskId ?nextTaskId))
   (modify ?f2 (complete TRUE))
   (retract ?f3)
)

When this is reset/run no rules fire. If you remove the (exists) portion of
the pattern everything seems to work.

Am I using the (not (exists()) pattern incorrectly? In a previous post you
indicated that (not (XYZ)) and (not (exists (XYZ)) are logically equivalent
so I'm assuming there could be a bug here.

In our actual rules the symptom is the opposite of this example - the
start-task rule fires even in the presence of a (futureResult) fact.

Our rules are more complicated and involve java beans instead of
deftemplates and the process-task rule doesn't exist but is work performed
on another thread started by the start-task rule.

Hopefully this small code snippet can help identify the problem without my
having to cook up another bean/threaded example.

alan

Alan Moore - mailto:[EMAIL PROTECTED]
Ciphergen Biosystems - http://www.ciphergen.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: (not) vs (not (exists))

2003-02-14 Thread Alan Moore
Is there a difference between the following:

(defrule some-rule
   (pattern1)
   (not (MyJavaObject))
=>
)

and

(defrule some-rule
   (pattern1)
   (not (exists (MyJavaObject)))
=>
)

beyond performance or internal jess overhead?

Note that I am not testing for any particular properties of MyJavaObject,
just that one doesn't exist.

I was running into a problem (I am using 6.1b1) where the rule was firing
when there *was* an instance of MyJavaObject definstance'd.

After reading the manual and the cautionary note about calling reset() when
working with the (not) conditional element, I discovered that reset() was
not being called anywhere - could this explain the behavior?

In the heat of the moment I threw in the (exists) test and it seemed to fix
things. But now I am revisiting this issue and just want to verify that
these should be equivalent. I have also added a call to reset()...

BTW - your newly updated online user manual has the following date:

Version 6.1b2 (24 February 2003)

alan

Alan Moore - mailto:[EMAIL PROTECTED]
Ciphergen Biosystems - http://www.ciphergen.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: ConcurrentModificationException calling listDefinstances

2003-01-31 Thread Alan Moore
I received the following exception while calling Rete.listDefinstances():

stackTrace: java.util.ConcurrentModificationException
at java.util.HashMap$HashIterator.nextEntry(HashMap.java:750)
at java.util.HashMap$KeyIterator.next(HashMap.java:786)
at java.util.AbstractCollection.toArray(AbstractCollection.java:170)
at java.util.ArrayList.(ArrayList.java:132)
at jess.DefinstanceList.listDefinstances(DefinstanceList.java:52)
at jess.Rete.listDefinstances(Rete.java:499)

There is a strong possibility that (definstance) was being called by a rule
running on another thread at the time.

This brings up a couple of questions:

1) Is this expected behavior?
2) In general, does jess make any guarantees w.r.t. concurrent modifications
for public API's that return collections/iterators?
3) Is there a difference between calling (definstance) or
Rete.definstance(...)?
4) Does jess maintain a lock object (or some other mechanism) I can use to
make sure my access to the API is safe?

alan

Alan Moore - mailto:[EMAIL PROTECTED]
Ciphergen Biosystems - http://www.ciphergen.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]





RE: JESS: How to get rule name

2003-01-30 Thread Alan Moore
>I like the getCurrentActivation() idea. I imagine people could get into
> all kinds of mischief with that :)

I was thinking of mischief but didn't want to mention it for fear it
wouldn't happen for just that reason...

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: How to get rule name

2003-01-29 Thread Alan Moore
How about returning the rule itself? An alternative would be to return the
current activation.

My 2cts...

alan

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, January 29, 2003 5:33 PM
To: [EMAIL PROTECTED]
Subject: Re: JESS: How to get rule name


I think Richard Kasperowski wrote:
> [EMAIL PROTECTED] wrote:
> > I think Richard Kasperowski wrote:
> > 
> >>In the RHS of a rule, is there a way to get the rule name?
> >>
> > 
> > 
> > Write a JessListener class which watches for DEFRULE_FIRED events. The
> > event will arrive just before the RHS of the rule executes. Call
> > getObject() on the JessEvent. It'll be a jess.Activation objects. The
> > name of the rule will be in Activation.getRule().getName(). Call
> > Rete.store("RULE", theName). Then on a rule's RHS you can (fetch RULE)
> > to get the name.
> 
> Can I request a new feature?  It would be nice if there were a built-in 
> function like (rule) or (this) or (self) that would return the rule 
> object when you evaluate it on the RHS of a rule.

OK, I'll stick it in as a function on Rete, so you can call it like

(bind ?rule ((engine) getCurrentRuleName))




-
Ernest Friedman-Hill  
Distributed Systems ResearchPhone: (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: JDBC ResultSet data

2003-01-07 Thread Alan Moore
Also, you could do one of the following within the Userfunction:

1) definstance your ResultSet object.
2) definstance application specific objects based on the data in your
ResultSet.
3) assert the ResultSet data/rows as facts.

#1 is pretty useless as you can't pattern match against the row data and
would have to use jess code to extract the data - java is probably a better
tool for that job so your Userfunction is a good place to do it.

#2 is better but has more overhead than #3 and requires that you create
object wrappers for your table/query data. My guess is that your data is
static (for the purposes of this problem) and using java object wrappers
doesn't buy you anything...

#3 is more jess-like and since it is pretty simple to write a generic
Userfunction that covers arbitrary tables/query results I would go with this
approach.

Good luck!

alan

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, January 07, 2003 5:32 AM
To: [EMAIL PROTECTED]
Subject: Re: JESS: JDBC ResultSet data


I think Aalap Parikh wrote:
> Hi everybody,
> 
> I am a Jess newbie. I am trying to retrieve data from
> a database by wrapping the necessary JDBC code within 
> a Userfunction.
> 
> My problem is that how do I pass the JDBC ResultSet
> containing the data to Jess? I am trying to do this
> because I want the data extracted from the database to
> be accessible for transformation or modification to a
> jess rule. 
> 
> I tried looking at store , fetch etc...But I am
> confused.
> 


If you're writing a Userfunction, you can just return a Java object to
Jess via "return":

return new Value(myResultSet);

and this becomes the return value of the called function.


-
Ernest Friedman-Hill  
Distributed Systems ResearchPhone: (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: JavaBean String property doesn't match on LHSpattern.

2002-12-18 Thread Alan Moore
Change your rule to:

(defrule tcr2
   (tc (status "fail") (OBJECT ?tc)) 
   => 
   (printout t "Found match for status=fail" crlf)
)

Matching Strings on the lhs must be enclosed in quotes.

alan

-Original Message-
From: Bijal Modi [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, December 18, 2002 4:48 PM
To: [EMAIL PROTECTED]
Subject: JESS: JavaBean String property doesn't match on LHS pattern.


Hello,

I have a simple JavaBean  class TestCase as follows:

public class TestCase {
private int domainID;
private String status;

public TestCase() {
super();
}
public int getDomainID() {
return domainID;
}
public void setDomainID(int newDomainID) {
domainID = newDomainID;
}
public java.lang.String getStatus() {
return status;
}
public void setStatus(java.lang.String newStatus) {
status = newStatus;
}

}


I create the template for it in Jess using defclass:

(defclass tc TestCase)

and define a definstance tc1 as follows:

(bind ?tc1 (new TestCase))
(set ?tc1 status fail)
(set ?tc1 domainID 1)
(definstance tc ?tc1 static)

and define two rules:

(defrule tcr1
   (tc (domainID 1) (OBJECT ?tc)) 
   => 
   (printout t "Found match for domainID=1" crlf)
)

(defrule tcr2
   (tc (status fail) (OBJECT ?tc)) 
   => 
   (printout t "Found match for status=fail" crlf)
)

Now when I run the Rule Engine, tcr1 gets fired but tcr2 
doesn't and I can't figure out why. I was expecting both 
rules to fire since the definstance tc1 has appropriate data.

thanks for your help,

-Bijal


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: Jess in Action book announcement

2002-12-12 Thread Alan Moore
Congratulations!

alan

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent: Thursday, December 12, 2002 3:02 PM
To: [EMAIL PROTECTED]
Subject: JESS: Jess in Action book announcement


Hi Folks,

Manning Press has put up a web page for "Jess in Action," including a
table of contents and a picture of the cover. There's a blurb on the
front page of their web site too, in the "Coming Soon!" column. See

  http://www.manning.com/friedman-hill/index.html

-
Ernest Friedman-Hill  
Distributed Systems ResearchPhone: (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: updating and synchronization

2002-12-12 Thread Alan Moore
I think Bonnet was asking about property change/bean events - did I misread
the question?

alan

> -Original Message-
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On
> Behalf Of [EMAIL PROTECTED]
> Sent: Wednesday, December 11, 2002 8:16 PM
> To: [EMAIL PROTECTED]
> Subject: Re: JESS: updating and synchronization
>
>
> There is no function that updates a single object this way in the
> current version of Jess. If you can modify the object using (modify),
> thyen do so. If not, then retract/re-assert is the only way to do it.
>
>
> I think Bonnet Emmanuel wrote:
> > Hi,
> > is it possible to use methods that changes Java classes state
> > and to tell Jess that this object has been modified.
> >
> > In other words, I would like to do something like,
> >
> > ?X <-  (Object ?x)
> > ?Y <-  (Object ?y)
> > =>
> > ( call ?x complexModificationMethod  ?parameters )  // x and y are
> > modified
> > ;; tell jess that they have been updated ?
> >
> >
> > ;;is it the reset method ?
> > reset()
> >
> > ;; do I need to retract the objects and add them again ?
> > retract ?X(?Y)
> > assert ?X(?Y)
> >
> > Emmanuel
> >
>
>
>
>
> -
> Ernest Friedman-Hill
> Distributed Systems ResearchPhone: (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: fireing one rule when none of the others fire

2002-11-14 Thread Alan Moore
Or you could watch the advice for rule firing and keep a count.

alan

-Original Message-
From: [EMAIL PROTECTED] [mailto:ejfried@;ca.sandia.gov]
Sent: Thursday, November 14, 2002 8:46 AM
To: [EMAIL PROTECTED]
Subject: Re: JESS: fireing one rule when none of the others fire


This is a kind of meta-linguistic thing; you want a rule to be able to
reason about what other rules will do or have done. This isn't a
feature that Jess currently offers.

Furthermore, it's a vague problem statement, because I don't know if
you mean "has fired in response to a specific assertion" or "has fired
since run was called, and run is about to return without firing any
rules." But if you mean the latter -- i.e., you want to perform an
action if run() would return without firing any rules --  then that's
easy, because both (run) and Rete.run() return the number of rules
fired. You can do this:

(if (eq 0 (run)) then
(do whatever))

The statement (do whatever) could include (run) if your action
modifies working memory so that other rules may be activated.





I think Richard Patten wrote:
> 
> Hello everybody,
>   I want to make a rule fire if none of the other rules fire (this is very
important, I dont want to fire this rule if any other rule has fired).  Its
something like specifying an 'else' statement in a program.  How can I
achieve this in JESS.
> 
> thanks
> Richard.
> 
> 
> 
> -
> Do you Yahoo!?
> Yahoo! Web Hosting - Let the expert host your site



-
Ernest Friedman-Hill  
Distributed Systems ResearchPhone: (925) 294-2154
Sandia National LabsFAX:   (925) 294-2234
Org. 8920, MS 9012  [EMAIL PROTECTED]
PO Box 969  http://herzberg.ca.sandia.gov
Livermore, CA 94550


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: does someone use apache with tomcat AND Jess ANDWebmacros

2002-11-13 Thread Alan Moore
> Does anyone have experiences in configuring the servers?
Yes.

> Does anyone know how to integrate the Webmacros in this difficult system?
Yes.

But this should be taken offline since it is off-topic.

You can contact me at:

mailto:alan@;closedsource.com

Good luck!

alan

You never change things by fighting the existing reality. To change
something, build a new model that makes the existing model obsolete. --
Buckminster Fuller


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: Problem matching String valued slot using an ATOM

2002-10-24 Thread Alan Moore
Thanks for the clarification.

alan

> -Original Message-
> From: [EMAIL PROTECTED] [mailto:owner-jess-users@;sandia.gov]On
> Behalf Of [EMAIL PROTECTED]
> Sent: Wednesday, October 23, 2002 4:58 PM
> To: [EMAIL PROTECTED]
> Subject: Re: JESS: Problem matching String valued slot using an ATOM
>
>
> I think Alan Moore wrote:
> >
> > Please help me understand when the automatic conversion is done
> and when it
> > is not.
> >
>
> LHS matching is done "as if by" the (eq) and (neq) functions. These do
> no conversions at all, and so values match in content and type.
>
> Conversion of function arguments is at the discretion of the
> individual function. Most Jess functions try to be lenient in what
> they'll accept.
>
>
>
> -
> Ernest Friedman-Hill
> Distributed Systems ResearchPhone: (925) 294-2154
> Sandia National LabsFAX:   (925) 294-2234
> Org. 8920, MS 9012  [EMAIL PROTECTED]
> PO Box 969  http://herzberg.ca.sandia.gov
> Livermore, CA 94550
>
> 
> 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: Problem matching String valued slot using an ATOM

2002-10-23 Thread Alan Moore
I found that the following doesn't work:

(defclass Thing com.xxx.Thing) ; the class Thing has a property called
"name" of type String
(definstance Thing (new com.xxx.Thing))
(defrule print-thing
   (Thing (name Zaphod))
=>
   (printout t "Thing named Zaphod found")
)

(bind ?theThing (new com.xxx.Thing))
(definstance Thing ?theThing) ; note - dynamic
(?theThing setName Zaphod)
(run)

but the rule will work if I define the rule like this:

(defrule print-thing
   (Thing (name "Zaphod"))
=>
   (printout t "Thing named Zaphod found")
)

I assume this has something to do with ATOMS vs. Strings but am not quite
sure why Jess doesn't match the former rule since it seems to do automatic
conversions as needed elsewhere (e.g. on the RHS.)

Please help me understand when the automatic conversion is done and when it
is not.

alan

Alan Moore - mailto:amoore@;ciphergen.com
Ciphergen Biosystems - http://www.ciphergen.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]





RE: JESS: Message saying it is not a multislot, when actually,it is...

2002-10-23 Thread Alan Moore
Ernest,

It is often helpful to have the parser spit out the column number of the
line with a parse error.

A while back I modified jess to track and display (on a parse error) the
current column number during parsing but lost the mods. I can reimplement
the changes using the current code base - just let me know if you would like
to see them.

alan

-Original Message-
From: [EMAIL PROTECTED] [mailto:ejfried@;ca.sandia.gov]
Sent: Wednesday, October 23, 2002 9:27 AM
To: [EMAIL PROTECTED]
Subject: Re: JESS: Message saying it is not a multislot, when actually,
it is...



I think Alexander Lamb wrote:
> 
> However, when loading the rule, I get the following message:
> 
> ERROR: Jess reported an error in routine Jesp.parsePattern
> while executing (batch
> /Users/alamb/Development/OrMed2Proto/Protocols.jess).
>   Message: selectedCompleterResponse is not a multislot .
>   Program text: ( defrule KEY_SCRIPT0 ( OrmedRequest ( key "script" ) (
> ormedContext ?c ) ( OBJECT ?r ) ) ( OrmedContext (
selectedCompleterResponse
> ?s & : ( and ( neq ?s nil ) ( eq "ASP" ( get ?s key ) ) ) (  at line 17.
> 

When the Jess parser produces an error message, the very last token
(here "(") is the one that caused the error -- i.e., Jess saw that "("
and was expecteing something else. If you have an editor like vi or
Emacs that can show you matching parentheses, use it to check for the
open paren that matches the third ")" after "get ?s key" above, and
you'll find that it matches the "(" before "and" -- i.e., there's a
missing close parenthesis, and so the "(" at the end makes this look
like you are matching multiple items in the selectedCompleterResponse
slot. Stick another ")" before that last "(" and you should be fine.

I personally couldn't survive without Emacs.


-
Ernest Friedman-Hill  
Distributed Systems ResearchPhone: (925) 294-2154
Sandia National LabsFAX:   (925) 294-2234
Org. 8920, MS 9012  [EMAIL PROTECTED]
PO Box 969  http://herzberg.ca.sandia.gov
Livermore, CA 94550


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]





InvocationTargetException (was: RE: JESS: Still a problem whentrying to match an object in an object... Even more info)

2002-10-04 Thread Alan Moore

> See manual section 4.1 re: getNextException() -- Jess is telling you
> that it called a Java method via reflection, and it threw an
> exception. You have to call getNextException.printStackTrace() to see
> it -- it will probably give you a clue!

Would it be more appropriate for Jess to throw an InvocationTargetException,
or an exception deried from it, instead? Jess must be trapping this
exception internally (I don't have the source handy) and then copying
getTargetException() into setNextException(). What is the reason for doing
this? Just curious...

I suspect that it may be too late to change this behavior since many people
already rely on the current exception.

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: definstance fails on first attempt and passes onnext?

2002-10-03 Thread Alan Moore

I didn't know Jess looks for BeanInfo objects. I'll give it a go.

This might be a good item for the FAQ and/or user manual.

Thanks!

alan

> -Original Message-
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, October 03, 2002 9:29 AM
> To: [EMAIL PROTECTED]
> Subject: Re: JESS: definstance fails on first attempt and passes on
> next?
> 
> 
> 
> Of course, the official way to do this is to use BeanInfo
> objects. This is how you tell the JavaBeans machinery what is a
> property and what is not. You can write a java.beans.BeanInfo object
> to exclude the troublesome method, and Jess will use it. You really
> need to get the JavaBeans spec from Sun to understand how to write
> one, but it's pretty easy.
> 
> 
> I think Alan Moore wrote:
> [Charset iso-8859-1 unsupported, filtering to ASCII...]
> > I had a similar problem recently definstancing an object with a
> > getSnapshot() method that was getting called. This method 
> is not a bean
> > property and could not be called at just any time - it has 
> side effects. I
> > had to rename the method _getSnapshot() to prevent jess 
> from calling it when
> > I definstanced it.
> > 
> > Unfortunately, you can't change the names of the methods on the
> > DefaultMutableTreeNode class.
> > 
> > Once possible alternative is to have definstance take an 
> "excludeMethods" or
> > "allowedMethods" parameter that would prevent it from 
> calling certain
> > methods on the LHS or during definstance. Of course, this 
> would disallow the
> > ability to pattern match against such things as the 
> firstChild in your
> > DefaultMutableTreeNode but I suspect you aren't doing that anyway.
> > 
> > Another strategy would be for you to create a wrapper class for
> > DefaultMutableTreeNode that somehow checks it's wrapped instance to
> > determine if an exception is going to be thrown, or just 
> catches one, and
> > then return some reasonable default such as null in this 
> case. This seems
> > like a bad hack but in a pinch it might just work for you.
> > 
> > Good luck!
> > 
> > alan
> > 
> > > -Original Message-
> > > From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED]]On
> > > Behalf Of pgilli1
> > > Sent: Thursday, October 03, 2002 6:56 AM
> > > To: [EMAIL PROTECTED]
> > > Subject: JESS: definstance fails on first attempt and 
> passes on next?
> > >
> > >
> > > I'm running into a strange problem when inserting a
> > > DefaultMutableTreeNode
> > > object into my engine. I define the shadow fact, create a new
> > > instance and try
> > > to create a fact and it fails.  But if I run definstance again,
> > > the fact is
> > > inserted successfully!  What the heck is going on to exhibit this
> > > behavior?
> > >
> > > See run below:
> > >
> > >
> > > Jess> (defclass simple javax.swing.tree.DefaultMutableTreeNode)
> > > javax.swing.tree.DefaultMutableTreeNode
> > >
> > > Jess> (bind ?dmtn (new 
> javax.swing.tree.DefaultMutableTreeNode "Parent"))
> > > 
> > >
> > > Jess> (definstance simple ?dmtn static)
> > >
> > > Jess reported an error in routine DefinstanceList.createFact
> > >   while executing (definstance simple ?dmtn static).
> > >  Message: Called method threw an exception.
> > >   Program text: ( definstance simple ?dmtn static )  at line 4.
> > > Nested exception is:
> > > node has no children
> > >
> > > java.util.NoSuchElementException: node has no children
> > >
> > >   at
> > > javax.swing.tree.DefaultMutableTreeNode.getFirstChild(DefaultMutab
> > > leTreeNode.j
> > > ava:864)
> > >
> > > (note: rest of stack trace has been removed)
> > >
> > > Jess> (definstance simple ?dmtn static)
> > > 
> > >
> > > Jess> (facts)
> > > f-0   (MAIN::simple (allowsChildren TRUE) (childCount 0) (class
> > > ) (depth 0) (firstChild
> > > ) (firstLeaf
> > > ) (lastChild
> > > ) (lastLeaf
> > > ) (leaf
> > > ) (leafCount
> > > ) (level
> > > ) (nextLeaf
> > > ) (nextNode
> > > ) (nextSibling
> > > ) (parent
> > > ) (path
> > > ) (previousLeaf
> > > ) (previousNode
> > >

RE: JESS: definstance fails on first attempt and passes onnext?

2002-10-03 Thread Alan Moore

I had a similar problem recently definstancing an object with a
getSnapshot() method that was getting called. This method is not a bean
property and could not be called at just any time - it has side effects. I
had to rename the method _getSnapshot() to prevent jess from calling it when
I definstanced it.

Unfortunately, you can't change the names of the methods on the
DefaultMutableTreeNode class.

Once possible alternative is to have definstance take an "excludeMethods" or
"allowedMethods" parameter that would prevent it from calling certain
methods on the LHS or during definstance. Of course, this would disallow the
ability to pattern match against such things as the firstChild in your
DefaultMutableTreeNode but I suspect you aren't doing that anyway.

Another strategy would be for you to create a wrapper class for
DefaultMutableTreeNode that somehow checks it's wrapped instance to
determine if an exception is going to be thrown, or just catches one, and
then return some reasonable default such as null in this case. This seems
like a bad hack but in a pinch it might just work for you.

Good luck!

alan

> -Original Message-
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On
> Behalf Of pgilli1
> Sent: Thursday, October 03, 2002 6:56 AM
> To: [EMAIL PROTECTED]
> Subject: JESS: definstance fails on first attempt and passes on next?
>
>
> I'm running into a strange problem when inserting a
> DefaultMutableTreeNode
> object into my engine. I define the shadow fact, create a new
> instance and try
> to create a fact and it fails.  But if I run definstance again,
> the fact is
> inserted successfully!  What the heck is going on to exhibit this
> behavior?
>
> See run below:
>
>
> Jess> (defclass simple javax.swing.tree.DefaultMutableTreeNode)
> javax.swing.tree.DefaultMutableTreeNode
>
> Jess> (bind ?dmtn (new javax.swing.tree.DefaultMutableTreeNode "Parent"))
> 
>
> Jess> (definstance simple ?dmtn static)
>
> Jess reported an error in routine DefinstanceList.createFact
>   while executing (definstance simple ?dmtn static).
>  Message: Called method threw an exception.
>   Program text: ( definstance simple ?dmtn static )  at line 4.
> Nested exception is:
> node has no children
>
> java.util.NoSuchElementException: node has no children
>
>   at
> javax.swing.tree.DefaultMutableTreeNode.getFirstChild(DefaultMutab
> leTreeNode.j
> ava:864)
>
> (note: rest of stack trace has been removed)
>
> Jess> (definstance simple ?dmtn static)
> 
>
> Jess> (facts)
> f-0   (MAIN::simple (allowsChildren TRUE) (childCount 0) (class
> ) (depth 0) (firstChild
> ) (firstLeaf
> ) (lastChild
> ) (lastLeaf
> ) (leaf
> ) (leafCount
> ) (level
> ) (nextLeaf
> ) (nextNode
> ) (nextSibling
> ) (parent
> ) (path
> ) (previousLeaf
> ) (previousNode
> ) (previousSibling
> ) (root
> ) (siblingCount
> ) (userObject
> ) (userObjectPath
> ) (OBJECT
> ))
>
> For a total of 1 facts.
>
>
> Thats the end of the run
>
> 
> 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: Defect (?) report

2002-09-24 Thread Alan Moore

It was in my code - see previous post.

The code I am debugging is multi-threaded and is a bit tricky to debug. The
FutureResult object is a key communication element between my threads so
anything that goes wrong in one thread is thrown in the context of another
thread when it calls get().

The exception was nested a bit deeper inside jess' own ?ERROR than I
realized and made it difficult to determine which code threw which
exception.

Again, sorry for the false alarm.

alan

> -Original Message-
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, September 24, 2002 1:03 PM
> To: [EMAIL PROTECTED]
> Subject: Re: JESS: Defect (?) report
> 
> 
> I think Alan Moore wrote:
> > 
> > Jess reported an error in routine call
> > while executing (call ?futureResult get)
> > while executing (bind ?result (call ?futureResult get)).
> >   Message: Called method threw an exception.
> ...
> > 
> > I think Jess' reflection code is not taking this 
> possibility into account -
> > e.g. it is trying to get the property name from the method 
> name but since
> > this isn't a property there is no name to "get"... ;-D
> 
> 
> No, shouldn't be any different from any other method. Are you sure
> "get" really isn't throwing an exception?
> 
> 
> -
> Ernest Friedman-Hill  
> Distributed Systems ResearchPhone: (925) 294-2154
> Sandia National LabsFAX:   (925) 294-2234
> Org. 8920, MS 9012  [EMAIL PROTECTED]
> PO Box 969  http://herzberg.ca.sandia.gov
> Livermore, CA 94550
> 
> 
> 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: Defect (?) report

2002-09-24 Thread Alan Moore

But wait - there's more...

After further investigation, the getNextException method on ?ERROR returns
the following:

java.lang.ClassCastException: java.lang.String

I think the problem may be in my code. I think my own code is throwing this
exception and being bubbled up through the FutureResult and into Jess.

Sorry for the false alarm...

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: Defect (?) report

2002-09-24 Thread Alan Moore

I found a problem running the following code (not exact):

(defrule some-rule
   (some-pattern)
=>
   (bind ?futureResult (some-function-returning-futureResult))
   (bind ?result (call ?futureResult get))
)

It throws the following error on the RHS:

Jess reported an error in routine call
while executing (call ?futureResult get)
while executing (bind ?result (call ?futureResult get)).
  Message: Called method threw an exception.

The FutureResult class is a prexisting class (that I cannot change) that
contains a method called "get" that takes no parameters and returns a value
of type Object (it is from the Doug Lea's concurrent library) like so:

public Object get() throws Exception

I think Jess' reflection code is not taking this possibility into account -
e.g. it is trying to get the property name from the method name but since
this isn't a property there is no name to "get"... ;-D

alan

Alan Moore - mailto:[EMAIL PROTECTED]
Ciphergen Biosystems - http://www.ciphergen.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]





RE: JESS: multiple Rete Engine.

2002-09-24 Thread Alan Moore

Is it possible that you asserted the same Fact object/instance into two
different engines?

alan

> -Original Message-
> From: Gang Liu [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, September 24, 2002 11:10 AM
> To: [EMAIL PROTECTED]
> Subject: Re: JESS: multiple Rete Engine.
> 
> 
> Thanks
> My expectation is No too. But, in reality, I observed that 
> one fact in one 
> engine activated one rule in another engine. Any ideas?
> thanks
> Gang
> 
> 
> >From: "Alexander Lamb" <[EMAIL PROTECTED]>
> >Reply-To: [EMAIL PROTECTED]
> >To: [EMAIL PROTECTED]
> >Subject: Re: JESS: multiple Rete Engine.
> >Date: Tue, 24 Sep 2002 08:20:02 +0200
> >
> >My understanding is NO. Each Rete engine has its own facts and rules.
> >However, in one Rete engine you can have several "spaces" (I 
> think) which
> >are called "modules"... (but this is as far as I can go... I am a
> >beginner:-)
> >
> >Alex
> >
> >On 24.9.2002 4:28, "Gang Liu" <[EMAIL PROTECTED]> wrote:
> >
> > > hi, all
> > > I got a question. Thank you for your help in advance.
> > >
> > > In one java VM, we could run serveral Rete engines. Are 
> they sharing the
> > > same collection of facts?
> > >
> > > thanks
> > > gang
> > >
> > >
> > >
> > >
> > > _
> > > MSN Photos is the easiest way to share and print your photos:
> > > http://photos.msn.com/support/worldwide.aspx
> > >
> > > 
> 
> > > 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]
> > > 
> 
> > >
> >
> >--
> >Alexander Lamb
> >Groupe Serveurs Applicatifs
> >Division d'Informatique Midicale
> >Htpitaux Universitaires de Genhve
> >21 rue Micheli-du-Crest
> >CH-1211 Genhve 4 / Switzerland
> >Tel: +41-22 372.48.46 Fax: +41-22 382.86.80
> >[EMAIL PROTECTED] / http://www.hcuge.ch
> >
> >
> >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]
> >
> 
> 
> 
> 
> _
> Join the worlds largest e-mail service with MSN Hotmail. 
> http://www.hotmail.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: multiple Rete Engine.

2002-09-24 Thread Alan Moore

Nope. If you want to share facts between logical parts of your system, try
looking into modules and just use one Rete instance.

alan

> -Original Message-
> From: Gang Liu [mailto:[EMAIL PROTECTED]]
> Sent: Monday, September 23, 2002 7:29 PM
> To: [EMAIL PROTECTED]
> Cc: [EMAIL PROTECTED]
> Subject: JESS: multiple Rete Engine.
> 
> 
> hi, all
> I got a question. Thank you for your help in advance.
> 
> In one java VM, we could run serveral Rete engines. Are they 
> sharing the 
> same collection of facts?
> 
> thanks
> gang
> 
> 
> 
> 
> _
> MSN Photos is the easiest way to share and print your photos: 
> http://photos.msn.com/support/worldwide.aspx
> 
> 
> 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: How to pause rule firing?

2002-09-19 Thread Alan Moore

After reading:

http://www.mail-archive.com/jess-users@sandia.gov/msg04691.html

the answer to a) and b) are pretty clear - sorry for the redundant
questions.

alan

> -Original Message-
> From: Alan Moore 
> Sent: Thursday, September 19, 2002 2:15 PM
> To: '[EMAIL PROTECTED]'
> Subject: RE: JESS: How to pause rule firing?
> 
> 
> > 2) Have a rule that calls wait() on a well-known lock object when it
> > sees a "pause" fact. Here I'll use fetch to get it, but it could be
> > from a Java method, a static member, etc.
> > 
> > (defrule pause
> > ?p <- (pause)
> > =>
> > (synchronized (fetch LOCK) ((fetch LOCK) wait))
> > (retract ?p))
> > 
> 
> This is good. Another variation would be to assert the pause 
> fact with an
> external address of the lock object to wait on so you would have:
> 
> (defrule pause
>?p <- (pause ?resume)
> =>
>(synchronized ?resume (?resume wait))
>(retract ?p)
> )
> 
> NB: I try to stay away from (store) and (fetch).
> 
> This raises some questions that push my understanding of 
> jess. If thread #1
> activates this rule and waits on the RHS, what happens if:
> 
> a) other threads call run() or runUntilHalt()
> 
> How can I guarantee that all possible threads will block? My 
> current system
> doesn't have this scenario but I am just trying to understand 
> how this could
> be generalized into a "complete engine pause", not just a 
> single thread
> pause.
> 
> b) other threads fire property change events matched by LHS patterns.
> 
> I assume activations will be added/removed as necessary but 
> no rules fire
> unless run() is called by another thread.
> 
> > 3) When thread 2 wants thread 1 to pause, it uses
> > 
> > rete.store("LOCK", wellKnownObject);
> > rete.assertString("(pause)");
> > 
> > 4) To wake it up, #2 just says
> > 
> > synchronized (wellKnownObject) {
> > wellKnownObject.notify();
> > }
> > 
> > This doesn't seem to complicated to me -- what do you think?
> 
> No, it is very simple. I just need some time to wrap my head 
> around it. I'm
> sure I will be back with more questions once the fog lifts.
> 
> Thanks for the help!
> 
> 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]
> 
> 


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: How to pause rule firing?

2002-09-19 Thread Alan Moore

> 2) Have a rule that calls wait() on a well-known lock object when it
> sees a "pause" fact. Here I'll use fetch to get it, but it could be
> from a Java method, a static member, etc.
> 
> (defrule pause
> ?p <- (pause)
> =>
> (synchronized (fetch LOCK) ((fetch LOCK) wait))
> (retract ?p))
> 

This is good. Another variation would be to assert the pause fact with an
external address of the lock object to wait on so you would have:

(defrule pause
   ?p <- (pause ?resume)
=>
   (synchronized ?resume (?resume wait))
   (retract ?p)
)

NB: I try to stay away from (store) and (fetch).

This raises some questions that push my understanding of jess. If thread #1
activates this rule and waits on the RHS, what happens if:

a) other threads call run() or runUntilHalt()

How can I guarantee that all possible threads will block? My current system
doesn't have this scenario but I am just trying to understand how this could
be generalized into a "complete engine pause", not just a single thread
pause.

b) other threads fire property change events matched by LHS patterns.

I assume activations will be added/removed as necessary but no rules fire
unless run() is called by another thread.

> 3) When thread 2 wants thread 1 to pause, it uses
> 
> rete.store("LOCK", wellKnownObject);
> rete.assertString("(pause)");
> 
> 4) To wake it up, #2 just says
> 
> synchronized (wellKnownObject) {
> wellKnownObject.notify();
> }
> 
> This doesn't seem to complicated to me -- what do you think?

No, it is very simple. I just need some time to wrap my head around it. I'm
sure I will be back with more questions once the fog lifts.

Thanks for the help!

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: How to pause rule firing?

2002-09-19 Thread Alan Moore

Does anyone have a good technique for pausing rule firing?

I tried to search the archives but the search function is broken at the
moment...

Here is my setup and requirements:

1) thread #1 calls runUntilHalt() in order to keep the engine running. The
intent is to call halt() only when the system is being shut down.

2) thread #2 needs to pause and then later resume rule firing.

My initial plan was to have thread #2 assert a fact, e.g. (Pause), that the
rules will check for with a (not (Pause)) pattern to make sure they don't
fire when this fact is present. Later, thread #2 will assert a fact, e.g.
(Resume), that will trigger a rule to retract the (Pause) fact. I don't like
this approach since it clutters the rules with what is otherwise an external
"pause" aspect.

As part of doing this, thread #2 needs to ensure that the rules have stopped
firing. The only way I could think of doing this is to call run() from
thread #2. However, I am not sure this will guarantee no more rules are
(still?) running on thread #1.

Another approach would be to have thread #2 call halt() and then in thread
#1, check a barrier/latch set/unset by thread #2 indicating that thread #1
should wait until thread #2 signals it to go back and call runUntilHalt(). I
don't like this approach because thread #1 and thread #2 are from different
parts of my system and I don't want to couple them any more tightly than
they already are.

Yet another idea is to switch the engine's focus to a module that does
nothing but I'm not sure how to make this work since I have never used
modules.

All of this sounds very convoluted and was wondering if anyone on the list
had any ideas about how to do this a better way.

*Enhancement request* - would it be possible for the Rete class to implement
pause()/resume() methods *or* for the (halt) command and/or the halt()
method to take an (optional) parameter that would be returned to the
thread(s) that have called runUntilHalt()?

I know there is a public method on Rete called getActivationSemaphore() but
I am not exactly sure how I should use this without breaking the agenda or
causing some kind of deadlock. Any advise in this regard is appreciated.

Thanks in advance.

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: NumberFormatException during parse

2002-09-05 Thread Alan Moore

Ernest,

>From my experience debugging some jess code, I noticed that a
NumberFormatException is thrown on a somwhat regular basis during parsing. I
assume that some part of the parser is checking to see if a symbol is a
number or not in order to determine RU.XXX types.

Do you know how much, or if at all, this exception slows down parsing? From
what I have read about exceptions is that they can significantly slow
execution of a program but this may be old news (hotspot?) or just a bad
rumor.

Given that it is only thrown during parsing it shouldn't amount to much
percentage-wise of a typical jess program so I am not really concerned -
just curious. Have you done any profiling in this area?

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]





JESS: scriptlib.clp request

2002-08-27 Thread Alan Moore

Ernest,

Would it be possible to include a deffunction for println/print in the
scriptlib.clp like so:

(deffunction println (?msg)
   (printout t ?msg crlf)
)

and possibly:

(deffunction print (?msg)
   (printout t ?msg)
)

It would be handy to always have these available. Granted, it clutters
things up a bit but I always find myself tripping up over printout when
moving back and forth between jess and java (ie. System.out.println())...

Thanks!

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]





  1   2   >