The following table of sentences represents 22 sales reports from two branches (west and east) including volume and value of sales from two customer groups (BUSINESS and HOME). Each report indicates a period, a salesman and a date (of submission). The periods are in the range 1 to 10, however a decimal representation is used here (1.0 to 10.0), to illustrate interpolation better.
sales report is submitted by branch
customer group volume sales period branch code salesman date 

BUSINESS 101 1020.10 1.0 west jim 12-JAN-2003 
BUSINESS 100 1010.00 2.0 west anne 19-JAN-2003 
BUSINESS 104 1050.40 3.0 west jim 26-JAN-2003 
BUSINESS 107 1080.70 5.0 west karen 09-FEB-2003 
BUSINESS 106 1070.60 6.0 west karen 16-FEB-2003 
BUSINESS 110 1111.00 7.0 west jim 23-FEB-2003 
BUSINESS 117 1181.70 8.0 west jim 02-MAR-2003 
BUSINESS 113 1141.30 9.0 west dina 09-MAR-2003 
BUSINESS 115 1161.50 10.0 west peter 16-MAR-2003 
HOME 104 1050.40 3.0 west oscar 26-JAN-2003 
HOME 105 1060.50 4.0 west john 02-FEB-2003 
HOME 106 1070.60 6.0 west phil 16-FEB-2003 
HOME 110 1111.00 7.0 west phil 23-FEB-2003 
HOME 112 1131.20 8.0 west phil 02-MAR-2003 
HOME 113 1141.30 9.0 west phil 09-MAR-2003 
HOME 104 1050.40 3.5 east mia 29-JAN-2003 
HOME 115 1161.50 5.0 east mia 05-FEB-2003 
HOME 106 1070.60 6.0 east mia 12-FEB-2003 
HOME 110 1111.00 7.0 east wolf 19-FEB-2003 
HOME 112 1131.20 8.0 east john 26-FEB-2003 
HOME 113 1141.30 8.5 east wolf 05-MAR-2003 
HOME 103 1040.30 9.5 east john 12-MAR-2003 

Interpolation, Selection and Accumulation Procedures

 

Interpolation

We are interested in analyzing the sales reports for period 1 to 10. However, there are several gaps in the series of periods, the two HOME series additionally have missing reports both from the start and end of the analysis period, besides "odd" reporting periods (3.5, 8.5 and 9.5). We will use interpolation to create estimates for the missing reports, and to "straighten up" the data, such that there is one report for each customer group from each branch for each period 1 to 10. We have entered one sentence which defines the analysis period:

The sentence type we want to derive (the interpolated sentences) is sales report is estimated by branch. The following rule is defining this derivation:

Note the following particulars of the above rule:
Interpolations are based on a series of sentences. The series is defined by the number argument element parameter to the interpolation procedure, i.e. the period data element, the series-start and series-end parameters which define the boundaries of the series, and finally the series-step parameter which defines the increments for the steps in the series. Given the estimation period is used sentence above, this means the series 1,2,3,...,10. The interpolation procedure is assigned to the conclusion data element which corresponds to the series - it follows from this that use of the interpolation procedure mandates the use of such a data element in the concluded sentence type.
Consider the assignments between the customer group data element in the conclusion with the same data element in the condition, and the similar assignments for the branch code data element. These two assignments have the effect that interpolation is carried for the series of periods separately for each combination of customer group and branch (all in all three BUSINESS/ west, HOME/east and HOME/west).
The extrapolation parameter (to the INTERPOLATION procedure) is EXTRAPOLATE_AT_START_AND_END, i.e. sentences at the head and tail of the series will be added as required. 
The PREDECESSOR sub-procedure used for volume specifies that interpolated sentences should use the volume value from the predecessor-sentence in the series. The MIDPOINT sub-procedure used for sales specifies that interpolated sentences should use the midpoint between the predecessor and successor sentences' value for sales.
The FIXED procedure used for salesman and data specify that "n/a" and 0 respectively should be used as value for these two data elements in interpolated sentences.

The rule derives the following sentences:

sales report is estimated by branch
customer group volume sales period branch code salesman date 
BUSINESS 101 1020.10 1.0 west jim 12-JAN-2003 
BUSINESS 100 1010.00 2.0 west anne 19-JAN-2003 
BUSINESS 104 1050.40 3.0 west jim 26-JAN-2003 
BUSINESS 104 1065.55 4.0 west n/a 26-JAN-2003 
BUSINESS 107 1080.70 5.0 west karen 09-FEB-2003 
BUSINESS 106 1070.60 6.0 west karen 16-FEB-2003 
BUSINESS 110 1111.00 7.0 west jim 23-FEB-2003 
BUSINESS 117 1181.70 8.0 west jim 02-MAR-2003 
BUSINESS 113 1141.30 9.0 west dina 09-MAR-2003 
BUSINESS 115 1161.50 10.0 west peter 16-MAR-2003 
HOME 104 1050.40 1.0 east n/a 29-JAN-2003 
HOME 104 1050.40 2.0 east n/a 29-JAN-2003 
HOME 104 1050.40 3.0 east n/a 29-JAN-2003 
HOME 104 1105.95 4.0 east n/a 29-JAN-2003 
HOME 115 1161.50 5.0 east mia 05-FEB-2003 
HOME 106 1070.60 6.0 east mia 12-FEB-2003 
HOME 110 1111.00 7.0 east wolf 19-FEB-2003 
HOME 112 1131.20 8.0 east john 26-FEB-2003 
HOME 113 1090.80 9.0 east n/a 05-MAR-2003 
HOME 103 1040.30 10.0 east n/a 12-MAR-2003 
HOME 104 1050.40 1.0 west n/a 26-JAN-2003 
HOME 104 1050.40 2.0 west n/a 26-JAN-2003 
HOME 104 1050.40 3.0 west oscar 26-JAN-2003 
HOME 105 1060.50 4.0 west john 02-FEB-2003 
HOME 105 1065.55 5.0 west n/a 02-FEB-2003 
HOME 106 1070.60 6.0 west phil 16-FEB-2003 
HOME 110 1111.00 7.0 west phil 23-FEB-2003 
HOME 112 1131.20 8.0 west phil 02-MAR-2003 
HOME 113 1141.30 9.0 west phil 09-MAR-2003 
HOME 113 1141.30 10.0 west n/a 09-MAR-2003 

No extrapolation 

If we had specified NO_EXTRAPOLATION to the extrapolation parameter instead of EXTRAPOLATE_AT_START_AND_END, the result would have been as follows (and quite different from the previous rule):

sales report is estimated by branch
customer group volume sales period branch code salesman date 
BUSINESS 101 1020.10 1.0 west jim 12-JAN-2003 
BUSINESS 100 1010.00 2.0 west anne 19-JAN-2003 
BUSINESS 104 1050.40 3.0 west jim 26-JAN-2003 
BUSINESS 104 1065.55 4.0 west n/a 26-JAN-2003 
BUSINESS 107 1080.70 5.0 west karen 09-FEB-2003 
BUSINESS 106 1070.60 6.0 west karen 16-FEB-2003 
BUSINESS 110 1111.00 7.0 west jim 23-FEB-2003 
BUSINESS 117 1181.70 8.0 west jim 02-MAR-2003 
BUSINESS 113 1141.30 9.0 west dina 09-MAR-2003 
BUSINESS 115 1161.50 10.0 west peter 16-MAR-2003 
HOME 104 1050.40 3.5 east mia 29-JAN-2003 
HOME 104 1105.95 4.5 east n/a 29-JAN-2003 
HOME 115 1116.05 5.5 east n/a 05-FEB-2003 
HOME 106 1090.80 6.5 east n/a 12-FEB-2003 
HOME 110 1121.10 7.5 east n/a 19-FEB-2003 
HOME 113 1141.30 8.5 east wolf 05-MAR-2003 
HOME 103 1040.30 9.5 east john 12-MAR-2003 
HOME 104 1050.40 3.0 west oscar 26-JAN-2003 
HOME 105 1060.50 4.0 west john 02-FEB-2003 
HOME 105 1065.55 5.0 west n/a 02-FEB-2003 
HOME 106 1070.60 6.0 west phil 16-FEB-2003 
HOME 110 1111.00 7.0 west phil 23-FEB-2003 
HOME 112 1131.20 8.0 west phil 02-MAR-2003 
HOME 113 1141.30 9.0 west phil 09-MAR-2003 

 

Accumulation

We are also interested in the accumulated sales and volume figures over the analysis period. We want to accumulate separately for each customer group and branch:

Note the following particulars of the above rule:
Consider first the assignments between the customer group data element in the conclusion with the same data element in the condition, and the similar assignments for the branch code data element. These two assignments have the effect that accumulation is carried for the series of periods separately for each combination of customer group and branch (all in all three BUSINESS/ west, HOME/east and HOME/west). (Accumulation separately for each period would be meaningless, since as is described under, period is used as the series-element in the accumulation. Correspondingly, the assignments to period in the conclusion simply assigns it the values of the series-element).
There are two calls to the ACCUMULATION_OF procedure corresponding to the two data elements we want to accumulate (sales and volume). Each call specifies the data element to be accumulated and the series-element which is period. The actual increments are determined by the actual sentences defined by the condition. It is important to note that only one sentence per series occurrence (= period) is considered. period) is considered. The procedure will simply ignore other sentences with the same period. In relation to the above example, it would not be possible to accumulate totals per period for e.g. all branches directly (i.e. without using another rule to total per period for all branches). Note also that in cases like the above rule where more than one accumulation is carried out, then the series-element parameter must be the same. 

The rule derives the following accumulated sales is observed by branch sentences:

accumulated sales is observed by branch
customer group sales volume period branch code 
BUSINESS 1020.10 101 1.0 west 
BUSINESS 2030.10 201 2.0 west 
BUSINESS 3080.50 305 3.0 west 
BUSINESS 4146.05 409 4.0 west 
BUSINESS 5226.75 516 5.0 west 
BUSINESS 6297.35 622 6.0 west 
BUSINESS 7408.35 732 7.0 west 
BUSINESS 8590.05 849 8.0 west 
BUSINESS 9731.35 962 9.0 west 
BUSINESS 10892.85 1077 10.0 west 
HOME 1050.40 104 1.0 east 
HOME 2100.80 208 2.0 east 
HOME 3151.20 312 3.0 east 
HOME 4257.15 416 4.0 east 
HOME 5418.65 531 5.0 east 
HOME 6489.25 637 6.0 east 
HOME 7600.25 747 7.0 east 
HOME 8731.45 859 8.0 east 
HOME 9822.25 972 9.0 east 
HOME 10862.55 1075 10.0 east 
HOME 1050.40 104 1.0 west 
HOME 2100.80 208 2.0 west 
HOME 3151.20 312 3.0 west 
HOME 4211.70 417 4.0 west 
HOME 5277.25 522 5.0 west 
HOME 6347.85 628 6.0 west 
HOME 7458.85 738 7.0 west 
HOME 8590.05 850 8.0 west 
HOME 9731.35 963 9.0 west 
HOME 10872.65 1076 10.0 west

 

Maximum and minimum selection

Let's consider again the original sales report is submitted by branch sentences above. We want to know the highest sale regardless of customer group and branch:


Note the following particulars of the above rule:
There is one call to the MAXIMUM_OF procedure, which selects the sentence in the condition with the highest sales value. This sentence is used as source for all values assigned to the data elements in the conclusion, through the MAXIMUM_OF call assigned to the sales data element, as well as to remaining conclusion data elements which are assigned value through the SELECT sub-procedure. It will be evident from the next example why the select rule must be used and not simple assignments.

The rule concludes the following sentence (NL-format):

sales report with customer group BUSINESS, volume 117, sales 1181.70 and period 8.0 is the best for date 02-MAR-2003! 

Let's assume that we instead are interested in the best sales figures for each customer group. This is achieved by changing the rule, such that an equaliy condition is set between the customer group data element in the conclusion and the customer group in the condition:

This rule would derive the following sentences:

sales report with customer group BUSINESS, volume 117, sales 1181.70 and period 8.0 is the best for date 02-MAR-2003! 
sales report with customer group HOME, volume 115, sales 1161.50 and period 5.0 is the best for date 05-FEB-2003!

Minimum selection works in exactly the same manner as maximum selection.

 

Ranking

We also want to rank the submitted sales reports in order of decreasing sales. This is handled by the ranking procedure:

Note the following particulars of the above rule:
There is one call to the STANDARD_RANKING procedure, which indicates which data element in the conclusion to be assigned the ranking. The sort procedure states that the ranking is based on value of the sales data element in the condition set (and also that these sales data elements are assigned to the similarly named data element in the conclusion ). Note that several sort data elements can be used. The sort element no parameter indicates the relative significance of the elements (i.e. 1 is the most significant sorting element). The select procedure calls work in the same way as described for the MAXIMUM_OF procedure above.

The rule concludes the following sentences:

The results would have been as follows if the statistical ranking procedure is used in place of the standard ranking procedure. The difference is the treatment of ties (the rankings are fixed point numbers):

 

Unique selection

We want to select sales reports which have been submitted by salesmen with only one report submission. The unique rule can be used for this:

Note the following particulars of the above rule:
There is one call to the UNIQUE_OF procedure, which selects sentences in the condition with unique values for the salesman data element. The SELECT procedure calls work in the same way as described for the MAXIMUM_OF procedure above.

The rule concludes the following sentences:


If we were interested in "unique salesmen" per branch and customer group, then we would have to use an equality condition between the respect data elements in the conclusion and condition in place of the select procedure calls.