Re: JESS: Interpretation problem and (reset)
I think [luca Marchesotti] wrote: > Dear all, > i have got an interpretation problem with the jess > output .. > > q1)Can anyone explain me what the lines between $$ > mean? > > ==> Activation: send-request-for-merging : f-2, The rule send-request-for-merging is activated by fact 2 > FIRE 1 send-request-for-merging f-2, It fires > <== f-2 (OldGuy (agent "ALuca") (percent > 0.9528794884681702) (time "945301532571")) and retracts fact 2 > > <== Activation: send-request-for-merging : f-2, Because the activation has fired, it is withdrawn > ==> f-3 (OldGuy (agent "ALuca") (percent > 0.9528794884681702) (time "945301532611")) It looks like send-request-for-merging modifies the "OldGuy" fact that activated it > ==> Activation: send-request-for-merging : f-3 This new version reactivates the rule. > $ > > In particular i can't understand the meaning of : > > <== Activation: > > does it mean that the correspondant rule has been > fired?? > > why the custom FIRE does not appear?? It does, just above the $$. The rule has already fired. > > q2)I found that putting at the end of my rule the > (reset) > can have bad consequencies on the execution of my > rules > What does exactly reset do?? Manual section 8.110 (the entry in the function list for "reset") is fairly clear: Description: Removes all facts from the fact list, removes all activations, then asserts the fact (initial-fact), then asserts all facts found in deffacts, asserts a fact representing each registered definstance, and (if the set-reset-globals property is TRUE) initializes all defglobals. > > > thanks a lot Luca > > > = > . > _ | Luca Marchesotti | _ > _ > / )|Vision Lab |( \ >/ / |Kingston University | \ \ > _( ( | _ kt6 5bj London _ | ) )_ > (((\ \ |_/ )( \_| / /))) > ( \_/ / \ \_/ ) > __ > Do You Yahoo!? > Thousands of Stores. Millions of Products. All in one place. > Yahoo! Shopping: http://shopping.yahoo.com > - > To unsubscribe, send the words 'unsubscribe jess-users [EMAIL PROTECTED]' > in the BODY of a message to [EMAIL PROTECTED], NOT to the > list (use your own address!) List problems? Notify [EMAIL PROTECTED] > - > - Ernest Friedman-Hill Distributed Systems ResearchPhone: (925) 294-2154 Sandia National LabsFAX: (925) 294-2234 Org. 8920, MS 9012 [EMAIL PROTECTED] PO Box 969 http://herzberg.ca.sandia.gov Livermore, CA 94550 - To unsubscribe, send the words 'unsubscribe jess-users [EMAIL PROTECTED]' in the BODY of a message to [EMAIL PROTECTED], NOT to the list (use your own address!) List problems? Notify [EMAIL PROTECTED] -
Re: JESS: Where is the output stream of Jess?
Read manual section 4.4.6, I/O Routers. I think An Hua wrote: > Dear All > I want to use Jess from Java code (JATLite) to execute the files of CLIPS in > Jess. Following the instruction in user manual, I create a Rete object and a > Jesp object. System.in is used for the input stream. But I can't find the > code about the output stream in Jess. Could you help me? > Thanks very much. > Sincerely > Anhua > - Ernest Friedman-Hill Distributed Systems ResearchPhone: (925) 294-2154 Sandia National LabsFAX: (925) 294-2234 Org. 8920, MS 9012 [EMAIL PROTECTED] PO Box 969 http://herzberg.ca.sandia.gov Livermore, CA 94550 - To unsubscribe, send the words 'unsubscribe jess-users [EMAIL PROTECTED]' in the BODY of a message to [EMAIL PROTECTED], NOT to the list (use your own address!) List problems? Notify [EMAIL PROTECTED] -
Re: JESS: Jess: How to do an AND, OR?
I think Jens Liegle wrote: [Charset iso-8859-1 unsupported, filtering to ASCII...] > Dear All: > I have the following CLIPS rule that I need to convert to Jess: > I have problems with 1) and 2) > > (defrule myforward > (topic (name ?first) (color (?firstcolor&black|grey)); 1) > problem 1 &black|grey Recent releases of Jess 5.0 support the '|' connective, although it's entirely equivalent to the somewhat more verbose ?firstcolor&:(or (eq ?firstcolor black) (eq ?firstcolor grey)) (By the way, there are an extra set of parentheses in your rule here: the open paren before ?firstcolor and the close after grey should be removed or this looks like a match on a function call.) > (prereq (general ?first) (specific ?second)) > ?x0 <- (topic (name ?second) (color ?color&red)) > (not (exists (and (prereq (general ?otherfirst &~ ?first) (specific > ?second))) ; 2) * > (topic (name ?otherfirst) (color red | > green) Jess has neither (exists) nor (and) right now. (Unique) is something like (exists), but not quite. In the next release of Jess it will be improved, actually, thanks to comments from our friend Vicken Kasparian. As to (and), as parenthesized above, there's only one fact inside the (and), so it doesn't seem as though you actually need it! But there certainly are cases where it would be useful. (not (and (A) (B))) is equivalent to (or (not (A)) (not (B))), so the best you can do is break the rule into two, with the same RHS, with (not (A)) on one LHS and (not (B)) on the other. It's not ideal but it more-or-less works. More complex tree-like LHSs is a project I will be tackling for the next major Jess release (i.e., post- 5.0). > ) > ) > ) > => > (modify ?x0 (color green)) > ) > > * 2) here the > (not (exists (andAND > > Which also raises the question (have not tried yet): Does Jess support > EXISTS? > > with the templates > (deftemplate prereq (slot general) (slot specific)) > and > (deftemplate topic (slot name) (slot color)) > > > Thanks so much for all help! > > Jens Liegle > [EMAIL PROTECTED] > - Ernest Friedman-Hill Distributed Systems ResearchPhone: (925) 294-2154 Sandia National LabsFAX: (925) 294-2234 Org. 8920, MS 9012 [EMAIL PROTECTED] PO Box 969 http://herzberg.ca.sandia.gov Livermore, CA 94550 - To unsubscribe, send the words 'unsubscribe jess-users [EMAIL PROTECTED]' in the BODY of a message to [EMAIL PROTECTED], NOT to the list (use your own address!) List problems? Notify [EMAIL PROTECTED] -
Re: JESS: finding Maximum value in a set of facts
(deftemplate mytemplate (slot myslot)) (defrule find-max-value ; For some instance of "mytemplate", with myslot == ?x ... ?f <- (mytemplate (myslot ?x)) ; If there's no other instance with a larger value... (not (mytemplate (myslot ?y&:(> ?y ?x => ;; ?x is the maximum value, ?f is the fact-index of the fact ) I think Neeraj - Khandelwal wrote: > Hi all, > > I have a set of unordered facts which have a numerical slot in them among > others. I have to find that fact which has the max value for that > integer slot. How can this be done in a rule? > > thanx, > Neeraj. > > > - > 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 Distributed Systems ResearchPhone: (925) 294-2154 Sandia National LabsFAX: (925) 294-2234 Org. 8920, MS 9012 [EMAIL PROTECTED] PO Box 969 http://herzberg.ca.sandia.gov Livermore, CA 94550 - To unsubscribe, send the words 'unsubscribe jess-users [EMAIL PROTECTED]' in the BODY of a message to [EMAIL PROTECTED], NOT to the list (use your own address!) List problems? Notify [EMAIL PROTECTED] -
Re: JESS: finding Maximum value in a set of facts
I think Michael H. Coen wrote: [Charset iso-8859-1 unsupported, filtering to ASCII...] > Doesn't this require O(n^2) running time for what is a linear problem? Or > does Jess do some optimization I don't know about? > > I would have suggested keeping an auxiliary fact holding the maximum value > that could be compared individually against the rest. > > Sorry if I'm missing something obvious! Yes, no, sort of, and no. The solution I gave is a classic one, nice and simple, fine for small datasets, but as you say, it compares every fact to every other one. It does all the computation on the rule LHSs. Here's a linear solution that does the work on the RHSs: (defglobal ?*max = 0) (defrule find-max-value-2 (declare (salience 100)) (mytemplate (myslot ?x)) => (if (> ?x ?*max*) then (bind ?*max* ?x))) Now when the engine stops running, ?*max* holds the maximum value. The reason for the salience declaration is so that rules of lesser salience won't fire until this rule has fired as many times as it is going to (n times.) Note that the prefactor for find-max-value-2 will be quite a bit larger than for find-max-value. I'm not sure where the crossover point is, but for small datasets I'd expect my original solution to run faster. Firing rules costs more than just doing pattern matching. Using an auxilliary fact is going to do basically the same thing, but with a lot of extra bookkeeping; building and rebuilding the partial matches as the aux fact is modified will make it run more like O(n ln n). > Michael > > -Original Message- > Behalf Of [EMAIL PROTECTED] > > (deftemplate mytemplate (slot myslot)) > > (defrule find-max-value > ; For some instance of "mytemplate", with myslot == ?x ... > ?f <- (mytemplate (myslot ?x)) > ; If there's no other instance with a larger value... > (not (mytemplate (myslot ?y&:(> ?y ?x > => > ;; ?x is the maximum value, ?f is the fact-index of the fact > ) > > - Ernest Friedman-Hill Distributed Systems ResearchPhone: (925) 294-2154 Sandia National LabsFAX: (925) 294-2234 Org. 8920, MS 9012 [EMAIL PROTECTED] PO Box 969 http://herzberg.ca.sandia.gov Livermore, CA 94550 - To unsubscribe, send the words 'unsubscribe jess-users [EMAIL PROTECTED]' in the BODY of a message to [EMAIL PROTECTED], NOT to the list (use your own address!) List problems? Notify [EMAIL PROTECTED] -
Re: JESS: finding Maximum value in a set of facts
I think Neeraj - Khandelwal wrote: > thanx Ernest, that was an elegant compact solution, though as Michael > points out it is expensive in computation. I have a huge rulebase > (simulating battlefield etc) and I think Michael strikes an imp point. > earlier I had tried to define a defglobal (max) and used that for > comparison but auxiallry fact seems a better idea. Actually a defglobal will be more efficient -- see my other mail. > > got another ques: I have a rule like > > (defrule xyz > ?f <- (abc ()) > => > (modify ?f ())) > > the problem I face with this is that this rules fires infinitely as the > modified fact is again fired upon .. right now I have introduced an extra > slot in the deftempalte for abc which is modified in the first > activation. also I compare it on the LHS to see if it has been modified , > if it is, then the rule doesnt fire. But this seems a little bit > roundabout to me, is there another way to handle this? This is a common problem, and you're using the traditional solution. Often you can do something like (defrule xyz ?f <- (abc (something) (not something-else)) => (modify ?f (something-else))) I.e., instead of introducing an extra slot, you can have the LHS specifically exclude whatever modification is made on the RHS -- instead of using an extra slot just for this purpose. > > > thankx > Neeraj. > - Ernest Friedman-Hill Distributed Systems ResearchPhone: (925) 294-2154 Sandia National LabsFAX: (925) 294-2234 Org. 8920, MS 9012 [EMAIL PROTECTED] PO Box 969 http://herzberg.ca.sandia.gov Livermore, CA 94550 - To unsubscribe, send the words 'unsubscribe jess-users [EMAIL PROTECTED]' in the BODY of a message to [EMAIL PROTECTED], NOT to the list (use your own address!) List problems? Notify [EMAIL PROTECTED] -
Re: JESS: Weird bug involving salience and redefined rules?
Hi David, I needed to use 5.0b3 to reproduce the problem: both my current working copy and Jess44 do the right thing (you didn't say what version you were using.) Anyway, I believe this is a symptom of a bug in 5.0b3 I've already fixed; here's the appropriate patch: diff -r jess/Node.java d:/temp/Jess50b3/jess/Node.java 71,73c71 <* Cannot use removeElement here. Some Nodes compare equal using equals(), <* but aren't the same physical node. We only want to remove the ones that <* are physically equal, not just conceptually. --- >* @param s 77,82c75 < for (int i=0; i m_succ.removeElement(s); i.e., change the single line "m_succ.removeElement(s);" at line 75 of Node.java to the for-loop shown above. I think G. David Barnett wrote: > Hello- > > I had some code that was working great just before it stopped working in a > very unusual place. It took me forever to realize that I unintentionally > had two rules of the same name. Fixing this fixed the 'unrelated' > problem. I found this odd but I was unable to determine what the > significance was at that time due to the complexity of the application and > time constraints. Then it happened again. > > Normally, issuing a defrule with a duplicate name should simply replace > the definition and the network adjusted appropriately. This does indeed > seem to happen for most cases. I now have some simplified code that > demonstrates when it doesn't, but I'm still not sure exactly what is going > on. Basically, part of the network seems to become disjoined when the > replacement rule is added, which explains how my partially running > application began stopping at an unusual point. > > View the differences in the following when the indicated defrule name is > changed: > > > ;;; BEGIN CODE > > (watch all) > > (defrule phase-change > (declare (salience -10)) > ?phase-fact <- (phase ?x) > ?phase-list-fact <- (phase-list ?next $?remaining) > => > (retract ?phase-fact ?phase-list-fact) > (assert (phase ?next)) > (assert (phase-list $?remaining))) > > (defrule a > (phase a) > => > (printout t "phase a" crlf)) > > (defrule b > (phase b) > => > (printout t "phase b" crlf)) > > (defrule aa ;; change 'aa' to 'a' to break it > (phase aa) > => > (printout t "phase aa" crlf)) > > (assert (phase a)) > (assert (phase-list b c d e)) > > (run) > > ;;; END CODE > > > It seems I had to use salience to get it to break. Hope this is a simple > bug for somebody else to fix . . . . > > > -Dave Barnett > > - > 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 Distributed Systems ResearchPhone: (925) 294-2154 Sandia National LabsFAX: (925) 294-2234 Org. 8920, MS 9012 [EMAIL PROTECTED] PO Box 969 http://herzberg.ca.sandia.gov Livermore, CA 94550 - To unsubscribe, send the words 'unsubscribe jess-users [EMAIL PROTECTED]' in the BODY of a message to [EMAIL PROTECTED], NOT to the list (use your own address!) List problems? Notify [EMAIL PROTECTED] -
JESS: Some Announcements
Hi Folks, An announcement or three... First, Sandia's Y2K plan calls for much of our network to be shut down over the holidays. Therefore neither this list nor the Jess web site are likely to be functioning starting sometime this week, until perhaps Jan 3rd or so. Second, as soon as things come back up after the holidays, there will be one more 5.0 beta. There are several bug fixes and three new features: 1) limited support for an RU.LONG type; 2) nested 'not' CEs and the 'exists' CE; 3) a new function (run-until-halt) and associated machinery such that the busy-wait loop is no longer necessary for agent-like systems. Finally, if you get a chance, please head over to www.thehungersite.com. It literally takes two seconds, there are no forms to fill out, and your visit will generate a few pennies worth of advertising revenue, enough to pay for a meal for someone less fortunate than yourself. Happy holidays to all! - Ernest Friedman-Hill Distributed Systems ResearchPhone: (925) 294-2154 Sandia National LabsFAX: (925) 294-2234 Org. 8920, MS 9012 [EMAIL PROTECTED] PO Box 969 http://herzberg.ca.sandia.gov Livermore, CA 94550 - To unsubscribe, send the words 'unsubscribe jess-users [EMAIL PROTECTED]' in the BODY of a message to [EMAIL PROTECTED], NOT to the list (use your own address!) List problems? Notify [EMAIL PROTECTED] -
Re: JESS: Characters into String
Two answers: see the Jess (format) command for one possibility. Second, note that to produce a String in Jess that contains a newline, simply embed the newline in the String: (bind ?message "Hello! My name is...") Although of course this is not acceptable Java syntax, it's OK in Jess (the manual does indeed mention this.) Jess doesn't support any of the Java String escape characters. I think [EMAIL PROTECTED] wrote: > Hi! > I use Jess for an Italian Manufacturing Group and I'd like to know > how to print some characters into a string, such as "space", CR > (carriage return), LF (line feed) and so on. > If I wanto to print: > > "Hello! > My name is Paolo Goodbye!" > > using the following program code: > > (bind ?message "Hello! My name is Paolo Goodbye!") > > then I pass ?message in Java in a code like this: > > System.out.println(?message). > > My problem is: how characters I have to put in the string after > ?message when I write > > (bind ?message "Hello! My name is Paolo Goodbye!") > > to print the CRLF (carriage return and line feed) or SPACE > to write down the message I wrote above between "" ? > > Thank you > > Bye! > > Paolo Pancini > [EMAIL PROTECTED] > > - > To unsubscribe, send the words 'unsubscribe jess-users [EMAIL PROTECTED]' > in the BODY of a message to [EMAIL PROTECTED], NOT to the > list (use your own address!) List problems? Notify [EMAIL PROTECTED] > - > - Ernest Friedman-Hill Distributed Systems ResearchPhone: (925) 294-2154 Sandia National LabsFAX: (925) 294-2234 Org. 8920, MS 9012 [EMAIL PROTECTED] PO Box 969 http://herzberg.ca.sandia.gov Livermore, CA 94550 - To unsubscribe, send the words 'unsubscribe jess-users [EMAIL PROTECTED]' in the BODY of a message to [EMAIL PROTECTED], NOT to the list (use your own address!) List problems? Notify [EMAIL PROTECTED] -
Re: JESS: small (test...) issue
Hmm. I'll have to think about whether (test) should be supported in defqueries or not. I'm on vacation so I can't actually check the source right now but i t seems tome as if there would have to be some special accomodation to make this work. I'll let you know after Christmas. I think Michal Fadljevic wrote: > Hi everyone, > > I am impressed by the quality of the Jess. > It is really powerfull system. {:) > > I have simple question: > Is this query supposed to work ? > > (deftemplate person > (slot id (type INTEGER) (default 0) ) ;; 0 means not initialized > (slot sex(type ATOM)(default nil) ) ;; male/female atoms > (slot mother (type INTEGER) (default 0) ) ;; 0 means not initialized > (slot father (type INTEGER) (default 0) ) ;; 0 means not initialized > ) > ... > (defquery children-of (declare (variables ?id)) > (person (mother ?mid) (father ?fid)) > (test (or (= ?id ?mid) (= ?id ?fid))) > ) > > the run-query complains about sth like > Value.listValue while executing (= ?id ?mid) > Not a list: "1" (type = INTEGER). > > But there are only integer number involved in this query, > so why is he expecting list ? > > Am I missing something about concept of queries ? > > Thank you very much > Michal > -- > [EMAIL PROTECTED] phone: 415.876.0187 pager: 415.253.8030 > > > > - > 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 Distributed Systems ResearchPhone: (925) 294-2154 Sandia National LabsFAX: (925) 294-2234 Org. 8920, MS 9012 [EMAIL PROTECTED] PO Box 969 http://herzberg.ca.sandia.gov Livermore, CA 94550 - To unsubscribe, send the words 'unsubscribe jess-users [EMAIL PROTECTED]' in the BODY of a message to [EMAIL PROTECTED], NOT to the list (use your own address!) List problems? Notify [EMAIL PROTECTED] -
Re: JESS: small (test...) issue
This will now work in Jess 5.0b4, to be released today. I think Michal Fadljevic wrote: > Hi everyone, > > I am impressed by the quality of the Jess. > It is really powerfull system. {:) > > I have simple question: > Is this query supposed to work ? > > (deftemplate person > (slot id (type INTEGER) (default 0) ) ;; 0 means not initialized > (slot sex(type ATOM)(default nil) ) ;; male/female atoms > (slot mother (type INTEGER) (default 0) ) ;; 0 means not initialized > (slot father (type INTEGER) (default 0) ) ;; 0 means not initialized > ) > ... > (defquery children-of (declare (variables ?id)) > (person (mother ?mid) (father ?fid)) > (test (or (= ?id ?mid) (= ?id ?fid))) > ) > > the run-query complains about sth like > Value.listValue while executing (= ?id ?mid) > Not a list: "1" (type = INTEGER). > > But there are only integer number involved in this query, > so why is he expecting list ? > > Am I missing something about concept of queries ? > > Thank you very much > Michal > -- > [EMAIL PROTECTED] phone: 415.876.0187 pager: 415.253.8030 > > > > - > 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 Distributed Systems ResearchPhone: (925) 294-2154 Sandia National LabsFAX: (925) 294-2234 Org. 8920, MS 9012 [EMAIL PROTECTED] PO Box 969 http://herzberg.ca.sandia.gov Livermore, CA 94550 - To unsubscribe, send the words 'unsubscribe jess-users [EMAIL PROTECTED]' in the BODY of a message to [EMAIL PROTECTED], NOT to the list (use your own address!) List problems? Notify [EMAIL PROTECTED] -
Re: JESS: Rete serialization and (defclass)
This is fixed in Jess 5.0b4, to be released today. I think Russ Milliken wrote: > Hi, > > Has anyone tried to take advantage of the fact that the Rete engine > and all associated constructs (i.e., Deftemplate, Defrule, etc.) are > now Serializable? It's pretty cool that you can save the state of the > entire Rete engine, but I'm running into problems when I use > (defclass) and serialization. > > If I define a simple bean (like SimpleBean from the example), the Rete > engine won't serialize. It has to do with Java's default > introspection scheme. The class java.beans.PropertyDescriptor isn't > serilizable, so to serialize the engine I had to implement a > SimpleBeanBeanInfo class which returned a new PropertyDescriptor, > SerializablePropertyDescriptor (which extends PropertyDescriptor). > > Now I'm running into problems when I deserialize the engine, that is, > read it from disk and reconstitute the object. I'm getting a > "java.io.InvalidClassException: java.beans.PropertyDescriptor; > NoSuchMethodError" exception when I call readObject(). I suspect that > I need to implement a SerializableMethodDescriptor object and return > this from my SimpleBeanBeanInfo object. > > My question is this: Isn't this a lot of work just to make my bean > serializable? Am I doing something wrong? Is there an easier way? > > -Russ > > > Russ Milliken Engineering Design Research Center > Graduate Student Carnegie Mellon University > Department of Chemical Engineeringhttp://www.ndim.edrc.cmu.edu/~milliken > - > 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 Distributed Systems ResearchPhone: (925) 294-2154 Sandia National LabsFAX: (925) 294-2234 Org. 8920, MS 9012 [EMAIL PROTECTED] PO Box 969 http://herzberg.ca.sandia.gov Livermore, CA 94550 - To unsubscribe, send the words 'unsubscribe jess-users [EMAIL PROTECTED]' in the BODY of a message to [EMAIL PROTECTED], NOT to the list (use your own address!) List problems? Notify [EMAIL PROTECTED] -
Re: JESS: small (test...) issue
This will work in Jess5.0b4, to be released today. I think Michal Fadljevic wrote: > Hi everyone, > > I am impressed by the quality of the Jess. > It is really powerfull system. {:) > > I have simple question: > Is this query supposed to work ? > > (deftemplate person > (slot id (type INTEGER) (default 0) ) ;; 0 means not initialized > (slot sex(type ATOM)(default nil) ) ;; male/female atoms > (slot mother (type INTEGER) (default 0) ) ;; 0 means not initialized > (slot father (type INTEGER) (default 0) ) ;; 0 means not initialized > ) > ... > (defquery children-of (declare (variables ?id)) > (person (mother ?mid) (father ?fid)) > (test (or (= ?id ?mid) (= ?id ?fid))) > ) > > the run-query complains about sth like > Value.listValue while executing (= ?id ?mid) > Not a list: "1" (type = INTEGER). > > But there are only integer number involved in this query, > so why is he expecting list ? > > Am I missing something about concept of queries ? > > Thank you very much > Michal > -- > [EMAIL PROTECTED] phone: 415.876.0187 pager: 415.253.8030 > > > > - > 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 Distributed Systems ResearchPhone: (925) 294-2154 Sandia National LabsFAX: (925) 294-2234 Org. 8920, MS 9012 [EMAIL PROTECTED] PO Box 969 http://herzberg.ca.sandia.gov Livermore, CA 94550 - To unsubscribe, send the words 'unsubscribe jess-users [EMAIL PROTECTED]' in the BODY of a message to [EMAIL PROTECTED], NOT to the list (use your own address!) List problems? Notify [EMAIL PROTECTED] -
JESS: Announcing Jess 5.0b4
Hi Folks, Well, majordomo is up again, as is the Jess web site, so, as promised, I've released Jess 5.0b4. This release fixes a number of bugs and adds a few small but important features (support for a LONG type, the (exists) CE and nested (not)s, and a mechanism for running forever without busy-waiting.) I hope this will be the last beta. Please pound on this and see if you can find any more bugs. As usual, the software is available from http://herzberg.ca.sandia.gov/jess/download.html . >From the change log: Version 5.0b4 (January 5th, 2000): Fixed broken fact-slot-value function. Some support for new RU.LONG type. Added (run-until-halt), runUntilHalt(), activationSemaphore, etc. (unique) CE no longer prevents partial matches from being retracted, only from being propagated (thanks Vicken Kasparian.) Nested nots and (exists) CE added. Unmatched variables can appear in function calls within defqueries (thanks Michal Fadljevic). Bsave/bload now works with defclasses (thanks Russ Milliken.) ReflectFunctions cache result of BeanInfo.getPropertyDescriptors(). - Ernest Friedman-Hill Distributed Systems ResearchPhone: (925) 294-2154 Sandia National LabsFAX: (925) 294-2234 Org. 8920, MS 9012 [EMAIL PROTECTED] PO Box 969 http://herzberg.ca.sandia.gov Livermore, CA 94550 - To unsubscribe, send the words 'unsubscribe jess-users [EMAIL PROTECTED]' in the BODY of a message to [EMAIL PROTECTED], NOT to the list (use your own address!) List problems? Notify [EMAIL PROTECTED] -
Re: JESS: Help with long type conversions using Jess 50b4
I think Rudolph George-P27574 wrote: [Charset iso-8859-1 unsupported, filtering to ASCII...] > > In attempting to use the new features involved with long types, I've run > into some problems as described below. > I put my questions here at the top (for convenience) because the description > is somewhat involved. > > Question1: How do you tell the Jess parser that a number like > -60067621520002 is a long value, as opposed to a double or a string? My intention was that you'd use the new function (long ) to enter long literals -- i.e., (long "123"). Yes, it's ugly, but as I said, this release only has partial support for longs. The parser can't parse long literals directly, and this can't be changed without slowing things down for all non-long numeric literals until I rewrite the whole thing. I'd like to do this eventually but it won't happen for 5.0. > Question 2: Knowing that slot values in Jess are typeless, how do I specify > a rule pattern that will correctly match against NewThing objects? (thing (value ?X&=(long "12345"))) should work and is somewhat less ugly than (thing (value ?X&:(eq ?X (long "12345". Type conversions are done when calling Java functions, (i.e., creating the shadow fact from an object) but not during pattern matching. This often bites people who expect symbols and Strings to compare equal, but they don't: the types of the two Value objects being compared must be the same. > > > Given a Java object NewThing, which has as one of its properties a long > value, > I'm having problems both creating and pattern matching against long values > in > ways that I would expect to be able to. I did find one solution, but it > seems more complex > than it needs to be, so I think I'm forgetting something simple or missing > the boat on this. > The Java code and .clp file are given below. I'm using Sun JDK 1.2.2 and > Jess 50b4. > > > Problem 1: > - > > If I run the following .clp file, > > ;;begin file > (defclass thing NewThing) > > (defrule startup_rule > => > (definstance thing (bind ?thing1 (new NewThing -60067621520002))) > ) > > (reset) > (run) > > ;; end file > > I get the following exception, > > > Jess reported an error in routine new while executing (new NewThing > -6.0067621520002E13) while executing (bind ?thing4 ( > new NewThing -6.0067621520002E13)) while executing (definstance thing (bind > ?thing4 (new NewThing -6.0067621520002E13))) > while executing defrule startup_rule while executing (run). > Message: Constructor not found: (new NewThing -6.0067621520002E13). > Program text: ( run ) at line 9. > Nested exception is: > NewThing > java.lang.NoSuchMethodException: NewThing > at jess.JessNew.call(ReflectFunctions.java, Compiled Code) > at jess.FunctionHolder.call(FunctionHolder.java:37) > at jess.Funcall.execute(Funcall.java:240) > at jess.FuncallValue.resolveValue(FuncallValue.java:33) > at jess.Bind.call(Funcall.java:767) > at jess.FunctionHolder.call(FunctionHolder.java:37) > at jess.Funcall.execute(Funcall.java:240) > at jess.FuncallValue.resolveValue(FuncallValue.java:33) > at jess.Definstance.call(ReflectFunctions.java:882) > at jess.FunctionHolder.call(FunctionHolder.java:37) > at jess.Funcall.execute(Funcall.java:240) > at jess.Defrule.fire(Defrule.java, Compiled Code) > at jess.Activation.fire(Activation.java:65) > at jess.Rete.run(Rete.java, Compiled Code) > at jess.Rete.run(Rete.java, Compiled Code) > at jess.HaltEtc.call(Funcall.java:1528) > at jess.FunctionHolder.call(FunctionHolder.java:37) > at jess.Funcall.execute(Funcall.java:240) > at jess.Jesp.parseAndExecuteFuncall(Jesp.java:1585) > at jess.Jesp.parseSexp(Jesp.java:185) > at jess.Jesp.parse(Jesp.java, Compiled Code) > at jess.Main.execute(Main.java, Compiled Code) > at jess.Main.main(Main.java:28) > > I was assuming that the number -60067621520002 was going to be treated as a > long, > because of type conversions, but it looks like the Jess parser is converting > it to a double > and then raising and exception because there is no NewThing constructor that > takes a double. > > Question: How do you tell the Jess parser that this is a long value, as > opposed to a double or a string? > > > > Problem 2: > > > I came up with an answer for question 1, but my answer led to further > problems. > My solution was to explicitly create a long value, so that the parameter's > type is unambiguous: > > ;; begin file > > (defclass thing NewThing) > > (deffunction create-newthing (?value) > (bind ?myval (call Long parseLong ?value)) > (definstance thing (new NewThing ?myval)) > ) > > (defrule startup_rule > => > (bind ?thi
Re: JESS: Help with long type conversions, again
>From ejfried Tue Jan 11 03:44:43 2000 >> Question 2: Knowing that slot values in Jess are typeless, how do I specify >> a rule pattern that will correctly match against NewThing objects? > >(thing (value ?X&=(long "12345"))) should work and is somewhat less >ugly than (thing (value ?X&:(eq ?X (long "12345". > I was sleepy when I wrote this - of course simply (thing (value =(long "123"))) works too and is even less ugly. - Ernest Friedman-Hill Distributed Systems ResearchPhone: (925) 294-2154 Sandia National LabsFAX: (925) 294-2234 Org. 8920, MS 9012 [EMAIL PROTECTED] PO Box 969 http://herzberg.ca.sandia.gov Livermore, CA 94550 - To unsubscribe, send the words 'unsubscribe jess-users [EMAIL PROTECTED]' in the BODY of a message to [EMAIL PROTECTED], NOT to the list (use your own address!) List problems? Notify [EMAIL PROTECTED] -
Re: JESS: Problem with batch function
This sounds like you're trying to view the page with the applet as a file on the local disk. Browsers generally won't be able to batch files unless the whole nine yards (applet, HTML, .clp file) are all being loaded from a Web server, -and- the browser doesn't find the Jess classes on the local disk. Applet security rules are tricky. But as I've said before, don't use Jess in applets. Use servlets instead. They're much better, really. I think Fran / Carmen wrote: [Charset iso-8859-1 unsupported, filtering to ASCII...] > Problem with batch function > I'm calling JESS functions from Java applet using fetch and store, the program works >without problem using the JDK but when I try to open the HTML page from Explorer >appear this error: > > exception: com.ms.security.SecurityExeptionEx[jess/Batch.call]: > cannot access file name.clp > > it's not a path problem (I'm using Internet Explorer ver 5). > > Thaks > Fran - Ernest Friedman-Hill Distributed Systems ResearchPhone: (925) 294-2154 Sandia National LabsFAX: (925) 294-2234 Org. 8920, MS 9012 [EMAIL PROTECTED] PO Box 969 http://herzberg.ca.sandia.gov Livermore, CA 94550 - To unsubscribe, send the words 'unsubscribe jess-users [EMAIL PROTECTED]' in the BODY of a message to [EMAIL PROTECTED], NOT to the list (use your own address!) List problems? Notify [EMAIL PROTECTED] -
Re: JESS: Parse error for comments after deftemplate 'extends'clause. Fix included.
I think Richard Long wrote: [Charset iso-8859-1 unsupported, filtering to ASCII...] > I've been using JESS for a few months now as part of a large Airforce > simulation project we are working on. > Recently, I stumbled upon the multiple inheritance abilities of JESS through > the 'extends' clause in the deftemplate construct. If I'm not mistaken, > this is not available in CLIPS, and for our project it will be extremely > useful! > Every day, I am more and more impressed with the power and flexibility of > JESS. Congratulations again to Dr. Friedman-Hill for such a wonderful > expert system development environment. *blush* > > While playing with inherited deftemplates, I uncovered a minor bug. > Comments given after the 'extends' clause, as allowed by the deftemplate > syntax, will give a parse error: > Thanks for the report, Richard. Here's how I would fix it (somewhat shorter and with less redundancy) -- /** * parseDeftemplate * * Syntax: * (deftemplate (slot foo (default )) (multislot bar)) * @exception JessException * @return */ private Value parseDeftemplate() throws JessException { Deftemplate dt; int slot_type = RU.SLOT; Value default_value = null; String default_type = null; JessToken tok; /* '(deftemplate' */ if ( (m_jts.nextToken().m_ttype != '(') || ! (m_jts.nextToken().m_sval.equals("deftemplate")) ) parseError("parseDeftemplate", "Expected (deftemplate..."); /* deftemplate name, optional extends clause */ if ((tok = m_jts.nextToken()).m_ttype != RU.ATOM) parseError("parseDeftemplate", "Expected deftemplate name"); String name = tok.m_sval; String docstring = ""; String parent = null; if ((tok = m_jts.nextToken()).m_ttype == RU.ATOM) { if (tok.m_sval.equals("extends")) { tok = m_jts.nextToken(); if (tok.m_ttype == RU.ATOM) parent = tok.m_sval; else parseError("parseDeftemplate", "Expected deftemplate name to extend"); } else parseError("parseDeftemplate", "Expected '(' or 'extends'"); tok = m_jts.nextToken(); } if (parent == null) dt = new Deftemplate(name, docstring); else dt = new Deftemplate(name, docstring, m_engine.findDeftemplate(parent)); /* optional comment */ if (tok.m_ttype == RU.STRING) { docstring = tok.m_sval; tok = m_jts.nextToken(); } - Ernest Friedman-Hill Distributed Systems ResearchPhone: (925) 294-2154 Sandia National LabsFAX: (925) 294-2234 Org. 8920, MS 9012 [EMAIL PROTECTED] PO Box 969 http://herzberg.ca.sandia.gov Livermore, CA 94550 - To unsubscribe, send the words 'unsubscribe jess-users [EMAIL PROTECTED]' in the BODY of a message to [EMAIL PROTECTED], NOT to the list (use your own address!) List problems? Notify [EMAIL PROTECTED] -
JESS: Console behaviour
Hi Folks, I personally don't use the jess.Console class much, but I know that many of you do. It has been pointed out to me that (under Windows at least) when the TextArea scroll buffer fills up, Jess will "freeze" until you press the Clear button to clear the window. This is not a Jess bug, but a Windows bug, really; it's the way the text control that java.awt.TextArea uses works. Would it be better to have the text area automatically drop the oldest lines such that the window never froze? If several people think so, I'll implement this. This is probably a trivial enough issue that we don't want to clutter the list with a discussion of it. If anyone wants to voice an opinion, please email to me directly and let me know what you think. - Ernest Friedman-Hill Distributed Systems ResearchPhone: (925) 294-2154 Sandia National LabsFAX: (925) 294-2234 Org. 8920, MS 9012 [EMAIL PROTECTED] PO Box 969 http://herzberg.ca.sandia.gov Livermore, CA 94550 - To unsubscribe, send the words 'unsubscribe jess-users [EMAIL PROTECTED]' in the BODY of a message to [EMAIL PROTECTED], NOT to the list (use your own address!) List problems? Notify [EMAIL PROTECTED] -
Re: JESS: queries and using defquery
Hi, Indeed, as you suspected, Jess and Prolog are rather different beasts, and in Jess queries have to be predefined. As with defrules, most of the work in running a defquery is done not when you say "run-query", but while the facts themselves are being asserted (read up on the Rete algorithm, Manual chapter 8, to understand why.) Therefore while you could certainly define queries on-the-fly, they'd be much slower than predefined ones. Note, as an aside, that it is quite possible to define rules and queries from Java code - just build the String version and call Rete.executeCommand. Most of the work in adding a rule or query to Jess is not parsing the textual form, but building the Rete network representation. WHen you can build Defrule objects on the fly in some version of Jess, installing them into the Rete network will still be the costly step, much more expensive than parsing. Glad you enjoy using Jess. I think Jonker, J. wrote: [Charset iso-8859-1 unsupported, filtering to ASCII...] > Hello Jess users, > > I have a question about how Jess handles queries. > > As I read it, defquery is used for dealing with specific queries. It acts > pretty much like a function, returning an Enumeration of pattern matches (or > an integer denoting the number of pattern matches) after you call the > defquery with run-query (or count-query-results) and supply it with the > appropriate parameters. > > But this means that you have to write a defquery for every query you might > expect. My question is: is there any way you can handle general queries in > Jess? (For example, you can ask Prolog for child_from(?x john), which will > result in false (john has no children, or in all matches found in the > knowledge base child_from(mary john); child_from(albert john).) > > I expect that your answer will be that that won't be possible in Jess (also > noting that the construct is quite recently added to Jess). Therefore, I > will add defqueries for handling specific queries to the rule base as needs > arise. But if there's a way to handle general queries in Jess, I'd surely > want to know and try. > > You cannot hand over a Defquery from Java to the Rete (as you cannot > construct and pass a Defrule to the Rete either), so a QueryFactory > dynamically creating queries as you need them, isn't an option, I think. > Overmore, you would want to be able to "retract" those queries from the rule > base as well. > > That's it for now... > Thanks for that jazzy Jess, it makes Java swing - Joost > > Joost Jonker > [EMAIL PROTECTED] > KPN Research, Leidschendam, room CD101 > visitors: St. Paulusstraat 4, 2264 XZ Leidschendam > mail: P.O. Box 421, 2260 AK Leidschendam, > Netherlands; + 31 (0)70 - 33 26 148 > - > 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 Distributed Systems ResearchPhone: (925) 294-2154 Sandia National LabsFAX: (925) 294-2234 Org. 8920, MS 9012 [EMAIL PROTECTED] PO Box 969 http://herzberg.ca.sandia.gov Livermore, CA 94550 - To unsubscribe, send the words 'unsubscribe jess-users [EMAIL PROTECTED]' in the BODY of a message to [EMAIL PROTECTED], NOT to the list (use your own address!) List problems? Notify [EMAIL PROTECTED] -
JESS: Update on 5.0 final
Hi Folks, Well, I've had only trivial bug reports against 5.0b4, so I think we're ready to call it 5.0 final. If anyone has something they'd really like to see fixed for the final release, or I promised to do but haven't done yet, please let me know now. One thing I've done that I'm really happy with is to write a new unit test for the Jess manual. Because the source is in XML, I've been able to specially mark all the Jess and Java code examples contained in the manual. The new test extracts and compiles all the Java code to make sure it compiles, then runs all the Jess examples and compares the output against what the manual says the output should be. I have to admit that the early runs of this test were far from successful - many of the code examples didn't work or didn't compile. I've fixed them so they do, and the test will help me keep it that way. Otherwise, I can see doing the 5.0 final release next week sometime. - Ernest Friedman-Hill Distributed Systems ResearchPhone: (925) 294-2154 Sandia National LabsFAX: (925) 294-2234 Org. 8920, MS 9012 [EMAIL PROTECTED] PO Box 969 http://herzberg.ca.sandia.gov Livermore, CA 94550 - To unsubscribe, send the words 'unsubscribe jess-users [EMAIL PROTECTED]' in the BODY of a message to [EMAIL PROTECTED], NOT to the list (use your own address!) List problems? Notify [EMAIL PROTECTED] -
Re: JESS: Multifield arguments in Jess 5.0
The behavior has been tightened up and the documentation clarified. The formal argument types do -not- correspond to the actual parameter types in any way. A single, final, multifield argument, if present, means that the argument at this ordinal position and all subsequent ones should be catenated into a multified and provided as a single argument to the function. It is a "wildcard" parameter and it allows you to have a variable-length argument list. But as I said, this has no bearing on the actual types of the arguments. I.e., in the following code: (deffunction foo (?a ?b) ...) (foo (create$ a b c) (create$ 1 2 3)) at the ellipsis, ?a is (a b c) and ?b is (1 2 3). I think [EMAIL PROTECTED] wrote: > > I'm in the process of upgrading from 4.4 to 5.0 and I've run across > the following difference between the versions that I'm not sure how to > resolve. > > In the old program, I had a function of the following form: > > (deffunction foo (?$arg1 ?$arg2) > ... > ) > > In 5.0, the parameter list has different semantics and it appears that > only one multifield argument is permitted. Have I lost the ability to > pass multifields as arguments like I can atomic values? > > -- > > robin > =:-{) > University of California, Irvine > Information and Computer Science Dept. > > http://www.ics.uci.edu/~burke/ > > "The universe is made of stories, not of atoms" - Muriel Rukeyser > - > 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 Distributed Systems ResearchPhone: (925) 294-2154 Sandia National LabsFAX: (925) 294-2234 Org. 8920, MS 9012 [EMAIL PROTECTED] PO Box 969 http://herzberg.ca.sandia.gov Livermore, CA 94550 - To unsubscribe, send the words 'unsubscribe jess-users [EMAIL PROTECTED]' in the BODY of a message to [EMAIL PROTECTED], NOT to the list (use your own address!) List problems? Notify [EMAIL PROTECTED] -
JESS: autoconf for CLIPS
Mark Tomlinson would gladly host your autoconf scripts: http://ourworld.compuserve.com/homepages/marktoml/clipstuf.htm contact info is on the page. It also contains links to CLIPS-related mailing lists. WHen they've put up your scripts, you could post a note here. I think David E. Young wrote: > Hello Ernest. You're probably aware a number of folks have asked me > for my GNU autoconf extensions to CLIPS 6.1. More requests are coming > in, and I've no readily-accessible web site on which to place this > stuff. Would it be violating the spirit of Jess to send this > distribution to jess-users (and perhaps have it appear on the "user > contribution" page)? Some time ago I asked the CLIPS maintainers if > they were interested in the autoconf work but got no reply. > > Sorry to be of trouble. > > Regards, > - Ernest Friedman-Hill Distributed Systems ResearchPhone: (925) 294-2154 Sandia National LabsFAX: (925) 294-2234 Org. 8920, MS 9012 [EMAIL PROTECTED] PO Box 969 http://herzberg.ca.sandia.gov Livermore, CA 94550 - To unsubscribe, send the words 'unsubscribe jess-users [EMAIL PROTECTED]' in the BODY of a message to [EMAIL PROTECTED], NOT to the list (use your own address!) List problems? Notify [EMAIL PROTECTED] -
Re: JESS: String parsing (again?)
I think Alan Moore wrote: > Is this a problem? > > rete.executeCommand("(batch c:myJessDirectoryscriptlib.clp)"); > > I know that java requires quoting of backslashes in strings but does > executeCommand? It's not a problem, per se, but Jess will see the path c:\\myJessDirectory\\scriptlib.clp, the exact contents of the Java String as produced by the Java lexer. The Jess lexer places no special meaning on the character '\', so the doubles are not removed. Jess will pass precisely these characters to the Java FileReader constructor. In my experience, windows system calls are fairly forgiving in what they'll accept for path names: double backslashes are fine, forward slashes are equally fine, even mixtures of the two like "\/" will work perfectly well. So although the four backslashes in a row don't hurt, they don't specifically help, and two would be just fine. > > Please, no flames re: paths with backslashes ;-D > > alan > > Alan Moore (mailto:[EMAIL PROTECTED]) > iAMnetworks (http://www.iAMnetworks.com) - Ernest Friedman-Hill Distributed Systems ResearchPhone: (925) 294-2154 Sandia National LabsFAX: (925) 294-2234 Org. 8920, MS 9012 [EMAIL PROTECTED] PO Box 969 http://herzberg.ca.sandia.gov Livermore, CA 94550 - To unsubscribe, send the words 'unsubscribe jess-users [EMAIL PROTECTED]' in the BODY of a message to [EMAIL PROTECTED], NOT to the list (use your own address!) List problems? Notify [EMAIL PROTECTED] -
Re: JESS: funcall arg types like RU.STRING, RU.FUNCALL
I think Rudolph George-P27574 wrote: > I'm using Jess 5.0b4 and JDK 1.2.2 on NT 4.0. > > I have some code that supports a GUI rule editor. > The code gets a defrule from the engine, then parses the rule > using methods available from the Defrule object. > In processing the right-hand-side of a rule, > it looks for strings, variables, or function calls. Note that a RHS always consists of a list of Funcalls, never anything else. You can fetch them one at a time with Defrule.getAction(). > When processing a particular Funcall object, > it uses the RU arg types to distinguish argument types and know > how to further process them (like RU.STRING, RU.VARIABLE, RU.FUNCALL). > (Note: I did not write this code, but I do have to maintain it.) > > I had assumed that each kind of arg or Value object would have only one > type-- > i.e. the RU types are mutually exclusive. They are, and even their bits are mutually exclusive. You can always use '|' to combine them and then test using '&'. In this particular case, RU.FUNCALL == 64, RU.STRING = 2. However, I have run into a case > where > in the code snippet > > //myFunc is a Funcall that is passed in... > jess.Value arg = myFunc.get(i); > > if (arg.type() == jess.RU.FUNCALL) { > Funcall func = arg.funcallValue(context); > tempstr = func.toString(); > System.out.println(" func = " + func.toString()); > } > > if(arg.type() == jess.RU.STRING) { > tempstr = arg.stringValue(context); > System.out.println(" string = " + tempstr); > } > > both clauses seem to be getting executed for the same arg. > Given only the exact code shown here, this can't happen. The implementation of Value.type() is just public int type() { return m_type; } m_type is private, and Value is an immutable class. > The case involves an action like > (do-this ?param1 (strcat "string1 " (call warper warp ?myObject) > " string2")) > > where the call to warper.warp() returns a String. > Relating to the snippet above, the strcat call is the value of "myFunc", and > the (call warper warp ?myObject) is the value of "arg". > > Question 1. Is this the type confusion a bug? I don't think so. Note, though, that arg.funcallValue(c) and arg.stringValue(c) will both return something: stringValue(c) will execute the function and attempt to return the result as a String. Although the calls of type() would seem to prevent this happening in the code above, perhaps there's something you're not showing me that's crucial. Note also that arg = arg.resolveValue(c) will replace the Funcall object with its String result, and perhaps this is being done somewhere. Maybe if I saw a longer stretch of code I could tell what was happening. > Question 2. Is there an easier way to parse defrules (back) out of the > engine than what is being done? > Depends on exactly what you're trying to do, I suppose. The Funcall data structure is a straightforward representation of a function call, so I'm not sure what could be simpler. The Pattern objects are somewhat messier, but they will likely improve in the future. - Ernest Friedman-Hill Distributed Systems ResearchPhone: (925) 294-2154 Sandia National LabsFAX: (925) 294-2234 Org. 8920, MS 9012 [EMAIL PROTECTED] PO Box 969 http://herzberg.ca.sandia.gov Livermore, CA 94550 - To unsubscribe, send the words 'unsubscribe jess-users [EMAIL PROTECTED]' in the BODY of a message to [EMAIL PROTECTED], NOT to the list (use your own address!) List problems? Notify [EMAIL PROTECTED] -
Re: JESS: question: findFactByID / fact-slot-value
Hi Joost, First, the quick answer: you can make a integer out of a fact-id with the Jess function (integer): (bind ?fact (call (engine) findFactByID (integer ?id))) Second, I think you're right, this should work automatically. The integer/fact-id data type distinction is inherited from CLIPS, and it engenders lots of confusion there, too. If you insert the following line: case RU.FACT_ID: at line 111 in jess/ReflectFunctions.java and recompile Jess, you should find that it works without the (integer) call. I'll include this change in the next release. (reset) works with anything that can be converted to a Jess integer, which includes fact-id's. (call), on the other hand, looks at both the Java argument types and the Jess data types to decide what to do, and I forgot to include an explicit conversion from fact-id to Java int here. I think Jonker, J. wrote: [Charset iso-8859-1 unsupported, filtering to ASCII...] > Hello folks, > > I'm trying to pass a certain kind of fact as a string to one of my > functions. But I have severe problems to get a hold on that fact. > As I understand it, you get a fact by using ?my-match <- > (the-fact-you-want-to-match). > That works just fine, for example, for retracting that fact. > > But calling findFactByID from the Rete engine results in error: Message: No > overloading of method 'findFactByID' in class jess.Rete I can call with > these arguments: (call (engine) findFactByID ?my-match). > > (defrule my-rule > ?my-match <- (foo (bar "oof")) > => > (bind ?fact (call (engine) findFactByID ?my-match)) > (bind ?fact-as-string (call ?fact toStringWithParens)) > (bind ?whatever (my-function "a-string" ?fact-as-string)) > (retract ?my-match) > ) > > I wonder why retract works with ?my-match, but findFactByID won't accept > it?! > > The handle on the fact is not a Variable or Value either (though the > exception message tells its type is a FACT_ID): > ... > (bind ?fact-id-as-int (call ?my-match factIDValue (context))) > ... > .I get this message if I try to call any of the methods of those classes: > Message: Not an external address: "" (type = FACT_ID). > I need the integer 17, not this string. How should I do this? > > The same problem arises when I want to use (fact-slot-value ?fact-id > "OBJECT")... > > Thanks, your help is appreciated! Kind regards, Joost > > Joost Jonker > [EMAIL PROTECTED] > KPN Research, Leidschendam, room CD102 > visitors: St. Paulusstraat 4, 2264 XZ Leidschendam > mail: P.O. Box 421, 2260 AK Leidschendam, > Netherlands; + 31 (0)70 - 33 27 180 > > > > - > 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 Distributed Systems ResearchPhone: (925) 294-2154 Sandia National LabsFAX: (925) 294-2234 Org. 8920, MS 9012 [EMAIL PROTECTED] PO Box 969 http://herzberg.ca.sandia.gov Livermore, CA 94550 - To unsubscribe, send the words 'unsubscribe jess-users [EMAIL PROTECTED]' in the BODY of a message to [EMAIL PROTECTED], NOT to the list (use your own address!) List problems? Notify [EMAIL PROTECTED] -
JESS: Bug in backwards chaining with ordered facts
Thanks for the information. Nothing like calling a release "final" to flush out new bug reports! Here's a patch: -- --- c:/Jess50/jess/Node2.java Mon Jan 31 08:06:34 2000 +++ jess/Node2.java Wed Feb 02 16:31:36 2000 @@ -493,7 +493,12 @@ (Binding) m_defrule.getBindings().get(test.m_slotValue.variableValue(null)); if (b.m_factIndex < token.size()) - val = token.fact(b.m_factIndex).get(b.m_slotIndex); + { +val = token.fact(b.m_factIndex).get(b.m_slotIndex); + +if (b.m_subIndex != -1) + val = val.listValue(null).get(b.m_subIndex); + } if (type == RU.SLOT) break; -- I think Ashraf Afifi wrote: > > > The following is a technical problem I am facing in release 5. > > In backward chaining if you write this code it works fine: > > (do-backward-chaining foo) > (defrule xyz > (bar ?a) > (foo ?a) > => ) > (assert( bar abc)) > this causes fact (need-foo abc) to be asserted. > > But, if you rewrite it as > (do-backward-chaining foo) > (defrule xyz > (bar ?a ?b) > (foo ?a ?b) > => ) > (assert( bar a b)) > > this causes the fact (need-foo a b a b a b) to be asserted > > If I print the arguments of this fact, I get ((a b)(a b)(a b)) > > I don't know to whom should I report this problem? > > regards > > Ashraf Afifi > > > > - Ernest Friedman-Hill Distributed Systems ResearchPhone: (925) 294-2154 Sandia National LabsFAX: (925) 294-2234 Org. 8920, MS 9012 [EMAIL PROTECTED] PO Box 969 http://herzberg.ca.sandia.gov Livermore, CA 94550 - To unsubscribe, send the words 'unsubscribe jess-users [EMAIL PROTECTED]' in the BODY of a message to [EMAIL PROTECTED], NOT to the list (use your own address!) List problems? Notify [EMAIL PROTECTED] -
JESS: More backwards chaining fixes
Ah, I see what's happening. Thanks! I think a better fix (same idea, but covers all possibilities) is to move copies of the new line to two different places in the same routine: one at about line 522, right after slot.set(val, test.m_subIdx); + val = Funcall.NIL; and another at about line 536, right after vv.set(val, i); + val = Funcall.NIL; These lines numbers refer to the file -after- the previous patch has been applied. Together, these two should prevent similar problems in other circumstances. I think Ashraf Afifi wrote: > > > > I have added one line to the patch that you sent me. When I run the test in the > forwarded message, the asserted fact is (need-foo a b nil) > > Binding b = > (Binding) > m_defrule.getBindings().get(test.m_slotValue.variableValue(null)); > + val = Funcall.NIL; > if (b.m_factIndex < token.size()) > //val = token.fact(b.m_factIndex).get(b.m_slotIndex); > { >val = token.fact(b.m_factIndex).get(b.m_slotIndex); > if (b.m_subIndex != -1) > val = val.listValue(null).get(b.m_subIndex); > } > > Ashraf Afifi > -- Forwarded by Ashraf Afifi/Bsg/MetLife/US on 02/03/2000 > 05:38 PM --- > > > Ashraf Afifi > 02/03/2000 12:09 PM > > To: [EMAIL PROTECTED] > cc: > Subject: 2nd backward chaining bug after batch for release 5 > > Thanks for your fast reply yesterday. I applied it and further tested the > system. > > (do-backward-chaining foo) > > (defrule x > (xyz ?a ?b ) > (foo ?a ?b $?c) > =>) > (assert(xyz a b)) > > this causes the system to assert (need-foo a b b) > when I print it. It is (a b b). > I was expecting (need-foo a b nil) or (need-foo a b ) > > regards > > Ashraf > > > > > > - Ernest Friedman-Hill Distributed Systems ResearchPhone: (925) 294-2154 Sandia National LabsFAX: (925) 294-2234 Org. 8920, MS 9012 [EMAIL PROTECTED] PO Box 969 http://herzberg.ca.sandia.gov Livermore, CA 94550 - To unsubscribe, send the words 'unsubscribe jess-users [EMAIL PROTECTED]' in the BODY of a message to [EMAIL PROTECTED], NOT to the list (use your own address!) List problems? Notify [EMAIL PROTECTED] -
Re: JESS: complex slots
This is a frequently-requested feature, but I'm sorry, it just doesn't work this way, at least not right now. You can store the Person's name in the slot, of course, but there's no way to link a slot to another deftemplate. Deftempates are not a good data-structure representation language. Because of the way the Rete algorithm works, facts are transient things. Whenever any of the values of a specific Person's slots changes, the fact representing that Person is retracted and a new one asserted. If Jess somehow allowed the kind of linking you're interested in (and believe me, lots of other people are interested as well) what would then happen to the Organization fact? Somehow it would need to be updated. How would Jess know to update it? It would have to keep a table listing every fact that referred to another fact. Keeping this table updated could be a significant computational burden. There are some other issues as well: when the Organization fact is updated, it will have to be retracted and reasserted too (this is how the Rete algorithm works, remember. ) A Person might sensibly want to refer to its own Organization fact as well - but now we've got an infinte loop. Now, one thing you can do in an actual system is use Java Beans and defclasses instead of Deftemplates. Then the 'employs' slot could directly hold a reference to a Person Bean, which would not change when the Person's slots changed. If the goal is, however, just to define the ontology, then this doesn't help. I think Maren Zubizarreta wrote: [Charset iso-8859-1 unsupported, filtering to ASCII...] > I_m definning an ontology using Jess, and I don_t know how to express > complex slots: > Example: > > (deftemplate Person > (slot name (type STRING))) > > (deftemplate Organization > (slot name (type STRING)) > (slot location(type STRING)) > (slot employs --->Person ) > > I want the slot "employs" being of type "Person",and so when setting > a fact for Organization I want to set the slot "employs" to a Person's > "name". > > Does anybody knows if it's possible to make such structures in Jess? > Thank you very much in advance for your help. > - Ernest Friedman-Hill Distributed Systems ResearchPhone: (925) 294-2154 Sandia National LabsFAX: (925) 294-2234 Org. 8920, MS 9012 [EMAIL PROTECTED] PO Box 969 http://herzberg.ca.sandia.gov Livermore, CA 94550 - To unsubscribe, send the words 'unsubscribe jess-users [EMAIL PROTECTED]' in the BODY of a message to [EMAIL PROTECTED], NOT to the list (use your own address!) List problems? Notify [EMAIL PROTECTED] -
Re: JESS: A question...
I thought some of you might want to hear that I bounced this problem back and forth with Mr. Borraz and we eventually traced it to some spurious control characters in the Jess script he was reading! Jess apparently doesn't do a great job of reporting this particular brand of syntax error (a fairly generic "I/O Error" was all he was getting.) Anyway, it's nice to have closure. - Forwarded message from Calicrates Policroniades Borraz - >From [EMAIL PROTECTED] Mon Feb 7 12:37:05 2000 Date: Mon, 7 Feb 2000 14:21:01 +0700 (GMT) From: Calicrates Policroniades Borraz <[EMAIL PROTECTED]> X-Sender: cali@pitts To: friedman_hill ernest j Subject: Re: JESS: A question... In-Reply-To: <[EMAIL PROTECTED]> Message-ID: On Mon, 7 Feb 2000, friedman_hill ernest j wrote: > Well, there's nothing wrong with this. Can you retype the file, just > to make sure there aren't any invisible control characters in it, and > try again? Thank you very much, the problem has been fixed. Good point. > > I think Calicrates Policroniades Borraz wrote: > > > > >Hi, > > > > > >OK, now I think we're getting somewhere. I think what's happening is > > >that Jess is doing a very bad job of reporting a syntax error in your > > >script file -- an unusual syntax error. Can you show me the script > > >file you're trying to read? > > > > Ok, my script is only this: > > > > (defclass element VisualElem) > > (defrule here-i-am > > (element (name "ball")) > > => > > (printout t "I SEE THE BALL" crlf) > > ) > > > > > > Thank you... > > > > > > > > > > > > - > Ernest Friedman-Hill > Distributed Systems ResearchPhone: (925) 294-2154 > Sandia National LabsFAX: (925) 294-2234 > Org. 8920, MS 9012 [EMAIL PROTECTED] > PO Box 969 http://herzberg.ca.sandia.gov > Livermore, CA 94550 > - End of forwarded message from Calicrates Policroniades Borraz - - Ernest Friedman-Hill Distributed Systems ResearchPhone: (925) 294-2154 Sandia National LabsFAX: (925) 294-2234 Org. 8920, MS 9012 [EMAIL PROTECTED] PO Box 969 http://herzberg.ca.sandia.gov Livermore, CA 94550 - To unsubscribe, send the words 'unsubscribe jess-users [EMAIL PROTECTED]' in the BODY of a message to [EMAIL PROTECTED], NOT to the list (use your own address!) List problems? Notify [EMAIL PROTECTED] -
Re: JESS: Retract an object
Use "undefinstance" instead of retract: rete.executeCommand("(undefinstance (fetch morfologia))") undefinstance has the same effect as retract on a definstance, but it accepts the object as a parameter instead of the fact-id. I think Alessandro Saporiti wrote: > Hi, > on the following code I have a question: > > rete.executeCommand("(defclass Morfologia MorfologiaBean)"); > for (int i=0 ; i < vettore.size() ;i++){ > if (vettore.elementAt(i) instanceof MorfologiaBean ){ >rete.store("morfologia", (MorfologiaBean)vettore.elementAt(i)); >rete.executeCommand("(definstance Morfologia (fetch morfologia) > static)"); }} > > .do something > > Value my = rete.fetch("morfologia"); > Context context = rete.getGlobalContext(); > MorfologiaBean oggetto = (MorfologiaBean) my.externalAddressValue(context); > > How can I retract the all object "morfologia" ? > > Thank you in advance > Alessandro - Ernest Friedman-Hill Distributed Systems ResearchPhone: (925) 294-2154 Sandia National LabsFAX: (925) 294-2234 Org. 8920, MS 9012 [EMAIL PROTECTED] PO Box 969 http://herzberg.ca.sandia.gov Livermore, CA 94550 - To unsubscribe, send the words 'unsubscribe jess-users [EMAIL PROTECTED]' in the BODY of a message to [EMAIL PROTECTED], NOT to the list (use your own address!) List problems? Notify [EMAIL PROTECTED] -
Re: JESS: automatically generating rules
The appropriate transformation looks like this: (defrule foo (or (A) (B)) (C) (or (D) (E)) => ) ---\ ---/ (defrule foo-1 (defrule foo-2 (A) (A) (C) (C) (D) (E) => => ) ) (defrule foo-3 (defrule foo-4 (B) (B) (C) (C) (D) (E) => => ) ) This is not too terribly difficult to carry out mechanically. The four left-hand-sides of these rules will together constitute the most efficient possible translation of the LHS of the original rule. Jess will recombine the LHS using the normal Rete-network sharing mechanisms such that no nonessential duplicate work will be done. No extra facts or machinery are needed. Of course, a full implementation (of the sort that Jess will hopefully soon include) has to include (and) and (not) CEs arbitrarily nesting inside (or)s, which are somewhat harder. The one downside of this approach is that there are four separate rule RHS, andthis will show up in trace information, etc. When Jess gets ORs, this, too, will be overcome. But anyway, for the simple kind of case shown above, the transofmration can eb done textually on the rues, and it's not too bad. I think Blaine Bell wrote: > It is my understanding (correct me if I am wrong), it is not possible to > define a rule in which the LHS is a combination of facts ORed together. > It is quite easy to write functions for this problem, however, writing > functions on the LHS can produce performance problems. One of our > proposed solutions is to generate multiple rules, one for each > sub-expression that is ORed together. These sub-expression rules will > assert a "sub-expression" fact that will be checked for by a rule that > has the RHS for the complete expression. This is fine, and it performs > better, except I do believe that I am trying to re-invent the wheel. > Because multiple rules have similar sub-expressions, in order to perform > better, I would need to recognize these similarities, and combine them > with each other to form sub-expressions so that they do not get > evaluated multiple times. This is exactly what JESS is suppose to do, > right? My question is: is there a better way to do this in JESS? > > Thanks in advance.. > > Blaine > > - > 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 Distributed Systems ResearchPhone: (925) 294-2154 Sandia National LabsFAX: (925) 294-2234 Org. 8920, MS 9012 [EMAIL PROTECTED] PO Box 969 http://herzberg.ca.sandia.gov Livermore, CA 94550 - To unsubscribe, send the words 'unsubscribe jess-users [EMAIL PROTECTED]' in the BODY of a message to [EMAIL PROTECTED], NOT to the list (use your own address!) List problems? Notify [EMAIL PROTECTED] -
Re: JESS: A question about reset function.
Ah. OK. When I described what (reset) does, I neglected to mention that (definstances) are like (deffacts). Here's what the jess manual says about (reset): 8.111. (reset) Package: Intrinsics Arguments: None Returns: TRUE Description: Removes all facts from the fact list, removes all activations, then asserts the fact (initial-fact), then asserts all facts found in deffacts, asserts a fact representing each registered definstance, and (if the set-reset-globals property is TRUE) initializes all defglobals. If you want the definstances to disappear, you have to remove them. You can do them one at a time, or use (undefinstance *). One of the best parts about Jess 5, I thought, at least comapred to previous versions, is the manual. The javadoc for the API functions is still very weak, but the documentation for the Jess language itself is, I think, now fairly complete. I think Calicrates Policroniades Borraz wrote: > On Mon, 7 Feb 2000, friedman_hill ernest j wrote: > > > reset() removes all the facts, then asserts the fact (initial-fact), > > then asserts all the facts that appear in any (deffacts) > > constructs. The entire implementation of the Jess (reset) function is > > > > case RESET: > > context.getEngine().reset(); > > break; > > > > So clearly the two do the same thing. > > > > Hi, my application creates a rete object, then immediatly executes a reset > command, this action asserts the initial fact, as it must do it. > Later each determined time (a simulation step) it receives an object that > is included in the KB in this way: > > f = new Funcall("definstance", rete); > f.add(new Value("element", RU.ATOM)); > f.add(new Value(objInMemory)); > f.execute(rete.getGlobalContext()); > > After this, the program executes the method: > > rete.run(); > > The first time the rules that must be fired are fired. I want now to clean > the KB of all the facts, therefore the program executes: > > rete.reset(); > rete.executeCommand("(facts)"); > > Apparently the facts are not erased because the next command (the > above facts) show me all the facts, even though I have executed the reset. > The big problem is that the rule that must be fired only once in each step > of the simulation recognizes the previous facts and the rule is fired > several times in each step. Is this right? or Have I misunderstood the > reset function? > > Thank you in advance... > > - Ernest Friedman-Hill Distributed Systems ResearchPhone: (925) 294-2154 Sandia National LabsFAX: (925) 294-2234 Org. 8920, MS 9012 [EMAIL PROTECTED] PO Box 969 http://herzberg.ca.sandia.gov Livermore, CA 94550 - To unsubscribe, send the words 'unsubscribe jess-users [EMAIL PROTECTED]' in the BODY of a message to [EMAIL PROTECTED], NOT to the list (use your own address!) List problems? Notify [EMAIL PROTECTED] -
Re: JESS: A question about reset function.
reset() removes all the facts, then asserts the fact (initial-fact), then asserts all the facts that appear in any (deffacts) constructs. The entire implementation of the Jess (reset) function is case RESET: context.getEngine().reset(); break; So clearly the two do the same thing. I think Calicrates Policroniades Borraz wrote: > > Hi guys... > > I'm loading a Jess script from Java and I have a problem, I think. > > I want to know if the rete.reset() method really erase all the facts > from Jess memory. Because when I execute the method the facts seem to > remain. The explanation that I find is that reset() only erase the mark > that indicate that they have fired a rule. > > Thank you in advance. > - Ernest Friedman-Hill Distributed Systems ResearchPhone: (925) 294-2154 Sandia National LabsFAX: (925) 294-2234 Org. 8920, MS 9012 [EMAIL PROTECTED] PO Box 969 http://herzberg.ca.sandia.gov Livermore, CA 94550 - To unsubscribe, send the words 'unsubscribe jess-users [EMAIL PROTECTED]' in the BODY of a message to [EMAIL PROTECTED], NOT to the list (use your own address!) List problems? Notify [EMAIL PROTECTED] -
Re: JESS: A question...
I think Calicrates Policroniades Borraz wrote: > > Jess reported an error in routine Tokenizer.nextToken while executing > (batch D:/Cali/progv5/primero.clp). > Message: I/O Exception. > Program text: ( batch D:/Cali/progv5/primero.clp ) at line 0. > > I read the manual and I know that I must enclose in double quotes the > paths that include a colon. Could somebody tell me how to do this in Java? > Because I've tried but every time that I want to include in a stringtry to > define a char or a string the double quote the compiler ask me for > the end of the string. Use backslashes to escape the souble quotes inside a Java string: rete.executeCommand("(batch \"D:/Cali/progv5/primero.clp\")"); - Ernest Friedman-Hill Distributed Systems ResearchPhone: (925) 294-2154 Sandia National LabsFAX: (925) 294-2234 Org. 8920, MS 9012 [EMAIL PROTECTED] PO Box 969 http://herzberg.ca.sandia.gov Livermore, CA 94550 - To unsubscribe, send the words 'unsubscribe jess-users [EMAIL PROTECTED]' in the BODY of a message to [EMAIL PROTECTED], NOT to the list (use your own address!) List problems? Notify [EMAIL PROTECTED] -
Re: JESS: BNF or EBNF for Jess rules
I don't have a grammar for Jess rules, no. It probably would not be too hard to write, as the syntax is fairly regular and you don't need more than one token of lookahead. Regarding a DTD for rules: see Dave Carlson's work: http://www.ontogenics.com/repository/translator , and the various documents on XMI available from the OMG web site (http://www.omg.org, search for "XMI"). I think Rudolph George-P27574 wrote: [Charset iso-8859-1 unsupported, filtering to ASCII...] > Ernest, > Is there a BNF for Jess rules? > > I'm betting several other people on the list may have already hit this, > so I'd welcome any suggestions or info on the following subject: > > I'd like to define an engine-neutral XML DTD for rules. I'd thought of > doing this based on the structure of Jess rules, but that's not a > requirement > as long as instances of XML rules based on the DTD can be translated into > Jess defrule command strings. > > I'm assuming that a BNF description is the easiest place to start, which is > what's at the > root of my question at the top. > > -- > George Rudolph > Mad Scientist > Motorola SSG > -- > > - > 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 Distributed Systems ResearchPhone: (925) 294-2154 Sandia National LabsFAX: (925) 294-2234 Org. 8920, MS 9012 [EMAIL PROTECTED] PO Box 969 http://herzberg.ca.sandia.gov Livermore, CA 94550 - To unsubscribe, send the words 'unsubscribe jess-users [EMAIL PROTECTED]' in the BODY of a message to [EMAIL PROTECTED], NOT to the list (use your own address!) List problems? Notify [EMAIL PROTECTED] -
Re: JESS: Question on using Jess with JAVA Servlets
See http://www.nsm.iup.edu/pha/rih/ for a nice example of a servlet-based Jess application. See http://www.nsm.iup.edu/pha/rih/techinfo to get the full source code. Note that this site does use Jess 4.x, so you will need to update the code for 5.0. I think BPoon wrote: > Dear All, > > My Project is using applet as front-end, and using Jess as back-end rule > base system. So I decide to use Jess with java servlet to do so because IE > will prompt the security error when the applet is required to run the Rete > engine to execute the file rule.clp > > However, I have no experience on using Jess with servlet, but I MUST use > the applet as front-end of the system (for some purpose). I remember that > Ernest said the example will be included in the zip file of Jess 5.0 > final, but after I downloaded it, the file CORBA (is this the one for > using servlet?) has no content. > > Now, I have the following questions: > 1. Would anyone like telling me that how can I find the example of > using Jess with Servlet? > > 2. If there is no example, would anyone like telling me how to do so? > > 3. Could you suggest me whether my idea on this project is good or > not? > > Please help me. Thanks a lot! > > Best Regards, > BPoon > > - > 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 Distributed Systems ResearchPhone: (925) 294-2154 Sandia National LabsFAX: (925) 294-2234 Org. 8920, MS 9012 [EMAIL PROTECTED] PO Box 969 http://herzberg.ca.sandia.gov Livermore, CA 94550 - To unsubscribe, send the words 'unsubscribe jess-users [EMAIL PROTECTED]' in the BODY of a message to [EMAIL PROTECTED], NOT to the list (use your own address!) List problems? Notify [EMAIL PROTECTED] -
Re: JESS: JESS and Java objects
That's what the "OBJECT" slot is for - it holds the object. (defrule write-a (a (num ?n) (OBJECT ?o)) => (call ?o setNum (+ ?n 1))) Note that in this case, you can use "modify" if you want, since what you're doing is modifying one of the matched slots. That would look like this, and have the identical effect: (defrule write-a-2 ?f <- (a (num ?n)) => (modify ?f (num (+ ?n 1 The advantage here is that (a) could be either a regular fact or a definstance, and the code still works; useful if you ever want to change this. I think Jerome Poirier wrote: > Hello, > > First I'm a new french user of Jess, so I don't speak english very, sorry > for the inconvenience. > I would like to fire rules with Java objects based facts. > > Please let's considere the following object : > * class A { > * int num; > * A (int newNum) { setNum (newNum); } > * int getNum () { return num; } > * void setNum (int newNum) { num = newNum; } > * } > To put instances of it into facts, I made : > * jess.Rete rete = jess.Rete(); > * A a1 = new Achat(1); > * rete.executeCommand("(defclass a A)"); > * rete.store("A1", a1); > * rete.executeCommand("(bind ?a (fetch A1))"); > * rete.executeCommand("(definstance a ?a static)"); > So I have the following fact: > * (a (class ) (num 1) (OBJECT > )) > > Now I would like to create a rule which, for all "a" facts, do an action. > This is done by (for example) : > * rete.executeCommand("(defrule write-a " + > * "(a (num ?n)) => " + > * "(printout t ?n crlf))"); > Into the action, I can use "num" thanks to "?n". > > BUT I do not know how to use the objet itself ! I would like to do something > "like" : > * rete.executeCommand("(defrule write-a " + > * "(?object = a) => " + > * "(call ?object setNum 2))"); > > Do you know how to do ??? > > Thanks a lot > > Jerome Poirier > [EMAIL PROTECTED] > > - > To unsubscribe, send the words 'unsubscribe jess-users [EMAIL PROTECTED]' > in the BODY of a message to [EMAIL PROTECTED], NOT to the > list (use your own address!) List problems? Notify [EMAIL PROTECTED] > - > - Ernest Friedman-Hill Distributed Systems ResearchPhone: (925) 294-2154 Sandia National LabsFAX: (925) 294-2234 Org. 8920, MS 9012 [EMAIL PROTECTED] PO Box 969 http://herzberg.ca.sandia.gov Livermore, CA 94550 - To unsubscribe, send the words 'unsubscribe jess-users [EMAIL PROTECTED]' in the BODY of a message to [EMAIL PROTECTED], NOT to the list (use your own address!) List problems? Notify [EMAIL PROTECTED] -
Re: JESS: Cast of an object
Hi, Well, I'm not 100% sure what you're trying to do. 'paolo' is an instance of jess.Value or a subclass thereof, so the println will print "jess.Value", "jess.Variable", or "jess.FuncallValue", and you're probably not expecting that. Note, by the way, that you evaluate the paolo object twice, once when you call externalAddressValue and once when you call stringValue(); this might be bad if paolo is a FuncallValue, since then you'll execute this function twice. To avoid this, make the first line read Value paolo = vv.get(1).resolveValue(context); (See Jess manual section 4.2.2.) I'm also not sure what you want the stringValue() call to do. It looks like you believe paolo should contain an AttuazioneBean object as an EXTERNAL_ADDRESS. It cannot also contain a String! Maybe you expect toString() to be called automatically? It will not be. Because the function is called fact-out-2, and because it's returning a String, perhaps you want a String rendering of the shadow fact that represents this object? Jess doesn't provide any easy way to get such a thing, at least, not that I can think of right now. Roughly, you could do something like String getStringFormOfShadowFact(Object o) { for (Enumeration e = rete.listFacts(); e.hasMoreElements();) { Fact f = (Fact) e.nextElement(); if (f.isShadow() && f.getSlotValue("OBJECT") == o) return f.toStringWithParens(); } // Not found, throw an exception or something. } I think Alessandro Saporiti wrote: > Hi, > I have write the following java code , but this function don't work! > I'm missing somethings? > > import jess.*; > > public class FactOut2 implements Userfunction > { > public String getName() { return "fact-out-2"; } > public Value call(ValueVector vv, Context context) throws JessException > { > Value paolo = vv.get(1); > AttuazioneBean AttuazioneObject = (AttuazioneBean) > paolo.externalAddressValue(context); > System.out.println("Bean object :" + paolo.getClass().getName() ); > return new Value (vv.get(1).stringValue(context), RU.STRING); > > } > } > > Thank in advance. > Alessandro > - > 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 Distributed Systems ResearchPhone: (925) 294-2154 Sandia National LabsFAX: (925) 294-2234 Org. 8920, MS 9012 [EMAIL PROTECTED] PO Box 969 http://herzberg.ca.sandia.gov Livermore, CA 94550 - To unsubscribe, send the words 'unsubscribe jess-users [EMAIL PROTECTED]' in the BODY of a message to [EMAIL PROTECTED], NOT to the list (use your own address!) List problems? Notify [EMAIL PROTECTED] -
Re: JESS: clean up of facts.
Well, it seems to me that basically two rules would keep the set of EntityAt facts up to date. (defrule create-entity-at (entity ?id ?x ?y) (position ?pid ?x ?y) (not (EntityAt ?id ?pid)) => (assert (EntityAt ?id ?pid))) (defrule delete-entity-at ?e <- (EntityAt ?id ?pid) (entity ?id ?x ?y) (not (position ?pid ?x ?y)) => (retract ?e)) Whenever an (entity) changes, both rules will probably fire (given that the necessary position and/or EntityAt facts exist.) Does this do it? I think Neeraj - Khandelwal wrote: > > Hi all, > I have the followong problem: > > I have the facts: > > (entity id x y) > (position pid x y ) > > Now theres a rule which asserts new facts based on the current values of > the above facts. > > the new fact is of the type: > > (EntityAt id pid) > > Now at some point in the future the fact for entity modifies its x and y > values. I would like this to delete the old EntityAt fact and assert a new > fact based on the new value of entity fact. Basicly I want Jess to clean > up after itself. Is there an easy and straight forward way of doing this? > I am currently using the fact number to see if a fact is newer than > another to see if it is still valid. > > the problem is complicated by the fact that I already have a big facts and > rule base and I want to achieve this by making the minimal changes. > > thanx , > Neeraj. > > > > - > 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 Distributed Systems ResearchPhone: (925) 294-2154 Sandia National LabsFAX: (925) 294-2234 Org. 8920, MS 9012 [EMAIL PROTECTED] PO Box 969 http://herzberg.ca.sandia.gov Livermore, CA 94550 - To unsubscribe, send the words 'unsubscribe jess-users [EMAIL PROTECTED]' in the BODY of a message to [EMAIL PROTECTED], NOT to the list (use your own address!) List problems? Notify [EMAIL PROTECTED] -
JESS: Re: Center of Gravity
I think Rudolph George-P27574 wrote: [Charset iso-8859-1 unsupported, filtering to ASCII...] > Why are you doing this calculation using a rules engine? > Whay not just use a conventional loop that aggregates partial results? > > -- > George Rudolph > Mad Scientist > Motorola SSG > -- > > Well, I was just taking it as a given that he's got the entities as facts. He may be doing other kinds of reasoning about the geometrical entities as well. - Ernest Friedman-Hill Distributed Systems ResearchPhone: (925) 294-2154 Sandia National LabsFAX: (925) 294-2234 Org. 8920, MS 9012 [EMAIL PROTECTED] PO Box 969 http://herzberg.ca.sandia.gov Livermore, CA 94550 - To unsubscribe, send the words 'unsubscribe jess-users [EMAIL PROTECTED]' in the BODY of a message to [EMAIL PROTECTED], NOT to the list (use your own address!) List problems? Notify [EMAIL PROTECTED] -
Re: JESS: [Modifying facts in deffunction]
Yes, this is a fine solution. I think Bruno SINTES wrote: > I found a 'solution' to my problem (well, it's working so far, so I consider it > is a solution !) > > > (defrule foo > ... > ?ac <- (action yes) > => > > (retract ?ac) > ) > > ... > > (deffunction menu-handler (?event) > (assert (action yes)) > (run) > ) > > Because when the user doesn't do anything (and no rule has to be fired), the > engine stops. > So when there is an action commited, I assert the fact and run the engine. I don't > know if it is clever, but it works. > > Bruno SINTES > - Ernest Friedman-Hill Distributed Systems ResearchPhone: (925) 294-2154 Sandia National LabsFAX: (925) 294-2234 Org. 8920, MS 9012 [EMAIL PROTECTED] PO Box 969 http://herzberg.ca.sandia.gov Livermore, CA 94550 - To unsubscribe, send the words 'unsubscribe jess-users [EMAIL PROTECTED]' in the BODY of a message to [EMAIL PROTECTED], NOT to the list (use your own address!) List problems? Notify [EMAIL PROTECTED] -
Re: JESS: Jess 6.0
I think Kahuna Moore wrote: > > I remember (or not?) working with CLIPS a while back and I thought it had a > feature that let UserFunctions (or the equivalent) eat up the parser input > stream to allow the checking the # args etc. It has been a while so I could > be wrong... > > Could you do something like this for Jess? That way it might be possible to > embed javascript inline on the rhs. > > alan > This is indeed something I've thought about, something like this, anyway. If functions could parse themselves, then the "constructs vs. functions" dichotomy could go away, and it'd also be easier to write functions which, as you suggest, interpret embedded scripting languages. We'll see if this happens or not. - Ernest Friedman-Hill Distributed Systems ResearchPhone: (925) 294-2154 Sandia National LabsFAX: (925) 294-2234 Org. 8920, MS 9012 [EMAIL PROTECTED] PO Box 969 http://herzberg.ca.sandia.gov Livermore, CA 94550 - To unsubscribe, send the words 'unsubscribe jess-users [EMAIL PROTECTED]' in the BODY of a message to [EMAIL PROTECTED], NOT to the list (use your own address!) List problems? Notify [EMAIL PROTECTED] -
JESS: nth$ semantic difference (fwd)
Should I change this? - Forwarded message from [EMAIL PROTECTED] - >From [EMAIL PROTECTED] Fri Feb 25 12:07:51 2000 From: [EMAIL PROTECTED] Message-Id: <[EMAIL PROTECTED]> Subject: nth$ semantic difference To: ejfried@california Date: Fri, 25 Feb 2000 15:07:30 -0500 (EST) X-Mailer: ELM [version 2.5 TKL/POP PL2] Hi, How are you? I am not quite sure on this but I think I found one JESS commands that are not semantically match with Clips. On nth$, the symbol nil is returned if the first argument(integer expression) is greater than the number of field in the second argument. However, in JESS it throws exception. I had afew trouble on my code because I was expecting nil. So, for simple fix up, I returned Funcall.NIL instead of JessException. thank you for building this wonderful expert system shell:) later, Seung - End of forwarded message from [EMAIL PROTECTED] - - Ernest Friedman-Hill Distributed Systems ResearchPhone: (925) 294-2154 Sandia National LabsFAX: (925) 294-2234 Org. 8920, MS 9012 [EMAIL PROTECTED] PO Box 969 http://herzberg.ca.sandia.gov Livermore, CA 94550 - To unsubscribe, send the words 'unsubscribe jess-users [EMAIL PROTECTED]' in the BODY of a message to [EMAIL PROTECTED], NOT to the list (use your own address!) List problems? Notify [EMAIL PROTECTED] -
Re: JESS: Any benchmark programs?
They're from Daniel Miranker's group at the university of texas. See ftp://cs.utexas.edu/pub/ops5-benchmark-suite The programs are in OPS5 syntax but it's not too tough to translate them to CLIPS/Jess syntax. I've never run Waltz to compare CLIPS to Jess, as it requires the writing of a certain amount of external (C or Java) code, but I have run the 'manners' test many times. As the problem size gets larger, Jess outpaces CLIPS by an increasingly large factor; at N=100, Jess is more than an order of magnitude faster than CLIPS. THere are some other benchmarks at Miranker's site too. I think Dayton Marcott wrote: [Charset iso-8859-1 unsupported, filtering to ASCII...] > I'm curious about benchmarking some production systems to see how they > compare. > Are there any benchmark programs available that are written simply enough to > run > on different OPS products? I'd like to run the same program with JESS, > CLIPS, > OPS5, and perhaps others. The PST site mentions two benchmark programs, > Manners and Waltz, that they used to compare CLIPS and OPS83, but I can't > locate those programs anywhere. Can anyone help? > > Thanks, > > Dayton > > - Ernest Friedman-Hill Distributed Systems ResearchPhone: (925) 294-2154 Sandia National LabsFAX: (925) 294-2234 Org. 8920, MS 9012 [EMAIL PROTECTED] PO Box 969 http://herzberg.ca.sandia.gov Livermore, CA 94550 - To unsubscribe, send the words 'unsubscribe jess-users [EMAIL PROTECTED]' in the BODY of a message to [EMAIL PROTECTED], NOT to the list (use your own address!) List problems? Notify [EMAIL PROTECTED] -
Re: JESS: change the facts
This is what the (modify) function does: (modify 2 (model SL2)) Of course, if you have the Java Fact object itself instead, you can call setSlotValue on it. I think Maren Zubizarreta wrote: > Hi Everibody: > Does anybody know if it's possible to change a fact's value, > once it has been asserted? > For instance: > if I have the fact: > >>f-2 (used-auto (make Saturn) (model SL1) (year 1992) (color white) >>> (mileage 120000) (blue-book-value 3500) (owners > ejfried)) > Can I change the value of the "model" slot by means of a rule or > smthg? > Thanx > - Ernest Friedman-Hill Distributed Systems ResearchPhone: (925) 294-2154 Sandia National LabsFAX: (925) 294-2234 Org. 8920, MS 9012 [EMAIL PROTECTED] PO Box 969 http://herzberg.ca.sandia.gov Livermore, CA 94550 - To unsubscribe, send the words 'unsubscribe jess-users [EMAIL PROTECTED]' in the BODY of a message to [EMAIL PROTECTED], NOT to the list (use your own address!) List problems? Notify [EMAIL PROTECTED] -
Re: JESS: modifying a fact
This should really be a FAQ entry. You just have to modify your matching pattern so it excludes whatever you'll be modifying the facts to look like. You examples aren't quite concrete enough for me to use them, so I'll make up my own here. For instance: (deftemplate sum (slot op1) (slot op2) (slot sum (default nil))) (defrule compute-sum ?s <- (sum (op1 ?n1) (op2 ?n2) (sum nil)) => (modify ?s (sum (+ ?n1 ?n2 If we didn't match on (sum nil), there would be an infinite loop. But the dum slot is never nil after the modify, so the loop is broken. Sometimes, instead of changing the match criteria, you instead can retract one or more of the matched facts that will no longer be needed. I think Maren Zubizarreta wrote: > Hi again after a short while: > The answer I got from this list about how to change a fact, was to use the > "modify" function. > I applied this to my example: > (assert (Shop (a somethg)(b somethgelse))) > (defrule change-the-fact > ?fact <-(Shop(a something)) > => > modify ?fact (b change)) > Or to this one: > (assert (Shop (a somethg)(b somethgelse))) > (assert (House (c somethg)) > (defrule change-the-fact > (House ?some) > ?fact <-(Shop(a ?some)) > => > modify ?fact ((a ?some)(b change)) > > In both cases Jess enters an infinite loop > > So the question would be:How can I modify a fact's slot that isn't the one > used > to do the matching? > thanx > > > - > 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 Distributed Systems ResearchPhone: (925) 294-2154 Sandia National LabsFAX: (925) 294-2234 Org. 8920, MS 9012 [EMAIL PROTECTED] PO Box 969 http://herzberg.ca.sandia.gov Livermore, CA 94550 - To unsubscribe, send the words 'unsubscribe jess-users [EMAIL PROTECTED]' in the BODY of a message to [EMAIL PROTECTED], NOT to the list (use your own address!) List problems? Notify [EMAIL PROTECTED] -
Re: JESS: Get a query result
There's an example of this in section 2.8.2 of the Jess 5.0 (final version) manual. Here it is: import jess.*; import java.util.*; public class ExQuery { public static void main(String [] argv) throws JessException { // Create engine, define query and data Rete r = new Rete(); r.executeCommand("(defquery search (declare (variables ?X)) (foo ?X ?Y))"); r.executeCommand("(deffacts data" + "(foo blue red)" + "(bar blue green)" + "(foo blue pink)" + "(foo red blue)" + "(foo blue blue)" + "(foo orange yellow)" + "(bar blue purple))"); // Assert all the facts r.reset(); // Run the query, store the result r.executeCommand("(store RESULT (run-query search blue))"); // Fetch the result (an Enumeration). Enumeration e = (Enumeration) r.fetch("RESULT").externalAddressValue(null); Vector v = new Vector(); // Pick each element of the Enumeration apart and store the // interesting part in the Vector v. while (e.hasMoreElements()) { Token t = (Token) e.nextElement(); // We want the second fact in the token - the first is the query trigger Fact f = t.fact(1); // The first and only slot of this fact is the __data multislot. ValueVector multislot = f.get(0).listValue(null); // The second element of this slot is the datum we're interested in. v.addElement(multislot.get(1).stringValue(null)); } for (Enumeration answers = v.elements(); answers.hasMoreElements();) System.out.println(answers.nextElement()); } } C:\> java ExQuery red pink blue I think Maren Zubizarreta wrote: > Hi again: > While embedding jess in java code, > I'm trying to retrieve the enumeration generated by a run-query > command > into an enumeration I can use in my java code and not like a jess > command. > Does anybody know what method to use? > Thanx > > > - > 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 Distributed Systems ResearchPhone: (925) 294-2154 Sandia National LabsFAX: (925) 294-2234 Org. 8920, MS 9012 [EMAIL PROTECTED] PO Box 969 http://herzberg.ca.sandia.gov Livermore, CA 94550 - To unsubscribe, send the words 'unsubscribe jess-users [EMAIL PROTECTED]' in the BODY of a message to [EMAIL PROTECTED], NOT to the list (use your own address!) List problems? Notify [EMAIL PROTECTED] -
Re: JESS: jess 5 fact command problem
Actually, while CLIPS may support this, Jess never has, not in 4.4 or any other version; so this is not a change in 5.0. The functionality you want shouldn't be too hard to code up, so you're invited to do so. Just call Rete.listFacts() and scan through the Enumeration (the facts will be in order of ascending id.) You could write it as a (defadvice) for the existing (facts) function, if you like. I think Ashraf Afifi wrote: > > > > Hi, > In jess4.4 and clips if you type (facts n1 n2), the shell displays the > facts that have index numbers between n1 and n2. > In Jess 5 the same command displays all facts. > > Ashraf Afifi > - Ernest Friedman-Hill Distributed Systems ResearchPhone: (925) 294-2154 Sandia National LabsFAX: (925) 294-2234 Org. 8920, MS 9012 [EMAIL PROTECTED] PO Box 969 http://herzberg.ca.sandia.gov Livermore, CA 94550 - To unsubscribe, send the words 'unsubscribe jess-users [EMAIL PROTECTED]' in the BODY of a message to [EMAIL PROTECTED], NOT to the list (use your own address!) List problems? Notify [EMAIL PROTECTED] -
Re: JESS: A problem with Jess Facts.
Hi, (facts) is written in Jess code, in the file jess/scriptlib.clp. When you create a Rete object, this file is not loaded automatically - you have to do it yourself. If you want Jess to do it for you, use the class jess.Main. An easy way to do this is just to do this: Rete r = /* whatever */; Main m = new Main(); m.initialize(new String[] {}, r); >From here on,you can simply forget about the 'm' object. It has done its job of initializing the Rete object, including loading in the script library (and arranging to have it re-loaded when the (clear) command is issued.) See manual sections 4.4.3 and 6.1 for more information. I think Calicrates Policroniades Borraz wrote: > > Hi. I'm writting a program that uses a Rete object and in a moment I want > to know wich facts are activated in the KB so I use: > > rete.executeCommand("(facts)"); > > But I got the next message error: > > Jess reported an error in routine Funcall.execute while executing (facts). > Message: Unimplemented function facts. > Program text: ( facts ) at line 0. > > Does somebody know what is wrong? > > Thank you in advance... > > Calicrates > > - > 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 Distributed Systems ResearchPhone: (925) 294-2154 Sandia National LabsFAX: (925) 294-2234 Org. 8920, MS 9012 [EMAIL PROTECTED] PO Box 969 http://herzberg.ca.sandia.gov Livermore, CA 94550 - To unsubscribe, send the words 'unsubscribe jess-users [EMAIL PROTECTED]' in the BODY of a message to [EMAIL PROTECTED], NOT to the list (use your own address!) List problems? Notify [EMAIL PROTECTED] -
Re: JESS: How to do EXISTS?
Starting with Jess 5.0b4, Jess supports (exists) just as it is used in CLIPS. See manual section 2.8.1.7. Is the manual hard to read? Maybe it needs a better table of contents. I'm sure I could write a program to generate one from the XML nicely enough. I'll try to do this for the next release. I think Jens Liegle wrote: [Charset iso-8859-1 unsupported, filtering to ASCII...] > Hello JESS comrades, > how can I do an EXISTS statement in JESS? > > I need a rule that starts like > > (not (exists ( > > anyone? Thanks in advance... > > Jens > > [EMAIL PROTECTED] > - Ernest Friedman-Hill Distributed Systems ResearchPhone: (925) 294-2154 Sandia National LabsFAX: (925) 294-2234 Org. 8920, MS 9012 [EMAIL PROTECTED] PO Box 969 http://herzberg.ca.sandia.gov Livermore, CA 94550 - To unsubscribe, send the words 'unsubscribe jess-users [EMAIL PROTECTED]' in the BODY of a message to [EMAIL PROTECTED], NOT to the list (use your own address!) List problems? Notify [EMAIL PROTECTED] -
Re: JESS: Jess Multislots & Java Collections
Hmmm, well, interesting suggestion. There are certainly technical issues (for instance, since none of the Collections support PropertyChangeListeners, they would only be meaningful in static definstances.) Given this, I'm not sure a Vector is more convenient than an array (which Jess currently supports.) I think Javier Maria Torres Ramon wrote: > Hi, I wanted to know if there is going to be some "convergence" between Jess > multislots and some Java collection class. When making inferences on Java > objects, it would be very useful if you could define a slot as a > "vector/multislot", so as to have a unified interface. I found a way to > patch this use into Jess, but I don't find it too elegant, and cannot be > used without some amount of modification on a normal CLIPS environment. > > (foo (attribute ?a) (OBJECT ?foo-object)) > (bar (attribute ?b) (foo-list ?vector)) > ; ?vector is am externalAddressValue, a Vector > (test (call ?vector contains ?foo-object)) > => > ... > > I would appreciate any suggestions on the subject. > > Thanks and greetings, > > Javier Torres > - > 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 Distributed Systems ResearchPhone: (925) 294-2154 Sandia National LabsFAX: (925) 294-2234 Org. 8920, MS 9012 [EMAIL PROTECTED] PO Box 969 http://herzberg.ca.sandia.gov Livermore, CA 94550 - To unsubscribe, send the words 'unsubscribe jess-users [EMAIL PROTECTED]' in the BODY of a message to [EMAIL PROTECTED], NOT to the list (use your own address!) List problems? Notify [EMAIL PROTECTED] -
Re: JESS: Web Server question
Hi, I've used Jess in servlets under both Apache with the mod_jserv module, and under Microsoft's IIS with the ServletExec ISAPI plug-in from New Atlanta. Both of these worked well for me. I would expect Jess to work fine in virtually all servlet engines. I tried out Sun's Java Web Server at one time, and found it very clumsy and difficult to use. The applet-based configuration tool was just horrid (everyone on the list probably knows my take on Applets in general.) Both Apache and ServletExec have pure HTML administration. Of the two, ServletExec is nicer (IMHO) although it costs money, while Apache is free. If NES gives security exceptions, you should probably just read their documentation and find out how to configure the security policy. I think Fang Liu wrote: > Hi, all: > > I have a web application using java applets, servlets and jess on a Sun > workstation. I ran it on Java Web Server 2.0, but I always have problems > to start Java Web Server 2.0. I tried it on Netscape Enterprise Server > 3.6 before and it always gave security problems. > Could anybody give any suggestions about other servers you have used > successfully with servlets and jess? > > Any suggestions and comments are highly appreciated! > > Fang Liu Content-Description: Card for Fang Liu [Attachment, skipping...] - Ernest Friedman-Hill Distributed Systems ResearchPhone: (925) 294-2154 Sandia National LabsFAX: (925) 294-2234 Org. 8920, MS 9012 [EMAIL PROTECTED] PO Box 969 http://herzberg.ca.sandia.gov Livermore, CA 94550 - To unsubscribe, send the words 'unsubscribe jess-users [EMAIL PROTECTED]' in the BODY of a message to [EMAIL PROTECTED], NOT to the list (use your own address!) List problems? Notify [EMAIL PROTECTED] -
JESS: A modest proposal
Hi Folks, I've been thinking about future plans for Jess. One quite modest change with perhaps far-reaching results is the following: what if fact-ids didn't change when a fact was modified? Then you could have a way to reliably refer to one fact from another, building all sorts of interesting data structures. This is a frequently-requested feature. (shopping-cart (items 2 7 6 3 9)) (item (type eggs)) ;; fact-2 (item (type milk)) ;; fact-7 ... etc. In fact, if fact-id's didn't change, I can think of lots of internal optimizations that could make Jess even faster. One is that RU.FACT_ID values could contain a reference to the Fact object itself, saving many lookups. In fact, the separate representation of a fact-id as an int could go away entirely: an RU.FACT_ID could simply call getFactId() on the embedded Fact. Anyway, it turns out this is very easy to do. Only one routine in Jess actually cares if the fact-ids change, and it is easily modified to not care. This will, however, break some CLIPS code which depends on fact-ids having specific values. Such code has always struck me as nasty, anyway, but I'm not sure how much of it exists. Is it important to keep CLIPS compatibility here? (I think not - there is much to gain and little to lose.) Opinions, please! Some other fact-related changes: currently all deftemplates, ordered and unordered, inherit from a deftemplate __fact with no slots. This isn't very useful. It could be much more useful if it were changed a little. For instance, what if __fact had a slot (id) which contained the fact-id? Then you could eaily find a fact with a given ID. What if __fact had a slot (head) which contained the "head" or name of the fact. Then you could find all facts of a given type, with the type being runtime data. What if __fact were the parent of deftemplates __ordered, which was the parent of all ordered deftemplates, and the slot 'data' that all ordered deftemplates have were moved up to the parent? Then you could find any ordered fact containing a given datum, regardless of head. I think all of these would be more or less transparent to existing code, but the features would be available. Again, opinions and suggestions are invited. - Ernest Friedman-Hill Distributed Systems ResearchPhone: (925) 294-2154 Sandia National LabsFAX: (925) 294-2234 Org. 8920, MS 9012 [EMAIL PROTECTED] PO Box 969 http://herzberg.ca.sandia.gov Livermore, CA 94550 - To unsubscribe, send the words 'unsubscribe jess-users [EMAIL PROTECTED]' in the BODY of a message to [EMAIL PROTECTED], NOT to the list (use your own address!) List problems? Notify [EMAIL PROTECTED] -
Re: JESS: Jess 6.0
I think Erwan Tranvouez wrote: > Hi, > > I have been using Jess for quite a while and regretted the > performance issue due, i presume, to Java rather than Jess itself. Note that for "big" problems, Jess is often faster than CLIPS, sometimes by quite a lot. > > Therefore I support any performance improvement :-). > Anyway, I do not understand the point in modifying the fact-id unless if the > jess engine relies on it to re-check its rules network when a fact > is modified. Is this an implementation issue or else ... Jess has always done this simply because CLIPS does. Because of the way multifield matching is handled, Jess can't use ID comparisons to test for fact identity internally, so there's no reason for it at all except that that's the way it's always been. > > Speaking of version compatibility, could anyone tell me if important changes > occured in defining userpackage between Jess44 and Jess5... I looked > in the history version but haven't found reference to any problem with it > (I may have overlooked it...). Jess's Java interfaces changed dramatically between versions 4 and 5. The Userfunction and Userpackage interfaces themselves even changed, so old Userfunctions will not load. You'll need to look at all your code and make some changes - after reading manual chapters 4 and 5. - Ernest Friedman-Hill Distributed Systems ResearchPhone: (925) 294-2154 Sandia National LabsFAX: (925) 294-2234 Org. 8920, MS 9012 [EMAIL PROTECTED] PO Box 969 http://herzberg.ca.sandia.gov Livermore, CA 94550 - To unsubscribe, send the words 'unsubscribe jess-users [EMAIL PROTECTED]' in the BODY of a message to [EMAIL PROTECTED], NOT to the list (use your own address!) List problems? Notify [EMAIL PROTECTED] -
Re: JESS: A modest proposal
Note that (allowed-values) will probably be supported soon. I've realized there's another nice optimization that this modifier will allow. I think Richard Long wrote: > EZ-Xpert currently generates CLIPS files which are incompatable with JESS due to the > use of an (allowed-values ...) modifier and the use of (type SYMBOL) instead of >(type ATOM) within deftemplates. I simply remove the modifier and replace the type >using a simple script, and they seem to work just fine. Dr. Friedman-Hill's proposed >changes will be of great use, and would not appear to break any CLIPS code generated >by this particular utility. > BTW, I think that I've convinced the author of EZ-Xpert to support JESS directly in >the next official release :-) > - Ernest Friedman-Hill Distributed Systems ResearchPhone: (925) 294-2154 Sandia National LabsFAX: (925) 294-2234 Org. 8920, MS 9012 [EMAIL PROTECTED] PO Box 969 http://herzberg.ca.sandia.gov Livermore, CA 94550 - To unsubscribe, send the words 'unsubscribe jess-users [EMAIL PROTECTED]' in the BODY of a message to [EMAIL PROTECTED], NOT to the list (use your own address!) List problems? Notify [EMAIL PROTECTED] -
Re: JESS: A modest proposal
I think Rudolph George-P27574 wrote: > > One theoretical question is what are the intended semantics of modifying an > existing fact? > Is it a new fact (with a new id), or the same fact (with the same id)? I think by far most new users expect it to be the same fact, and the fact that the id currently changes is jarring to them. This would absolutely be a more "object-oriented" approach. - Ernest Friedman-Hill Distributed Systems ResearchPhone: (925) 294-2154 Sandia National LabsFAX: (925) 294-2234 Org. 8920, MS 9012 [EMAIL PROTECTED] PO Box 969 http://herzberg.ca.sandia.gov Livermore, CA 94550 - To unsubscribe, send the words 'unsubscribe jess-users [EMAIL PROTECTED]' in the BODY of a message to [EMAIL PROTECTED], NOT to the list (use your own address!) List problems? Notify [EMAIL PROTECTED] -
Re: JESS: deftemplate documentation
Although the difference probably seems academic to everyone but me, deftemplate is not a function, it is a construct. Constructs are part of the language, and functions are not. Therefore constructs are documented in chapter 2 (section 2.7.2,) while functions are in chapter 7. The physical difference is that there's a Userfunction class that implements defclass, and another for definstance - but the deftemplate "command" is implemented in the parser. I think Alan Moore wrote: [Charset iso-8859-1 unsupported, filtering to ASCII...] > Where did it go? I searched the jess function list in the manual but only > defclass and definstance refer to it in passing. > > alan - Ernest Friedman-Hill Distributed Systems ResearchPhone: (925) 294-2154 Sandia National LabsFAX: (925) 294-2234 Org. 8920, MS 9012 [EMAIL PROTECTED] PO Box 969 http://herzberg.ca.sandia.gov Livermore, CA 94550 - To unsubscribe, send the words 'unsubscribe jess-users [EMAIL PROTECTED]' in the BODY of a message to [EMAIL PROTECTED], NOT to the list (use your own address!) List problems? Notify [EMAIL PROTECTED] -
Re: JESS: loading .clp files from a jar
This was -supposed- to work, but I'm not sure I ever tested it (you all know I'm not much in favor of applets.) It looks like this support is slightly broken. With a few modifications to jess.Batch, though, it works as intended. Here's a fixed version of that class (in Funcall.java) class Batch implements Userfunction, Serializable { public String getName() { return "batch";} public Value call(ValueVector vv, Context context) throws JessException { String filename = vv.get(1).stringValue(context); Value v = Funcall.FALSE; Reader fis = null; try { try { if (context.getEngine().getApplet() == null) fis = new FileReader(filename); else { URL url = new URL(context.getEngine().getApplet().getDocumentBase(), vv.get(1).stringValue(context)); fis = new InputStreamReader(url.openStream()); } } catch (Exception e) { // Try to find a resource file, too. InputStream is = getClass().getClassLoader().getResource(filename).openStream(); if (is == null) throw new JessException("batch", "Cannot open file", e); fis = new InputStreamReader(is); } Jesp j = new Jesp(fis, context.getEngine()); do { v = j.parse(false); } while (fis.ready()); } catch (Exception ex) { throw new JessException("batch", "I/O Exception", ex); } finally { if (fis != null) try { fis.close(); } catch (IOException ioe) {} } return v; } } I think Javier Maria Torres Ramon wrote: > Hi, > > I wanted to know if JESS gets .clp from a jar file in case it is started from > an applet, and Rete (Applet applet) is called as a constructor. > > Thanks and greetings, > > Javier Torres > - > 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 Distributed Systems ResearchPhone: (925) 294-2154 Sandia National LabsFAX: (925) 294-2234 Org. 8920, MS 9012 [EMAIL PROTECTED] PO Box 969 http://herzberg.ca.sandia.gov Livermore, CA 94550 - To unsubscribe, send the words 'unsubscribe jess-users [EMAIL PROTECTED]' in the BODY of a message to [EMAIL PROTECTED], NOT to the list (use your own address!) List problems? Notify [EMAIL PROTECTED] -
Re: JESS: A modest proposal
I think Alan Moore wrote: > > > In fact, if fact-id's didn't change... > > [alan] > I plead ignorance here, but how does this affect activation? I presume > existing agenda items that were activated with the old "version" of the > fact(s) they matched on would have their patterns re-evaluated as before. > Newly matched patterns would also activate. The proposed changes change absolutely nothing about how Jess operates; fact-ids have always been just window-dressing. > > How would I recognize a rule(s) that depended on the fact-id changing? Would > they have to have explicit use of fact-ids such as stashing them in other > facts, etc.? Yes. It's currently possible (in Jess and CLIPS) to literally write things like (reset) (assert (foo (bar 1))) (modify 1 (bar 2)) (retract 2) This code would break under the proposed changes - the fact-id of the foo fact after the modify is assumed here to have been incremented to 2, when now it would remain at 1. > > [alan] > If the change isolated, could it not be configured via a compatibility > switch? > > Sorry, I had to ask D-; No, this is a good question. The change is easy to make in the current code base, and there could indeed be a compatibility switch. BUT, maintaining the compatibility option might constrain me from taking advantage of the optimization opportunities. > > > Some other fact-related changes: currently all deftemplates, ordered > > and unordered, inherit from a deftemplate __fact with no slots. This > > isn't very useful. It could be much more useful if it were changed a > > little. For instance, what if __fact had a slot (id) which contained > > the fact-id? Then you could eaily find a fact with a given ID. > > [alan] > Since defclass is-a deftemplate is-a fact (?), would the id slot for > definstances be the object reference, possibly redundant with the OBJECT > slot? > > (defrule find-object > ?this <- (type (slot1 ?value1) (slot2 ?value2)) > (looking-for ?this) > => > (call ?this method) > (assert (found ?this)) > ) > > The id namespaces are different so I don't think this would be possible > unless facts were changed to use the underlying references as their id's. > The fact that this is not currently possible has surprised some users. I think it would be nice if this worked. > > > > What if __fact had a slot (head) which contained the "head" or name of > > the fact. Then you could find all facts of a given type, with the type > > being runtime data. > > [alan] > Does this mean I could somehow distinguish between multiple definstances of > the same object reference. For example, given an object instance A that > implements interfacesX and interfaceY, I would like to "definterface" the X > and Y interfaces separately like so: > > (import interfaceX) > (import interfaceY) > > (deffunction doit (?x ?y) > (definstance ?x (head interfaceX.class.toString()) > (definstance ?y (head interfaceY.class.toString()) > ) > > I would like to be able to write rules that work with interfaces and that do > not depend on (or in addition to) the underlying object identity? No, the proposed changes don't do anything to help this dilemna, which we've discussed in the past. > > > What if __fact were the parent of deftemplates __ordered, which was > > the parent of all ordered deftemplates, and the slot 'data' that all > > ordered deftemplates have were moved up to the parent? Then you could > > find any ordered fact containing a given datum, regardless of head. > > [alan] > Could you give a concrete example of how an existing rule could be rewritten > to exploit these changes or how something that is not currently possible > could be accomplished? Well, one simple one is something like this, which retracts all facts of a given type, with the type being runtime data: (defrule retract-named-facts (retract-facts ?head) ?id <- (?head) => (retract ?id)) > > In any case, it sounds useful to me... > > > I think all of these would be more or less transparent to existing > > code, but the features would be available. Again, opinions and > > suggestions are invited. > > [alan] > Are stupid questions ok? > - > 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 Distributed Systems ResearchPhone: (925) 294-2154 Sandia National LabsFAX: (925) 294-2234 Org. 8920, MS 9012 [EMAIL PROTECTED] PO Box 969 http://herzberg.ca.sandia.gov Livermore, CA 94550 - To unsubscribe, send the words 'unsubscribe jess-
Re: JESS: Jess 6.0
I think Philip Jackson wrote: > [EMAIL PROTECTED] wrote: > > > > Note that for "big" problems, Jess is often faster than CLIPS, > > sometimes by quite a lot. > > This is very interesting. Is there any documentation of when Jess is more > efficient? It would be helpful to know for specific tasks. Well, we've discussed this before (you might want to check the archives at [EMAIL PROTECTED]) but most of the performance gain comes from two things: first, Jess is very smart about indexing the partial matches held in its Rete memories. It will choose different kinds of indexes depending on the tests that will be done at each node, to optimize access. Second, because the matches are organized in this way, Jess can skip lots of pattern-matching tests; i.e., if there's a slot pattern (foo ?X) and ?X is "red" for one particular input, and if Jess has chosen to index the appropriate node on this slot, then it doesn't need to test the colors of most partial matches - it can automatically discard all those that aren't in the "red" bin of the index. This algorithm shines on some of Daniel Miranker's benchmarks, where Jess has performed ten times faster (or more) than CLIPS for the largest problem sizes. > > > > Therefore I support any performance improvement :-). > > What kind of performance improvement does the proposed change yield? Does it > improve performance linearly, quadratically, exponentially? If the gain is > only a small linear constant (e.g. < 1.5) then it may not be worthwhile. The problem with talking about Jess and performance is that every rulebase is different. Some are dominated by pattern matching, and some by RHS execution. Some pattern-matching problems have a small number of partial matches, and some a large number. Some use many facts, some only a few. The potential improvements we're talking about here will be most noticeable for problems with few partial matches but many, many facts. In this case, the problem running time could be proportional to the number of facts, and the improvements could change it to a constant-time problem - a dramatic improvement in some cases. > > Since the change appears easy to implement, would it be possible to include > a "software switch" that would allow end-users to turn the change on or off, > so that an end-user could choose compatibility with CLIPS if necessary and > sacrifice the performance gain? As I said in another message, the change is easy to do, but keeping backwards compatibility as an option will constrain the optimization potential. > An area where I'd be interested in seeing compatibility sacrificed (though > ideally still in an upward-compatible way with CLIPS) is in providing more > object-oriented pattern-matching. I understand fact-ids are a step in that > direction -- What I'd like to see is matching objects, not just facts, and > even matching across structures of objects, e.g. matching with > "dot-chaining" across objects and attributes, e.g. something like > ?foo.fie.fum = ?bar.baz, etc. (Maybe this is already supported and I just > don't know it yet... I'm still a newbie to Jess...) Well, matching objects -is- supported, as described in the manual. Many people are currently using this feature. More comfortable syntax is somethig I'd like to see too. One possility I've been wondering about is offering multiple alternative parsers on top of the common engine - i.e., a CLIPS-compatible parser, a Java-like parser, etc. A less radical option is to try to support a dotted notation for member access and function calls, as several people have asked for it. It does complicate things, though. I know there's at least one user who wanted to use IP address atoms like 123.44.23.123, and so I specifically has to make Jess support dots as part of symbols (as CLIPS does.) > > Cheers, > > Phil Jackson - Ernest Friedman-Hill Distributed Systems ResearchPhone: (925) 294-2154 Sandia National LabsFAX: (925) 294-2234 Org. 8920, MS 9012 [EMAIL PROTECTED] PO Box 969 http://herzberg.ca.sandia.gov Livermore, CA 94550 - To unsubscribe, send the words 'unsubscribe jess-users [EMAIL PROTECTED]' in the BODY of a message to [EMAIL PROTECTED], NOT to the list (use your own address!) List problems? Notify [EMAIL PROTECTED] -
Re: JESS: A question about Rete object.
If the rules always store something, and you're finding nothing stored on a particular iteration, then the logical conclusion is that the rules didn't fire on that iteration. I would issue a "(watch all)" command at the beginning of your program, and then examine the output to find out what rules are firing, or not. Look at the trace of shadow-facts being added and removed to see if the preconditions for a particular rule exist when you think they do. Most likely it's a bug in one of your rules. And yes, of course you can call assert() and retract() as needed. I think Calicrates Policroniades Borraz wrote: > > Hi I'm building an application wich main() is in Java and that loads in > runtime an script of Jess in a Rete object. Some beans are passed as facts > to rete in this way: > > for(int i=0;iobjInMemory = myMemory.recoverObject(i); >f = new Funcall("definstance", rete); >f.add(new Value("element", RU.ATOM)); >f.add(new Value(objInMemory)); >f.execute(rete.getGlobalContext()); > } > > Immediatly after this the program executes: > > rete.run(); > > Some rules are fired and the results are recovered using store and > fetch commands. Finally the program clear the facts and storage in this > way: > >rete.executeCommand("(undefinstance *)"); >rete.clearStorage(); > > The program executes several times the previous part of code until a > variable don't be true. The program begins running perfectly but in some > part, with apparently no reason, the rete object seems to be dead because > I don't recover nothing in the storage, the rules in the script are simple > and are fixed to always return something in the storage (indeed with the > idea of check it I only have 6 simple rules in the script without > chaining). I am sure that I'm not losing the reference of the rete object. > Am I doing something bad in the code showed previously? or Do you have any > idea or suggestion about what is happening? > > On the other hand, Is it valid to use assert and retract commands in the > script and in the java program? For example, taking as base the previous > code, after the run method I retract and assert some facts according with > the results obtained in the storage. I dont think that this have problems > but I'm not sure... > > Thank you very much... > > Calicrates... > > - > 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 Distributed Systems ResearchPhone: (925) 294-2154 Sandia National LabsFAX: (925) 294-2234 Org. 8920, MS 9012 [EMAIL PROTECTED] PO Box 969 http://herzberg.ca.sandia.gov Livermore, CA 94550 - To unsubscribe, send the words 'unsubscribe jess-users [EMAIL PROTECTED]' in the BODY of a message to [EMAIL PROTECTED], NOT to the list (use your own address!) List problems? Notify [EMAIL PROTECTED] -
Re: JESS: [Modifying facts in deffunction]
Hi, There's no neat way to do what you're asking about (at least not in the current versions of Jess.) What you could do, though, is use Beans instead of facts. Keep a reference to the Bean available someplace, and have the item-listener change the properties of the Bean. If the Bean is definstanced, then it will be available for matching by rules just as the current facts are -- the rules would likely not need to be changed. I think sintes wrote: [Charset ISO-8859-1 unsupported, filtering to ASCII...] > Hi all ! > > I'd like to know how to get a fact-id in a > function. I create a GUI with awt objects, > I add listeners to those objects and when > something happens, I'd like to modify the > fact involved in the control. > > Here is my sample > > (deffact act (action no)) > ... > > > (defrule foo > ... > ?ac <- (action yes) > => > ...) > > ... > > (deffunction itemlistener (?event) > > ;;I dunno how to modify the fact action, as > I dunno how to get the fact-id > > ?bar<-(action no) ;;? > (modify ?bar (action yes)) ;;? > ) > > Thank you, > > Bruno SINTES - Ernest Friedman-Hill Distributed Systems ResearchPhone: (925) 294-2154 Sandia National LabsFAX: (925) 294-2234 Org. 8920, MS 9012 [EMAIL PROTECTED] PO Box 969 http://herzberg.ca.sandia.gov Livermore, CA 94550 - To unsubscribe, send the words 'unsubscribe jess-users [EMAIL PROTECTED]' in the BODY of a message to [EMAIL PROTECTED], NOT to the list (use your own address!) List problems? Notify [EMAIL PROTECTED] -
Re: JESS: Forwarded mail....
;; Can you do do something like this? Each firing of ;; calculate-center-of-gravity increments ?n in partial result and ;; adds in some more data. report-center-of-gravity then finishes the ;; calculation up. If this doesn't quite work, I'm sure there's a ;; slight variation that would. To kick off a calculation, you assert ;; (entities 1 2 3 5 7) and (partial-result 0 0 0 ). (defrule calculate-center-of-gravity (entities $? ?one-entity-id $?) (entity (id ?one-entity-id) (X ?x1) (Y ?y1)) ?p <- (partial-result ?n ?x ?y) => ;; update partial-result by accumulating one more entity) (defrule report-center-of-gravity (declare (salience -1)) ?p <- (partial-result ?n ?x ?y) ?c <- (entities) => (retract ?p ?c) (assert (result (calculate-final-result ?n ?x ?y I think Neeraj - Khandelwal wrote: > > > > I need to calculate the center of mass (an average of all their positions) > for some number n of entities. I have a template of the form > (ENTITY(ID)(X)(Y)). How can I write a rule to calculate it without having to > hardcode every entity into the left side of the rule? This is not possible > because entities may be added or deleted and I can't write a rule for every > combination of entities. The other idea I had was to keep a field in the > template and mark it as each entity is figured into the calculation. Once > the calculation is complete, reset all those fields for the next time. I am > sure there is a better way to go about this. Any help? > > Keith. > - Ernest Friedman-Hill Distributed Systems ResearchPhone: (925) 294-2154 Sandia National LabsFAX: (925) 294-2234 Org. 8920, MS 9012 [EMAIL PROTECTED] PO Box 969 http://herzberg.ca.sandia.gov Livermore, CA 94550 - To unsubscribe, send the words 'unsubscribe jess-users [EMAIL PROTECTED]' in the BODY of a message to [EMAIL PROTECTED], NOT to the list (use your own address!) List problems? Notify [EMAIL PROTECTED] -
Re: JESS: New Strategy implementation ...and a rather long mail
Hi, First of all, let me say that the order in which rules fire has indeed changed between Jess 4.4 and the default "depth" strategy in Jess 5.0. The new ordering is the one that is considered "correct" by most production-system researchers. The "breadth" strategy, by definition, will never fire "old" activations as long as there are newer ones on the agenda; since you're writing rules that deliberately keep generating new activations, the breadth strategy is not a good choice and you should stick with the default. Now. As far as agents with time-dependent behavior: this is something I do all the time. There are two major strategies, which I'll describe here. The first one is from the FAQ. In this first strategy, all the agents are in one process, and you have rules that explicitly depend on time. In this case you need an "idle' rule, something like ;; ;; This fact will be used to sleep when idle (deffacts idle-fact (time 0)) ;; ;; This rule will always be on the agenda! Make the salience ;; lower than any other rule. (defrule sleep-if-bored (declare (salience -100)) ?idle <- (time ?) => (retract ?idle) (call java.lang.Thread sleep 100) (assert (time (time The rule "sleep-if-bored" is like a clock, which keeps a single fact (time ?t) on the fact-list all the time. Rules with time dependence just need to match on this fact: (defrule initiate-future-action (some-condition) (time ?t) => (assert (fire-now (+ ?t 20 (defrule execute-future-action (time ?t1) ?f<- (fire-now ?t2&:(>= ?t2 ?t1)) => (retract ?f) (printout t "It's 20 seconds later!" crlf)) The second rule will fire roughly 20 seconds after the first. That's the first scheme. In the second scheme, the time-dependent activities happen outside of Jess - i.e., in Java. This is a good strategy if the agents are separate Java processes communicating on a network; messages are received in a background thread and asserted from those background threads. Then all you need is to keep the engine running all the time. In this case, simply use (run-until-halt) instead of (run). This function will sleep when there are no activations instead of returning; it will wake up automatically when any new facts are asserted that activate rules. I could mention a third scheme in which separate Threads are used but in which all the code is written in Jess. I've got a utility class JessThread which I use for my own work that looks like this: package gov.sandia.eiagent.jess; import jess.*; /** * Lets you write the run() method of a Thread in Jess. */ public class JessThread extends Thread { private String m_name; private Rete m_engine; public JessThread(String routineName, Rete engine) { m_name = routineName; m_engine = engine; } public void run() { try { Funcall f = new Funcall(m_name, m_engine); f.execute(m_engine.getGlobalContext()); } catch (JessException je) { System.out.println("Exception in background thread: " + je); if (je.getNextException() != null) System.out.println(je.getNextException()); } } } You can use this like this: (deffunction run-in-thread() (something-interesting)) (call (new gov.sandia.eiagent.jess.JessThread run-in-thread (engine)) start) (run-until-halt) Now if the function (something-interesting) asserts a fact, it can cause the main thread to wake up and fire some rules. You can run any number of Threads at once, of course. In any event, these techniques should cover pretty much every situation. An "official" version of JessThread (or something like it) will appear in a future release. I think Erwan Tranvouez wrote: > Hi, > > I'm using Jess 5.0 and I have some problems with the rules activations. > > I am programming intelligent (cooperatiNG) Agents in/with Jess. For the > moment, an agent is a jess Console "batching" some behaviours Jess files. > > -- > REQUISIT : > -- > > Therefore I need a rule for : > 1) assuring at least one rule is active (minimal behaviour) > 2) checking REGULARLY if there is some message in one's agent Mailbox > 3) enforce REGULARLY some (test ) value based on time. For exemple if I > want my agent > to wait for 20 seconds for new messages WITHOUT blocking the other rules > firing. > > Using strategy breadth enabling a "multi-tasking" rule behaviour... and > avoiding > > -- > CONTEXT : > -- > > > Therefore I used a rule as follows: > > (defrule cycle > ?f <- (cycle ?num) > => > (retract ?f) > (if < check for message > > then > (assert (message ) ) > ) ; end if > (assert (boucle (+ ?num 1) ) ) ; ?num used for debuging ... > ) > > Alas, depending on when the rules is loaded, rules depending on (cycle ?) > to enforce some test (mostly temporal) (test ) where > d
Re: JESS: Debugging Jess matches
First, read Chapter 8 of the manual (The Rete Algorithm.) This chapter describes how rules are transformed into a network of pattern-matching nodes. What 'matches' shows you are the cumulative fact-lists that have been sent to the left and right inputs of each node in the join part of the network. Second, do a (ppdefrule ) to make sure you know how Jess has transformed your rule, if at all. Sometimes things are changed in various ways. Now. In the (matches) output, you'll see one clump of output for each join node. There are N-1 joins, where N is the number of patterns you saw in step 2. The joins are shown in top-to-bottom order, such that the first join displayed joins the first pattern and the second, while the second one joins the second and third patterns, etc. Each [Token] represents one input that a join has received. The tokens in the right memory are always one fact in length, while those on the left are n facts long, where n is the 1-based index of the join. The tokens in the left memory of join n+1 imply the outcome of tests done in join n; i.e., if you see two facts together in a left memory, that means that any tests that compared them in the previous join must have passed. A brief example: say you define this rule: Jess> (defrule sample (fact ?x ?y) (data ?x ?y) (exec) => ) TRUE And assert these facts Jess> (assert (fact 1 2) (data 1 2) (fact 3 4) (data 1 4)) Then this is what (matches sample) shows: -- Jess> (matches sample) [Node2 ntests=2 [Test2Multi: test=EQ;tokenIdx=0;leftIdx=0;leftSubIdx=0;rightIdx=0;rightSubIdx=0] [Test2Multi:test=EQ;tokenIdx=0;leftIdx=0;leftSubIdx=1;rightIdx=0;rightSubIdx=1] ;usecount = 1;unique = false] Left Memory: [Token: size=1;sortcode=0;tag=UPDATE;negcnt=0;facts=(fact 1 2);] [Token: size=1;sortcode=2;tag=UPDATE;negcnt=0;facts=(fact 3 4);] RightMemory: [Token: size=1;sortcode=1;tag=UPDATE;negcnt=0;facts=(data 1 2);] [Token: size=1;sortcode=3;tag=UPDATE;negcnt=0;facts=(data 1 4);] [Node2 ntests=0 ;usecount = 1;unique = false] Left Memory: [Token: size=2;sortcode=1;tag=UPDATE;negcnt=0;facts=(fact 1 2);(data 1 2);] RightMemory: TRUE -- The first Node2 shown joins the first two patterns. It has several "Test2Multi" tests - these compare the identity of specific data between two multislots (recall that ordered facts are implemented as unordered facts with one multislot named _data.) These tests assure that any tokens sent "out the bottom" of this join into the next join will have the requisite matching fields. In this first join, as expected, you see all the (fact) slots in the left memory, and all the (data) slots in the right. Additional tests might have pruned this - tests that can be done on a single fact are done in the pattern network, which has no memory and therefore is not shown here. In the second Node2, we see that of the four possible combinations of one (fact) and one (data) fact, only a single Token was sent to the left input. This token contains the only two facts for which the previous join's tests both pass: (fact 1 2) + (data 1 2). So, obviously there are many additional details, but there's the basic idea. You can tell if something got stuck in the pattern network by seeing whether it appears in the appropriate "first" memory, and you can see if joins succeed by looking in the "next" memory. Note that the (view) command, which now takes a rule name as an optional argument, is a good way to visualize how the network fits together. You can see the same information, plus more, by double-clicking on the nodes that make up a rule. I think Ryan Eberhard wrote: > Has anyone used "(matches )" to try and debug a Jess rule set? > > In particular, I have a rule that I think should be active, but it is not. > When I executed the matches command, I received the appropriately described, > "ugly", printout. Does anyone know how to parse the meaning of the left and > right memory displays to find the prediate that is not satisfied? > > Thanks in advance, > Ryan Eberhard > Gradient Technologies - Ernest Friedman-Hill Distributed Systems ResearchPhone: (925) 294-2154 Sandia National LabsFAX: (925) 294-2234 Org. 8920, MS 9012 [EMAIL PROTECTED] PO Box 969 http://herzberg.ca.sandia.gov Livermore, CA 94550 - To unsubscribe, send the words 'unsubscribe jess-users [EMAIL PROTECTED]' in the BODY of a message to [EMAIL PROTECTED], NOT to the list (use your own address!) List problems? Notify [EMAIL PROTECTED] -
Re: JESS: Debugging Jess matches
I think Erwan Tranvouez wrote: > > Remark: > > Strange enough, matches always return true!! Wouldn't it be better to have > true > only when the conditions are met? > > Erwan > If you're talking about the return values from Node2/NodeNot2.runTestsVaryRight/Left: the fact that these return anything at all is an artifact from an earlier stage of Jess's evolution. The return values are all ignored now, so the values don't really matter. In this specific case, though, it's not clear what they should have been. Should the call return true if there are any matches at all, since any given input will be compared to an arbitrary number of tokens in the opposite memory? Should it return true only if there are no failed matches? In any case, it's not clear of what value this datum would be. It's likely that a future refactoring will remove these return values altogether and make the methods return void. - Ernest Friedman-Hill Distributed Systems ResearchPhone: (925) 294-2154 Sandia National LabsFAX: (925) 294-2234 Org. 8920, MS 9012 [EMAIL PROTECTED] PO Box 969 http://herzberg.ca.sandia.gov Livermore, CA 94550 - To unsubscribe, send the words 'unsubscribe jess-users [EMAIL PROTECTED]' in the BODY of a message to [EMAIL PROTECTED], NOT to the list (use your own address!) List problems? Notify [EMAIL PROTECTED] -
Re: JESS: A question about the knowledge base and rules..
Hi, I just tried this on a simple Bean and I did not observe the problem you're reporting (nor did I expect to.) A transcript is below. If you can reproduce the problem in a similar transcript, please send it along - you may have found a bug. But make sure that it's not something else - for instance, the "not" wont trigger if you retract the (initial-fact). -- c:/users/root/jess5> cat Bean.java public class Bean { public String getName() { return "Fred"; } } c:/users/root/jess5> java jess.Main Jess, the Java Expert System Shell Copyright (C) 1998 E.J. Friedman Hill and the Sandia Corporation Jess Version 5.0 1/28/2000 Jess> (defclass bean Bean) Bean Jess> (bind ?bean (new Bean)) Jess> (definstance bean ?bean static) Jess> (watch rules) TRUE Jess> (defrule test-rule (bean (name "Fred")) =>) TRUE Jess> (run) FIRE 1 test-rule f-0 1 Jess> (undefinstance *) TRUE Jess> (definstance bean ?bean static) Jess> (run) FIRE 1 test-rule f-1 1 Jess> -- I think Calicrates Policroniades Borraz wrote: > > Hi, I have a simple question. > > If I have the next simple rule in a script: > > (defrule I-cant-see-the-object >(not (element (name "object"))) >=> >(assert (no_object)) > ) > > where element is a bean that comes from a Java program and name is a slot. > > I clear the kb of elements with rete.executeCommand("(undefinstance *)") > If the previous rule is fired once, it will not be fired again because the > element wich name is "object" has fired the rule even though I had > cleared the kb of elements. I mean, If I include a new element with name > "object" it won't fire the rule. I suppouse that Jess takes the new income > as if were the one that fired the rule previously. > > I understand this property with simple asserted facts (because support > the refraction property of an expert system), but it's not clear for me > why a bean that has bean removed with undefinstance and included again in > the kb is not recognized by the rule as a new fact. > > How can I activate the rule with the new income that comes in the shape > of a bean without Jess thinks that is the same fact? > > Thank you in advance... > > Calicrates. > > - > 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 Distributed Systems ResearchPhone: (925) 294-2154 Sandia National LabsFAX: (925) 294-2234 Org. 8920, MS 9012 [EMAIL PROTECTED] PO Box 969 http://herzberg.ca.sandia.gov Livermore, CA 94550 - To unsubscribe, send the words 'unsubscribe jess-users [EMAIL PROTECTED]' in the BODY of a message to [EMAIL PROTECTED], NOT to the list (use your own address!) List problems? Notify [EMAIL PROTECTED] -
Re: JESS: when can we have release6 functionality
Expect to see a version 6 "pre-alpha" release soon - sometime this month, I think. I think Ashraf Afifi wrote: > > > Hi, > > You announced the possibility of not changing the fact number when we > modify it. What is the time frame for having the change. If not soon, can you > guide us on how to batch 5.0 to get that functionality? > > regards > > Ashraf Afifi > - Ernest Friedman-Hill Distributed Systems ResearchPhone: (925) 294-2154 Sandia National LabsFAX: (925) 294-2234 Org. 8920, MS 9012 [EMAIL PROTECTED] PO Box 969 http://herzberg.ca.sandia.gov Livermore, CA 94550 - To unsubscribe, send the words 'unsubscribe jess-users [EMAIL PROTECTED]' in the BODY of a message to [EMAIL PROTECTED], NOT to the list (use your own address!) List problems? Notify [EMAIL PROTECTED] -
Re: JESS: when can we have release6 functionality
Folks, Do NOT use this function. It changes a Fact object when it is installed deep in Jess's innards, which is a big no-no! While this may work in some (very limited) sitations, it will generally lead to rules not firing when they should, firing when they shouldn't, or to Jess crashing. As I said, proper modifications to allow modifying facts without changing fact-IDs will be made available shortly. I think Ru wrote: [Charset ISO-8859-1 unsupported, filtering to ASCII...] > I send you a userfunction "modify-slot" with a same signature as of > intrinsic > "modify" , but it changes only slot(s) and does'nt change fact itself (and > its ID). > Ru - Ernest Friedman-Hill Distributed Systems ResearchPhone: (925) 294-2154 Sandia National LabsFAX: (925) 294-2234 Org. 8920, MS 9012 [EMAIL PROTECTED] PO Box 969 http://herzberg.ca.sandia.gov Livermore, CA 94550 - To unsubscribe, send the words 'unsubscribe jess-users [EMAIL PROTECTED]' in the BODY of a message to [EMAIL PROTECTED], NOT to the list (use your own address!) List problems? Notify [EMAIL PROTECTED] -
Re: JESS: defmodule
I think Ashraf Afifi wrote: > > > Hi, > > Does jess has an equivalent to clips's defmodule construct. If not, do we have a > workaround to group rule sets. There aren't modules - this was on the 5.0 wish list, and will likely be on the 6.0 to-do list. Barring modules, you can use multiple separate Rete objects in one process, each with its own rule set. You would need to write a few functions like "broadcast-assert" and "broadcast-retract" to keep the knowledge bases in sync. I know this has been done more than once by users. > > Thanks > > Ashraf Afifi > > > > > - > 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 Distributed Systems ResearchPhone: (925) 294-2154 Sandia National LabsFAX: (925) 294-2234 Org. 8920, MS 9012 [EMAIL PROTECTED] PO Box 969 http://herzberg.ca.sandia.gov Livermore, CA 94550 - To unsubscribe, send the words 'unsubscribe jess-users [EMAIL PROTECTED]' in the BODY of a message to [EMAIL PROTECTED], NOT to the list (use your own address!) List problems? Notify [EMAIL PROTECTED] -
Re: JESS: errout
Well, there's WSTDERR, which Jess uses to print error messages to. By default, it's attached to System.out, but if you want it to go to System.err, (or for that matter, if you want to create a new router that goes to System.err) just do something like (call (engine) addOutputRouter "WSTDERR" (new java.io.PrintWriter (get-member System err))) You can change WSTDERR to any other name if you want to create a new router instead of redirecting WSTDERR. I think Gyhra, Norman (Student Assistant) wrote: > Are there any plans to implement an errout router identifier for the > printout function ? - Ernest Friedman-Hill Distributed Systems ResearchPhone: (925) 294-2154 Sandia National LabsFAX: (925) 294-2234 Org. 8920, MS 9012 [EMAIL PROTECTED] PO Box 969 http://herzberg.ca.sandia.gov Livermore, CA 94550 - To unsubscribe, send the words 'unsubscribe jess-users [EMAIL PROTECTED]' in the BODY of a message to [EMAIL PROTECTED], NOT to the list (use your own address!) List problems? Notify [EMAIL PROTECTED] -
Re: JESS: global file handles
Hi Norman, Not sure where you got this idea; once you open a file, it simply stays open, and accessible by the assigned name, until it is closed somewhere. You can open a file at the beginning of your application and never close it at all, if you want; then any rule can write to it. I think Gyhra, Norman (Student Assistant) wrote: > Hi there ! > > I_m looking for a possibility to have some sort of global file handles in > Jess. > I_d like to open a file before starting the Rete engine and have several > rules write > some stuff in it. > > Do I really have to open and close the file each time I_m going to print out > something ? > > thanks in advance. > > CU > Norman - Ernest Friedman-Hill Distributed Systems ResearchPhone: (925) 294-2154 Sandia National LabsFAX: (925) 294-2234 Org. 8920, MS 9012 [EMAIL PROTECTED] PO Box 969 http://herzberg.ca.sandia.gov Livermore, CA 94550 - To unsubscribe, send the words 'unsubscribe jess-users [EMAIL PROTECTED]' in the BODY of a message to [EMAIL PROTECTED], NOT to the list (use your own address!) List problems? Notify [EMAIL PROTECTED] -
Re: JESS: knoe of a barebones Rete implementation tahe I canuse for an embedded inference engine. Arman.
Rete, because of its intrinsically large and effectively unbounded memory usage, is poorly suited for embedded applications. Given that, CLIPS can be compiled in a minimal configuration that leaves out unnecessary stuff including, I think, the rule compiler (you compile the rules to C code, and link them with this minimal engine.) Of course, there's always the Personal Java platform, with Jess. I've never tried to get Jess running on the KVM (Palm Pilot JVM,) but I do know of someone that had it basically working on a Windows CE palmtop. I think Arman Anwar wrote: > > > > = > > He, > Who is capable of attempting the absurd, > Is capable of achieving the impossible. > > - Ernest Friedman-Hill Distributed Systems ResearchPhone: (925) 294-2154 Sandia National LabsFAX: (925) 294-2234 Org. 8920, MS 9012 [EMAIL PROTECTED] PO Box 969 http://herzberg.ca.sandia.gov Livermore, CA 94550 - To unsubscribe, send the words 'unsubscribe jess-users [EMAIL PROTECTED]' in the BODY of a message to [EMAIL PROTECTED], NOT to the list (use your own address!) List problems? Notify [EMAIL PROTECTED] -
Re: JESS: 1.2.2 compile errors with jess
Hi Bert, -Very- strange! Javac is deciding (for some odd reason) that in some of your source files, but not others, "String" means a (mythical) class named "jess.String". No idea why this is happening for you; something must be wedged, somehow. This sounds like the sort of case where you should unset your CLASSPATH variable, delete all the .class files in jess/, and try again. In any event, JDK 1.2.2 works fine for me, as I suspect it does for many other folks. I think Bert Hinrichs wrote: > The web page says that there are no compiler issues known. I receive > several > method overload errors when using jdk1.2.2 on win32. > > Here is a sample: > [D:/Jess/Jess50] make > d:/java/jdk1.2.2/bin/javac jess\Main.java > .\jess\Deffunction.java:31: The method java.lang.String getName() > declared in cl > ass jess.Deffunction cannot override the method of the same signature > declared i > n interface jess.Userfunction. They must have the same return type. > public final String getName() { return m_name; } > ^ > .\jess\Rete.java:1286: Class jess.String not found in jess.Userfunction > addUserf > unction(jess.Userfunction). > if ((fh = (FunctionHolder) m_functions.get(uf.getName())) != null) > ^ > .\jess\Rete.java:1290: Class jess.String not found in jess.Userfunction > addUserf > unction(jess.Userfunction). > m_functions.put(uf.getName(), fh); >^ > .\jess\Defrule.java:303: The method jess.String toString() declared in > class jes > s.Defrule cannot override the method of the same signature declared in > class jav > a.lang.Object. They must have the same return type. > public String toString() > ^ > .\jess\Activation.java:104: The method jess.String toString() declared > in class > jess.Activation cannot override the method of the same signature > declared in cla > ss java.lang.Object. They must have the same return type. > public String toString() > ^ > .\jess\JessTokenStream.java:153: The method jess.String toString() > declared in c > lass jess.JessTokenStream cannot override the method of the same > signature decla > red in class java.lang.Object. They must have the same return type. > public String toString() > ^ > .\jess\JessToken.java:79: The method jess.String toString() declared in > class je > ss.JessToken cannot override the method of the same signature declared > in class > java.lang.Object. They must have the same return type. > public String toString() > ^ > make: 'jess/Main.class' removed. > > > Am I missing something obvious? jdk1.2.2 seems to work fine with > everything > else I have. > > Thanks > > Bert > > > > > - > 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 Distributed Systems ResearchPhone: (925) 294-2154 Sandia National LabsFAX: (925) 294-2234 Org. 8920, MS 9012 [EMAIL PROTECTED] PO Box 969 http://herzberg.ca.sandia.gov Livermore, CA 94550 - To unsubscribe, send the words 'unsubscribe jess-users [EMAIL PROTECTED]' in the BODY of a message to [EMAIL PROTECTED], NOT to the list (use your own address!) List problems? Notify [EMAIL PROTECTED] -
Re: JESS: How to get the "Intermediate values"
I think Thomas Barnekow wrote: > Readers of the Jess Manual ;-) will recall, that > > (bind ) > > assigns to and returns the given value. Therefore, > you can modify your rule as follows: > > (defrule somerule > ?a <- (aclass (OBJECT ?o)) > (test (< (call (bind ?vector (call ?o getVectorBasedOnSomeConditions 5)) > size) 0)) > => > (printout t "Size = " (call ?vector size) crlf)) > > Hope that helps. > > Thomas Unfortunately, this doesn't work. There's no way to bind a variable on the LHS of a rule that can be accessed from the RHS, except by pattern-matching it. - Ernest Friedman-Hill Distributed Systems ResearchPhone: (925) 294-2154 Sandia National LabsFAX: (925) 294-2234 Org. 8920, MS 9012 [EMAIL PROTECTED] PO Box 969 http://herzberg.ca.sandia.gov Livermore, CA 94550 - To unsubscribe, send the words 'unsubscribe jess-users [EMAIL PROTECTED]' in the BODY of a message to [EMAIL PROTECTED], NOT to the list (use your own address!) List problems? Notify [EMAIL PROTECTED] -
Re: JESS: A problem with the OBJECT slot (?)
I think alan littleford wrote: > I'm using 5.0 (_very_ nice job, Ernest) and I seem to be running into a > problem. I have a java bean -- B, and I defclass it: > (defclass C B dynamic). I then have a user function which creates a > fact, sets some slot values and asserts it: > >f = new Fact("C", engine) >f.setSlotValue(..) >f.setSlotValue(..) >engine.assert(f) > > So fas so good. In a rule set I acquire the fact ID for the asserted > fact. All the slots are there with all the right values except slot > OBJECT, which I thought should be a pointer back to the underlying > instance of B. However, for some reason it is the atom 'nill' > ( I'm accesing it using (fact-slot-value (integer ?fid) OBJECT)). > > Am I doing something obviously wrong? Yes :) You have to use "definstance," not "assert," to attach a Bean to Jess; you also have to create the actual Bean yourself. So create the Bean, set its slots (by calling the Bean's methods) then use definstance to tell Jess about it; Jess will then in turn create the fact (rather than the other way round!) > > Tnx > Alanl > - Ernest Friedman-Hill Distributed Systems ResearchPhone: (925) 294-2154 Sandia National LabsFAX: (925) 294-2234 Org. 8920, MS 9012 [EMAIL PROTECTED] PO Box 969 http://herzberg.ca.sandia.gov Livermore, CA 94550 - To unsubscribe, send the words 'unsubscribe jess-users [EMAIL PROTECTED]' in the BODY of a message to [EMAIL PROTECTED], NOT to the list (use your own address!) List problems? Notify [EMAIL PROTECTED] - - To unsubscribe, send the words 'unsubscribe jess-users [EMAIL PROTECTED]' in the BODY of a message to [EMAIL PROTECTED], NOT to the list (use your own address!) List problems? Notify [EMAIL PROTECTED] -
Re: JESS: constants
I think Peter Martinovic wrote: > hi, > > please, is it possible to use constants in jess ? i did not find any notice of this >in the docs. > > would there be a way of using e.g a static java class members for this purpose ? >would i have to write the set and get methods for them ? > > thank you I tend to use defglobals as "constants", even though they're mutable (idea for future Jess version: "final" defglobals?) You can access static members in any Java class using get-member: Jess> (import java.awt.AWTEvent) TRUE Jess> (printout t (get-member AWTEvent COMPONENT_EVENT_MASK) crlf) 1 Jess> > > peter > > (sorry for bothering everyone if this is an elementary question) - Ernest Friedman-Hill Distributed Systems ResearchPhone: (925) 294-2154 Sandia National LabsFAX: (925) 294-2234 Org. 8920, MS 9012 [EMAIL PROTECTED] PO Box 969 http://herzberg.ca.sandia.gov Livermore, CA 94550 - To unsubscribe, send the words 'unsubscribe jess-users [EMAIL PROTECTED]' in the BODY of a message to [EMAIL PROTECTED], NOT to the list (use your own address!) List problems? Notify [EMAIL PROTECTED] -
Re: JESS: Something like patterns in Jess
Jess doesn't have a regular expression matcher, although this is something I've contemplated putting in. You can do what you want by calling out to Java explicitly; for instance, you could use String.indexOf(): (defrule list (row (name ?s&:(neq -1 (call ?s indexOf "new"))) (value ?b)) => (printout t "List:" ?b crlf )) I.e., we're testing the Java expression s.indexOf("new") != -1 . I think Skokan, Ladislav wrote: [Charset iso-8859-1 unsupported, filtering to ASCII...] > Hello All > > I am new in Jess/Lisp and I am faced to solve such problem: > This is simplified example: > > >>> code > (deftemplate row (slot name) (slot value)) > > (assert (row (name new) (value 1)) ) > (assert (row (name news) (value 1)) ) > > (defrule list (row (name new) (value ?b)) => (printout t "List:" ?b crlf )) > (run) > >> code > > I now need to list each row , where name STARTS with or CONTAINS the word > "new". > This example lists only words exactly maching name "new". > > Does anybody have any idea how to do it ? > > Thanx, > Laco Skokan. > > - > 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 Distributed Systems ResearchPhone: (925) 294-2154 Sandia National LabsFAX: (925) 294-2234 Org. 8920, MS 9012 [EMAIL PROTECTED] PO Box 969 http://herzberg.ca.sandia.gov Livermore, CA 94550 - To unsubscribe, send the words 'unsubscribe jess-users [EMAIL PROTECTED]' in the BODY of a message to [EMAIL PROTECTED], NOT to the list (use your own address!) List problems? Notify [EMAIL PROTECTED] -
Re: JESS: problem with getSlotValue
Jess is simply saying there's no such slot in that fact. I would try inserting a debugging print statement in the method below at the top, something like System.out.println(fact); and see what you're actually dealing with - it probably isn't what you're expecting. I think Weihua Zhou wrote: > hi, there, > > I just got a wired problem with jess.Fact class. In rule file, I defined > a fact template and asserted several facts based on the template. Then > in my java program, I was trying to get slot value as follows: > > public Task (Rete rete, Fact fact, int id) { > try { >setID(id); >setObject(fact.getSlotValue("object").toString()); > > >setRequirements(fact.getSlotValue("requirements").listValue(rete.getGlobalContext())); > > > setConstraints(fact.getSlotValue("constraints").listValue(rete.getGlobalContext())); > >Hashtable h = new Hashtable(); > > >h.put("elaboration",fact.getSlotValue("elaboration").listValue(rete.getGlobalContext())); > > > >h.put("dependency",fact.getSlotValue("dependency").listValue(rete.getGlobalContext())); > >setRelation(h); >setStatus(fact.getSlotValue("status").toString()); > > >setDuration((int)fact.getSlotValue("duration").numericValue(rete.getGlobalContext())); > >setPriority(0); >System.out.println("Creating task "+String.valueOf(id)+" ..."); > } > catch (JessException je) { >System.out.println(je); > } > } > > However, I always got error report from jess as "Jess reported an error > in routine Fact.findSlot, Message: Attempt to access invalid slotname > object." for the first time use of getSlotValue. In above case, say > getSlotValue("object"). Did someone have the same problem before? Any > suggestions and advice are greatly appreciated. > > thanks, > David > > - > 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 Distributed Systems ResearchPhone: (925) 294-2154 Sandia National LabsFAX: (925) 294-2234 Org. 8920, MS 9012 [EMAIL PROTECTED] PO Box 969 http://herzberg.ca.sandia.gov Livermore, CA 94550 - To unsubscribe, send the words 'unsubscribe jess-users [EMAIL PROTECTED]' in the BODY of a message to [EMAIL PROTECTED], NOT to the list (use your own address!) List problems? Notify [EMAIL PROTECTED] -
Re: JESS: How to access a slot with a variable
Sorry, but this isn't possible in current versions of Jess. The slot names in patterns must be known at the time that a rule is compiled; they're converted into numeric indices at that time. Therefore slot names can't be matched or wildcarded. The closest you could come would be to write something like this: (defrule newMessage ?message<-(message ?p ?t) ?participant<-(participant (nom ?p)) => (bind ?val (fact-slot-value ?participant ?t)) (eval (str-cat "(modify " ?participant " (" ?t " " (+ ?val 1) "))")) (retract ?message) ) This doesn't rely on matching on an unknown slot, and buildsthe (modify) funcall only after the slot name is known. I think [S_bastien] GEORGE wrote: [Charset iso-8859-1 unsupported, filtering to ASCII...] > Hi all, > > I have a question and I don't know if it's possible to resolve it > > I explain me with an example > > (deftemplate participant "a participant" > (slot nom (type STRING)) > (slot Question (default 0)) > (slot Answer (default 0)) > (slot Aknowledge (default 0)) > ... > ) > > The I assert a participant > (assert (participant (nom "Duke"))) > > Inside a rule, I want to access a slot with a variable > > (defrule newMessage > ?message<-(message ?p ?t) > ?participant<-(participant (nom ?p) (?t ?val) ; here's the problem > => > (modify ?participant (?t (+ ?val 1)) ) ; and there's too > (retract ?message) > ) > > and then I assert a message > > (assert (message "Duke" Question)) > > But it doesn't work ... > The problem is (participant (?t ?val)) > How to transform a variable into a name of a field ? > > Thanks for answers or comments > > S_bastien George > > > - > 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 Distributed Systems ResearchPhone: (925) 294-2154 Sandia National LabsFAX: (925) 294-2234 Org. 8920, MS 9012 [EMAIL PROTECTED] PO Box 969 http://herzberg.ca.sandia.gov Livermore, CA 94550 - To unsubscribe, send the words 'unsubscribe jess-users [EMAIL PROTECTED]' in the BODY of a message to [EMAIL PROTECTED], NOT to the list (use your own address!) List problems? Notify [EMAIL PROTECTED] -
JESS: Printable manual preview
Hi Folks, A printable Jess manual is a common request. I've been noodling with some tools to generate LaTeX source (and thereby PostScript) from Jess's XML-based manual. I have posted a sample of the fruits of these efforts at http://herzberg.ca.sandia.gov/jess/language.ps. This is Chapter 2 of the manual (even though it claims to be Chapter 1!) Comments and suggestions are welcome. - Ernest Friedman-Hill Distributed Systems ResearchPhone: (925) 294-2154 Sandia National LabsFAX: (925) 294-2234 Org. 8920, MS 9012 [EMAIL PROTECTED] PO Box 969 http://herzberg.ca.sandia.gov Livermore, CA 94550 - To unsubscribe, send the words 'unsubscribe jess-users [EMAIL PROTECTED]' in the BODY of a message to [EMAIL PROTECTED], NOT to the list (use your own address!) List problems? Notify [EMAIL PROTECTED] -
Re: JESS: Problem with Pumps Example
Hi, Well, let's see. First of all, I note that the Jess 5.0 version of Pumps stabilizes with pump rates varying between 3 and 4 on the two machines I've tried it on: a dual-processor PII 266 running Windows NT, JDK 1.2.2 + HotSpot 1.0.1, and a 133 MHz Pentium notebook running Windows 95 and the same JDK. A different JDK, or an even slower machine, could indeed possibly prevent the example from working, I'm sure. This is because while the pumps and tanks run in "real time" (driven by separate Threads performing periodic (wall-clock-based) tasks), the Jess rules will only fire as fast as the machine will go. Since there are five threads, too, the Thread scheduling algorithm in use by the JVM will also make a big difference. Anyhow, as far as the realtime control algorithm being used, it is admittedly a lousy one - I've definitely never claimed to be an engineer. Realtime control is an entire college semester course, not something some fellow like me makes up on the spot (as this example originally was!) I know that one elegant solution to this kind of control problem is to use fuzzy logic. Of course, you can therefore use Bob Orchard's Fuzzy Jess toolkit - see http://www.iit.nrc.ca/IR_public/fuzzy/fuzzyJavaToolkit.html . The standard FuzzyJess example is a fuzzy control algorithm, so have a look. I think Rudolph George-P27574 wrote: [Charset iso-8859-1 unsupported, filtering to ASCII...] > Ernest, > > When I run the latest Pumps example, it cranks the pump up then down hard, > then > overfills the tank, which explodes. Apparently, increments of 5 units is > too much for > the tank to handle. > I the modified the test to the condition of the rule "lower-rate-if-high" ( > line 55 of pumps-from-java.clp) : (test (>= ?flow-rate 5)). > This will set the flow rate to 0 if 5 is still too high, effectively > shutting off the > pump until the tank is low. This keeps the tank from exploding. > > Note: > The solution above "works", in that the tank will now not explode. > However, the pump is throttled up and down so hard that the tank and pump > never > approximate any kind of smooth equilibrium. > Recognizing that a true smooth equilibrium would require calculus, and that > an > approximation is sufficient in this particular case, and that this is, after > all, only an example,: > > How would you adjust this example to smooth out the pump's flow rate, given > that the > tank, pump and main threads all run as fast as they currently do? > I'm curious. > > Thanks. > > -- > George Rudolph > Mad Scientist > Motorola SSG > -- > > - > 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 Distributed Systems ResearchPhone: (925) 294-2154 Sandia National LabsFAX: (925) 294-2234 Org. 8920, MS 9012 [EMAIL PROTECTED] PO Box 969 http://herzberg.ca.sandia.gov Livermore, CA 94550 - To unsubscribe, send the words 'unsubscribe jess-users [EMAIL PROTECTED]' in the BODY of a message to [EMAIL PROTECTED], NOT to the list (use your own address!) List problems? Notify [EMAIL PROTECTED] -
JESS: RE: Storing Vector in ordinary variable
Hi, You're confused about several points. ONe is that you're binding an ordinary (not global) variable to a Vector, and then accessing it on the RHS of your rules. Now, it turns out that this actually may work, but it's actually undefined behaviour - it's not documented anywhere. This menas that it might not always work, or it might not work in the next Jess release. You could use a defglobal (which see, in the manual) to hold your Vector. Secondly, you're confusing the storage area used by fetch() and store() with Jess variables. You can't get the value of a Jess variable using fetch() - you can only get the values of things that have been stored using store() (or (store) ). To get the value of a global variable, you can use Rete.getGlobalContext().getVariable(). Alternatively, you can use fetch and store, but not use a defglobal at all. I think s s wrote: > hi > > I am trying to embed jess is java and having couple of issues. > I have got a rules file called rules.clp. The outline > of which is given below. > > (bind ?p (new java.util.Vector)) > > (defrule Rule1 > LHS > => > (call ?p addElement "value1") > > (defrule Rule2 > LHS > => > (call ?p addElement "value2") > > I am using java to run this rule file. THe code I am using is given below. > > public class Test > { > >public static void main(String [] argv) throws JessException >{ > //Create Engine, load the rules to the jess engine > Rete r = new Rete(); > FileReader rulesFile; > Jesp jessParse; > try { > rulesFile = new FileReader("Rules.clp"); > } > catch (FileNotFoundException fnfe) { > rulesFile = null; > System.out.println("Cannot open Rules.clp"); > } > > if (rulesFile != null) { //parse jess file > jessParse = new Jesp(rulesFile, r); > } > r.executeCommand("(run)"); > Vector v = r.fetch("p"); >} > } > > What I want to happen is get the Vector object that is declared in jess > through java once the rules file is run. > I tried to get the vector by using the fetch method. The program compiles > alright. But I am getting an error while running the application. Would > appreciate any help. > > Thanks > > Sobha > __ > Get Your Private, Free Email at http://www.hotmail.com > > - > To unsubscribe, send the words 'unsubscribe jess-users [EMAIL PROTECTED]' > in the BODY of a message to [EMAIL PROTECTED], NOT to the > list (use your own address!) List problems? Notify [EMAIL PROTECTED] > - > - Ernest Friedman-Hill Distributed Systems ResearchPhone: (925) 294-2154 Sandia National LabsFAX: (925) 294-2234 Org. 8920, MS 9012 [EMAIL PROTECTED] PO Box 969 http://herzberg.ca.sandia.gov Livermore, CA 94550 - To unsubscribe, send the words 'unsubscribe jess-users [EMAIL PROTECTED]' in the BODY of a message to [EMAIL PROTECTED], NOT to the list (use your own address!) List problems? Notify [EMAIL PROTECTED] -
Re: JESS: Delphi-Jess
Well, either JNI or CORBA could be used. Other alternatives include Microsoft's J/Connect technology (direct access from Java to the Win32 APIs). I should point out that it may be easier for you to use CLIPS instead, which is written in C and for which several DLL wrappers exist. There are pointers to the CLIPS web site from the Jess web site. If you don't have any specificly Java-related things to do, using CLIPS would make your life easier. I think Ru wrote: [Charset KOI8-R unsupported, filtering to ASCII...] > Good morning to all! > If I want to integrate an existing Delphi application with a Jess to use > its reasoning possibilities what would be best decision: JNI, CORBA or > something else? > Does exist some kind of such implementation? I would appreciate any > information on this subject. > Sincerily, > Ru. - Ernest Friedman-Hill Distributed Systems ResearchPhone: (925) 294-2154 Sandia National LabsFAX: (925) 294-2234 Org. 8920, MS 9012 [EMAIL PROTECTED] PO Box 969 http://herzberg.ca.sandia.gov Livermore, CA 94550 - To unsubscribe, send the words 'unsubscribe jess-users [EMAIL PROTECTED]' in the BODY of a message to [EMAIL PROTECTED], NOT to the list (use your own address!) List problems? Notify [EMAIL PROTECTED] -
Re: JESS: missing CORBA example??
That file is a placeholder for an example I was going to write, but haven't gotten around to yet. It wouldn't have contained anything special other than a specific example of using Jess's Java reflection capabilities to make CORBA method calls. Look at the existing reflection examples (primarily in the manual, but also in the "pumps" directory) and you shouldn't have any trouble figuring out how to do it on your own. It's just a matter of translating the code line by line from Java to Jess. To the extent that that becomes onerous, of course, you could instead put all the CORBA code into Jess Userfunctions and just call those. I think R. Keith Kerr wrote: > I'm probably getting ahead of myself, since I just started using Jess, > but I'm hoping to use it in a servlet, and pass both http requests and > CORBA-based requests. In the Jess5.0 example directory there is a file > "CORBA.clp", but it is empty. Was that just left out?? I don't know > whether it would be useful to me or not, but right now, reading/running > the examples is where I'm at. > > thanks, > keith - Ernest Friedman-Hill Distributed Systems ResearchPhone: (925) 294-2154 Sandia National LabsFAX: (925) 294-2234 Org. 8920, MS 9012 [EMAIL PROTECTED] PO Box 969 http://herzberg.ca.sandia.gov Livermore, CA 94550 - To unsubscribe, send the words 'unsubscribe jess-users [EMAIL PROTECTED]' in the BODY of a message to [EMAIL PROTECTED], NOT to the list (use your own address!) List problems? Notify [EMAIL PROTECTED] -
Re: JESS: PropertyChangeListeners and the Rete class
Well, one problem is that sometimes Beans are to be registered under a defclass that was not generated from their specific type, or the defclass they should use was defined to use inheritance. In both cases, the definstance statement provides the necessary association between the defclass and the Bean. Another problem is that when you call call addPropertyListener() on the Bean, the Listener is not notified until the first PropertyChangeEvent comes in. This means that Jess wouldn't contain a fact to represent the Bean until some property changed, and if none ever do, the Bean would never appear on the fact list. One additional side effect of this is that undefinstance wouldn't work until after the first property change had occurred. Both of these together show pretty clearly that Jess needs to be told about the Bean, rather than simply having the Bean told about Jess. It does take a half-dozen lines of code to definstance a Bean, however, and this can certainly interrupt the flow of your Java code. What I would suggest would be to put these half-a-dozen lines into a utility method, which you can then call as JessUtils.definstance("my-defclass", myBean, theEngine); I think Javier Maria Torres Ramon wrote: > Hi everyone, > > I wanted to propose a minor change in JESS interface that might help > in Java programming. As far as I know, JavaBeans are defined into the > Rete object via the definstance command, which may be available from the > Java part as a Funcall. I was wondering if it would be both easy and useful > to define some object (Rete or a property of Rete) as a PropertyChangeListener > stright ahead, so the need for definstance would be hidden from the Java > programmer and he/she would only need to register the Rete as another Listener. > Maybe the list of objects being stored in JESS can be watched everytime > a Change is fired, and the Object firing the Event can be dynamically > definstance (even though I realize this would surely bring a lower performance).I >would appreciate any views and opinions on this idea. > > Thanx and greetings, > > Javier Torres - Ernest Friedman-Hill Distributed Systems ResearchPhone: (925) 294-2154 Sandia National LabsFAX: (925) 294-2234 Org. 8920, MS 9012 [EMAIL PROTECTED] PO Box 969 http://herzberg.ca.sandia.gov Livermore, CA 94550 - To unsubscribe, send the words 'unsubscribe jess-users [EMAIL PROTECTED]' in the BODY of a message to [EMAIL PROTECTED], NOT to the list (use your own address!) List problems? Notify [EMAIL PROTECTED] -
JESS: Jess site back up
Several of you had written to me inquiring after the Jess web site this weekend. Apparently it was down due to an unexpected power failure. It is now back up and running. If anyone notices any anomalies, please let me know. Sorry for the inconvenience. - Ernest Friedman-Hill Distributed Systems ResearchPhone: (925) 294-2154 Sandia National LabsFAX: (925) 294-2234 Org. 8920, MS 9012 [EMAIL PROTECTED] PO Box 969 http://herzberg.ca.sandia.gov Livermore, CA 94550 - To unsubscribe, send the words 'unsubscribe jess-users [EMAIL PROTECTED]' in the BODY of a message to [EMAIL PROTECTED], NOT to the list (use your own address!) List problems? Notify [EMAIL PROTECTED] -
Re: JESS: may I have your advice on this situation?
I think you're asking for "modules," a feature that Jess doesn't currently support. Modules should probably be included in Jess 6.0. I think Weihua Zhou wrote: > hi, there, I am working on a multi-agent based simulation program by > using JESS. Basically each agent holds certain mount of knowledge > (cognitive attributes). to solve a problem, agent is going to follow > this procedure with different knowledge applied into: > > (1) if it can solve it by itself, solve it. capability is involved. > (2) if more information is needed, find it. belief is involved. > (3) if it can't solve it, find one who can. collaboration knowledge is > involved. > > so you see, in different stage, different knowledge is applied. I just > wonder if in JESS there is a way to do quick switch between different > knowledge set. say, if I instantiates a Rete engine instance, how can I > hold different knowledge set in terms of facts and rules and switch > among them without having more Rete instances? > > your advice is greatly appreciated. please reply to me directly. thanks > a lot. > - Ernest Friedman-Hill Distributed Systems ResearchPhone: (925) 294-2154 Sandia National LabsFAX: (925) 294-2234 Org. 8920, MS 9012 [EMAIL PROTECTED] PO Box 969 http://herzberg.ca.sandia.gov Livermore, CA 94550 - To unsubscribe, send the words 'unsubscribe jess-users [EMAIL PROTECTED]' in the BODY of a message to [EMAIL PROTECTED], NOT to the list (use your own address!) List problems? Notify [EMAIL PROTECTED] -
Re: JESS: Use retract in Deffunction
Hi, You can't do pattern matching inside of deffunctions, only inside of defrules and defqueries. You could recast this as a rule like (defrule esborraSortir ?e <- (esborraSortir ?numero ?pal) ?fact <- (sortir (str-cat ?numero "-" ?pal) ?) => (retract ?e ?fact)) and then to use it you could do this: (assert (esborraSortir 5 ors)) (run) I think Jordi Cardona wrote: > Hi all, > > Excuse my poor english, please. > > I have a question about use facts in deffunction, I explain me with an > example > > (deffunction esborraSortir (?numero ?pal) >?fact <- (sortir (str-cat ?numero "-" ?pal) ?) >(retract ?fact) > ) > > In my knowledge base, I have facts like: > > (sortir "5-ors" 5) > > When I execute: > > (esborraSortir 5 ors) > > Jess don't work and answer: > > Jess reported an error in routine Variable.resolveValue while > executing deffunction esborraSortir while executing > (esborraSortir 5 ors). > Message: Undefined variable (no binding) fact. > Program text: ( esborraSortir 5 ors ) at line 0. > Undefined variable (no binding) > > It's possible to use question mark (?) in this case? > > Thanks for answers or comments > > Jordi Cardona > > > - > 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 Distributed Systems ResearchPhone: (925) 294-2154 Sandia National LabsFAX: (925) 294-2234 Org. 8920, MS 9012 [EMAIL PROTECTED] PO Box 969 http://herzberg.ca.sandia.gov Livermore, CA 94550 - To unsubscribe, send the words 'unsubscribe jess-users [EMAIL PROTECTED]' in the BODY of a message to [EMAIL PROTECTED], NOT to the list (use your own address!) List problems? Notify [EMAIL PROTECTED] -
Re: JESS: release 6.0
Well, a long time from a final release of 6.0, as much of it isn't even written yet. But it has only been my unusually busy schedule that has kept me so far from sending out a 6.0 alpha release with some of the early features. I promise it will happen within the next week or so. I think Ashraf Afifi wrote: > > > Hi, > I don't mean to be pushy. But, how far are we from having release 6.0 ? > > Ashraf Afifi > - Ernest Friedman-Hill Distributed Systems ResearchPhone: (925) 294-2154 Sandia National LabsFAX: (925) 294-2234 Org. 8920, MS 9012 [EMAIL PROTECTED] PO Box 969 http://herzberg.ca.sandia.gov Livermore, CA 94550 - To unsubscribe, send the words 'unsubscribe jess-users [EMAIL PROTECTED]' in the BODY of a message to [EMAIL PROTECTED], NOT to the list (use your own address!) List problems? Notify [EMAIL PROTECTED] -
Re: JESS: how to update deffacts?
Again, to change a deffacts from the Jess language, you must redefine the entire thing. Alternatively, you can define a jess.Deffacts object in Java, and add it to the engine with Rete.addDeffacts(). You could then add new facts, or change existing ones, in your Deffacts object, and the changes would be visible at the next (reset) command. I think Weihua Zhou wrote: > hi, there. I assert some set of facts by using deffacts. but later on, I > want to dynamically update those facts, for example put new fact in or > change old fact content? how can I do this? it seems that I can modify > old fact by using modify. however, how about add new fact to certain > fact set asserted by deffacts? any suggestions? thanks a lot. > > david > - Ernest Friedman-Hill Distributed Systems ResearchPhone: (925) 294-2154 Sandia National LabsFAX: (925) 294-2234 Org. 8920, MS 9012 [EMAIL PROTECTED] PO Box 969 http://herzberg.ca.sandia.gov Livermore, CA 94550 - To unsubscribe, send the words 'unsubscribe jess-users [EMAIL PROTECTED]' in the BODY of a message to [EMAIL PROTECTED], NOT to the list (use your own address!) List problems? Notify [EMAIL PROTECTED] -
Re: JESS: how to solve this wired problem?
Jess doesn't create any threads of its own (except for an I/O flushing thread if multi-threaded I/O is set, and some process I/O readers from the (system) command. ) run() doesn't return until no more rules are firing. Whatever you're observing, it isn't that you need to do something special to wait for Jess to stop running. Now, other events can happen in the engine when it is not running. For instance, if you've got definstanced Beans with properties being changed in other Threads, facts will be modified in Jess without any direct action from your main program. I think Weihua Zhou wrote: > hi, there, I got a wired problem with JESS. in my java program, I set > rete engine to run. but it seems to me that JESS is running with my java > program paralelly, which means sometimes my java program won't wait jess > to finish and just go ahead. how can I let my java program wait until > jess is finished? any hint? thanks a lot. urgent! please reply to my > email directly. > > David - Ernest Friedman-Hill Distributed Systems ResearchPhone: (925) 294-2154 Sandia National LabsFAX: (925) 294-2234 Org. 8920, MS 9012 [EMAIL PROTECTED] PO Box 969 http://herzberg.ca.sandia.gov Livermore, CA 94550 - To unsubscribe, send the words 'unsubscribe jess-users [EMAIL PROTECTED]' in the BODY of a message to [EMAIL PROTECTED], NOT to the list (use your own address!) List problems? Notify [EMAIL PROTECTED] -
Re: JESS: Getting any kind of value out og jess
I've told Gavin in another email to use store and fetch as described in manual section 4.4.4. I think Gavin Nunns wrote: > HI > > I need to get a value (string or int) out of jess when I assert a fact in > java which triggers a rule. > > Please can anyone help me I've been strugling with this for a while now and > I haven't got much time left to get this working. > > Thanks in advance > > Gavin Nunns (Plymouth University) > __ > Get Your Private, Free Email at http://www.hotmail.com > - Ernest Friedman-Hill Distributed Systems ResearchPhone: (925) 294-2154 Sandia National LabsFAX: (925) 294-2234 Org. 8920, MS 9012 [EMAIL PROTECTED] PO Box 969 http://herzberg.ca.sandia.gov Livermore, CA 94550 - To unsubscribe, send the words 'unsubscribe jess-users [EMAIL PROTECTED]' in the BODY of a message to [EMAIL PROTECTED], NOT to the list (use your own address!) List problems? Notify [EMAIL PROTECTED] -
Re: JESS: problems with (facts)
Indeed. The vector that's being malindexed ( (__data () -1) ) is the vector contained by the standard deftemplate for ordered facts (an ordered fact is stored as an unordered fact with a single multislot named __data; the () is the default value (the empty list) and the -1 is the data type (unknown)). Although fact #195 has this default ordered deftemplate, it apparently contains more than one slot, since when (facts) calls Fact.toString() to print the fact out, Fact.toString() tries to access the name of the second slot, which would be at offset 3 within the deftemplate; hence the failure. So most likely what you've done is created an ordered fact, but stored the slot data as a series of separate slots, instead of as a single multislot. This representation is mentioned in the manual in several places, one of which is in section 4.7, "The jess.Fact class." I think Javier Maria Torres Ramon wrote: > > Hi, > > I get this message when executing a (facts) command. I suspect it's due to > an incorrectly asserted fact in JESS via a Java call to Rete.assert(), > such as asserting a fact that does not follow a template. > > I would appreciate any help. > > Thanx and greetings, > > Error message: > > f-195 (Jess reported an error in routine ValueVector.get. > Message: Bad index 3 in call to get() on this vector: (__data () -1).) > > - Ernest Friedman-Hill Distributed Systems ResearchPhone: (925) 294-2154 Sandia National LabsFAX: (925) 294-2234 Org. 8920, MS 9012 [EMAIL PROTECTED] PO Box 969 http://herzberg.ca.sandia.gov Livermore, CA 94550 - To unsubscribe, send the words 'unsubscribe jess-users [EMAIL PROTECTED]' in the BODY of a message to [EMAIL PROTECTED], NOT to the list (use your own address!) List problems? Notify [EMAIL PROTECTED] -
Re: JESS: how to solve this wired problem?
This is an excellent question, and one that I've looked at more than once. Someday I may well provide an implementation of this. There are implementation difficulties having to do with fine-grained synchronization (the Rete network is not a proper tree, and separate paths can converge downstream,) but nothing insurmountable. Trial implementations I've done in the past showed negative speedup factors, largely because thread synchronization wasn't cheap. I think matters have improved with today's JVMs, so perhaps it's time to revisit the idea. I do, in fact, work on a dual-processor machine myself. I think S. Alexander Jacobson wrote: > If you are running on a multiprocessor box, is there a way to get Jess to > break into threads to work in parallel? > > I mean if two rules are driven by the same assertion, why not run them in > parallel? > > Can Jess load balance rule processing across multiple threads/CPUs? > > -Alex > > ___ > S. Alexander Jacobson Shop.Com > 1-212-697-0184 voice The Easiest Way To Shop > - Ernest Friedman-Hill Distributed Systems ResearchPhone: (925) 294-2154 Sandia National LabsFAX: (925) 294-2234 Org. 8920, MS 9012 [EMAIL PROTECTED] PO Box 969 http://herzberg.ca.sandia.gov Livermore, CA 94550 - To unsubscribe, send the words 'unsubscribe jess-users [EMAIL PROTECTED]' in the BODY of a message to [EMAIL PROTECTED], NOT to the list (use your own address!) List problems? Notify [EMAIL PROTECTED] -
Re: JESS: Moving the Rete engine
Ages and ages ago, before Java even -had- serialization yet, a mobile agent application was the primary reason I began the Jess project. When Serialization was put into Java 1.1., (after the original application was no longer needed, alas) I began to add support for it to Jess, and it turned out to be not as easy as you'd think. The current design needs quite a bit of rework. In any event, Jess has the (bsave) and (bload) commands, which store and retrieve active Rete object (sans facts) to a file. If you want to store and retrieve the facts as well, you can use (save-facts) and (load-facts), but only if the facts are renderable as text - i.e., they can't have any Java objects as slot values. So one strategy for doing what you want to do is to call (save-facts), then (bsave), on the source end, send the two files to the destination end, then call (bload) and (load-facts) on the destination end. I'm hoping that by the Jess 6.0 release, I'll have things worked out such that the straightforward process you tried will be sufficient. I think Andreas Johansson wrote: > I'm doing a little project in Java with mobile agents that jumps from > computer to computer in a network to search for data. I have tested Jess > a bit and found out that it would be very nice to use it as the "brain" > for the agent. I.e. to decide when and where to move and what to do > (what > methods to run) when it gets there. Enough of backgound. > > The agent transport system uses the Serializable interface to pack the > objects before sending them over the network. Therefore I was pleased to > see that all the Jess classes seems to be serializable. > > I have tried my agent system before including Jess and then everything > worked just fine. Compileing the agent with the Rete engine and some > small things (like some asserts) also worked fine. The agent could start > at my computer, create the Rete engine, move to some other computer and > then do some assertions and get back here. > > But then I discovered the problem. The facts that I inserted were no > longer available and had disappered! Either they weren't moved with the > Agent, Rete object etc. or the Rete engine was resetted or cleared in > some way when it reached the destination. > > I also tried it a bit more by including a rule that would be fired on > one of the facts that were included on the other computer. The line was > (r is the Rete object): > r.executeCommand("(defrule test (back again) > => (assert (rule activated)))"); > > But then I got a long exception and the top of it are as follows: > Fri Apr 14 11:28:57 CEST 2000=>TCPDistributor : ERROR : Caught exception > handling a client > request: java.lang.ArrayStoreExceptionnull > java.lang.ArrayStoreException > at java.io.ObjectInputStream.inputArray(Compiled Code) > at java.io.ObjectInputStream.readObject(Compiled Code) > at java.io.ObjectInputStream.defaultReadObject(Compiled Code) > at java.io.ObjectInputStream.inputObject(Compiled Code) > at java.io.ObjectInputStream.readObject(Compiled Code) > at java.io.ObjectInputStream.inputArray(Compiled Code) > at java.io.ObjectInputStream.readObject(Compiled Code) > at java.io.ObjectInputStream.defaultReadObject(Compiled Code) > at java.io.ObjectInputStream.inputObject(Compiled Code) > at java.io.ObjectInputStream.readObject(Compiled Code) > at java.io.ObjectInputStream.defaultReadObject(Compiled Code) > at java.io.ObjectInputStream.inputObject(Compiled Code) > at java.io.ObjectInputStream.readObject(Compiled Code) > at java.io.ObjectInputStream.inputArray(Compiled Code) > at java.io.ObjectInputStream.readObject(Compiled Code) > at java.io.ObjectInputStream.defaultReadObject(Compiled Code) > at jess.Node.readObject(Node.java:138) > > What I can read from this is that the agent transport system gets a > problem when moving one of the Node objects and that one of its Arrays > are null and then everything breaks. (I think that other Nodes are moved > correctly, so it's not a general transport problem). > > Does anyone have any suggestions about what to do? Is it even possible > to move the entire Jess engine? Maybe if I somehow stores all the data > from the > engine and then move the data over in an new object and then creates a > new engine and fills it with the data? But it feels like to much work > since it *almost* works this way! > > I think it would be really useful to have an mobile agent controlled by > a > rule based system like Jess! > > I hope someone can please help me. If more details are required for you > to be able to help me, just ask and I answer. I just thought that the > mail was long enough already. > > Best regards > Andreas Johansson, Sweden > - > To unsubscribe, send the words 'unsubscribe jess-users [EMAIL PROTECTED]' > in
Re: JESS: Jess Applet (Jess 5.0) in IE 5.01 Crashes
I think Marvin Pankaskie wrote: > I recently upgraded my version of Jess to 5.0 and transferred the files > necessary to run the console applet to my web server. However, when I > access the page that contains the applet using IE 5.01 it does not seem to > completely load the applet (part of the class files are loaded but the > applet never actually starts running). HOWEVER, if I use Netscape 4.7 as my > browser, the applet runs perfectly normal. Is this a "bug" in Jess or a > problem in IE 5.0? Can it be fixed? Find the "Java Console" and open it. It will most likely contain an explanatory error message. Most likely it's simply a security exception; IE isn't letting Jess read something or other that it wants to read (the .clp file, for instance, or perhaps jess/scriptlib.clp. Hairy, complicated, constantly changing, and largely inscrutable security rules are one reason why you'll not encounter many unsigned applets on the web these days consisting of more than a few dozen lines of code. > > I am going to eventually try converting my code to servlets, but not untill > I learn more about creating them and convering my existing clp files to > code that can run on the server. By the way, does anyone have any > suggestions on "converting" the console display applet and supporting clp > files to servlets Of course, you don't want to convert the graphical console class into a Servlet, since servlets don't have GUIs; you want to simply make Jess method calls from the body of a normal servlet. Eventually I hope to provide an example servlet. For now, suffice it to says that once you've learned about servlet programming, and studied the examples in the Jess manual on embedding Jess in Java applications, you should have no problem writing such things from scratch. > and what servlet program (e.g., JRun or others) runs best > on a MS IIS web host? I've used New Atlanta's ServletExec with IIS, which is very nice (but only the crippled demo is free.) The other things I've done servlets with have involved using other web servers (Sun's Java Web Server, Apache + Apache_jmod, the W3C's Jigsaw which has native servlet support.) Of all of these, Jigsaw is my favorite. JWS was my least favorite. > > Many thanks, > Marvin Pankaskie > > - > 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 Distributed Systems ResearchPhone: (925) 294-2154 Sandia National LabsFAX: (925) 294-2234 Org. 8920, MS 9012 [EMAIL PROTECTED] PO Box 969 http://herzberg.ca.sandia.gov Livermore, CA 94550 - To unsubscribe, send the words 'unsubscribe jess-users [EMAIL PROTECTED]' in the BODY of a message to [EMAIL PROTECTED], NOT to the list (use your own address!) List problems? Notify [EMAIL PROTECTED] -
JESS: Two small announcements
Hi Folks, Two things: 1) There's a PostScript version of the whole Jess manual at the Jess web site now: http://herzberg.ca.sandia.gov/jess/manual.ps . It's "almost" suitable for printing -- an occasional line veers off the RHS of the page, and the pictures aren't in yet. Those of you who have expressed interest in a printable manual might want to grab this. I'm not sure that there will ever be a better version of the 5.0 manual available - i.e., by the time this is all fixed up, it will be the 6.0 manual, and some things will have changed. 2) I have been meaning to do this, but finally remembered: here's a link to the slides from a talk on Jess's implementation that I've given a few times in the last six months: http://aaaprod.gsfc.nasa.gov/teas/Jess/JessUMBC/index.htm Nothing earth-shattering, but probably of interest to many of you. - Ernest Friedman-Hill Distributed Systems ResearchPhone: (925) 294-2154 Sandia National LabsFAX: (925) 294-2234 Org. 8920, MS 9012 [EMAIL PROTECTED] PO Box 969 http://herzberg.ca.sandia.gov Livermore, CA 94550 - To unsubscribe, send the words 'unsubscribe jess-users [EMAIL PROTECTED]' in the BODY of a message to [EMAIL PROTECTED], NOT to the list (use your own address!) List problems? Notify [EMAIL PROTECTED] -
Re: JESS: Multislots for defclass Java Classes
Scalar properties whose values are arrays get mapped onto multislots. An example is int[] getIndexes(); void setIndexes(int[] values); Doing this with more complex properties, especially Vectors or other collections, has been discussed in the past, but right now nothing of the kind is supported. I think Blaine Bell wrote: > Forgive me if this has already been answered, but can you create > multislots in defclass classes? How? > > Thanks in advance, > > Blaine Bell > - Ernest Friedman-Hill Distributed Systems ResearchPhone: (925) 294-2154 Sandia National LabsFAX: (925) 294-2234 Org. 8920, MS 9012 [EMAIL PROTECTED] PO Box 969 http://herzberg.ca.sandia.gov Livermore, CA 94550 - To unsubscribe, send the words 'unsubscribe jess-users [EMAIL PROTECTED]' in the BODY of a message to [EMAIL PROTECTED], NOT to the list (use your own address!) List problems? Notify [EMAIL PROTECTED] -