Hi Kathy,
The way this is generally dealt with is for each prioritized rule to
make the conditions untrue after it fires, so that lower-priority
rules are deactivated. In your case, you could do this by making code
look like
(deftemplate code (slot value) (slot container (default UNKNOWN)))
(defrule air-transportable-tonnage
(declare (salience 100))
?c <- (code (value ?v&:(first-char-is R)) (container UNKNOWN))
=>
(modify ?c (container air-transportable-tonnage)))
If all the rules require 'UNKNOWN' in the container slot, then only
the highest in salience will fire.
Of course, there are many variations on this using more than just the
one deftemplate; feel free to modify to suit.
I think Kathy Lee Simunich wrote:
>
> I'm converting a pre-existing pseudo-rulebase for use within JESS.
> I use the term pseudo, because the rules have an implicit ordering
> to them. Basically, they used to process the rules by checking each
> one in order, and the first one to fire is the answer. It is a
> categorization
> rulebase, where a multi-digit code is being categorized as a type
> of container. And the rules start with the most-specific type of
> container it could be, and end with the most-generic type.
>
> A much simplified example:
> Code = R2B
>
> Rule1
> if (codeChar1 = R)
> then container = air-transportable-tonnage
>
> Rule2
> if (codeChar3 = B)
> then container = generic-container
>
> The problem I am facing is that the creators/users of the rules cannot
> completely specify every possible combination of codes. They use
> the implicit ordering to have a fall-through so that they can have
> some sort of classification in case they didn't specify a combination.
> In the above example, they are interested in catching
> air-transportable-tonnage
> specifically, but all other **B codes can just be plain containers.
> When I
> translate the above rules into JESS, of course I get both rules to fire,
>
> when what I really want is the results from Rule1. I've tried putting
> in Rule2 (if codeChar1 ~=R), but there are other rules where I would
> have to say & notX & notY, etc. And so if I added another specific
> rule, I would also have to add the not condition to Rule2. This seems
> too high maintenance.
>
> How would I go about coding the JESS rulebase in order to catch only
> the most specific categorization? Using salience still fires them all
> in
> a specific order, but how do I pair the list down to a single return
> value?
> Any hints would be appreciated.
>
> KathyLee Simunich
> Argonne National Lab
>
> ---------------------------------------------------------------------
> To unsubscribe, send the words 'unsubscribe jess-users [EMAIL PROTECTED]'
> in the BODY of a message to [EMAIL PROTECTED], NOT to the
> list. List problems? Notify [EMAIL PROTECTED]
> ---------------------------------------------------------------------
>
>
---------------------------------------------------------
Ernest Friedman-Hill
Distributed Systems Research Phone: (925) 294-2154
Sandia National Labs FAX: (925) 294-2234
Org. 8920, MS 9214 [EMAIL PROTECTED]
PO Box 969 http://herzberg.ca.sandia.gov
Livermore, CA 94550
---------------------------------------------------------------------
To unsubscribe, send the words 'unsubscribe jess-users [EMAIL PROTECTED]'
in the BODY of a message to [EMAIL PROTECTED], NOT to the
list. List problems? Notify [EMAIL PROTECTED]
---------------------------------------------------------------------