What is a rule?

What is a rule?

What do you want to learn about?

What is a rule?

What is a rulebase?

Conclusions and conditions

What is an attribute?

Attribute levels

Connecting conditions using and/or

Grouping conditions using both/all and either/any

Alternative conclusions

Rule types

What is a rule?

A rule is an assertion that a conclusion can be drawn from a particular state of affairs. For example:

If you leave the ice cream in the sun, then the ice cream will melt.

It is a good idea to take an umbrella if it is raining outside.

Full-time students and pensioners are eligible for a discount at the university bookstore.

Your plane can take-off from the airport if it has permission from the control tower and has completed a safety check.

The movie ticket will cost $10 if the ticket is for a child.

The claimant is not eligible for an aged pension if the claimant is not a citizen

Rules operate on data and can incorporate operations such as comparisons and mathematical functions.

What is a rulebase?

A rulebase is simply a collection of one or more connected rules. For example:

Rule 1:

the person is eligible for a discount at the university bookstore if

the person is a full-time student or

the person is a pensioner

Rule 2:

the person is a full-time student if

the person is studying a full-time load and

the person does not have a full-time job

Conclusions and conditions

Each rule must have a conclusion (the state of affairs that can be determined) and usually has at least one condition (the conditions upon which that determination may be made). A conclusion is the "Then" part of an "If... Then..." statement. A condition is the "If" part of an "If... Then..." statement.



CONCLUSION: the ice-cream will melt if

CONDITION: the ice-cream has been left in the sun



CONCLUSION: it is a good idea to take an umbrella if

CONDITION: it is raining outside

 

CONCLUSION: the person is eligible for a discount at the university bookstore if

CONDITION: the person is a full-time student

CONDITION: the person is a pensioner

 

CONCLUSION: your plane can take-off from the airport if

CONDITION: it has permission from the control tower

CONDITION: it has completed a safety check

 

CONCLUSION: the cost of the movie ticket = $10 if

CONDITION: the ticket is for a child

 

CONCLUSION: the claimant is not eligible for an aged pension if

CONDITION: the claimant is not a citizen

 

NOTE: The value of the condition may be different to the value of the attribute as used in the condition.

The table below demonstrates the range of values which a condition may have:

 

Condition Actual Citizenship Value

The claimant is an Australian citizen

Australian

True

The claimant is an Australian citizen

American

False

The claimant is not an Australian citizen

Australian

False

The claimant is not an Australian citizen

American

True

What is an attribute?

An attribute is a single unit of data or fact. For example:

An attribute is of a particular data type: boolean, text, number, currency, date, time of day, or date and time. Boolean attributes can either have a true or false value, and variable attributes take a text, number, currency, date, time of day, or date and time value depending on the type of variable.

The following are some examples of attributes and types:

An attribute always belongs to a particular entity even if it is the global entity. Attributes form the building blocks of rules.

Attribute levels

Attributes will have different purposes depending on their place in the rule hierarchy. For example, consider the hierarchy of attributes in the following rules:

Rule 1

the person is eligible for a discount at the university bookstore if

the person is a full-time student or

the person is a pensioner

Rule 2

the person is a full-time student if

the person is studying a full-time load and

the person does not have a full-time job

Diagrammatic form:

 

In this rulebase, the attribute "the person is eligible for a discount at the university bookstore" is the top-level attribute. That is, the attribute is at the top of the rule hierarchy, it is not used as a condition in any other rule. Top-level attributes usually represent the main outcome or primary goal of the rulebase (that is, the question the rulebase seeks to answer).

The attribute in the middle, "the person is a full-time student" is called an intermediate attribute as it is used as a condition in at least one rule and a conclusion in another. Intermediate attributes can also be called goals where they calculate an outcome which may be of interest to a user.

The attributes:

are all base-level attributes in the rule hierarchy. That is, there are no rules explaining how these attributes are to be determined. The value of base-level attributes must be provided by the user.

Connecting conditions using and/or

Where a rule contains multiple conditions, the conditions must be separated by an and or an or to indicate whether one or all conditions are required to satisfy the conclusion.

For instance,

 

Example 1 Example 2

the person is eligible for a pension if:

the person is eligible for a pension if:

the person is over 65.

the person is over 65.

AND

OR

the person is a citizen.

the person is unable to work.

 

In Example 1, both conditions must be true to be able to draw a positive outcome for the person's eligibility. If either condition is false, then only a negative outcome can be drawn.

In Example 2, either the first or second condition, or both, must be true to be able to draw a positive outcome. If both the conditions are proved false, then a negative outcome is drawn.

For more information on the possible outcomes when using and or or, see Truth tables.

 

There is no restriction on the number of ands and ors that can be used in a rule. For instance,

 

Example 1 Example 2

the person is eligible for a pension if

the person is eligible for a pension if

the person is over 65

the person is over 65

AND

OR

the person is a citizen

the person is a citizen

AND

OR

the person is unable to work

the person is unable to work

 

Both ands and ors can be used within the same rule in order to closely model source material. It is not possible, however, to mix these two operators on a single level without creating an ambiguity in the logic.

Grouping conditions using both/all and either/any

The all operator is used to group conditions separated by and. In the example "A if B or (C and D)" the brackets are around the conditions joined by an and so you must use the all operator in your rule:

A is true if

B is true

or

all

C is true

and

D is true

 

The any operator is used to group conditions separated by or. In the example "A if (B or C) and D" the brackets are around the conditions joined by an or so you must use the any operator in your rule:

A is true if

any

B is true

or

C is true

and

D is true

 

NOTE: You may also use the word both in place of all and either in place of any. Using these words has the same effect but may make the text more readable where only two conditions are grouped.

 

The grouping operators sit above the conditions they are grouping. The conditions being grouped sit beneath the grouping operator and should therefore take the style of the next level down. For example, if the word "any" is in Level 1 style, the conditions it is grouping should be in Level 2 style.

The following example demonstrates this placement:

 

the claimant is eligible for a pension if

the claimant is poor

or

all

the claimant is sick and

the claimant has been sick for more than 6 months and

the claimant does not another form of income

 

Where your rule continues (as in the example below) at the higher level, the appropriate operator (and or or) should be added as a separate line at the same level as the subsequent condition. For example:

 

the claimant is eligible for a pension if

the claimant is poor or

all

the claimant is sick and

the claimant has been sick for more than 6 months and

the claimant does not another form of income

or

the claimant has been entitled to a pension previously

Alternative conclusions

By default, Oracle Policy Modeling assumes all rules contain an alternative conclusion. That is, if the conditions are not satisfied, you can infer the opposite of the conclusion. For example, given the rule:

CONCLUSION: it is a good idea to take an umbrella if

CONDITION: it is raining outside

If it is not raining outside, you may conclude that it is not a good idea to take an umbrella.

The alternative conclusion need not be stated, it is assumed in all rules unless otherwise indicated.

Rule types

Oracle Policy Modeling supports the following rule types: