I think Jens Liegle wrote:
[Charset iso-8859-1 unsupported, filtering to ASCII...]
> Dear All:
> I have the following CLIPS rule that I need to convert to Jess:
> I have problems with 1) and 2)
> 
> (defrule myforward
>     (topic (name ?first) (color (?firstcolor&black|grey))        ; 1)
> problem 1 &black|grey

Recent releases of Jess 5.0 support the '|' connective, although it's
entirely equivalent to the somewhat more verbose

?firstcolor&:(or (eq ?firstcolor black) (eq ?firstcolor grey))

(By the way, there are an extra set of parentheses in your rule here:
the open paren before ?firstcolor and the close after grey should be
removed or this looks like a match on a function call.)


>     (prereq (general ?first) (specific ?second))
>     ?x0 <- (topic (name ?second) (color ?color&red))
>     (not (exists (and (prereq (general ?otherfirst &~ ?first) (specific
> ?second)))  ; 2) *
>                                   (topic (name ?otherfirst) (color red |
> green)


Jess has neither (exists) nor (and) right now. (Unique) is something
like (exists), but not quite. In the next release of Jess it will be
improved, actually, thanks to comments from our friend Vicken
Kasparian. As to (and), as parenthesized above, there's only one fact
inside the (and), so it doesn't seem as though you actually need it!
But there certainly are cases where it would be useful. (not (and (A)
(B))) is equivalent to (or (not (A)) (not (B))), so the best you can
do is break the rule into two, with the same RHS, with (not (A)) on
one LHS and (not (B)) on the other. It's not ideal but it more-or-less
works.

More complex tree-like LHSs is a project I will be tackling for the
next major Jess release (i.e., post- 5.0).

>                         )
>                 )
>     )
> =>
> (modify ?x0 (color green))
> )
> 
> * 2) here the
>     (not (exists (and    AND
> 
> Which also raises the question (have not tried yet): Does Jess support
> EXISTS?
> 
> with the templates
> (deftemplate prereq (slot general) (slot specific))
> and
> (deftemplate topic (slot name) (slot color))
> 
> 
> Thanks so much for all help!
> 
> Jens Liegle
> [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]
---------------------------------------------------------------------

Reply via email to