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

[{KnowWEPlugin quickInterview}]

!! Solutions
%%ShowSolutions
  @master: Body-Mass-Index
  @show_abstractions: true
  @show_digits: 2
%

!! The Knowledge Base

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

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

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

%%Solution
Weight Assessment
- Underweight
- Normal weight
- Overweight
- Heavy overweight
%

!Knowledge
Here we define __how__ the BMI is calculated and the solutions are derived.

%%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>
</flowchart>

%

Here we follow with some basic stuff that is needed to tell the system, that we have a knowledge base here.

%%KnowledgeBase
BMI Demo
%

!Package
%%Package BMIDemo

%%tags
DemoBMI  
%