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!
To test it, add some values in the interview questionnaire below.

!! Interview


!! Solutions

@show_abstractions: true

!! The Knowledge Base

In this part of the article, the knowledge base for this demo is defined.


We first define __what__ questions can be asked and solutions can be derived in this demo.

Start questionaire #1
- Height [num] (0.1 3) {m} 
- Weight [num] (1 300) {kg}
- bmi [num] <abstract>

Weight Assessment
- Underweight
- Normal weight
- Overweight
- Severe overweight

We also define german question and solution texts. This is optional. If no texts are given for a certain language, the original name is shown.

%%Property = Wie groß sind Sie? = Wie schwer sind Sie? = Ihr Body Mass Index = Untergewicht
Normal = Normalgewicht = Übergewicht
Severe = Starkes Übergewicht
Severe = Ihr BMI ist größer 35. Sie sollten dringend abnehmen.



Here we define __how__ the BMI is calculated and the solutions are derived.\\
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".

<flowchart fcid="flow_26ef012e" name="Main" icon="sanduhr.gif" width="789" height="262" autostart="true" idCounter="21">

	<!-- nodes of the flowchart -->
	<node fcid="#node_2">
		<position left="20" top="89"></position>
		<action markup="KnOffice"><![CDATA[Height]]></action>

	<node fcid="#node_3">
		<position left="175" top="89"></position>
		<action markup="KnOffice"><![CDATA[Weight]]></action>

	<node fcid="#node_5">
		<position left="32" top="20"></position>

	<node fcid="#node_7">
		<position left="327" top="89"></position>
		<action markup="KnOffice"><![CDATA["bmi" = ((Weight / (Height*Height)))]]></action>

	<node fcid="#node_9">
		<position left="173" top="211"></position>
		<action markup="KnOffice"><![CDATA["Underweight" = P7]]></action>

	<node fcid="#node_11">
		<position left="331" top="211"></position>
		<action markup="KnOffice"><![CDATA["Normal weight" = P7]]></action>

	<node fcid="#node_13">
		<position left="480" top="211"></position>
		<action markup="KnOffice"><![CDATA["Overweight" = P7]]></action>

	<node fcid="#node_20">
		<position left="635" top="211"></position>
		<action markup="KnOffice"><![CDATA["Severe overweight" = P7]]></action>

	<!-- rules of the flowchart -->
	<edge fcid="#rule_4">
		<guard markup="KnOffice"><![CDATA["Height" > 0]]></guard>

	<edge fcid="#rule_6">

	<edge fcid="#rule_8">
		<guard markup="KnOffice"><![CDATA[KNOWN["Weight"]]]></guard>

	<edge fcid="#rule_10">
		<guard markup="KnOffice"><![CDATA["bmi" < 18.5]]></guard>

	<edge fcid="#rule_12">
		<guard markup="KnOffice"><![CDATA["bmi" >= 18.5 AND "bmi" <= 25]]></guard>

	<edge fcid="#rule_14">
		<guard markup="KnOffice"><![CDATA["bmi" > 25 AND "bmi" <= 35]]></guard>

	<edge fcid="#rule_21">
		<guard markup="KnOffice"><![CDATA["bmi" > 35]]></guard>



!Definition of Knowledge Base

Here we follow with some basic stuff that is needed to tell the system, that we have a knowledge base here. Using the menu that expands when hovering over the small book icon on the right, you can also export the knowledge base as a .d3web-file to load and run it in your own application (click ''Download''), or start a one-choice-dialog for this demo (click ''Run Interview'').

BMI Demo


%%Package BMIDemo