JESS: Announcing Jess 8.0a1
The first alpha release of Jess 8.0 is now available for licensed users: http://www.jessrules.com/jess/sourcedist/Jess80a1.zip Jess 8 includes many bug fixes since Jess 7.1p2, a new Eclipse update site-based installer for the JessDE, and support for building Jess applications for Android devices. Please direct questions about Jess licensing to Melissa Simpson (msim...@sandia.govmailto:msim...@sandia.gov), and technical questions to Ernest Friedman-Hill (ejfr...@sandia.gov).
RE: JESS: [EXTERNAL] bsave fails after defquery execution [was: Dynamic rule-base analysis]
It would certainly make sense for this class to be Serializable, as most other classes in Jess are. The current implementation in practice contains an instance of java.util.ArrayList.Itr, which is not Seriaizable, so a certain amount of coding would be involved in making this change. Worth doing, though, so I'll see if we can work it in. -Original Message- From: owner-jess-us...@sandia.gov [mailto:owner-jess-us...@sandia.gov] On Behalf Of Jonathan Sewall Sent: Monday, September 30, 2013 9:49 AM To: jess-users Subject: JESS: [EXTERNAL] bsave fails after defquery execution [was: Dynamic rule-base analysis] [Apologies for the incorrect Subject: on this report yesterday, 9/29.] The trouble with bsave after executing a defquery appears to happen when serializing the Map Context.m_variables in Rete.m_globalContext: at this point in the script, the map holds the QueryResult variable ?qr: (bind ?qr (run-query* all-cars)) Hence, if I execute (bind ?qr not a QueryResult) before the 2nd bsave, then the script runs without error. Could QueryResult be made Serializable? Revised script and results below. Thanks again, Jonathan Sewall --- Original Message Subject:Re: JESS: [EXTERNAL] Dynamic rule-base analysis Date: Sun, 29 Sep 2013 18:04:11 -0400 From: Jonathan Sewall sew...@cs.cmu.edu Reply-To: jsew...@cmu.edu, jess-users@sandia.gov To: jess-users@sandia.gov ... Contents of script.clp: (deftemplate car (slot make) (slot model)) (defquery all-cars Get all cars. ?car - (car)) (defquery cars-of-make Get cars of the given make. (declare (variables ?want-make)) ?car - (car (make ?m:(= ?m ?want-make (reset) (bind ?pickup (assert (car (make Ford) (model F100 (bind ?sedan (assert (car (make Honda) (model Civic (bind ?suv (assert (car (make Ford) (model Explorer (printout t *** Before 1st bsave *** crlf) (printout t globalContext (((engine) getGlobalContext) toString) crlf) (bsave s1.bsave) (bind ?qr (run-query* all-cars)) (while (?qr next) (bind ?car (?qr getObject car)) (printout t (?car toString) crlf)) (?qr close) (printout t *** Before 2nd bsave *** crlf) (printout t globalContext (((engine) getGlobalContext) toString) crlf) ;; (bind ?qr not a QueryResult) ;; uncomment to make script run ok (bsave s2.bsave) Results: $ java -cp lib/jess.jar jess.Main Jess, the Rule Engine for the Java Platform Copyright (C) 2008 Sandia Corporation Jess Version 7.1p2 11/5/2008 Jess (batch script.clp) *** Before 1st bsave *** globalContext [Context, 3 variables: pickup=Fact-1;sedan=Fact-2;suv=Fact-3;] (MAIN::car (make Ford) (model F100)) (MAIN::car (make Honda) (model Civic)) (MAIN::car (make Ford) (model Explorer)) *** Before 2nd bsave *** globalContext [Context, 5 variables: car=Java-Object:jess.Fact;pickup=Fact-1;sedan=Fact-2;suv=Fact-3;qr=Java-Object:jess.QueryResult;] Jess reported an error in routine bsave while executing (bsave s2.bsave) while executing (batch script.clp). Message: IO Exception. Program text: ( bsave s2.bsave ) at line 17 in file script.clp. Nested exception is: jess.QueryResult Jess 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: [EXTERNAL] Issue with static methods (or generics?)
Java syntax like DefaultEdge.class is (more or less) just syntactic sugar for 'java.lang.Class.forName(org.jgrapht.graph.DefaultEdge);' which in Jess will come out like (Class.forName org.jgrapht.graph.DefaultEdge) (taking advantage of the default static imports from the java.lang package.) So you want to do something like (bind ?edge-class (Class.forName org.jgrapht.graph.DefaultEdge)) (bind ?graph (new org.jgrapht.graph.DefaultDirectedGraph ?edge-class)) From: owner-jess-us...@sandia.gov [mailto:owner-jess-us...@sandia.gov] On Behalf Of Aurélien Mazurie Sent: Wednesday, August 07, 2013 7:11 PM To: jess-users Subject: JESS: [EXTERNAL] Issue with static methods (or generics?) Dear Jess users, I am having trouble instantiating a Java class from within a rule's RHS, and cannot figure out how to solve this problem. The code in my RHS creates an instance of a class from the JGraphT library. As seen in https://github.com/jgrapht/jgrapht/blob/master/jgrapht-demo/src/main/java/org/jgrapht/demo/HelloJGraphT.java (lines 91-92), the creation of a DefaultDirectedGraph instance require another class as argument; here, DefaultEdge. I couldn't find an example in the Jess documentation about how to do that. For example, I tried the following: (bind ?edge-class org.jgrapht.graph.DefaultEdge) (bind ?graph (new org.jgrapht.graph.DefaultDirectedGraph ?edge-class)) I also tried variations such as (bind ?edge-class org.jgrapht.graph.DefaultEdge) (bind ?graph (new org.jgrapht.graph.DefaultDirectedGraph (?edge-class getClass)) or (bind ?edge-class (new org.jgrapht.graph.DefaultEdge)) (bind ?graph (new org.jgrapht.graph.DefaultDirectedGraph ?edge-class)) Any idea about what the syntax should be to properly instantiate the DefaultDirectedGraph class? For information (but not certain how relevant it is here), I succeeded in the past in using java.util.regex.Pattern and its static method 'compile' by typing (bind ?pattern-class java.util.regex.Pattern) (bind ?matches ((?pattern-class compile ...) matcher ?string)) Best, Aurélien
RE: JESS: [EXTERNAL] Dynamic rule matching in the LHS
You can slightly augment my forall version to fire once for each good set, given that bag-of-items has some kind of identifier; I'll assume a slot named id. It doesn't matter what the contents are: (defrule check-bag-valid (bag-of-items (id ?id) )) (forall (bag-of-items (id ?id) (names $??name $?)) (item (name ?name))) = (printout t The bag is valid crlf)) This rule could be read as For some bag with some id, every value in the names slot has a matching item fact. It will fire once for every bag for which this condition holds. -Original Message- From: owner-jess-us...@sandia.gov [mailto:owner-jess-us...@sandia.gov] On Behalf Of Aurelien Mazurie Sent: Wednesday, July 31, 2013 1:13 AM To: jess-users Subject: Re: JESS: [EXTERNAL] Dynamic rule matching in the LHS Thank you for this tip. It is not what I am trying to achieve, however. I must apologize if my original email was misunderstood. My goal is to write a rule that would fire for any 'bag-of-items' fact whose item names, as listed in a multislot, are all represented by 'item' facts. The rule should not fire if one or more of these items are absent from the fact list: (item (name A)) (item (name B)) (bag-of-items (item-names A)) (bag-of-items (item-names A B)) (bag-of-items (item-names A B C)) In this example the two first 'bag-of-items' facts would fire my hypothetical rule, while the third would not, because there is no 'item' fact with name C. The 'forall' approach suggested by M. Friedman-Hill is quite close to this, however it seems that the rule will fire only if _all_ the 'bag-of-items' facts have all of their items represented by facts. I.e., in my example above it would not fire until I remove the third bag-of-items fact. Once again, it is close but no cigar. Best, Aurélien On Jul 30, 2013, at 10:54 AM, Jason Morris jason.c.mor...@gmail.com wrote: Another old skool way of doing it using predicate constraints is... (clear) (deftemplate item (slot name)) (deftemplate bag-of-items (multislot item-names)) (defrule fire-for-all-members-in-bag ; If you have a bag of item names ... (bag-of-items (item-names $?item-names)) ; and there is an item whose name is member of this bag ... ?item -(item (name ?name:(member$ ?name $?item-names))) = ; ...then do something interesting (printout t ?name is in the bag! crlf)) ;; Program (reset) (assert (item (name A))) (assert (item (name B))) (assert (item (name C))) (assert (bag-of-items (item-names A B C))) (run) *Jason C. Morris* President, Principal Consultant Morris Technical Solutions LLC President, Rules Fest Association Chairman, IntelliFest 2013: International Conference on Reasoning Technologies 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: [EXTERNAL] Matching facts based on a slot, but not the fact's type
The short answer is no. Templates are like Java classes, and so this is akin to asking if you can write Java code that reads the value of a score member variable in any class. But you can use template inheritance to achieve your goal. Templates can extend other templates; just put your score slot in a base template, and extend everything else that needs a score slot from that common base, and write your patterns to match the base template. Read about the use of extends in templates here: http://www.jessrules.com/jess/docs/71/memory.html From: owner-jess-us...@sandia.gov [mailto:owner-jess-us...@sandia.gov] On Behalf Of Aurelien Mazurie Sent: Friday, July 26, 2013 4:43 PM To: jess-users Subject: JESS: [EXTERNAL] Matching facts based on a slot, but not the fact's type Dear Jess users, I am still learning the ropes, and cannot find an answer to the following question either online or in the 'Jess in action' book. Is there a way to match facts in a LHS based on the presence of a slot? For example, I have two templates: (deftemplate A (slot score)) (deftemplate B (slot score)) I would like my rule to be triggered if any fact (either from template A, B, or others) have a 'score' slot with a specific value. For now I can do it by manually adding references to A and B in the LHS, but this will not scale well. I'm looking for a solution that can just work on any fact, regardless of the template they are defined from. Best, Aurelien
RE: JESS: [EXTERNAL] Dynamic rule matching in the LHS
Not sure what dynamic means in this context. But you can use the forall conditional element to implement this rule. You could read the LHS here as For all values of ?name in bag-of-items, there's a corresponding item fact. (defrule check-bag-valid (forall (bag-of-items (names $??name $?)) (item (name ?name))) = (printout t The bag is valid crlf)) NOTE: Like many complex Jess rules, this one won't fire unless before adding your facts you've executed the (reset) command to asset (initial-fact). -Original Message- From: owner-jess-us...@sandia.gov [mailto:owner-jess-us...@sandia.gov] On Behalf Of Aurelien Mazurie Sent: Friday, July 26, 2013 4:56 PM To: jess-users Subject: JESS: [EXTERNAL] Dynamic rule matching in the LHS Dear Jess users, I am wondering how to write a rule that would dynamically match multiple facts based on their names. Let say I have two types of facts; one representing the information that an item (with a given name) exists, and the other one representing a list of items (e.g., as a list of names in a multislot). It could be something like this: (deftemplate item (slot name)) (deftemplate bag-of-items (multislot names)) (assert (item (name A)) (assert (bag-of-items (names A B)) What I am trying to write is a rule that would, for any bag-of-items fact, fire if all the items listed in the multislot 'name' are item facts that have been asserted. I am wondering if there is an easy way to do that, or if I'll need to hack my way through it with loops and tests in the LHS of my rule. Any suggestion? Best, Aurélien -- View this message in context: http://jess.2305737.n4.nabble.com/Dynamic-rule-matching-in-the-LHS-tp4654176.html Sent from the Jess mailing list archive at Nabble.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: [EXTERNAL] Question on QueryResult close() function
Hi Daniel, Closing a QueryResult doesn't really do anything important; normal garbage collection will free all of its resources. I used Google to see if there was a standard Jess/Matlab integration that I didn't know about, but I didn't find one; I'm afraid I don't know anything about how Jess and Matlab are typically used together. Jess does warm up for a few iterations if run repeatedly with the same rules - i.e., (reset) won't necessarily get you back to the same memory usage as before the first run - but this levels off quickly. It would be a good idea to run a heap analyzer tool to see what kind of objects are being leaked; that might give us a clue as to what's happening. From: owner-jess-us...@sandia.gov [mailto:owner-jess-us...@sandia.gov] On Behalf Of Daniel Selva Sent: Thursday, June 27, 2013 12:53 PM To: jess-users Subject: JESS: [EXTERNAL] Question on QueryResult close() function Hi, I am experiencing a memory leak problem in a Matlab-Jess application and I am trying to locate the leak. I came across the definition of the close() method of the QueryResult class. I have never called this method after using queries. 1) Should I call close() after using a query? 2) Could not calling close() be the cause of the leak? If not, I would appreciate any tips on typical causes of leaks in Matlab-Jess applications. Thanks in advance, Daniel
RE: JESS: [EXTERNAL] Creating an eLearning system following TekMart example
Don't try to get the Token - hiding that sort of ugliness is the whole reason run-query* exists. Use a pattern binding instead: (defquery my-query (declare (variables ?n)) ?f - (room (number ?n))) (bind ?r (run-query* my-query 100)) (while (?r next) (bind ?fact (?r getObject f)) ;; ... now do something with your fact From: owner-jess-us...@sandia.gov [mailto:owner-jess-us...@sandia.gov] On Behalf Of Rejaul Barbhuiya Sent: Wednesday, June 26, 2013 6:22 AM To: jess-users Subject: Re: JESS: [EXTERNAL] Creating an eLearning system following TekMart example Thanks Ernest. In my program, I was using runQuery(arg0, arg1) and storing the result in a Iterator as shown below. Then I am storing the result in token and from token to fact. Iterator sno = engine.runQuery(session-number,new ValueVector().add(sidValue)); if (sno.hasNext()) { Token token = (Token) sno.next(); Fact fact = token.fact(1); Now, I want to use runQueryStar(). But I don't know how to read the Query Result. QueryResult sno = engine.runQueryStar(session-number,new ValueVector().add(sidValue)); if (sno.next()) { Token token = (Token) sno.; what function should I use here? Fact fact = token.fact(1); On Mon, Jun 24, 2013 at 11:06 PM, Friedman-Hill, Ernest ejfr...@sandia.govmailto:ejfr...@sandia.gov wrote: You can use a query to easily find your facts; see http://www.jessrules.com/jess/docs/71/queries.html and in particular, http://www.jessrules.com/jess/docs/71/queries.html#in_java To unsubscribe, send the words 'unsubscribe jess-users y...@address.commailto:y...@address.com' in the BODY of a message to majord...@sandia.govmailto:majord...@sandia.gov, NOT to the list (use your own address!) List problems? Notify owner-jess-us...@sandia.govmailto:owner-jess-us...@sandia.gov. -- Rejaul Karim Barbhuiya Senior Research Fellow Department of Computer Science Jamia Millia Islamia New Delhi, India Phone: +91-9891430568
RE: JESS: [EXTERNAL] Creating an eLearning system following TekMart example
You can use a query to easily find your facts; see http://www.jessrules.com/jess/docs/71/queries.html and in particular, http://www.jessrules.com/jess/docs/71/queries.html#in_java 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: [EXTERNAL] Corrupted Negcnt Error
It's an internal consistency check. Usually it means that a non-value class (a class whose identity, defined by hashCode()/equals(), changes during a run) is being used in an indexed field. Look at this section of the manual and see if you can use it to fix the problem: http://www.jessrules.com/jess/docs/71/functions.html#set-value-class In the past, very rarely, this message indicated a bug in Jess. I don't think this will be the case here - I think any bugs that trigger this assert were found and fixed long ago. From: owner-jess-us...@sandia.gov [mailto:owner-jess-us...@sandia.gov] On Behalf Of Dwight Hare Sent: Wednesday, May 29, 2013 5:05 PM To: jess-users Subject: JESS: [EXTERNAL] Corrupted Negcnt Error During a run I started getting the error Jess reported an error in routine NodeNot2.tokenMatchesRight while executing rule LHS (Node2) while executing rule LHS (TECT). Message: Corrupted Negcnt ( 0) . Any idea what this means? Dwight
RE: JESS: [EXTERNAL] Corrupted Negcnt Error
Yes, that's what I mean, mutable Java objects in your slots. If that's not the problem, then a bug is a possibility. Can you provide me a SSCCEhttp://sscce.org/ that displays the error? (Off-list) From: owner-jess-us...@sandia.gov [mailto:owner-jess-us...@sandia.gov] On Behalf Of Dwight Hare Sent: Thursday, May 30, 2013 1:00 PM To: jess-users Subject: RE: JESS: [EXTERNAL] Corrupted Negcnt Error By indexed field do you mean slot values? I don't use any Java objects other than simple primitives (Integer, Float, Boolean, String). I've looked at all my calls to the Value constructor. Dwight From: owner-jess-us...@sandia.govmailto:owner-jess-us...@sandia.gov [mailto:owner-jess-us...@sandia.gov] On Behalf Of Friedman-Hill, Ernest Sent: Thursday, May 30, 2013 7:36 AM To: jess-users Subject: RE: JESS: [EXTERNAL] Corrupted Negcnt Error It's an internal consistency check. Usually it means that a non-value class (a class whose identity, defined by hashCode()/equals(), changes during a run) is being used in an indexed field. Look at this section of the manual and see if you can use it to fix the problem: http://www.jessrules.com/jess/docs/71/functions.html#set-value-class In the past, very rarely, this message indicated a bug in Jess. I don't think this will be the case here - I think any bugs that trigger this assert were found and fixed long ago. From: owner-jess-us...@sandia.govmailto:owner-jess-us...@sandia.gov [mailto:owner-jess-us...@sandia.gov] On Behalf Of Dwight Hare Sent: Wednesday, May 29, 2013 5:05 PM To: jess-users Subject: JESS: [EXTERNAL] Corrupted Negcnt Error During a run I started getting the error Jess reported an error in routine NodeNot2.tokenMatchesRight while executing rule LHS (Node2) while executing rule LHS (TECT). Message: Corrupted Negcnt ( 0) . Any idea what this means? Dwight
RE: JESS: [EXTERNAL] Adding facts that are instances of from-class deftemplates
The thing is that after this code: (deftemplate Person (declare (from-class Person))) (bind ?f (assert (Person (name Henrique) (age 38 There's no way to transfer those property values to a Person object; i.e., if you then said (modify ?f (OBJECT (new Person))) Then the Person's name and age would NOT be Henrique and 38; they'd be something else. The only way to get a shadow fact and a Java object synced up automatically is to let Jess copy the properties to the fact from the object. 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: [EXTERNAL] Usage of abstract classes in rules
Typically slots come from JavaBeans properties, not fields – i.e., accessor methods like getEventID(). But if you specify “include-variables” when you create a deftemplate from a class, then public (and only public!) member fields will be used as well. See http://www.jessrules.com/jess/docs/71/memory.html#shadow_facts . From: owner-jess-us...@sandia.gov [mailto:owner-jess-us...@sandia.gov] On Behalf Of Tom De Costere Sent: Tuesday, May 21, 2013 6:24 AM To: jess-users Subject: JESS: [EXTERNAL] Usage of abstract classes in rules Hello, I currently have some abstract classes which are then implemented in various other classes extending those abstract classes. Now I’ve been trying to get Jess to work with both the abstract class as the implementation class, but somehow Jess cannot reach to the fields/methods specified in the abstract classes? Is this normal functionality of Jess or must I make such a conversion object that contains both the fields from the abstract class as the fields from the implementation class? Example: My abstract class AbstractApplicationEvent contains following protected fields: - eventID - eventName - eventTimestamp My subclass ConnectionMadeEvent extending the abstract class above no extra fields, but can be extended in the future. Rule: (defrule connection_established (declare (salience 50)) ?f1 - (ConnectionMadeEvent (eventID ?id) (eventTimestamp ?eventTimestamp)) = (assert (Notification (icon ICON_CONNECTION_ACTIVE) (generationTime ?eventTimestamp) (event ?f1))) ) Error message: SEVERE: Error loading Ruleset from: rules/global_rules.clp Jess reported an error in routine Jesp.parsePattern. Message: No such slot eventTimestamp in template MAIN::ConnectionMadeEvent at token 'eventTimestamp'. Program text: ( defrule connection_established ( declare ( salience 50 ) ) ?f1 - ( ConnectionMadeEvent ( eventID ?id ) ( eventTimestamp at line 110 in file rules/global_rules.clp. ... Thanks in advance! Tom DC
RE: JESS: [EXTERNAL] No cast needed when inspecting shadow facts' data members?
Jess doesn't actually try to look for the I member until the code actually runs, so it really has no choice but to accept the code as written. This really isn't any different from how other dynamically typed languages behave; Java, being a strongly/statically typed language that would not allow this kind of code is actually unusual these days. Ruby, Python, Scala, Groovy, etc would all allow this sort of thing, no casting needed. From: owner-jess-us...@sandia.gov [mailto:owner-jess-us...@sandia.gov] On Behalf Of Henrique Lopes Cardoso Sent: Friday, May 10, 2013 9:16 AM To: jess-users Subject: JESS: [EXTERNAL] No cast needed when inspecting shadow facts' data members? Hi, I've just noticed an interesting behavior of Jess. I was working with a couple of classes like this: public class X { Object obj; // getter and setter for obj ... } public class Y { int i; // getter and setter for i ... } Then in Jess I wrote: (deftemplate X (declare (from-class X))) (deftemplate a (slot s)) (defrule r (X (obj ?o)) (test (eq ((?o getClass) getSimpleName) Y)) (a (s ?o.i)) = (printout t ?o.i crlf)) (bind ?x (new X)) (bind ?y (new Y)) (?y setI 123) (?x setObj ?y) (add ?x) (run) This actually works! My surprise is related with the fact that the obj data member is declared as an Object, and the _i_ data member only exists for instances of Y. Despite this, the rule is able to get ?o.i in both the LHS adn the RHS (no cast needed). Of course if I remove the test in the rule and add to working memory an instance of X for which the obj is not an Y, I get a runtime exception. Is there anything I should know about the appropriateness of implementations such as this? Best practices? Thank you in advance. Henrique
RE: JESS: [EXTERNAL] Adding facts that are instances of from-class deftemplates
The *real* way to add shadow facts is using the definstance function. It has a number of options that aren't available with add. The add function was added to Jess to support the simplified semantics of JSR-94 (the javax.rules API) but the intent is that most Jess users will use definstance. Asserting a fact directly from a from-class template is like buying a doghouse; you don't expect to go out the next morning and find that somehow it has a dog in it, right? It's certainly something you can do, but in normal life it's not very useful; usually you get a doghouse when you buy a dog, and add and definstance will both get you a doghouse for your Java object dog automatically. From: owner-jess-us...@sandia.gov [mailto:owner-jess-us...@sandia.gov] On Behalf Of Henrique Lopes Cardoso Sent: Friday, May 10, 2013 4:54 AM To: jess-users Subject: JESS: [EXTERNAL] Adding facts that are instances of from-class deftemplates Hi, I am concerned with the at least two different ways in which you can add, to working memory, facts that are instances of from-class deftemplates. Lets say I have: (deftemplate FC (declare (from-class FC))) I can add a shadow fact like this: (bind ?fc (new FC)) (add ?fc) This is the general approach described in Section 5.3.2 of the Jess manual. But I can also simply go like: (assert (FC)) I guess in this case I do not get a shadow fact, since the OBJECT slot is nil. So, my question is: if my facts are not supposed to be changed from Java code, is there any difference in using each of these approaches? Section 5.3 from the Jess manual does not even mention that instances of from-class deftemplates can be created using the second approach above. Thanks! Henrique
RE: JESS: [EXTERNAL] Linking rule actions to the execution of other rules
Hi Tom, What you’re asking is basically an example of the famous Halting Problem in computer science, which I can paraphrase as “determining what a program is going to do without running the program.” You can’t tell what rules a fact could activate without doing all the pattern matching that Jess does, and unless you write something as complex as Jess, you will do it more slowly than Jess would. That said, the best way to determine what rules can fire as a result of a fact assertion would be to use Jess itself to find out. Add a JessEventListener that listens for ACTIVATION events, and then whenever you assert a fact, watch and see what events you get back. Each combination of rule/fact-tuple that could be fired as a result of the assertion will generate one event, so you may get many. Here is some documentation on JessEvents: http://www.jessrules.com/jess/docs/71/library.html#events Here’s a relevant page from the Javadocs: http://www.jessrules.com/jess/docs/71/api/jess/JessEvent.html From: owner-jess-us...@sandia.gov [mailto:owner-jess-us...@sandia.gov] On Behalf Of Tom De Costere Sent: Tuesday, April 23, 2013 5:08 PM To: jess-users Subject: JESS: [EXTERNAL] Linking rule actions to the execution of other rules Hello, I’m currenly trying to link the actions of rules to the possible execution of other rules. Now I was wondering if anybody has any ideas how this can be done? I’ve already succeeded in reading out the actions and the conditions, but when looking at the current results I can only see the following thing: (piece of output of the loaded miss manners benchmark) - Rule: MAIN::continue - Number of conditions [1]: -- MAIN::Context - Number of actions [1]: modify ?f1 state assign_seats - Rule: MAIN::find_Seating - Number of conditions [7]: -- MAIN::Context -- MAIN::Seating -- MAIN::Guest -- MAIN::Guest -- MAIN::Count -- not -- not - Number of actions [5]: assert Fact--1 assert Fact--1 assert Fact--1 modify ?f5 c (+ ?c 1) modify ?f1 state make_path The problem I’m encountering is the part of the “assert Fact—1”. Does anybody know how to extract the exact fact it’s going to produce + how I could possible find out what rules can be executed after the actions of a rule have been executed? Thanks in advance Tom DC
Re: JESS: [EXTERNAL] Multislot and queries
Use QueryResult.get(visites) and then call listValue() on the result. On 4/8/13 1:05 PM, mike donald mikedoni...@yahoo.fr wrote: hello, I am a beginner in jess, I'm stuck on my application since I have two deftemplates (deftemplate Individu (slot age) (slot sexe) (multislot visites (default (create$) ) ) ) (deftemplate Visite (slot id_visite) (slot nom) (slot pr) ) I have the following query: (defquery objetHistogramme ?i - (Individu {sexe != F } (age ?ag) (sexe ?sex) (visites $?visites)) ) In my java program, I call my query as follows: QueryResult result = engine.runQueryStar(objetHistogramme, new ValueVector()); while (result.next()) { int x = result.getInt(ag);//age Object v = result.getObject(visites); // Erroorr is it } I get an error when I want to retrieve the elements of multislot visit to the display. How to recover the multislot? Mike -- View this message in context: http://jess.2305737.n4.nabble.com/Multislot-and-queries-tp4654137.html Sent from the Jess mailing list archive at Nabble.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: [EXTERNAL] How to configure Eclipse JessDE to recognize Userfunctions?
Hi Samson, As you probably know, Jess learns about Userfunctions via method calls. As you may not realize, when the JessDE is running, there's a copy of the Jess engine in there that's used to parse and interpret Jess code. If the code you're editing makes that copy of Jess aware of the Userfunctions you want to refer to, then they'll be available. So, a very simple example: let's say there's is a Userfunction named foo implemented in a class named com.foo.FooFunction that's in a jar named foo.jar . You want to edit Jess code that calls this function. One way to accomplish this would be to add foo.jar to the project's Java build path, then simply have this Jess function call in your file of Jess code: (load-function com.foo.FooFunction) If there's a com.foo.FooPackage that adds a whole bunch of functions, you could add the jar and call (load-function com.foo.FooPackage) Now, the problem is that this will actually load the classes in foo.jar into Eclipse. Sometimes this is innocuous, but sometimes -- and Protégé is probably one of those times -- that would bring too much baggage with it. So instead, you can fake the editor out. For example, just adding a line like (deffunction foo () ) To your source file will define a function foo; you could have a whole bunch of these lines to define all the functions in a package. But of course, that litters your source file, and nobody wants that. So you move all those functions info another Jess file called, say, development.clp, and load it like this: (require development) And development.clp can include (provide development) and this will work great. But what about when you deploy, won't this file cause problems? Not if instead you use require*, which silently deals with missing files. At deployment time, you simply don't include development.clp in your deployed package, Jess will ignore the require*, and everything will work normally. So, long story short, the best way to edit protégé code would be to create a protégé-development.clp containing all the needed function declarations, and use it as described. On 4/3/13 7:03 PM, Samson Tu s...@stanford.edu wrote: Hi, Perhaps I can clarify that my question is more general than JessTab. It is really about how to make Eclipse JessDE recognize Jess user functions and templates. The value of Eclipse JessDE is much diminished if it cannot recognize user functions. Thank you. With best regards, Samson On 3/29/2013 5:06 PM, Samson Tu wrote: Hi, I am writing Jess rules for use in Protege's JessTab. I would like to use the Eclipse JessDE, but it doesn't recognize any of the JessTab functions, which were implemented as Jess user functions (accessible in jesstab.jar). What do I need to do to make JessDE recognize JessTab functions? Thanks. With best regards, Samson -- Samson Tu email: s...@stanford.edu Senior Research Scientist web: www.stanford.edu/~swt/ Center for Biomedical Informatics Research phone: 1-650-725-3391 Stanford University fax: 1-650-725-7944 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: [EXTERNAL] Anyone ran JESS on a realtime NIX?
Jess, like anything Java-based, can do soft real time at best, due to nondeterministic garbage collection. I've done control algorithms for simulated hardware, but never anything on real machinery. From: Grant Rettke gret...@acm.orgmailto:gret...@acm.org Reply-To: jess-users jess-us...@mailgate.sandia.govmailto:jess-us...@mailgate.sandia.gov Date: Thursday, March 28, 2013 3:39 PM To: jess-users jess-us...@mailgate.sandia.govmailto:jess-us...@mailgate.sandia.gov Subject: JESS: [EXTERNAL] Anyone ran JESS on a realtime NIX? Hi, I'm curious about setting up a balancing robot just for the fun of it. I'm wondering if any of you have any knowledge of people using JESS on a realtime UNIXes, or for that matter, doing anything hardware control wise? Best wishes, Grant
Re: JESS: [EXTERNAL] Jess in a multithreaded environment
Hi Wolfgang, Jess needs a constant hashcode for any given object, so this mechanism distinguishes between objects that provide their own constant hashcode and objects that can't be trusted to do so. The caching I was talking about would be actually sorting objects into these categories right when the jess.Value object is created, and storing the (constant) hashcode that was determined. The only weak point in this is that it would force the user to establish that a class is a value class before any objects of that type are referred to. Another approach would be to use a lock-free container for that list of classes (i.e., ConcurrentLinkedQueue) which retains that flexibility; that's what we're actually trying first. On 1/3/13 12:28 PM, Wolfgang Laun wolfgang.l...@gmail.com wrote: Warning: I may have misunderstood the issue completely. If there is a list (or any other collection) maintaining the set of value classes, it stands to reason that it is synchronized for use in a multithreaded environment, and the contention for its lock may very well cause a performance hit. If a lookup using this list is necessary for distinguishing between constant and non-constant hash codes, I don't see how caching a constant hash code may improve the situation. -W On 03/01/2013, Henschel, Joerg j.hensc...@itcampus.de wrote: Yes, we (Software AG) have a source license, so it'd be great if you could provide a patch for this. Thanks! Jörg Henschel Director Research Development Email: j.hensc...@itcampus.de Phone: +49 341 49287-700 | Fax: +49 341 49287-01 itCampus Software- und Systemhaus GmbH | a Software AG Company Nonnenstrasse 37 | 04229 Leipzig | Germany | http://www.itcampus.de Amtsgericht Leipzig HRB 15872 | Managing Director: Guido Laures -Ursprüngliche Nachricht- Von: owner-jess-us...@sandia.gov [mailto:owner-jess-us...@sandia.gov] Im Auftrag von Friedman-Hill, Ernest Gesendet: Dienstag, 18. Dezember 2012 19:50 An: jess-users Betreff: Re: JESS: [EXTERNAL] Jess in a multithreaded environment Are you adding non-value classes to the list yourself, or is this just with the small number of default listings? This method will get called when you evaluate the hash code of a Java object in the Rete memory; this will happen often during pattern matching. There's actually enough room to cache the hash code in the members of the Value class that are unused for Java object values, so we could try that as a performance improvement. Do you have a source license, so I could send you a patch to try? From: Nguyen, Son Nguyen son.ngu...@softwareag.commailto:son.ngu...@softwareag.com Reply-To: jess-users jess-us...@mailgate.sandia.govmailto:jess-us...@mailgate.sandia.gov Date: Thursday, December 13, 2012 11:04 AM To: jess-users jess-us...@mailgate.sandia.govmailto:jess-us...@mailgate.sandia.gov Subject: JESS: [EXTERNAL] Jess in a multithreaded environment Hi Jess experts, We use Jess in a multi-threaded environment and have experienced some performance degradation when going from a single thread to multiple threads. Our implementation uses the Slot Specific feature. Using a Java profiler, HashCodeComputer.isValueObject() stood out as one of the main contributing factors, if not the most likely, to the degradation 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. 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: [EXTERNAL] Jess in a multithreaded environment
Are you adding non-value classes to the list yourself, or is this just with the small number of default listings? This method will get called when you evaluate the hash code of a Java object in the Rete memory; this will happen often during pattern matching. There's actually enough room to cache the hash code in the members of the Value class that are unused for Java object values, so we could try that as a performance improvement. Do you have a source license, so I could send you a patch to try? From: Nguyen, Son Nguyen son.ngu...@softwareag.commailto:son.ngu...@softwareag.com Reply-To: jess-users jess-us...@mailgate.sandia.govmailto:jess-us...@mailgate.sandia.gov Date: Thursday, December 13, 2012 11:04 AM To: jess-users jess-us...@mailgate.sandia.govmailto:jess-us...@mailgate.sandia.gov Subject: JESS: [EXTERNAL] Jess in a multithreaded environment Hi Jess experts, We use Jess in a multi-threaded environment and have experienced some performance degradation when going from a single thread to multiple threads. Our implementation uses the Slot Specific feature. Using a Java profiler, HashCodeComputer.isValueObject() stood out as one of the main contributing factors, if not the most likely, to the degradation
Re: JESS: [EXTERNAL] Jess on Android Revisited
Grant -- Your message is *very* timely. We've just started working on an official, supported Android port, and hope to make it available in the first months of 2013. This will be in conjunction with the Jess 8.0 release, which will include a rollup of tons of bug fixes and other patches accumulated since 7.1p2. On 11/15/12 9:08 AM, Grant Rettke gret...@acm.org wrote: Hi, Curious about running Jess on Android 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: [EXTERNAL] Ordered facts question
You can't type a fact directly at the prompt. You can add a fact to working memory using the (assert) function (as shown in section 5.2) or you can use the (deffacts) construct to create a group of facts that will then be added to working memory on reset events (as in section 5.5) . As a general rule, in the HTML manual, the light red blocks show interactive sessions with Jess -- things you can type directly at the prompt -- while the green ones do not. The red ones show the actual Jess prompt; the number fact you typed in below is from a green block, and is meant to indicate how the fact data structures look. There are also violet-colored blocks: those are compilable Java code. I'm actually rather proud of what the Jess test suite does to verify the manual. The dialogs in the red blocks are actually parsed from the XML source of the manual and verified: if one of the red blocks says that Jess gives a particular response to a given input, that is actually verified in the test suite. Likewise, the code in the violet blocks is compiled, and if output is shown in the manual, the output is verified correct. The green boxes are the escape mechanism: they can contain pretty much anything, and no validation is done on them. On 10/11/12 4:43 PM, Grant Rettke gret...@acm.org wrote: Hi, I'm working on 5.4. Ordered facts in file:///C:/x86/Jess71p2/docs/memory.html with Jess Jess Version 7.1p2 11/5/2008 where there is an example Jess (number (value 6)) I expected the ordered fact number to get created on-demand but instead got: Jess reported an error in routine Funcall.execute while executing (number (value 6)). Message: Undefined function number. Program text: ( number ( value 6 ) ) at line 1. What am I doing wrong? Best wishes, Grant -- ((λ (x) (x x)) (λ (x) (x x))) http://www.wisdomandwonder.com/ ACM, AMA, COG, IEEE 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: [EXTERNAL] Fuzzy Jess available anywhere?
The FuzzyJ Toolkit is now available at http://www.jessrules.com/user.programs/FuzzyJToolkit.zip . On 10/8/12 11:44 AM, Friedman-Hill, Ernest ejfr...@sandia.gov wrote: Sandia has a license from NRC to redistribute the FuzzyJ toolkit. I will put it up on the Jess web site as soon as the site comes back from system time. On 10/7/12 5:55 AM, dselva80 dse...@mit.edu wrote: Hi, Can I find Bob Orchard's fuzzy Jess toolkit for download anywhere? 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: [EXTERNAL] Emacs Jess Users?
I still use Emacs 22 on my MacBook, so I didn't realize there was a problem. If you have a patch, let me know and I can post it for other people to use. On 10/9/12 11:57 PM, Grant Rettke gret...@acm.org wrote: Hi, Emacs v24 jess-mode users, are you out there? I just found a fix to make jess-mode play nice with Emacs 24 was wondering if anyone else is using it. Everything just works so far and I wanted to have someone to bounce ideas off of. Best wishes, Grant Rettke 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: [EXTERNAL] What is your preferred Eclipse version, distribution, and bitness for Jess 7*?
Jess doesn't care, being a pure Java library. The 32 vs 64-bit question depends entirely on your own machine's architecture, and then the proper Eclipse distribution depends on what sort of code you intend to write: for example, the RCP/RAP developer package is for people who are writing Eclipse plugins, while Eclipse Classic is a good all around distribution for general Java programming. On 10/9/12 7:05 PM, Grant Rettke gret...@acm.org wrote: Hi, There are different version numbers, distribution types (eg for java, for C/C++, for...), and 32 or 64 bit. For Jess 7 users, what combination do you prefer? I'm going to set it up for the first time and would like to avoid the usual Eclipse headaches! :) Best wishes, Grant 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: [EXTERNAL] Fuzzy Jess available anywhere?
Sandia has a license from NRC to redistribute the FuzzyJ toolkit. I will put it up on the Jess web site as soon as the site comes back from system time. On 10/7/12 5:55 AM, dselva80 dse...@mit.edu wrote: Hi, Can I find Bob Orchard's fuzzy Jess toolkit for download anywhere? (academic license) All links to the toolkit seem to be broken since Bob retired, and I don't really want to reimplement all this functionality from scratch... Thanks in advance, Daniel -- View this message in context: http://jess.2305737.n4.nabble.com/Fuzzy-Jess-available-anywhere-tp4654087. html Sent from the Jess mailing list archive at Nabble.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: [EXTERNAL] Activate a Behaviour Jade from Jess
In your setup() method, do something like Rete engine = new Rete(); try { engine.store(AGENT, this); engine.batch(ex.clp); Value v = engine.executeCommand((assert(ACLMessage(contenu A; engine.executeCommand((run)); ... Then in Jess code, you can get access to the Test1 object by calling (fetch AGENT) And call Java methods on that object as needed. I'm afraid I can't help any more than that, since you haven't told us anything about what activating a behavior might entail. On 7/11/12 7:36 AM, lyes clarke_ste...@hotmail.com wrote: Hello, I wish activate a behavior of agent from jess. Exemple : My class Agent -- public class Test1 extends Agent{ protected void setup() { System.out.println (Agent + getLocalName()+ I am here ); Rete engine = new Rete(); try { engine.batch(ex.clp); Value v = engine.executeCommand((assert(ACLMessage(contenu A; engine.executeCommand((run)); } catch (JessException e) { // TODO Auto-generated catch block e.printStackTrace(); } } public class MyAction extends OneShotBehaviour { @Override public void action() { // TODO Auto-generated method stub System.out.println (Agent + getLocalName()+ I am here ); } } } My file ex.clp -- (deftemplate ACLMessage (slot contenu)) (defrule test (ACLMessage (contenu A)) = [// i wish activate behaviour MyAction Defined in Agent java for excute instructions//]) Please Help me. Thank's -- View this message in context: http://jess.2305737.n4.nabble.com/Activate-a-Behaviour-Jade-from-Jess-tp46 54077.html Sent from the Jess mailing list archive at Nabble.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: [EXTERNAL] Using Jess from Java
The Unknown Source just means that line number info isn't stored in the binary (non-source code) distribution you are using; that's not a problem at all. The problem is the ThreadDeath message -- it means that you're using a trial or time-limited licensed version, and the trial period or license period has expired. You'll need to contact Craig Smith, casm...@sandia.gov, to obtain a current license. On 6/7/12 3:31 PM, Cecilia Zanni-Merk (INSA de Strasbourg) cecilia.zanni-m...@insa-strasbourg.fr wrote: Dear colleagues I'm absolutely new to using Jess from a Java program, When I try to test a software done by someone at my team a couple of years ago, Eclipse gives me these errors !ENTRY org.eclipse.osgi 4 0 2012-06-07 21:29:27.775 !MESSAGE Application error !STACK 1 java.lang.ThreadDeath at jess.Jesp.init(Unknown Source) at jess.Rete.g(Unknown Source) at jess.Rete.init(Unknown Source) at jess.Rete.init(Unknown Source) at fr.insa.mamas.Initialization.createAgents(Initialization.java:356) -- where Initialization is one of the classes of our project. Everything is imported correctly, son I do not understand why I get jess.Rete.init (Unknown Source) Any suggestion is more than welcome Thank you very much in advance Regards Cecilia -- === Cecilia Zanni-Merk INSA de Strasbourg 24 Bd de la Victoire - 67084 Strasbourg - France Phone: +33 3 88 14 47 00 (4864) Beware of bugs in the above code; I have only proved it correct, not tried it. Donald Knuth 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: [EXTERNAL] Jess Rules and CMD Prompt
JAVA_HOME isn't the path to java.exe; it's the path to bin/java.exe. In other words, JAVA_HOME will be something like C:\Program Files\jdk1.6.0_23 On 4/20/12 10:10 AM, Gianluigi Loffreda gianluigiloffr...@gmail.com wrote: I have a problem with the Jess Installation. Following the jess installation instructions I read that right after the unzip I could create an environment variable JAVA_HOME with the path of the java.exe to use the Jess also from the Command Prompt. I created the variable and set it with the correct path but I get a message that states that the path is uncorrect because it is not a J2SDK installation. Does anybody have any idea on how to fix this issue? Many thanks. Gianluigi -- View this message in context: http://jess.2305737.n4.nabble.com/Jess-Rules-and-CMD-Prompt-tp4574100p4574 100.html Sent from the Jess mailing list archive at Nabble.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: [EXTERNAL] Jess Error
Jess is involved here, but this is not a Jess problem per se. As the error message says, a third-party Jess script called a Java method loadOWLResource in some third-party code, and that Java method threw an exception. Jess, in turn, throws an exception to report this. The Jess exception object makes the third-party exception available via the Throwable.getCause() method, but based on the below it looks like the third-party code in which Jess is embedded is not calling that method and reporting the root cause exception. So in any case, Jess is doing everything it's supposed to do here; the fault lies with the various other pieces of software you're using, so you'll want to talk to those vendors to help you figure out what's wrong. On 3/4/12 5:32 PM, Faten fakhfakhfa...@gmail.com wrote: Hello, My goal is to test an example with the algorithm OWL-S Matcher. I created a folder: BravoAirService under the folder examples . Then I put in the folder: BravoAirService the following files: BravoAirService.owl, BravoAirGrounding.owl, BravoAirProcess.owl, BravoAirProfile.owl Now I want to run MatchingGUI.java. The interface OWL-S Matching Interface is displayed. I click Open Requested File. I did not understand exactly the path to choose in my case. I tried with the path of : BravoAirService.owl. and also I tried writing this path: http://localhost:80/BravoAirService/BravoAirService.owl; and writing the path: http://localhost:80/BravoAirService/BravoAirProcess.owl; But nothing happens and in console I get: Exception in thread Thread-3 OWLJessKBError: Error running rete to apply semantics Jess reported an error in routine call while executing (call ?*owljesskb* loadOWLResource ?x FALSE) while executing deffunction loadOWL while executing (loadOWL ?import) while executing defrule MAIN::owl-imports-ontologies. Message: Called method threw an exception. at edu.drexel.gicl.semanticweb.owljesskb.error.DefaultSystemError.reteRunErro r(Unknown Source) at edu.drexel.gicl.semanticweb.owljesskb.OWLJessKB.loadOWLResource(Unknown Source) at edu.drexel.gicl.semanticweb.owljesskb.OWLJessKB.loadOWLResource(Unknown Source) at de.tuberlin.ivs.owl.matching.Reasoner.loadOwlFile(Reasoner.java:157) at de.tuberlin.ivs.owl.service.OwlsParser.parse(OwlsParser.java:136) at de.tuberlin.ivs.owl.gui.LoadThread.run(LoadThread.java:94) Please have you any idea about my problem? Thank you in advance. -- View this message in context: http://jess.2305737.n4.nabble.com/Jess-Error-tp504p504.html Sent from the Jess mailing list archive at Nabble.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: [EXTERNAL] How to negate a variable when in lhs of a rule
The asterisks are part of the defglobal's name. You're not comparing to the defglobal: you're binding the value in the slot to a new variable. It's not legal to negate such a constraint in its first use, as the error message said. You need to use (unit (ID ?id) (typeID ?typeID) (player ~?*PLAYER_ID*)) From: Hunter McMillen mcmil...@gmail.commailto:mcmil...@gmail.com Reply-To: jess-users@sandia.govmailto:jess-users@sandia.gov Date: Wed, 11 Jan 2012 14:38:31 -0500 To: jess-users@sandia.govmailto:jess-users@sandia.gov Subject: JESS: [EXTERNAL] How to negate a variable when in lhs of a rule Hi everyone, I am trying to differentiate between Objects that belong to a certain user inside two of my rules. I have a variable created from Java like this: engine.getGlobalContext().setVariable(PLAYER_ID, new Value(player.getID()); And I want to use this variable in rules to determine which objects belong to each player. This rule works fine when just using ?PLAYER_ID (defrule myUnitSeen (unit (ID ?id) (typeID ?typeID) (player ?PLAYER_ID)) = .) But when I try to negate the variable I get an error, First use of variable negated: PLAYER_ID (defrule enemyUnitSeen (unit (ID ?id) (typeID ?typeID) (player ~?PLAYER_ID)) = .) How can I specify anything other than ?PLAYER_ID on the lhs of a rule? Thanks, Hunter McMillen
Re: JESS: [EXTERNAL] How to negate a variable when in lhs of a rule
For everything to work right, you always have to use the asterisks (as I said, they're part of the name), and you must include a (defglobal) declaration before using the variable. Setting a global variable by hand without declaring it first produces undefined results (I.e., it'll work right some of the time.) From: Hunter McMillen mcmil...@gmail.commailto:mcmil...@gmail.com Reply-To: jess-users@sandia.govmailto:jess-users@sandia.gov Date: Wed, 11 Jan 2012 16:37:11 -0500 To: jess-users@sandia.govmailto:jess-users@sandia.gov Subject: Re: JESS: [EXTERNAL] How to negate a variable when in lhs of a rule I placed the asterisks around PLAYER_ID then still received an error when the rule fired: No such variable *PLAYER_ID* But then noticed that when I call setVariable, I name the variable PLAYER_ID not *PLAYER_ID* so I changed my statement to this: engine.getGlobalContext().setVariable(*PLAYER_ID*, new Value(player.getID()); and everything works fine. Does getGlobalContext().setVariable(...) define global variables implicitly? or do you have to include the asterisks like I did? Thanks. Hunter McMillen On Wed, Jan 11, 2012 at 3:13 PM, Friedman-Hill, Ernest ejfr...@sandia.govmailto:ejfr...@sandia.gov wrote: The asterisks are part of the defglobal's name. You're not comparing to the defglobal: you're binding the value in the slot to a new variable. It's not legal to negate such a constraint in its first use, as the error message said. You need to use (unit (ID ?id) (typeID ?typeID) (player ~?*PLAYER_ID*)) From: Hunter McMillen mcmil...@gmail.commailto:mcmil...@gmail.com Reply-To: jess-users@sandia.govmailto:jess-users@sandia.gov Date: Wed, 11 Jan 2012 14:38:31 -0500 To: jess-users@sandia.govmailto:jess-users@sandia.gov Subject: JESS: [EXTERNAL] How to negate a variable when in lhs of a rule Hi everyone, I am trying to differentiate between Objects that belong to a certain user inside two of my rules. I have a variable created from Java like this: engine.getGlobalContext().setVariable(PLAYER_ID, new Value(player.getID()); And I want to use this variable in rules to determine which objects belong to each player. This rule works fine when just using ?PLAYER_ID (defrule myUnitSeen (unit (ID ?id) (typeID ?typeID) (player ?PLAYER_ID)) = .) But when I try to negate the variable I get an error, First use of variable negated: PLAYER_ID (defrule enemyUnitSeen (unit (ID ?id) (typeID ?typeID) (player ~?PLAYER_ID)) = .) How can I specify anything other than ?PLAYER_ID on the lhs of a rule? Thanks, Hunter McMillen
Re: JESS: Nested not/and syntax question
The difference is actually that the not in Rule1 doesn't have a preceding pattern, and therefore Jess inserts (initial-fact), so that the rule won't work unless you've executed (reset) at the beginning of the session, as described in section 6.10 of the Jess 7.1 manual. See http://www.jessrules.com/jess/docs/71/rules.html#not_ce On 1/6/12 8:40 AM, Theodore Patkos pat...@ics.forth.gr wrote: Hello everyone and best wishes for the new year could someone please give me an explanation why the following two rules behave in a different way, although they express the same logical formula (i.e., not (Object ^ Pred) )? In fact, only the second rule reaches correct conclusions, as I note below. (defrule Rule1 (not (and ?o - (Object (name B)) (Pred (obj ?o)) )) = (printout t OK1 crlf) ) (defrule Rule2 (or (not (Object (name B))) (and ?o - (Object (name B)) (not (Pred (obj ?o))) )) = (printout t OK2 crlf) ) The definition of facts could be like: (deftemplate Object (slot name)) (assert (Object (name A))) (assert (Object (name B))) (deftemplate Pred (slot obj)) where obj is the id of some Object fact, eg. (defrule Rule (declare (salience 10)) ?o - (Object (name A)) = (assert (Pred (obj ?o))) ) What I notice is that Rule1 behaves erroneously when the Object fact exists in the KB, but not the Pred fact: although it is supposed to be triggered, it is not! Rule2, on the other hand, behaves correctly all the times. When both Object and Pred facts exist or when the Object does not exist, both rules behave fine. So, what is wrong with the syntax of the first rule? No variable definition is used outside the not pattern.. Thanks Theodore 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: [EXTERNAL] Iterate over a Java List in Jess
That create$ call is creating a list with one element, the ArrayList. Iterating over the Jess list returns just the ArrayList - not what you want. In recent versions of Jess, the foreach function actually knows about Iterators and the like, so you can iterate over the ArrayList directly: (foreach ?u (?bwapi getMyUnits) (printout t (?u toString) crlf)) From: owner-jess-us...@sandia.gov [mailto:owner-jess-us...@sandia.gov] On Behalf Of Hunter McMillen Sent: Tuesday, December 13, 2011 8:56 PM To: jess-users Subject: JESS: [EXTERNAL] Iterate over a Java List in Jess Is there anyway to iterate over a Java List object from Jess? I have a Java object that I store in a Jess variable: engine.getGlobalContext().setVariable(bwapi, new Value(bwapi)); one of the methods that can be called on bwapi returns a Java ArrayList, and I would like to be able to iterate over this list to check certain properties of its elements. Right now I am doing this: engine.executeCommand((bind ?units (create$ =(?bwapi getMyUnits; engine.executeCommand(foreach ?u ?units (printout t ?u crlf))); but when the units are supposed to be printed all I get is: = Java-Object:java.util.ArrayList Any ideas? Thanks, Hunter M
RE: JESS: [EXTERNAL] Access public enum inside of a class
Nested enums, like nested classes, actually secretly have a name like UnitType$UnitTypes. I haven't tried this specifically for enums, but I suspect this would work: engine.executeCommand((import eisbot.proxy.types.UnitType$UnitTypes)); From: owner-jess-us...@sandia.gov [mailto:owner-jess-us...@sandia.gov] On Behalf Of Hunter McMillen Sent: Wednesday, December 07, 2011 4:27 PM To: jess-users Subject: JESS: [EXTERNAL] Access public enum inside of a class Hi everyone, I am trying to use an enum from one of my Java classes inside of Jess. I read a forum post that said I could use the (import enum-name) feature to import enums into Jess, but that only seems to work when the enum is itself in a separate file. I have a class called UnitType, inside of it there is a public enum called UnitTypes where all of the UnitTypes in my game are listed. In Java to access this I would use UnitType.UnitTypes.Element_in_enum to get to the enum
RE: [EXTERNAL] Re: JESS: defquery
H. I had to head over to Nabble to find out what this was referring to. I'll quote the most recent post in that thread, which quotes the original: That URL is the manual for Jess 5.2 (from May 2001, almost ten years ago!) The current version is 7.1, and the current manual is at http://www.jessrules.com/jess/docs/71 Modern query documentation is at http://www.jessrules.com/jess/docs/71/queries.html On Oct 6, 2010, at 3:04 PM, kartik tadanki wrote: I just noticed that the defquery example doesn't work as listed on the site. http://www.jessrules.com/jess/docs/52/language.html Is there a newer version somewhere that I am unaware of? Just came by the error, will try to handle it and post a working code on the mailing list. So the question is, Why doesn't this example in the old version of the Jess manual work? and the answer was Because that's for an old version of Jess, here's where the new example is. So are you having a problem that this answer doesn't help with? -Original Message- From: owner-jess-us...@sandia.gov [mailto:owner-jess-us...@sandia.gov] On Behalf Of speedway Sent: Tuesday, November 29, 2011 10:00 AM To: jess-users Subject: [EXTERNAL] Re: JESS: defquery Ack... http://xkcd.com/979/ http://jess.2305737.n4.nabble.com/file/n4119446/wisdom_of_the_ ancients.png -- View this message in context: http://jess.2305737.n4.nabble.com/JESS-defquery-tp3961274p4119446.html Sent from the Jess mailing list archive at Nabble.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: Scoping Question
Since control structures are functions in Jess, the ability for a function to peek from one stack frame to another is important. I could have implemented this using some kind of special form or keyword -- like the Tcl uplevel function -- but in the first go-round, I think I just took the easy way out, and this behavior has stuck ever since. Note that it's read-only by default: binding a value to a variable in a deffunction creates a new variable in the local scope. That's why recursive functions are possible. From: owner-jess-us...@sandia.gov [mailto:owner-jess-us...@sandia.gov] On Behalf Of David Scuse Sent: Wednesday, November 09, 2011 11:43 AM To: jess-users Subject: JESS: Scoping Question Hi Ernest: I came across a strange feature of Jess as a result of a typing error. It appears as though Jess uses dynamic scoping -- any variables defined in a rule are visible in any functions called by the RHS of the rule. I looked for references to this in the book and the manual but couldn't find anything. Is this the expected behaviour? (This is just a curiosity question.) Thanks David (deftemplate person (slot name) (slot age)) (deffacts initialFacts (person (name bill) (age 20)) (person (name will) (age 25)) (person (name dill) (age 25)) (person (name jill) (age 22)) ) (defrule findOldest ?f - (person (age ?max)) (not (person (age ?less:( ?less ?max = (my-function) ) (deffunction my-function () (printout t crlf Processing fact (?f toString) crlf) (printout t crlf Max age is ?max crlf) (printout t crlf Max age is ?f.age crlf crlf) ) (reset) (run) (facts)
RE: JESS: Is it possible to bind a Java object directly to a Jess variable without creating a new object?
That's what Rete.add() and Rete.definstance() do. If that's the goal, all of this other stuff is superfluous -- just call add() or definstance() from Java. From: owner-jess-us...@sandia.gov [mailto:owner-jess-us...@sandia.gov] On Behalf Of Hunter McMillen Sent: Friday, November 04, 2011 7:50 PM To: jess-users Subject: Re: JESS: Is it possible to bind a Java object directly to a Jess variable without creating a new object? Thanks for your quick reply. After I manage to get my Java object into Jess, can I assert it as a fact? Then have rules lhs match on the existence of some object with attributes x, y, and z? Hunter On Fri, Nov 4, 2011 at 4:01 PM, Friedman-Hill, Ernest ejfr...@sandia.govmailto:ejfr...@sandia.gov wrote: There are (obviously) two options: (a) put the object somewhere accessible, and run Jess code that retrieves it, or (b) use Jess's Java API to set a Jess variable to contain the object. Either would work. The store/fetch mechanism is sort of an built-in easy way to do (a). Alternatively, say there's a global variable ?*x* defined in your Jess program. Then you can say engine.getGlobalContext().setVariable(*x*, new Value(unit)); and your Jess code can later get the value of *x*. If you don't like using variables this way, there's always directly invoking Jess functions from Java. Here we invoke 'add' to add the object to working memory directly: new Funcall(add, engine).arg(new Value(unit)).execute(engine.getGlobalContext()); From: owner-jess-us...@sandia.govmailto:owner-jess-us...@sandia.gov [mailto:owner-jess-us...@sandia.govmailto:owner-jess-us...@sandia.gov] On Behalf Of Hunter McMillen Sent: Friday, November 04, 2011 1:08 PM To: jess-users Subject: JESS: Is it possible to bind a Java object directly to a Jess variable without creating a new object? Hi everyone, I am trying to assert to Jess that an object exists when I encounter a new object in my Java program. Right now I am using a template to mirror that object (i.e I have slot values for all of the Java objects fields) but this seems redundant to me. Is there any way to just bind a Java object to a Jess variable without creating a new Java object? A lot of the examples I see online and from JIA are of the form: (bind ?map (new HashMap)) or (call Classname method params...) but these either create a new object or call static methods. I already have the Java object and just want to store it. But I was hoping that there was someway I could do something like this: public Rete engine = new Rete(); public void unitDiscovered() { Unit unit = some unit encountered; //Java object engine.executeCommand((bind ?unit unit)); engine.executeCommand((assert ?unit)); } Or would I have to use the store() and fetch() methods for this? public void unitDiscovered() { Unit unit = some unit encountered; //Java object engine.store(UNIT, unit); engine.executeCommand((bind ?unit (fetch UNIT)); engine.executeCommand((assert ?unit)); } Basically I want to know the best practice for binding Java objects to Jess variables so I can assert them to the engine. Thanks, Hunter McMillen
RE: JESS: Is it possible to bind a Java object directly to a Jess variable without creating a new object?
There are (obviously) two options: (a) put the object somewhere accessible, and run Jess code that retrieves it, or (b) use Jess's Java API to set a Jess variable to contain the object. Either would work. The store/fetch mechanism is sort of an built-in easy way to do (a). Alternatively, say there's a global variable ?*x* defined in your Jess program. Then you can say engine.getGlobalContext().setVariable(*x*, new Value(unit)); and your Jess code can later get the value of *x*. If you don't like using variables this way, there's always directly invoking Jess functions from Java. Here we invoke 'add' to add the object to working memory directly: new Funcall(add, engine).arg(new Value(unit)).execute(engine.getGlobalContext()); From: owner-jess-us...@sandia.gov [mailto:owner-jess-us...@sandia.gov] On Behalf Of Hunter McMillen Sent: Friday, November 04, 2011 1:08 PM To: jess-users Subject: JESS: Is it possible to bind a Java object directly to a Jess variable without creating a new object? Hi everyone, I am trying to assert to Jess that an object exists when I encounter a new object in my Java program. Right now I am using a template to mirror that object (i.e I have slot values for all of the Java objects fields) but this seems redundant to me. Is there any way to just bind a Java object to a Jess variable without creating a new Java object? A lot of the examples I see online and from JIA are of the form: (bind ?map (new HashMap)) or (call Classname method params...) but these either create a new object or call static methods. I already have the Java object and just want to store it. But I was hoping that there was someway I could do something like this: public Rete engine = new Rete(); public void unitDiscovered() { Unit unit = some unit encountered; //Java object engine.executeCommand((bind ?unit unit)); engine.executeCommand((assert ?unit)); } Or would I have to use the store() and fetch() methods for this? public void unitDiscovered() { Unit unit = some unit encountered; //Java object engine.store(UNIT, unit); engine.executeCommand((bind ?unit (fetch UNIT)); engine.executeCommand((assert ?unit)); } Basically I want to know the best practice for binding Java objects to Jess variables so I can assert them to the engine. Thanks, Hunter McMillen
JESS: RE: Performance, Java static method vs Java oject method calls.
The time difference you're looking at is the time it takes the JVM to throw an exception. Jess interprets an expression like this (?string codePointAt 0) as (assuming ?string is the symbol 'a') (call a codePointAt 0) That's actually ambiguous. We might be calling a static method codePointAt on a class named a, or we might want to call the method codePointAt on the String a. Since it's a SYMBOL, Jess assumes the first case is more likely. The first step in trying the first alternative is to try to load the class 'a'. If we do it and fail, it costs us a ClassNotFoundException. Then we can try plan 'B', which is to call the member method on the String. But that's only what Jess does if ?string is a SYMBOL. If it's an RU.STRING -- i.e., if it appears in the source as a double-quoted String -- then Jess tries the other alternative first. In this case, that turns out to be the right alternative, and we don't need to pay the cost of throwing the exception. I tried changing all the bare 'a's to as in your source -- the time discrepancy completely disappeared. From: owner-jess-us...@sandia.gov [mailto:owner-jess-us...@sandia.gov] On Behalf Of Nguyen, Son Sent: Friday, October 21, 2011 5:14 PM To: jess-users Subject: JESS: Performance, Java static method vs Java oject method calls. Hi, I observed a real dramatic difference in performace when using the following two ways to get the same result. (bind ?value (?stringObject codePointAt 0)) (bind ?value (Helper.stringCodePointAt ?stringObject 0)) I did some not so scientific measurements with the following clp: (deftemplate model1 (slot a)(slot b)) (deftemplate model2 (slot a)(slot b)) (import Helper) (deffunction test1 (?string) (bind ?start (System.nanoTime)) (bind ?var (?string codePointAt 0)) (bind ?stop (System.nanoTime)) (printout t test1 took in nanosec: (- ?stop ?start) crlf) ) (deffunction test2 (?string) (bind ?start (System.nanoTime)) (bind ?var (Helper.stringCodePointAt ?string 0)) (bind ?stop (System.nanoTime)) (printout t -- test2 took in nanosec: (- ?stop ?start) crlf) ) (deffunction compare (?s1 ?s2 ?message) ;(printout t ?s1 : ?s2 - called by ?message returns (eq ?s1 ?s2) crlf) (if (eq ?s1 ?s2) then (test1 a) (test2 a)) (return (eq ?s1 ?s2))) (defrule rule1 (model1(a ?model1a :(compare ?model1a a model1 slot a))(b ?model1b :(compare ?model1b b rule1 model1 slot b))) (model2(a ?model2a :(compare ?model2a 1 model2 slot a))(b ?model2b :(compare ?model2b 2 rule1 model2 slot b))) (test (compare a a a)) = ) .. (defrule rule16 (model1(a ?model1a :(compare ?model1a a model1 slot a))(b ?model1b :(compare ?model1b b rule16 model1 slot b))) (model2(a ?model2a :(compare ?model2a 1 model2 slot a))(b ?model2b :(compare ?model2b 2 rule16 model2 slot b))) (test (compare a a a)) = ) (assert (model2 (a 1)(b 2))) (assert (model1 (a a)(b b))) The difference drastic in favor of the static implementation. The times are in the 30 to 40 microseconds while the other calls take much longer, usually in the 1000 to 2000 microseconds. Without rules, the difference is barely noticable. The side effect of the performance drop has a significant impact of scalability in a multi-cpu system. In our test environment, using Jmeter with multiple virtual users, the cpu usage of a 4 CPU system barely reach the 40% mark with the 'slow' method. With the static implementation, it can go up to the mid 90s for cpu usage. Any feedback is appreciated. Son Nguyen 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: compare slots but only with the last two instances
Assuming that there's some definite ordering among your instances, you just need to make those explicit somehow -- give each instance a slot holding a serial number -- and then you can identify the next two and the last two by comparing those numbers. Otherwise it's the same as comparing any two facts. If they're Java objects, you can generate the IDs in Java using a static member variable. if they're Jess facts, you could use the (default-dynamic) slot property to automatically create a value when the fact is asserted. From: owner-jess-us...@sandia.gov [mailto:owner-jess-us...@sandia.gov] On Behalf Of nikos erinis Sent: Wednesday, October 19, 2011 7:14 AM To: jess-users Subject: JESS: compare slots but only with the last two instances hi fellows, it's me again :) i wrote to you about a week ago. i wanted to compare slots but i didnt get any answers. i realised the question was very dumm. i foun the solution on my own. but now i have a bigger problem. i just want to compare the slot of an instance but only with the last two instances and the next two instances... is this possible!? thank you for your time !
RE: JESS: Using JESS for representing game states
It is true that the Rete algorithm (on which Jess is based) is built on the assumption that only a small fraction (usually quoted as 5-10%) of the knowledge base will change on each evaluation cycle. Populating the network from scratch is expensive and constantly resetting it does degrade performance quite seriously. On the other hand, if the whole knowledge base must be constantly reevaluated, than no other algorithm will necessarily be any better. Rather than searching for other tools, you might put some work into figuring out how to preserve those parts of the KB that don't change as frequently, rather than constantly resetting. Presumably there are stationary objects and information about ownership and properties that don't change often. From: owner-jess-us...@sandia.gov [mailto:owner-jess-us...@sandia.gov] On Behalf Of Sam Sarjant Sent: Sunday, October 09, 2011 5:49 PM To: jess-users Subject: JESS: Using JESS for representing game states Hello, I have been using JESS for some time as a rule-system for representing states in a game (relational reinforcement learning), such that the state of the game can be represented in terms of objects. An agent uses these states and a decision making process (in this case defqueries to resolve rules in conditions - action form). Because games are very dynamic environments, the state is constantly changing. I am currently handling this by resetting the state and reasserting the facts of the state (then running to generate any further facts that rules generate). My question is: is JESS the best rule-system to use for this task? I know JESS has the property of only generating facts once, but if the state is constantly being reset, perhaps some other system would be more effective. JESS certainly gets the job done, and I haven't really tested anything else, but I am concerned with the speed of execution, but perhaps this is simply due to the fact that I am using this relational representation. -- - Thanks, Sam Sarjant www.samsarjant.comhttp://www.samsarjant.com
RE: JESS: Call Jess from C++ via JNI
To restate: you have three libraries you want to use: - One (Jess) is written in Java; - One (BWAPI) can be accessed from Java by using an existing JNI interface, - And the third (BWSAL) is currently available only in native code. Your current plan is to write a JNI wrapper for some or all of BWSAL and write your application in Java. This makes perfect sense to me. It might be even easier to use JNA (http://jna.java.net/) instead of writing a specific wrapper, but that depends on various details. Worth looking at, anyway. From: owner-jess-us...@sandia.gov [mailto:owner-jess-us...@sandia.gov] On Behalf Of Hunter McMillen Sent: Saturday, October 01, 2011 12:52 PM To: jess-users Subject: Re: JESS: Call Jess from C++ via JNI Well I am trying to create an agent to compete in the Starcraft AI competition for next year, the API that the agents all use is called BWAPI: http://code.google.com/p/bwapi/, but this is also a standard library that some of the agents use that would be really useful for for my agent called BWSAL: http://code.google.com/p/bwsal/. Anyway there is a native interface that someone created for BWAPI, which I was planning on using in my code, so my plan was to create a native interface for BWSAL, that way I could do all the Jess interaction inside of Java, then call associated methods in C++ via JNI. Does this sound far-fetched? On Thu, Sep 29, 2011 at 5:10 PM, Socrates Frangis soc.fran...@gmail.commailto:soc.fran...@gmail.com wrote: What framework are you using? Curious to see how it is invoking JNI. using this I think I can only interact with Jess in my Java program then pass data from my Java code to C++ -Unless your framework has an API supporting JESS specifically, i doubt that is the case. It should be providing a 'simpler' implementation to access your java classes but that would just eliminate the cryptic path declaration and still give you an interface to what youre playing with. Overall opinion, given the chance that your framework may inhibit full controll of the Rete engine or using JESS (and for the learning experience) i would recommend sticking with your current implementation. Rule engines require precise attention to detail and i wouldn't risk the chance of losing fidelity. On Wed, Sep 28, 2011 at 2:22 PM, Hunter McMillen mcmil...@gmail.commailto:mcmil...@gmail.com wrote: Sorry to pester you with more questions. The way I am currently doing things in invoking a JVM from C++ to call Java code that calls/interacts with Jess code, but it turns out that someone has actually created a java native interface for the api/framework I am using to make my agent, using this I think I can only interact with Jess in my Java program then pass data from my Java code to C++, I was wondering if you thought this would be a better solution than invoke a JVM from C++ Thanks Hunter On Tue, Sep 27, 2011 at 12:03 PM, Friedman-Hill, Ernest ejfr...@sandia.govmailto:ejfr...@sandia.gov wrote: This is all perfectly reasonable so far. When you create the JVM you'll need to tell it where jess.jar is, along with any other jars you use, with the -cp flag or the java.class.path property. Once you have this working, you'll presumably want to connect things a little more tightly. You can use the JNI API to write the equivalent of your three-line main() in C++ pretty easily; you'll want to put together a C++ version executeCommand() that controls the Rete instance, passes a script along, executes it, and gets the Value back, decoding it as needed. From: owner-jess-us...@sandia.govmailto:owner-jess-us...@sandia.gov [mailto:owner-jess-us...@sandia.govmailto:owner-jess-us...@sandia.gov] On Behalf Of Hunter McMillen Sent: Monday, September 26, 2011 8:51 PM To: jess-users Subject: JESS: Call Jess from C++ via JNI Hello everyone, I am working on a project where I am using a C++ framework and API to create a game agent. My agent has to be flexible so it can react to/predict events that occur inside the game environment, Jess has the kind of flexibility that I need for my agent to be good, but I am having trouble connecting to Jess from C++ and that is where I was hoping someone could help me out. What I am doing right now I have a C++ program that starts a Java Virtual Machine and searches for a Java class file name TestJNIJessInvoke Inside of TestJNIJessInvoke.java I define a simple function in Jess, and try to call that function then print the result import jess.*; public class TestJNIJessInvoke { public static void main(String[] args) throws JessException { Rete r = new Rete(); r.executeCommand((deffunction square (?n) (return (* ?n ?n; Value v = r.executeCommand((square 3)); System.out.println(v.intValue(r.getGlobalContext())); } } But when I try to compile and link the C++ file with: cl -IC:\Program Files\Java\jdk1.7.0\include -IC:\Program Files
RE: JESS: Call Jess from C++ via JNI
The problem is here. The Java classpath doesn't list directories in which jar files can be found, but rather, the jar files themselves. The argument should be, e.g., -Djava.class.path=./jess.jar. options[0].optionString = (char*)-Djava.class.path=.; //the current directory is where jess.jar is also
RE: JESS: multiple bindings of a multislot
Probably. The specialized Rete network nodes are faster than general function calls, as they have less overhead and work directly in Java. From: owner-jess-us...@sandia.gov [mailto:owner-jess-us...@sandia.gov] On Behalf Of Wolfgang Laun Sent: Monday, August 15, 2011 11:22 AM To: jess-users Subject: Re: JESS: multiple bindings of a multislot I solved it by binding the lot: (Temp (m $?mels)) and writing deffunctions testing all other patterns. I ran into this while trying to solve the Zebra Puzzle in a way fundamentally different from the example distributed with Jess. I have all permutations as facts and select them by filtering according to the puzzle's givens. This is where things like ($? ivory green $?) or (? ? milk ? ?) would have to be written in addition to the binding of the entire quintuple
JESS: RE: run-query* and rule LHS
Hi, The bottom line is that you can't run queries, directly or indirectly, from the LHS of rules. The results are unpredictable and, as you've seen, generally bad. From: owner-jess-us...@sandia.gov [mailto:owner-jess-us...@sandia.gov] On Behalf Of Nguyen, Son Sent: Tuesday, August 16, 2011 12:03 PM To: jess-users Subject: JESS: run-query* and rule LHS Hi, I observed some strange behaviors of run-query* from the LHS of rules.
RE: JESS: multiple bindings of a multislot
Yes, reopening a slot like this is an error; this behavior was inherited from CLIPS. I can't think of any particularly elegant workarounds. You can name those anonymous multifields and refer to them later in the rule, though -- i.e., (Temp (m $?first one two $?rest) ?first and ?rest can be used elsewhere in the same rule to refer to what came before and after one two. From: owner-jess-us...@sandia.gov [mailto:owner-jess-us...@sandia.gov] On Behalf Of Wolfgang Laun Sent: Sunday, August 14, 2011 2:30 PM To: jess-users Subject: JESS: multiple bindings of a multislot Given (deftemplate Temp (multislot m)) Cursory tests seem to indicate that a Temp pattern may be written with just a single set of clusters consisting of '?', '$?' and their named cousins. As an example, it's possible to write (Temp (m $? one two $?)) but not (Temp (m $? one two $?)(m $?mvals)) to ascertain that one and two occur as indicated and to bind ?mvals to the entire list. There is, of course, the workaround to use (Temp) once more, making sure that the facts are the same, but this is rather a lot to write for a relatively simple thing. Is it correct that one (multi)slot cannot be used more than once in a single pattern (except as a variable between braces)? -W 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: Is there a better Jess equivalent for pack.age.MyClass.class?
There's a method findClass() in jess.Rete which finds Class objects. It leverages the data from the Jess import command so that class names don't have to be fully qualified. So you could say ((engine) findClass MyClass) I love it when a question has a clear, unambiguous, helpful answer! :) From: owner-jess-us...@sandia.gov [mailto:owner-jess-us...@sandia.gov] On Behalf Of Wolfgang Laun Sent: Wednesday, August 10, 2011 7:27 AM To: jess-users Subject: JESS: Is there a better Jess equivalent for pack.age.MyClass.class? If there's an object of a class around, one can do (?obj getClass). Given only the class name, the only thing I can think of is (call Class forName pack.age.MyClass) which can be wrapped into a deffunction but still needs the full class name as an argument. There's no static field class in a class, and therefore (call MyClass class) cannot work (after an import of MyClass). Is there any better way? -W
Re: JESS: Call for Demos: RuleML2011@BRF - 5th International Rule Challenge
Jess just uses java.util.Random, which you can read about in the Javadoc: http://download.oracle.com/javase/6/docs/api/java/util/Random.html On 7/25/11 4:51 AM, Nessrine Nassou kachroudi.nessr...@yahoo.com wrote: Hi all, Could anyone tell me if the random function of jess is normal or uniform? Thank you for help From: Wolfgang Laun wolfgang.l...@gmail.com To: jess-users@sandia.gov Sent: Tue, July 19, 2011 7:19:15 PM Subject: JESS: Call for Demos: RuleML2011@BRF - 5th International Rule Challenge Dear Jess users, apologies if you receive this more than once, but I think that Jess users are in a particularly well equipped position for participating in this rule challenge, and that's why I gladly take the opportunity to post this call for on this list. ==* * RuleML2011@BRF - 5th International Rule Challenge* * Nov 4th * * Westin Diplomat, Ft Lauderdale, Florida * * http://2011.ruleml.org/america/?page_id=126 * * * Call for Demos - Submission Deadline - Sept. 2nd, 2011* * New categories in the Challenge with prestigious prizes * * Demo papers published as CEUR proceedings* * 15% RuleML2011@BRF Partner discounts - see registration page * * http://2011.ruleml.org/america/ * * http://www.businessrulesforum.com/register.php * * Overview and Aim == The RuleML2011@BRF Challenge is one of the highlights at RuleML2011@BRF Conference.The RuleML2011@BRF Challenge is dedicated to practical experiences with rule-oriented applications. In particular, submissions of benchmarks / evaluations, demos, case studies / use cases, experience reports, best practice solutions (e.g. design patterns, reference architectures, models), rule-based implementations / tools / applications, demonstrations of engineering methods, implementations of rule standards (e.g. RuleML, RIF SBVR, PRR, rule-based Event Processing languages, BPMN+rules, BPEL+rules,...), rules + industrial standards (e.g. XBRL, MISMO, Accord, ...), and industrial problem statements are particularly encouraged. Key themes of the RuleML2011@BRF Challenge include the following: * Demos related to the RuleML2011@BRF Track Topics * Extensions and implementations of rule standards: W3C RIF, RuleML, SBVR,.. * Editing environments and IDEs for Web rules * Benchmarks and comparison results for rule engines * Distributed rule bases and rule services * Reports on industrial experience about rule systems A dedicated track of RuleML2011@BRF Challenge will be focused on the theme: **Combining Rules, Objects, and Ontologies: Implementations and Applications** - Loose/tight integrations of rules and knowledge bases - Knowledge Modelling and Reasoning - Real cases and practical experiences Ideally, demos submitted to the Challenge track should tackle knowledge-rich domain problems. The proposed solution should address such problem using a combination of rule-based modelling and semantic knowledge-based modelling. Solutions ranging from loosely coupled hybrid systems (i.e. where different frameworks are put together), to unified homogeneous architectures (i.e. where a unified model / semantics, within a single framework, is proposed) will be of great interest for the special track. Prizes will be awarded to the two best applications from the main focus them and for the all categories. All accepted demos will be presented in a special Challenge Session. Submission == The submission is composed of two parts: - open-source or commercial demo - demo papers describing research, implementation, and technical details of your submission. Submissions to the Rules Challenge 2011 consist of a demo paper of 4-8 pages describing the demo show case, and a link to the demo/show case, e.g. project site, an online demonstration, a presentation about the demonstration or a download site for the demonstration. Demo and papers submission website: https://www.easychair.org/conferences/?conf=ruleml2011challenge Please upload all demo papers submissions as PDF files in LNCS format (http://www.springer.de/comp/lncs/authors.html). To ensure high quality, submitted papers will be carefully peer-reviewe according to the evaluation criteria indicated below. To better disseminate your work, please also udpate your demo in the systems submission website with a brief abstract presentation: http://2011.ruleml.org/america/?page_id=184 Challenge Evaluation Criteria
JESS: RE: Basic questions about modules, context, and focus
Hi Russ, Facts are assigned to modules at the template level, not at the individual fact level. When you define a template using deftemplate, either the template specifies its module by using a name like modulename::factname, or if the name is unqualified, the template is placed in the current module. The current module is the one that unqualified constructs will be assigned to; usually it's only relevant during the time your code is being loaded, and not while your program is running. The focus module, on the other hand, is the one from which rules are being fired. It's unrelated to which module things will be defined in. It is relevant at runtime only. If you use assertFact with an unqualified name as you've shown below, Jess will first look in the current module and the default module for a template with that name; if one isn't found, it'll be created in the current module. As the current module won't necessarily be well-defined or predicatable while your program is running, it is always a good idea when using modules to specify the full name of the fact, including the module name, so that you don't inadvertently create templates with the same name in different modules by mistake. Finally, note that when a rule or query is compiled, the unqualified template names it mentions are resolved in the module in which the rule or query is defined, or in the default module. The current module is thus effectively set to the rule's module while a rule is being defined. Once the rule is compiled, the templates are already resolved, and the current module has no effect on how the rule operates. From: owner-jess-us...@sandia.gov [mailto:owner-jess-us...@sandia.gov] On Behalf Of Russell Thomas Sent: Tuesday, July 19, 2011 10:00 AM To: jess-users Subject: JESS: Basic questions about modules, context, and focus I've read through the documentation, JESS in Action book, and mailing list archive, and I can't seem to figure out this basic question: How do I assert facts from Java into different modules (or ??contexts??)? To be more specific, the application is a discrete event simulation with agents interacting with each other and objects in the environment. Each agent currently has two separate RETE engines, each with it's own CLP file and only the MAIN module, and I use 'call-on-engine' function calls to coordinate between them. While this functions correctly, it's cumbersome and inefficient. Plus I need to expand the categories of rules by two and using the current scheme would get too complicated. Most of the discrete event simulation happens in Java, with facts asserted to the agents so they can react to the environment and each other. Currently, this is how I assert facts: engine.assertFact(new Fact(found-something-interesting, engine)); I would like to move to an architecture where each agent has only one RETE engine, one CLP file with multiple modules -- one module for each category of rules. But how do I assert the fact in a specific module? Is it in the string associated with the fact? I found classdoc for public Fact assertFact(Fact f, Context c) throws JessException -- Assert a fact, using the given execution context. ..., and then tried to understand of 'execution context' was the same thing as module or focus stack or what. The classdoc for Context was very unhelpful in this regard. Also, what's the difference between 'set-current-module' and 'focus' functions? When do you use one or the other? I presume I'll be using java methods 'engine.eval((focus BLARG));' if I need to change the current module, but then what is 'set-current-module' for? I really wish there was a complete worked example showing how to use a rule set with multiple modules that are accessed and manipulated through Java. I need the dots to be more connected. Struggling, Russ Thomas
RE: JESS: Storing rules in an excel sheet
Jess rules are textual, like program code. Typically what you're going to store in a spreadsheet is a decision table, which some simple rule engines will execute directly. That isn't what Jess does. You could write a Jess program to *implement* a decision table runner, or you could try to store Jess rules as text in spreadsheet cells (although I have no idea why anyone would ever want to do that!) -Original Message- From: owner-jess-us...@sandia.gov [mailto:owner-jess-us...@sandia.gov] On Behalf Of Flogger Sent: Wednesday, February 23, 2011 11:13 AM To: jess-users Subject: JESS: Storing rules in an excel sheet Hi Folks, first of all I want to introduce myself. My name is Florian. I am from Germany. I am 22 years old and I am writing my bachelor thesis about expert systems. My tutor wants me to store my rule database in excel because he wants to automatically generate it using a data mining software. My question right now is: Is it possible? And if yes, how? I read Jess in action but there was only an explanation for storing in xml files. Thank you. Florian 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: Which is faster?
No, just the small overhead of parsing. From: Donald Winston [mailto:satchwins...@yahoo.com] Sent: Tuesday, August 17, 2010 07:08 AM To: jess-users Subject: JESS: Which is faster? Is there enough of a difference in performance between the following to worry about? ; from Jess (assert (param-name1 ?param-value1)) (assert (param-name2 ?param-value2)) (assert (param-name3 ?param-value3a ?param-value3b ?param-value3c)) ...,etc v.s. /* Assert ordered facts from the request parameter map. * No deftemplate is necessary (I have an unorderd fact version of this too) */ private void assertRequestParameters(HttpServletRequest request) throws JessException { Map map = request.getParameterMap(); Iterator keys = map.keySet().iterator(); while (keys.hasNext() == true) { String key = (String)keys.next(); Fact fact = new Fact(key, peerEngine); String[] paramValues = (String[])map.get(key); ValueVector values = new ValueVector(); for(String value : paramValues) values.add(new Value(value, RU.STRING)); fact.setSlotValue(_data, new Value(values, RU.LIST)); peerEngine.assertFact(fact); } }
Re: JESS: question about a feature in Jess 7.1
No, they're not. From: owner-jess-us...@sandia.gov owner-jess-us...@sandia.gov To: jess-users Sent: Fri Apr 09 11:54:01 2010 Subject: JESS: question about a feature in Jess 7.1 Hi all, On page 103 of Jess In Action, it says Note that in Jess 6.1, you can't use a variable to match the head of a fact or the name of a slot; these things must always be specified as literal values. This capability is planned for a future release, however. I am wondering if this capability is in Jess 7.1. Thank you! Felix
RE: JESS: Defglobal function.
Nothing is utterly wrong, but I'm not sure it makes sense to reuse the Rete object for each loop iteration without either (1) calling clear, to completely start over, or (2) moving some of the stuff out of the loop, like the batch file. The resetToMark() call is removing all the facts except for the (initial-fact) -- it seems like you could just call reset. And of course once you've defined the defglobal with a particular object as its initial value, that variable doesn't need to be recreated, so the defglobal can move out of the loop as well. -Original Message- From: owner-jess-us...@sandia.gov [mailto:owner-jess-us...@sandia.gov] On Behalf Of Andrew Meng Sent: Wednesday, March 03, 2010 10:09 AM To: jess-users Subject: RE: JESS: Defglobal function. Ernest, Thanks a lot for helping me here! Let me clarify what I try to do: The internal state of the global veriable(fuzzyVariable) is keep changing because the defination of the fuzzy term gets changed according to the external input. My code is like, --- WorkingMemoryMark marker; engine = new FuzzyRete(); Defglobal dg; FuzzyVariable var = new FuzzyVariable (value 0 100 percentage); engine.reset(); marker = engine.mark(); while( input){ var.addTerm(low, ZFuzzySet(input); var.addTerm(high, SFuzzySet(input); dg = new Defglobal(*v*, new Value(var)); engine.addDefglobal(dg); engine.batch(x.clp); //x.clp will reference the global variable if (engine.run() 1){ //do something } engine.clearStorage(); engine.resetToMark(marker) } -- Will the defglobal part work? Thanks a lot! Andrew From: ejfr...@gmail.com To: jess-users@sandia.gov Subject: Re: JESS: Defglobal function. Date: Wed, 3 Mar 2010 07:08:56 -0500 Hi Andrew, I'm not sure how subtle your question actually is, because there may be a major issue with accomplishing what you're after here. The initial value of a defglobal is stored exactly as it appears in the definition of the defglobal; if the initial value is a function call, then that function call itself is stored. This is so that when you call (reset), the function call can be invoked to initialize the defglobal to an appropriate new value at that time. In any case, the point is that the function call has to be stored as Jess code, so the code that creates the FuzzyVariable itself has to be expressed as a Jess function call no matter what. If you want to express exactly what you've shown here without any Jess code, then I'm afraid you're out of luck! If, on the other hand, it's OK for the initial value of the defglobal to be one, specific object created in Java, then you could just create the FuzzyVariable in Java (including the addTerm calls) and then call something like FuzzyRete engine = ... FuzzyVariable var = ... Defglobal dg = new Defglobal(*v*, new Value(var)); engine.addDefglobal(dg); On Mar 2, 2010, at 11:09 PM, Andrew Meng wrote: Hello, I try to follow a fuzzyJess example. It does something(in Jess only) like: (defglobal ?*v* = (new FuzzyVariable value 0 100 percentage)) then (?*v* addTerm low, (new TriangleFuzzySet (...)) I am wondering how I could do the same thing totally from Java using Jess API. - 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: Re: Mysterious behavior when using Java5 enums in Jess
Hi Jan, No mystery, just a few subtle things wrong. Remember that MyEnum.BIM is always just a symbol, while (MyEnum.BIM) is a function that returns the object BIM in the enumeration MyEnum (given that you've imported MyEnum). The version of the program with enums should NEVER use a bare MyEnum.BIM without the parentheses. The slightly modified version below works as you'd expect 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: assertion - exception out of memory
Hi, I don't know why your code isn't in the message that went out to the mailing list, but I saw it when I approved the message for the list. Basically you're seeing exactly the issue discussed in the FAQ here: http://www.jessrules.com/jess/FAQ.shtml#Q12 You've got a couple of rules with patterns like (Method ?m1) (Method ?m2) (Call (something ?m1) (something-else ?m2)) (some-other-test ?m1 ?m2) These patterns first construct partial matches for all pairs of Method facts -- i.e., n^2 pairs, so this uses memory proportional to the square of the number of facts. If you just rearrange it like (Call (something ?m1) (something-else ?m2)) (Method ?m1) (Method ?m2) (some-other-test ?m1 ?m2) then only the relevant pairs will be formed -- presumably a much smaller number. And if you can do something like (Call (something ?m1) (something-else ?m2)) (some-other-test ?m1 ?m2) (Method ?m1) (Method ?m2) then the memory usage will be smaller still. -Original Message- From: owner-jess-us...@sandia.gov [mailto:owner-jess-us...@sandia.gov] On Behalf Of Lucia Masola Sent: Tuesday, September 29, 2009 10:59 PM To: jess-users Subject: JESS: assertion - exception out of memory Hi, I'm working in a java applications that has Jess embedded. I had some trouble in the assertions of facts. I'm asserting the facts from java and i received the exception out of memory. I realized that the problem is in the archive clp because when i tried to do the same assertion with another clp i didn't encounter the problem. I also tried to take out some rules from the clp in order to check which rule were having the problem and i found them, but i don't know how to solve it (the trouble rules are callerMethods, calleeMethods ). if anyone can help me with this issue i will appreciate it 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.