Attribute values are set by creating an attribute element for each attribute whose value is to be specified. There are few important things to note about setting attribute instance values:
Example:
If we had a rulebase which has the following base level attributes:
| Attribute ID | Text | Data Type |
|---|---|---|
| DOB | The person's date of birth | Date |
| name | The person’s full name | Text |
| weekly_earnings | The person’s weekly earnings | Currency |
| AU_citizen | The person is an Australian citizen | Boolean |
| AU_Birth | The person was born in Australia | Boolean |
| num_pets | The number of pets the person owns | Number |
The data XML to set the attribute values may look something like:
1 <attribute id="DOB">2 <date-val>1952-12-01</date-val>3 </attribute>4 <attribute id="name">5 <text-val>Bob Smith</text-val>6 </attribute>7 <attribute id="weekly_earnings">8 <currency-val>512.34</currency-val>9 </attribute>10 <attribute id="AU_citizen">11 <boolean-val>true</boolean-val>12 </attribute>13 <attribute id="AU_Birth" state="uncertain">14 </attribute>
In this example, the following values have been set:
| Attribute ID | Value |
|---|---|
| DOB | 1 December 1952 |
| name | Bob Smith |
| weekly_earnings | $512.34 |
| AU_citizen | True |
| AU_Birth | Uncertain |
| num_pets | Unknown |
Notice that the reason num_pets is unknown is because it has not been set in the session data.
See also:
Setting Session Data - Generic Data
Specifying Entity Sets and Entity Instances
Determining an attribute's value