something like (assert (expression A OR [ B AND C ]))
should work.

Of course, your rules should look like :

(defrule test
        ?exp <- (expression ?x ?op1 [ ?y ?op2 ?z ])
        =>
        action

The point is that [ are not a part of the Jess language. ( and ) are.

Emmanuel L�charny, IKTEK
06 08 33 32 61, www.iktek.com <http://www.iktek.com>


-----Message d'origine-----
De : [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]De
la part de Daniel Carrier
Envoy� : lundi 30 avril 2001 18:19
� : [EMAIL PROTECTED]
Objet : JESS: Parenthesis support in rules


Hi, I'm currently working with Jess to implement a boolean expression
reduction application. All is going well but now I am stuck with those
parenthesis. The thing is, i've built my rules like so :

(defrule some-rule
  ?some-rule <- (expression ?x ?op ?z)
=>
 action)

Which are supposed to work ( and they do! ) with facts entered like this
(assert ( expression A AND B)).

Problem is, if i want to incorporate rules to simulate say distributivity,
then, if i keep the same structure i have now, i would get:

(assert (expression A OR (A AND B)))
(defrule some-rule
 ?some-rule <- (expression ?x ?op1 (?y ?op2 ?z))
=>
action)

but (?y ?op2 ?z) would not match with anything and is even interpreted as
being a function call. I am considering integrating another token in the
assert and rule to change it to

(assert (expression A OR (sub-exp A AND B)))
(defrule some-rule
 ?some-rule <- (expression ?x ?op1 (sub-exp ?y ?op2 ?z))
=>
action)

so it can be interpreted as being a fact and not a function call. What i am
wondering is if it couldn't be done in another way? I find this "sub-exp"
addition to be quite annoying ( in my application's context ) and will
require me to add some processing time which i would like to bypass.


Anyone can help me?



Daniel Carrier



---------------------------------------------------------------------
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]
---------------------------------------------------------------------


---------------------------------------------------------------------
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