Re: JESS: Question about defquery

2004-04-15 Thread ejfried
I think Lakshmi Vempati wrote:
 
 I am using a simple defquery to find a fact and then modify it.

For reasons that are too difficult to go into (although we've actually
discussed it before on this list) when you get a jess.Fact out of a
jess.Token (as you do when you're working with a query result) you
should call getIcon() to get the fact's canonical representation (I
know, that's a terrible method name) and use the return value instead
of the original Fact object. That should solve your problem.

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




Re: JESS: Getting detailed match information

2004-04-21 Thread ejfried

I think Douglas Pearson wrote:
  
 For example if I had:
  
 (defrule simple-rule
(child (id ?x) (name ?name))
(parent (id ?y) (child ?x))
=
(printout t Child  ?x  name  ?name crlf)
 )
 
 and I know fact-3 and fact-7 were matched...how can I tell
 (programmatically) which fact matched which condition?


Well, the facts in a token are in the same order as the patterns they
matched. There's no way to explicitly ask for the jess.Pattern that a
given fact in a jess.Token matched, although you could probably back
it out by getting the jess.Defrule of interest and calling
getConditionalElements() to get the root of the (potentially
tree-structured) LHS patterns. This is not well-documented, and for
good reason: you'll find that the structure changes quite a bit as
Jess evolves from version to version.

  
 I'd also really like to get partial match information as well...not just
 when the rule fired and I'm less clear on how to even get started with that
 since the rule won't be in the agenda.

There's no public API for this, but if you've got a Jess license, you
can poke around in the source. See the implementation of the (matches)
command (which displays partial matches.) The key thing it does is
call getNodes() on the given Defrule object, which returns a List of
jess.Node objects. These are the Rete network nodes. You can root
through this list and find the Node2 objects (the join nodes) and then
look at their alpha memories.


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




Re: JESS: jess.Console question

2004-04-22 Thread ejfried
I think Maxim Tretyak wrote:
 Hi
 
 Can I get advantages of jess.Console by such a way:
 
 Jess (new jess.Console Hi (engine))
 External-Address:jess.Console
 
 Console is appearing, but connand line input is transmitted directly to
 output text area, without interaction with Rete.


Very clever!

Just creating a Console doesn't do it though, there has to be a thread
running the Console.execute() method (the read-eval-print loop). You
could say 

Jess (bind ?c (new jess.Console Hi (engine)))
Jess (?c execute (create$))

The console would then work, but the original command line wouldn't
anymore; and there's no way (no easy way, anyway) to get it back. The
Console class has to reroute all of the Rete objects standard I/O
routers to connect it to the GUI; in the process, it gets disconnected
from standard I/O.


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




Re: JESS: Passing an instance of Rete to java

2004-04-23 Thread ejfried
I think Greg Biegel wrote:
[Charset iso-8859-1 unsupported, filtering to ASCII...]
 Hi,
 
 Is there a way to pass a reference to the current instance of the rule
 engine from Jess, to a Java object. I tried using the 'this' keyword, but
 doesn't seem to work. So basically, I would like to construct a Java object
 from within Jess, but be able to call back to Jess from the object.
 

The (engine) function returns the Rete object that the invoking Jess
code is running in; so

(bind ?o (new MyObject))
(?o mySetJessEngineMethod (engine))

would create an instance of MyObject, and call the imaginary
mySetJessEngineMethod method, passing a reference to the Rete object
as an argument.




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




JESS: Announcing Jess 6.1p7

2004-05-07 Thread ejfried
Hi Folks,

I am pleased to announce that version 6.1p7 of Jess, the rule engine
for the Java platform, is now available for download at the usual
place:

  http://herzberg.ca.sandia.gov/download.shtml

This is a bug fix release with some improved performance
characteristics. From the change log:

Fixed deadlock problem (thanks Paul Kaib). Better
performance with huge numbers of templates (thanks
Travis Nelson.) Fix NPE when parsing empty (not)
patterns. Fix PrettyPrinter bug with (not) and
pattern bindings. 

As usual, question, comments, or concerns welcome at
[EMAIL PROTECTED] or to the mailing list at
[EMAIL PROTECTED] 

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




Re: JESS: Pausing the execution cycle without returning

2004-05-07 Thread ejfried
I think Steffen Luypaert wrote:
 
  The basic trick is this:
  
  From one rule, set up the GUI to ask a question, then call
  ((engine)
  waitForActivations), which pauses the (run) thread until a new rule
  is
  activated.
  
 
 
 The problem is that waitForActivations will still fire the activations 
 left on the agenda, and then wait for new activations to execute them.

Only in the focus module, but yes, you're right.

You could, instead, just use

  (bind ?s ((engine) getActivationSemaphore))
  (synchronized (?s)
  (?s wait))
  
which won't allow any more rules to fire at all until a new activation
comes in.



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




Re: JESS: Combining the logical CE and backward chaining

2004-05-05 Thread ejfried
I think Steffen Luypaert wrote:
 Hi all,
 
 No backward chaining will occur for patterns inside a conditional 
 element. I was wondering that this will change in a future version of 
 Jess, especially for the logical conditional element.

This is basically an oversight in the rule compiler; nobody's ever
pointed this out before. The problem is that, because everything in
Jess is driven by pattern-matching, for a pattern to trigger backward
chaining, there has to be a preceding pattern; i.e., for Jess to
notice that there's no fact that satisfies pattern 1 of a rule, there
has to be a pattern 0 that is satisfied. Imagine that the deftemplate
foo is backwards chaining reactive. Then if you write a rule

(defrule bar
  (foo (a 1))
  = )

Jess will rewrite it like this to provide that needed preceding
pattern:

(defrule bar
  (initial-fact)
  (foo (a 1))
   = )

(you can confirm this with ppdefrule.) The problem you're seeing is
that a rule like

(defrule foo
  (logical (foo (a 1)))
   = )

isn't being rewritten automatically. No worries, though -- you can
actually do it yourself:

(defrule foo
  (logical
(initial-fact)
(foo (a 1)))
   = )

You'll find that if you do this, logical patterns will indeed trigger
backward chaining. I'll log a bug on this and we'll get it fixed.


 Will it ever be possible to make Jess automatically retract the
 need-fact, whenever the needed fact is computed?

When Jess's backward chaining feature was first added, that's what it
did, actually, but we changed it because it led to infinite loops. You
can of course retract the need-X facts on the RHS of your rules that
satisfy them, and deal with the loops some other way.


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




Re: JESS: Problem updating shadow fact data

2004-04-27 Thread ejfried
I think Michael Knapik wrote:

 
 ;;(call event setConditionCodeId )

Variables always have a ? in their name:

(call ?event setConditionCodeId )

 
 (modify 2 (conditionCodeID ))
 

Slot names are case-sensitive:

(modify 2 (conditionCodeId ))



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




Re: JESS: Problem updating shadow fact data

2004-04-27 Thread ejfried
I think Michael Knapik wrote:
 
 (defrule report-subject-and-event-status
 ?s - (subject (subjectId ?sId) (caseStatusId ?csId))
 ?e - (event (eventId ?eId) (conditionCodeId ?ccId)(eventDescriptor ?evtDescriptor))
 =
 (modify ?e (conditionCodeId ))
 (printout t * Event  ?eId  has a condition code:  ?ccID crlf)
 
 produces
 
 Event 100017 has a condition code: 1008
 
 which is the original value.
 

Imagine a JavaBean class Foo with a property X. Now, what does this print?

Foo f = new Foo();
f.setX(23);
int x = f.getX();
f.setX(37);
System.out.println(x);

It prints 23, right? Even though the X property of the Foo bean is 37,
because you read the property, changed it, and then printed the value
you read earlier.

That's exactly what you're doing in your Jess code. The variable ?eId
gets bound on the rule LHS; then you modify the value of that property
in the bean; then you print the value of the variable which, not
surprisingly, still has the same value. If you want to see the new
value, you need to read it back from the object.






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




Re: JESS: JessAgentTab

2004-04-28 Thread ejfried
I think Chintan Shah wrote:
[Charset iso-8859-1 unsupported, filtering to ASCII...]
 Can you please provide the fully qualified server name in the url.
 http://www-i4 does not work for anybody outside your DNS.

It the same as his email;

http://www-i4.informatik.rwth-aachen.de/agentcities/main/tools/JessAgentTab/doc/jat.html




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




Re: JESS: Comparing string

2005-09-09 Thread ejfried
Jess doesn't have an explicit else-if feature; if you put an if into
the else of another if, then that second if is a separate
function call, so it needs its own parentheses. 

If I may, I will point out a few other things here: You don't need to
spell out the names of any classes in java.lang, as it's implicitly
imported, just as in Java. Second, you don't actually need to
construct Strings at all; you can call Java String methods on Jess
strings. Third, you can (and should) always omit call when calling a
Java instance method; it's really only needed when you're invoking a
static method. So you could clean your function up like this:

(deffunction compare-comptment-function(?s1 ?s2)
  (if (eq ?s1 ?s2) then
(return FFF)
else (if (?s1 contains ?s2) then
  (printout t COMES 1 crlf)
  (return ?s1)
  else (if (?s2 contains ?s1) then
(printout t COMES 2 crlf)
(return ?s2)
else
  (printout t COMES 3 crlf)
  (return (str-cat ?s1 , ?s2))  

I think Amit Jain wrote:
[Charset iso-8859-1 unsupported, filtering to ASCII...]
 Hi all 
 I'm trying to compare two strings
 
 (deffunction compare-comptment-function(?s1 ?s2)
 (bind ?str-buff1 (new java.lang.String ?s1))
 (bind ?str-buff2 (new java.lang.String ?s2))
 (if (eq ?s1 ?s2) then
 (return FFF)
 else if (call ?str-buff1 contains ?str-buff2) then
 (printout t COMES 1 crlf)
 (return ?s1)
 else if (call ?str-buff2 contains ?str-buff1) then
 (printout t COMES 2 crlf)
 (return ?s2)
 else
 (printout t COMES 3 crlf)
 (return (str-cat ?s1 , ?s2
 
 SO when i call (compare-comptment-function CSEE CS) it should return 
 COMES 1 CSEE
 
 (compare-comptment-function CSE CSEEE) it should return COMES 2 
 CSEEE
 and (compare-comptment-function AE CSE) it should return COMES 3 
 AE,CSE 
 
 but it keeps going into first elseif loop in all the cases. please tell me 
 what i'm doing wrong. thanks for the help.
 -amit



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


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




Re: JESS: Pattern Binding for CE

2005-09-09 Thread ejfried
I think Krasnigor, Scott L (N-AST) wrote:

 I have an ID slot defined for the Bean object used to define the facts
 but can't seem to figure out how to get the fact that triggered the rule
 so I can modify it for this particular case (all my other rules allow
 pattern binding). 

I formatted your rule to make it easier to understand.

(defrule doctrine-untripped
;; sets qualDoctrine to FALSE if any check flags are FALSE
?docFact - (or
(and (testTrkClass (qualRng FALSE))
 (testTrkClass (qualDoctrine ~FALSE)))

(and (testTrkClass (qualBrg FALSE))
 (testTrkClass (qualDoctrine ~FALSE
=
(modify  ?docFact (qualDoctrine FALSE)))

So the or has two branches, each of which is an and. Those ands,
in turn, each match two facts (the two could, in fact, be the same
one, or they could be different.)

Based on your comment, and on your problem description, my guess is
that you didn't realize that, and you intend the and to simply group
together multiple tests on the same fact. It doesn't work that way:
you should write all the tests for a single fact in a single pattern,
or else the rule can match bits and pieces from multiple facts. So
really I think you mean

(defrule doctrine-untripped
;; sets qualDoctrine to FALSE if any check flags are FALSE
?docFact - (or
(testTrkClass (qualRng FALSE) (qualDoctrine ~FALSE))
(testTrkClass (qualBrg FALSE) (qualDoctrine ~FALSE))
=
(modify  ?docFact (qualDoctrine FALSE)))

Because each branch of the or matches a single branch, the pattern
binding is OK.



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


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




Re: JESS: How to write constraint for shadow fact list/set properties ?

2005-09-14 Thread ejfried
I think robert fields wrote:
 
 Classes are loaded from java by
 
 Jesp j = new Jesp(new StringReader((defclass {Role,
 ...} package.{Role,})), aEngine);
 j.parse(false);
 

The Rete class has a defclass method which would be much more
convenient to use! Barring that, it also has an executeCommand
method that takes a String of Jess code and runs it -- basically the
equivalent of the above, only shorter and faster.

 
 I have no problem in writing constraints with simple
 attributes. It is List/Set/Array properties I am
 having trouble with.


Jess has no special way of treating Collections; the only thing you
need to do is call the collection's methods. For example, if a class Foo
has a property aSet which is (predictable enough) a Set, and you want
to match a Foo object if aSet contains bar, then you might write a
pattern like this:

  (Foo (aSet ?s:(?s contains bar)))

Jess *does* treat arrays specially; arrays are mapped to Jess
lists. You can use multifield variables to match sections of
lists. As it turns out, this is quite badly documented in the current
manual, although that should be remedied soon. In the meantime, you
can look at the section on multifields on page 103 of the book Jess
in Action, or look at how they're used in the stack.clp example in
the Jess distribution.


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


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




Re: JESS: Facts and modules

2005-09-30 Thread ejfried
I think Henrique Lopes Cardoso wrote:
 
 So, if I understood correctly, facts can only be asserted in the module 
 where their templates are defined 

Yes.

 
 Therefore, if I have a template defined in MAIN, I cannot create a fact 
 based on that template in another module.

Right.

 Another observation: using a module name at a deftemplate definition 
 (e.g. (deftemplate m::the-facts ...)), if that module is the current 
 module, is irrelevant.

Redundant, yes. The effect will be the same without it.

A fact and a template are related in exactly the same way that a Java
object and a Java class are related. In this scheme, a module is like
a Java package. Every object must belong to a class; every class must
be in some package. Every fact must belong to a template; every
template must be in some module. So facts don't belong to modules any
more than Java objects belong to packages, right? You can't create a
java.lang.String in the java.util package; it just doesn't make
sense, in the same way that you can't create an X::foo fact in the Y
module. You can use Strings in code in the java.util package, or you
can use X::foo facts in a rule in the Y module.


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


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




Re: JESS: Matching a static variable

2005-10-03 Thread ejfried

Hi Erich,

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

Second, your code looks fine except that the defclass defines a short
template tag RentalCarReservation, but the rules are using the long
com form; I'll assume this is a transcription error, because the
rules won't compile unless you're consistent here.

Third, let me mention, as I often do on this list (I really need to
make this point more strongly in the manual) that direct matching
should always be preferred to function calls, and anything else should
be preferred to the test CE; this is not only a style issue but a
performance issue. Although your rules are both correct, it's better
style and will perform better to write them as

(defrule car_class_is_compact

(RentalCarReservation (carClass ~=(CarClass.COMPACT)))
=
(printout t Car Class is not COMPACT crlf)
)

(defrule one_hundred_miles

(RentalCarReservation (freeMiles 100))
=
(printout t 100 free miles crlf)
)

Finally, I can't say for sure what the problem is, but I'll guess
(since you've mentioned equals()) that you've written a class whose
hashCode() is not consistent with its equals() method (perhaps simply
by  not overriding hashCode().) Jess is rather sensitive to this
error, as are many of the java.util container classes.

I think erich.oliphant wrote:
[Charset iso-8859-1 unsupported, filtering to ASCII...]
 
 
 Hi I am a new jess user and I'm running into a problem trying to match an java
 object value in a rule.  Here are 2 rules and their setup, the first is the
 one with the problem.  The other I added to verify that it would match on a
 primitive type and it seems to work fine:
 (import CarClass)
 
 (defclass RentalCarReservation 
  RentalCarReservation nil)
 (bind ?tmpRentalCarRes (new RentalCarReservation))
 (definstance  RentalCarReservation 
 ?tmpRentalCarRes
 static)
 (call ?tmpRentalCarRes setCarClass (CarClass.MINI))
 (call ?tmpRentalCarRes setFreeMiles 100)
 (reset)
 
 (facts)
 
 
 (defrule car_class_is_compact
 
 (com.ngc.dts.domain.reservation.car.RentalCarReservation (carClass ?x))
 (test (neq ?x (CarClass.COMPACT)))
 =
 (printout t Car Class is not COMPACT crlf)
 )
 
 (defrule one_hundred_miles
 
 (com.ngc.dts.domain.reservation.car.RentalCarReservation (freeMiles ?x))
 (test (eq ?x 100))
 =
 (printout t 100 free miles crlf)
 )
 
 --
 
 CarClass is an enum type i.e.:
 
 class CarClass
 {
 ...
static public MINI = new CarClass(MINI);
 ...
 }
 
 --
 
 equals() has been overridden in CarClass as well.  The one_hundred_miles rule
 works fine so I know there's a specific problem using the object.  Any help
 would be greatly appreciated.
 
 
 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]
 
 



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


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




Re: JESS: Jess DE JSR-94

2005-10-05 Thread ejfried
I think erich.oliphant wrote:
 Hi,
 We are using the JSR-94 interface but would like to use JessDE for
 debugging,etc.  Will jessDE support the XML formatted files required by the
 JSR-94 interface ?

There are two JSR94 drivers. There's the reference implementation that
comes with the JSR94 package from Sun. It only supports a weird XML
rule format in which Jess language code is wrapped with XML
tags. This driver works with Jess 6 and I do not encourage anyone to
use it. It was just a proof-of-concept.

There also the new JSR94 driver that is packaged with recent versions
of Jess 7. It supports JessML *and* Jess language code. In fact, the
example given in the manual show it being used with Jess language
code, not JessML. If you're using the JessDE, then you'll need to use
this new Jess 7 driver.

So tell me where you got the idea that JessML was required if you were
using javax.rules? I'd like to change it if I can to make it clear
that it's not.

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


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




Re: JESS: Problem with definstance

2005-10-05 Thread ejfried
I think David Firmin wrote:

 I'm trying to create shadow facts that subclass a deftemplate that's
 already been added to the Rete. When I try and add the java bean using
 definstance I get a ClassCastException as follows:
 
 java.lang.ClassCastException
   at jess.DefinstanceList.createNewShadowFact(DefinstanceList.java:206)
   at jess.DefinstanceList.definstance(DefinstanceList.java:275)

Jess is assuming that the given class looks like a subclass of the
deftemplate -- i.e., if the template has slots foo and bar, then the
class had better have getFoo() and getBar() methods. It can have
additional properties as well, of course, as befits a subclass.

In any case, this is a lousy error message -- Jess should explicitly
detect and report this problem.


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


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




Re: JESS: Central data storage for multiople Jess instances

2005-10-05 Thread ejfried
I think Bogdan Werth wrote:
[Charset iso-8859-1 unsupported, filtering to ASCII...]
 Hello everybody,
 I working on the model from the field of social simulation. I am
using RePast and Jess to make my agents think in a declarative way. At
the moment I have a separate Jess instance for every agent (300 agents
= 300 Rete instances).

Don't do that. Just use one Jess instance. Facts that are specific to
one agent should include an agent-specific identifier, and rules that
operate on these facts should take care to match them as needed to
keep the various agent's logical processes separate.


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


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




Re: JESS: New to JESS

2005-10-10 Thread ejfried
I think nikita berdikov wrote:
[Charset iso-8859-1 unsupported, filtering to ASCII...]
 Hello, 
 I'm new to Eclipse and JESS, so can anyone tell me how
 to start working with JESS in Eclipse 3.1. What
 variables should i set? I did everything that is
 written in Using the JessDE, but something is wrong.

What is wrong, exactly -- i.e., what did you do, what happened, and
what did you expect to happen instead? If you install it properly,
files named *.clp will be opened in the JessDE Editor; otherwise,
nothing much should be different.

 And please, show me an example of JESS code in
 Eclipse.

You can open any *.clp file in the JessDE editor; you can type in any
code in the manual, or open any *.clp files in the examples directory.

 
 Thanks in advance.
 
 
   
 __ 
 Yahoo! Music Unlimited 
 Access over 1 million songs. Try it free.
 http://music.yahoo.com/unlimited/
 
 
 
 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]
 
 



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


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




Re: JESS: So lame, and so sorry - disregard last post

2005-10-10 Thread ejfried
I think Matthew Hutchinson wrote:
 
 So it's not a complete waste, is the following line still the reccomended
 way of loading rules from Java?
 
 engine.executeCommand((batch jess_test.clp));

In Jess 7, there's a Rete.batch() method you can use instead;
otherwise, what you've shown works fine. Another alternative is

Reader data = ... // Open file, or whatever
try {
  Jesp jesp = new Jesp(data, engine);
  jesp.parse(false);
} finally {
  data.close();
}



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


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




Re: JESS: The JessTab PAL-integration functions are not available

2005-10-10 Thread ejfried
I think Eunice Palmeira wrote:
[Charset iso-8859-1 unsupported, filtering to ASCII...]
 Hello,
I have a problem when i try run Jess with Protigi:
 
 JessTab: Note that the PAL engine is not currently installed in Protege.
 (The JessTab PAL-integration functions are not available.)
 

Well, presumably whatever the PAL engine is needs to be
installed. This is not a Jess thing -- it must be a Protege thing.
Protege questions tend not to get answered on this list. You should
try asking this on a Protege mailing list or forum.




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


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




Re: JESS: For-loop bug

2005-10-10 Thread ejfried
You're right -- that's not the correct behavior. Thanks for the
report.

I think Yura wrote:
[Charset koi8-r unsupported, filtering to ASCII...]
 Hi
 
 I think there is a bug in the 'for'-loop implementation. The following code 
 returns '1' (incorrect):
 
 (bind ?x 1)
 (for (bind ?i 1) ( ?i 2) (++ ?i)
   (bind ?x (float ?x))
   (printout t ?x ==  ?x crlf)
 )
 ?x
 
 When I comment out the 'for'-block the expression evaluates to '1.0' 
 (correct). I'm using 70b3.
 
 Yuri



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


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




Re: JESS: New to JESS

2005-10-11 Thread ejfried
In the first screenshot, I see an editor window named awtdraw.clp,
but I don't see a file by this name in the navigator view; my guess,
then, is that you've used the Eclipse File | Open... menu to
try to open a file not in your workspace. This doesn't work. You can
only edit .clp files that are actually part of an Eclipse project.

We've covered this before on this mailing list, but I'm surprised to
see it's not mentioned in the manual anywhere. We hope to have this
working by the final release of Jess 7.


I think nikita berdikov wrote:
[Charset iso-8859-1 unsupported, filtering to ASCII...]
 I have unzipped all plugins in plugin Eclipse
 directory and yes, i have created a java project.
 
 When i try to open *.clp file nothing is happening,
 see Attach.
 
 Also there is my build path (In Attach)
 
 What do i do wrong?
 
 Thanks in advance
 
 --- Matthew Hutchinson [EMAIL PROTECTED] wrote:
 
  Hi,
  
  having just started using Eclipse myself, I would
  suggest:
  
  - making sure you unzipped all the correct plugins
  into the correct
  directory
  - make sure you create a new *java* project in
  eclipse, not any other type
  
  cheers,
  Matt
  
  
  
  On 10/10/05, nikita berdikov [EMAIL PROTECTED]
  wrote:
  
   Hello,
   I'm new to Eclipse and JESS, so can anyone tell me
  how
   to start working with JESS in Eclipse 3.1. What
   variables should i set? I did everything that is
   written in Using the JessDE, but something is
  wrong.
   And please, show me an example of JESS code in
   Eclipse.
  
   Thanks in advance.
  
  
  
   __
   Yahoo! Music Unlimited
   Access over 1 million songs. Try it free.
   http://music.yahoo.com/unlimited/
  
  
  
 
 
   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]
 
 
 
   
 __ 
 Yahoo! Music Unlimited 
 Access over 1 million songs. Try it free.
 http://music.yahoo.com/unlimited/
Content-Description: 263436701-error.PNG

[image/x-png is not supported, skipping...]
Content-Description: 1585163811-buildPath.PNG

[image/x-png is not supported, skipping...]



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


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




Re: JESS: JessDE buggy

2005-10-14 Thread ejfried
I think Jim Goodwin wrote:
[Charset iso-8859-1 unsupported, filtering to ASCII...]

 Are you interested in bug reports? Where do I send them?

Very interested. You can send them to this list or directly to me at
[EMAIL PROTECTED] 

 Is further work on the JessDE active right now?
 

Absolutely.

 Are there any relevant system requirements?
 I am using WinXP, Eclipse 3.1.0, java 1.5.0_04, and an evaluation
 copy of  Jess 7.0b3.

Development is done on dual-processor Linux machines, and so far it's
been with Eclipse 3.0, not 3.1. We also run Eclipse with JDK 1.4, not
1.5, and it's possible that this matters too.  The next release should
require Eclipse 3.1.

In any case, the behavior of the debugger may depends on how fairly
multiple processes are scheduled and how TCP packets are delivered
through loopback, so we definitely need to do significant testing on
the standard single-processor Windows box -- and thus your feedback is
very important.

 
 My plugin-details show 4 items for Jess, all at version 7.0.0.
 That should be the most current stuff, right?

 Jessgov.sandia.jess
 Jess Debuggergov.sandia.jess.debug
 Jess Editor Plugingov.sandia.jess.editor
 Jess Rete Network Viewergov.sandia.jess.reteview
 

Yes.



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


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




Re: JESS: Using not and and

2005-10-19 Thread ejfried
I think Dusan Sormaz wrote:
[Charset iso-8859-1 unsupported, filtering to ASCII...]
 I was able to run it in 7.0a6.
 
 I am curious, what is the interpretation of and in this example? Is it AND 
 of 4 items? or only 2?

2. It means that there's not a (bar ?x) fact where ?x is the fact (a b c).


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


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




Re: JESS: Using not and and

2005-10-19 Thread ejfried
Hmmm, OK, I see. This is a known issue which has (as another poster
pointed out) been dealt with in Jess 7. In Jess 6, the workaround is
to reverse the order of these patterns:

  (not
  (and
  ?b - (a b c)
  (foo (bar ?b))
  )
  )



I think Henrique Lopes Cardoso wrote:
[Charset iso-8859-1 unsupported, filtering to ASCII...]
 Again, I get a NullPointerException just with the code I've shown:
 
 (deftemplate foo (slot bar))
 
 (defrule r1
(not
(and
(foo (bar ?b))
?b - (a b c)
)
)
=
(printout t r1 fired crlf)
 )
 
 I am using Jess Version 6.1p8.
 
 Henrique
 




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


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




Re: JESS: jess

2005-10-20 Thread ejfried
I think =?iso-8859-1?Q?=5BEXTERN=5D_Manuel_Kollmu=DF?= wrote:
[Charset iso-8859-1 unsupported, filtering to ASCII...]
 hi 
  
 is it possible to read out informations from a *.dll and to handle the
 return value (string)?


Sure, in the same way you'd do it from any Java program: you wrap the
DLL using JNI. Then you can call those native methods using Jess. You
can learn about JNI here:

http://java.sun.com/docs/books/tutorial/native1.1/index.html 



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


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




Re: JESS: TextArea Buffer Size

2005-10-21 Thread ejfried
I think Semmel, Glenn S wrote:
[Charset iso-8859-1 unsupported, filtering to ASCII...]
 Hello.  Under Jess 7.0a4, the TextAreaWriter class has the following 
 attribute:
  private static final int MAXSIZE = 3
  
  In a future release, can this attribute be changed to be either a user 
  configurable or made public?  We deliver our product with a Jess Console 
  Panel that allows users to query the state of the engine.  However, the 
  users complain about the size of the buffered text (3 characters ~ 120 
  lines).  Too much information scrolls out of the text area (i.e. even with 
  the scroll bar, ~120 lines is not enough to maintain all the messages they 
  want to see).  Thanks.
  


Historically, that was the maximum value because the Windows TextEdit
control used by AWT on Windows held only 2^15 characters before
silently refusing to accept any more. The new Swing analog of this
class inherited this limit for no particular reason; sure, it could be
configurable.




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


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




Re: JESS: Converting from/to strings

2005-10-24 Thread ejfried
I think Henrique Lopes Cardoso wrote:
 
 (defrule r1
 ?x - (foo)
 =
 (bind ?string (implode$ ?x))   ;; IS THERE A WAY OF DOING THIS?

?x is a jess.Fact object. You can call any of the methods of jess.Fact
on it -- including toString() and toStringWithParens(), one of which
surely does what you want.

But I think you need to step back a little and look at your design; in
particular, the way in which you're structuring your data. For
example, why is it important that the foo part of

(foo a b c)

be including in your string -- since, given the foo pattern, it's
already known? Why not just

...
  ?x - (foo $?data)
  =
  (bind ?string (implode $?data))
...

Now, you say that ?string is just going to be passed to a
Userfunction implemented in Java. Why not just pass ?data to that
Userfunction (or ?x, if that's what you really want?) Why this
preprocessing step?

Any time you feel like you're fighting Jess (or any tool) to achieve a
certain effect, ask yourself if the problem isn't just that the tool
is designed to make it easy to do things some other way, and consider
if that other way would work for you.

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


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




Re: JESS: Jess in a multithreaded environment

2005-10-24 Thread ejfried
I think Florian Fischer wrote:
[Charset iso-8859-1 unsupported, filtering to ASCII...]
 Hello,
 
 I am using Jess in a multithreaded environment...
 I need to understand how Jess works in a multithreaded environment.
 
 Is the following description correct?
 - One lock is on all the data (facts, rules,  the state of the engine, 
 etc. ) .  That means you can do asserts, retracts, deffacts, defrules 
 and such simultaneously in multiple threads without risk.

Yes.

 - A second lock prevents multiple rules to be fired at the same time.

From separate threads, yes. run()/runUntilHalt() can only be executed
in one thread at a time.

 
 Can I assume that no 2 threads will fire a rule at the same time?  

Yes.

 While the RHS is being executed, can I assume no other rule will
 even be considered for firing before the RHS executed, even if run()
 is called in the meantime in the same thread or another thread?

No. If you call run() reentrantly -- i.e., if a rule fires, and that
code itself calls run() again, then another rule could fire during the
firing of the first rule. The result is undefined. Don't do this. 

 Will run() be ignored if called from a Java method called from a rule 
 RHS?  

No, it won't be ignored.

 I tend to do a run() after every update to any fact.  But it might 
 well be that the said update was called from the RHS of a rule firing 
 during a run().  Will this cause problems?
 

Yes it will. Don't do that.  This has nothing to do with thread
safety, but with whether run() is reentrant. It's not.

 If one thread is executing run() (and fires and executes rules) and a 
 second threads calls run(), will they both fire rules or will the first 
 thread to all the work?

The second thread will block until run returns.

  If yes, will the second thread wait for the 
 first run() to complete, tu guarantees all rules have fired?
 

The second thread will block until run returns for any reason --
halt() was called, or you called run(N) and N rules have fired, or an
exception halts the run, etc.

 If one thread is executing run() (and fires and executes rules) and a 
 second threads does a deffact() or undeffact(), can the facts be updated 
 while a RHS is executing? 

There is no deffact() method, but based on your earlier statements I
think you mean definstance(). Can facts be updated while a rule is
firing? Yes. Values bound on the LHS are copies from the facts that
activate a rule before the rule fires, so if the fact changes while
the rule is firing, the original bound values are used.

 Or will the facts change between 2 rules 
 firing?  Or will the second thread block until run() returns and all 
 rules have fired?

No and no.

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


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




Re: JESS: Jess in a multithreaded environment (Copies of the fact data)

2005-10-24 Thread ejfried
Ultimately, of course, a Fact is an array, with one element for
each slot. When you compile a rule, the rule compiler will look up the
names of any slots that are mentioned, and it's the index of the slot
that gets compiled into the rule.

On the other hand, fact-slot-value is a function that has to look up
the index of a slot by name at runtime. The lookup is fast, as it's an
O(1) HashMap lookup, but still, it represents a finite amount of
overhead. So in other words.

(defrule fast-rule
  (foo (bar ?x))
  =
  (printout t ?x crlf))

represents much less computation than

(defrule slow-rule
  ?f - (foo)
  =
  (printout t (fact-slot-value ?f bar) crlf))

So that's one case. It's just a little bad. The other case is calling
fact-slot-value on the LHS of a rule, which can be *devestatingly*
bad. If you use fact-slot-value on the LHS of a rule, you hide
important information from the rule compiler -- namely, what parts of
a fact are interesting in a given rule. The rule compiler will use
this information to index the Rete memories. If there's no
information, then the relevant node memories default to flat lists and
linear lookups, which can be very slow. So, for example, this rule is
fast, 

(defrule fast-rule-2
  (foo (bar ?x))
  (bar (foo ?x))
  =
  (printout t Found a match! crlf))

While this one is terrible (assuming large numbers of foo and bar
facts, of course:)

(defrule slow-rule-2
  ?f - (foo)
  ?b -(bar)
  (test (eq (fact-slot-value ?f bar) (fact-slot-value ?b foo)))
  =
  (printout t Found a match! crlf))

But actually, this one may be just as bad:

(defrule slow-rule-3
  (foo (bar ?x))
  (bar (foo ?y))
  (test (eq ?x ?y))
  =
  (printout t Found a match! crlf))

as might this one (which surprises a lot of people):

(defrule slow-rule-4
  (foo (bar ?x))
  (bar (foo ?y:(eq ?x ?y)))
  =
  (printout t Found a match! crlf))

I say might be because Jess tries to do the right thing for these,
but can't always do so. In any case, direct matching (including direct negated
matches using ~) is always vastly faster than calling a function on
the LHS of a rule.

I think Jon Weygandt wrote:
 
 Ernest,
 
 Thanks for your description of locks, the part of values and bindings
 and fact-slot-value references are of interest.
 
 I have 2 cases where rules use the fact-slot-value method, and based
 upon the original postings multithreaded use case, are these uses thread
 safe or could the value of the fact change from the original match to
 the access of slot data.
 
 My specific task is to improve the throughput of the application and as
 I have inherited these rules from another source, I would also be
 curious as to your thoughts on the performance of fact-slot-value vs.
 the early binding of all the necessary values in the original rule
 pattern. The matching test for the rules may involve as few as 2-4
 fields, whereas the some-function and access to the fields may be as
 many as 10 fields.
 
 Case 1 (fact-slot-value in rhs)
 (defrule r1
 ?f1 -
 (FACT1
(OP UPDATE)
 ...
 )
...
 =
...
(some-function (fact-slot-value ?f1 S1))
 )
 
 Case 2 (fact-slot-value in lhs)
 (defrule r1
 ?f1 -
 (FACT1
 (OP UPDATE)
 ...
 )
 (exists
 (or
 (test (neq (fact-slot-value ?eqpst S1)
(fact-slot-value ?eqpst S2)))
 (test (neq (fact-slot-value ?eqpst S3)
(fact-slot-value ?eqpst S4)))
 )
 )
...
 =
...
 )
 
 Thanks,
 Jon Weygandt
 
 -- Original Message --
 
  If one thread is executing run() (and fires and executes rules) and a 
  second threads does a deffact() or undeffact(), can the facts be
 updated 
  while a RHS is executing? 
 
 There is no deffact() method, but based on your earlier statements I
 think you mean definstance(). Can facts be updated while a rule is
 firing? Yes. Values bound on the LHS are copies from the facts that
 activate a rule before the rule fires, so if the fact changes while
 the rule is firing, the original bound values are used.
 
 
 
 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]
 
 



-
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 

Re: JESS: MethodNameComparator generates error in 70b3

2005-10-26 Thread ejfried
I think Semmel, Glenn S wrote:

 I looked at the source files and noted the following differences:
   70b3's compare() ends with:
 return ((String) o1).compareTo(o2);
 
   Whereas 70a4's compare ends with:
 return ((String) o1).compareTo((String) o2);
 


Interesting! If you look at the java.lang.String source in JDK 1.5,
String is declared to implement ComparableString (which makes sense)
and therefore the method compareTo(Object) is now written as
compareTo(String), which also makes sense, although it's certainly
surprising. This explains the compilation error, but now I wonder how
some older code, still expecting compareTo(Object), will be able to
run. The JVM must do some magic that, so far at least, I haven't
thought about.

Anyway, I'm rambling. I will put that cast into the source, but it's
probably prudent to use -source 1.4 while compiling Jess itself
(which also fixes this problem -- I just checked).




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


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




Re: JESS: exists description in the documentation missing?

2005-10-26 Thread ejfried
I think Fred Janon wrote:
[Charset iso-8859-1 unsupported, filtering to ASCII...]
 I am reading the Jess in Action book and noticed that it lists
 exists as a Jess' CEs but I could not find it in the online doc for
 version 6.1.

It's here, in chapter 2:

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

 
 What's the best way to test that a fact doesn't exist?

The not CE tests for non-existence. Although what you've written
sounds good in English:

   (not (exists(tick ?)))

it's actually just silly. (exists (x)) is actually equivalent to
(not (not (x))) -- i.e., It's not true that (not (x)) is true.
Therefore, (not (exists (x))) is the same as  (not (not (not (x, which,
as you can imagine, is precisely the same as (not (x)).



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


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




Re: JESS: WebSite navigation

2005-10-31 Thread ejfried
I think Daniel B. Davis wrote:

 All browsers I have tested show the navigation items on the web site as
 too small to read.nbsp; These include:
 ul
 liMozilla Firefox 1.0
 liNetscape Navigator 7.1
 liInternet Explorer 6.0
 /ulThese are the ones high on the left-hand side of the page, rendered
 in shades of pink and white.brbr

(Navigation in the Jess 7.0b3 manual.) Thanks, yes, this has been
reported. I moved from Linux to Mac OS X as my primary development
machine, and the current format changes were intended to make the nav
bar look good in Safari; unfortunately, that made it look bad on
Windows. It's fixed for the next release which should be on Wednesday.



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




JESS: Announcing Jess 7.0b4

2005-11-02 Thread ejfried
Hi Folks,

We're pleased to announce the availability of the latest release of
Jess, the rule engine for the Java platform, at the usual location:

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

This release adds a lot of polish to Jess 7 as we approach the final
version. There are a number of bug fixes, enhanced features for the
JessDE debugger, and a new simplified API for embedding Jess in Java
applications. 

As usual, comments and questions are welcome on the mailing list at
jess-users@sandia.gov or directly to me at [EMAIL PROTECTED]

From the changelog:

  Fix slot-specific behavior for null property names
  in change events (thanks Shan Ming Woo). Fix SAX parse
  error for facts with no slots (thanks Wang Dong.)
  Fixed definstance name resolution across modules
  (Woo). New map, filter, and list functions for
  functional programming. Run configurations are reused
  in Eclipse. Can pass command-line arguments from
  Eclipse Run dialog. Defglobals show up in JessDE
  debugger. Spaces in path names won't confuse jess.bat
  (thanks Eric Schubert.) Fix deadlock in debugger when
  stepping over (read) and (readline) calls (thanks Jim
  Goodwin.)  Start suspended checkbox in debugger. Can
  specify jess.Main alternate in launch
  configuration. Tiny font in manual navbar fixed. New
  URL for Jikes in manual. New quick start section in
  manual, and a new simplified engine API as described
  therein: mark(), resetToMark(), add(), addAll(),
  getObjects(). 

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


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




Re: JESS:Modular deffacts problem

2005-11-02 Thread ejfried
I think David Firmin wrote:

 
 I'm trying to use deffacts with a specific module, but am having some
 problems changing out of that module once the deffacts has taken place.
 At present, I'm doing the following (although I've simplified the code
 here, the sense remains the same):

I'm afraid you've simplified things a little bit too much. The
important points are 1) when and where the defclass for your Java
objects is being done, 2) exactly how the object is being put into
working memory, and 3) what version of Jess you're using.

Jess 7.0b4 was released just today, and it fixes a bug in earlier 7.0
releases related to definstances in the presence of multiple modules,
although the symptoms don't sound precisely right.

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


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




Re: JESS: multiple shadow fact templates

2005-11-02 Thread ejfried
I think Scott Moss wrote:

 The order in which rules are fired depends first on the conflict
 resolution strategy, but if two rules are of equal priority by that
 criterion, then they'll fire in an arbitrary order that just falls out
 of the Rete network implementation. That order is affected by, but
 isn't equal to nor even easily predicatable from, the order in which
 the rules are defined.
   
 That's good to know since one of our developments will be to implement a 
 conflict resolution strategy  sound and consistent with a formal logic 
 or, more likely, several  conflict resolution strategies based  on 
 several logics.  The ability to do this is, I think, one of the great 
 strengths of Jess from a modeller's point of view.  I imagine that, in 
 so doing, the order of the defrule statements can be entirely 
 irrelevant.  Is that right?

Only if you replace the existing arbitrary-but-not-random order with
your own arbitrary-but-not-random order. As a trivial example, these
two rules:

(defrule rule-1
  = )

(defrule rule-2
  = )

will fire in an arbitrary order which will definitely depend on the
order in which they're defined. To remove that dependency in your
strategy implementation, you'd have to order them based on dictionary
ordering of their names, or some other arbitrary criterion.

But the point is that yes, you could do that.

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


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




Re: JESS: String to Symbol

2005-11-03 Thread ejfried
I think [EMAIL PROTECTED] wrote:

 How can I convert a string into a symbol?

In Java, 

  String string = whatever;
  Value symbol = new Value(string, RU.SYMBOL);

In Jess, 

  (bind ?string whatever)
  (bind ?symbol (sym-cat ?string))

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


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




Re: JESS: empty list pattern and ppdefrule

2005-11-03 Thread ejfried
I think Jonathan Sewall wrote:

 However, in Jess v7.0b4, ppdefrule omits the (data ) pattern from
 its output.  Is our simpler syntax for testing multislots
 unsupported?  Many thanks,

Seems to work as ever; this is apparently just a bug in the
pretty-printer. Thanks for the report.



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


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




Re: JESS: RE: Understanding JESS

2005-11-04 Thread ejfried
I think Daniela CLARO wrote:
 
 However I have more two questions, the first one I thought that (reset)
 clear my knowledge base, I mean, my facts, rules, all things and actually it
 doesn't. What is the command I can use to clear my knowledge base? 

There's a chapter entitled The Jess Function List near the end of
the manual; it gives some documentation for every function in
Jess. You can read that to see what (reset) actually does. There's
also a cross-reference page that groups functions by functional area,
to help you find related functions. The one you're looking for is
(clear). 

 
 More one thing, is there any command that lists all facts before execution,
 for example, I only want to know which facts I have put in my knowledge base
 before execution.  

It's (facts).


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


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




Re: JESS: String to Symbol

2005-11-08 Thread ejfried
I think Roger Studner wrote:

 
 (defrule count-icd9-codes
 
 ?c - (accumulate (bind ?count 0) ;; initializer
 (bind ?count (+ ?count 1)) ;; action
 ?count ;; result
 (encounter (code ?c : (eq ?c 440)))
   )

...
 This (and anything in the accumlates match area) *always* returns 0 as the
 count variable. I took the example (modified) from the 7.0 'new features'
 area of the docs.


You've used the same variable ?c to mean two totally different things
in the same pattern: you're binding the result of the accumulate to
it, but you're also binding the contents of the code slot to
it. This is tricky enough that even I would have to trace through with
a debugger to see what will happen -- but I can guarantee you that it
won't be the answer you're expecting! 

Finally, note that there's no reason to write patterns like this

   (encounter (code ?c : (eq ?c 440)))

when the following is equivalent but simpler, clearer, *and* more
efficient:

   (encounter (code 440))

Conveniently, making this change will also fix the problem outlined above!

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


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




Re: JESS: Behavior change from 6.1p7 to 7.0b3 with modify function

2005-11-08 Thread ejfried
I think Jon Weygandt wrote:

 it looks like modifying a fact sometimes requires the equivalent of:
 
 For each slot modified
 {
 Retract the fact
 Set the slot
 Assert the fact
 }

Yes, more or less. Special versions of retract and assert can be
used to cut a few corners in this specific case, but that's just how
the Rete algorithm works. Same way re-hashing a hash table works, too,
if you think about it, more or less.

 
 Although in 6.1p7 it appears that from the rules modify accepts multiple
 slot/values and is optimized (whereas Rete offers only a single
 slot/value at a time) and 7.0b3 seems to do the inefficient loop.
 

Jess 6 and earlier would retract the fact, modify all the slots, then
assert. The current version of Jess 7 will do the whole cycle for each
modified slot. The reason for this is that the slot-specific
activation features need to know the slot that's been modified when
the assert is done. There are two ways to accomplish this: either
provide a collection of slot names and allow multiple simultaneous
modifies, or change things to really only modify one slot at a time,
and then pass around just the one slot name.

I've gone back and forth on which is better. Obviously it depends on
how frequently a program uses the multiple-modify syntax. If it's used
infrequently, then forcing the Rete network to iterate over all those
one-item collections is inefficient. If multiple-modify is used a lot,
then it's a net gain to pass the collections around.

My impression is that multiple modify -- i.e.,

   (modify ?fact (slot-1 X) (slot-2 Y) (slot-3 Z))

is used infrequently. I'd be interested to hear otherwise, though!



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


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




Re: JESS: How does the pattern match: ?trans_state SI | MI | EI

2005-11-08 Thread ejfried
I think Jon Weygandt wrote:
 Jess,

That's her picture on the cover of Jess in Action :) 

(TRANS_STATE ?trans_state  SI | MI | EI)

 
 My procedural view would be the pattern is evaluated as:
 (TRANS_STATE (?trans_state  SI) | MI | EI)
 And if the match for SI fails, not sure what ?trans_state would be.
 
 However from testing, it looks like the binding is a byproduct of the
 first test and the statement is really evaluated like:
 (TRANS_STATE ?trans_state  (SI | MI | EI))
 But to write this results in a compile time error.
 

The | connective is actually handled by transforming it into calls
to the and and or predicate functions:

Jess (defrule foo (TRANS_STATE ?trans_state  SI | MI | EI) = )
TRUE
Jess (ppdefrule foo)
(defrule MAIN::foo
   (MAIN::TRANS_STATE ?trans_state:(or (eq SI ?trans_state)
(eq MI ?trans_state)
(eq EI ?trans_state)))
   =)

The meaning is somewhat different if this pattern were unifying with
?trans_state rather than defining it: e.g., 

Jess (defrule foo (X ?trans_state) (TRANS_STATE ?trans_state  SI | MI | EI) 
= )
TRUE
Jess (ppdefrule foo)
(ppdefrule foo)
(defrule MAIN::foo
   (MAIN::X ?trans_state)
   (MAIN::TRANS_STATE
  ?_blank_1:(or (and (eq ?trans_state ?_blank_1) (eq SI ?_blank_1))
 (eq MI ?_blank_1)
 (eq EI ?_blank_1)))
   =)


Now, it actually matches your original intuition.

The general rule  is that  binds more tightly than |, except that
variable definitions are moved outside the whole conditional
expression. ~ binds tighter still.

If you need to express more complex logic than you can with , |, and
~, you can use the and, or, and not predicate functions directly.

 
 BTW the original customer written rule has the TRANS_STATE slot twice in
 the pattern match. This fails as it seems the binding to ?trans_state
 isn't done, and thus the test for ~?trans_state always returns true.
 

This issue has been reported before; it's on the list of things to
fix. Thanks for the reminder.


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


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




Re: JESS: String to Symbol

2005-11-08 Thread ejfried
I think Roger Studner wrote:
 
 (deftemplate employee
 (slot salary))
 (deffacts employee-facts
 (employee (salary 1007700))
 (employee (salary 1002347700))
 (employee (salary 107712000))
 )
 (watch all)
 (reset)
 
 (defrule count-highly-paid-employees
 ?c - (accumulate (bind ?count 0) ;; initializer
 (bind ?count (+ ?count 1)) ;; action
 ?count ;; result
 (employee (salary ?s:( ?s 10 ;; CE
 =
 (printout t ?c  employees make more than $10/year. crlf))
 
 (run)
 


Move the reset *after* you define the rule (the normal pattern is to
define rules, then add data) and it works fine. This shouldn't matter,
but it apparently does. Congratulations, you've found a bug! Thanks
for the report.


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


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




Re: JESS: Strange Jess / Eclipse crash

2005-11-09 Thread ejfried
I think Matthew Hutchinson wrote:
[Charset iso-8859-1 unsupported, filtering to ASCII...]
 G'day everyone,
 
 This is more of an Eclipse question, however, I only get this error when
 trying to open CLP files. Eclipse with Jess has been working fine for weeks,
 and now suddenly Eclipse completely closes when i double-click a CLP file to
 edit it in eclipse. I have not changed any classpath stuff, or anytihng
 else. I really need to this to work... :-(

Your 30-day trial version of Jess has expired. You can get an academic
license at no cost by contacting Craig Smith, [EMAIL PROTECTED]

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


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




Re: JESS: Strange Jess / Eclipse crash

2005-11-09 Thread ejfried
I think Matthew Hutchinson wrote:
[Charset iso-8859-1 unsupported, filtering to ASCII...]
 Hi,
 
 Actually, I have already got the full version from Craig and it works fine.
 Also, my classpath and eclipse stuff is all set to the full version jar file
 also.

Good, but be that as it may, one can still clearly see the obfuscated
class names of the trial version JAR file in the stack trace you sent
in your earlier message. Find all copies of jess.jar on your machine,
and replace them with known good ones from the licensed distribution.


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


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




Re: JESS: Checking if a fact exists

2005-11-09 Thread ejfried
I think [EMAIL PROTECTED] wrote:

 
 (defrule rule1
   (x1 value1 ?cf1)
   (x2 value2 ?cf2)
   (x3 value3 ?cf3)
   =
   (assert (x3 value3 (min ?cf1 ?cf2 ?cf3)))

Perhaps this rule should retract or modify the existing fact, rather
than asserting a second one, as this does?

 (defrule rule2
   (x1 value1 ?cf1)
   (x2 value2 ?cf2)
   =
   (assert (x3 value3 (min ?cf1 ?cf2)))
 )

And this one should surely include a pattern like

(not (x3 value3 ?))

or otherwise it will fire whether there is an x3 fact or not.

 
 By this way, the number of rules of the system would duplicate. Is there a
 better solution?

You want to do one thing under one set of conditions, and another
thing under other conditions, so this really does warrant having two
separate rules. Jess will notice the similarities, by the way, and
share code in the Rete network for these two rules.



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


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




Re: JESS: variable facts

2005-11-11 Thread ejfried
I think =?iso-8859-1?Q?=5BEXTERN=5D_Manuel_Kollmu=DF?= wrote:

 Isn_t it possible to assert a variable as a fact or a variable fact?
 like this:
  
 (bind ?var number1)
 _.
 (assert (?var))

No, the type of the fact must be known when the call to assert is
compiled. You can use an extra level of indirection, though, by
building the code as a string and then evaluating it:

(eval (str-cat (assert ( ?var 




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


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




Re: JESS: Or problem

2005-11-11 Thread ejfried
I think mauricio rincon wrote:
[Charset iso-8859-1 unsupported, filtering to ASCII...]
 Hi...
 I have a problem with OR (v) operator. I_m using this operator in a rule, 
 that should be fired only once when both of the conditions happened . The 
 problem is that if both events are happening, the rule fires twice. example;
 
 (defrule names (or (name mao) (name july)) = (printout hello world))
  
 I_m getting: hello world
  hello world
  

In this particular case the solution is simple: use the 'or'
connective constraint, not the 'or' conditional element:

(defrule names (name mao|july) = (printout hello world))

In the general case, when the 'or' conditional element is really
needed, the solution is to make sure that when the rule fires, it has
some detectable effect, and then match the negation of that effect on the
left-hand-side of the rule; trivially

(defrule names
  (or (name mao) (name july))
  (not (names fired))   
  =
  (assert (names fired))
  (printout hello world))


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


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




Re: JESS: Multifield matching nil

2005-11-11 Thread ejfried
I think Steve Solomon wrote:
 This is a minor complaint. Why can't one use nil to match an empty list?

Short answer: because Jess inherited its basic rule language semantics
from CLIPS, and that's how it works in CLIPS.

 Only the pattern (sprocket ?id) matches (sprocket 2) with no following
 symbols. I would have thought that (sprocket ?id nil) at least would
 also work, i.e. nil matching the empty list, especially considering that
 ~~nil matches a non-null symbol. Perhaps my concept of nil is influenced
 too much by Lisp.

Yes, that's pretty much it. Jess's 'nil' is more like Java's
'null'. In Lisp, 'nil' means an empty list, while in Java, 'null'
means no list at all, whereas an empty List is a List object with no
contents. In Lisp, there's no difference between these two ideas, but
there definitely is in Java and in Jess. Whereas in Lisp 'nil' means
'no value', in Java 'null' is a definite specific value; Jess is the
same way. 

Instead of using nil to match nothing in a list, you use
multifields, basically variables that start with $?, to match
nothing or something. The patterns

(sprocket ?id $?)
(sprocket 2 $?)
(sprocket $?)

all match both (sprocket 2) and (sprocket 2 3 4).



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


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




Re: JESS: slot-specific and multifields

2005-11-15 Thread ejfried
I think Greenblatt, Howard wrote:
 I have encountered some odd behavior using the slot-specific template
 declaration and multifields. 

Thanks for the report, Howard. With your nice example, it didn't take
long to track this down. Although slot-specific is the thing that
triggers the bug here, it was actually more primitive than that, and
had something to do with the handling of multiple multifields in a
single fact. This otherwise benign bug (i.e., until slot-specific was
implemented, nobody should ever have noticed) seems to have been in for
a while. 

The one-line fix, if you're playing along at home, is

[EMAIL PROTECTED] Jess]$ cvs diff -r 1.5 -r 1.6 jess/Node1MTMF.java
Index: jess/Node1MTMF.java
===
RCS file: /home/ejfried/cvsroot/Jess/jess/Node1MTMF.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -r1.5 -r1.6
98c98
 f.setIcon(oldFact);
---
 f.setIcon(oldFact.getIcon());



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


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




Re: JESS: Debugger

2005-11-16 Thread ejfried
I think Jeffrey Davine wrote:
 
 I'll do the research, but as a general matter, do you think the Jess API
 exposes enough information (particularly concerning the rete tokens) so that
 I could write such a tool?

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

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

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

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

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

Any and all contributions welcome.


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


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




Re: JESS: Converting Object to Object[]

2005-11-17 Thread ejfried

Jess's usual representation for arrays is a Jess list -- is that what
you're looking for? There isn't a public API built into Jess for
turning an array into a List, but now that you're pointing out the
need, it seems like a good addition. For now, though, your obj2array
function is the best way to go.


I think Yura wrote:
[Charset koi8-r unsupported, filtering to ASCII...]
 Hi jess-users
 
 Is there any way 2 convert Object to Object[]? I need 2 pass several arrays 
 from Java to Jess so I wrapped them in a Vector. But executing
 (call ?vector get 0)
 returns just
 Java-Object:[Ljava.lang.Object;
 I can write some wrapper like
 Object[] obj2array(Object)
 but probably Jess can handle such situations?
 
 Yuri



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


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




Re: JESS: Object to built-in type

2005-11-18 Thread ejfried
I think Roger Studner wrote:

 v = new Value(l, RU.SYMBOL);
...
 v = new Value(i, RU.SYMBOL);

For the record, note that both of these lines will throw exceptions at
runtime. To contstruct an RU.SYMBOL from a numeric type, you have to
convert the value to a String yourself and pass that String to the
Value constructor.


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


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




Re: JESS: Conflic Resolution Implementation

2005-11-21 Thread ejfried
There's no tutorial guide or anything like that. The basic procedure
is very easy: implement the jess.Strategy interface, then use
(set-strategy classname) to load it into Jess. There's really just
the one compare() method to write; it's supposed to implement the
spaceship operator (ie., comparison that returns negative, 0, or
positive to indicate how the activations should be ordered.) As long
as your ordering is internally consistent, it can be anything you
want. You can even ignore salience if you'd like, so that a perfectly
valid implementation could be something as simple as

/**
 * A Jess conflict resolution strategy that gives priority to 
 * rules with more patterns.
 */
public SizeStrategy implements jess.Strategy {
public int compare(Activation a1, Activation a2) {
return a1.getToken().getSize() - a2.getToken().getSize();
}
public String getName() { return size; }
}




I think Bogdan Werth wrote:
[Charset iso-8859-1 unsupported, filtering to ASCII...]
 Hi,
 I just wondered whether there are any place where I can get some more 
 information about how to write your own conflict resolution strategy for 
 Jess. There is a bit of information about this issue in Jess In Action 
 but not enough to start your own development. I am doing agent based 
 modeling with Jess and RePast and one of developments in the course of 
 my PhD will be to implement a conflict resolution strategy  sound and 
 consistent with a formal logic or, more likely, several  conflict 
 resolution strategies based  on several logics.
 
 Many thanks in beforehand.
 
 -- 
 
 Bogdan Werth
 Doctoral Researcher Centre for Policy Modelling
 The Graduate School of Business
 Aytoun Building
 Aytoun Street
 Manchester
 M1 3GH
 UK
 Tel: +44 161 247 6481
 Fax: +44 161 247 6802
 Email: [EMAIL PROTECTED]
 Web: http://cfpm.org/~bogdan
 
 **
 Before acting on this email or opening any attachments you
 should read the Manchester Metropolitan University's email
 disclaimer available on its website
 http://www.mmu.ac.uk/emaildisclaimer
 ***  
 
 
 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]
 
 



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


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




Re: JESS: Template Hierarchy

2005-11-22 Thread ejfried
I think Jeffrey Davine wrote:
 Perhaps the place to ask this question is the Constantine Planning Wiki -
 but would it be difficult in the next version of Jess to implement a
 hierarchical template structure? 
...
 (deftemplate Individual extends LegalAgent

OK, let's get in the time machine... going back... mucking with the
space time continuum... writing a little code...

OK, I'm back! Jess has had exactly the feature you describe, using
your proposed syntax, since version 5.0a1. It works exactly as you
describe. The code you've shown here ought to work perfectly.

Thank you!

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


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




Re: JESS: Size of an activation record

2005-11-22 Thread ejfried
I think Roger Studner wrote:
 
 Is there (I read something 'akin' to this in the mailing archive) a big
 performance hit as well?

 I like to use beans/shadow facts for a variety of reasons, but have always
 been under the impression that when i'm going to assert a 'huge' number of a
 particular fact type, that I should be using a deftemplate/fact API versus
 just using defclass/definstance of a bean representing the exact same
 information.

There *was* a performance issue in earlier versions of Jess 6 related
to Fact slots containing Java objects (doesn't matter whether the Fact
is a plan fact or a shadow fact.) The issue was that Jess didn't do
the kind of efficient indexing of those slots that it can do with
primitive types. That's been cleared up now. There's no performance
penalty for using definstances.



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


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




Re: JESS: Editor couldn't be initialized

2005-11-23 Thread ejfried
I think Yura wrote:
 
 I'm receiving the Editor couldn't be initialized when trying to open
 clp-files in Jess70b4-editor (yes, I tried the -clean switch). Jess70b3
 works well. Can anybody help?

JessDE 7.0b4 now requires Eclipse 3.1 -- the sudden changeover with
this particular version wasn't really intentional, and should have
been noted in the release notes. In any case, because 3.1 is the
current release, and there have already been several 3.2 milestone
builds, I think this makes sense. It's likely that 3.1 will still be
the current version when 7.0 final is released.



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


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




Re: JESS: Fact object not in working memory error

2005-11-28 Thread ejfried

Most likely the problem is that some of your classes (perhaps
com.ngc.dts.domain.common.PerDiemEntitlement) have mutable hash codes,
making them unsuitable for use as keys in a hash table (try using one
of these objects as a key in a HashMap, change the values of some
properties, then try to look up the same object; it will fail) and
some properties of these objects are being modified outside of a
(modify) call. This causes problems in Jess 6. Jess 7 works around
this by providing a function that lets you warn Jess about this issue
for a particular class.


I think erich.oliphant wrote:
[Charset iso-8859-1 unsupported, filtering to ASCII...]
 I am having a strange problem.  I am getting the following error (debug
 included).  The populate-last-travel-day rule fires based on the presence of
 facf-5 (among others).  The error is thrown in the rule body where I try to
 modify f-5.  I am not sure how the fact cannot be in working memory as the
 rule fired because of it's existence (and I'm not retracting it)  The body of
 the rule only modifies this fact and asserts a new one.  These rules are
 driven from Java code and verified that the supporting Java object still
 exists at the time the exception is thrown.
 
 
 rule
 --
 (defrule populate-last-travel-day-entitlement 
   first day at perdiem location entitlement 
 ?arrlocation - (com.ngc.dts.domain.common.TripLocation 
   (arrivalTripItem ?ati) 
 (perDiemLocation ?x:(eq ?x nil))) 
 (test (neq (?ati getTravelDate) nil))
 ?perdiemLocation - (com.ngc.dts.domain.common.TripLocation 
   (departureTripItem ?dti) 
   (perDiemLocation ?pdLocation:(neq ?pdLocation nil)))
 ?entitlement - (com.ngc.dts.domain.common.PerDiemEntitlement (date
 ?pddate) ) 
 ;;@todo investigate why same-day is not working as expected
 ;;(test (neq (same-day (?dti getTravelDate) ?date) FALSE) ) 
 (test (call org.apache.commons.lang.time.DateUtils isSameDay (?ati
 getTravelDate) ?pddate))
 (test (call org.apache.commons.lang.time.DateUtils isSameDay (?dti
 getTravelDate) (?ati getTravelDate)))
 (not (travel-day (date ?pddate)))
 =
 ;; get the per 
 (bind ?mie (ognl-get ?pdLocation
 getEffectivePerDiemRate(#date).getMealsAndIncidentalsRate() date
 (fact-slot-value ?entitlement date)))
 (modify ?entitlement 
 (perDiemLocation ?pdLocation)
 (mealsAndIncidentalsAllowed (?mie multiply .75)))
 (assert (travel-day (date ?pddate)))
 )
 
 --
 debug and error
 --
 
 
 MAIN::populate-first-travel-day-entitlement: +1+1+1+2+1+2+1+2+1+2+2+2+t
 MAIN::populate-last-travel-day-entitlement: =1=1=1+2=1+2=1+2+2+2=1+2+t
 MAIN::populate-full-perdiem-day-entitlements: =1=1+1+2+2=1+2+2+2+1+2+t
 MAIN::assign-cmr: =1+1+1=1+2+2+2+2+a+2+t
 MAIN::assign-pmr: =1=1=1=1=2+2+t
 MAIN::assert-entitlements: +1+1+t
 MAIN::assign-gmr: =1=1=1=1=2+2+2+2+t
 MAIN::zero-allowed-duty-conditions: =1+1+1+1+2+t
 MAIN::actual-lodging: =1=1=1=1+2+t
 MAIN::assert-entitlements: +1+1+t
  == f-0 (MAIN::com.ngc.dts.domain.common.Trip (auth
 Java-Object:com.ngc.dts.domain.common.Authorization) (class
 Java-Object:java.lang.Class) (documentKey nil) (endDate nil) (endLocation
 nil) (id nil) (startDate nil) (startLocation nil) (taNumber nil)
 (travelOrderComments nil) (tripDescription nil) (tripDuration nil)
 (tripLocations Java-Object:java.util.ArrayList) (tripNumber 1) (tripProfile
 nil) (tripPurpose nil) (tripType nil) (OBJECT
 Java-Object:com.ngc.dts.domain.common.Trip))
 == Activation: MAIN::assert-entitlements :  f-0
 FIRE 1 MAIN::assert-entitlements f-0
  == f-1 (MAIN::com.ngc.dts.domain.common.PerDiemEntitlement
 (acutalLodgingCostLimit nil) (class Java-Object:java.lang.Class) (date
 Java-Object:java.util.GregorianCalendar) (dutyConditions
 Java-Object:java.util.HashSet) (leave nil) (lodgingAllowed nil)
 (lodgingExpense Java-Object:com.ngc.dts.domain.common.Expense)
 (mealsAndIncidentalsAllowed nil) (mealsAndIncidentalsExpense
 Java-Object:com.ngc.dts.domain.common.Expense) (otherEntitlementType nil)
 (perDiemLocation nil) (OBJECT
 Java-Object:com.ngc.dts.domain.common.PerDiemEntitlement))
 ent date from code: 01/01/2006 12:00 PM
  == f-2 (MAIN::com.ngc.dts.domain.common.PerDiemEntitlement
 (acutalLodgingCostLimit nil) (class Java-Object:java.lang.Class) (date
 Java-Object:java.util.GregorianCalendar) (dutyConditions
 Java-Object:java.util.HashSet) (leave nil) (lodgingAllowed nil)
 (lodgingExpense Java-Object:com.ngc.dts.domain.common.Expense)
 (mealsAndIncidentalsAllowed nil) (mealsAndIncidentalsExpense
 Java-Object:com.ngc.dts.domain.common.Expense) (otherEntitlementType nil)
 (perDiemLocation nil) (OBJECT
 Java-Object:com.ngc.dts.domain.common.PerDiemEntitlement))
 ent date from code: 01/02/2006 12:00 PM
  == f-3 (MAIN::com.ngc.dts.domain.common.PerDiemEntitlement
 (acutalLodgingCostLimit nil) (class Java-Object:java.lang.Class) (date
 

Re: JESS: Userfunctions and Jess - Java type conversion

2005-12-01 Thread ejfried
I think erich.oliphant wrote:
[Charset iso-8859-1 unsupported, filtering to ASCII...]
 Hmm, ok thanks, I understand better now.  However, jess.Userfunctions return
 Value's so is there anything I can do in that case to activate the type
 conversion?  I tried Value.resolve() but that did not help.
 

You know, there's not actually a public API for getting Jess to do
those conversions on demand from Java, although you've made a good
case as to why there should be. The method you want is the static
method jess.ReflectFunctions.objectToValue(), which takes two
arguments, the object and the class of the Object; this is so that you
can pass (for example) java.lang.Boolean as a Boolean.class or as a
Boolean.TYPE -- i.e., a primitive. You could simply use obj and
obj.getClass() as the two arguments. Since it's private, you could
either change the source to make it public, or you could call the method
reflectively using something like

   Object prop = ...
   Method oTV = 
Class.forName(jess.ReflectFunctions).getMethod(objectToValue);
   oTV.setAccessible(true);
   Value result = (Value) oTV.invoke(null, new Object[] {prop, 
prop.getClass()});

Of course, you'd probably want to get the Method object and cache it
in a member variable someplace, and then stick all of this into your
own objectToValue method.


-
Ernest Friedman-Hill  
Advanced Software Research  Phone: (925) 294-2154
Sandia National LabsFAX:   (925) 294-2234
PO Box 969, MS 9012 [EMAIL PROTECTED]
Livermore, CA 94550 http://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: Userfunctions and Jess - Java type conversion

2005-12-01 Thread ejfried
I think erich.oliphant wrote:
 I tried that function, but it doesn't seem to exist on the
 jess.ReflectFunctions class (I am using 7.0 beta 4.  There seems to be a a
 static Value a(Class, Object) throws JessException method based on browsing
 the class file. Could this be it?  

You're not using a licensed version of Jess. Contact Craig Smith,
[EMAIL PROTECTED], to obtain a license.

 
 Also, in regards to the original question, just thought about something. 
 Since returning new Value(Boolean()) from my userfunction returns the Java
 Object, I'm still not clear about why this didn't work:
 
 (test (eq (ognl-get ?obj booleanProperty) (Boolean.TRUE)))
 
 shouldn't 'eq' call returnedObj.equals(Boolean.TRUE) ?

The Jess function (Boolean.TRUE) returns the symbol TRUE, which is not
the same at the Java object Boolean.TRUE; as I said before, calling a
Java function from Jess reflectively always converts the result to a
Jess data type.


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


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




Re: JESS: Re: Bug

2005-12-02 Thread ejfried
I think Yura wrote:
 I'm sorry - it's there in the manual. I should be more attentive.

By my calculation, you've reported 4 bugs, and 3 of them were real --
so you're batting .750 . Seems like an excellent average to me!



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


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




Re: JESS: Probelm with property change listeners in Jess7b4

2005-12-08 Thread ejfried
Hi,

In Jess 7.0b3, the default for definstance type changed from dynamic
to auto. If you specified dynamic as the last argument to
definstance, then Jess would try to register itself with your Bean as
a PropertyChangeListener; this used to be the default, so that you had
to write static if you didn't want this behavior. The new default is
auto. In this case, Jess looks at the Bean to see if it accepts
PropertyChangeListeners and only registers itself if the Bean does,
indeed, accept them.

Jess's current definition of indeed accepts them is that the
following two methods exist with these exact signatures:

public void addPropertyChangeListener(PropertyChangeListener);
public void removePropertyChangeListener(PropertyChangeListener);

So if this worked for you in dynamic mode, my guess is that your
Beans don't have the removePropertyChangeListener method. The right
thing to do is add it, but a band-aid would be to say

(definstance block ?g dynamic)

This will work until you try undefinstance which, of course, won't
work (it never did.)

If I've guessed wrong, and it's something else, let me know, please!

I think Dusan Sormaz wrote:
[Charset iso-8859-1 unsupported, filtering to ASCII...]
 I am running example that uses property change listeners to update shadow 
 fact when object changes.
 
 Problem that I have is that running same code in Jess7.0b2 and Jess7.0b4 
 produces different results. Here is the log for both:
 
 Jess, the Rule Engine for the Java Platform
 Copyright (C) 2005 Sandia Corporation
 Jess Version 7.0b4 11/1/2005
 
 Jess (require defclasses)
 defclasses
 Jess (bind ?g (new Block G))
 Java-Object:edu.ohiou.imse.ise891.blockworld.Block
 Jess (definstance block ?g)
 Fact-0
 Jess (facts)
 f-0   (MAIN::block (class Java-Object:java.lang.Class) (name G) (OBJECT 
 Java-Object:edu.ohiou.imse.ise891.blockworld.Block))
 For a total of 1 facts in module MAIN.
 Jess (?g setName gfd)
 before PCS
 after PCS
 Jess (facts)
 f-0   (MAIN::block (class Java-Object:java.lang.Class) (name G) (OBJECT 
 Java-Object:edu.ohiou.imse.ise891.blockworld.Block))
 For a total of 1 facts in module MAIN.
 Jess
 
 
 Jess, the Rule Engine for the Java Platform
 Copyright (C) 2005 Sandia Corporation
 Jess Version 7.0b2 8/11/2005
 
 Jess (require defclasses)
 defclasses
 Jess (bind ?g (new Block G))
 External-Address:edu.ohiou.imse.ise891.blockworld.Block
 Jess (definstance block ?g)
 Fact-0
 Jess (facts)
 f-0   (MAIN::block (class External-Address:java.lang.Class) (name G) 
 (OBJECT External-Address:edu.ohiou.imse.ise891.blockworld.Block))
 For a total of 1 facts in module MAIN.
 Jess (?g setName gfd)
 before PCS
 after PCS
 Jess (facts)
 f-0   (MAIN::block (class External-Address:java.lang.Class) (name gfd) 
 (OBJECT External-Address:edu.ohiou.imse.ise891.blockworld.Block))
 For a total of 1 facts in module MAIN.
 Jess
 
 
 While Jess7.0b2 works as expected, Jess7.0b4 doe snot update fact when 
 object changes.
 
 Any ideas why is this happening?
 
 Dusan Sormaz
 
 
 
 *
 * Du_an _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/~sormazhttp://www.ent.ohiou.edu/~sormaz
 *  



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


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




Re: JESS: Bug?

2005-12-08 Thread ejfried
I think Yura wrote:
[Charset koi8-r unsupported, filtering to ASCII...]
 Hi jess-users
 
 JessDE doesn't parse this rule (saying: 'TRUE' is a symbol, not an integer):
 
 (defrule rule (declare (salience (+ 1 1))) = )
 
 whereas Jesp makes no complaints.

Yep. I can reproduce this and now that you point it out, I immediately
see what's happening. Thanks for the report.



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


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




Re: JESS: DefRule - Memory Leak

2005-12-09 Thread ejfried
I think Hariprasath Manivannan wrote:

 
 - Has anyone faced this issue with Jess5.0? If so please send the possible
 solutions.

Jess 5.0 is unsupported. The last release of any version of Jess 5 was
5.2 in June, 2000; that's over five years ago. Jess has evolved
considerably since then, and many bugs have been fixed, including, as
you might expect, various memory leaks. My suggestion is to upgrade to
the current version.

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


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




Re: JESS: defadvice before/after bug?

2005-12-09 Thread ejfried
I think [EMAIL PROTECTED] wrote:

 Am I wrong to say that the 'misfeature' mentioned below hasn't made it 
 into a feature yet in the latest release 7.0 b4?
 Is there any plan to still add it in time for 7.0 final?
 
 I've written defadvice for every numeric Jess-function (+, -, *, /, , =, 
 , =, =, , min, max, div, ...) to support BigDecimals only to discover 
 that they don't support nesting.
 The only solution I see for now is to convert them into deffunctions, and 
 go through all my rules one by one to change the function call.
 

This had completely fallen off the radar, but now that you've
brought it up, I'll put it on the list. Thanks for the reminder.




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


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




Re: JESS: Problems with SWT_AWT in Eclipse on MacOS X

2005-12-09 Thread ejfried
I think Dona Mommsen wrote:

 On MacOS X, Eclipse will crash with error:
 
  Can't start the AWT because Java was started on the first thread. Make 
  sure StartOnFirstThread is
   not specified in your application's Info.plist or on the command line
 

Yes, I can reproduce this on my Powerbook. There is an excellent
workaround that could be implemented, and in fact it's not really a
workaround but a better way of doing things which would improve other
parts of the JessDE as well -- but it's a chunk of work that probably
won't be done for Charlemagne.

As an alternative, I could offer the option to disable validating Java
class names, and then have validation turned off for Macs.



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


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




Re: JESS: Which comes first, the chicken or the rule?

2005-12-13 Thread ejfried
I think Matthew Hutchinson wrote:
 
 Just a conceptual question... since starting with Jess, it always seemed to
 me generally you have the rules established first, then load in facts which
 in turn trigger these rules. No problems there. But is it proper to
 consider having the facts already in memory and *then* adding rules which I
 know will trigger - basically a sort of query on the data mentality? Is
 this a bad concept?

Jess will work either way; you can even add rules to a running
program. But in general, Jess is designed with the rules, then facts
paradigm in mind. For a given collection of facts and rules, defining
the rules first, then populating working memory will be faster than
doing thing the other way around -- but both ways are correct and will
work fine.

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


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




Re: JESS: Help on the syntax of a rule.

2005-12-21 Thread ejfried
I think ROSSEL, Olivier (CIMPA) wrote:

 I am using Jess with Protege.  I want to write a rule that says: run
 when you get an oject FOO with a non-empty slot called 'name' and
 where there is no fact foo with property bar equal to the slot
 value.  I would intuitively wirte that this way:

 (defrule doStuff  
  ?o - (object (is-a FOO) (name ?name~nil))
  (not (foo (bar ?name)))
 =
 ...
 )
 
 Is it a correct syntax?

There were some extra close-parentheses, which I've removed. I also
added a not nil condition to meet the non-empty requirement,
assuming that nil is the default value for that slot. Other than
that's it's fine as far as I know -- whether it's actually correct or
not depends on the object and foo templates.


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




JESS: Problem with trial distribution

2006-01-17 Thread ejfried

Several people have reported that there was a problem with the
distribution file for the trial version (only) of Jess 7.0b5. The
symptom is basically that the JessDE just doesn't work. The licensed
download is unaffected. I've corrected the problem and posted a new
binary. If you've been having trouble with the trial version (only),
then downloading this new file should fix them.

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


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




Re: JESS: Checking for null/nil on the RHS

2006-01-18 Thread ejfried
I think erich.oliphant wrote:
[Charset iso-8859-1 unsupported, filtering to ASCII...]

 (if (eq ?effRate nil) then 
 ;;(dts-log-error No effective rate found for  (call
 com.ngc.dts.util.DateUtils formatDateTime ?pddate))
  return )

That return is just the symbol return, not the function call
(return). This symbol is the last expression in the if function
call, so if is returning it, but otherwise, it's just being ignored.

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


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




Re: JESS: ppdefrule doesn't make sense - is this a Jess 6.1 bug?

2006-01-19 Thread ejfried
I think Hector Urroz wrote:
[Charset iso-8859-1 unsupported, filtering to ASCII...]
 Thanks for the response. It does seem a bit odd to automatically and
 silently modify code. Why not throw an exception? Is this done elsewhere in
 Jess? What is the rationale? Did I stumble onto a reserved rule name?
 

Some rules get transformed in various ways as they are compiled -- for
example, | connectives are actually transformed into or function
calls, and ppdefrule will show them that way. And Jess inserts an
initial-fact pattern in various situations; this is described in the
manual. But I think this is only case where Jess inserts a pattern
than matches a user template. As I recall, it was done for defensive
reasons: because if Jess doesn't insert that pattern, then if people
don't include it themselves (which is the right thing to do 99.99% of
the time) there will be extra, spurious firings of the need-X rules,
and I got tired of explaining why they were happening.


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


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




Re: JESS: JESS website

2006-01-19 Thread ejfried
I think Vageesh Setty wrote:
[Charset iso-8859-1 unsupported, filtering to ASCII...]
 Website seems to be down for a while.. is 
 http://herzberg.ca.sandia.gov/jess/docs/70/programming.html right URL?
  

It's OK now. Thanks.



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


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




Re: JESS: Watch all - '1 ' inside defrule

2006-01-24 Thread ejfried
I think Daniela CLARO wrote:

 MAIN::installer-barreaux-metallique: =1=1=1=1+t
 MAIN::installer-barreaux-metallique1: =1=1=1=1+t
 
 What actually this means for Jess? 

Internally, Jess breaks rules containing the or conditional element
into multiple rules. In general, you shouldn't worry about it; it
doesn't affect how you work with Jess.


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


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




Re: JESS: retract doesn't work like I want it to do

2006-01-27 Thread ejfried
I think =?iso-8859-1?Q?H=FCbner?= wrote:
[Charset iso-8859-1 unsupported, filtering to ASCII...]
 Hello everybody,
 
 I need a hint from you. When I try to retract a fact, all other facts are
 reactivated.
...
 Can somebody tell me what's wrong with the code?

You've got a bunch of rules with the pattern

(not (repair ?))

When you assert a fact like (repair X), all these rules are
deactivated. When you later retract the repair fact, all these rules
are activated again. This is how things are supposed to work.

If these rules are no longer relevant, then you have to make that
explicit. You could use multiple modules, so that the rules that
matter in each stage are in their own module, and the focus could be
changed over time; or you can use a phase fact: a special fact that
indicates which set of rules matter, and all the rules can match it as
appropriate.




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


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




Re: JESS: Finding fact the max/min slot value

2006-02-01 Thread ejfried
I think erich.oliphant wrote:
[Charset iso-8859-1 unsupported, filtering to ASCII...]
 Hi,
 I am trying to figure out the best way to have a rule fire only for a fact
 whose slot value is the min or max of a group of facts.

Match a negated pattern to the (nonexistent) fact in which some
number is greater than the greatest value.

 (defrule biggest-number
 (number (value ?val))
 (not (number (value ?val2:( ?val2 ?val
 =
 )


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


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




Re: JESS: Logical dependency bug?

2006-02-02 Thread ejfried

I'd call that a bug, yes. Thanks.

I think Yura wrote:

 Don't know whether it's a bug but after
 
 (deffunction fun () (assert (b 2)))
 (defrule rule (logical (a))=(assert (b 1)))
 (defrule rule2 (logical (a))=(fun))
 (assert (a))
 (run)
 
 (retract 0) deletes only (a) and (b 1). (b 2) doesn't seem to have a logical
 dependency on (a).
 

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


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




Re: JESS: persistent storage of facts and rules

2006-02-21 Thread ejfried
I think Matthew Hutchinson wrote:
 g'day everyone,
 
 when it comes to sotrage of rules and facts, how are most people handling
 it? Are you using JessML? Also, has anyone been storing the JessML in a
 database?

I don't think too many projects are using JessML yet, although I
expect that many will after the final release. The specifics of the
JessML language have still been changing a bit.

Those installations that don't store rules in flat files often use
Jess language rules stored in a VARCHAR column in a database. I know
of many systems of this type.

 
 as far as facts are concerned, do y'all just store them in plain text files?
 i also noticed that the Rete object is serializable, is this feature used
 often?

Most large applications use Java objects rather than native Jess
facts, and those objects are stored in the usual ways, independent of
Jess. But flat files (as are produced by save-facts) work well for
plain facts.

Rete's serializability is used by the bload/bsave commands, and it's
also used by some mobile agent frameworks. In a few cases it's been
used for web app clustering, although I think a Rete object is
somewhat heavyweight to be put into a session.

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


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




Re: JESS: Question on defadvice

2006-02-21 Thread ejfried
I think Lakshmi Vempati wrote:
[Charset iso-8859-1 unsupported, filtering to ASCII...]
 I am trying to use defadvice (before reset and after clear) and I 
 noticed the following problem:
 
 If reset (or clear) is invoked via a a programmatic call to the reset 
 (or clear) method defined in the Rete class,
 it does not trigger the defadvice but if  instead I execute either reset 
 (or clear) on the command line or use the executeCommand method defined 
 in the Rete class, it does trigger the defadvice.


This is precisely how things should work. You're adding advice to the
(reset) and (clear) functions in the Jess language; the functioning of
the Rete.reset() and Rete.clear() Java methods is unaffected.

If you want to execute some code every time Rete.reset() is called,
you can register a JessListener with the Rete object.


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