Thanks a lot for the reply.
I want to compare strings.
If I look at the result of the printout-function, there are a few facts in my
knowledge base, where the variables have the same value.
I tried eq, eq* and str-compare.
Only str-compare worked. I dont understand, why eq doesnt work.
It uses the Java Object.equals() function, and you can compare strings with it. I
found in the mailing-archiv the question, what the difference would be of eq* and
str-compare. The answer there was:
I think (test (eq* ?X "ABC")) may be fast because, (test (= 0 (str-compare
?X "ABC"))) requires one extra operation.
I guess I miss something.
Thanks for any help.
Vincent
defrule match-price-and-quality
(Tag (TagName "price") (Text ?u))
(Tag (TagName "quality") (Text ?t))
(servicequality ?quality)
(serviceprice ?price)
;;(test (eq ?quality ?t))
;;(test (eq* ?quality ?t))
(test (= 0 (str-compare ?quality ?t)))
=>
(printout t "---- quality ------------- : " ?t crlf )
(printout t "---- servicequality ------ : " ?quality crlf ))
[EMAIL PROTECTED] schrieb am 04.06.02:
> (eq) is a very strong test; (eq 1 1.0) is FALSE, as are (eq 1 "1"),
> (eq "1" 1.0), and all the permutations. Both the types and the values
> of the variables must match. STRING, INTEGER, and FLOAT are all
> different types. My guess is that ?quality and ?t have different
> types.
>
> The "=" function is much looser, and will convert types as needed:
> (= 1 1.0), (= "1" 1.0), etc. are all TRUE. Try using "=" instead of
> "eq".
>
> I think Vincent Wolowski wrote:
> [Charset iso-8859-1 unsupported, filtering to ASCII...]
> > I have the following rule:
> >
> > (defrule match-price-and-quality
> > (Tag (TagName "price") (Text ?u))
> > (Tag (TagName "quality") (Text ?t))
> > (servicequality ?quality)
> > (serviceprice ?price)
> > (test (and (eq ?quality ?t) (<= ?u ?price)))
> > =>
> > (printout t "---- price ----------- : " ?u crlf )
> > (printout t "---- quality --------- : " ?t crlf )
> > (printout t "---- serviceprice ---- : " ?price crlf )
> > (printout t "---- servicequality -- : " ?quality crlf ))
> >
> > If I comment the test CE, the rule gets activated and fires.
> > The values of the variables are OK.
> > I have no idea, why it doesn_t work with the test CE.
> > Thanks for any help!
> >
> > Vincent
> > ______________________________________________________________________________
> > FreeMail in der Premiumversion! Mit mehr Speicher, mehr Leistung, mehr
> > Erlebnis und mehr Pr_mie. Jetzt unter http://club.web.de/?mc=021105
> >
> >
> >
> > --------------------------------------------------------------------
> > To unsubscribe, send the words 'unsubscribe jess-users [EMAIL PROTECTED]'
> > in the BODY of a message to [EMAIL PROTECTED], NOT to the list
> > (use your own address!) 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 9012 [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
> (use your own address!) List problems? Notify [EMAIL PROTECTED]
> --------------------------------------------------------------------
>
______________________________________________________________________________
FreeMail in der Premiumversion! Mit mehr Speicher, mehr Leistung, mehr
Erlebnis und mehr Pr�mie. Jetzt unter http://club.web.de/?mc=021105
--------------------------------------------------------------------
To unsubscribe, send the words 'unsubscribe jess-users [EMAIL PROTECTED]'
in the BODY of a message to [EMAIL PROTECTED], NOT to the list
(use your own address!) List problems? Notify [EMAIL PROTECTED]
--------------------------------------------------------------------