A Practical Method of Developing Natural Language Rule Statements (Part 9)

Graham   Witt
Graham Witt Consultant / Author, Read Author Bio || Read All Articles by Graham Witt
What is this series of articles about?

This is the ninth 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]

Alternative passive verb forms

In Article 3[3] we looked at the fact that, whereas the passive form of a verb phrase like operates can only be is operated by, the passive form of a verb phrase like specifies can be either is specified in or is specified by.  Some of the rule statements we've developed using a passive form of specifies have used one form and some the other.  In discussions with readers, there is a clear consensus that is specified in almost always reads more naturally so I've updated all rule statements in the [sidebar] to use that form.

Some more constraints

As anyone who has tried to book a flight will know, there are a number of constraints on the flights that one can actually book.  We've already looked at the requirement for there to be sufficient time to catch the outgoing flight after making the booking and to catch the return flight after arriving at the destination:  these rules were introduced in Article 5[4] in rule statements RS38 and RS39 (reproduced below):

RS38. The departure time of the return flight (if any) specified in each flight booking confirmation must be no earlier than 1 hour after the arrival time of the outgoing flight specified in that flight booking confirmation.
RS39. The departure time of the outgoing flight specified in each flight booking confirmation that is made online must be no earlier than 3 hours after the booking confirmation time of that flight booking confirmation.

There are, of course, other constraints on the flights that may be specified in a flight booking, in particular:

  1. each flight must be operated by the airline (or one of its partners)
  2. seats of the specified travel class and fare class must be available on each flight.

The first constraint above can be stated in rule statement RS67, which is somewhat more verbose than necessary; we shall simplify it in due course:

RS67. Each flight specified in each flight booking confirmation must be one of the flights that either is operated by the airline or is operated by a partner of the airline.

Since the rule is a value set rule, its rule statement is based on template RT21 with a value set predicate (sub-template ST32):

ST32. <value set predicate> ::=
  {one of the <term> {<qualifying clause>|}|<value-list>}

The qualifying clause in RS67 is

that either is operated by the airline or is operated by a partner of the airline,

which includes "or".  I discussed this possibility in the previous[5] article, but have not yet given you the necessary sub-templates.

"And" or "or" in qualifying clauses

Our starting point is the sub-templates ST29 and ST31:

ST29. <condition> ::=
  {<verb phrase>
{{<
article>|each|that} <term> {<qualifying clause>|}|}|
is <predicate>}
ST31. <qualifying clause> ::= {that|who} <condition>

Before we allow and or or in a qualifying clause, we should note that:

  1. a condition can include a qualifying clause
  2. a conditional clause can include a condition (see sub-templates ST24 – ST27 in the [sidebar])
  3. a conditional clause can include and or or but not both (for reasons discussed in Articles 4[6] and 7[7]).

We therefore need to arrange that a condition can only include a qualifying clause that does not contain and or or.

We also need to make sure that any qualifying clauses we generate are unambiguous:  the metarules ensuring this are:

  1. a qualifying clause cannot include both and and or
  2. a qualifying clause that includes and cannot also include that or who (other than at the start) unless it also includes both
  3. a qualifying clause that includes or cannot also include that or who (other than at the start) unless it also includes either.

Two additional metarules ensuring that complex qualifying clauses are structurally sound are:

  1. a qualifying clause that ends with a term can be followed by another qualifying clause
  2. a qualifying clause that ends with an intransitive verb phrase or a predicate cannot be followed by another qualifying clause.

These metarules yield the following taxonomy of qualifying clauses:

  1. A simple qualifying clause has only an initial that or who plus one of:
    1. a transitive verb phrase followed by a term, e.g., "that specifies an insurance option"
    2. an intransitive verb phrase, e.g., "that has expired"
    3. is followed by a predicate, e.g., "is less than 12 years of age".

  2. A chained qualifying clause has more than one that or who, of which only the last may be followed by an intransitive verb phrase or predicate form, whereas every that or who may be followed by a transitive verb phrase and a term, e.g., " [that is] of the outgoing flight [that is] specified in that flight booking confirmation" (remember that that is can be omitted).

  3. An or-qualifying clause has at least one or but only an initial that or whothat or who, and each or, may be followed by a transitive verb phrase and term, an intransitive verb phrase, or a predicate form, e.g., "who accompanies a disabled passenger or is flying first class".

  4. An and-qualifying clause has at least one and but only an initial that or whothat or who, and each and, may be followed by a transitive verb phrase and term, an intransitive verb phrase, or a predicate form, e.g., "who accompanies a disabled passenger and is flying first class".

  5. An either-or-qualifying clause has one either, one or, and may have any number of that or who (before either, between either and or, or after or), e.g., "who either accompanies a passenger who is less than 5 years of age or is flying first class".

  6. A both-and-qualifying clause has one both, one and, and may have any number of that or who (before both, between both and and, or after and), e.g., "who both accompanies a passenger who is less than 5 years of age and is flying first class".

We can now create the appropriate sub-templates for:

  1. the syntactic structures that may appear before or after that, who, either, or, both, or and (ST34 – ST37)
  2. the various types of qualifying clause (ST38 – ST43)
  3. <qualifying clause> itself (ST44).
ST34. <simple condition> ::= <verb phrase> {<article>|each|that} <term>
ST35. <final condition> ::=
  {<simple condition>|<verb phrase>|is <predicate>}
ST36. <chained condition> ::=
  {<simple condition>|<chained condition>}
{that|who} <final condition>
ST37. <condition> ::= {<final condition>|<chained condition>}
ST38. <simple qualifying clause> ::= {that|who} <final condition>
ST39. <chained qualifying clause> ::=
  {that|who} <simple condition>
{<simple qualifying clause>|<chained qualifying clause>}
ST40. <or-qualifying clause> ::=
  {<simple qualifying clause>|<or-qualifying clause>}
or <final condition>
ST41. <and-qualifying clause> ::=
  {<simple qualifying clause>|<and-qualifying clause>}
and <final condition>
ST42. <either-or-qualifying clause> ::=
  {{that|who} either <condition> or <condition> {or|but not} both|
{
that|who} <simple condition> <either-or-qualifying clause>
ST43. <both-and-qualifying clause> ::=
  {that|who} both <condition> and <condition>|
{
that|who} <simple condition> <both-and-qualifying clause>
ST44. <qualifying clause> ::=
  {<simple qualifying clause>|<chained qualifying clause>|
<or-qualifying clause>|<and-qualifying clause>|
<either-or-qualifying clause>|<both-and-qualifying clause>
}

Set functions revisited

The second of the constraints listed under "Some more constraints" can be stated in rule statements RS68 and RS69.

RS68. The number of seats that both are of the fare class specified in the flight booking confirmation and are available on the outgoing flight specified in the flight booking confirmation must be more than the number of passengers specified in the flight booking request that gives rise to that flight booking confirmation.
RS69. The number of seats that both are of the fare class specified in the flight booking confirmation and are available on the return flight specified in the flight booking confirmation must be more than the number of passengers specified in the flight booking request that gives rise to that flight booking confirmation if that flight booking request specifies a return journey.

Before we look at a template for these rule statements, note that the subject of each of them is the number of seats on a flight, not the number of passengers needing to fly.  This is because the number of passengers has been accepted and is not in contention, whereas only a flight with the appropriate number of seats can be selected.  That is, this rule is violated if a flight is selected which has insufficient seats.

Rule statements RS68 and RS69 both exhibit two characteristics in particular:

  1. The subject of the statement is a set function (number of seats).
  2. The statement includes a qualifying clause that in turn includes and.

The only template we have encountered so far which allows for set functions is RT23 (reproduced below), but, as it stands, this template has the explicit qualifying clause "that <verb phrase> each <term 2>" rather than "<qualifying clause>", so it will need to be modified as in RT24.  This is all that is required, since <qualifying clause> allows for inclusion of and.

RT23.  The <set function> of {the|} <term 1>
            that <verb phrase> each <term 2>
must be
<predicate>
{{if|unless} <conditional clause>|}.
RT24.  The <set function> of {the|} <term 1> <qualifying clause>
must be
<predicate>
{{if|unless} <conditional clause>|}.

Transformations

Earlier in this article, I pointed out that RS67 is rather more verbose than necessary, and promised to simplify it.  The English language, like many others (if not all) allows for utterances to undergo certain transformations without changing their meaning.  For example, the either <verb phrase>or <verb phrase> structure in this statement can be reduced to <verb phrase> eitheror, yielding RS70.  There are alternative transformations if this one is not to your taste:  either is <passive participle> <preposition>or is <passive participle> <preposition> can be variously reduced to:

  1. is <passive participle> either <preposition>or <preposition>, yielding RS71, or

  2. is either <passive participle> <preposition> … or <passive participle> <preposition>, yielding RS72.
RS70. Each flight specified in each flight booking confirmation must be one of the flights that is operated by either the airline or a partner of the airline.
RS71. Each flight specified in each flight booking confirmation must be one of the flights that is operated either by the airline or by a partner of the airline.
RS72. Each flight specified in each flight booking confirmation must be one of the flights that is either operated by the airline or operated by a partner of the airline.

A similar transformation is available for the both <verb phrase>and <verb phrase> structure in RS68 and RS69.  This structure can be reduced to <verb phrase> bothand, yielding RS73 and RS74.

RS73. The number of seats that are both of the fare class specified in the flight booking confirmation and available on the outgoing flight specified in the flight booking confirmation must be more than the number of passengers specified in the flight booking request that gives rise to that flight booking confirmation.
RS74. The number of seats that are both of the fare class specified in the flight booking confirmation and available on the return flight specified in the flight booking confirmation must be more than the number of passengers specified in the flight booking request that gives rise to that flight booking confirmation if that flight booking request specifies a return journey.

To be continued...
In subsequent articles we will examine the difference between operational and structural rules (and various ways of expressing structural rules), as well as temporal rules, and rule statement quality assessment, including identification of redundant and conflicting rule statements.

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  return to article

[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.  return to article

[3]  Graham Witt, "A Practical Method of Developing Natural Language Rule Statements (Part 3)," Business Rules Journal, Vol. 10, No. 4 (Apr. 2009), URL:  http://www.BRCommunity.com/a2009/b473.html  return to article

[4]  Graham Witt, "A Practical Method of Developing Natural Language Rule Statements (Part 5)," Business Rules Journal, Vol. 10, No. 6 (Jun. 2009), URL:  http://www.BRCommunity.com/a2009/b485.html  return to article

[5]  Graham Witt, "A Practical Method of Developing Natural Language Rule Statements (Part 8)," Business Rules Journal, Vol. 10, No. 9 (Sep. 2009), URL:  http://www.BRCommunity.com/a2009/b501.html   return to article

[6]  Graham Witt, "A Practical Method of Developing Natural Language Rule Statements (Part 4)," Business Rules Journal, Vol. 10, No. 5 (May 2009), URL:  http://www.BRCommunity.com/a2009/b481.html   return to article

[7]  Graham Witt, "A Practical Method of Developing Natural Language Rule Statements (Part 7)," Business Rules Journal, Vol. 10, No. 8 (Aug. 2009), URL:  http://www.BRCommunity.com/a2009/b494.html  return to article

# # #

Standard citation for this article:


citations icon
Graham Witt, "A Practical Method of Developing Natural Language Rule Statements (Part 9)" Business Rules Journal, Vol. 10, No. 10, (Oct. 2009)
URL: http://www.brcommunity.com/a2009/b504.html

About our Contributor:


Graham   Witt
Graham Witt Consultant / Author,

Graham Witt has over 30 years of experience in assisting organisations to acquire relevant and effective IT solutions. NSW clients include the Department of Lands, Sydney Water, and WorkCover while Victorian clients include the Departments of Sustainability & Environment, Education & Early Childhood Development, and Human Services. Graham previously headed the information management and business rules practice in Ajilon's Sydney (Australia) office.

Graham has developed specialist expertise in business requirements, architectures, information management, user interface design, data modelling, relational database design, data quality, business rules, and the use of metadata repositories & CASE tools. He has also provided data modelling, database design, and business rules training to various clients including NAB, Telstra, British Columbia Government, and ASIC and in the form of public courses run by Simsion Bowles and Associates (Australia) and DebTech (USA).

He is the co-author, with Graeme Simsion, of the widely-used textbook "Data Modeling Essentials" and is the author of the newly published book, "Writing Effective Business Rules" (published by Elsevier). Graham has presented at conferences in Australia, the US, the UK, and France. Contact him at gwitt@pacific.net.au.

Read All Articles by Graham Witt

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.