See below.<br><br><div class="gmail_quote">On Fri, Aug 28, 2009 at 12:49 AM, tim fulcher <span dir="ltr"><<a href="mailto:against.entropy@googlemail.com">against.entropy@googlemail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Hi<br>
<br>
Making no bones about it, this is a broad topic request and I've got<br>
little hands-on Drools experience, just looking for some pointers on a<br>
potential Drools approach, feedback appreciated.<br>
<br>
Background:<br>
We have a system which asks online users questions to diagnose an<br>
issue (the problem domain isn't important right now).<br>
The questions are structured in a tree/graph such that one question<br>
leads to another until a conclusion - not exactly rocketscience to<br>
this list I suspect! Any question will have n outputs (defined in<br>
configuration); each output is mapped to an option in an HTML<br>
select/radio button.<br>
<br>
The key issue though is that this question flow is all running in the<br>
browser, by reading in an XML configuration and parsing this in<br>
javascript. Instead I need this executing server side, i.e. in a rule<br>
engine. One reason is that increasingly questions are being automated<br>
- currently we make an ajax call which decides upon the outcome to<br>
select and therefore move onto the next. This is however a little<br>
clunky at present.<br>
<br>
I see Drools as a potential execution engine for our reworked system,<br>
running rules until needing a manual question to be asked, and<br>
triggering question display in a page. Upon the answer the flow<br>
continues in that fashion until a conclusion is reached.<br>
<br>
Specific queries:<br>
<br>
We have a legacy stack of question flows, how to adapt them into a<br>
syntax amenable to Drools? Can I do this at runtime?<br>
( Our question graphs could be accessed via database access or in an<br>
XML format )</blockquote><div>For modeling and processing the questions as fact objects, XML is<br>well suited. If the XML schema is well designed, you may unmarshal<br>(using JAXB) to objects which are ready to be inserted as facts. <br>
</div><div><br> </div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Given many questions have >2 outcomes, I assume each question-answer<br>
permutation would be a rule?</blockquote><div>This would depend on whether distinct activities other than storing the<br>answer and proceeding to the next question as a function of the current<br>answer is required. A generic QA handling would be<br>
<br>when<br> $i : Issue( $a : answers )<br> $q: Question( $next : next )<br> Answer( issue == $i, question == $q, $v : $value )<br>then <br> mouth.ask( $next.get( $v ) ); // global service<br> $a.put( $q, $v );<br>end <br>
</div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><br>
<br>
Does every question have to be mapped to a bean to become a fact to<br>
operate on? Given our questions are of a few broad types<br>
(boolean,numeric,select one) is that all I need to model?</blockquote><div><br>It's possible that you can have your questions as data in a map, not as<br>individual facts. The rule engine would then just handle the "abstract<br>
QA algorithm", asking Qs, registering As, pursuing the issue, going<br>back to previous answers, etc. If this isn't feasible or practical, you<br>would indeed have all Qs as facts. Presumably a small hierarchy of<br>
classes (AbstractQ, BooleanQ, NumericQ, EnumQ ) is sufficient.<br> <br></div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<br>
In our current setup a user could decide to re-answer an earlier<br>
question and therefore take an alternate route. What would be the<br>
equivalent in Drools?</blockquote><div><br>Easy: There would be a rule determining that A(Q) is already there;<br>the fact representing the Q might determine whether this is permitted<br>etc. <br></div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<br>
If this is viable, will I need 1 rule outcome to pose a question and<br>
another to operate on the outcome, i.e. will the rules fire up<br>
to/including the decision to ask a question, then when an answer fact<br>
is injected into working memory the rules will fire from that point<br>
onwards?<br>
</blockquote><div><br>In such a scenario a session might "run until halt", possibly with one<br>set of rules being conditioned to fire when there is an unhandled anwer,<br>and another set prepared to fire when there is no open question in<br>
the WM. <br> <br>HTH<br>-W<br></div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><br>
<br>
Thanks<br>
<br>
A:E<br>
_______________________________________________<br>
rules-users mailing list<br>
<a href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a><br>
<a href="https://lists.jboss.org/mailman/listinfo/rules-users" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-users</a><br>
</blockquote></div><br>