Hi Michael,

Well, as written, of course, the rule fires -zero- times, not twice:
the double-quotes in the assert make your intended multifield members
into a single quoted string. 

But, removing the quotes, this rule does fire twice. I think there's
just a bit of confusion here about how multifields work. When a
multifield-containing fact is being matched against a pattern like
($?first ?test $?restOfIt), the available fields are put into three
piles, correspoonding to the three variables, in as many ways as
possible, subject only to the restriction that a single-field variable
must match one actual datum, and multifield variables can match zero
or more datums. So the possible ways for your test string are

(Olds Delta 98) (1999) ()
(Olds Delta) (98) (1999)
(Olds) (Delta) (98 1999)
() (Olds) (Delta 98 1999)

I'm not sure what the form of your strings will be, so I can't
recommend what pattern you should actually use; but if
you're interested in the last field, it would be most efficient to
simply match to last field as a single variable and use a 'numberp'
test on it.

        (autoMultiString (text $?first ?test ?year&:(numberp ?year)))

I think Michael Lucero wrote:
> 
> I have the following:
> 
> (deftemplate autoMultiString (multislot text))
> (assert (autoMultiString (text "Olds Delta 98 1999")))
> 
> ;;******************************************************
> (defrule findLastTokenYear
>     ?a<-(autoMultiString (text $?first ?test $?restOfIt))
>     (test (numberp ?test))
>     ;;(test (not(numberp (sym-cat ?restOfIt))));; this did not work
> either
>     ;;(test (not(numberp (implode$ ?restOfIt))));; neither did this
>     (test (not(numberp (str-cat ?restOfIt))))
> =>
>     (printout t "%%%findLastTokenYear FIRED " ?test " #" (str-cat
> ?restOfIt) "&&" crlf)
> )
> 
> The intent is for this rule to fire on ONLY  the last numeric token in
> the multifield.
> 
> It fires twice -
> 
> %%%findLastTokenYear FIRED 98 #1999&&
> %%%findLastTokenYear FIRED 1999 #&&
> 
> I'd expect only the 2nd one to occur.  What am I doing wrong here?
> 
> Thanks in advance,
> 
> Michael Lucero
> 
> 
> 
> ---------------------------------------------------------------------
> 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]
---------------------------------------------------------------------

Reply via email to