%%KnowledgeBase BMI Demo @uses: BMI Demo % This simple knowledge base derives the body-mass-index (BMI) of a person based on the weight and height. Please note that this is a simple example for demonstration uses! The BMI is calculated using DiaFlux models, where first the "Height" and "Weight" is asked to the user. Then, the value of the abstraction "bmi" is derived, when values for the aforementioned questions are known. Final solutions are derived depending on the result of the calculated value of "bmi". !!! Interview and Solutions %%ShowSolutions @master: Body-Mass-Index @show_abstractions: true @show_digits: 2 % [{KnowWEPlugin quickInterview}] !!! The Knowledge Base %%DiaFlux <flowchart fcid="flow_26ef012e" name="Main" icon="sanduhr.gif" width="623" height="397" autostart="true" idCounter="19"> <!-- nodes of the flowchart --> <node fcid="#node_2"> <position left="35" top="150"></position> <action markup="KnOffice">Height</action> </node> <node fcid="#node_3"> <position left="190" top="150"></position> <action markup="KnOffice">Weight</action> </node> <node fcid="#node_5"> <position left="47" top="81"></position> <start>Start</start> </node> <node fcid="#node_7"> <position left="322" top="150"></position> <action markup="KnOffice">"bmi" = ((Weight / (Height*Height)))</action> </node> <node fcid="#node_9"> <position left="168" top="272"></position> <action markup="KnOffice">"Underweight" = P7</action> </node> <node fcid="#node_11"> <position left="326" top="272"></position> <action markup="KnOffice">"Normal weight" = P7</action> </node> <node fcid="#node_13"> <position left="475" top="272"></position> <action markup="KnOffice">"Overweight" = P7</action> </node> <!-- rules of the flowchart --> <edge fcid="#rule_4"> <origin>#node_2</origin> <target>#node_3</target> <guard markup="KnOffice">"Height" > 0</guard> </edge> <edge fcid="#rule_6"> <origin>#node_5</origin> <target>#node_2</target> </edge> <edge fcid="#rule_8"> <origin>#node_3</origin> <target>#node_7</target> <guard markup="KnOffice">KNOWN["Weight"]</guard> </edge> <edge fcid="#rule_10"> <origin>#node_7</origin> <target>#node_9</target> <guard markup="KnOffice">"bmi" < 18.5</guard> </edge> <edge fcid="#rule_12"> <origin>#node_7</origin> <target>#node_11</target> <guard markup="KnOffice">"bmi" >= 18.5 AND "bmi" <= 25</guard> </edge> <edge fcid="#rule_14"> <origin>#node_7</origin> <target>#node_13</target> <guard markup="KnOffice">"bmi" > 25</guard> </edge> <preview mimetype="text/html"> <![CDATA[ <DIV class="Flowchart" style=" width: 633px; height: 403px;"><DIV class="Node" id="#node_2" style="left: 35px;top: 150px; width: 95px; height: 42px;"><DIV class="question" style=" width: 82px; height: 42px;"><DIV class="decorator" style=" width: 20px; height: 20px;"></DIV><DIV class="ActionPane" style=" width: 80px; height: 38px;"><DIV class="object" style=" width: 80px; height: 19px;"><SPAN class="icon" style=" width: 16px; height: 15px;"><IMG src="cc/image/kbinfo/num.gif" style=" width: 16px; height: 16px;"></IMG></SPAN>Height</DIV><DIV class="value" style=" width: 80px; height: 19px;">ask</DIV></DIV></DIV></DIV><DIV class="Node" id="#node_3" style="left: 190px;top: 150px; width: 95px; height: 42px;"><DIV class="question" style=" width: 82px; height: 42px;"><DIV class="decorator" style=" width: 20px; height: 20px;"></DIV><DIV class="ActionPane" style=" width: 80px; height: 38px;"><DIV class="object" style=" width: 80px; height: 19px;"><SPAN class="icon" style=" width: 16px; height: 15px;"><IMG src="cc/image/kbinfo/num.gif" style=" width: 16px; height: 16px;"></IMG></SPAN>Weight</DIV><DIV class="value" style=" width: 80px; height: 19px;">ask</DIV></DIV></DIV></DIV><DIV class="Node" id="#node_5" style="left: 47px;top: 81px; width: 75px; height: 20px;"><DIV class="start" style=" width: 62px; height: 20px;"><DIV class="decorator" style=" width: 20px; height: 20px;"></DIV><DIV class="title" style=" width: 60px; height: 15px;">Start</DIV></DIV></DIV><DIV class="Node" id="#node_7" style="left: 322px;top: 150px; width: 174px; height: 42px;"><DIV class="action" style=" width: 161px; height: 42px;"><DIV class="decorator" style=" width: 20px; height: 20px;"></DIV><DIV class="ActionPane" style=" width: 159px; height: 38px;"><DIV class="object" style=" width: 159px; height: 19px;"><SPAN class="icon" style=" width: 16px; height: 15px;"><IMG src="cc/image/kbinfo/num-abstract.gif" style=" width: 16px; height: 16px;"></IMG></SPAN>bmi</DIV><DIV class="value" style=" width: 159px; height: 19px;">= (Weight / (Height*Height))</DIV></DIV></DIV></DIV><DIV class="Node" id="#node_9" style="left: 168px;top: 272px; width: 109px; height: 42px;"><DIV class="action" style=" width: 96px; height: 42px;"><DIV class="decorator" style=" width: 20px; height: 20px;"></DIV><DIV class="ActionPane" style=" width: 94px; height: 38px;"><DIV class="object" style=" width: 94px; height: 19px;"><SPAN class="icon" style=" width: 16px; height: 15px;"><IMG src="cc/image/kbinfo/diagnosis.gif" style=" width: 16px; height: 16px;"></IMG></SPAN>Underweight</DIV><DIV class="value" style=" width: 94px; height: 19px;">established</DIV></DIV></DIV></DIV><DIV class="Node" id="#node_11" style="left: 326px;top: 272px; width: 121px; height: 42px;"><DIV class="action" style=" width: 108px; height: 42px;"><DIV class="decorator" style=" width: 20px; height: 20px;"></DIV><DIV class="ActionPane" style=" width: 106px; height: 38px;"><DIV class="object" style=" width: 106px; height: 19px;"><SPAN class="icon" style=" width: 16px; height: 15px;"><IMG src="cc/image/kbinfo/diagnosis.gif" style=" width: 16px; height: 16px;"></IMG></SPAN>Normal weight</DIV><DIV class="value" style=" width: 106px; height: 19px;">established</DIV></DIV></DIV></DIV><DIV class="Node" id="#node_13" style="left: 475px;top: 272px; width: 101px; height: 42px;"><DIV class="action" style=" width: 88px; height: 42px;"><DIV class="decorator" style=" width: 20px; height: 20px;"></DIV><DIV class="ActionPane" style=" width: 86px; height: 38px;"><DIV class="object" style=" width: 86px; height: 19px;"><SPAN class="icon" style=" width: 16px; height: 15px;"><IMG src="cc/image/kbinfo/diagnosis.gif" style=" width: 16px; height: 16px;"></IMG></SPAN>Overweight</DIV><DIV class="value" style=" width: 86px; height: 19px;">established</DIV></DIV></DIV></DIV><DIV class="Rule" id="#rule_4" style=" width: 0px; height: 0px;"><DIV class="h_line" style="left: 130px;top: 171px; width: 60px; height: 1px;"><DIV class="arrow_right" style=" width: 9px; height: 9px;"></DIV></DIV><DIV style="position: absolute;left: 130px;top: 171px;overflow: visible; width: 0px; height: 0px;"><DIV class="guard" style="position: absolute;left: 7px; width: 27px; height: 12px;"><DIV class="GuardPane" style=" width: 27px; height: 12px;"><DIV style=" width: 27px; height: 12px;">> 0 m</DIV></DIV></DIV></DIV><DIV class="rule_highlight" style=" width: 0px; height: 0px;"><DIV class="h_line_highlight" style="left: 129px;top: 170px; width: 62px; height: 3px;"></DIV></DIV><DIV class="rule_selector" style=" width: 0px; height: 0px;"><DIV class="rule_selector" style="position: absolute;left: 127px;top: 168px;overflow: hidden; width: 66px; height: 7px;"></DIV></DIV></DIV><DIV class="Rule" id="#rule_6" style=" width: 0px; height: 0px;"><DIV class="v_line" style="left: 84px;top: 101px; width: 1px; height: 49px;"><DIV class="arrow_down" style=" width: 9px; height: 9px;"></DIV></DIV><DIV style="position: absolute;left: 84px;top: 101px;overflow: visible; width: 0px; height: 0px;"><DIV class="guard" style="position: absolute;left: 3px;top: 2px; width: 0px; height: 0px;"><DIV class="GuardPane" style=" width: 0px; height: 0px;"><DIV style=" width: 0px; height: 0px;"> </DIV></DIV></DIV></DIV><DIV class="rule_highlight" style=" width: 0px; height: 0px;"><DIV class="v_line_highlight" style="left: 83px;top: 100px; width: 3px; height: 51px;"></DIV></DIV><DIV class="rule_selector" style=" width: 0px; height: 0px;"><DIV class="rule_selector" style="position: absolute;left: 81px;top: 98px;overflow: hidden; width: 7px; height: 55px;"></DIV></DIV></DIV><DIV class="Rule" id="#rule_8" style=" width: 0px; height: 0px;"><DIV class="h_line" style="left: 285px;top: 171px; width: 37px; height: 1px;"><DIV class="arrow_right" style=" width: 9px; height: 9px;"></DIV></DIV><DIV style="position: absolute;left: 285px;top: 171px;overflow: visible; width: 0px; height: 0px;"><DIV class="guard" style="position: absolute;left: 7px; width: 32px; height: 12px;"><DIV class="GuardPane" style=" width: 32px; height: 12px;"><DIV style=" width: 32px; height: 12px;">known </DIV></DIV></DIV></DIV><DIV class="rule_highlight" style=" width: 0px; height: 0px;"><DIV class="h_line_highlight" style="left: 284px;top: 170px; width: 39px; height: 3px;"></DIV></DIV><DIV class="rule_selector" style=" width: 0px; height: 0px;"><DIV class="rule_selector" style="position: absolute;left: 282px;top: 168px;overflow: hidden; width: 43px; height: 7px;"></DIV></DIV></DIV><DIV class="Rule" id="#rule_12" style=" width: 0px; height: 0px;"><DIV class="v_line" style="left: 409px;top: 192px; width: 1px; height: 80px;"><DIV class="arrow_down" style=" width: 9px; height: 9px;"></DIV></DIV><DIV style="position: absolute;left: 409px;top: 192px;overflow: visible; width: 0px; height: 0px;"><DIV class="guard" style="position: absolute;left: 3px;top: 2px; width: 50px; height: 12px;"><DIV class="GuardPane" style=" width: 50px; height: 12px;"><DIV style=" width: 50px; height: 12px;">[ 18.5 .. 25 ] </DIV></DIV></DIV></DIV><DIV class="rule_highlight" style=" width: 0px; height: 0px;"><DIV class="v_line_highlight" style="left: 408px;top: 191px; width: 3px; height: 82px;"></DIV></DIV><DIV class="rule_selector" style=" width: 0px; height: 0px;"><DIV class="rule_selector" style="position: absolute;left: 406px;top: 189px;overflow: hidden; width: 7px; height: 86px;"></DIV></DIV></DIV><DIV class="Rule" id="#rule_10" style=" width: 0px; height: 0px;"><DIV class="v_line" style="left: 351px;top: 192px; width: 1px; height: 40px;"><DIV class="no_arrow" style=" width: 0px; height: 0px;"></DIV></DIV><DIV class="h_line" style="left: 215px;top: 231.5px; width: 137px; height: 1px;"><DIV class="no_arrow" style=" width: 0px; height: 0px;"></DIV></DIV><DIV class="v_line" style="left: 215px;top: 231.5px; width: 1px; height: 40px;"><DIV class="arrow_down" style=" width: 9px; height: 9px;"></DIV></DIV><DIV style="position: absolute;left: 351px;top: 192px;overflow: visible; width: 0px; height: 0px;"><DIV class="guard" style="position: absolute;left: 3px;top: 2px; width: 30px; height: 12px;"><DIV class="GuardPane" style=" width: 30px; height: 12px;"><DIV style=" width: 30px; height: 12px;">< 18.5 </DIV></DIV></DIV></DIV><DIV class="rule_highlight" style=" width: 0px; height: 0px;"><DIV class="v_line_highlight" style="left: 350px;top: 191px; width: 3px; height: 42px;"></DIV><DIV class="h_line_highlight" style="left: 214px;top: 230.5px; width: 139px; height: 3px;"></DIV><DIV class="v_line_highlight" style="left: 214px;top: 230.5px; width: 3px; height: 42px;"></DIV></DIV><DIV class="rule_selector" style=" width: 0px; height: 0px;"><DIV class="rule_selector" style="position: absolute;left: 348px;top: 189px;overflow: hidden; width: 7px; height: 46px;"></DIV><DIV class="rule_selector" style="position: absolute;left: 212px;top: 228.5px;overflow: hidden; width: 143px; height: 7px;"></DIV><DIV class="rule_selector" style="position: absolute;left: 212px;top: 228.5px;overflow: hidden; width: 7px; height: 46px;"></DIV></DIV></DIV><DIV class="Rule" id="#rule_14" style=" width: 0px; height: 0px;"><DIV class="v_line" style="left: 485px;top: 192px; width: 1px; height: 80px;"><DIV class="arrow_down" style=" width: 9px; height: 9px;"></DIV></DIV><DIV style="position: absolute;left: 485px;top: 192px;overflow: visible; width: 0px; height: 0px;"><DIV class="guard" style="position: absolute;left: 3px;top: 2px; width: 21px; height: 12px;"><DIV class="GuardPane" style=" width: 21px; height: 12px;"><DIV style=" width: 21px; height: 12px;">> 25 </DIV></DIV></DIV></DIV><DIV class="rule_highlight" style=" width: 0px; height: 0px;"><DIV class="v_line_highlight" style="left: 484px;top: 191px; width: 3px; height: 82px;"></DIV></DIV><DIV class="rule_selector" style=" width: 0px; height: 0px;"><DIV class="rule_selector" style="position: absolute;left: 482px;top: 189px;overflow: hidden; width: 7px; height: 86px;"></DIV></DIV></DIV></DIV> ]]> </preview> </flowchart> @package: BMI Demo % __Terminology Definitions:__ %%Question Startquestionaire #1 - Height [num] (0.1 3) {m} - Weight [num] (1 300) {kg} - bmi [num] <abstract> @package: BMI Demo % %%Solution Weight Assessment - Underweight - Normal weight - Overweight - Heavy overweight @package: BMI Demo % %%tags DemoBMI %