Re: JESS: Checking list equality

2008-02-13 Thread Wolfgang Laun
intersection of the two lists have the same length as their union. all best, Szymon - Original Message - From: Wolfgang Laun [EMAIL PROTECTED] To: jess-users@sandia.gov Sent: Wednesday, February 13, 2008 3:16 PM Subject: Re: JESS: Checking list equality You can apply (=) to more than 2

Re: JESS: Jess Casting/ Inheritance

2008-01-14 Thread Wolfgang Laun
Gary Napier wrote: I have an alarm deftemplate derived from my Alarm class. I would like jess to analyse these incoming alarms and highlight the important ones. So the output from jess is Super_Alarm. Both classes share many slots / fields. Now the question. If i have *deftemplate*

Re: JESS: Floating issue

2008-01-08 Thread Wolfgang Laun
This is not a Jess problem. Using reals for non-atomic monetary units (e.g., dollar, euro, pound) is a no-no. Absolutely. Don't do it. You might turn to integers representing the subunit (e.g., cent or penny or whatever). Or use java.math.BigDecimal. Kind regards Wolfgang Nara Hari wrote:

Re: JESS: Design check - Tempral Issues

2008-01-08 Thread Wolfgang Laun
The Jess Wiki contains a Jess User Function that might be useful: http://herzberg.ca.sandia.gov/jesswiki/view?AfterEveryUserFunction Assuming that, at some point in time, you know that Y should fire within the next minute, you can set up a fact that says expecting Y. (In Y's RHS, you retract

Re: JESS: Java Vector iterator/Application Design issue

2008-01-08 Thread Wolfgang Laun
There is no '=' separating the RHS and the LHS in your rule rule_test. Processing slots containing a java.util.Vector (or a multislot) requires you to write rather complicated rules. It seems that a simple fact that associates, say, a category name with a *single* charge code, and is used

Re: JESS: cost/objective function ?

2008-01-08 Thread Wolfgang Laun
Mohd. Noor wrote: Dear all What is it means by cost or objective function? http://en.wikipedia.org/wiki/Objective_function one more things. How I am going to map (using rules) between two different attributes from users and resources let say user need to run the job and get results in 1

Re: JESS: insert data into database in JESS

2007-12-17 Thread Wolfgang Laun
And there is the body of the while loop: (while (?result next) (?statement execute insert into test (persen) values (?result getString y))) which looks strange to me, as the string literal contains (presumably) some SQL statement, where the embedded Jess (?result getString y) may be,

Re: JESS: Updating shadow facts from object copies

2007-12-13 Thread Wolfgang Laun
to update Rete with the new object. Thanks. -Original Message- From: [EMAIL PROTECTED] [mailto:owner-jess- [EMAIL PROTECTED] On Behalf Of Wolfgang Laun Sent: Tuesday, December 11, 2007 4:48 AM To: jess-users@sandia.gov Subject: Re: JESS: Updating shadow facts from object copies I

Re: JESS: Updating shadow facts from object copies

2007-12-11 Thread Wolfgang Laun
I have understood Will's problem to be within a single Rete object. Basically, the Rete.add() method returns a reference to the created jess.Fact. As a shadow fact in good standing it'll have a slot OBJECT containing a reference to the original Java object. Therefore, the original object is

Re: JESS: Ranking facts

2007-11-27 Thread Wolfgang Laun
Maybe this is coming close to what you want. ; your fact template (deftemplate Fact (slot id)(slot a)(slot b)(slot c)) ; supposed to contain the rating functions for the slot values (deftemplate Func (slot fa)(slot fb)(slot fc)) ; the computed ranking for a fact (deftemplate Rank (slot r)(slot

Re: JESS: Forward and Backward chaining

2007-11-20 Thread Wolfgang Laun
I doubt very much that an approach combining forward and backward chaining would simplify matters. Given that we're still discussing the user/systems/resources application: I'd extend the set of rules (including dynamically created ones) so that the system would come up with the info which

Re: JESS: matching problem

2007-11-14 Thread Wolfgang Laun
Or this one which is subtly different: (deftemplate things (slot Id) (multislot elements)) (deftemplate otherthing (slot one_Element)) (defrule FindIt ?ot - (otherthing (one_Element ?el )) ?th - (things (Id ?Id) (elements $? ?el $?)) = (printout t found ?el in ?Id crlf) ) (deffacts

JESS: The JessEvent trap

2007-11-07 Thread Wolfgang Laun
Playing around with Jess Event handling, I've just run into this one: I defined a handler in Jess, using JessEventAdapter, to run a simple deffunction whenever a new fact appears. Tested, works fine. Next, I wrote a more general event handler, in Java, to fire whenever something interesting

Re: JESS: Pattern matching nested objects

2007-11-01 Thread Wolfgang Laun
Darrel Davis wrote: I am a real newbie having some difficulty understanding how I would test/access nested Java objects from the LHS of a rule. Given the following declarations: (deftemplate AgreementVO (declare (from-class AgreementVO))) (deftemplate HostVO (declare (from-class HostVO))) A

JESS: multislot and its alternatives

2007-10-30 Thread Wolfgang Laun
Recently, on this list, there was a question about how to find a pair of facts ?a and ?b (of templates A, B) where multislot ?a.props contains element ex and multislot ?a.props contains element ey. The posting did not include sufficient information about the nature of the values stored in the

JESS: Avoiding slot class in shadow facts

2007-10-25 Thread Wolfgang Laun
Deriving a deftemplate from a Java class with, e.g., (deftemplate Account (declare (from-class Account))) invariably adds a slot class, due to getClass() inherited from java.lang.Object. If you want to get rid of this, see the Jess userfunction I've added to the Jess Wiki:

Re: JESS: Avoiding slot class in shadow facts

2007-10-25 Thread Wolfgang Laun
of course an Eclipse-specific version would also be possible.) On Oct 25, 2007, at 12:01 PM, Wolfgang Laun wrote: Deriving a deftemplate from a Java class with, e.g., (deftemplate Account (declare (from-class Account))) invariably adds a slot class, due to getClass() inherited from

Re: JESS: Is this feature available in Jess?

2007-10-24 Thread Wolfgang Laun
The first way proposed by Ernest can be implemented in a Userfunction. See http://herzberg.ca.sandia.gov/jesswiki/edit?FactOnFiring With some rule A and a deftemplate FiredA you call the function (fact-on-firing A FiredA) Using FiredA in some other rule should give you the desired behavior.

Re: JESS: Is this feature available in Jess?

2007-10-24 Thread Wolfgang Laun
The better link to the Userfunction is http://herzberg.ca.sandia.gov/jesswiki/view?FactOnFiring Sorry -W On 10/24/07, Wolfgang Laun [EMAIL PROTECTED] wrote: The first way proposed by Ernest can be implemented in a Userfunction. See http://herzberg.ca.sandia.gov/jesswiki/edit?FactOnFiring

Re: JESS: How can I write this rule?

2007-10-22 Thread Wolfgang Laun
of (matches MAIN::Station-3-Rule) function call (Matches.txt). Sorry for giving a lot of details. I rather like to give smallest example but I am not able to reproduce the problem. Any help or advice that could help me to debug this rule would be appreciate. Regards, Nicolas. Wolfgang Laun-2 wrote

Re: JESS: How can I write this rule?

2007-10-21 Thread Wolfgang Laun
On 10/21/07, Robert Kirby [EMAIL PROTECTED] wrote: If you want to consider only enabled instances, (defrule CP::enabled-example-rule Enabled My-Template with the greatest index1 and among those enabled with the smallest index2. (My-Template (id ?id) (enabled TRUE) (index1 ?index1)

Re: JESS: Java and Jess: Hashtable etc.

2007-10-20 Thread Wolfgang Laun
Hello Waschtl, Neither the code snippets nor the explanations you provided indicate what sort of facts you want to process with your rules, so I'm using classes of my own, which describe the facts I'm going to use: public class Song { private String myTitle; private String myAuthor;

Re: JESS: How can I write this rule?

2007-10-18 Thread Wolfgang Laun
Nicolas Fortin wrote: Hello everybody, Suppose that I have the following template: (deftemplate MAIN::My-Template (slot id (type INTEGER)) (slot index1 (type INTEGER)) (slot index2 (type INTEGER))) I want a rule that would be activated by the fact with the greatest index1

Re: JESS: Jess JessTab protege

2007-09-13 Thread Wolfgang Laun
velven wrote: Is this due to the way i have written my rule such that for each agent, atleast (:X-coordinate ?x2:(= 1 (abs (- ?x2 ?x1 had to be checked by jess with another 199 agents? or something else? welcome any suggestions to optimise, Thank you for your time Forget my doubts

Re: JESS: Jess JessTab protege

2007-09-11 Thread Wolfgang Laun
velven wrote: Hi everyone, I'm new to Jess and I have some questions 1) I'm using (mapclass) to map my protege classes into jess, but I found What is (mapclass), please? that the function maps all userdefined slots to be multislots although i have set them to be required single

Re: JESS: Rules firing only once

2007-08-27 Thread Wolfgang Laun
Another solution to your problem could be based on a deftemplate Category which is used for finding a group of experts. Experts' facts are kept in a linked list used for assigning another expert for every new problem. (The code assumes that one expert is servicing only one Category, but this

Re: JESS: Java objects

2007-08-22 Thread Wolfgang Laun
Noel Huebers wrote (defquery searchcontext (declare (variables ?name ?task ?val)) (context (username ?name) (action Bewertet) (task ?task) (value ?val))) Now I want to delete the some facts. How do I get a fact from the queryresult '?result' ?

Re: JESS: Java objects

2007-08-20 Thread Wolfgang Laun
Noël Huebers wrote: Hi, I'm new to the Jess language and have some questions. 1. I work with Java object. I stored them in Jess with store and assert/fetch commands. But I could not call there member in the lhs of my rule. No function calls allowed, right? So, for every object I made a rule

JESS: multislot matching and binding

2007-08-19 Thread Wolfgang Laun
Is it correct that it isn't possible to bind the entire value of a multislot to a variable *and* use some list pattern to restrict the facts at the same time? Consider: (deftemplate AE (multislot ae)) (deffacts facts (AE (ae a b c d e)) (AE (ae b c d e a)) (AE (ae e d c b a)) )

Re: JESS: Constraining values of a slot

2007-08-08 Thread Wolfgang Laun
To at least *detect* bad slot values consider setting up suitable rules that throw an exception, or whatever. The task of generating these straightforward rules can be automated with a userfunction. You might then, for instance, write (deftemplate SrcTemp (slot destFact)) (deftemplate

Re: JESS: query distinct values of a slot

2007-08-03 Thread Wolfgang Laun
Two solutions. (A) You define a query: (defquery personQuery (person (firstName ?fn)(lastName ?ln)(age ?age))) The Jess function values-of runs the query and processes the result, collecting the values of the result component with the name given as the function argument name into the list

Re: JESS: No rules firing

2007-07-31 Thread Wolfgang Laun
One might very well argue that the automatic definition of a template for ordered facts, as in (defrule r (t 1 ?two) = ... ) or any fact definition is somewhat dangerous since it might cover up anything from a simple typos to a major syntax error. Adding the option of suppressing the

Re: JESS: Java 1.5 enums

2007-07-27 Thread Wolfgang Laun
To match a slot with the result or a method call, prefix the call with an equal sign: (MyShadowFact (OBJECT ?o) (property1 =(MyEnum.xyz))) krW On 7/27/07, Krasnigor, Scott L (N-AST) [EMAIL PROTECTED] wrote: I believe you need to surround the enum with ( ), e.g. (property1

Re: JESS: Who needs class as a slot in a shadow fact?

2007-07-25 Thread Wolfgang Laun
Ernest Friedman-Hill wrote: On Jul 24, 2007, at 12:17 PM, Wolfgang Laun wrote: we see that the fact includes a slot class, inherited from Object . Why is this not suppressed? It never has been. Although I don't think the class property is *extremely* useful, I could certainly come up

JESS: Who needs class as a slot in a shadow fact?

2007-07-24 Thread Wolfgang Laun
After Jess (deftemplate Signal (declare (from-class at.laune.jess.Signal))) TRUE Jess (ppdeftemplate Signal) (deftemplate MAIN::Signal \$JAVA-OBJECT$ at.laune.jess.Signal\ (declare (from-class at.laune.jess.Signal))) Jess (bind ?f1 (assert (Signal))) Fact-1 Jess (facts) f-0

Re: JESS: Defmodule vs. defrule

2007-07-23 Thread Wolfgang Laun
Isn't a (defmodule X) just a way of setting the default namespace for templates, facts, queries and rules? This, then, means that the execution of a (defmodule X) doesn't really imply that a module has come into existence. (Or does it create an empty module X and does (focus X) achieve

Re: JESS: Problem with bload and System functions

2007-07-07 Thread Wolfgang Laun
I can reproduce that error with Foo and Bar, running Jess7.1a1, due to some null pointer exception in the eval. But the documentation for the Jess function call says: The functor call may be omitted if the method being called is non-static. I guess that means that the call, as tried by Henrique,

Re: JESS: Problem with bload and System functions

2007-07-07 Thread Wolfgang Laun
Here is another check on the effect of bsave/bload. I define this function: (deffunction ppallfunctions () (bind ?sb (new StringBuffer)) (bind ?it ((engine) listFunctions)) (while (?it hasNext) (bind ?f (?it next)) (bind ?class (call ?f getClass)) (?sb append ?class) (?sb

JESS: An inconsistency between listFunctions() and PrettyPrinter()

2007-07-07 Thread Wolfgang Laun
This is surprising: (deffunction ppallfunctions () (bind ?sb (new StringBuffer)) (bind ?it ((engine) listFunctions)) (while (?it hasNext) (bind ?f (?it next)) ;; The following call isn't possible because the intrinsic functions ;; don't implement jess.Visitable, and the only

Re: JESS: Problem with bload and System functions

2007-07-07 Thread Wolfgang Laun
The same problem occurs when running bin/jess, and (most likely) with any other of the import-ed things. Statics of some classes are automatically (imports are in jess/scriptlib.clp) defined as functions, and that's why there are some exceptions to the rule stated in the documentation on

Re: JESS: Announcing wiki contributions

2007-07-05 Thread Wolfgang Laun
On 7/3/07, Wolfgang Laun [EMAIL PROTECTED] wrote: There are some recent contributions to the topic Design Patterns on the Jess Wiki (http://www.jessrules.com/jesswiki/view). And here's FactsAsSlotValues, another design pattern. Given the right data, it may be used to answer questions

JESS: Announcing wiki contributions

2007-07-03 Thread Wolfgang Laun
(LambdaCall), * accessing facts (AsBean, GetTemplate), * timer functions (AfterEvery) and * miscellaneous (WhatIs). Any comments (critique, suggestions for improvement,...) more than welcome. Kind regards Wolfgang Laun

Re: JESS: Re: Real deftemplate of extended fact - Solved it!

2007-06-29 Thread Wolfgang Laun
This Userfunction is another way of getting the deftemplate name of some fact: http://herzberg.ca.sandia.gov/jesswiki/view?GetTemplateUserFunction HTH Wolfgang Henrique Lopes Cardoso wrote: Hi, Just to let you know that I solved my own problem. I had not realized that with a query like

Re: JESS: Help: OutOfMemory problem

2007-06-28 Thread Wolfgang Laun
Not knowing the details, I can only quote divide and conquer. If the sets of facts (F) and rules (R) can be divided so that F = union(F1, F2,... Fn) and R = union(R1, R2,...Rn) and these may be paired to run as F1/R1,...Fn/Rn then you might be able to process even bigger Java programs.

Re: JESS: Another rule that doesn't fire

2007-06-28 Thread Wolfgang Laun
includes a default of false for a boolean slot. Due to case sensitivity, the default should probably be FALSE. OK, but not relevant for the problem. (I've changed things as compared to the original source.) -W Bob Kirby At 08:39 AM 6/27/2007, Wolfgang Laun wrote: Perhaps

JESS: Another rule that doesn't fire

2007-06-27 Thread Wolfgang Laun
In the program below, Jess will only fire the second rule if both are uncommented, but each of them fires if the other one isn't there. If the order of rule definitions is reversed, the second one wins again. Jess Version 7.0p1 Kind regards Wolfgang (clear) (deftemplate Obj (slot id

Re: JESS: Another rule that doesn't fire

2007-06-27 Thread Wolfgang Laun
it; and indeed, if you move your reset to after the rules are defined, they both fire correctly. Thanks for the report; we'll look into this further and get it fixed. On Jun 27, 2007, at 10:34 AM, Wolfgang Laun wrote: In the program below, Jess will only fire the second rule if both

Re: JESS: Weighted facts

2007-06-12 Thread Wolfgang Laun
Andrei Boutyline wrote: A third approach is to allow multiple instances of the same feature, but have a high-salience rule that sits around and waits for the existence of two instances of the same feature, and then retracts them and restates one feature with a combined weight; my gut feeling is

JESS: WMEs as slot values

2007-06-11 Thread Wolfgang Laun
Greetings to everybody on this list. The general idea of this approach is to use WME references as slot values. Retrieval of one fact will then permit efficient access to one or more related facts, via some (constant) slots. I haven't found any hint that this isn't permitted, but in the Jess

JESS: breaking loops broken

2007-06-11 Thread Wolfgang Laun
Jess Version 7.0p1 12/21/2006 Using return to break a (for) or (foreach) is documented behaviour. (It isn't for (while), but perhaps this is just an omission in the documentation.) However: ;; Using return to exit from a loop confuses Jess. ;; Loops won't work any more. A (clear) appears to

Re: JESS: breaking loops broken

2007-06-11 Thread Wolfgang Laun
no higher level to return to. But thanks for the report -- return should just be equivalent to break when called in a context like this, so this should be fixed. On Jun 11, 2007, at 3:42 AM, Wolfgang Laun wrote: Jess Version 7.0p1 12/21/2006 Using return to break a (for) or (foreach

<    1   2   3