Re: JESS: Jess IDE in Eclipse 3.5.1
I'm going to see if I can find out more info on the fail so we can at least understand the failure mode... On Nov 20, 2009, at 11:53 AM, Socrates Frangis wrote: > They load for me in 3.5.1, but I have had some issues in the past couple of > weeks where I would run and rules would not fire. watch all was enabled and I > could see the facts were all in the engine which 'should' trigger the rules. > Closing and restarting Eclipse with a -clear fixed it temporarily but there > have been some issues where I just had to restart eclipse for it to work. I > never received any errors, just not replication in the execution. > > This situation only occurs for me when I am creating dynamic web applications > and using Tomcat, JSP's, Servlets, and JXL API (Excell API). > > Also, Jason provided me with a Jess-Eclipse fix patch during our training a > few months back. I can not remember if it was just for the debug archive or > not, but perhaps the fix is enough to get me by in 3.5.1 without errors. > > Odd that this was brought up, I was actually having the problem i describe > last night. And just restarting eclipse with a clear fixes it for me. Its not > until I add something to my Elcipse plugins directory that odd things happen > again. > > On Fri, Nov 20, 2009 at 7:51 AM, Ernest Friedman-Hill > wrote: > I'm not sure that means anything (although I don't know quite what it means:) > the gov.sandia.jess plugin is just a holder for the Jess library, and > contains no extensions. > > But that said: they don't seem to load for me under 3.5.1 either. It looks > like it's time for a refresh, as Eclipse has changed how plugins work since > these were first released. For quite a while they've been supporting two > mechanisms, but perhaps the old one has finally stopped working. > > Unless they're working for anybody else under 3.5.1 ? > > > On Nov 19, 2009, at 7:24 PM, Hal Hildebrand wrote: > > Well, still having issues with this. found this warning in the log, which > explains why things are getting messed up: > >The extensions and extension-points from the bundle "gov.sandia.jess" > are ignored. The bundle is not marked as singleton. > > Anyone else having issues with the IDE under Eclipse 3.5.1? > > > > > - > Ernest Friedman-Hill > Informatics & Decision Sciences, Sandia National Laboratories > PO Box 969, MS 9012, Livermore, CA 94550 > http://www.jessrules.com > > > > > > > > > > To unsubscribe, send the words 'unsubscribe jess-users y...@address.com' > in the BODY of a message to majord...@sandia.gov, NOT to the list > (use your own address!) List problems? Notify owner-jess-us...@sandia.gov. > > >
JESS: Jess IDE in Eclipse 3.5.1
Well, still having issues with this. found this warning in the log, which explains why things are getting messed up: The extensions and extension-points from the bundle "gov.sandia.jess" are ignored. The bundle is not marked as singleton. Anyone else having issues with the IDE under Eclipse 3.5.1? To unsubscribe, send the words 'unsubscribe jess-users y...@address.com' in the BODY of a message to majord...@sandia.gov, NOT to the list (use your own address!) List problems? Notify owner-jess-us...@sandia.gov.
Re: JESS: Jess 7.1p2 with Eclipse 3.5
On Sep 1, 2009, at 5:58 AM, Ernest Friedman-Hill wrote: Well, I'm using it with a group here, and it's working OK, except that one person *is* having an odd issue where classes that use java.util.regex won't resolve properly. We haven't tracked that down yet. Otherwise I don't think we've gotten any reports about general failures. You said the "class path". Just to be precise and make sure we're all on the same page, it's actually the "Java build path" of a Java project that the JessDE will look at. That's what you mean, too, right? Yes, sorry about that. What I mean is that I have a project. In the project are .clp files and classes. The .clp imports one Java class as a Jess Function - via load-function - in which the class is in the same project. The error is that the class cannot be found. The class is there. When I actually build and run tests, which use this .clp, things work just find (this is a very old project, anyway). It's just in the editor that things seem to go south. On Aug 31, 2009, at 12:16 PM, Hal Hildebrand wrote: Wondering if there's any known issues with the IDE integration of Jess with the latest Eclipse. Running into an issue where the resources and classes are not being found on the class path. I am using the Maven plugin, however classes in the same project as the .clp are not being found. - Ernest Friedman-Hill Informatics & Decision Sciences Phone: (925) 294-2154 Sandia National Labs PO Box 969, MS 9012ejfr...@sandia.gov Livermore, CA 94550 http://www.jessrules.com To unsubscribe, send the words 'unsubscribe jess-users y...@address.com' in the BODY of a message to majord...@sandia.gov, NOT to the list (use your own address!) List problems? Notify owner-jess-us...@sandia.gov . To unsubscribe, send the words 'unsubscribe jess-users y...@address.com' in the BODY of a message to majord...@sandia.gov, NOT to the list (use your own address!) List problems? Notify owner-jess-us...@sandia.gov.
JESS: Jess 7.1p2 with Eclipse 3.5
Wondering if there's any known issues with the IDE integration of Jess with the latest Eclipse. Running into an issue where the resources and classes are not being found on the class path. I am using the Maven plugin, however classes in the same project as the .clp are not being found. To unsubscribe, send the words 'unsubscribe jess-users y...@address.com' in the BODY of a message to majord...@sandia.gov, NOT to the list (use your own address!) List problems? Notify owner-jess-us...@sandia.gov.
Re: JESS: Rule firing an threads
Perhaps this will help? Basically, this Userfunction allows you to execute any arbitrary Jess function (whether it's a user function or not) and evaluates it with the configured Executor. You can control how this is done by configuring the right executor. For example, configuring the instance of the user function below with: BackgroundProcessor bp = new BackgroundProcessor(); bp.setExecutor(java.util.concurrent.Executors.newFixedThreadPool(5)); will give you 5 background threads to use. You can use this in Jess like so: (evaluate-in-background (some-function anArg anotherArg)) the function "some-function" will be evaluated asynchronously. import java.util.concurrent.Executor; import jess.*; /** * @author Hal Hildebrand * Evaluates the passed Jess function call via an executor */ public class BackgroundProcessor implements Userfunction { protected Executor executor; public void setExecutor(Executor executor) { this.executor = executor; } /* (non-Javadoc) * @see jess.Userfunction#call(jess.ValueVector, jess.Context) */ public Value call(ValueVector vv, final Context context) throws JessException { final Funcall task = vv.get(1).funcallValue(context); executor.execute(new Runnable() { public void run() { try { task.execute(context); } catch (JessException e) { // Do your own error handling here ;) e.printStackTrace(); } } }); return Funcall.NIL; } /* (non-Javadoc) * @see jess.Userfunction#getName() */ public String getName() { return "evaluate-in-background"; } } On Feb 17, 2009, at 12:52 PM, Matt Hutchinson wrote: OK, thanks. However I am using a Userfunction - which takes a couple of parameters. How do I start the new thread for it and pass it the parameters? The only way to do this was with constructor parameters, but the Userfunction uses command line parameters. Thanks MH On Thu, Feb 12, 2009 at 12:51 PM, Ernest Friedman-Hill wrote: Rules are fired sequentially, on the thread where you call "run". If you want asynchronous execution, you could create a thread and run your code off in its own thread. CHek out the "implement" function in the "Jess Function List" chapter of the manual for an example of this. On Feb 12, 2009, at 11:20 AM, Matt Hutchinson wrote: Hi everyone, I did search on this but could not find an answer. When multiple rules fire in JESS, it is JESS who decides the order in which they fire - no worries. Although these fire in some order, does the RHS of the first have to finish before the RHS of the next rule is executed, and so on? I was hoping that if several rules fire, their RHSs are all executed one they fire, without any waiting (somewhat in parallel). Thanks, MH - Ernest Friedman-Hill Informatics & Decision Sciences Phone: (925) 294-2154 Sandia National Labs PO Box 969, MS 9012ejfr...@sandia.gov Livermore, CA 94550 http://www.jessrules.com To unsubscribe, send the words 'unsubscribe jess-users y...@address.com' in the BODY of a message to majord...@sandia.gov, NOT to the list (use your own address!) List problems? Notify owner-jess-us...@sandia.gov .
Re: JESS: New article available
Can you post the link to this article? I can't seem to find where you've posted it. Thanks. On Feb 10, 2009, at 7:11 AM, Ernest Friedman-Hill wrote: I've posted a new article on the Jess web site: "Predicate Calculus and Jess," by Wolfgang Laun. This paper shows how Jess can be used to implement concepts from Propositional Logic and First Order Predicate Calculus. It's perfect for anyone coming to Jess from a background in computer science, mathematics, or philosophy. - Ernest Friedman-Hill Informatics & Decision Sciences, Sandia National Laboratories PO Box 969, MS 9012, Livermore, CA 94550 http://www.jessrules.com To unsubscribe, send the words 'unsubscribe jess-users y...@address.com' in the BODY of a message to majord...@sandia.gov, NOT to the list (use your own address!) List problems? Notify owner-jess-us...@sandia.gov . To unsubscribe, send the words 'unsubscribe jess-users y...@address.com' in the BODY of a message to majord...@sandia.gov, NOT to the list (use your own address!) List problems? Notify owner-jess-us...@sandia.gov.
Re: JESS: Announcing The Zen of Jess Blog
ha! very cool. thx. On Jan 29, 2009, at 2:03 PM, Jason Morris wrote: Hi All, After a nearly three year hiatus and at the bequest of James Owen, I have decided to reactivate my blog on applied Jess technology. To motivate myself, I'll start a thread about my on-going work with the University of Sydney, Australia. If you'd like to follow along, please join us at http://zen-of-jess.blogspot.com/ The blog is moderated and all comments are welcome. Cheers, Jason -- --- Morris Technical Solutions LLC consult...@morris-technical-solutions.com (517) 304-5883
Re: JESS: Problem with variables and rule syntax
what is the ?n in your rule? The problem you're having is that ?n isn't a variable. Think about where you believe you're binding ?n - in your example, it's just "there". On Dec 30, 2008, at 4:29 AM, serendipity wrote: hello!(sorry about my bad english) I am working first time with jess and i have some problems Here i have a deftempate : (deftemplate mitsos (slot x (type INTEGER)) ) and i created a rule (defrule myrule (mitsos(x (+ ?n 1))) => (printout t "everything is ok" )) although,the jess tell me that i have syntax error at (x (+ ?n 1))) how can i write it in appropriate way? plz help me View this message in context: Problem with variables and rule syntax Sent from the Jess mailing list archive at Nabble.com.
Re: JESS: Generic Rules Modelling for using OWL Ontology
Are you talking about defaults? If so, then the java object itself can set the default state of the slot. However, there's really nothing that either Jess or Java is going to provide to help you set up the initial state of a system which cannot be set up via some algorithm. If there is no programatic way to produce the initial state pattern, then you'll have to do it the long way, by setting up each slot state explicitly. On Nov 20, 2008, at 6:40 AM, John Chrysakis wrote: Another problem for this issue is: How to massively fill in the slots for all the shadow facts? (?door1 setState "open") (?door2 setState "open") (?door3 setState "closed") ...etc I'm waiting for your answer, thanks, On Mon, 17 Nov 2008, John Chrysakis wrote: I am using an owl ontology through protege-owl api. Each OwlClass (corresponds to a deftepmlate) and has instances(OwlIndividuals) and properties (OwlProperties) I need to model the ontology in such way as I could write rules in general form with the elements of this ontology. I Need some ideas for this... For example instead of having getDoor1State and getDoor2state I need to have a generic slot DoorState in which I can pass as parameter the Door1, Door2. Is it possible? Or I have to write for each instance of each property a getXXX method... Thanks for your time. John. - To unsubscribe, send the words 'unsubscribe jess-users [EMAIL PROTECTED] ' in the BODY of a message to [EMAIL PROTECTED], NOT to the list (use your own address!) List problems? Notify [EMAIL PROTECTED] . To unsubscribe, send the words 'unsubscribe jess-users [EMAIL PROTECTED]' in the BODY of a message to [EMAIL PROTECTED], NOT to the list (use your own address!) List problems? Notify [EMAIL PROTECTED] . To unsubscribe, send the words 'unsubscribe jess-users [EMAIL PROTECTED]' in the BODY of a message to [EMAIL PROTECTED], NOT to the list (use your own address!) List problems? Notify [EMAIL PROTECTED]
Re: JESS: Preferred rules formulation using NOT CE
Whoops! Yep. I really have only on choice here, don't I. Thx. On Nov 17, 2008, at 9:38 AM, Peter Lin wrote: I haven't tried running the rules, but the second format doesn't mean the same thing as the first format. normally, if I start a rule with a NOT CE, I have it match against a literal value. Having a NOT CE that declares a binding isn't really valid, if I'm not mistaken. peter On Mon, Nov 17, 2008 at 12:23 PM, Hal Hildebrand <[EMAIL PROTECTED]> wrote: Which is more efficient: (DOMAIN::planned-process (host-id ?host) (id ?pid) (plan ?plan)) (not (DOMAIN::host-association (host ?host))) (not (DOMAIN::decommission-process (process ?pid))) or (not (DOMAIN::host-association (host ?host))) (not (DOMAIN::decommission-process (process ?pid))) (DOMAIN::planned-process (host-id ?host) (id ?pid) (plan ?plan)) Assuming that there are a large number of DOMAIN::planned-process facts in the system. Are they essentially equivalent? Also, in general, is it more efficient to put the NOTs before or after in rule forms such as the above? To unsubscribe, send the words 'unsubscribe jess-users [EMAIL PROTECTED]' in the BODY of a message to [EMAIL PROTECTED], NOT to the list (use your own address!) List problems? Notify [EMAIL PROTECTED] . To unsubscribe, send the words 'unsubscribe jess-users [EMAIL PROTECTED]' in the BODY of a message to [EMAIL PROTECTED], NOT to the list (use your own address!) List problems? Notify [EMAIL PROTECTED]
JESS: Preferred rules formulation using NOT CE
Which is more efficient: (DOMAIN::planned-process (host-id ?host) (id ?pid) (plan ?plan)) (not (DOMAIN::host-association (host ?host))) (not (DOMAIN::decommission-process (process ?pid))) or (not (DOMAIN::host-association (host ?host))) (not (DOMAIN::decommission-process (process ?pid))) (DOMAIN::planned-process (host-id ?host) (id ?pid) (plan ?plan)) Assuming that there are a large number of DOMAIN::planned-process facts in the system. Are they essentially equivalent? Also, in general, is it more efficient to put the NOTs before or after in rule forms such as the above?
Re: JESS: Setting Shadow Facts In Defrules
Note that Jess also understands getter and setter conventions, so: (set ?door state "open") is equivalent to (?door setState "open") On Nov 17, 2008, at 7:44 AM, Wolfgang Laun wrote: The Jess User Manual 5.3.2 explains about the OBJECT slot in shadow facts which you get in addition to those derived from the Java class fields. It contains a reference to the Java object. Chapter 8 contains details about calling methods on Java objects. For instance, (?door setState "open") is equivalent to Java's Door door = ...; ... door.setState( "open" ); On Mon, Nov 17, 2008 at 2:35 PM, John Chrysakis <[EMAIL PROTECTED]> wrote: And what door symbols?? Could you be more specific of using OBJECT ?door please? One of my ideas is to pass the name of each instance a On Mon, 17 Nov 2008, Ernest Friedman-Hill wrote: > (defrule open-door > (Door {state == "closed"} (OBJECT ?door)) > => > (?door setState "open")) > > On Nov 17, 2008, at 5:33 AM, John Chrysakis wrote: > > > > > Hello to jess community, > > > > I am having a question. > > > > Till now I have used shadow facts through jess api to develop a rule > > base system. In eaSrch defrule where I need one slot the corresponding > > getXXX method was called to retrieve its value. e.g getstate() for > > the slot state. > > Example of defrule: (Door {state == "closed"}) => ... > > > > > > Now I need to set the slot from a defule. How Can I Do that? > > I have a setstate method but how should I write the rule? > > > > thanks in advance! > > > > > > John CH. > > > > > > > > To unsubscribe, send the words 'unsubscribe jess-users > > [EMAIL PROTECTED]' > > in the BODY of a message to [EMAIL PROTECTED], NOT to the list > > (use your own address!) List problems? Notify [EMAIL PROTECTED] > > . > > > > - > Ernest Friedman-Hill > Informatics & Decision Sciences, Sandia National Laboratories > PO Box 969, MS 9012, Livermore, CA 94550 > http://www.jessrules.com > > > > > > > > > To unsubscribe, send the words 'unsubscribe jess-users [EMAIL PROTECTED] ' > in the BODY of a message to [EMAIL PROTECTED], NOT to the list > (use your own address!) List problems? Notify [EMAIL PROTECTED] . > > > To unsubscribe, send the words 'unsubscribe jess-users [EMAIL PROTECTED]' in the BODY of a message to [EMAIL PROTECTED], NOT to the list (use your own address!) List problems? Notify [EMAIL PROTECTED] .
Re: JESS: A "proper" prolog interpreter?
No, I understand that. It's just that what I've currently done hasn't needed anything more than what JESS provides. I am taking a look at CHR again, and looking to see what's under the hood and what the capabilities are. On Nov 5, 2008, at 5:17 AM, Peter Van Weert wrote: Hal Hildebrand wrote: I had tried to take a look at CHR early on in my current project, but what I realized was that my particular problem wasn't so much handling constraints Don't let the name fool you: CHR may have originally be designed to solely handler constraints, it has grown to a powerful general purpose language. CHR constraint's are nothing else then what in production rule's speak is called a pattern (CHR rules are productions, etc). Peter To unsubscribe, send the words 'unsubscribe jess-users [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 "proper" prolog interpreter?
I had tried to take a look at CHR early on in my current project, but what I realized was that my particular problem wasn't so much handling constraints as it was creating dynamically adaptive, intelligent workflows. So I didn't follow up on my initial interests. I'll take another look at CHR now that I understand the space far better than I did a couple of years ago. It could well be. But realistically, it looks like I'll have to find a Prolog system and go through Reiter's work using it before even attempting to cross the beams and get creative... On Nov 4, 2008, at 8:09 AM, Peter Van Weert wrote: Hal Hildebrand wrote: Thanks, this is helpful. The main issue I'm going to have with this is the implicit backward chaining in Prolog... Will have to do a lot more investigation to see if JESS is even suitable for these investigations. Most current Prolog systems (including SICStus, SWI, XSB, YAP, B- Prolog and Ciao Prolog) ship with a forward chaining language extension fairly similar to Jess called Constraint Handling Rules (CHR) (see for instance http://www.cs.kuleuven.be/~dtai/projects/CHR/ ). CHR and Prolog can be mixed freely, thus obtaining a powerful combination of forward chaining CHR rules, and Prolog's backward chaining clauses. Maybe this is more or less what you need? Cheers, Peter To unsubscribe, send the words 'unsubscribe jess-users [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 "proper" prolog interpreter?
Thanks, this is helpful. The main issue I'm going to have with this is the implicit backward chaining in Prolog... Will have to do a lot more investigation to see if JESS is even suitable for these investigations. On Nov 4, 2008, at 12:24 AM, Gary Hallmark wrote: Hal, Jess' NOT CE does not implement NAF. It implements "inflationary negation" semantics. Consider: if not(P(1)) then print("fail."). if P(0) then P(1). P(0). Prolog will never fail. Jess may fail, depending on conflict resolution. Jess semantics is the usual semantics for production rules. Haley's does have NAF, though. Hal Hildebrand wrote: I'm doing some offline research on Reiter's GOLOG and came across hi assertion that he requires a "proper prolog interpreter". Since I'm going to be using JESS rather than a prolog interpreter for this bit of investigation, I was wondering if JESS actually does meet his requirement: A /proper/ Prolog interpreter is one that evaluates a negative literal not *A*, using negation-as-failure, and moreover, does so /only when (at the time of evaluation)/ the atom *A* /is ground/. When *A* is not ground, the interpreter may suspend its evaluation, working on other literals until (with luck) *A* does become ground, or it may abort its computation. Either way, it never tries to fail on non-ground atoms Obviously, I'm way out of my league here if I don't know the answer to the question as to whether JESS satisfies this requirement, but I thought I'd get the answer from those who do know. Thanks. To unsubscribe, send the words 'unsubscribe jess-users [EMAIL PROTECTED]' in the BODY of a message to [EMAIL PROTECTED], NOT to the list (use your own address!) List problems? Notify [EMAIL PROTECTED] . To unsubscribe, send the words 'unsubscribe jess-users [EMAIL PROTECTED]' in the BODY of a message to [EMAIL PROTECTED], NOT to the list (use your own address!) List problems? Notify [EMAIL PROTECTED]
Re: JESS: A "proper" prolog interpreter?
Thanks, Peter. Your point about there not being a "proper" Prolog interpreter according to that definition is shared by Reiter. On Nov 4, 2008, at 12:23 AM, Peter Van Weert wrote: Hal Hildebrand wrote: I'm doing some offline research on Reiter's GOLOG and came across hi assertion that he requires a "proper prolog interpreter". Since I'm going to be using JESS rather than a prolog interpreter for this bit of investigation, I was wondering if JESS actually does meet his requirement: A /proper/ Prolog interpreter is one that evaluates a negative literal not *A*, using negation-as-failure, and moreover, does so /only when (at the time of evaluation)/ the atom *A* /is ground/. When *A* is not ground, the interpreter may suspend its evaluation, working on other literals until (with luck) *A* does become ground, or it may abort its computation. Either way, it never tries to fail on non-ground atoms Obviously, I'm way out of my league here if I don't know the answer to the question as to whether JESS satisfies this requirement, but I thought I'd get the answer from those who do know. In a way it does, but probably not the way you want. Its true that Jess will never try to fail on non-ground atoms, but only because neither non-ground atoms or negation-as-failure are supported by Jess. Jess is not Prolog, nor will it ever be. Jess is a forward chaining rule engine, Prolog is a backward chaining engine with built-in chronological backtracking. Jess only supports ground data (and objects), whereas Prolog reasons over non-ground logical data. So, though there is an overlap in application areas, Prolog and Jess are quite different languages. Btw: I haven't read Reiter's work, so I do not know why he's defining a "proper" Prolog interpreter that way, but I do know that using that definition no Prolog implementation I know of is "proper", nor should they be. All Prolog engines attempt negation-as-failure for non-ground data, and I'm pretty sure that's also what the Prolog language standard demands. Peter To unsubscribe, send the words 'unsubscribe jess-users [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 "proper" prolog interpreter?
I'm doing some offline research on Reiter's GOLOG and came across hi assertion that he requires a "proper prolog interpreter". Since I'm going to be using JESS rather than a prolog interpreter for this bit of investigation, I was wondering if JESS actually does meet his requirement: A proper Prolog interpreter is one that evaluates a negative literal not A, using negation-as-failure, and moreover, does so only when (at the time of evaluation) the atom A is ground. When A is not ground, the interpreter may suspend its evaluation, working on other literals until (with luck) A does become ground, or it may abort its computation. Either way, it never tries to fail on non-ground atoms Obviously, I'm way out of my league here if I don't know the answer to the question as to whether JESS satisfies this requirement, but I thought I'd get the answer from those who do know. Thanks.
Re: JESS: Test for null
Are you talking about whether the slot is "nil" or not? You can just do: (some-slot nil) to match for an empty slot or (some-slot ~nil) to match a non-empty slot On Oct 30, 2008, at 7:58 AM, David Coyle wrote: Hello: I'm working with objects that have numerous relationships to others. There are a number of times where I need to simply check whether a particular relationship is or is not null, without caring about the actual destination object itself. I haven't found an appropriate function: does one exist, or is there a standard approach to determining null? thanks, -dave- David Coyle PhD Lead Web Application Architect m: 919.454.7770 www.livescribe.com -- LiveScribe, Inc. 7677 Oakport St. 12th Floor Oakland, CA 94621 To unsubscribe, send the words 'unsubscribe jess-users [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: accumulate not setting variable?
No problem. I was more concerned for my sanity than I was requiring the functionality. Appreciate the look-see. On Oct 17, 2008, at 7:25 AM, Ernest Friedman-Hill wrote: Unfortunately accumulate handles only single patterns right now, not groups like the "and" you've used below. Using a group will not give an error message in most cases -- you'll just get a broken rule, which is what's happening here. On Oct 16, 2008, at 2:01 PM, Hal Hildebrand wrote: (defrule allocate-resource (declare (auto-focus TRUE)) (DOMAIN::group (id ?group) (unit-cpu ?unit-cpu) (unit-memory ? unit-memory)) ?deployment-state <- (DOMAIN::deployment-state (placement-strategy ?strategy) (placmeent-type ?type) (id ? state) (plan ?plan) (current-cpu ?current-cpu) (current-memory ? current-memory)) (DOMAIN::host-association (host ?host) (state ?state)) (DOMAIN::deployment-plan (id ?plan) (group ?group) (maximum-memory ?maximum-memory&:(<= (+ ?current-memory ? unit-memory) ?maximum-memory)) (maximum-cpu ?maximum-cpu&:(<= (+ ?current-cpu ?unit-cpu) ? maximum-cpu)) {minimum-memory <= maximum-memory && minimum-cpu <= maximum- cpu} {(minimum-memory > ?current-memory) || (minimum-cpu > ? current-cpu)}) ?candidate <- (DOMAIN::host-resources (id ?candidate) (host ?host) (available-memory ?available-memory&:(>= ?available-memory ? unit-memory)) (available-cpu ?available-cpu&:(>= ?available-cpu ?unit-cpu))) ?host-resources <- (accumulate (bind ?resources new jess.ValueVector) (?resources add ?r) ?resources (and (DOMAIN::host-association (host ?h) (state ?state)) (DOMAIN::host-resources (id ?r) (host ?h)) ) ) => (bind ?resource (select-resource ?candidate ?unit-cpu ?unit- memory (accumulate-resources ?host-resources) ?strategy ?type)) (modify ?resource (available-memory (- (fact-slot-value ?resource available- memory) ?unit-memory)) (available-cpu (- (fact-slot-value ?resource available-cpu) ? unit-cpu))) (assert (DOMAIN::resource (host ?host) (plan ?plan) (memory ? unit-memory) (cpu ?unit-cpu))) (modify ?deployment-state (current-cpu (+ ?current-cpu ?unit-cpu)) (current-memory (+ ? current-memory ?unit-memory))) ) The variable ?host-resources is the one which is remains undefined. Note that if ?candidate is set, the accumulated set should have at least 1 member... On Oct 16, 2008, at 10:54 AM, Ernest Friedman-Hill wrote: Well, off the top of my head, this should only happen if the accumulate is in an "or", and the rule is firing on a branch not containing the accumulate. Can I see the rule? Under what circumstances with the accumulate CE not set the variable? For example: ?var <- (accumulate ) When will ?var not be set? What I'm seeing is that I'm using accumulate as the last pattern on the LHS of a rule. The rule is evaluated and I'm using the variable assigned to the result of the accumulate CE and Jess is throwing the exception "No such variable var". As you can imagine, this is driving me rather batty trying to figure out what I'm doing wrong... To unsubscribe, send the words 'unsubscribe jess-users [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 Informatics & Decision Sciences, Sandia National Laboratories PO Box 969, MS 9012, Livermore, CA 94550 http://www.jessrules.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 Informatics & Decision Sciences, Sandia National Laboratories PO Box 969, MS 9012, Livermore, CA 94550 http://www.jessrules.com To unsubscribe, send the words 'unsubscribe jess-users [EMAIL PROTECTED]' in the BODY of a message to [EMAIL PROTECTED], NOT to the list (use your own address!) List problems? Notify [EMAIL PROTECTED] . To unsubscribe, send the words 'unsubscribe jess-users [EMAIL PROTECTED]' in the BODY of a message to [EMAIL PROTECTED], NOT to the list (use your own address!) List problems? Notify [EMAIL PROTECTED]
Re: JESS: accumulate not setting variable?
(defrule allocate-resource (declare (auto-focus TRUE)) (DOMAIN::group (id ?group) (unit-cpu ?unit-cpu) (unit-memory ? unit-memory)) ?deployment-state <- (DOMAIN::deployment-state (placement-strategy ?strategy) (placmeent-type ?type) (id ? state) (plan ?plan) (current-cpu ?current-cpu) (current-memory ? current-memory)) (DOMAIN::host-association (host ?host) (state ?state)) (DOMAIN::deployment-plan (id ?plan) (group ?group) (maximum-memory ?maximum-memory&:(<= (+ ?current-memory ?unit- memory) ?maximum-memory)) (maximum-cpu ?maximum-cpu&:(<= (+ ?current-cpu ?unit-cpu) ? maximum-cpu)) {minimum-memory <= maximum-memory && minimum-cpu <= maximum- cpu} {(minimum-memory > ?current-memory) || (minimum-cpu > ? current-cpu)}) ?candidate <- (DOMAIN::host-resources (id ?candidate) (host ?host) (available-memory ?available-memory&:(>= ?available-memory ? unit-memory)) (available-cpu ?available-cpu&:(>= ?available-cpu ?unit-cpu))) ?host-resources <- (accumulate (bind ?resources new jess.ValueVector) (?resources add ?r) ?resources (and (DOMAIN::host-association (host ?h) (state ?state)) (DOMAIN::host-resources (id ?r) (host ?h)) ) ) => (bind ?resource (select-resource ?candidate ?unit-cpu ?unit- memory (accumulate-resources ?host-resources) ?strategy ?type)) (modify ?resource (available-memory (- (fact-slot-value ?resource available- memory) ?unit-memory)) (available-cpu (- (fact-slot-value ?resource available-cpu) ? unit-cpu))) (assert (DOMAIN::resource (host ?host) (plan ?plan) (memory ?unit- memory) (cpu ?unit-cpu))) (modify ?deployment-state (current-cpu (+ ?current-cpu ?unit-cpu)) (current-memory (+ ? current-memory ?unit-memory))) ) The variable ?host-resources is the one which is remains undefined. Note that if ?candidate is set, the accumulated set should have at least 1 member... On Oct 16, 2008, at 10:54 AM, Ernest Friedman-Hill wrote: Well, off the top of my head, this should only happen if the accumulate is in an "or", and the rule is firing on a branch not containing the accumulate. Can I see the rule? Under what circumstances with the accumulate CE not set the variable? For example: ?var <- (accumulate ) When will ?var not be set? What I'm seeing is that I'm using accumulate as the last pattern on the LHS of a rule. The rule is evaluated and I'm using the variable assigned to the result of the accumulate CE and Jess is throwing the exception "No such variable var". As you can imagine, this is driving me rather batty trying to figure out what I'm doing wrong... To unsubscribe, send the words 'unsubscribe jess-users [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 Informatics & Decision Sciences, Sandia National Laboratories PO Box 969, MS 9012, Livermore, CA 94550 http://www.jessrules.com To unsubscribe, send the words 'unsubscribe jess-users [EMAIL PROTECTED]' in the BODY of a message to [EMAIL PROTECTED], NOT to the list (use your own address!) List problems? Notify [EMAIL PROTECTED] .
JESS: accumulate not setting variable?
Under what circumstances with the accumulate CE not set the variable? For example: ?var <- (accumulate ) When will ?var not be set? What I'm seeing is that I'm using accumulate as the last pattern on the LHS of a rule. The rule is evaluated and I'm using the variable assigned to the result of the accumulate CE and Jess is throwing the exception "No such variable var". As you can imagine, this is driving me rather batty trying to figure out what I'm doing wrong... To unsubscribe, send the words 'unsubscribe jess-users [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 use templates inside facts
I treat facts like I would rows in a relational database, with templates as tables, and slots acting as keys to other facts. So, a slot, or combination of slots, contain the key which identifies the fact in question. The question, then is how far you normalize your domain. For me, this makes things very, very simple and quite natural - but then, I work for a relational database vendor so perhaps we're just wired that way... On Sep 29, 2008, at 3:19 PM, levent kent wrote: Hmm, thanks.It was very explanatory that Jess does not work like prolog. So, now I would ask what do Jess-people do, when they have to define nodes with 2 coordinates or an employee with id,name,surname,wage? It would be very confusing to flatten all the data. I guess there should be a way to do it. Should we use java classes for that purpose or are there different ways to do it? Thanks for all replies, all were very understandable for me :) On Mon, Sep 29, 2008 at 9:14 PM, Gary Hallmark <[EMAIL PROTECTED] > wrote: Jess and most other production rule languages do not have Herbrand terms that prolog-like languages use to model tree-structured facts. In your case you can simply flatten your data model to a single fact with 2 x and 2 y coordinates, as Hal suggests. In more complex cases you may want to assert several linked facts -- but your rules may need several patterns and tests to put th pieces back together again. Levent Kent wrote: Hi, I am a new user fo Jess and try to get some understanding for the engine. I cant understand why the code below does not work. (deffacts graph-links3 (link3 (gnode3 0 0) (gnode3 2 1)) ) Here, I am trying to describe links of nodes with 2 coordinates. How should I do that? I also tried this version: (deftemplate gnode (slot x) (slot y)) (deftemplate link (slot start) (slot end)) (deffacts graph-links (link (start (gnode (x 0) (y 0))) (end (gnode (x 2) (y 1 (link (start (gnode (x 2) (y 1))) (end (gnode (x 1) (y 2 (link (start (gnode (x 2) (y 1))) (end (gnode (x 2) (y 0 (link (start (gnode (x 2) (y 0))) (end (gnode (x 1) (y 1 (link (start (gnode (x 1) (y 1))) (end (gnode (x 0) (y 2 (link (start (gnode (x 0) (y 2))) (end (gnode (x 2) (y 3 (link (start (gnode (x 1) (y 2))) (end (gnode (x 1) (y 3 ) I am always geetıng the error message: Jess reported an error in routine Funcall.execute while executing (gnode3 0 0) while executing assert from deffacts MAIN::graph-links3 while executing (reset). Message: Undefined function gnode3. or Jess reported an error in routine Funcall.execute while executing (gnode (x 0) (y 0)) while executing assert from deffacts MAIN::graph-links while executing (reset). Message: Undefined function gnode. Some little help would save me from confusion. I hope this message will be accepted by the mailing list, because I am not sure if my messages are delivered successfully. Thanks, Levent To unsubscribe, send the words 'unsubscribe jess-users [EMAIL PROTECTED]' in the BODY of a message to [EMAIL PROTECTED], NOT to the list (use your own address!) List problems? Notify [EMAIL PROTECTED] . -- Levent Kent
Re: JESS: How to use templates inside facts
You'll have to use something like: (deftemplate link (slot x1) (slot y1) (slot x2) (slot y2) ) On Sep 28, 2008, at 1:57 PM, Levent Kent wrote: Hi, I am a new user fo Jess and try to get some understanding for the engine. I cant understand why the code below does not work. (deffacts graph-links3 (link3 (gnode3 0 0) (gnode3 2 1)) ) Here, I am trying to describe links of nodes with 2 coordinates. How should I do that? I also tried this version: (deftemplate gnode (slot x) (slot y)) (deftemplate link (slot start) (slot end)) (deffacts graph-links (link (start (gnode (x 0) (y 0))) (end (gnode (x 2) (y 1 (link (start (gnode (x 2) (y 1))) (end (gnode (x 1) (y 2 (link (start (gnode (x 2) (y 1))) (end (gnode (x 2) (y 0 (link (start (gnode (x 2) (y 0))) (end (gnode (x 1) (y 1 (link (start (gnode (x 1) (y 1))) (end (gnode (x 0) (y 2 (link (start (gnode (x 0) (y 2))) (end (gnode (x 2) (y 3 (link (start (gnode (x 1) (y 2))) (end (gnode (x 1) (y 3 ) I am always geetıng the error message: Jess reported an error in routine Funcall.execute while executing (gnode3 0 0) while executing assert from deffacts MAIN::graph-links3 while executing (reset). Message: Undefined function gnode3. or Jess reported an error in routine Funcall.execute while executing (gnode (x 0) (y 0)) while executing assert from deffacts MAIN::graph-links while executing (reset). Message: Undefined function gnode. Some little help would save me from confusion. I hope this message will be accepted by the mailing list, because I am not sure if my messages are delivered successfully. Thanks, Levent -- View this message in context: http://www.nabble.com/How-to-use-templates-inside-facts-tp19715452p19715452.html Sent from the Jess mailing list archive at Nabble.com. To unsubscribe, send the words 'unsubscribe jess-users [EMAIL PROTECTED]' in the BODY of a message to [EMAIL PROTECTED], NOT to the list (use your own address!) List problems? Notify [EMAIL PROTECTED] . To unsubscribe, send the words 'unsubscribe jess-users [EMAIL PROTECTED]' in the BODY of a message to [EMAIL PROTECTED], NOT to the list (use your own address!) List problems? Notify [EMAIL PROTECTED]
Re: JESS: Replacing Facts
How would you write the rules relying on the referred to facts? Just curious to find out, as this would be a useful technique... On Sep 11, 2008, at 6:00 PM, [EMAIL PROTECTED] wrote: Thank you Wolfgang, this is a clever idea. I will think about it some more. On Sep 11, 2008, at 10:24 AM, Wolfgang Laun wrote: Perhaps a wrapper fact with a single slot containing a reference of the actual fact could server as a stable point of reference. That means that the many references in other "real" facts would remain stable, but, of course, dereferencing becomes more complicated. Only the pointer in the wrapper would have to be updated. To unsubscribe, send the words 'unsubscribe jess-users [EMAIL PROTECTED]' in the BODY of a message to [EMAIL PROTECTED], NOT to the list (use your own address!) List problems? Notify [EMAIL PROTECTED] . To unsubscribe, send the words 'unsubscribe jess-users [EMAIL PROTECTED]' in the BODY of a message to [EMAIL PROTECTED], NOT to the list (use your own address!) List problems? Notify [EMAIL PROTECTED]
Re: JESS: Re: functions as values and calling them
Thanks for providing the function ;) On Aug 25, 2008, at 3:55 AM, Wolfgang Laun wrote: Thanks for finding this bug. You have seen that this can (now) be done using the builtin call. Just to set the record straight, the fix should be in one if earlier, where we test that some things have to be evaluated in the current context before we really know what we have. if (valArg1.type() == RU.VARIABLE || valArg1.type() == RU.FUNCALL) || valArg1.type() == RU.BINDING ) { valArg1 = valArg1.resolveValue(context); } // This must now be a lambda expression or a binding. if (valArg1.type() != RU.LAMBDA ) { throw new JessException( NAME, "first argument is not a lambda definition.", Integer.toString(valArg1.type())); } On Thu, Aug 14, 2008 at 6:51 PM, Hal Hildebrand <[EMAIL PROTECTED]> wrote: So I figured out how to fix this to do what I want. Basically, the CallLambda Userfunction needs to check that the first argument is a RU.BINDING in addtion to RU.LAMBDA. This this fix, things work as I would like them to. Nice addition - and powerful, too. public class CallLambda implements Userfunction { private static final String NAME = "lcall"; /** Get the name of the Jess function. * @see jess.Userfunction#getName() */ public String getName() { return NAME; } /** Call the userfunction * @see jess.Userfunction#call(jess.ValueVector, jess.Context) */ public Value call(ValueVector vv, Context context) throws JessException { int narg = vv.size() - 1; // Check that we have at least one element. if (narg < 1) throw new JessException(NAME, "missing argument.", ""); // Evluate a variable or a function call. Value valArg1 = vv.get(1); if (valArg1.type() == RU.VARIABLE || valArg1.type() == RU.FUNCALL) { valArg1 = valArg1.resolveValue(context); } // This must now be a lambda expression or a binding. if (valArg1.type() != RU.LAMBDA && valArg1.type() != RU.BINDING) { throw new JessException( NAME, "first argument is not a lambda definition.", Integer.toString(valArg1.type())); } // Get the function value,... Deffunction d = (Deffunction) valArg1.functionValue(context); // ...construct the argument list and... ValueVector av = new ValueVector(narg); av.add(d.getName()); for (int iArg = 2; iArg <= narg; iArg++) { av.add(vv.get(iArg)); } // ...call and return the result. return d.call(av, context); } } On Aug 14, 2008, at 9:04 AM, Hal Hildebrand wrote: Have tried using the CallLambda Userfunction class from http://herzberg.ca.sandia.gov/jesswiki/view?LambdaCallUserFunction (load-function CallLambda) (deftemplate functional-fact (slot func) ) (bind ?f (lambda (?x) (> 1 ?x))) (assert (functional-fact (func ?f))) (defrule test-me (functional-fact (func ?f)) (test (lcall ?f 0)) => (printout t "1 > 0" crlf)) fails with: Jess reported an error in routine lcall while executing (lcall ?f 0) while executing 'test' CE while executing rule LHS (TECT). Message: first argument is not a lambda definition. 4096. Program text: ( defrule test-me ( functional-fact ( func ?f ) ) ( test ( lcall ?f 0 ) ) = > ( printout t "1 > 0" crlf ) ) at line 17. Seems as though nothing I can do with the slot value will turn it into a function call. On Aug 14, 2008, at 8:23 AM, Hal Hildebrand wrote: I would like to have functions contained in the slot value of a fact and then apply them. I can create and assign the function values by using (lambda ...), which seems to be what I'm looking for on that side of the equation: (deftemplate functional-fact (slot func) ) (assert (functional-fact (func (lambda (?x) (> 1 ?x) However, the question becomes how do I actually call this function? What I would like to do is use these in test CE: (deftemplate functional-fact (slot func) ) (assert (functional-fact (func (lambda (?x) (> 1 ?x) (defrule test-me (functional-fact (func ?function)) (test (?function 0)) => (printout t "1 > 0" crlf)) However, this does not work as I would expect instead failing with: Jess reported an error in routine call while executing (call ?function 0) while executing 'test' CE while executing rule LHS (TECT). Message: No method named '0' found in class jess.Deffunction. Program text: ( defrule test-me ( functional-fact ( func ? function ) ) ( test ( ?function 0 ) ) = > ( printout t "1 > 0" crlf ) ) at line 1
Re: JESS: functions as values and calling them
Yea, asserting before defining the rule definitely has a tendency to make things confusing... On Aug 24, 2008, at 8:42 PM, Jason Morris wrote: Hi Hal, Clean up your code a bit, and I think it works fine. :-) ; hal.clp (clear) (watch all) (deftemplate functional-fact (slot func)) (defrule test-me (functional-fact (func ?function)) (test (?function 0)) => (printout t "1 > 0" crlf)) ; PROGRAM (reset) (assert (functional-fact (func (lambda (?x) (> 1 ?x) (run) ; OUTPUT ;--- ; Jess> (batch "hal.clp") ; TRUE ; Jess> (batch "hal.clp") ; MAIN::test-me: +1+1+1+t ; ==> Focus MAIN ; ==> f-0 (MAIN::initial-fact) ; ==> f-1 (MAIN::functional-fact (func )) ; ==> Activation: MAIN::test-me : f-1 ; FIRE 1 MAIN::test-me f-1 ; 1 > 0 ; <== Focus MAIN ; 1 ; Jess> Cheers, Jason On Thu, Aug 14, 2008 at 11:23 AM, Hal Hildebrand <[EMAIL PROTECTED] > wrote: I would like to have functions contained in the slot value of a fact and then apply them. I can create and assign the function values by using (lambda ...), which seems to be what I'm looking for on that side of the equation: (deftemplate functional-fact (slot func) ) (assert (functional-fact (func (lambda (?x) (> 1 ?x) However, the question becomes how do I actually call this function? What I would like to do is use these in test CE: (deftemplate functional-fact (slot func) ) (assert (functional-fact (func (lambda (?x) (> 1 ?x) (defrule test-me (functional-fact (func ?function)) (test (?function 0)) => (printout t "1 > 0" crlf)) However, this does not work as I would expect instead failing with: Jess reported an error in routine call while executing (call ?function 0) while executing 'test' CE while executing rule LHS (TECT). Message: No method named '0' found in class jess.Deffunction. Program text: ( defrule test-me ( functional-fact ( func ? function ) ) ( test ( ?function 0 ) ) = > ( printout t "1 > 0" crlf ) ) at line 11. Clearly, I'm not understanding this and would appreciate any help from those on the list. Thanks. -- --- Jason Morris Morris Technical Solutions LLC [EMAIL PROTECTED] (517) 304-5883
JESS: Re: functions as values and calling them
So I figured out how to fix this to do what I want. Basically, the CallLambda Userfunction needs to check that the first argument is a RU.BINDING in addtion to RU.LAMBDA. This this fix, things work as I would like them to. Nice addition - and powerful, too. public class CallLambda implements Userfunction { private static final String NAME = "lcall"; /** Get the name of the Jess function. * @see jess.Userfunction#getName() */ public String getName() { return NAME; } /** Call the userfunction * @see jess.Userfunction#call(jess.ValueVector, jess.Context) */ public Value call(ValueVector vv, Context context) throws JessException { int narg = vv.size() - 1; // Check that we have at least one element. if (narg < 1) throw new JessException(NAME, "missing argument.", ""); // Evluate a variable or a function call. Value valArg1 = vv.get(1); if (valArg1.type() == RU.VARIABLE || valArg1.type() == RU.FUNCALL) { valArg1 = valArg1.resolveValue(context); } // This must now be a lambda expression or a binding. if (valArg1.type() != RU.LAMBDA && valArg1.type() != RU.BINDING) { throw new JessException( NAME, "first argument is not a lambda definition.", Integer.toString(valArg1.type())); } // Get the function value,... Deffunction d = (Deffunction) valArg1.functionValue(context); // ...construct the argument list and... ValueVector av = new ValueVector(narg); av.add(d.getName()); for (int iArg = 2; iArg <= narg; iArg++) { av.add(vv.get(iArg)); } // ...call and return the result. return d.call(av, context); } } On Aug 14, 2008, at 9:04 AM, Hal Hildebrand wrote: Have tried using the CallLambda Userfunction class from http://herzberg.ca.sandia.gov/jesswiki/view?LambdaCallUserFunction (load-function CallLambda) (deftemplate functional-fact (slot func) ) (bind ?f (lambda (?x) (> 1 ?x))) (assert (functional-fact (func ?f))) (defrule test-me (functional-fact (func ?f)) (test (lcall ?f 0)) => (printout t "1 > 0" crlf)) fails with: Jess reported an error in routine lcall while executing (lcall ?f 0) while executing 'test' CE while executing rule LHS (TECT). Message: first argument is not a lambda definition. 4096. Program text: ( defrule test-me ( functional-fact ( func ?f ) ) ( test ( lcall ?f 0 ) ) = > ( printout t "1 > 0" crlf ) ) at line 17. Seems as though nothing I can do with the slot value will turn it into a function call. On Aug 14, 2008, at 8:23 AM, Hal Hildebrand wrote: I would like to have functions contained in the slot value of a fact and then apply them. I can create and assign the function values by using (lambda ...), which seems to be what I'm looking for on that side of the equation: (deftemplate functional-fact (slot func) ) (assert (functional-fact (func (lambda (?x) (> 1 ?x) However, the question becomes how do I actually call this function? What I would like to do is use these in test CE: (deftemplate functional-fact (slot func) ) (assert (functional-fact (func (lambda (?x) (> 1 ?x) (defrule test-me (functional-fact (func ?function)) (test (?function 0)) => (printout t "1 > 0" crlf)) However, this does not work as I would expect instead failing with: Jess reported an error in routine call while executing (call ?function 0) while executing 'test' CE while executing rule LHS (TECT). Message: No method named '0' found in class jess.Deffunction. Program text: ( defrule test-me ( functional-fact ( func ? function ) ) ( test ( ?function 0 ) ) = > ( printout t "1 > 0" crlf ) ) at line 11. Clearly, I'm not understanding this and would appreciate any help from those on the list. Thanks.
JESS: Re: functions as values and calling them
Have tried using the CallLambda Userfunction class from http://herzberg.ca.sandia.gov/jesswiki/view?LambdaCallUserFunction (load-function CallLambda) (deftemplate functional-fact (slot func) ) (bind ?f (lambda (?x) (> 1 ?x))) (assert (functional-fact (func ?f))) (defrule test-me (functional-fact (func ?f)) (test (lcall ?f 0)) => (printout t "1 > 0" crlf)) fails with: Jess reported an error in routine lcall while executing (lcall ?f 0) while executing 'test' CE while executing rule LHS (TECT). Message: first argument is not a lambda definition. 4096. Program text: ( defrule test-me ( functional-fact ( func ?f ) ) ( test ( lcall ?f 0 ) ) = > ( printout t "1 > 0" crlf ) ) at line 17. Seems as though nothing I can do with the slot value will turn it into a function call. On Aug 14, 2008, at 8:23 AM, Hal Hildebrand wrote: I would like to have functions contained in the slot value of a fact and then apply them. I can create and assign the function values by using (lambda ...), which seems to be what I'm looking for on that side of the equation: (deftemplate functional-fact (slot func) ) (assert (functional-fact (func (lambda (?x) (> 1 ?x) However, the question becomes how do I actually call this function? What I would like to do is use these in test CE: (deftemplate functional-fact (slot func) ) (assert (functional-fact (func (lambda (?x) (> 1 ?x) (defrule test-me (functional-fact (func ?function)) (test (?function 0)) => (printout t "1 > 0" crlf)) However, this does not work as I would expect instead failing with: Jess reported an error in routine call while executing (call ?function 0) while executing 'test' CE while executing rule LHS (TECT). Message: No method named '0' found in class jess.Deffunction. Program text: ( defrule test-me ( functional-fact ( func ? function ) ) ( test ( ?function 0 ) ) = > ( printout t "1 > 0" crlf ) ) at line 11. Clearly, I'm not understanding this and would appreciate any help from those on the list. Thanks.
JESS: functions as values and calling them
I would like to have functions contained in the slot value of a fact and then apply them. I can create and assign the function values by using (lambda ...), which seems to be what I'm looking for on that side of the equation: (deftemplate functional-fact (slot func) ) (assert (functional-fact (func (lambda (?x) (> 1 ?x) However, the question becomes how do I actually call this function? What I would like to do is use these in test CE: (deftemplate functional-fact (slot func) ) (assert (functional-fact (func (lambda (?x) (> 1 ?x) (defrule test-me (functional-fact (func ?function)) (test (?function 0)) => (printout t "1 > 0" crlf)) However, this does not work as I would expect instead failing with: Jess reported an error in routine call while executing (call ?function 0) while executing 'test' CE while executing rule LHS (TECT). Message: No method named '0' found in class jess.Deffunction. Program text: ( defrule test-me ( functional-fact ( func ? function ) ) ( test ( ?function 0 ) ) = > ( printout t "1 > 0" crlf ) ) at line 11. Clearly, I'm not understanding this and would appreciate any help from those on the list. Thanks.
JESS: Re: lazy nature of default-dynamic
Okay, this seems to be not the case - i.e. that the evaluation of the default-dynamic outside of the engine seems to work just fine. On Aug 2, 2008, at 8:05 AM, Hal Hildebrand wrote: I would like to create facts with the values initialized to unique value for each asserted fact. I do this, naturally, using the default-dynamic. However, I'm using the listener hooks and need to access this value outside of the rules engine proper. When I do so, the evaluation of the function kicks off and sets the slot. So I'm wondering about whether this messes up Jess' internal data structures, as the evaluation happens "outside" of the running of the rules engine - i.e. this is a modification not done via the modify() call to the engine. Further, is there a way to have this slot initialization performed immediately, upon the actual assert? I was thinking of trying to use defadvice and access these slots to force the evaluation, but I seem to recall that the assert is a special function which I can't apply defadvice to. To unsubscribe, send the words 'unsubscribe jess-users [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: lazy nature of default-dynamic
I would like to create facts with the values initialized to unique value for each asserted fact. I do this, naturally, using the default- dynamic. However, I'm using the listener hooks and need to access this value outside of the rules engine proper. When I do so, the evaluation of the function kicks off and sets the slot. So I'm wondering about whether this messes up Jess' internal data structures, as the evaluation happens "outside" of the running of the rules engine - i.e. this is a modification not done via the modify() call to the engine. Further, is there a way to have this slot initialization performed immediately, upon the actual assert? I was thinking of trying to use defadvice and access these slots to force the evaluation, but I seem to recall that the assert is a special function which I can't apply defadvice to. To unsubscribe, send the words 'unsubscribe jess-users [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: trigger when all referred elements of a list in a particular state?
On Jul 23, 2008, at 6:50 PM, Ernest Friedman-Hill wrote: The "forall" conditional element can do this: (defrule something-like-this (forall (some-state (list-o-things $? ?thing-id $?)) (thing (id ?thing-id) (state "2"))) => (do-something) ) This basically reads "If for all ways of matching the first pattern, there's a match for the second pattern..." Note one important difference: ?thing-id is not a multifield. It has to match just one item from the list. Yea, sorry 'bout that. It was a typo... Many thanks! This is fantastic. On Jul 23, 2008, at 8:53 PM, Hal Hildebrand wrote: Sorry for the wacky subject line, but can't think of a good way to describe what I'm attempting. Suppose I had something like the following: (deftemplate some-state (multislot list-o-things)) (deftemplate thing (slot id) (slot state (default "1"))) (defrule transition-2 (some-state (list-o-things $? $?thing-id $?)) ?thing <- (thing (id ?thing-id) (state "1")) => (modify ?thing (state "2")) ) (defrule transition-3 (some-state (list-o-things $? $?thing-id $?)) ?thing <- (thing (id ?thing-id) (state "2")) => (modify ?thing (state "3")) ) Note that the "some-state" fact multislot refers to the "thing" facts indirectly, through an id - this is important, as I cannot have the "things" embedded in the list, rather they have to be separate facts that stand on their own. What I would like to do is define a rule which will fire when all the elements referred to in the multi-slot are in a particular state. For example, I'd like to define a rule which detects when all of the "things" referred to in the list have "state" value of "2". Note that the size of the list can vary between instances of the "some-state", and the ids are literally UUIDs, so I can't simply lay down a rule which enumerates the id's of the "thing"s. I can't for the life of me figure out how to write such a rule. So a) is it possible at all... b) what would it look like if it was possible. Thanks for your consideration. To unsubscribe, send the words 'unsubscribe jess-users [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 Informatics & Decision Sciences, Sandia National Laboratories PO Box 969, MS 9012, Livermore, CA 94550 http://www.jessrules.com To unsubscribe, send the words 'unsubscribe jess-users [EMAIL PROTECTED]' in the BODY of a message to [EMAIL PROTECTED], NOT to the list (use your own address!) List problems? Notify [EMAIL PROTECTED] . To unsubscribe, send the words 'unsubscribe jess-users [EMAIL PROTECTED]' in the BODY of a message to [EMAIL PROTECTED], NOT to the list (use your own address!) List problems? Notify [EMAIL PROTECTED]
JESS: trigger when all referred elements of a list in a particular state?
Sorry for the wacky subject line, but can't think of a good way to describe what I'm attempting. Suppose I had something like the following: (deftemplate some-state (multislot list-o-things)) (deftemplate thing (slot id) (slot state (default "1"))) (defrule transition-2 (some-state (list-o-things $? $?thing-id $?)) ?thing <- (thing (id ?thing-id) (state "1")) => (modify ?thing (state "2")) ) (defrule transition-3 (some-state (list-o-things $? $?thing-id $?)) ?thing <- (thing (id ?thing-id) (state "2")) => (modify ?thing (state "3")) ) Note that the "some-state" fact multislot refers to the "thing" facts indirectly, through an id - this is important, as I cannot have the "things" embedded in the list, rather they have to be separate facts that stand on their own. What I would like to do is define a rule which will fire when all the elements referred to in the multi-slot are in a particular state. For example, I'd like to define a rule which detects when all of the "things" referred to in the list have "state" value of "2". Note that the size of the list can vary between instances of the "some-state", and the ids are literally UUIDs, so I can't simply lay down a rule which enumerates the id's of the "thing"s. I can't for the life of me figure out how to write such a rule. So a) is it possible at all... b) what would it look like if it was possible. Thanks for your consideration. To unsubscribe, send the words 'unsubscribe jess-users [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: load-function problem
Make sure the directory name of the project is the same as the name of the project. 7.1 has a bug in that if they are named differently, the resources can't be found - e.g. if your eclipse project is "my-proj", then it must be in a directory called "my-proj". On Feb 20, 2008, at 3:58 PM, Marco Zappatore wrote: Now, you say something about a "warning", and so maybe you're talking about the JessDE? In that case, you need to make sure the Userfunction class is on the Java build path of your project so that the editor can find it. Yes, I'm using the JessDE plugin for Eclipse and I have such a hierarchy in "\myWorkspace\myProject" folder: "\src\myPackage\*.java", "\bin\myPackage\*.class", "\srcJess\*.clp". The class MyUserFunctionClass.class belongs to "\bin\myPackage\" like other .class files, so it should be on my default build path but ir seems it is unreachable in the sense that the new Jess function defined inside that class is still undefined when you open in the JessDE the clp file in which it should be used. I'm sure that this problem has a simple solution because both java and jess codes are correct. To unsubscribe, send the words 'unsubscribe jess-users [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: Matching on multi-slot length
Nothing so fancy :). All I'm currently doing is simply allocating new process instances based on a target number of instances - either adding or subtracting - on various hosts. Kind of a quick and dirty allocation scheme for a demo. On Feb 20, 2008, at 8:02 AM, Peter Lin wrote: sounds like the rule is handling join/fork from a BPM graph? On Feb 20, 2008 10:24 AM, Hal Hildebrand <[EMAIL PROTECTED]> wrote: I only posted an abstraction to figure out my problem, leaving out the other details. What I'm doing is essentially modeling workflow which manages to some target number of instances, so the fact in question is further qualified by other attributes as you have indicated. On Feb 20, 2008, at 6:29 AM, Jason Morris wrote: Hi Hal, Peter & Wolfgang, >> The proposed solution does not compare a length with foo.desired, and binding of a multislot vaue should use a variable starting with $?. Hal, since you said you were satisfied with Peter's solution, I never posted my reply which anticipated Wolfgang's almost verbatim. However, if you really want what Peter was advocating then there is a bit more to it I think. You have to recall that Jess doesn't allow multiple facts to have identical slot values -- that means that no two foo facts could have the exact same multislot list and desired value. You may need this in your application, so you'd need some other slot like (slot id) to differentiate your facts. Also, Peter's version would fire twice for each pair of foo facts that had the same slot length, which is not what you want I'd think. The implementation below addresses these issues. Cheers, Jason ;; ;; list-len.clp ;; ;; (clear) (watch all) (deftemplate foo (slot id) (multislot my-list) (slot desired)) (deffacts init (foo (id 1) (my-list 1 2 3 4)) (foo (id 2) (my-list a b c d)) (foo (id 3) (my-list 5 6 7 8)) (foo (id 4) (my-list e f g h))) (defrule myrule ; Find a foo fact... (foo (id ?id1) (my-list $?list1)) ; ...and another fact of different id where the list lengths are the same... (foo (id ?id2&~?id1) (my-list $?list2&:(= (length$ ?list2) (length$ ?list1 ; ...such that we have not examined this pair of foo facts before. (not (has-fired ?id1 ?id2)) => ; Assert that this pair has been processed with a little logic trick. (assert (has-fired ?id2 ?id1)) (printout t "Lists lengths in foo facts " ?id1 " and " ?id2 " are equal!" crlf)) :: Program (reset) (run) ;MAIN::myrule: +1+1+1+2+1+1+2+t ; ==> Focus MAIN ; ==> f-0 (MAIN::initial-fact) ; ==> f-1 (MAIN::foo (id 1) (my-list 1 2 3 4) (desired nil)) ; ==> f-2 (MAIN::foo (id 2) (my-list a b c d) (desired nil)) ;==> Activation: MAIN::myrule : f-2, f-1, ;==> Activation: MAIN::myrule : f-1, f-2, ; ==> f-3 (MAIN::foo (id 3) (my-list 5 6 7 8) (desired nil)) ;==> Activation: MAIN::myrule : f-3, f-1, ;==> Activation: MAIN::myrule : f-3, f-2, ;==> Activation: MAIN::myrule : f-1, f-3, ;==> Activation: MAIN::myrule : f-2, f-3, ; ==> f-4 (MAIN::foo (id 4) (my-list e f g h) (desired nil)) ;==> Activation: MAIN::myrule : f-4, f-1, ;==> Activation: MAIN::myrule : f-4, f-2, ;==> Activation: MAIN::myrule : f-4, f-3, ;==> Activation: MAIN::myrule : f-1, f-4, ;==> Activation: MAIN::myrule : f-2, f-4, ;==> Activation: MAIN::myrule : f-3, f-4, ;FIRE 1 MAIN::myrule f-3, f-4, ; ==> f-5 (MAIN::has-fired 4 3) ;<== Activation: MAIN::myrule : f-4, f-3, ;Lists lengths in foo facts 3 and 4 are equal! ;FIRE 2 MAIN::myrule f-4, f-2, ; ==> f-6 (MAIN::has-fired 2 4) ;<== Activation: MAIN::myrule : f-2, f-4, ;Lists lengths in foo facts 4 and 2 are equal! ;FIRE 3 MAIN::myrule f-1, f-4, ; ==> f-7 (MAIN::has-fired 4 1) ;<== Activation: MAIN::myrule : f-4, f-1, ;Lists lengths in foo facts 1 and 4 are equal! ;FIRE 4 MAIN::myrule f-3, f-2, ; ==> f-8 (MAIN::has-fired 2 3) ;<== Activation: MAIN::myrule : f-2, f-3, ;Lists lengths in foo facts 3 and 2 are equal! ;FIRE 5 MAIN::myrule f-3, f-1, ; ==> f-9 (MAIN::has-fired 1 3) ;<== Activation: MAIN::myrule : f-1, f-3, ;Lists lengths in foo facts 3 and 1 are equal! ;FIRE 6 MAIN::myrule f-1, f-2, ; ==> f-10 (MAIN::has-fired 2 1) ;<== Activation: MAIN::myrule : f-2, f-1, ;Lists lengths in foo facts 1 and 2 are equal! ; <== Focus MAIN -- --- Jason Morris Morris Technical Solutions LLC http://www.morris-technical-solutions.com
Re: JESS: Matching on multi-slot length
I only posted an abstraction to figure out my problem, leaving out the other details. What I'm doing is essentially modeling workflow which manages to some target number of instances, so the fact in question is further qualified by other attributes as you have indicated. On Feb 20, 2008, at 6:29 AM, Jason Morris wrote: Hi Hal, Peter & Wolfgang, >> The proposed solution does not compare a length with foo.desired, and binding of a multislot vaue should use a variable starting with $?. Hal, since you said you were satisfied with Peter's solution, I never posted my reply which anticipated Wolfgang's almost verbatim. However, if you really want what Peter was advocating then there is a bit more to it I think. You have to recall that Jess doesn't allow multiple facts to have identical slot values -- that means that no two foo facts could have the exact same multislot list and desired value. You may need this in your application, so you'd need some other slot like (slot id) to differentiate your facts. Also, Peter's version would fire twice for each pair of foo facts that had the same slot length, which is not what you want I'd think. The implementation below addresses these issues. Cheers, Jason ;; ;; list-len.clp ;; ;; (clear) (watch all) (deftemplate foo (slot id) (multislot my-list) (slot desired)) (deffacts init (foo (id 1) (my-list 1 2 3 4)) (foo (id 2) (my-list a b c d)) (foo (id 3) (my-list 5 6 7 8)) (foo (id 4) (my-list e f g h))) (defrule myrule ; Find a foo fact... (foo (id ?id1) (my-list $?list1)) ; ...and another fact of different id where the list lengths are the same... (foo (id ?id2&~?id1) (my-list $?list2&:(= (length$ ?list2) (length$ ?list1 ; ...such that we have not examined this pair of foo facts before. (not (has-fired ?id1 ?id2)) => ; Assert that this pair has been processed with a little logic trick. (assert (has-fired ?id2 ?id1)) (printout t "Lists lengths in foo facts " ?id1 " and " ?id2 " are equal!" crlf)) :: Program (reset) (run) ;MAIN::myrule: +1+1+1+2+1+1+2+t ; ==> Focus MAIN ; ==> f-0 (MAIN::initial-fact) ; ==> f-1 (MAIN::foo (id 1) (my-list 1 2 3 4) (desired nil)) ; ==> f-2 (MAIN::foo (id 2) (my-list a b c d) (desired nil)) ;==> Activation: MAIN::myrule : f-2, f-1, ;==> Activation: MAIN::myrule : f-1, f-2, ; ==> f-3 (MAIN::foo (id 3) (my-list 5 6 7 8) (desired nil)) ;==> Activation: MAIN::myrule : f-3, f-1, ;==> Activation: MAIN::myrule : f-3, f-2, ;==> Activation: MAIN::myrule : f-1, f-3, ;==> Activation: MAIN::myrule : f-2, f-3, ; ==> f-4 (MAIN::foo (id 4) (my-list e f g h) (desired nil)) ;==> Activation: MAIN::myrule : f-4, f-1, ;==> Activation: MAIN::myrule : f-4, f-2, ;==> Activation: MAIN::myrule : f-4, f-3, ;==> Activation: MAIN::myrule : f-1, f-4, ;==> Activation: MAIN::myrule : f-2, f-4, ;==> Activation: MAIN::myrule : f-3, f-4, ;FIRE 1 MAIN::myrule f-3, f-4, ; ==> f-5 (MAIN::has-fired 4 3) ;<== Activation: MAIN::myrule : f-4, f-3, ;Lists lengths in foo facts 3 and 4 are equal! ;FIRE 2 MAIN::myrule f-4, f-2, ; ==> f-6 (MAIN::has-fired 2 4) ;<== Activation: MAIN::myrule : f-2, f-4, ;Lists lengths in foo facts 4 and 2 are equal! ;FIRE 3 MAIN::myrule f-1, f-4, ; ==> f-7 (MAIN::has-fired 4 1) ;<== Activation: MAIN::myrule : f-4, f-1, ;Lists lengths in foo facts 1 and 4 are equal! ;FIRE 4 MAIN::myrule f-3, f-2, ; ==> f-8 (MAIN::has-fired 2 3) ;<== Activation: MAIN::myrule : f-2, f-3, ;Lists lengths in foo facts 3 and 2 are equal! ;FIRE 5 MAIN::myrule f-3, f-1, ; ==> f-9 (MAIN::has-fired 1 3) ;<== Activation: MAIN::myrule : f-1, f-3, ;Lists lengths in foo facts 3 and 1 are equal! ;FIRE 6 MAIN::myrule f-1, f-2, ; ==> f-10 (MAIN::has-fired 2 1) ;<== Activation: MAIN::myrule : f-2, f-1, ;Lists lengths in foo facts 1 and 2 are equal! ; <== Focus MAIN -- --- Jason Morris Morris Technical Solutions LLC http://www.morris-technical-solutions.com
Re: JESS: Matching on multi-slot length
Yes, I think the missing "$" was the issue that was preventing this working. Will reformulate and try (should work). Thx. On Feb 20, 2008, at 3:28 AM, Wolfgang Laun wrote: I would not use this rule provided I understood the problem correctly as: "Find all facts foo where the length of foo.my-list equals the value of slot foo.desired." The proposed solution does not compare a length with foo.desired, and binding of a multislot vaue should use a variable starting with $?. I think the solution should be written as: (deftemplate foo (multislot my-list)(slot desired (default 0))) (defrule lok ?mf <- (foo (my-list $?list)(desired ?len &:(= (length$ $?list) ? len))) => (printout t ?mf " list " $?list " length " ?l crlf) ) (deffacts facts (foo ) (foo (my-list x y)(desired 2)) (foo (my-list a b c)(desired 2)) ) (reset) (facts) (run) kr Wolfgang On 2/19/08, Peter Lin <[EMAIL PROTECTED]> wrote: I believe you need to use (length$ ) and then do a test to compare the two lengths. so the rule might look like this (defrule myrule (foo (my-list ?list1) ) (foo (my-list ?list2) ) (test (eq (length$ ?list1) (length$ ?list2) ) ) => (printout t "the lists have the same length) ) that's how I've done it in the past. there might be an easier way. On Feb 19, 2008 4:04 PM, Hal Hildebrand <[EMAIL PROTECTED]> wrote: I've been struggling with trying to formulate a LHS which tries to match the length of one of the fact's multislots with another slot. For example: (deftemplate foo (multislot my-list) (slot desired)) I've tried the following: (foo (my-list ?my-list) (desired = (length$ ?my-list)) (foo { desired == (length$ my-list) } ) (foo (my-list ?my-list { desired == (length$ ?my-list) } ) And even though desired is 0 and the length of the list is 0, the rule simply won't fire. Obviously, I'm missing something To unsubscribe, send the words 'unsubscribe jess-users [EMAIL PROTECTED]' in the BODY of a message to [EMAIL PROTECTED], NOT to the list (use your own address!) List problems? Notify [EMAIL PROTECTED] .
Re: JESS: Matching on multi-slot length
Yep. That works. Many thanks... On Feb 19, 2008, at 1:15 PM, Peter Lin wrote: I believe you need to use (length$ ) and then do a test to compare the two lengths. so the rule might look like this (defrule myrule (foo (my-list ?list1) ) (foo (my-list ?list2) ) (test (eq (length$ ?list1) (length$ ?list2) ) ) => (printout t "the lists have the same length) ) that's how I've done it in the past. there might be an easier way. On Feb 19, 2008 4:04 PM, Hal Hildebrand <[EMAIL PROTECTED]> wrote: I've been struggling with trying to formulate a LHS which tries to match the length of one of the fact's multislots with another slot. For example: (deftemplate foo (multislot my-list) (slot desired)) I've tried the following: (foo (my-list ?my-list) (desired = (length$ ?my-list)) (foo { desired == (length$ my-list) } ) (foo (my-list ?my-list { desired == (length$ ?my-list) } ) And even though desired is 0 and the length of the list is 0, the rule simply won't fire. Obviously, I'm missing something To unsubscribe, send the words 'unsubscribe jess-users [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: Matching on multi-slot length
I've been struggling with trying to formulate a LHS which tries to match the length of one of the fact's multislots with another slot. For example: (deftemplate foo (multislot my-list) (slot desired)) I've tried the following: (foo (my-list ?my-list) (desired = (length$ ?my-list)) (foo { desired == (length$ my-list) } ) (foo (my-list ?my-list { desired == (length$ ?my-list) } ) And even though desired is 0 and the length of the list is 0, the rule simply won't fire. Obviously, I'm missing something To unsubscribe, send the words 'unsubscribe jess-users [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: Distributed Jess Engine?
Very little in the literature (There's DJess). I've got a model I've been working for my needs, but it requires Coherence. Peter Lin has, I believe, a couple of patents in this area and a lot of excellent ideas. On Feb 6, 2008, at 11:57 AM, Mohd. Noor wrote: Hi all, Is that any answer to Michael's question- I've the same inquires. Cheers mnoor On Jan 30, 2008 4:39 PM, Michael Frey <[EMAIL PROTECTED]> wrote: Hi, is it possible to distribute parts of Jess on multiple machines, e.g. one peer engine runs on node 1 while the original engine and it's rule base run on another one or are there other distribution mechanisms? Best Regards, Michael -- Michael Frey Telecommunications Software & Systems Group ArcLabs Research & Innovation Centre West Campus Waterford Institute of Technology Carriagnore, Co.Waterford, Ireland mail: [EMAIL PROTECTED] web: http://www.tssg.org To unsubscribe, send the words 'unsubscribe jess-users [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: Eclipse 3.3.1.1 and Jess Editor on Mac OS X 10.5
I'm using Eclipse Version: 3.3.2 Build id: M20071107-1100 OS X 10.5 java 1.5.0_13 and things are working fine. I did move to Jess 7.0p2, though. On Jan 4, 2008, at 7:58 AM, JimYates wrote: I'm having trouble getting Eclipse 3.3.1.1 to open .clp files running Mac OS X 10.5 Leopard.I have the plugins installed and they show as Started in the config. There is no Jess icon shown in the About dialog. When I try to open a clp file, I get no errors Eclipse just goes back to the editor window like nothing happened. I don't see anything in the log or error log when I try this. Jess version 7.0p1 and Java 1.5.0_13. *** Plug-in Registry: com.ibm.icu (3.6.1.v20070906) "International Components for Unicode for Java (ICU4J)" [Active] com.jcraft.jsch (0.1.31) "JSch" [Resolved] com.lowagie.itext (1.5.2.v20070710) "Lowagie Itext" [Resolved] gov.sandia.jess (7.0.0) "Jess" [Starting] gov.sandia.jess.debug (7.0.0) "Jess Debugger" [Starting] gov.sandia.jess.editor (7.0.0) "Jess Editor Plug-in" [Starting] gov.sandia.jess.reteview (7.0.0) "Jess Rete Network Viewer" [Starting] -- View this message in context: http://www.nabble.com/Eclipse-3.3.1.1-and-Jess-Editor-on-Mac-OS-X-10.5-tp14619380p14619380.html Sent from the Jess mailing list archive at Nabble.com. To unsubscribe, send the words 'unsubscribe jess-users [EMAIL PROTECTED]' in the BODY of a message to [EMAIL PROTECTED], NOT to the list (use your own address!) List problems? Notify [EMAIL PROTECTED] . To unsubscribe, send the words 'unsubscribe jess-users [EMAIL PROTECTED]' in the BODY of a message to [EMAIL PROTECTED], NOT to the list (use your own address!) List problems? Notify [EMAIL PROTECTED]
Re: JESS: Updating shadow facts from object copies
Wouldn't the fact id be (potentially) different in different instances of the rules engine? I believe these are assigned in declaration order, so unless every instance is defining instances in precisely the same order, then you'd end up with the same logical fact having different ids in different VMs. FWIW, there's a good paper by someone who did something remarkably similar: www.waset.org/pwaset/v4/v4-18.pdf Myself, I've taken another route, which is using shadow facts for everything I want distributed. The facts all have generated UUIDs, so there's no issues with locally generated ids in a distributed system. Then it's a fairly simple matter to translate to the local facts when the shadow changes and vice versa. On Dec 10, 2007, at 1:07 PM, Will Edwards wrote: We're attempting to integrate a JavaSpaces implementation with Jess. When an object changes in the JavaSpace we receive a notification that the object has changed and a copy of the changed object which we want to add or modify as a Jess shadow fact in the rules engine. Our problem is that in this environment we do not get a reference to the original object but a new (by value) copy of the object. So, we want to modify the existing Jess fact with the new copy. Assuming we have the FactIDValue (from the original rete.add) is there a reasonably simple way to do this? Currently we are using a FactFilter to get the existing object, call rete.remove() to remove the old copy and then rete.add() with the new copy. This is of course prone to potential race conditions, etc. What we would like to do is use modify() or updateObject() but both of these seem to require that the original object reference be maintained. Thanks in advance. To unsubscribe, send the words 'unsubscribe jess-users [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: suitability of jess to large (but simple) fact-sets
On Nov 27, 2007, at 8:53 PM, Ernest Friedman-Hill wrote: n Nov 27, 2007, at 2:45 PM, Hal Hildebrand wrote: On Nov 27, 2007, at 10:59 AM, Ernest Friedman-Hill wrote: Jess doesn't spool working memory to disk; it lives in RAM. There are techniques for telling Jess how to only load the facts it actually needs, however. Can you elaborate a bit more on that? This is one of the best uses for Jess's limited backward chaining facility. Jess "knows" when certain facts that don't exist would activate some rules. Using backward chaining rules, you can hook into this knowledge and supply just those needed facts in a "just-in- time" manner (perhaps by querying for just the right information from a database.) This way you don't have to load in the whole big dataset at once -- just what is needed. Ah, this is the strategy used by the "Jess Fact Storage Provider Framework", correct? Now I understand. Very powerful indeed. To unsubscribe, send the words 'unsubscribe jess-users [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: suitability of jess to large (but simple) fact-sets
On Nov 27, 2007, at 10:59 AM, Ernest Friedman-Hill wrote: Jess doesn't spool working memory to disk; it lives in RAM. There are techniques for telling Jess how to only load the facts it actually needs, however. Can you elaborate a bit more on that? To unsubscribe, send the words 'unsubscribe jess-users [EMAIL PROTECTED]' in the BODY of a message to [EMAIL PROTECTED], NOT to the list (use your own address!) List problems? Notify [EMAIL PROTECTED]
Re: JESS: Re: how to make a rule
On Nov 16, 2007, at 7:40 AM, Ernest Friedman-Hill wrote: Hi, I'm not sure how this conversation drifted into a discussion of *alternatives* to Jess; I don't see any problem with doing this application in Jess itself. Sorry, that was my fault... Apologies ;) If you need to have properties like "service" come and go in a running system, then the way to do that is the same way you'd do it in any database-like system: make the property names into data. So, for example (deftemplate computer (slot name)) (deftemplate property (slot computer) (slot name) (slot value)) (deftemplate user-wants (slot name) (slot value)) (assert (computer (name A)) (property (computer A) (name RAM) (value 1GB)) (property (computer A) (name service) (value BLAST))) The rules look a little different, but not much (defrule find-something (computer (name ?c)) (property (computer ?c) (name ?p) (value ?v)) (user-wants (name ?p) (value ?v)) => (printout t "Computer " ?c " fits the user criteria " ?p " = " ?v crlf)) Jess lets you define new rules, and remove old ones, while a system is running, and facts (like the "property" facts) can come and go all the time, as well. In a real system, you'd probably use multiple user-wants facts at a time, and you could use the "forall" conditional element to match computers which meet all of them. On Nov 16, 2007, at 2:54 AM, Mohd. Noor wrote: let me extend my example say > Computer A: >CPu =100 >RAM = 1GB >s/w = c++ > Computer B: > CPU =20 > RAM = 512M > S/w =spps > Computer C > CPU =12 > RAM = 2GB > s/w = mathlab >>> service = bioInformatic service(BLAST) - this is a new service with refers to Computer C, it just introduced/published in the broker a new attribute/property namely service. I wonder how this infrormation being made available in Jess/JHCR/any other techniques on the fly- with that, the "user-wants" could be easily satisfied. in this case - user-wants might be "run my application with mathlab and use the BLAST tools" - which not priory available on the origional rules/facts declaration. My requirement is - my new rules/facts must be able be updated and evaluated of there is any request related at particular time. Any ideas/comments are very much welcome. mnoor On Nov 15, 2007 11:15 PM, Hal Hildebrand <[EMAIL PROTECTED] > wrote: The rules are compiled into classes, so yes, they are hard coded in that sense. But you can compile on the fly and create new systems of rules. However, the question comes down to what are the constraints you are trying to solve? Is it true that the constraints are changing and therefore you need to create a new system of constraints? Or is the data changing and the system remains unchanged. If you do have to change the constraint system/rules, then under what conditions? Are you changing the constraint system when you could be modeling this as data that the constraint system uses (thus eliminating the need to change the constraints)? If not, then how often does the constraint system change? For example, is it a time based policy, like 8am - 4pm, these constraint rules are used, but 5pm - 7am, we use a different set? If so, then the life cycle doesn't change - merely the equations/rules. You can therefore create a model where you can switch in the constraint system to satisfy. You can also use object oriented techniques with constraints ( http://tinyurl.com/2rfdck ). This would allow you to subclass, use polymorphism, etc, which may allow you to have an extensible system which doesn't require changing the constraints. There's a lot of modeling choices out there... On Nov 15, 2007, at 2:46 PM, Mohd. Noor wrote: Yes, - I noticed that we have to consider the state of resource at certain point of time. I go through the examples of JCHR, it look like that we have to hardcoded the rules. Am I right/wrong?. Cheers On Nov 15, 2007 7:35 PM, Hal Hildebrand <[EMAIL PROTECTED]> wrote: There's a life cycle involved, so you're never going to get a system with continuously varying state (nor would you really want to), thus it has to be sampled discretely. The result is a system which triggers when the sampled values change. Some values, like hardware configuration, will change slowly. Others, like CPU load, I/O utilization, etc, will change faster. But regardless, the essential life cycle remains the same: sample the data - event driven, perhaps set up your equations - canned, template or rule driven get your solutions - multiple solutions are possible choose your solution - rule driven, perhaps effec
Re: JESS: Re: how to make a rule
The rules are compiled into classes, so yes, they are hard coded in that sense. But you can compile on the fly and create new systems of rules. However, the question comes down to what are the constraints you are trying to solve? Is it true that the constraints are changing and therefore you need to create a new system of constraints? Or is the data changing and the system remains unchanged. If you do have to change the constraint system/rules, then under what conditions? Are you changing the constraint system when you could be modeling this as data that the constraint system uses (thus eliminating the need to change the constraints)? If not, then how often does the constraint system change? For example, is it a time based policy, like 8am - 4pm, these constraint rules are used, but 5pm - 7am, we use a different set? If so, then the life cycle doesn't change - merely the equations/rules. You can therefore create a model where you can switch in the constraint system to satisfy. You can also use object oriented techniques with constraints ( http://tinyurl.com/2rfdck ). This would allow you to subclass, use polymorphism, etc, which may allow you to have an extensible system which doesn't require changing the constraints. There's a lot of modeling choices out there... On Nov 15, 2007, at 2:46 PM, Mohd. Noor wrote: Yes, - I noticed that we have to consider the state of resource at certain point of time. I go through the examples of JCHR, it look like that we have to hardcoded the rules. Am I right/wrong?. Cheers On Nov 15, 2007 7:35 PM, Hal Hildebrand <[EMAIL PROTECTED]> wrote: There's a life cycle involved, so you're never going to get a system with continuously varying state (nor would you really want to), thus it has to be sampled discretely. The result is a system which triggers when the sampled values change. Some values, like hardware configuration, will change slowly. Others, like CPU load, I/O utilization, etc, will change faster. But regardless, the essential life cycle remains the same: sample the data - event driven, perhaps set up your equations - canned, template or rule driven get your solutions - multiple solutions are possible choose your solution - rule driven, perhaps effect the system change based on the solution Rinse and repeat. On Nov 15, 2007, at 10:38 AM, Mohd. Noor wrote: Dear All Thanks for the kind replies What I am concerned is, my rules is always dynamically changes over time(e.g. CPU availability/utilisation) -with that, I cannot hard coded on the programming coding. Even their template/"deftemplate" might be changes( e.g. new software properties/a totally new hardware-such as any new instrument attached to the computer system) Is that possible with JCHR? Any suggestions are welcome Cheers mnoor On Nov 15, 2007 5:09 PM, Hal Hildebrand <[EMAIL PROTECTED]> wrote: What you are describing is constraint programming. You can do this with Jess, but it's not exactly the best (imho) tool for the job due to what is involved. The combinatorics are nasty in all but the simplest examples. For a constraint solver that runs (with minor tweaks) in Jess, see http://tinyurl.com/yvz98m This technique might do what you want, but you might want to look into constraint systems in Java like JCHR or even Genetic Algorithms, which are particularly good at searching large sparse spaces for solutions to constraints. On Nov 15, 2007, at 8:45 AM, Mohd. Noor wrote: let say the user want to select the computer (resources) in which suite their requirement- in this case user wants to run mathlab simulation in computer(clusters) that have more than 20 CPUs available. Let consider the attributes such as CPU and software are treated differently(whereby we can migrate the software and licenses to the node that most appropriate with users' resources requirements- in this case;). This rules (contains the node A, B and C's properties/attributes) suppose made available in the brokerage level. In this case the user may select the mathlab from node C and run on node B. How do we transform the resources properties into the rules? How we are going to infer the rules? How we can apply a forward chaining and backward chaining? Cheers, mnoor On Nov 15, 2007 2:42 PM, Motaz K. Saad <[EMAIL PROTECTED]> wrote: Could you explain more!. Do you want to make a rule to determine computer specifications for a given software.? On Nov 15, 2007 1:48 PM, Mohd. Noor < [EMAIL PROTECTED] > wrote: dear jess how to make a rule from this scenario Computer A: CPu =100 RAM = 1GB s/w = c++ Computer B: CPU =20 RAM = 512M S/w =spps Computer C CPU =12 RAM = 2GB s/w = mathlab The user will request to run a software mathlab - h
Re: JESS: Re: how to make a rule
There's a life cycle involved, so you're never going to get a system with continuously varying state (nor would you really want to), thus it has to be sampled discretely. The result is a system which triggers when the sampled values change. Some values, like hardware configuration, will change slowly. Others, like CPU load, I/O utilization, etc, will change faster. But regardless, the essential life cycle remains the same: sample the data - event driven, perhaps set up your equations - canned, template or rule driven get your solutions - multiple solutions are possible choose your solution - rule driven, perhaps effect the system change based on the solution Rinse and repeat. On Nov 15, 2007, at 10:38 AM, Mohd. Noor wrote: Dear All Thanks for the kind replies What I am concerned is, my rules is always dynamically changes over time(e.g. CPU availability/utilisation) -with that, I cannot hard coded on the programming coding. Even their template/"deftemplate" might be changes( e.g. new software properties/a totally new hardware-such as any new instrument attached to the computer system) Is that possible with JCHR? Any suggestions are welcome Cheers mnoor On Nov 15, 2007 5:09 PM, Hal Hildebrand <[EMAIL PROTECTED]> wrote: What you are describing is constraint programming. You can do this with Jess, but it's not exactly the best (imho) tool for the job due to what is involved. The combinatorics are nasty in all but the simplest examples. For a constraint solver that runs (with minor tweaks) in Jess, see http://tinyurl.com/yvz98m This technique might do what you want, but you might want to look into constraint systems in Java like JCHR or even Genetic Algorithms, which are particularly good at searching large sparse spaces for solutions to constraints. On Nov 15, 2007, at 8:45 AM, Mohd. Noor wrote: let say the user want to select the computer (resources) in which suite their requirement- in this case user wants to run mathlab simulation in computer(clusters) that have more than 20 CPUs available. Let consider the attributes such as CPU and software are treated differently(whereby we can migrate the software and licenses to the node that most appropriate with users' resources requirements- in this case;). This rules (contains the node A, B and C's properties/attributes) suppose made available in the brokerage level. In this case the user may select the mathlab from node C and run on node B. How do we transform the resources properties into the rules? How we are going to infer the rules? How we can apply a forward chaining and backward chaining? Cheers, mnoor On Nov 15, 2007 2:42 PM, Motaz K. Saad <[EMAIL PROTECTED]> wrote: Could you explain more!. Do you want to make a rule to determine computer specifications for a given software.? On Nov 15, 2007 1:48 PM, Mohd. Noor < [EMAIL PROTECTED] > wrote: dear jess how to make a rule from this scenario Computer A: CPu =100 RAM = 1GB s/w = c++ Computer B: CPU =20 RAM = 512M S/w =spps Computer C CPU =12 RAM = 2GB s/w = mathlab The user will request to run a software mathlab - how do the rules look like cHEERS On Nov 15, 2007 11:44 AM, Mohd. Noor < [EMAIL PROTECTED]> wrote: dear jess how to make a rule from this scenario Computer A: -- Motaz K. Saad Computer Science Dept. College of IT http://motaz.saad.googlepages.com
Re: JESS: Re: how to make a rule
What you are describing is constraint programming. You can do this with Jess, but it's not exactly the best (imho) tool for the job due to what is involved. The combinatorics are nasty in all but the simplest examples. For a constraint solver that runs (with minor tweaks) in Jess, see http://tinyurl.com/yvz98m This technique might do what you want, but you might want to look into constraint systems in Java like JCHR or even Genetic Algorithms, which are particularly good at searching large sparse spaces for solutions to constraints. On Nov 15, 2007, at 8:45 AM, Mohd. Noor wrote: let say the user want to select the computer (resources) in which suite their requirement- in this case user wants to run mathlab simulation in computer(clusters) that have more than 20 CPUs available. Let consider the attributes such as CPU and software are treated differently(whereby we can migrate the software and licenses to the node that most appropriate with users' resources requirements- in this case;). This rules (contains the node A, B and C's properties/attributes) suppose made available in the brokerage level. In this case the user may select the mathlab from node C and run on node B. How do we transform the resources properties into the rules? How we are going to infer the rules? How we can apply a forward chaining and backward chaining? Cheers, mnoor On Nov 15, 2007 2:42 PM, Motaz K. Saad <[EMAIL PROTECTED]> wrote: Could you explain more!. Do you want to make a rule to determine computer specifications for a given software.? On Nov 15, 2007 1:48 PM, Mohd. Noor < [EMAIL PROTECTED] > wrote: dear jess how to make a rule from this scenario Computer A: CPu =100 RAM = 1GB s/w = c++ Computer B: CPU =20 RAM = 512M S/w =spps Computer C CPU =12 RAM = 2GB s/w = mathlab The user will request to run a software mathlab - how do the rules look like cHEERS On Nov 15, 2007 11:44 AM, Mohd. Noor < [EMAIL PROTECTED]> wrote: dear jess how to make a rule from this scenario Computer A: -- Motaz K. Saad Computer Science Dept. College of IT http://motaz.saad.googlepages.com
Re: JESS: Rete.clear() and JessEvent.CLEAR
Ah, okay. I was just wondering what to do. I worked around this by transforming the code to: // HSH Mod - do not clear event mask after sending clear event. // To ensure that CLEAR handlers are called, we use JessEvent.CLEAR // as the proxy for no events. If there are no handlers for CLEAR // then no harm is done as this is a low frequency event. setEventMask(JessEvent.CLEAR); broadcastEvent(JessEvent.CLEAR, this, null); I'm not sure how the event handlers will ever work if clear() is called with the code the other way... With the above fix, things should still work fine with the slight addition of a possibly unneeded check to handle any non listeners when clear() is called again. On 9/28/07 10:47 AM, "Ernest Friedman-Hill" <[EMAIL PROTECTED]> wrote: > > On Sep 28, 2007, at 12:32 PM, Hal Hildebrand wrote: > >> Can anyone answer as to whether this is a bug, or that I have to >> modify my >> code in some way as to set the event mask such that my handler is >> called >> after clear(). >> >> Just wondering what I should be doing. > > > In the past we've called it a low-priority bug, but we never decided > if it's a documentation bug or a code bug. One workaround could be to > subclass jess.Rete and override clear() to store and restore the > event mask (there's a Rete.listJessListeners() method you could use > to restore the event listeners, too). > > >> >> >> On 9/26/07 3:08 PM, "Hal Hildebrand" <[EMAIL PROTECTED]> >> wrote: >> >>> In the doc, it says to use the JessEvent.CLEAR to re-set up your >>> event mask >>> on the engine (section 10.11 in the 7.0p1 manual). >>> >>> "One added wrinkle: note how the handler for JessEvent.CLEAR sets >>> the event >>> mask. When (clear) is called, the event mask is typically reset to >>> the >>> default. When event handlers are called, they have the opportunity >>> to alter >>> the mask to re-install themselves. Alternatively, they can call >>> removeJessListener() to unregister themselves." >>> >>> The example shown is: >>> >>> case JessEvent.CLEAR: >>> Rete engine = (Rete) je.getSource(); >>> int mask = engine.getEventMask(); >>> mask |= defaultMask; >>> engine.setEventMask(mask); >>> // MyGUI.clearDisplay( >>> break; >>> >>> What I found out is in the Rete.clear() method: >>> >>>broadcastEvent(JessEvent.CLEAR, this, null); >>> setEventMask(0); >>> >>> So, whatever handlers are doing when handling CLEAR, the event >>> mask is going >>> to be zero'd out after they set it. >>> >>> Is this a bug, or is there another mechanism that I can use to >>> reset the >>> event mask when the Rete is clear'd? >>> >>> >>> >>> To unsubscribe, send the words 'unsubscribe jess-users >>> [EMAIL PROTECTED]' >>> in the BODY of a message to [EMAIL PROTECTED], NOT to the list >>> (use your own address!) List problems? Notify owner-jess- >>> [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 owner-jess- >> [EMAIL PROTECTED] >> > > - > Ernest Friedman-Hill > Advanced Software Research Phone: (925) 294-2154 > Sandia National LabsFAX: (925) 294-2234 > PO Box 969, MS 9012 [EMAIL PROTECTED] > Livermore, CA 94550 http://www.jessrules.com > > > To unsubscribe, send the words 'unsubscribe jess-users [EMAIL PROTECTED]' > in the BODY of a message to [EMAIL PROTECTED], NOT to the list > (use your own address!) List problems? Notify [EMAIL PROTECTED] > > To unsubscribe, send the words 'unsubscribe jess-users [EMAIL PROTECTED]' in the BODY of a message to [EMAIL PROTECTED], NOT to the list (use your own address!) List problems? Notify [EMAIL PROTECTED]
Re: JESS: Rete.clear() and JessEvent.CLEAR
Can anyone answer as to whether this is a bug, or that I have to modify my code in some way as to set the event mask such that my handler is called after clear(). Just wondering what I should be doing. On 9/26/07 3:08 PM, "Hal Hildebrand" <[EMAIL PROTECTED]> wrote: > In the doc, it says to use the JessEvent.CLEAR to re-set up your event mask > on the engine (section 10.11 in the 7.0p1 manual). > > "One added wrinkle: note how the handler for JessEvent.CLEAR sets the event > mask. When (clear) is called, the event mask is typically reset to the > default. When event handlers are called, they have the opportunity to alter > the mask to re-install themselves. Alternatively, they can call > removeJessListener() to unregister themselves." > > The example shown is: > > case JessEvent.CLEAR: > Rete engine = (Rete) je.getSource(); > int mask = engine.getEventMask(); > mask |= defaultMask; > engine.setEventMask(mask); > // MyGUI.clearDisplay( > break; > > What I found out is in the Rete.clear() method: > >broadcastEvent(JessEvent.CLEAR, this, null); > setEventMask(0); > > So, whatever handlers are doing when handling CLEAR, the event mask is going > to be zero'd out after they set it. > > Is this a bug, or is there another mechanism that I can use to reset the > event mask when the Rete is clear'd? > > > > To unsubscribe, send the words 'unsubscribe jess-users [EMAIL PROTECTED]' > in the BODY of a message to [EMAIL PROTECTED], NOT to the list > (use your own address!) List problems? Notify [EMAIL PROTECTED] > > To unsubscribe, send the words 'unsubscribe jess-users [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: Rete.clear() and JessEvent.CLEAR
In the doc, it says to use the JessEvent.CLEAR to re-set up your event mask on the engine (section 10.11 in the 7.0p1 manual). "One added wrinkle: note how the handler for JessEvent.CLEAR sets the event mask. When (clear) is called, the event mask is typically reset to the default. When event handlers are called, they have the opportunity to alter the mask to re-install themselves. Alternatively, they can call removeJessListener() to unregister themselves." The example shown is: case JessEvent.CLEAR: Rete engine = (Rete) je.getSource(); int mask = engine.getEventMask(); mask |= defaultMask; engine.setEventMask(mask); // MyGUI.clearDisplay( break; What I found out is in the Rete.clear() method: broadcastEvent(JessEvent.CLEAR, this, null); setEventMask(0); So, whatever handlers are doing when handling CLEAR, the event mask is going to be zero'd out after they set it. Is this a bug, or is there another mechanism that I can use to reset the event mask when the Rete is clear'd? To unsubscribe, send the words 'unsubscribe jess-users [EMAIL PROTECTED]' in the BODY of a message to [EMAIL PROTECTED], NOT to the list (use your own address!) List problems? Notify [EMAIL PROTECTED]
Re: JESS: Jess JessTab protege
These are functions provided by the JessTab plugin to Protégé (http://www.ida.liu.se/~her/JessTab/) which allows it to pull in the model you build in Protégé via modeling in OWL or another ontology language and operate on it with Jess. It's billed as a kind of OO extension to Jess and I haven't personally played around with it, but my suspicion is, like pretty much any generated code system, if you want performance you're not going to want to use some thing with a large amount of layers and lots o' layers is kind of inevitable with this kind of system. On 9/11/07 5:51 AM, "Wolfgang Laun" <[EMAIL PROTECTED]> wrote: > velven wrote: > >> Hi everyone, I'm new to Jess and I have some questions >> >> 1) I'm using (mapclass) to map my protege classes into jess, but I found >> > What is (mapclass), please? > >> that the function maps all userdefined slots to be multislots although i >> have set them to be required single cardinality and integer type in protege. >> ie. the generated is (multislot :X-coordinate) when what i need is (slot >> :X-coordinate (type INTEGER)) >> The trouble occurs when i need to get the value to Java and it is identified >> as a list and I cannot use (slot-get) as only the facts were being modified >> during runtime (...slot-set is too costly) >> > What is (slot-get) or (slot-set)? > >> Though conversion is possible, I'm just wondering if theres a better way to >> do it as the conversion seems abit wasteful and costly to my simulation's >> execution. >> >> 2)I have this rule >> >> (defrule moving_aside >> >> ?node1<-(object (is-a Agent)(:NAME ?n1)(:X-coordinate ?x1)(:Y-coordinate >> ?y1)(:Behaviour ?b1&~"move_aside"&~"look_for_leader")) >> ?node2<- (object (is-a Agent)(:NAME ?n2&~?n1)(:X-coordinate ?x2&:(>= 1 >> (abs (- ?x2 ?x1(:Y-coordinate ?y2&:(>= 1 (abs (- ?y2 ?y1) >> => >> >> (modify ?node1 (:Behaviour "move_aside")) >> >> ) >> >> Basically this rule checks for another agent beside it and set its behaviour >> to another state if present. >> According to my test case, though this rule is never fired, its presence >> alone slowed down the simulation with 200 agents. >> > The checks resulting from the LHS are exercised each time "object" facts > are asserted or modified. The *firing* of this rule with its simple RHS > isn't the expensive part. > > Since you write that X-coordinates are INTEGER, a comparison using > (:X-coordinate ?x2&~?x1) might be a little faster. (But isn't either > x-coordinate differs *or* y-coordinate differs sufficient to warrant the > change of :Behaviour? As it stands now, *both* must differ.) > > -Wolfgang > > >> Is this due to the way i have written my rule such that for each agent, >> atleast >> (:X-coordinate ?x2&:(>= 1 (abs (- ?x2 ?x1 >> had to be checked by jess with another 199 agents? or something else? >> >> welcome any suggestions to optimise, Thank you for your time >> >> >> >> > > > To unsubscribe, send the words 'unsubscribe jess-users [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: LHS, lists and productions.
Ah. Should have paid more attention to the details. This has been a tremendous help and my rules make much more sense and don't have that really ugly feel to them. Thanks! On 9/7/07 10:32 AM, "Ernest Friedman-Hill" <[EMAIL PROTECTED]> wrote: > > On Sep 7, 2007, at 1:01 PM, Hal Hildebrand wrote: > >> I guess I'm more than a little confused as to the "(templates $? ?t >> $?)" >> syntax. > > Remember that the first time a variable is used, it matches > whatever's there, and subsequent uses of that same variable match > only whatever the first usage matched. The order of patterns can be > very important for this reason! > > The above slot pattern matches "anything, followed by something (call > it "?t"), followed by anything else." In other words, this rule will > match each individual item in the list, one match for each item. > >> I would have expected that I could have rewritten the rule Wolfgang >> provided to: >> >> (defrule makeTransforms >> ?s <- (source (id ?id) (templates $? ?template $?)) > > So far, so good... > >> (not (transform (source ?id))) > > This pattern says "If there are no 'transform' facts with the given > id," The first time this rule fires, there *will* be such a fact, so > it won't fire anymore, right? You need to write "If the fact this > rule will create doesn't exist yet" which would look like > > (not (transform (source ?id) (template ?template))) > > >> >> Worse however, regardless of whether I use the original >> makeTransform rule >> that Wolfgang proposed or the rewrite I did above, if I combine the >> makeTransforms and your removeTransforms, I end up in a system >> which goes >> into an endless loop from simply asserting one source. Here's the >> full >> test: > ... >> (defrule removeTransforms >> ?t <- (transform (source ?id) (template ?t)) >> (not (source (id ?id)(templates $? ?t $?))) >> => >> (retract ?t) >> ) >> >> > > My bad. I made a mistake in the above: I used ?t as the name of both > the variable bound to the transform fact, as well as the variable > bound to the template slot. The second pattern never matches, as > there's no "templates" slot that contains 'transform' fact references! > > The correct rule would be more like > > (defrule removeTransforms > ?t <- (transform (source ?id) (template ?template)) > (not (source (id ?id)(templates $? ?template $?))) > => > (retract ?t) > ) > > >> On 9/7/07 9:11 AM, "Ernest Friedman-Hill" <[EMAIL PROTECTED]> wrote: >> >>> Same idea: >>> >>> (defrule removeTransforms >>> ?t <- (transform (source ?id) (template ?t)) >>> (not (source (id ?id)(templates $? ?t $?)) >>> => >>> (retract ?t)) >>> >>> >>> On Sep 7, 2007, at 11:57 AM, Hal Hildebrand wrote: >>> >>>> Doh! That does work well and I'll certainly replace my cheesy >>>> solution with >>>> this, but one of the issues I'm dealing with is that the set of >>>> templates >>>> can change and I would like to ensure that as changes to the list of >>>> templates occur, the corresponding transforms are asserted or >>>> retracted. >>>> Sorry, this is an additional constraint I would like to satisfy >>>> that I >>>> should have noted. >>>> >>>> >>>> On 9/7/07 8:28 AM, "Wolfgang Laun" <[EMAIL PROTECTED]> >>>> wrote: >>>> >>>>> Assuming that the absence of any "transform" fact with a "source" >>>>> slot >>>>> equal to the "id" slot of a new "source" fact is the criterion for >>>>> creating the "transform" facts: >>>>> >>>>> (defrule makeTransforms >>>>> ?s <- (source (id ?id)(templates $?templates)) >>>>> (not (transform (source ?id))) >>>>> => >>>>> (foreach ?temp $?templates >>>>> (assert (transform (source ?id) (template ?temp >>>>> ) >>>>> >>>>> kr >>>>> Wolfgang >>>>> >>>>> Hal Hildebrand wrote: >>>>> >>>>>> I have a system where I need to ensure th
Re: JESS: LHS, lists and productions.
Thanks! This is exactly what I need. As you can see in my follow up email, I tried to do this transformation, but for some odd reason I think it was my placement of (watch all) - I didn¹t see all the assertions. However, I still have the endless loop issue if I combine this with the removeTransformation rule. On 9/7/07 9:40 AM, "Robert Kirby" <[EMAIL PROTECTED]> wrote: > This can all be combined in a single rule without a "foreach" loop. > > (defrule manage-source-templates > "Logically assert or retract templates for source" > (logical (source (id ?id) (templates $? ?template $?))) > (not (transform (source ?id) (template ?template))) > => > (assert (transform (source ?id) (template ?template > > Bob Kirby > > At 09:11 AM 9/7/2007, Ernest Friedman-Hill wrote: >> Same idea: >> >> (defrule removeTransforms >> ?t <- (transform (source ?id) (template ?t)) >> (not (source (id ?id)(templates $? ?t $?)) >> => >> (retract ?t)) >> >> >> On Sep 7, 2007, at 11:57 AM, Hal Hildebrand wrote: >>> Doh! That does work well and I'll certainly replace my cheesy >>> solution with this, but one of the issues I'm dealing with is that the set >>> of templates can change and I would like to ensure that as changes to the >>> list of templates occur, the corresponding transforms are asserted or >>> retracted. >>> Sorry, this is an additional constraint I would like to satisfy that I >>> should have noted. >>> >>> >>> On 9/7/07 8:28 AM, "Wolfgang Laun" <[EMAIL PROTECTED]> >>> wrote: >>>> Assuming that the absence of any "transform" fact with a "source" >>>> slot equal to the "id" slot of a new "source" fact is the criterion for >>>> creating the "transform" facts: >>>> >>>> (defrule makeTransforms >>>> ?s <- (source (id ?id)(templates $?templates)) >>>> (not (transform (source ?id))) >>>> => >>>> (foreach ?temp $?templates >>>> (assert (transform (source ?id) (template ?temp >>>> ) >>>> >>>> kr >>>> Wolfgang >>>> >>>> Hal Hildebrand wrote: >>>>> I have a system where I need to ensure that for every member of a >>>>> list, there is a fact which contains that member. For example, here's >>>>> my domain: >>>>> >>>>> >>>>> (deftemplate source (slot id) (multislot templates)) >>>>> (deftemplate transform (slot source) (slot template)) >>>>> >>>>> >>>>> What I would like is to write some rules that ensure that for ever member >>>>> of the templates slot of a "source", I have a corresponding transform. If >>>>> I assert: >>>>> >>>>> (assert source (id 1) (templates (create$ a b c))) >>>>> >>>>> I would like to see three facts asserted in response: >>>>> >>>>> (assert transform (source 1) (template a)) >>>>> (assert transform (source 1) (template b)) >>>>> (assert transform (source 1) (template c)) >>>>> >>>>> >>>>> I have accomplished this by creating an intermediary fact and some rules >>>>> which essentially cycle through the list of templates in the source, >>>>> asserting a transform for each. However, this just feels wrong. It seems >>>>> like I should be able to express this without the intermediary facts. >>>>> >>>>> Perhaps this is where backward chaining would be useful? Or perhaps I can >>>>> use the new "accumulate" CE? Or, have I already found the solution using >>>>> an intermediary fact to cycle through the list of templates? >>>>> >>>>> Any help/suggestions would be appreciated. >> >> - >> Ernest Friedman-Hill >> Advanced Software Research Phone: (925) 294-2154 >> Sandia National Labs FAX: (925) 294-2234 >> PO Box 969, MS 9012[EMAIL PROTECTED] >> Livermore, CA 94550http://www.jessrules.com >
Re: JESS: LHS, lists and productions.
I guess I'm more than a little confused as to the "(templates $? ?t $?)" syntax. I would have expected that I could have rewritten the rule Wolfgang provided to: (defrule makeTransforms ?s <- (source (id ?id) (templates $? ?template $?)) (not (transform (source ?id))) => (assert (transform (source ?id) (template ?template))) ) However, when I assert the source: (assert (source (id 1) (templates (create$ a b c I only see one transform asserted: ==> f-1 (MAIN::transform (source 1) (template a)) Even if I create the source with just one element and repeatedly modify the asserted source's template by adding to the list, I see only one transform asserted. Very confusing. Worse however, regardless of whether I use the original makeTransform rule that Wolfgang proposed or the rewrite I did above, if I combine the makeTransforms and your removeTransforms, I end up in a system which goes into an endless loop from simply asserting one source. Here's the full test: (watch all) (deftemplate source (slot id) (multislot templates)) (deftemplate transform (slot source) (slot template)) (defrule makeTransforms ?s <- (source (id ?id)(templates $?templates)) (not (transform (source ?id))) => (foreach ?temp $?templates (assert (transform (source ?id) (template ?temp ) (defrule removeTransforms ?t <- (transform (source ?id) (template ?t)) (not (source (id ?id)(templates $? ?t $?))) => (retract ?t) ) (bind ?source (assert (source (id 1) (templates (create$ a b c) (run-until-halt) Results in: MAIN::makeTransforms: +1+1+1+1+2+t MAIN::removeTransforms: =1+1=1+1+2+t ==> f-0 (MAIN::source (id 1) (templates a b c)) ==> Activation: MAIN::makeTransforms : f-0, FIRE 1 MAIN::makeTransforms f-0, ==> f-1 (MAIN::transform (source 1) (template a)) ==> Activation: MAIN::removeTransforms : f-1, ==> f-2 (MAIN::transform (source 1) (template b)) ==> Activation: MAIN::removeTransforms : f-2, ==> f-3 (MAIN::transform (source 1) (template c)) ==> Activation: MAIN::removeTransforms : f-3, FIRE 2 MAIN::removeTransforms f-3, <== f-3 (MAIN::transform (source 1) (template c)) FIRE 3 MAIN::removeTransforms f-2, <== f-2 (MAIN::transform (source 1) (template b)) FIRE 4 MAIN::removeTransforms f-1, <== f-1 (MAIN::transform (source 1) (template a)) ==> Activation: MAIN::makeTransforms : f-0, FIRE 5 MAIN::makeTransforms f-0, ==> f-4 (MAIN::transform (source 1) (template a)) ==> Activation: MAIN::removeTransforms : f-4, ==> f-5 (MAIN::transform (source 1) (template b)) ==> Activation: MAIN::removeTransforms : f-5, ==> f-6 (MAIN::transform (source 1) (template c)) ==> Activation: MAIN::removeTransforms : f-6, FIRE 6 MAIN::removeTransforms f-6, <== f-6 (MAIN::transform (source 1) (template c)) FIRE 7 MAIN::removeTransforms f-5, <== f-5 (MAIN::transform (source 1) (template b)) FIRE 8 MAIN::removeTransforms f-4, <== f-4 (MAIN::transform (source 1) (template a)) ==> Activation: MAIN::makeTransforms : f-0, And this continues forever. On 9/7/07 9:11 AM, "Ernest Friedman-Hill" <[EMAIL PROTECTED]> wrote: > Same idea: > > (defrule removeTransforms > ?t <- (transform (source ?id) (template ?t)) > (not (source (id ?id)(templates $? ?t $?)) > => > (retract ?t)) > > > On Sep 7, 2007, at 11:57 AM, Hal Hildebrand wrote: > >> Doh! That does work well and I'll certainly replace my cheesy >> solution with >> this, but one of the issues I'm dealing with is that the set of >> templates >> can change and I would like to ensure that as changes to the list of >> templates occur, the corresponding transforms are asserted or >> retracted. >> Sorry, this is an additional constraint I would like to satisfy that I >> should have noted. >> >> >> On 9/7/07 8:28 AM, "Wolfgang Laun" <[EMAIL PROTECTED]> >> wrote: >> >>> Assuming that the absence of any "transform" fact with a "source" >>> slot >>> equal to the "id" slot of a new "source" fact is the criterion for >>> creating the "transform" facts: >>> >>> (defrule makeTransforms >>> ?s <- (source (id ?id)(templates $?templates)) >>> (not (transform (source ?id))) >>> => >>> (foreach ?temp $?templates >>> (assert (transform (source ?id) (template ?temp >>> ) >>> >>> kr >>> Wolfgang >>> >>> Hal Hildebrand wrote: >>> >>>> I have a system where I need to ensure that for every member of a >>>> list, >>>>
Re: JESS: LHS, lists and productions.
Doh! That does work well and I'll certainly replace my cheesy solution with this, but one of the issues I'm dealing with is that the set of templates can change and I would like to ensure that as changes to the list of templates occur, the corresponding transforms are asserted or retracted. Sorry, this is an additional constraint I would like to satisfy that I should have noted. On 9/7/07 8:28 AM, "Wolfgang Laun" <[EMAIL PROTECTED]> wrote: > Assuming that the absence of any "transform" fact with a "source" slot > equal to the "id" slot of a new "source" fact is the criterion for > creating the "transform" facts: > > (defrule makeTransforms > ?s <- (source (id ?id)(templates $?templates)) > (not (transform (source ?id))) > => > (foreach ?temp $?templates > (assert (transform (source ?id) (template ?temp > ) > > kr > Wolfgang > > Hal Hildebrand wrote: > >> I have a system where I need to ensure that for every member of a list, >> there is a fact which contains that member. For example, here's my domain: >> >> >> (deftemplate source (slot id) (multislot templates)) >> (deftemplate transform (slot source) (slot template)) >> >> >> What I would like is to write some rules that ensure that for ever member of >> the templates slot of a "source", I have a corresponding transform. If I >> assert: >> >> (assert source (id 1) (templates (create$ a b c))) >> >> I would like to see three facts asserted in response: >> >> (assert transform (source 1) (template a)) >> (assert transform (source 1) (template b)) >> (assert transform (source 1) (template c)) >> >> >> I have accomplished this by creating an intermediary fact and some rules >> which essentially cycle through the list of templates in the source, >> asserting a transform for each. However, this just feels wrong. It seems >> like I should be able to express this without the intermediary facts. >> >> Perhaps this is where backward chaining would be useful? Or perhaps I can >> use the new "accumulate" CE? Or, have I already found the solution using an >> intermediary fact to cycle through the list of templates? >> >> Any help/suggestions would be appreciated. >> >> >> >> >> To unsubscribe, send the words 'unsubscribe jess-users [EMAIL PROTECTED]' >> in the BODY of a message to [EMAIL PROTECTED], NOT to the list >> (use your own address!) List problems? Notify [EMAIL PROTECTED] >> >> >> >> > > > To unsubscribe, send the words 'unsubscribe jess-users [EMAIL PROTECTED]' > in the BODY of a message to [EMAIL PROTECTED], NOT to the list > (use your own address!) List problems? Notify [EMAIL PROTECTED] > > To unsubscribe, send the words 'unsubscribe jess-users [EMAIL PROTECTED]' in the BODY of a message to [EMAIL PROTECTED], NOT to the list (use your own address!) List problems? Notify [EMAIL PROTECTED]
JESS: LHS, lists and productions.
I have a system where I need to ensure that for every member of a list, there is a fact which contains that member. For example, here's my domain: (deftemplate source (slot id) (multislot templates)) (deftemplate transform (slot source) (slot template)) What I would like is to write some rules that ensure that for ever member of the templates slot of a "source", I have a corresponding transform. If I assert: (assert source (id 1) (templates (create$ a b c))) I would like to see three facts asserted in response: (assert transform (source 1) (template a)) (assert transform (source 1) (template b)) (assert transform (source 1) (template c)) I have accomplished this by creating an intermediary fact and some rules which essentially cycle through the list of templates in the source, asserting a transform for each. However, this just feels wrong. It seems like I should be able to express this without the intermediary facts. Perhaps this is where backward chaining would be useful? Or perhaps I can use the new "accumulate" CE? Or, have I already found the solution using an intermediary fact to cycle through the list of templates? Any help/suggestions would be appreciated. To unsubscribe, send the words 'unsubscribe jess-users [EMAIL PROTECTED]' in the BODY of a message to [EMAIL PROTECTED], NOT to the list (use your own address!) List problems? Notify [EMAIL PROTECTED]
JESS: RESEND: Evaluating a function passed in an argument
Resending in plain text as I guess the list rejects HTML mail... I'm providing simulation functions which stand in for my Userfunctions and I ran into an interesting pickle I couldn't figure out how to correctly solve To unsubscribe, send the words 'unsubscribe jess-users [EMAIL PROTECTED]' in the BODY of a message to [EMAIL PROTECTED], NOT to the list (use your own address!) List problems? Notify [EMAIL PROTECTED]