Hello,
I have the following rules with the corresponding code in the LHS of
each in a single .drl file. These were not written by me but by someone
just as new to drools as I am. At the moment I'm not concerned with the
RHS of the rule.
rule "L_Quest_Q1_Add"
salience 20
when
not FormResponse(questionNumber == "Q1")
l_Quest : L_Quest(questionNumber =="Q1")
rule "L_Quest_Q3_Add"
salience 20
when
not FormResponse(questionNumber == "Q3")
l_Quest : L_Quest(questionNumber =="Q3")
rule "L_Quest_Q2_Add"
salience 10
when
formResponse1 : FormResponse(questionNumber == "Q1",
responseData == "Yes")
not FormResponse(questionNumber == "Q2")
l_Quest : L_Quest(questionNumber =="Q2")
rule "L_Quest_Q4_Add"
salience 10
when
formResponse3 : FormResponse(questionNumber == "Q3",
responseData == "Yes")
not formResponse4 : FormResponse(questionNumber == "Q4")
l_Quest : L_Quest(questionNumber =="Q4")
I want to rewrite these rules in a .dsl file making them as generic as
possible. Something like
when question {q} is not answered=not FormResponse(questionNumber == {q}
My question is regarding how to reference the 'formResponse' object.
For rule Q2_Add, do I really need to create 'formResponse1' and for rule
Q4_Add, do I have to create 'formResponse3' and 'formResponse4'? I
don't really want to have specific rules in my .dsl file like
when question 1 is answered=FormResponse1(questionNumber == 1, etc.
when question 3 is answered=FormResponse3(questionNumber == 3, etc.
when question 4 is not answered=not FormResponse4(questionNumber == 4)
Since I may have lots of questions, I don't want to have to have the
numbers hard-coded in the .dsl syntax if I don't have to. That's why
I'm wanting to know if I have to qualify 'FormResponse' so the rule
engine knows which 'FormResponse' I mean.
Thanks,
Rod