Both sides previous revision
Previous revision
Next revision
|
Previous revision
|
hekate:hmr [2009/08/14 15:05] gjn esimon doc imported |
hekate:hmr [2014/05/09 12:14] esimon [Rules definitions] |
See the [[HaDEs]] page for an overview. | See the [[HaDEs]] page for an overview. |
| |
==== Example ==== | ===== Example ===== |
| |
An example excerpt of HMR is given below: | An example excerpt of HMR is given below: |
| |
The first line defines an XTT table scheme, or header, defining all of the attributes used in the table. | The first line defines an XTT table scheme, or header, defining all of the attributes used in the table. |
Its semantics is as follows: | |
//the XTT table ''th'' has two conditional attributes: ''today'' and ''hour'' and one decision attribute: ''operation''//. | Its semantics is as follows:\\ |
| //The XTT table ''th'' has two conditional attributes: ''today'' and ''hour'' and one decision attribute: ''operation''//.\\ |
This information is determined from the conceptual design phase using the ARD method. | This information is determined from the conceptual design phase using the ARD method. |
Then two examples of rules are given. | Then two examples of rules are given. |
The second rule can be read as: | |
| The second rule can be read as:\\ |
//Rule with ID ''4'' in the XTT table called ''th'': if value of the attribute ''today'' equals (''='') value ''workday'' and the value of the attribute ''hour'' belongs to the range (''in'') ''<9,17>'' then set the value of the attribute ''operation'' to the value ''bizhours''.// | //Rule with ID ''4'' in the XTT table called ''th'': if value of the attribute ''today'' equals (''='') value ''workday'' and the value of the attribute ''hour'' belongs to the range (''in'') ''<9,17>'' then set the value of the attribute ''operation'' to the value ''bizhours''.// |
| |
* //type// - a field that contains a name of a type defined as //xtype//. This field denotes the attribute's type. | * //type// - a field that contains a name of a type defined as //xtype//. This field denotes the attribute's type. |
* //comm// - a field that describes attribute's relation to the world. If the attribute is //in// it means that a value of it is supposed to be given by the user; if the attribute is out it means that the value of it should be presented to the user; if attribute is inter it means that its value is set by the system as a result of inference process, but it;s not relevant to the user; if the attribute is comm, it means that it's both in and out. | * //comm// - a field that describes attribute's relation to the world. If the attribute is //in// it means that a value of it is supposed to be given by the user; if the attribute is out it means that the value of it should be presented to the user; if attribute is inter it means that its value is set by the system as a result of inference process, but it;s not relevant to the user; if the attribute is comm, it means that it's both in and out. |
* //callback// - a field that contains an information about which callback is supposed to be fired for the attribute. The list should look as follows: //[callback_name, [callback_parameters] ]//, where callback_name is a name of defined callback (see [[heart-howto#callbacks_definitions]]), and callback_parameters is a list of parameters that the callback takes. | * //callback// - a field that contains an information about which callback is supposed to be fired for the attribute. The list should look as follows: //[callback_name, [callback_parameters] ]//, where callback_name is a name of defined callback (see [[heart_howto#callbacks_definitions]]), and callback_parameters is a list of parameters that the callback takes. |
* //abbrev// - a field that contains short name of the attribute. | * //abbrev// - a field that contains short name of the attribute. |
* //desc// - a field that contains longer description of the attribute. | * //desc// - a field that contains longer description of the attribute. |
* //%LIST1%// - contains a list of firing conditions for the rule. Each condition has to be valid ALSV(FD) expression of the form //attribute_name ALSV_OPERATOR value// | * //%LIST1%// - contains a list of firing conditions for the rule. Each condition has to be valid ALSV(FD) expression of the form //attribute_name ALSV_OPERATOR value// |
* //%LIST2%// - contains decisions that has to be fired when conditions are true. Decision is of the form //attribute_name set value// | * //%LIST2%// - contains decisions that has to be fired when conditions are true. Decision is of the form //attribute_name set value// |
| * The value can be an expression including basic operators like (+,-,/,*) and functions like union, intersect, except |
* //%LIST3%// - contains list of actions with its parameters of the form //[action_name, [action_parameters]]//. Those actions are fired when rule's conditions are true. Actions cannot change system's state. | * //%LIST3%// - contains list of actions with its parameters of the form //[action_name, [action_parameters]]//. Those actions are fired when rule's conditions are true. Actions cannot change system's state. |
* //%STRING2%// - is a schema (table) name that should be given a token when inference mode is set to Token-Driven. | * //%STRING2%// - is a schema (table) name that should be given a token when inference mode is set to Token-Driven. |
* %STRING% - is an unique ID that is automatically generated every time a inference process is fired. | * %STRING% - is an unique ID that is automatically generated every time a inference process is fired. |
* %LIST% - is a list of two-elements list of the form: | * %LIST% - is a list of two-elements list of the form: |
* [entity_id, state_id] - where //entity_id// is a name of entity after which a state of the system was capture (it can be name of a table, name of a rule). Trajectory contains as a first element state of the system before inference process; entity for this state is called //start//. \\ The //state_id// is a name of a [[xstat/1]] record where the state of the system was saved. | * [entity_id, state_id] - where //entity_id// is a name of entity after which a state of the system was capture (it can be name of a table, name of a rule). Trajectory contains as a first element state of the system before inference process; entity for this state is called //start//. \\ The //state_id// is a name of a ''xstat/1'' record where the state of the system was saved. |
| |
| |