A Practical Method of Developing Natural Language Rule Statements (Part 20)
What is this series of articles about?This is the twentieth article in a series in which I describe a practical method of developing unambiguous natural language rule statements. I've developed this method for a large Australian government agency that has selected the Business Rules Approach and the Object Management Group's Semantics of Business Vocabulary and Business Rules (SBVR)[1] as representative of best rules practice.
The story so far
We've been looking at some of the rules governing an online "Book Flights" facility provided by an airline. So far we've created a set of rule statements, the fact types on which the rules are based, and some rule statement templates and sub-templates for generating rule statements.
We've also been developing a taxonomy of rules as well as a rule statement development method based on selection of the appropriate template and sub-template(s) for each type of rule. The taxonomy, templates, and sub-templates are listed in the [sidebar] along with all valid rule statements and supporting fact types.
The font and colour conventions used in these articles reflect those in the SBVR.[2] In addition, any technical terms (particularly those drawn from the field of linguistics) are rendered in a bold italic font.
A confusing rule statement
In discussion with other members of the business rules community, it has been pointed out to me that rule statement RS26 (reproduced below) is rather confusing.
RS26. | Each flight booking request must specify whether or not the passengers must travel on the specified dates. |
This is because the second "must" in that rule statement suggests (as do other uses of "must" in rule statements) an obligation on the part of the passengers involved, namely, that they are obliged by the airline to travel on certain dates. In fact, airlines allow their customers to specify whether they only want to travel on the specified dates or are happy to travel a day or so earlier or later. I have therefore reworded RS26 as follows:
RS26. | Each flight booking request must specify whether or not the travel dates specified in the flight booking request are moveable. |
The corresponding fact type FT16 also requires modification:
FT16. | travel date is moveable |
More missing fact types
The introduction of the term travel date means that we need to identify that this term refers to both departure date and return date, so we need the following additional fact types:
FT140. | departure date is a category of travel date | |
FT141. | return date is a category of travel date |
In the previous article[3] I added some fact types that were required to support various business rules. Two fact types, however, were omitted, as they introduced a new type of verb phrase, one in which the verb asserts a proposition (which necessarily involves another verb).
Rule statement RS26 (see above) needs fact type FT142 in addition to FT16 (see above).
FT142. | flight booking request specifies proposition |
Meanwhile, rule statement RS27 (reproduced below) needs fact type FT143 in addition to the existing FT17 (also reproduced below).
RS27. | Each flight booking confirmation must specify whether or not the paying party wishes to include a CO2 offset payment. |
FT143. | flight booking confirmation specifies proposition | |
FT17. | paying party wishes to include a CO2 offset payment |
Note that RS27 requires an additional qualifying clause, so that it reads as follows:
RS27. | Each flight booking confirmation must specify whether or not the paying party specified in the flight booking confirmation wishes to include a CO2 offset payment. |
Note also that in both FT142 and FT143 the term proposition refers to a fact formulated using the relevant fact type.
Party rules
As foreshadowed in earlier articles, some rules govern the parties (individuals or organisations) or roles that are allowed to perform a process or use information. These rules are rarely in terms of specific individuals, being more often in terms of roles that may be played by parties (e.g., The Captain, The First Officer, The Chief Flight Attendant). Other rules, however, may refer to organisations, either specific departments within the business (e.g., The Purchasing Department) or specific external organisations (businesses or specific government departments).
Consider the data rules we've encountered so far: none of these rules requires knowledge of who has supplied the data to determine whether the rule has been violated. Anyone can fill in a flight booking request and confirmation online, provided they have a credit card or can make an electronic payment.
The same is true of the process rules we've encountered so far, even those that require that the passenger present a passport that bears a likeness of that passenger. Any person with a current valid passport bearing that person's likeness can undertake any of the processes governed by those rules. Of course, a person carrying someone else's passport rather than their own shouldn't be able to check in, pass through departure control or security screening, or board an international flight.
There are, however, restrictions on who can perform some processes or activities or play some roles. These may be based on age, as in the following:
- A person who is less than 2 years of age is prohibited from travelling alone.
- A person who is 71 years of age or older is prohibited from obtaining travel insurance with some (if not all) insurance companies.
Alternatively, a restriction may be based on some other physical characteristic or capability, as in the following:
- A cabin crew member[4] must be at least 160cm (5'3") tall.
- A passenger who is unable to open an aircraft door in an emergency is prohibited from being allocated to a seat in an exit row.
For an activity requiring particular skills and/or involving physical or financial risks, a person may only perform that activity if that person has been certified as having been appropriately trained and tested in the appropriate skills, as in the following:
- A person who does not hold a current commercial pilot licence is prohibited from being rostered on a flight crew.
- A person is prohibited from being rostered on a flight crew if that person does not hold type endorsements appropriate to all aircraft types to be flown by that flight crew.
- A person who does not hold a current command endorsement is prohibited from being rostered as pilot in command on a flight crew.
It should be clear that compliance or non-compliance with each of these rules depends on who is being proposed for the process or activity. For example, I can obtain travel insurance in compliance with rule 2, and be allocated to an exit row seat in compliance with rule 4, while my mother can do neither. And neither of us can be rostered on a flight crew whereas there are plenty of people who are qualified to be so rostered. This is what makes these rules special and why I dub them party rules.
How best to express such rules? Rule 1 above can be expressed as an obligation statement (as RS152), a prohibition statement (as RS153), or a restricted permission statement (as RS154).
RS152. | A person who travels alone must be more than 2 years of age. |
RS153. | A person who travels alone must not be 2 years of age or less. |
RS154. | A person may travel alone only if that person is more than 2 years of age. |
My preference for rules of this type is a restricted permission statement, and below you can see all seven rules from above expressed in this way (RS154 to RS159 inclusive). Note that rules 5 and 6 are expressed using a single rule statement (RS158).
RS154. | A person may travel alone only if that person is more than 2 years of age. |
RS155. | A person may obtain travel insurance only if that person is less than 71 years of age. |
RS156. | A person may be employed as a cabin crew member only if that person has a height of at least 160cm. |
RS157. | A passenger may be allocated to a seat in an exit row only if that passenger is able to open an aircraft door. |
RS158. | A person may be rostered on a flight crew only if that person holds an airline transport pilot licence that is current and a type endorsement that is current for each aircraft type to be flown by that flight crew. |
RS159. | A person may be rostered as pilot in command on a flight crew only if that person holds a command endorsement that is current. |
Some situations require separation of responsibilities, in that the same person is prohibited from performing two activities. For example, the activities of disarming an aircraft door and checking that that door is disarmed are prohibited from being performed by the same cabin crew member.[5]
If we have such a rule, the person who performed the first activity (in this case, disarming the door) would be in violation of that rule if he or she attempts to check that the door was disarmed, whereas any other person who attempts to check that the door is disarmed would not violate that rule. Such a rule is, therefore, also a party rule of a particular type, i.e., a role separation rule. (To distinguish the other party rules so far discussed, I shall use the term party restriction rule for those.) My preferred form for role separation rules is as in RS160.
RS160. | The cabin crew member who checks that an aircraft door is disarmed must not be the same cabin crew member who disarmed that aircraft door. |
Similar to role separation rules are role binding rules. These require that the person performing the second of two activities must be the person who performed the first of those activities, as in RS161.
RS161. | The flight crew member who signs the pre-flight check report must be the same flight crew member who performed the pre-flight check documented in that pre-flight check report. |
Note that RS161 has essentially the same structure as RS160, the principal difference being the absence of not after must.
Templates for party rules
Before I discuss the template for party restriction rules, let me make a couple of observations. Firstly, the constrained activity or role (between may and only) may take the form of:
- an intransitive verb phrase, e.g., travels alone;
- a transitive verb phrase followed by a term with an optional determiner, e.g.,
obtain travel insurance,
be employed as a cabin crew member,
be rostered on a flight crew,
be rostered as pilot in command;
- a transitive verb phrase followed by a term (with optional determiner) followed by a qualifying clause, e.g., be allocated to a seat in an exit row.
Secondly, the conditional clause (after if) in a rule statement of this type always repeats the subject term (person or passenger in the examples above) after that.
A suitable template for party restriction rules is therefore RT40:
RT40. | {A|An} <term 1> may <verb phrase> | ||
{{a|an|the|} <term 2> {<qualifying clause>|}|} | |||
only if that <term 1 > <condition>. |
What about role separation and binding rules? These rules each consider two parties qualified in terms of the roles they play or activities they perform, and state whether those two parties may be the same or not. Accordingly, a suitable template for these rules is RT41:
RT41. | The <term 1> <qualifying clause 1> | ||
must {not|} be the same <term 1> | |||
<qualifying clause 2>. |
Note:
- In both these templates <term 1> is repeated; this is to indicate that the same term is to be used in both places.
- The first qualifying clause in RS160 (who checks that an aircraft door is disarmed) is not catered for by the current sub-template for qualifying clauses. I shall address that issue in the next article.
Supporting fact types
Examination of rule statements RS154 to RS161 inclusive reveals that the following fact types are required.
- RS154 requires FT117 and FT118.
- RS155 requires FT119 and FT118.
- RS156 requires FT120 and FT121.
- RS157 requires FT122 to FT124 inclusive.
- RS158 requires FT125 to FT130 inclusive.
- RS159 requires FT131 to FT133 inclusive.
- RS160 requires FT134 to FT136 inclusive.
- RS161 requires FT137 to FT139 inclusive.
FT117. | person travels alone | |
FT118. | person is of age | |
FT119. | person obtains travel insurance | |
FT120. | person is employed as cabin crew member | |
FT121. | person has height | |
FT122. | person is allocated to seat in row | |
FT123. | exit row is a category of row | |
FT124. | passenger is able to open an aircraft door | |
FT125. | person is rostered on flight crew | |
FT126. | person holds airline transport pilot licence | |
FT127. | airline transport pilot licence is current | |
FT128. | person holds type endorsement for aircraft type | |
FT129. | type endorsement is current | |
FT130. | aircraft type is flown by flight crew | |
FT131. | person is rostered as pilot in command on flight crew | |
FT132. | person holds command endorsement | |
FT133. | command endorsement is current | |
FT134. | cabin crew member checks that proposition | |
FT135. | aircraft door is disarmed | |
FT136. | cabin crew member disarms aircraft door | |
FT137. | flight crew member signs pre-flight check report | |
FT138. | flight crew member performs pre-flight check | |
FT139. | pre-flight check is documented in pre-flight check report |
To be continued...
In subsequent articles we will look at fact types and qualifying clauses in more depth, and cover various other topics, including more types of definitional (structural) rule, generating rule statements from a template, and the role of the time dimension in rules.
References
[1] Semantics of Business Vocabulary and Business Rules (SBVR), v1.0. Object Management Group (Jan. 2008). Available at http://www.omg.org/spec/SBVR/1.0/PDF
[2] The font and colour conventions used in this and other well-formed rule statements and fact types in these articles reflect those in the SBVR, namely underlined teal for terms, italic blue for verb phrases, orange for keywords, and double-underlined green for names and other literals. Note that, for clarity, less than well-formed rule statements will not use these conventions.
[3] Graham Witt, "A Practical Method of Developing Natural Language Rule Statements (Part 19)," Business Rules Journal, Vol. 12, No. 2 (Feb. 2011), URL: http://www.BRCommunity.com/a2011/b580.html
[4] 'Cabin crew member' is now the preferred term in some parts of the airline industry for persons previously known as 'flight attendants'.
[5] 'Arming' of aircraft doors after closure but before takeoff ensures that, if a door is opened after a crash or emergency landing, an escape slide automatically inflates. On landing, of course, all doors must be disarmed.
# # #
About our Contributor:
Online Interactive Training Series
In response to a great many requests, Business Rule Solutions now offers at-a-distance learning options. No travel, no backlogs, no hassles. Same great instructors, but with schedules, content and pricing designed to meet the special needs of busy professionals.