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
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
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
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
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
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
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
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)
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
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))
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
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
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
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.
) (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
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
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
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
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
, 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
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
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
22 matches
Mail list logo