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
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*
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:
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
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
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
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,
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
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
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
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
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
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
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
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
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:
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
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.
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
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
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)
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;
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
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
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
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
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' ?
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
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))
)
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
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
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
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
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
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
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
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,
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
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
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
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
(LambdaCall),
* accessing facts (AsBean, GetTemplate),
* timer functions (AfterEvery) and
* miscellaneous (WhatIs).
Any comments (critique, suggestions for improvement,...) more than welcome.
Kind regards
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
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.
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
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
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
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
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 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
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
201 - 251 of 251 matches
Mail list logo