Re: JESS: Defrule Pattern Matching and Shadow Facts

2008-10-31 Thread Robert Kirby
JavaBeans may need correct capitalization. For variables mainDoorState and userLocation, which both follow the standard convention of beginning with lower case and internal capitalization of words, the access methods should capitalize the first letter after get or set such as getMainDoorState

Re: JESS: GUI and defquery

2008-08-25 Thread Robert Kirby
is caused by calling the defquery within a deffuction. Does anyone know a better way of connecting a Gui-text with defquery? Thank you On 8/24/08, Robert Kirby mailto:[EMAIL PROTECTED][EMAIL PROTECTED] wrote: The value of next on the QueryResult is not being checked. If next returns FALSE

Re: JESS: GUI and defquery

2008-08-24 Thread Robert Kirby
The value of next on the QueryResult is not being checked. If next returns false, the message below will be seen as if next had not been called. The getInt method and other get methods could throw a JessException with a different message when called after next returns FALSE, but doesn't. Bob

RE: JESS: Modifying a fact from the current activation

2008-07-02 Thread Robert Kirby
Activation records seem more like part of the implementation than something to use in ordinary code. If more than one fact is part of the activation record, then it may be tricky to identify the fact to modify. Perhaps the matching facts could be passed as additional parameters to

Re: JESS: Ranking facts

2007-11-27 Thread Robert Kirby
Facts can be selected in rank order with a defquery and a Java collection. (deftemplate sample Sample facts to be ranked (declare (ordered FALSE)) (slot primary (type INTEGER) (default 0)) (slot secondary (type INTEGER)) (slot stuff) ) (defquery sample-query Query for

Re: JESS: matching problem

2007-11-14 Thread Robert Kirby
How about (defrule find_it2 (things (Id ?pId)(elements $? ?elementName $?)) (otherthing (one_Element ?elementName)) = (printout t found it: ?pId crlf)) which is described at the end of 6.4. Matching in Multislots http://herzberg.ca.sandia.gov/jess/docs/70/rules.html#multimatch? Bob

Re: JESS: Java and Jess: Hashtable etc.

2007-10-20 Thread Robert Kirby
When you add (assert) a Hashtable fact, there's only a single fact. The Jess engine can act on the existence of that fact and the top-level values of slots, not on methods on the contents of slots, such as Hashtable::containsKey(object key) or Hashtable::get(object key). You probably would be

RE: JESS: How can I write this rule?

2007-10-20 Thread Robert Kirby
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) (index2 ?index2)) (not (My-Template (enabled TRUE)

Re: JESS: How to access info in a objects cotained in a arraylist.

2007-09-29 Thread Robert Kirby
The left hand side (LHS) of rules consists of conditional elements, which are patterns to match before the rule fires. The only binding of variables on the LHS comes from matches of parts of the conditional elements. An S-expression that begins with (bind ... on the LHS tries to match a bind

Re: JESS: Rapid Changes to Java Object Values

2007-09-27 Thread Robert Kirby
It looks like you need to explicitly model the changes in slot values with a separate template if you don't want to lose track of the changes. (deftemplate change-event age changed for person (declare (ordered FALSE)) (slot person (type OJBECT)) (slot old-age (type INTEGER))

Re: JESS: How to access info in a objects cotained in a arraylist.

2007-09-26 Thread Robert Kirby
ArrayList, which is a Set-type collection, does not have a getValue method. I assume you meant some Map-type collection like HashMap, HashTable, Attributes or TreeMap, where the get method returns an object for a given key. Bob Kirby At 04:53 PM 9/26/2007, Ernest Friedman-Hill wrote: No cast

Re: JESS: Rules firing only once

2007-08-26 Thread Robert Kirby
A bid deftemplate could be inherited. Each expert could create a specialized bid to work on a problem that the expert is qualified to handle (at a higher salience). Each expert could maintain a count of problems handled. A rule could select (at a lower salience) the bid from the expert with

Re: JESS: query distinct values of a slot

2007-08-03 Thread Robert Kirby
As a Jess 7.0p1 query: (defquery unique-first-name A query for unique first names among person facts ?person - (person (firstName ?firstName)) (not (and ?earlier-person - (person (firstName ?firstName)) (test ( ?earlier-person ?person) (deffunction

Re: JESS: No rules firing

2007-07-30 Thread Robert Kirby
I would help to pretty-print your rules. If you had, you could see that you have (eq ?ov ?locality) (eq ?wv ?street) as patterns within an and to be matched rather than (test (and (eq ?ov ?locality) (eq ?wv ?street))). By the way, the outer and on the LHS of locality-stree is unnecessary.

RE: JESS: No rules firing

2007-07-30 Thread Robert Kirby
) (value ?street?wv)) = (assert (locality-street-match (locality-value ?locality) (street-value ?street Bob Kirby At 12:12 PM 7/30/2007, Robert Kirby wrote: I would help to pretty-print your rules. If you had, you could see that you have (eq ?ov ?locality

Re: JESS: Modify in template

2007-07-17 Thread Robert Kirby
The modify function expects at least two parameters: the first is the fact to be modified and the rest are slot name and modification value pairs. If your Java code has the fact-id, then it could be inserted into the string passed to executeCommand (which is deprecated in 7.0 for eval). For

Re: JESS: Another rule that doesn't fire

2007-06-27 Thread Robert Kirby
Since the accumulate-NextTo pattern (accumulate (bind ?xcount 0) (++ ?xcount) ?xcount (NextTo (room1 ?rid))) doesn't include a room2 match, shouldn't the pattern be matched just once for any one ?rid instantiation? The documentation is not clear about what a token means: a match to a fact or

Re: JESS: Jess syntax change?

2007-05-30 Thread Robert Kirby
The curly braces enclose simple patterns http://herzberg.ca.sandia.gov/jess/docs/70/rules.html#patterns_simple, which are available starting in 7.0. Assigning variable ?cs twice seems redundant in your example. ?cs - (CreditScore {ProgramGroup == PG linkType == Lt cs = 100}) would do the same

Re: JESS: How to write such rule in Jess?

2007-05-25 Thread Robert Kirby
Adapting http://herzberg.ca.sandia.gov/jess/docs/70/rules.html#accumulate_ce (defrule a-class-has-more-than-10-methods (class (className ?clsName)) ?total - (accumulate (bind ?count 0) ; initializer (bind ?count (+ ?count 1)) ; action ?count

Re: JESS: accessing defquery results fails

2007-05-24 Thread Robert Kirby
, then there's no ?val and you get an error when you try to examine the query results. So you need to rethink the rule and what you want to do with ?val. On May 21, 2007, at 12:25 PM, Robert Kirby wrote: While running Jess Version 7.0p1 12/21/2006, accessing defquery results fails with a compound

JESS: accessing defquery results fails

2007-05-21 Thread Robert Kirby
While running Jess Version 7.0p1 12/21/2006, accessing defquery results fails with a compound pattern that works with a defrule. Bob Kirby (deftemplate row A row in a test table. (declare (ordered FALSE)) (slot primary (type SYMBOL)) (slot foreign (type

Re: JESS: Custom printout function

2007-05-21 Thread Robert Kirby
From http://herzberg.ca.sandia.gov/jess/docs/70/deffunctions.html: Normally a deffunction takes a specific number of arguments. To write a deffunction that takes an arbitrary number of arguments, make the last formal parameter be a multifield -- a variable prefixed with a '$' character. When