JESS: how to write If else rule

2008-12-10 Thread hansari

I need rule for

if (condtion1)
 then (acton1)
if else (conditon2)
then   (action2)
if else (condition3)
then (action3)
else (acton4)

how can perform this by using defrule 
please help me.

thank you. 
-- 
View this message in context: 
http://www.nabble.com/how-to-write-If-else-rule-tp20929177p20929177.html
Sent from the Jess mailing list archive at Nabble.com.




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]




Re: JESS: how to write If else rule

2008-12-10 Thread Dusan Sormaz

Hasan,

Jess (and other rule-based languages) is not procedural, but more 
declarative.


rules are in the form:

(defrule myrule
   (condition 1)
(condition 2)
(condituin 3)
=
(action 1)
(action 2 ))

Each rule is independent of others. All of them are evaluated for their 
conditions and one is selected to run. Conditions are in the from of 
patterns which are defined using facts. Order of execution of the  rules 
is defined by set of facts.


for more details read Jess manual and books or rule-based programming.

Dusan Sormaz
hansari wrote:

I need rule for

if (condtion1)
 then (acton1)
if else (conditon2)
then   (action2)
if else (condition3)
then (action3)
else (acton4)

how can perform this by using defrule 
please help me.


thank you. 
  


--
***
* Dusan Sormaz, PhD, Associate Professor
* Ohio University
* Department of Industrial and Systems Engineering
* 284 Stocker Center, Athens, OH 45701-2979
* phone: (740) 593-1545 
* fax:nbsp;nbsp; (740) 593-0778
* e-mail: [EMAIL PROTECTED] 
* url: http://www.ent.ohiou.edu/~sormaz

***




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]




Re: JESS: how to write If else rule

2008-12-10 Thread Kartik Tadanki


The way one should do it in JESS is not procedurally has been expected here.

The conditions should be used to build the rules separately,
If you need an else if structure, it ideally is what  JESS does naturally.
However , if your requirement is :
   if(c1)
   {
   a1.
   if(c2)
   {
  a2.
   }
   }
 Then you could simply use both the conditions in the rule for firing 
a2 and only c1 for a1.



hansari wrote:

I need rule for

if (condtion1)
 then (acton1)
if else (conditon2)
then   (action2)
if else (condition3)
then (action3)
else (acton4)

how can perform this by using defrule 
please help me.


thank you. 
  





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]