D-tutorial

[ English | Japanese ]

[visit D-home]

CONTENTS

1. Getting started

Prerequisites for all: basic knowledge on text files and editor.
Prerequisites for Windows user: basic knowledge on command prompt (cmd shell). At least, you should know what dir | find ".log" > logfiles.txt does.
Prerequisites for Linux/Unix user: basic knowledge on shell. At least, you should know what ls | grep '\.d$' > Dfiles.list does.

1.1 D-file

The first step is to understand what D-file is. It is simple text file with some rules to accommodate records and fields. Input next data using your favorite editor, and store it in a file named "supplier.d". (You may name it without ".d" or with any other extension, but it is recommendable to use consistent extension).

(1-1)

s#:1
sname:Smith
loc:London

s#:2
sname:Jones
loc:Paris

s#:3
sname:Blake
loc:Paris

s#:4
sname:Clark
loc:London

s#:5
sname:Adams
loc:Athens

This is a D-file. There are five D-records separated by a null line (line without any character). Each D-record has three fields named "s#", "sname" and "loc".

Here, one thing should be noted. Do not put SPACE after COLON (:). Spaces after COLON are regarded as a part of the value. If you write loc: London, the value is not "London" but " London". This D-file convention may cause some uneasiness for people who are used to modern writing styles. But, it makes the system much simpler. For example, we don't need special way to write values led by a SPACE character(s).

As the first step, try

(1-2)

Dpr supplier.d

Dpr is one of the most frequently used D-commands. It prints the contents of the input D-file int a table style to your terminal.

(1-2 output)

                                  supplier.d                                  1

rec# s# sname loc
   1  1 Smith London
   2  2 Jones Paris
   3  3 Blake Paris
   4  4 Clark London
   5  5 Adams Athens

D-file has no "schema definition". You can put any field in any format as long as it is represented by a character string. Validatation can be done with many ways using various D-commands. Dfd is simple and most frequently used tool. It reports the field attributes in D-files. Try next command.

(1-3)

Dfd supplier.d | Dpr -f exists:r -g filename

It will produce the following output. (In Linux, you can use just Dfdp supplier.d).

(1-3 output)

                  filename:supplier.d

rec# fieldname min max exists minlen maxlen avglen attribute
   1 s#          1   1    5/5      1      1    1   Int
   2 sname       1   1    5/5      5      5    5   Asc
   3 loc         1   1    5/5      5      6    5.6 Asc

The field min and max reports minimum and maximum occurence of the field, respectively. Both values should be "1" for a "normalized" file. The field exists value 5/5" reports that the field apears in five records out of total five records. (If min is not zero, it is always 100%). The field minlen, maxlen and avglen reports minimum, maximum and average length (number of characters) of the values, respectively. The last field attribute value Int means all the values are unsigned decimal integer, and the value Asc means ASCII character string. For other attributes, see the manual of Dfd.

Usually, you will detect your input error easily with Dfd (except for simple typos).

1.2 Reading lines

Next, we are going to make new D-file which has four fields named p#, pname, color, weight and qoh. We can input it using editor as the first file. But, we introduce a new way -- DfromLine. Create next file (with an editor or any other way), and name it "part.txt".

(1-4)

1→Nut→Red→12→30
2→Bolt→Green→17→60
3→Screw→Blue→17→30
4→Screw→Red→14→10
5→Cam→Blue→12→20
6→Cog→Red→19→40

The RIGHTWARDS ARROW (→) character here denotes a TAB character. Then, a command

(1-5)

DfromLine p#,pname,color,weight,qoh part.txt > part.d

reads lines form "part.txt" and produce a D-file part.d. The parameter p#,pname,color,weight,qoh is called field-list which gives the field names. Field names in a field-list are separated either by COMMA (,) or by SPACE (U+0020). Then, Dpr part.d produces next output.

(1-6)

              part.d

rec# p# pname color weight qoh
   1  1 Nut   Red       12  30
   2  2 Bolt  Green     17  60
   3  3 Screw Blue      17  30
   4  4 Screw Red       14  10
   5  5 Cam   Blue      12  20
   6  6 Cog   Red       19  40

To make the third file "project.d", we use slightly different way. Try next command.

(1-7)

DfromLine -t ", *" j#,jname,mgr_e# > project.d

Your terminal goes into input mode. Type in the following lines.

(1-7 input)

1, Sorter, 640028
2, Punch, 700128
3, Reader, 680096
4, Console, 660118
5, Collator, 690002
6, Terminal, 640014
7, tape, 710020

After the last line (after ENTER), type in CONTROL-D (in UNIX), or CONTROL-Z ENTER (in Windows). (These characters are called EOF character. They may be altered with some means. But, default setting is usually these.)

The option -t ", *" gives the delimiter pattern ( regular expression). This pattern means "a COMMA followed by zero or more SPACE characters". Command

(1-8)

Dpr project.d

produces next output.

(1-8 output)

        project.d

rec# j# jname    mgr_e#
   1  1 Sorter   640028
   2  2 Punch    700128
   3  3 Reader   680096
   4  4 Console  660118
   5  5 Collator 690002
   6  6 Terminal 640014
   7  7 tape     710020

1.3 Csv file and D-file

For the fourth D-file, we take another approach. Use your favorite spreadsheet (e.g., EXCEL) to input the next table, save the sheet as CSV file named "supply.csv".
(Of course, you may use any other tool, including editor, to make the csv file).

(1-9)

supply.csv
s#p#j#shipdatequantity
1 1 1 70,1,12 200
1 1 4 70,1,12 700
2 3 2 70,1,17 200
2 3 3 70,1,17 200
2 3 4 70,1,17 500
2 3 5 70,1,17 600
2 3 6 70,1,17 400
2 3 7 70,1,17 800
2 5 2 69,12,19 100
3 3 1 70,2,2 200
3 4 2 70,2,10 500
4 6 3 70,1,31 300
4 6 7 70,1,31 300
5 2 1 70,1,23 100
5 2 2 70,1,23 200
5 2 3 70,1,23 100
5 2 4 70,1,23 100
5 2 5 70,1,23 100
5 2 6 70,1,23 100
5 2 7 70,1,23 100
5 3 7 70,1,31 100
5 5 5 70,1,12 500
5 5 7 70,1,12 100
5 6 2 70,1,16 200
5 1 4 70,2,9 100
5 3 4 70,1,14 200
5 4 4 70,1,24 800
5 5 4 70,1,12 400
5 6 4 70,2,5 500

Make sure the delimiter is COMMA (,) and texts are quoted with QUOTATION MARK ("). Then, command:

(1-10)

DfromCsv supply.csv > supply.d

produces the D-file "supply.d". With DfromCsv, field names are always taken from the first row. If you use other character as the delimiter (e.g., TAB), you can use -t option to give the delimiter character. Note that you may need some special character to input TAB depending on your tty settings.

There is another D-command DtoCsv, which, naturally, converts D-file to CSV file. With these commands you can import and export your D-files to spreadsheet software.

1.4 D-file operations

You have created, in the previous section, "supplier.d", "part.d", "project.d" and "supply.d". These files are classic example files use by E. F. Codd when he introduced a database sublanguage "alpha". He showed some relational operations on these "relations". We are going to follow his examples to show D-file operations.

1.4.1 Spj world

This is a small world of only four files. There are five suppliers in supplier.d. Each supplier has the supplier number s#, supplier's name sname and location loc.

Suplliers supply parts described in part.d. There are six parts identified by the part number p#. Each part has part name pname, color, weight and quantity on hand qoh in addition to p#.

The third entity is project to produce goods described in project.d. Each project is identified by project number j#, and has project name jname like "Sorter", "Punch" or "Reader" (Yes, it is a classic world!) and project manager's employee number mgr_e#. (This employee number suggest wider worlds including employees and organizations, but this example is not deployed in that world).

The last file supply.d describes the relation of above three files. It describes which supplier supllies which part to which project with each identifiers (s#, p# and j#), and additionally describes when (shipdate) and how much (quantity).


Figure 1-1 Supplier-part-project E-R like chart

1.4.2 Codd's examples

1) Find all the part numbers of parts being supplied.

(1-11)

Dfreq p# supply.d | Dproj p#

As Dfreq adds count field, we need Dproj to remove it. If you want more readable output, you may use Dpr.

(1-12)

Dfreq p# supply.d | Dpr -p p#

If you don't mind duplication, use just Dproj.

(1-13)

Dproj p# supply.d

You can remove duplication with the next commands.

(1-14)

Dproj p# supply.d | Dsort p# | Dbundle p#

But, using Dfreq is generally faster.

2) Find the part numbers, names and quantities on hand where quantity on hand (qoh) is less than 25.

(1-15)

Dselect FIELD qoh:n LT CONST 25 -- part.d | Dproj p#,pname,qoh

Dselect uses D specific language Dl for the condition. FIELD qoh:n means the field qoh evaluated as numeric. Input file name is part.d and -- is the end token to mark the end of Dl expression. You may wirte

(1-16)

Dselect qoh:n LT 25 part.d | Dproj p#,pname,qoh

The keywords FIELD and CONST may be omitted, because a non reserved word at the top of the expression is interpreted as a field name, and a non reserved word after comparison or assignment operator as a constant. But, it is recommendable to use keywords FIELD or CONST whenever you are not sure. The end token -- can be omitted where the filename (part.d in this case) is not a reserved word of the Dl.

Note also that Dl is always case sensitive.

3) Same query as former one but the result ordered by increasing weight (major order) and decreasing qoh (minor order).

(1-17)

Dselect FIELD qoh:n LT 25 part.d | Dproj p#,pname,qoh | Dsort weight:n,qoh:nr

Dsort takes key field list with key flags. The flag n means "numeric" and the r means "reverse order".

4) Find the part numbers, part names, and quantities on hand where quantity on hand is less than 25, retrieving no more than five elements.

(1-18)

Dselect FIELD qoh:n LT 25 part.d | Dproj p#,pname,qoh | Dextract 1-5

Dextract extracts D-records by record positions. You may use Dselect instead.

(1-19)

Dselect FIELD qoh:n LT 25 part.d | Dproj p#,pname,qoh | Dselect NR LE 5

5) Find the supplier numbers of those suppliers who supply the part with part number 3.

(1-20)

Dselect p# == 3 supply.d | Dfreq s# | Dproj s#

6) Find the supplier names of those suppliers who supply the part with part number 3.

(1-21)

Dselect p# == 3 supply.d | Dfreq s# | \
Djoin -c s# - supplier.d | Dproj sname

Djoin is the key operation here. Frequently used option -c (on core join) allows input files not sorted in the key field order. Note that the first input file of Djoin is piped from the previous command and the second input file is supplier.d.

Next commands produce same result.

(1-22)

Djoin -c s# supplier.d supply.d | \
Dselect p# == 3 | Dfreq sname | Dproj sname

In most cases, the first one is faster, because Djoin tends to produce a big file, selection first and join later is better.

7) Find the supplier numbers of those suppliers who have the same location (loc) as supplier Jones.

(1-23)

Dselect sname == Jones supplier.d | Dfreq loc | \
Djoin -c loc - supplier.d | Dproj s#

The operation structure is same as (1-22), but it joins the first step result with the same D-file (supplier.d). For this reason, analogous solution of (1-22)

(1-24)

Djoin -c loc supplier.d supplier.d | \
Dselect sname == Jones | Dfreq s# | Dproj s#

does not work for the question 7. This is due to the fact that Djoin takes no heed to the duplication of field names. There is another solution using repeating fields.

(1-25)

Dsort loc supplier.d | Dbundle loc | \
Dselect sname INCL Jones | \
Dunbundle "^loc" | Dproj s#

Dbundle and Dunbundle provides a way of grouping and ungrouping. Dbundle groups adjacent same key (here "loc") value records. As same key records must be adjacent, we use Dsort first. Next, Dselect select the group which includes Jones. Note that INCL operator is used here. Because sname field (as well as s#) repeats in this bundled record, sname == Jones does not work. Dunbundle separates grouped fields to original records. The parameter ^loc means the fields except for loc form the leaves to be separated.

8) Find the supplier numbers of suppliers who supply a part other than part number 3.

This is negation of the question 5.

(1-26)

Dselect p# NE 3 supply.d | Dfreq s# | Dproj s#

9) Find the supplier numbers of suppliers who do not supply part number 3 (and may not supply any part at all at this time).

(1-27)

Dsort s# supply.d | Dbundle s# | \
Djoin -o 1x -c s# supplier.d - | \
Dselect NOT p# INCL 3 | Dproj s#

The first Dsort is just a preparation to use the Dbundle. The Dbundle groups adjacent same key value records to one record. In this case, the output is supply table for each supplier number (s#). Next Djoin attaches this supply table to the supplier record. The option -o 1x tells Djoin to output all the records from the first file (supplier.d) regardless of matching result. (In fact, this option may be omitted, because it is the default when -c option is in effect). This Djoin is necessary to keep suppliers who does not supply any part.

The condition of Dselect uses INCL operator as the record has multiple p# fields, and NOT operator negates the result.

10) Find the names and locations of all suppliers, each of whom supplies all projects.

If you know there are seven projects in all, you can check if a supplier supplies allprojects only with the file supply.d.

(1-28)

Dfreq s#,j# supply.d | Dbundle s# | \
Dselect COUNT j# == 7 | \
Djoin -c -o 11 s# - supplier.d | Dproj sname,loc

The Dfreq counts s# and j# combination in supply.d. But, the field count is not important here. After Dbundle by s#, records that have seven j# fields provides all the projects. Then, with Djoin s#, sname and loc are attached to the selected s#. The option "-o 11" tells Djoin to output only matched records. With this option we can exclude s# not found in supplier.d. (Yes, this is an error case and there should not be).

When we do not know the total number of suppliers, we need some more procedures.

(1-29)

Dfreq s#,j# supply.d > tmp.d
Djoin "" supplier.d project.d | \
Djoin -c s#,j# - tmp.d | \
Dbundle s#,sname,loc | \
Dselect COUNT count == COUNT j# | Dproj sname,loc

The first step is same as the previous one. We store it to a temporary file. The second step Djoin joins supplier.d and project.d with null key-field-list. It is cross production operation. All the combination of records in supplier.d and project.d is produced. In the third step, the temporary file is attached to this cross production. In this output, when the supplier does not supply to the project, the count field is missing. In the fourth step, Dbundle groups records by suppliers. The parameter needs s# and its dependent fields (sname and loc), otherwise the output has repeated sname and loc. In the last steps, COUNT j# is always the number of projects in all, while COUNT count is actual number of projects that the supplier supplies.

11) For each project obtain as a triple the project number, project name and supplier location for all suppliers who supply that project.

(1-30)

Djoin -c j# supply.d project.d | \
Djoin -c s# - supplier.d | \
Dfreq j#,jname,loc | Dproj j#,jname,loc

First, attach project information to supply.d, then attach supplier information to it. Dfreq extract the triple.

12) Find the names and locations of all suppliers who supply at least those projects supplied by supplier Jones.

It will take two steps. First, we make a set of project numbers to which Jones supplies.

(1-31)

Dselect sname == Jones supplier.d | \
Djoin -c s# - supply.d | \
Dfreq j# | \
Dproj j# | \
Dbundle "" | \
Drename j#:j#Jones > tmp.d

The project number list is renamed as j#Jones, as it is tested against each supllier in the next step.

(1-32)

Dfreq s#,j# supply.d | \
Dbundle s# | \
Djoin -c s# supplier.d - | \
Djoin "" - tmp.d | \
Dselect FIELD j# INCL FIELD j#Jones | Dproj sname,loc

Dfreq with Dbundle produces project number list for each s#. Then this list is attached to supplier.d. The second Djoin with null key field is cross production. It appends Jones' project number list (j#Jones) to all input records. The condition of Dselect, FIELD j# INCL FIELD j#Jones" compares two array fields if the second operand is a subset of the first operand, i.e., every element of the second operand is equal to at least one element of the first operand. Note that the first keyword FIELD before j# may be omitted, while the latter can not be.

13) Find the number of suppliers who supply project #5.

(1-33)

Dselect j# == 5 supply.d | Dfreq s# | Drc | Dproj recordcount

Drc counts the number of records (, fields and characters as well). As the Dfreq creates a record for each s#, number of records is the number of suppliers.

14) Find the part numbers of all parts having the largest quantity-on-hand.

(1-34)

Dmax qoh:n part.d | Dproj p#

Dmax is a filter to select records with maximum value for the given key field.

15) For each part number being supplied to a project, find as a triple the part number, the project number, and the total quantity of that part being supplied to that project.

(1-35)

Dsort p#:n,j#:n supply.d | \
Dmeans -g p#,j# quantity | Dproj p#,j#,sum.quantity

Dmeans calculates descriptive statistic values for a given field(s). Here, it is used calculate total quantity. The -g p#,j# quantity (group by) option here tells Dmeans to calculate total of field quanitiy for each p# and j# pair. For the group by option to work correct, input file must be sorted by group by fields. The first step Dsort is just for this preparation.

Total quantity field is named as sum.quantity. This field name is predefined by Dmeans. If you want other field name, apply Drename to the last output file.

16) Find the part number of parts supplied to more than two projects.

(1-36)

Dfreq p#,j# supply.d | \
Dbundle p# | \
Dselect COUNT j# GT 2 | Dproj p#

Dfreq here is, again, used to extract unique pair of part (p#) and project (j#). The field count of Dfreq's output is not important here. This step could also be

(1-37)

Dsort p#,j# supply.d | Dproj p#,j# | Dbundle p#,j#

which works as relational projection operation.

Next Dbundle makes a record per part. The field j# (and not used count) becomes repeating field corresponding to the project to which the part is supplied.

Printing the output from each step will help you to understand.

17) Add DELTA to the quantity-on-hand qoh for the part with part number 3.

Here, we assume DELTA = 75. In the Codd's original context, DELTA is a variable of which value is assigned externally.

(1-38)

Ded IF p# == 3 THEN qoh = FIELD qoh + 75 FI part.d

Ded is general purpose editor for D-files. It interpretes D-language Dl. The script is provided as command arguments preceding the input file name. As other D-commands, output is written to starndard output. You have to use redirect (> ouput-file-name) to save it.

Warning for shell beginers: Never try Ded ... part.d > part.d. It will destroy the input file part.d

Explanations may be unnecessary for this program. Operator == is equality comparison, while = is value assignment, like in C language. FI closes IF operator, like in sh.

Dl allows some elipses. Full form of this program is IF FIELD p# == CONST 3 THEN FIELD qoh = FIELD qoh + CONST 75 FI Using full form may be cumbersome, but it is safe. For example, IF p# == 3 THEN qoh = qoh + 75 FI causes an error. Because, the second qoh after = operator is interpreted as CONST qoh, and CONST qoh + CONST 75 yields, always, 75.

18) - 21) (These questions are omitted, because they are specific to the processing model of language "alpha".)

22) Delete the tuple for part number 5 from the data base relation PART.

(1-39)

Ded IF p# == 5 THEN CURREC = { } FI part.d

Again, Ded is used. Deletion of a record is done with CURREC = { }. This is to assign null to the current record, and functions as deletion.

There is another way of D-file update, called Dupdate.

(1-40)

DfromLine p# | Dupdate -d p# part.d -

Terminal will turn into input mode, then input 5 and in the next line input the EOF character. This step is to make D-file with just one record p#:5. DfromLine is described in Reading lines section. Dupdate -d p# reads two D-files: part.d and the file made by the first step. It matches key (p#) of both file, and when it does not match, the record from the first file is output, when matches, output is detered.

23) - 25) (These questions are omitted, because they are language "alpha"'s processing model specific.)


2. Creation and validation of D-files

We have learned three ways to create D-files, 1) input with an editor (1.1), 2) reading from text files (1.2), and 3) reading from a CSV file (1.3),. We'll learn another method -- conversion from HTML (or XML) file in the section 6. In this section, we learn some more about creation of D-file from text files, with some methods of "validation".

2.1 Handmade D-file and Dfdp

Handmade files inevitably involve errors. At least, those who prepare data should work this in mind. The file supply-handmade.d is based on supply.d in the 1.4.1 Spj world, and some artificial errors are added. You know the file. It should have three id-number fieds ( s#, p#, j#) and two fields describing supply transaction ( quantity and shipdate).

Try Dfdp (or Dfd and Dpr as in (1-3)).

(2-1)

Dfdp supply-handmade.d

It will produce the following output.

(2-1 output)

                           filename:supply-handmade.d

rec# fieldname min max exists minlen maxlen avglen  attribute
   1 s#          1   1  25/25      1      1 1       Int
   2 p#          1   1  25/25      1      1 1       Int
   3 j#          1   1  25/25      1      1 1       Int
   4 shipdata    0   1   1/25      7      7 7       Asc
   5 shipdate    0   1  24/25      6      8 6.95833 Asc
   6 quantity    1   1  25/25      3      3 3       Num

You will be easily aware that the fieldname shipdata is an error. The fact that the field shipdata exists only one in twenty records (1/25) strongly suggests that is an error.

You should also be aware that the attribute value Num in the field quantity also suggests an error. Because, it should be Int if the quantity is recorded correctly. You can use

(2-2)

Dselect quantity UNLIKE "^[0-9]+$" supply-handmade.d

to find the error record(s).

Actually, supply-handmade.d has another error in the field shipdate. But, it is not found with Dfdp. If minlen were smaller than 6 or maxlen were greater than 8, you could find the error. These numbers in the output from (2-1) is normal.

The field shipdate has a date as its value. Format of the date is rather unusual YY,M,D. As D has no special validation tool, you have to write validation program for Dselect. A makeshift version will be:

(2-3)

Dselect shipdate UNLIKE "^[0-9][0-9],1?[0-9],[123]?[0-9]$" supply-handmade.d

This program checks only character class and number of characters. With this one, no error is found. It is possible to make a Dl program for full check of date. It is bit longer to be coded in the command arguments. We make Dl file and use it with -f option. The Dl file will be:

(2-4)

COUNT shipdate EQ 1 AND (
    FIELD shipdate UNLIKE ^([0-9][0-9]),(1?[0-9]),([1-3]?[0-9])$ OR (
        VAR y = MATCH1 ;
        VAR m = MATCH2 ;
        VAR d = MATCH3 ;
        ( NUM VAR m LT 1 OR NUM VAR m GT 12 ) OR
        ( NUM VAR d LT 1 OR NUM VAR d GT 31 ) OR
        (
            ( NUM { 4 6 9 11 } INCL NUM VAR m ) AND
            VAR d GT 30
        ) OR
        ( NUM VAR m EQ 2 AND NUM VAR d GT 29 ) OR
        ( VAR y EQ 00 AND NUM VAR m EQ 2 AND NUM VAR d GT 28 ) OR
        ( INT VAR y % 4 NE 0 AND NUM VAR m EQ 2 AND NUM VAR d GT 28 )
    )
)

Note that, in a Dl file, you don't need quoatations unless you use REVERSE SOLIDUS (\), QUOTATION MARK (") or APOSTROPHE (') in a Dl word. This program uses AND and OR as the meaning of if-then statements. condition AND ( foo ) means IF condition THEN foo, and condition OR ( foo ) means IF NOT condition THEN foo. This type of usage of logical operators is common in shell or perl scripts. Then you can use this program with Dselect.

(2-5)

Dselect -f check-shipdate.dl supply-handmade.d

It will produce next output.

(2-5 output)

s#:5
p#:1
j#:4
shipdate:70,2,29
quantity:100

2.2 Reading a log file

Recently, you need not read log files by yourself, as major applications come with proprietary log analyzer. But, occasionally, you may have to read a log file. D will be a handy tool for reading log files.

The file websmpl.log is a portion of a log file from a web server. At a look, you will find that you cannot read this file with simple DfromLine shown in 1.2 Reading Lines, because it is not tab separated. In websmpl.log, fields are basically separated by a SPACE, but the time stamp field is enclosed with SQUARE BRACKETs embracing SPACEs in it. The HTTP-request field is enclosed with QUOTATION MARKs also empracing SPACEs.

Actually, DfromLine accepts field-format-list, which is an extension of a simple field-list and enables to read these fields. Format specification is placed after field-name separated by COLON.

(2-6)

DfromLine -t " " "host,logname,user,time:+1/] /,request:q,status,bytes,etime" websmpl.log

The option -t " " gives the default delimiter which is applied to the fields without delimter specification. In this case it is applied to the fields except for request.

Format specification +1/] / in the field time means "Skip one character (+1), then read the field delimited by RIGHT SQUARE BRACKET + SPACE (/] /).". The reason we need to skip the first character is just to exclude the first LEFT SQUARE BRACKET ([). Without +1 you will get the value with '[' and without ']'.

The delimiter for the particular field is given within //.

Special characters in the D-format is cumbersome subject. The detailed specification is described in a section of the manual D_fmt.

The format of the field request is q, which means "Read a string quoted by QUOTATION MARK (").".

It is good idea to check newly created D-files with Dfdp.

(2-7)

DfromLine -t " " "host,logname,user,time:+1/] /,request:q,status,bytes,etime" websmpl.log | \
Dfdp

It will produce the following output.

(2-7 output)

rec# fieldname min max exists minlen maxlen avglen attribute
   1 host        1   1    8/8     12     15 13.5   Asc
   2 logname     1   1    8/8      1      1  1     Asc
   3 user        1   1    8/8      1      1  1     Asc
   4 time        1   1    8/8     26     26 26     Asc
   5 request     1   1    8/8     14     37 30.375 Asc
   6 status      1   1    8/8      3      9  3.75  Asc
   7 bytes       1   1    8/8      1      4  3.375 Asc
   8 etime       1   1    8/8      2      4  2.25  Int

You may think nothing wrong with this output, but, if you know the field status should be three digit by HTTP specification, you will find the field has some problem. To check the field you will try

(2-8)

DfromLine -t " " "host,logname,user,time:+1/] /,request:q,status,bytes,etime" websmpl.log | \
Dselect f UNLIKE "^[0-9][0-9][0-9]$"

The output is

(2-8 output)

host:247.25.64.162
logname:-
user:-
time:17/Oct/2002:15:19:12 +0900
request:GET /cgi-bin/p03?id=B4903411\
status:HTTP/1.1"
bytes:200
etime:7217

From this and the original file websmpl.log you will find the problem is \" within the field e. This is UNIX type escape method to use QUOTATION MARK within quoted string. As D-format default is Microsoft CSV like escape method (using ""), you have to use format qx to read this log.

(2-9)

DfromLine -t " " "host,logname,user,time:+1/] /,request:qx,status,bytes,etime" websmpl.log

Before closing this section, I would like to introduce a good practice for checking this type of DfromLine usage. Use the following procedure instead of (2-9).

(2-10)

DfromLine -t " " \
"host,logname,user,time:+1/] /,request:qx,status,bytes,etime,XXX" \
websmpl.log | \
Dfdp

The point is adding excess field XXX. This field should not appear in the Dfdp output if all goes well. If the field XXX appears, or the last field etime is missing in some record (you can know this by exists field of the Dfdp output), you can know that something is wrong with the reading process.

2.3 Some more about input format

In the previous subsection, we used some features of D-format, such as positioning (+1), field individual delimiter (/] /) and quoting option (qx). In this subsection, we learn some other features.

First, we learn fixed length format and repeat. Study next example, which prints the special character usage list of the input file.

(2-11)

DfromLine "c:(1)*" websmpl.log | \
Dunbundle c | \
Dselect c UNLIKE "[ a-zA-Z0-9]" | \
Dfreq c | Dpr

The first DfromLine reads field c. The format (1) means that the field is fixed one character length, and ASTERISK (*) means the field repeats to the end of input line. The output from this command is like the following.

(2-12)

Output from the DfromLine of (2-11)

c:2
c:2
c:3
c:.
c:9
c:8
...
...
c:0
c:5
c:
c:4

-- 1st D-record (97 fields)
 

c:1
c:0
c:9
...
...
c:
c:1

-- 2nd D-record (88 fields)

...
...

...
c:6
c:9
c:
c:2

-- 8th (last) D-record (84 fields)

This output has eight D-records corresponding to the number of lines in the input file. Each D-record has repeating field c, corresponding to each characters in the line.

Next Dunbundle disjoints the repeating field c, and generates 734 (total number of characters in the input lines) records having just one field c like the following.

(2-13)

Output from the Dunbundle of (2-11)

c:2

c:2

c:3

c:.

c:9

c:8

...
...

c:9

c:

c:2

-- 734 D-records,

Next Dselect command excludes SPACE, alphabets and digits. Dfreq counts the frequency of c. Final output of (2-11) will be the following.

(2-11 output)

rec# c count
   1 "    17
   2 +     8
   3 -    24
   4 .    32
   5 /    39
   6 :    24
   7 =     5
   8 ?     5
   9 [     8
  10 \     1
  11 ]     8

The second feature we learn is pattern. We have learned field specific delimiter can be given in a field-format-list with /regular expression/. Field pattern is, in a sense, the reversal of field delimiter. It has form @regular expression@, and gives the span of the field with the regular expression. We used delimiter /] / for the field time in (2-10). (Almost) same thing can be done with pattern. See the next command.

(2-14)

DfromLine -t " " \
"host,logname,user,time:+1@[^]]+@,request:+2qx,status,bytes,etime" \
websmpl.log

The field time, here, has pattern @[^]]+@ instead of delimiter /] /. This pattern reads as "one or more characters except RIGHT SQUARE BRACKET (])". The result is same as delimiter /]/. But, slight difference is found in the next field reading position. In the case of delimiter, next field starts from the character after the delimiter. But, in the case of pattern, next field starts from the character just after the matched pattern. It is the reason we need +2 for the next field request.

With pattern and repeat, we can pick up numbers from a text file.

(2-15)

DfromLine "num:@[0-9]+@*" websmpl.log

When a pattern does not match from the current character position, next field starts from the next character. The output has 8 D-records corresponding to the input lines. Each D-record has repeating field num of which value is a number appeares in the input line.

2.4 DfromChunk

DfromLine premises that a logical record is represented in a line. This type of data is commonly used in UNIX world. But, for example, ".ini" file format in Windows uses a text line to represent a logical field, and uses a group of lines to represent a logical record. This type of data representation is widely used (including D). E-mail header is one of the formats of this type. DfromChunk is general converter for this type of format.

2.4.1 ".ini" file

Windows ".ini" file is a classic format for initializer. An example is like this:

(2-16)

; This is a sample .ini file for D_tutorial

[dirs]
HelpDir=c:\Program Files\D-3.0\help
BinDir=c:\Program Files\D-3.0\win64\bin

[window]
WindowSizeX=386
WindowSizeY=540
; Color settings in RRGGBB
Background=ffffff
FontColor=000000

This ".ini" file can be converted to a D-file using the following command.

(2-17)

DfromChunk -h "^\[(.*)\]$" -s "=" chunk.ini

The output will be:

(2-18)

HDR:dirs
HelpDir:c:\Program Files\D-3.0\help
BinDir:c:\Program Files\D-3.0\win64\bin

HDR:window
WindowSizeX:386
WindowSizeY:540
Background:ffffff
FontColor:000000

DfromChunk uses regular expression pattern to find chunk of lines or field-name separators. In this case, -h gives header line pattern ^\[(.*)\]$", which means "whole line is enclosed with SQUARE BRACKETs, and within it zero or more characters (.*)" exist. PARENTHESES in this patten means the matched string to be the value of HDR field. The option -s gives the separator between field name and field value.

2.4.2 Reading mail headers

Mail header (used to be known as RFC 822) uses D like convention, field-name separator is COLON (:) and header fields and body is delimited by null line. In unix mail command, mail command cumulates all the mails in mbox file. To handle individual mail in this mbox, there are some tools. But, DfromChunk can extract header fields from mbox file.

Use the folloging command.

(2-19)

DfromChunk -C -s ": ?" mbox

It will produce an output like the follows

(2-20)

From miyazawa@somewhere.jp  Fri Mar  1 20:10:48 2013
Return-Path:<miyazawa@somewhere.jp>
X-Original-To:miyazawa@elsewhere.jp
Delivered-To:miyazawa@elsewhere.jp
Received:from mailhost.somewhere.jp (mailhost.somewhere.jp [123.456.7.8]) by elsewhere.jp (Postfix) with ESMTP id 2B60D381428 for <miyazawa@elsewhere.jp>; Fri,  1 Mar 2013 20:10:48 +0900 (JST)
Received:from [123.456.45.43] (123.456.45.43 [123.456.45.43]) by mailhost.somewhere.jp (deepsmtpd.so 3.7.0) with ESMTP id <61309CB0.50000@somewhere.jp> for <miyazawa@elsewhere.jp>; Fri, 1 Mar 2013 20:10:40 +0900
Message-ID:<61309CB0.50000@somewhere.jp>
Date:Fri, 01 Mar 2013 20:10:40 +0900
From:MIYAZAWA Akira <miyazawa@somewhere.jp>
User-Agent:Mozilla/5.0 (X11; U; Linux i686; ja; rv:1.9.2.17) Gecko/20110414 SUSE/3.1.10 Thunderbird/3.1.10
MIME-Version:1.0
To:miyazawa@elsewhere.jp
Subject:TEST mail
Content-Type:text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding:7bit
X-IP:123.456.45.43
X-FROM-DOMAIN:somewhere.jp
X-FROM-EMAIL:miyazawa@somewhere.jp
Status:RO

From miyazawa@elsewhere.jp  Fri Mar  1 20:12:47 2013
......   (full listing here)

The option -s of (2-19) may be omitted. But, in that case, each field value will have SPACE character at the beginning.

The full listing shows the last small record with only four fields. In fact, this record is not from the header fields, but from a part of mail-body which quotes other mail.

DfromChunk can not make distinction of header fields and mail bodies. One solution is to use, for example, Dselect EXISTS Message-Id. This method does not exclude attached mail embedded in a mail body. Still, this method provides practical result in many cases.

Process (2-19) may cause code error. Because character code used in a mail depends on the sender's environment, and multiple character codes may be used in a mbox file, it is difficult to avoid such errors. Possible solution in Windows is to use set LANG=C before (2-19). At least, "code error" messages should be suppressed by this solution. In unix, you can use LANG=C; export LANG. But, depending on the locale definition, this may not suppress the error message. You may try, for example, export LANG=en_GB.ISO-8859-1, if the locale is supported and implemented. Implemented locale name (like en_GB.ISO-8859-1) depends on your environment. General discussion on locale and character codes is beyond this tutorial.

2.5 D-file creation from NULL

This subsection use Ded without any input file. The following command produces partial ASCII character list.

(2-21)

Ded \
  FOR VAR i IN 0x60 .. 0x7e DO \
    code = VAR i ";" \
    hex = VAR i SPRINTF "%x" ";" \
    char = VAR i SPRINTF "%lc" ";" \
    OUTPUT \
  DONE \
< /dev/null  | \
Dpr

Note: Line division and indention are for readability. You may write these lines in one line.
< /dev/null should be < NUL in Windows command line.

Output will be:

(2-21 output)

rec# code hex char
   1   96 60  `
   2   97 61  a
   3   98 62  b
   4   99 63  c
   5  100 64  d
   6  101 65  e
   7  102 66  f
   8  103 67  g
   9  104 68  h
  10  105 69  i
  11  106 6a  j
  12  107 6b  k
  13  108 6c  l
  14  109 6d  m
  15  110 6e  n
  16  111 6f  o
  17  112 70  p
  18  113 71  q
  19  114 72  r
  20  115 73  s
  21  116 74  t
  22  117 75  u
  23  118 76  v
  24  119 77  w
  25  120 78  x
  26  121 79  y
  27  122 7a  z
  28  123 7b  {
  29  124 7c  |
  30  125 7d  }
  31  126 7e  ~

We have already used Ded in (1-38) and in (1-39). It is a general editor of D-files, and usually modifies input D-file with a Dl script. In this (2-21), we use Ded without any input. In fact, this script is run under epilogue mode of Ded.

Operator SPRINTF is like C function sprintf(). x SPRINTF y corresponds to sprintf(result, y, x). In this example, the first SPRINTF operation yields hexadecimal representation of VAR i. And, the second SPRINTF operation yields a long char with internal code value VAR i. You may use %c, but you can extend to non ASCII characters by using %lc.

Operator OUTPUT writes current field values as a D-record. At this timing, only field code, hex and char exist. (VAR i is not a field). So, the output has these three fields with current value. Note that automatic output at the end of cycle is not performed in epilogue mode


3. When a field repeats

In "spj" examples in the "Getting started" section, all D-files are first normal form, or a field in the records does not repeat. But, in some operations, we have used Dbundle which introduces repeating fields. Repeating field handling is the most prominent feature of D-file operation.

3.1 Simple repeat and Dunbundle

See the following example D-file movies.d.

(3-1)

movies.d

title:The Godfather
year:1972
director:Francis Ford Coppola
writer:Mario Puzo
writer:Francis Ford Coppola
star:Marlon Brando
star:Al Pacino

title:Singin' in the Rain
year:1952
director:Stanley Donen
director:Gene Kelly
star:Gene Kelly
star:Donald O'Connor
star:Debbie Reynolds

The records are about movies and a movie has one or more directors, writers, actors, etc. In SQL database (or Microsoft Access), repeating fields are not allowed. You have to separate tables like next example (assuming title and year provide the primary key).

(3-2)

Normalized tables
director table
titleyeardirector
The Godfather1972Francis Ford Coppola
Singin' in the Rain1952Stanley Donen
Singin' in the Rain1952Gene Kelly
writer table
titleyearwriter
The Godfather1972Mario Puzo
The Godfather1972Francis Ford Coppola
star table
titleyearstar
The Godfather1972Marlon Brando
The Godfather1972Al Pacino
Singin' in the Rain1952Gene Kelly
Singin' in the Rain1952Donald O'Connor
Singin' in the Rain1952Debbie Reynolds

This is good for machine processing, but not for human reading. Repeating fields in the first D-file provides better browsability. When you are prparing the data by hand, the former formation is much easier.

D-file operations provide facilities to change the former formation to the latter (normalization), or the latter to the former.

(3-3)

Normalization process of movies.d

Dproj title,year,director movies.d | \
Dunbundle director > director.d

Dproj title,year,writer movies.d | \
Dunbundle writer > writer.d

Dproj title,year,star movies.d | \      output
Dunbundle star > star.d

These three groups of commands separates the D-file to three tables above. Procedures are all same. I'll take the third one (star.d) as an example.

The first Dproj limits the fields to be used ones. (See the output). The essential part is Dunbundle. It categorizes fields into "leaf" and "stem". "Leaf" field is specified by command parameter leaf-field-list, All other fields are "stem" fields. Dunbundle operation is to assume a tree structure between the "stem" fields and the "leaves", and to create N records each of which has the "stem" fields and an occurence of "leaf" fields, where N is the number of "leaves". The next figure shows this operation for the first record of the example.


Figure 3-1 Dunbundle operation

The leaf field is star. The stem fields are title and year. There are two "leaves" Marlon Brando and Al Pacino, hence the output has two records.

Dproj and Dunbundle operations above can be inverted. Dunbundle star movies.d will produce the following result.

(3-4)

title:The Godfather
year:1972
director:Francis Ford Coppola
writer:Mario Puzo
writer:Francis Ford Coppola
star:Marlon Brando

title:The Godfather
year:1972
director:Francis Ford Coppola
writer:Mario Puzo
writer:Francis Ford Coppola
star:Al Pacino

title:Singin' in the Rain
year:1952
director:Stanley Donen
director:Gene Kelly
star:Gene Kelly

title:Singin' in the Rain
year:1952
director:Stanley Donen
director:Gene Kelly
star:Donald O'Connor

title:Singin' in the Rain
year:1952
director:Stanley Donen
director:Gene Kelly
star:Debbie Reynolds

In this case, the leaf field is same star, but, the stem fields are title, year, director and writer, The fields director and writer actually repeats. But, they are just copied to the output records as they are, because they are stem fields. Only leaf fields are the target of unbundling.

It will be easyly understood that Dproj title,year,star to this output will produce same star.d.

3.2 Reverse operation of Dunbundle

It is quite natural to ask a question that "is Dbunbundle reversible operation?". The answer is not always "yes", but in many cases including the preceding example, it is reversible.

(3-5)

Reverse operation of Dunbundle (movies.d)

Dbundle title,year director.d > tmp-director.d
Dbundle title,year writer.d > tmp-writer.d
Dbundle title,year star.d > tmp-star.d
Djoin -c title,year tmp-director.d tmp-writer.d tmp-star.d

Dbundle command does the reverse operation of Dunbundle. Here, again, the third one (star.d) will be the example. The parameter title,year gives the stem fields. The fields of the input records are divided into stem fields and leaf fields as shown by the colors in the following.

(3-6)

star.d

title:The Godfather
year:1972
star:Marlon Brando

title:The Godfather
year:1972
star:Al Pacino

title:Singin' in the Rain
year:1952
star:Gene Kelly

title:Singin' in the Rain
year:1952
star:Donald O'Connor

title:Singin' in the Rain
year:1952
star:Debbie Reynolds

Then, Dbundle groups adjoining input records by the value of stem field, and merges the records in a group having:

In the example above, there are two distinct stem field values: title:The Godfather; year:1972 and title:Singin' in the Rain; year:1952, so, the output has two records as follows:

(3-7)

tmp-star.d

title:The Godfather
year:1972
star:Marlon Brando
star:Al Pacino

title:Singin' in the Rain
year:1952
star:Gene Kelly
star:Donald O'Connor
star:Debbie Reynolds

The last part of the process Djoin do the reverse operation of three Dprojs in the "normalization" process (3-3). It takes two or more input files and merges the same key field (title,year here) value records from each input file. It recovers the original table form from divided three tables.

3.3 Pitfalls of this reverse operation (Advanced)

The method introduced in this section may not be successful under some circumstances. There are two pitfalls in the procedure. One is in Dbundle and the other is in Djoin. The common point is in the record sequence and the primary key.

3.3.1 Sorting

In the method, the input (star.d) is the direct output from Dunbundle. Under this condition, reversibility is guaranteed. But, once you change the record sequence of the output, Dbundle no longer guarantees the reversibility. Dbundle groups only adjoining records. If the records with same stem field values are disperse in the input, Dbundle does not merge them.

For example, if you sort star.d by the field star, it will be like this. Then

(3-8)

Dbundle title,year

will produce output like this.

As title:The Godfather; year:1972 records are separated in two positions, Dbundle cannot merge them. This is obvious result for those who know well, but common mistake for beginners.

To avoid this situation, Dsort before Dbundle is widely used technic. Dsort by stem fields ensures the fields to be unique key in the output. But, unfortunately, in this particular case of movies.d, records are not ordered by title or year. Dsort by title,year will not restore the original record sequence. To ensure the reversibility including record and field sequences, we need some more processes, which will be mentioned later.

3.3.2 Output option of Djoin

The second pitfall is with Djoin. If we change the input file sequence of the Djoin command of Reverse operation of Dunbundle (3-5) to

(3-9)

Djoin -c title,year tmp-writer.d tmp-director.d tmp-star.d

you may expect the output to have writer field preceding director field like this.

But, actually, you will get only one D-record like this. The expected second record with title:Singin' in the Rain; year:1952 disappears.

The reason is output selection (-o) option of Djoin command. When -c options is in effect, default value of -o option is "1xx", which means only the records matched to the first input file (tmp-writer.d) to be output. This file does not have title:Singin' in the Rain; year:1952 record, so the output doesn't have it, either.

Output selection option value "xxx" will select any record. But, if you specify

(3-10)

Djoin -c -o xxx title,year tmp-writer.d tmp-director.d tmp-star.d

Djoin complains:

(3-10 message)

Djoin: with -c option, -o option's top must be '1'.

This is by the specification of Djoin. You can't use -o xxx with -c option. To use -o xxx, you have to sort the input. And, if you sort the input files, the original record sequence may be lost.

The following procedure of normalization will ensure the reversibility.

(3-11)

New normalization process of movies.d

Dcat -n movies.d | \
Dproj seq,title,year,director | \
Drename seq:rec# | \
Dunbundle director | \
Dcat -g title,year -n | \ Drename seq:fld# | \
Dorder rec#,fld# > new-director.d

Dcat -n movies.d | \
Dproj seq,title,year,writer | \
Drename seq:rec# | \
Dunbundle director | \
Dcat -g title,year -n | \ Drename seq:fld# | \
Dorder rec#,fld# > new-writer.d

Dcat -n movies.d | \
Dproj seq,title,year,star | \
Drename seq:rec# | \
Dunbundle director | \
Dcat -g title,year -n | \ Drename seq:fld# | \
Dorder rec#,fld# > new-star.d

The new normalized files have two additional fields, rec# and fld#. corresponding to the sequence number of the record in original movies.d and the sequence number of the concerned field in the record. In the procedure, two time used Dcat provides these sequence numbers with -n option. Drename gives distinct fieldnames to these fields, and the last Dorder is used just to beautify records with moving these two sequence fields to top of the records.

Reverse operation of these new files will be the following:

(3-12)

The new reverse operation (movies.d)

Dsort rec#:n,fld#:n new-director.d | \
Dbundle rec#,title,year | \
Dproj "^fld#" > new-tmp-director.d

Dsort rec#:n,fld#:n new-writer.d | \
Dbundle rec#,title,year | \
Dproj "^fld#" > new-tmp-writer.d

Dsort rec#:n,fld#:n new-star.d | \
Dbundle rec#,title,year | \
Dproj "^fld#" > new-tmp-star.d

Djoin -o xxx rec#:n,title,year new-tmp-director.d new-tmp-writer.d new-tmp-star.d | \
Dproj "^rec#"

The result is movies.d. The first Dsort ensures the original sequence of movies.d. In its key-field-list, :n is a key-flag to specify numeric value. It is necessary, because without this, value "10" comes before value "2". Dproj with "^" strips off the listed field. (Quotation mark is not necessary in most shells, but some, including Windows cmd.exe, requires quoting). The final phase Djoin is mostly same as the old procedure (3-5), but with rec#:n field at the top of title,year. As the input is sorted by these fields, we can use -o xxx to reflect all the input records from three files.

3.4 Value of repeating fields

When a field repeats, you have to heed that the value is not single element. For example for movies.d,

(3-13)

Dselect star == "Marlon Brando" movies.d

does not select title:The Godfather record.

Because the value of repeating field is interpreted as an array of elements. With Dl expreession, the value of the field star is { "Marlon Brando" "Al Pacino" } which has two elements, apparently being different from single element "Marlon brando".

You may use INCL operator or more commonly used LIKE operator to test elements of an array.

When a repeating field is specified in the key-field-list of Dbundle, records are merged if the number of field occurences are same and all the value with their order are same. See next examples:

(3-14)

Repeating field equality by examples
Two field "a"s are equal
record 1record 2
a:1a:1
a:2b:2
a:3a:2
 c:3
 a:3
Three field "a:n"s are equal
record 1record 2record 3
a:1a:01a:1.0
a:2a:02a:2.0
a:3a:03a:3.0
Four field "a"s are unequal
record 1record 2record 3record 4
a:1a:1a:1a:01
a:2a:3a:2a:02
a:3a:2 a:03

Note that equality is affected by key-flags. When key-flag is :n, value "1" and "01" are equal, but without that key-flag, they are not equal.

When a repeatig field is specified in the key-fieldlist of Dsort, comparison of values follow the followin rules.

The interpretation of the value of a repeating field is shared by most of D-commands, though there are a few exceptions including Dmeans.

3.5 Repeating group

Here, the term "repeating group" refers to a set of fields which repeats as a group. For the example of repeating groups, we are going to use a record from Robert Schumann's work list.

(3-15)

schumann-op15.d

op:15
date:1838
title:Kinderscenen
category:keyboard
instrumentation:piano
pub:1839
part:1
ptitle:Von fremden Landern und Menschen
key:G
part:2
ptitle:Curiose Geschichte
key:D
part:3
ptitle:Hasche-Mann
key:h
part:4
ptitle:Bittendes Kind
key:D
part:5
ptitle:Glückes genug
key:D
part:6
ptitle:Wichtige Begebenheit
key:A
part:7
ptitle:Träumerei
key:F
part:8
ptitle:Am Camin
key:F
part:9
ptitle:Ritter vom Steckenpferd
key:C
part:10
ptitle:Fast zu ernst
key:gis
part:11
ptitle:Fürchtenmachen
key:G
part:12
ptitle:Kind im Einschlummern
key:e
part:13
ptitle:Der Dichter spricht
key:G

Well, this record may not be easy to read, but it is fairly simple. Schumann's op.15 "Kinderscenen" (Child-scenes) is made of thirteen piano pieces. While the field op (opus), date (year of composition), title, category, instrumentation and pub (year of publishing) describe the whole work, the field part (sequence number of the piece), ptitle (title of the piece) and key describe each piece, so that the latter fields repeat thirteen times. We can think former fiedlds form a stem and the latter fields form thirteen leaves. Next command:

(3-16)

Dtie -t ", " part,ptitle,key piece schumann-op15.d

produces the following output.

(3-16 output)

op:15
date:1838
title:Kinderscenen
category:keyboard
instrumentation:piano
pub:1839
piece:1, Von fremden Landern und Menschen, G
piece:2, Curiose Geschichte, D
piece:3, Hasche-Mann, h
piece:4, Bittendes Kind, D
piece:5, Glückes genug, D
piece:6, Wichtige Begebenheit, A
piece:7, Träumerei, F
piece:8, Am Camin, F
piece:9, Ritter vom Steckenpferd, C
piece:10, Fast zu ernst, gis
piece:11, Fürchtenmachen, G
piece:12, Kind im Einschlummern, e
piece:13, Der Dichter spricht, G

This record is better for reading. Dtie finds tree structure in the input record, like Dunbundle, and "ties" leaf fields making individual leaf as a new field. In other words, it converts a repeating group into a single repeating field. In the command line, part,ptitle,key is the leaf field list, piece is the new field name given to the "tied" leaf, and the option -t ", " gives the delimiter to be inserted between "tied" values.

Here, you may ask question that how Dtie find the leaves. By default, Dtie uses N-th occurence algorithm. It makes n-th leaf from n-th occurence of each leaf field. But, this algorithm does not work well in some cases. See another record from Robert Schumann's work list.

(3-17)

schumann-op14a.d

op:14a
date:1836
title:Sonate No.3
atitle:Grosse Sonate
atitle:Concert ohne Orchester
version:Erste Ausgabe
category:keyboard
instrumentation:piano
pub:1836
part:1
tempo:Allegro brillante
key:f
part:2
ptitle:Quasi variazioni
tempo:Andantino de Clara Wieck
key:f
part:3
tempo:Prestissimo possibile
key:f

There are three new fields: atitle (alternative title: repeating) and version pertain to the whole work and tempo pertains to each piece ("movement"). If you use

(3-18)

Dtie -t ", " part,ptitle,tempo,key movement schumann-op14a.d

it will produce the following output.

(3-18 output)

op:14a
date:1836
title:Sonate No.3
atitle:Grosse Sonate
atitle:Concert ohne Orchester
version:Erste Ausgabe
category:keyboard
instrumentation:piano
pub:1836
movement:1, Allegro brillante, f, Quasi variazioni
movement:2, Andantino de Clara Wieck, f
movement:3, Prestissimo possibile, f

This is not good because "Quasi variazioni" should come to the second movement. With N-th occurence algorithm, missing fields in leaves are not allowed. In this op.14a record (and in other records), description of pieces are always led by part field. In such case Leading field algorithm works well. Use following command:

(3-19)

Dtie -t ", " -L part,ptitle,tempo,key movement schumann-op14a.d

will produce the next output.

(3-19 output)

op:14a
date:1836
title:Sonate No.3
atitle:Grosse Sonate
atitle:Concert ohne Orchester
version:Erste Ausgabe
category:keyboard
instrumentation:piano
pub:1836
movement:1, Allegro brillante, f
movement:2, Quasi variazioni, Andantino de Clara Wieck, f
movement:3, Prestissimo possibile, f

Note that Leading field algorithm works for op.15 as well. For the detail of these "leaf separation algorithims", refer to the manual D_lsa.

3.6 Repeating group and Dfd

We used Dfd command in the "Getting started" section (1-3). Before going to the next session. we observe the result of Dfd command on the repeating groups. Do next command.

(3-20)

Dcat schumann-op14a.d schumann-op15.d > schumann-ops.d

It produces a D-file with two records we used in the previous subsection. Try Dfdp command.

(3-21a)

Dfdp schumann-ops.d

or

(3-21b)

Dfd schumann-ops.d | Dpr -f exists:r -g filename

It will produce the following output.

(3-21 output)

                            filename:schumann-ops.d

rec# fieldname       min max exists minlen maxlen avglen  attribute position
   1 op                1   1    2/2      2      3  2.5    Asc
   2 date              1   1    2/2      4      4  4      Int
   3 title             1   1    2/2     11     12 11.5    Asc
   4 atitle            0   2    1/2     13     22 17.5    Asc
   5 version           0   1    1/2     13     13 13      Asc
   6 category          1   1    2/2      8      8  8      Asc
   7 instrumentation   1   1    2/2      5      5  5      Asc
   8 pub               1   1    2/2      4      4  4      Int
   9 part              3  13    2/2      1      2  1.25   Int       split
  10 ptitle            1  13    2/2      8     32 16.5    AscNAsc   split
  11 tempo             0   3    1/2     17     24 20.6667 Asc       split
  12 key               3  13    2/2      1      3  1.125  Asc       split

The output has a new column named "position", which is not found in the (1-3 output). The value of this field is either null or split. This value means that the field is repeated and there are other fields among the occurecnces of this field (in at least one record). This split strongly suggests the field is a part of a repeating group.

In this case, fields part, ptitle, tempo and key have value split and likely to form a repeating group.

Note that the field ptitle has value AscNAsc. Some of the part titles have German words with umlauts which can not be represented by ASCII characters.

3.7 Djoin, Dbundle and repeating group

As we already saw in "D-file operations" section, repeating group is produced with D-file operation Dbundle from normalized files. We are going back to Supplier-part-project (spj) example for this section.

In the spj files, all the essential associations between three entities (supplier, part and project) are represented in supply.d file. Suppose you are the project manager of the "Console" project (j# == 4), you will need to know what kind of parts you use, and which supplier(s) supply them when and how many. You may use

(3-22)

Dsort j#,p#,s# supply.d | Dbundle j#,p# | Dselect j# == 4 | Dpr

to get the followig result.

(3-22 output)

rec# s# p# shipdate quantity
   1  1  1 70,1,12       700
      5    70,2,9        100
   2  5  2 70,1,23       100
   3  2  3 70,1,17       500
      5    70,1,14       200
   4  5  4 70,1,24       800
   5  5  5 70,1,12       400
   6  5  6 70,2,5        500

Dbundle j#,p# makes tree structure with repeating groups. Stem fields are j#,p# and leaf fields are p#,shipdate,quantity. The first Dsort j#:n,p#:n,s#:n prepares for the Dbundle.

If you memorize who is supplier number 5 and what is part number 2, this result may be ok. But, general people need part names and supplier names in addition to p# and s#. You can find these names in part.d or in supplier.d. For the part names, the following command

(3-23)

Dsort j#,p#,s# supply.d | Dbundle j#,p# | Dselect j# == 4 | \
Djoin -c p# - part.d | \
Dorder j#,p#,pname,color,weight,qoh,s#,shipdate,quantity | Dpr

produces next output.

(3-23 output)

rec# j# p# pname color weight qoh s# shipdate quantity
   1  4  1 Nut   Red       12  30  1 70,1,12       700
                                   5 70,2,9        100
   2  4  2 Bolt  Green     17  60  5 70,1,23       100
   3  4  3 Screw Blue      17  30  2 70,1,17       500
                                   5 70,1,14       200
   4  4  4 Screw Red       14  10  5 70,1,24       800
   5  4  5 Cam   Blue      12  20  5 70,1,12       400
   6  4  6 Cog   Red       19  40  5 70,2,5        500

Dorder here is just to provide easier reading.

But, you can not combine supplier names in the same way. The field p# is one of the stem fields, while the field s# is one of the leaf fields in the (3-22 output). You do not join files with a leaf field.

If you try the same way for the field s# and supplier.d as follows,

(3-24)

Dsort j#,p#,s# supply.d | Dbundle j#,p# | Dselect j# == 4 | \
Djoin -c p# - part.d | \
Djoin -c s# - supplier.d | \
Dorder j#,p#,pname,color,weight,qoh,s#,sname,loc,shipdate,quantity | Dpr

You will get

(3-24 output)

rec# j# p# pname color weight qoh s# sname loc    shipdate quantity
   1  4  1 Nut   Red       12  30  1              70,1,12       700
                                   5              70,2,9        100
   2  4  2 Bolt  Green     17  60  5 Adams Athens 70,1,23       100
   3  4  3 Screw Blue      17  30  2              70,1,17       500
                                   5              70,1,14       200
   4  4  4 Screw Red       14  10  5 Adams Athens 70,1,24       800
   5  4  5 Cam   Blue      12  20  5 Adams Athens 70,1,12       400
   6  4  6 Cog   Red       19  40  5 Adams Athens 70,2,5        500

Some of the supplier names and locations are missing. The reason is almost obvious if you understand the Value of repeating fields subsection. As the field s# is repeating, it does not match with the records in supplier.d, which has single value s#.

Solution is, again, almost obvious. Do Djoin before Dbundle.

(3-25)

Dsort j#,p#,s# supply.d | \
Djoin -c p# - part.d | \
Djoin -c s# - supplier.d | \
Dbundle j#,p#,pname,color,weight,qoh | \
Dselect j# == 4 | Dorder j#,p#,pname,color,weight,qoh,s#,sname,loc,shipdate,quantity | Dpr

This is almost same as (3-24) but the Dbundle comes after two Djoins. In addition, note that the parameter of Dbundle includes all the dependent fields of p# (sname,color,weight,qoh). This command will produce output like this.

It is easy to modify (3-25) so that not only the number 4 project but all the projects are listed. For this, usually, -g (group by) option is used.

(3-26)

Djoin -c j# supply.d project.d | \
Djoin -c p# - part.d | \
Djoin -c s# - supplier.d | \
Dsort j#:n,p#:n,s#:n | \
Drder j#,jname,mgr_e#,p#,pname,color,weight,qoh,s#,sname,loc,shipdate,quantity | \
Dbundle j#,jname,mgr_e#,p#,pname,color,weigt,qoh | \
Dpr -g j#,jname,mgr_e#

This command produces output like this.

3.8 A bit theoretically

Before starting this topic, we introduce the consolidated file spj.d for Spj examples as follows.

(3-27)

Djoin -c s# supply.d supplier.d | \
Djoin -c p# - part.d | \
Djoin -c j# - project.d > spj.d

You know original supplier.d, part.d, project.d and supply.d files can be easily restored from spj.d file. For example:

(3-28)

Dproj s#,sname,loc spj.d | \
Dsort s#:n,sname,loc | Dbundle "^" > supplier.d

Now, Spj examples can be viewd as three level tree structure with six ways, They are:

The output of (3-26) is project - part - supplier tree, Actually, the top level project has no corresponding record. It is represented only by -g j#,jname,mgr_e# option of the Dpr command, while part and supplier level is represented by the stem - leaf structure in each D-record.

In the same way, you can make supplier - part - project tree with the following command.

(3-29)

Dsort s#:n,p#:n,j#:n spj.d | \
Dorder s#,sname,loc,p#,pname,color,weight,qoh,j#,jname,mgr_e#,shipdate,quantity | \
Dbundle s#,sname,loc,p#,pname,color,weight,qoh | \
Dpr -g s#,sname,loc

It will produce an output like this.

Is it possible to make three level tree structure? Yes. The following commands produce supplier - part - project tree.

(3-30)

Dsort s#:n,p#:n,j#:n spj.d | \
Dorder s#,sname,loc,p#,pname,color,weight,qoh,j#,jname,mgr_e#,shipdate,quantity | \
Dbundle s#,sname,loc,p#,pname,color,weight,qoh | \
Dbundle s#,sname,loc > 3-level.d

Fields s#, sname and loc are the first level stem fields. Fields p#, pname, color, weight and qoh are the second level, i.e. leaf for the first level and stem for the third level. Fields j#, jname, mgr_e#, shipdate and quantity are the third level leaf fields. In the listing of 3-level.d, these are shown by color.

If you want to draw out the second level,

(3-31)

Dunbundle -L p#,pname,color,weight,qoh,j#,jname,mgr_e#,shipdate,quantity 3-level.d

will work. Note that you need -L option (Leading Field Algorithm). Note also that you need to list the third level leaf fields, too.

If you want to draw out the third level, you need Dunbundle after extracting the second level (3-31).

(3-32)

Dunbundle -L p#,pname,color,weight,qoh,j#,jname,mgr_e#,shipdate,quantity 3-level.d | \
Dunbundle -L j#,jname,mgr_e#,shipdate,quantity

As shown in this example, three level tree structure can be embedded in the D-record. But, D-commands support, basically, two level tree structure only. You need to iterate D-commands to process lower level leaves. For this reason, it is not good idea to embed three or more level tree structure into a D-file.

3.9 Conversion to XML

When handling three or more level tree structure, explicitly, you should consider to convert the data to XML, as D is basically for flat or two level tree structure.

DtoXml is the command to use. (There is, of course, DfromXml and more popular DfromHtml. They are introduced in a separate section.)

Suppose you have the following file ab.d.

(3-33)

a:123
b:456

Then, the command

(3-34)

DtoXml ab.d

produces the following output.

(3-35)

<root>
 <file>
  <record>
   <a>123</a>
   <b>456</b>
  </record>
 </file>
</root>

(Note that unnecessary spaces are removed and indention is added for readability.)

This is for flat files. DtoXml offers two ways of giving structure. One way is giving leaf field, and the other way is using group by (-g) option. Leaf fields can represent two level tree structure. Group by options can be used more than one, so that arbitrary number of levels can be represented. In addition, group by and leaf fields can be used together.

To show the usage of DtoXml, project - part - supplier tree made by (3-26) and supplier - part - project tree made by (3-30) will be produced with different way.

For the first way, Dsort, Dorder (for the readability) and Dbundle are same as we did in (3-26). In the last part, we use DtoXml instead of Dpr

(3-36)

Dsort j#:n,p#:n,s#:n | \
Drder j#,jname,mgr_e#,p#,pname,color,weight,qoh,s#,sname,loc,shipdate,quantity | \
Dbundle j#,jname,mgr_e#,p#,pname,color,weigt,qoh | \
Drename j#:jno,mgr_e#:mgr_eno,p#:pno,s#:sno | \
DtoXml -g jno,jname,mgr_eno -L sno,sname,loc,shipdate,quantity

Drename is to change field names not allowed for XML tag names. The output is listed here.

The other way is more simple. It starts just like (3-30) and instead of Dbundle, DtoXml with two group by options is used.

(3-37)

Dsort s#:n,p#:n,j#:n spj.d | \
Dorder s#,sname,loc,p#,pname,color,weight,qoh,j#,jname,mgr_e#,shipdate,quantity | \
Drename s#:sno,p#:pno,j#:jno,mgr_e#:mgr_eno | \
DtoXml -g sno,sname,loc -g pno,pname,color,weight,qoh

The output will be this. Though the tag names are slightly different, those two are essentially same XML document. If you want, you can change tag names like <group>, <record> or <leaf>. See the manual of DtoXml.

How to handle XML files is out of scope of this tutorial. But, before closing this section, an HTML tables produced from the output of (3-37) are shown.

(3-38)

Table 3-1. An example of tables produced from the XML file

j#:1; Smith, London
p# pname color weight qoh j# jname mgr_e# shipdate quantity
1 Nut Red 12 30 1 Sorter 640028 70,1,12 200
4 Console 660118 70,1,12 700
j#:2; Jones, Paris
p# pname color weight qoh j# jname mgr_e# shipdate quantity
3 Screw Blue 17 30 1 Sorter 640028 70,1,17 400
2 Punch 700128 70,1,17 200
3 Reader 680096 70,1,17 200
4 Console 660118 70,1,17 500
5 Collator 690002 70,1,17 600
6 Terminal 640014 70,1,17 400
7 tape 710020 70,1,17 800
5 Cam Blue 12 20 2 Punch 700128 69,12,19 100
j#:3; Blake, Paris
p# pname color weight qoh j# jname mgr_e# shipdate quantity
3 Screw Blue 17 30 1 Sorter 640028 70,2,2 200
4 Screw Red 14 10 2 Punch 700128 70,2,10 500
j#:4; Clark, London
p# pname color weight qoh j# jname mgr_e# shipdate quantity
6 Cog Red 19 40 3 Reader 680096 70,1,31 300
7 tape 710020 70,1,31 300
j#:5; Adams, Athens
p# pname color weight qoh j# jname mgr_e# shipdate quantity
1 Nut Red 12 30 4 Console 660118 70,2,9 100
2 Bolt Green 17 60 2 Punch 700128 70,1,23 200
4 Console 660118 70,1,23 100
3 Screw Blue 17 30 4 Console 660118 70,1,14 200
7 tape 710020 70,1,31 100
4 Screw Red 14 10 4 Console 660118 70,1,24 800
5 Cam Blue 12 20 4 Console 660118 70,1,12 400
5 Collator 690002 70,1,12 500
7 tape 710020 70,1,12 100
6 Cog Red 19 40 2 Punch 700128 70,1,16 200
4 Console 660118 70,2,5 500

HTML source here

These HTML tables are produced from the output of (3-37) with this xslt script.


4. Renaming the fields

In this section, we use next example D-file as a start point.

(4-1)

     rename-1.d
rec# cc nm        lc
   1 DE Michel    de
   2 FR Marianne  fr
   3 GB John Bull en
   4 US Uncle Sam en
                    Text view here

4.1 Simply Drename

Of course, Drename provides field rename facility. For example,

(4-2)

Drename cc:country-code,nm:name,lc:language-code rename-1.d              Output

renames field cc to country-code, field nm to name and field lc to language-code. (It's good idea to make expressive field names for the readability). But, what if Marianne says it's not name but nom, and Michel says it's Name?

4.2 Separation and Drename

Drename does not provide conditional renaming function. The first idea is to divide the data by language and apply Drename separately.

(4-3)

Dselect lc == de rename-1.d | Drename nm:Name > tmp-de.d
Dselect lc == fr rename-1.d | Drename nm:nom > tmp-fr.d
Dselect lc == en rename-1.d | Drename nm:name > tmp-en.d
Dcat tmp-de.d tmp-fr.d tmp-en.d                                     Output

Note: lc == de is FIELD lc == CONST de in full style. It may be better to use the full style to avoid unexpected result.

But, with this method you needs more than three paths, i.e., you have to read through whole file more than three times. This is not efficient when the file is very big or you have large number of conditions you want to separate. Isn't there a method with just one path?

4.3 Using Ded

Ded is an interpreter of Dl language and a general purpose D-record processor.

(4-4)

Ded IF lc == de THEN FIELD Name = FIELD nm \
    ELIF lc == fr THEN FIELD nom = FIELD nm \
    ELSE FIELD name = FIELD nm FI ";" \
    FIELD nm = { } rename-1.d                      Output

What this small Dl program does is to make a new field depending on the lc value, copying from nm field, and then remove nm field ( nm = { } ). As the new field is generated after the existing fields, the field order is changed. If the field order matters, you may use Dorder after this.

4.4 Tricky but effective

This method also uses Dl with Ded. It is tricky because it relies on the raw structure of D-record.

(4-5)

Ded IF lc == de THEN @_ = @_ S "^nm:" BY "Name:" \
    ELIF lc == fr THEN @_ = @_ S "^nm: BY "nom:" \
    ELSE @_ = @_ S "^nm:" BY "name:" FI rename-1.d              Output

Note: >@_ can be FIELDS or CURREC. These three are synonyms.

This Dl program is similar to the previous one. The point is @_ and S operator. @_ is the current record special variable, which is an array of all fields in the current record represented as strings in the form of D-fields in a D-file (i.e., field name:value form). It can also be the left hand value of an asignment operator, and changes made in @_ is directly reflected in the current record.

S operator is ternary substitute operator: x S y BY z means "s/y/z/" operation of sed on the string x. The second operand y is regular expression. In this expression, ^nm: matchs the string nm: at the beginning of the string, hence matches the field name nm. In this case, @_ is an array. S operation is applied to each elements of @_, and the result is same size array.


5. Row-column transposition

5.1 Using Ddecompose and Dcompose

Sometimes, you may want to transpose rows and columns in a table. In D-files, this means to convert a field value to a field name, and to convert field names to field values under some field name. For example, for a D-file transposition-1.d shown with Dpr -i year transposition-1.d as:

(5-1)

          transposition-1.d

year USD/CHF USD/EUR USD/GBP USD/JPY
2001  1.6868  1.1166  0.6942 121.5193
2002  1.5561  1.0608  0.6663 125.1998
2003  1.3449  0.8852  0.6122 115.9517
2004  1.2426  0.8050  0.5460 108.1542
2005  1.2455  0.8044  0.5500 110.1053 Text view here.

You may want to transpose this table into row as time series form, such as:

(5-2)

        transposition-2.d

currency 2001     2002     2003     2004     2005
USD/CHF    1.6868   1.5561   1.3449   1.2426   1.2455
USD/EUR    1.1166   1.0608   0.8852   0.8050   0.8044
USD/GPB    0.6942   0.6663   0.6122   0.5460   0.5500
USD/JPY  121.5193 125.1998 115.9517 108.1542 110.1053 Text view here

There is no direct D-operation to do transposition. Use Ddecompose to make triplets of row-id, column-id and the value (e.g, 2001, USD/CHF, 1.6868), then Dsort to make it in column order, and finally use Dcompose to assemble in new rows.

(5-3)

Ddecompose -i year transposition-1.d | \           Output, Note 1
Dsort fieldname | \                                Output
Drename year:fieldname,fieldname:currency | \      Output, Note 2
Dcompose -i currency > transposition-2.d

Note 1: year is the row identifier field in transposition-1.d file.
Note 2: currency is the field name given here for the new row identifier field.

5.2 Tricky and unrecommendable way (for backward compatibility)

There is another way to do transposition. This is a bit tricky and not recommendable, but as Ddecompose and Dcompose was introduced from D-2.6, you have to use this in the earlier versions of D. This procedure essentially does same process as the above Ddecompose-Dcompose procedure.

(5-4)

Dtie -zf "^year" .x transposition-1.d | \    Output, Note 3
Dunpack .x | \                               Output
Dunbundle .x | \                             Output
Duntie -t: .x currency,.y | \                Output, Note 4
Dsort currency | \                           Output
Dtie -t: year,.y .z | \                      Output, Note 5
Duntie .z .:f | \                            Output, Note 6
Dbundle currency | \                         Output
Dorder currency > transposition-2.d                 Note 7

Note 3: .x here is an arbitrary field name, local to this procedure. Dtie "^year" .x in this case ties all fields except for year with TAB character, forming a new .x field. In doing so with format option -zf, not only the value of the field, but also field name is tied in <field name>:<value> form. As it uses TAB as the delimiter, when your data has TAB character in it, you have to give different delimiter with -t option, and have to give the same delimiter in the next Dunpack command.
Note 4 currency is the field name given here, .y is an arbitrary field name, local to this procedure. Note that row-id, column-id, value triplet is made here.
Note 5: year field and the value field (.y) is tied with delimiter COLON and temporary field name .z is given.
Note 6: Duntie here is used just to read the contents of .z field. AS -zf format is given, actual field name is derived from the contents of .z field.
Note 7 This Dorder is not essential, but at this position, the first field is 2001. It is not same as transposition-2.d. This Dorder command makes field order as in transposition-2.d.


6. HTML table reading

A lot of data are published in web pages as form of tables. Unfortunately, there is no general way to derive them in desired style, because there are may ways to represent same data in HTML table form. Especially, table nesting and row/column-span complicates reading way. You have to judge which part of the table represents data and which part indicates labels. For this analyzation, basic knowledge of HTML is essential. At least you have to know <table>, <tbody>, <tr>, <td> and <th>, which are essential tags in HTML table. In addition, you need minimum knowledge of xpath. But, you will acquire required xpath knowledge by using DfromHtml.

6.1 Simple table reading

We use the following HTML table In this section.

(6-1)

HTML-table-1
Country-nameCountry-codeLanguage-codeCurrency-code
FRANCEFRAfrEUR
GERMANYDEUdeEUR
JAPANJPNjaJPY
KOREA, REPUBLIC OFKORkoKRW
UNITED KINGDOMGBRenGBP

HTML source here

6.1.1 Simple fallback method, first

With this method, you have to name the fields by yourself.

(6-2)

DfromHtml -p //tr HTML-table-1.html | \           Output
Dextract 2- | \                                   Output
Ded FIELD Country-name = FIELD td [ 0 ] ";" \
    FIELD Country-code = FIELD td [ 1 ] ";" \
    FIELD Language-code = FIELD td [ 2 ] ";" \
    FIELD Currency-code = FIELD td [ 3 ] | \      Output
Dproj "Country-name,Country-code,Language-code,Currency-code" > HTML-table-1.d

The first step of HTML table reading is done by DfromHtml which extracts data from HTML files, and convert them into D-file format. In an HTML table, a row is represented by a <tr> (table row) element. DfromHtml -p //tr reads HTML files and make a D-record from each <tr> element in the HTML file. D-fields are made from the elements directly under the <tr> element. There are six rows including the header row in HTML-table-1 (source). So, the output D-file has six D-records. The header row in the input has four <th> (table header) elements, and the corresponding D-record has four "th" fields. Following five rows, each of which has fource <td> elements, yield five D-records having four "td" fields each.

There is another field "node" in the output. This field is not used in this method. It is explained in the next subsection.

The second step, Dextract 2- selects the second record to the last records, so the first record is omitted. In this method, the first record labels are not used.

The third step is Ded command with a simple program given by its arguments. This program is written in Dl. Ded executes this program for each input D-record and output the result. This simple program adds four fields, Country-name, Country-code, Language-code and Currency-code to the input record, copying the value from the first ([ 0 ]), the second ([ 1 ]), the third ([ 2 ]) and the fourth ([ 3 ]) td fields, respectively. The new field names are not necessarily equal to the first row labels. You may name them as you like.

The output D-records have both original td fields and newly added four fields. The last step drops the unnecessary original fields, keeping only the newly added fields.

6.1.2 D-authentic method

The previous method ignores the labels in the first row, and gives the field names by hand. It is easy when the columns are four. But, if the table has a hundred columns, you have to name each of them by hand, it will be hard work. This method utilize several D-commands to give field names from the first row labels.

(6-3)

DfromHtml -p //tr HTML-table-1.html | \      Output
Dfill th | \                                 Output
Dselect EXISTS td | \                        Output
Dunbundle th,td | \                          Output
Drename th:fieldname,td:value | \            Output
Dcompose -i node | \                         Output
Dproj "^node" > HTML-table-1.d

The first step DfromHtml is same as the previous method. In this method node field has its role. The value of node field is the xpath expression of the element which yields the output D-record. This field provides the identifier of the record in the output. For example:

(6-4)

node:/html/body/table/tbody/tr[2]

can be read as "this record is yielded from the second <tr> node in the <tbody> node in the <table> node in the <body> node in the <html> (root) node". Xpath is a language to select nodes. In //tr, '//' means "descendan or self", and //tr means any <tr> node under any level of the root (<html>) node.

Next Dfill th command copies th fields in the first record to the following records those don't have th field.

Next Dselect EXSISTS td filters out the first record which has the field names only (th field only thus not having td field). The argument EXISTS td is a Dl expression. It means the record has at least one td field.

At this point, as you see, you have five records with a node field, th fields representing field name and td fields representing the value. Latter two fields repeat four times corresponding to the table columns. Next two commands prepare to use Dcompose. Dunbundle th,td singularizes repeating four pairs of th and td, then Drename th:fieldname,td:value renames the field names as fieldname and value, so that Dcompose can work.

Dcompose -i node composes a D-record from a field name and a value. The option -i node tells it to make an output D-record for each node field value. The last command Dproj "^node" simply drops node fields, which we don't need any more. The result is written in HTML-table-1.d, and with Dpr, you can get a table just like the given one.

6.1.3 via CSV method

There are many ways to handle the D-file output from DfromHtml. The essential point is how to deliver the field names in the first D-record to the following D-records. Converting to and from CSV (comma separated value) file gives a simple solution to this question.

(6-5)

DfromHtml -p //tr HTML-table-1.html | \      Output
Dproj "^node" | \                            Output
DtoLine -t , -z q | \                        Output
DfromCsv > HTML-table-1.d

The first step, DfromHtml, is same as the previous example. The second step Dproj "^node" removes the field node, which is not used in this method.

The third step, DtoLine converts D-record into a line. DtoLine -t , -z q means the delimiter as COMMA (,) and all the fields to be quoted with QUOTATION MARK ("), so the output becomes CSV file.

The last step DfromCsv reads a CSV file (the first line as field names) and convert it to a D-file.

6.2 Reading a table with a header column

We use the following HTML table In this section.

(6-6)

HTML-table-2
HIGHLOW
03-2512°C2°C
03-2611°C1°C
03-2710°C1°C
03-2810°C2°C

HTML source here

6.2.1 Via CSV method

CSV method of 6.1.3 can be applied for this table, too. The first field name will become null-string, but it is still valid D-record.

(6-7)

DfromHtml -p //tr HTML-table-2.html | \      Output
Dproj "^node" | \                            Output
DtoLine -t , -z q | \                        Output
DfromCsv > HTML-table-2.d

It may be better to give a field name, e.g. date with

(6-8)

Drename :date HTML-table-2.d > HTML-table-2-new.d

6.2.2 D-authentic method

D-authentic method of 6.1.2 can not be applied to HTML-table-2 as it is in the (6-3) procedure. Because, in the output from DfromHtml of (6-7), all the records have th field and Dfill th does not work as in (6-3).

Next script is a bit complex, but it covers some of the typical D-file operations.

(6-9)

DfromHtml -p //tr HTML-table-2.html | \      Output
Dproj "^node" | \                            Output
Dextract 1 | \                               Output
Ddecompose | \                               Output
Dproj fieldseq,value | \                     Output
Drename value:fieldname > tmp.d

DfromHtml -p //tr HTML-table-2.html | \      Output
Dproj "^node" | \                            Output
Dextract 2- | \                              Output
Ddecompose | \                               Output
Dproj "^fieldname" | \                       Output
Djoin -c fieldseq - tmp.d | \                Output
Dcompose > HTML-table-2.d

The first half is to make a table of the field sequence and the field name, and store it in a file tmp.d. The first two steps are same as via CSV method. Next Dextract selects only the first record, which contains field names. After Ddecompose, field value has the field name to be assigned. Next two steps are to select only needed fields and rename value field to fieldname, so that it can be used in Dcompose afterwards.

The latter half is to replace field names (th or td) of the other D-records with the field names in tmp.d. Dextract 2- filters out the first D-record already processed in the first half. After Ddecompose, Dproj "^fieldname" removes the field names (th or td), then Djoin -c fieldseq - tmp.d gives field names from tmp.d. Djoin joins D-records from two (or more) files with same key value field. Djoin -c fieldseq - tmp.d joins standard input file (output from the Dproj) and tmp.d file with fieldseq field as the key. The option -c tells to Djoin that the input file is not sorted by the key field. With this, field names corresponding to the column position (represented by fieldseq field) are brought into the decomposed records. At the last line, Dcompose reconstruct the D-records. Here, we don't need -i option, because the seq field generated by Ddecompose identifies the original D-records.

6.3 Table with colspan, rowspan

We use the following HTML table In this section.

(6-10)

HTML-table-3
YearMonth TokyoSapporo
Maximum TemperatureMinimum Temperature Maximum TemperatureMinimum Temperature
2004Oct 28°C9°C24°C0°C
Nov 23°C8°C19°C-5°C
Dec 25°C0°C11°C-9°C
2005Jan 19°C-1°C7°C-12°C
Feb 19°C0°C3°C-11°C
Mar 19°C1°C9°C-11°C

HTML source

Unlike former two tables, how to read this table as a D-file is not straightforward. You may want to make records like

(6-11)

Year:2004
Month:Oct
Tokyo Maximum Temperature:28°C
Tokyo Minimum Temperature:9°C
Sapporo Maximum Temperature:24°C
Sapporo Minimum Temperature:0°C

or, like

(6-12)

Year:2004
Month:Oct
Place:Tokyo
property:Maximum Temperature
value:28°C

Year:2004
Month:Oct
Place:Tokyo
property:Minimum Temperature
value:9°C

There are many other ways. It depends on your purpose to choose the form of the result. Here, two examples above will be shown.

6.3.1 Method one

(6-13)

DfromHtml -p //tr HTML-table-3.html | \                            Output
Dproj "^node" | \                                                  Output
Dcat -n | \                                                        Output
Drename th:td | \                                                  Output
Dunbundle -L td,@colspan,@rowspan | \                              Output
Ded IF EXISTS @colspan THEN \
       FOR i IN 1 .. FIELD @colspan - 1 DO OUTPUT DONE FI | \      Output
Ded IF EXISTS @rowspan THEN \
       FOR i IN 1 .. FIELD @rowspan - 1 DO \
         OUTPUT ";" FIELD seq = FIELD seq + 1 DONE FI | \          Output
Dsort seq:n | \                                                    Output
Dproj "^@colspan,@rowspan" > tmp0.d

The first step is to make a D-file representing the table with no "span". This intermediate file tmp0.d represents a table like

(6-14)

Table image represented by tmp0.d
YearMonthTokyoTokyoSapporoSapporo
YearMonthMaximum TemperatureMinimum TemperatureMaximum TemperatureMinimum Temperature
2004Oct 28°C9°C24°C0°C
2004Nov 23°C8°C19°C-5°C
2004Dec 25°C0°C11°C-9°C
2005Jan 19°C-1°C7°C-12°C
2005Feb 19°C0°C3°C-11°C
2005Mar 19°C1°C9°C-11°C

In the output from DfromHtml, attributes like colspan or rowspan are converted to a D-field named @colspan or @rowspan. The attribute field is placed just after the element field to which the attribute belongs. Next two steps, Dproj "^node" and Dcat -n replaces the node field with seq field. It is not essential but it makes rowspan handling afterward easier.

In this method, Dunbundle -L td,@colspan,@rowspan is used instead of Ddecompose to make cell unit D-records. The reason is to handle attribute D-fields (@colspan and @rowspan) with cell level D-fields. What we want to do here is to separate field groups begin with th or td followed by attribute fields (@colspan or @rowspan). But, any leaf separation algorithm used for Dunbundle (version 2.6) can not do this directly. So, rename th field to td and use Leading field algorithm.

Next two Ded steps are for "spanning". It is possible to combine these two steps with a Ded command. But, it makes the Dl program more complex. The first Dl program duplicates the cell level D-record as @colspan field designates. The second Dl program duplicates the cell level D-record as @rowspan field designates, and make it with appropriate seq field value. Note 1 After these, Dsort seq:n sort the cell level D-field by seq (numeric) field. Numeric flag (:n) is required, because unless this, value "2" comes after value "11". In Dsort, original record sequence is always respected as the last hidden sortkey. By this, the row-spanned D-record comes right place after the Dsort. The last step Dproj drops the fields no more used.

Note 1 This is the reason why we replace node field with seq. It is possible to make /html/body/table/tbody/tr[2] from /html/body/table/tbody/tr[1], but it will take some more steps.

The second part is to combine the first two rows to make single field name row. It is stored in an intermediate file tmp2.d

(6-15)

Dselect seq == 1 tmp0.d > tmp1.d
Dselect seq == 2 tmp0.d | \                          Output
Dpaste tmp1.d - | \                                  Output
Ded IF FIELD td [ 0 ] == FIELD td [ 1 ] THEN \
   FIELD td [ 1 ] = { } FI | \                       Output
Dpack -t " " td > tmp2.d

In this case we use Dselect instead of Dextract to extract the first row. Because, in the input file tmp0.d, the first row is represented by six D-records having seq field value "1". Dselect is another Dl processor only for selection (no record change). We make two D-files, the first one has the first row D-records only, and is stored to tmp1.d. The second one, which is not stored, has the second row D-records only. These two files are "pasted" with Dpaste. The second file name - means standard-in file pipe-lined from the previous command. The output has two td fields from the first and second row, with two seq fields of which value "1" and "2".

Dpack concatenates two td fields into one, with intervening SPACE character (-t " " option). If the output from Dpaste is fed directly to this Dpack, first D-records th value will be "Year-Year". To avoid this, we use Ded to eliminate second td field when it is equal to the first td field. The expression [ 1 ] includes Dl suffix operator (suffix starts from zero). The expression { } is the null value constant. Note that suffix operator can be used in the left hand of the assignment operator. The expression FIELD td [ 1 ] = { } means to delete the second td field.

The last part is Via CSV method explained in Simple table reading section. Before that, we must combine the field name part (tmp2.d) and the value part (tmp0.d, after the second row).

(6-16)

Dselect seq:n GT 2 tmp0.d | \          Output
Dcat tmp2.d - | \                      Output
Dbundle seq | \                        Output
Dproj "^seq" | \                       Output
DtoLine | \                            Output
DfromCsv -t "TAB" > HTML-table-3.d

For the first Dselect, seq:n means numeric value of the field seq. Unless this numeric flag, value "10" is not selected. Dcat appends the selection result to the file tmp2.d Dbundle restores the row unit D-record with grouping same seq value D-records. The input record from tmp2.d has two seq fields. But it does not matter for Dbundle. Anyway, seq field is dropped by the next Dproj step.

In this example we use "tab separated" CSV (or TSV) file. This is default of DtoLine. The last step DfromCsv reads this file with -t "TAB" option. Here, TAB denotes the control character TAB. Depending on your environment (terminal program, tty settings and shell program), you may or may not input control character TAB directly. It is beyond this tutorial to teach how control characters can be typed in command lines. But, in some environment, pushing control+V key before TAB key wors. In some other environment, control+I can be used as TAB. Note that if your data contains control character TAB in it, you have to quote them with -z q option in DtoLine of (6-16).

6.3.2 Method two

This method starts from tmp0.d file of the method one. We will make slightly different representation of tmp0.d for better readabilty. It has 6x8 records with column (1..6), row (1..8) and value fields (tmp3.d).

(6-17)

Drename seq:row,td:value tmp0.d | \      Output
Dcat -g row -n | \                       Output
Drename seq:column > tmp3.d

The second step Dcat has option -g row -n. With these options, seq field is added for each group of row value. It represents the column number (1..6). The revised tmp0.d is stored in tmp3.d. You can easily see that tmp3.d is another representation of same table (6-14) with column, row, value triple.

(6-18)

Dselect column:n LE 2 AND row NE 2 tmp3.d | \          Output
Dproj "^column" | \                                    Output Note 2
Dbundle row | \                                        Output
Ded IF row == 1 THEN FIELD row = CONST row FI | \      Output Note 3
DtoLine -t , -z q | \                                  Output
DfromCsv > tmp4.d

Note 2: In most shells ^column may not be quoted.
Note 3: Both FIELD and CONST may be omitted, as by Dl specification, they are the default after THEN and = operator. But, row = row is confusing enough. It is good idea not to omit these keywords whenever there may be questions.

From tmp3.d, we make row labels table in tmp4.d, using the "via CSV" method. In the first step, we extract column one and two of tmp3.d excluding the second row, because it is just a duplication of the first row. We drop column field, and Dbundle it by row field to use via CSV method. In this output, row field, which will become the first column of coming CSV file, has the row value of the original tmp3.d. In the first record, the value of row field is "1". This value will become the first field name of tmp4.d. It is ok, but field name 1 is a bit strange. For the following procedure's convenience, we change it to a field name used in the following procedure row using Ded and apply via CSV method.

(6-19)

Dselect row:n LE 2 AND column:n GT 2 tmp3.d | \                 Output
Ded IF row == 1 THEN FIELDS = FIELDS S "^value:" BY "place:" \
    ELSE FIELDS = FIELDS S "^value:" BY "property:" FI | \      Output
Dproj "^row" | \                                                Output
Dsort column:n | \                                              Output
Dbundle column:n > tmp5.d

Again from tmp3.d, we make column labels table in tmp5.d. The first step extracts the row 1 and 2 excluding the column 1 and 2. Next Ded renames value field to place for the first row, and to property for the second row. (See Renaming the fields for the detail). Next, we drop row field which is no more used, and bundle the records for each column value. As the records comes not with column value order, we have to use Dsort before Dbundle.

(6-20)

Dselect row:n GT 2 AND column:n GT 2 tmp3.d | \      Output
Djoin -c row - tmp4.d | \                            Output
Djoin -c column - tmp5.d | \                         Output
Dproj "^row,column" | \                              Output
Dorder "^value" > HTML-table-3a.d

The last part is to combine the body part with labels generated in the previous parts. Dselect extracts the body part from tmp3.d. The first Djoin brings in year and month fields with row as the key value. The option -c tells Djoin to do "on core" matching. Without this option, Djoin expects both input file to be sorted by the key field value order and stops when the sequence is unordered. In this example, you may omit -c option, but then will need key flag :n if there are more than nine rows.

The second Djoin brings in place and property fields with column as the key value. In this case, the option -c is mandatory, because the input is not sorted by column field order. The key may be column:n, but it makes no difference, in this case. The last two steps are just for "brush up", to drop unnecessary field, and to change the field order. In the output from the Dproj, value field comes the first. Dorder changes the field order of each input record. The parameter "^value" tells fields other than value to come first.

6.4 Locating your table, or How to write xpath parameter

In the previous examples, we handled only one table in an HTML document. We used only -p //tr, for the DfromHtml, and it worked well. But, real HTML documents often have more than one tables in a document. In these cases, we have to provide xpath expression beyond simple //tr with the -p option.

6.4.1 Two or more tables

For example this document (D_tutorial.html) has several tables. How to find HTML-table-1 among them? Try next command:

(6-21)

DfromHtml -p //table D_tutorial.html | Dpr -p node

It lists something like next one:

(6-21 output)

rec# node
   1 /html/body/div[1]/blockquote[1]/table
   2 /html/body/div[2]/blockquote[1]/table
   3 /html/body/div[2]/blockquote[2]/table
   4 /html/body/div[3]/div[1]/blockquote/table
   5 /html/body/div[3]/div[2]/blockquote[1]/table
   6 /html/body/div[3]/div[3]/blockquote[1]/table
   7 /html/body/div[3]/div[3]/div[1]/blockquote[2]/table
   8 /html/body/div[6]/blockquote/table
   9 /html/body/div[8]/blockquote/table

Note: This output is from an early version of this tutorial and is not same as the output from the current version.

Xpath expression //table means any <table> element. The output (6-21 output) is an list of xpath expression of <table> elements in the HTML file of this document. There are nine <table> elements in this file. The first node value can be read as "the <table> element in the first <blockquote> element in the first <div> element in the <body> element in the <html> element".

Question is "Which one of these tables is HTML-table-1?" You can not answer only from this list. Other fields of the output from DfromHtml help you to find the requested one. Try next command.

(6-22)

DfromHtml -p //table D_tutorial.html | Dextract 1

It will produce something like next list.

(6-22 output)

node:/html/body/div[1]/blockquote[1]/table
@border:1
@id:gs-supplyCsv
caption:supply.csv
tbody:s#p#j#shipdatequantity11170,1,1220011470,...1,1240056470,2,5500

Note: This is only for the first record. tbody field is curtailed because the full list will be too long.

In this case, you find caption, tbody and attribute fields @id and @border. From this you will know that you can select from caption field.

(6-23)

DfromHtml -p //table D_tutorial.html | Dselect caption == "HTML-table-1"

This should be basically ok. But caption == "HTML-table-1" selection may fail in other files. Because the caption field may have extra spaces in its value. This is caused by nature of HTML (or XML). Besides it, many HTML tables lack <caption> element. Table titles may be represented in other way. In general, caption field is not reliable key for finding the required table.

But, at least, you know the table contents. You know HTML-table-1 has value FRANCE and GERMANY in it. Try next command.

(6-24)

DfromHtml -p //table D_tutorial.html | \
Dgrep -e "FRANCE" -e "GERMANY" | Dpr -p node

Dgrep selects D-records having pattern given with -e option(s) anywhere in the record. When two or more -e options are given, records matching all of the given patterns are selected. The above Dgrep command selects the record having both FRANCE and GERMANY in it. It will list the xpath expression of HTML-table-1 element like:

(6-24 output)

rec# node
   1 /html/body/div[3]/div[1]/blockquote/table

Now, you know the table element is addressed as /html/body/div[3]/div[1]/blockquote/table. The DfromHtml command to extract data from this table is:

(6-25)

DfromHtml -p /html/body/div[3]/div[1]/blockquote/table//tr

Add //tr to the table element xpath expression. This means "any <tr> element under this table element". You may add /tbody/tr, which means "any <tr> elements directly under <tbody> element, which is directly under this table element". But, as tbody element may be omitted in some HTML files, using //tr is better solution.

Next question is "What shall I do when the Dgrep fails to select unique table and reports two or more tables?". The answer is simple: "Try adding -e options until the output becomes unique".

6.4.2 Nested tables

See the sample homepage (source HTML). At a glance, you see two tables ("Some frequently used D commands" and "Version history of D") in this page. Let's try to locate the second table ("Version history of D") having Version 2.5 and Jul 10, 2008 in it.

(6-26)

DfromHtml -p //table sample-homepage.html | \
Dgrep -e "Version 2.5" -e "Jul 10, 2008" | \
Dpr -p node

This command produces something like next output:

(6-26 output)

rec# node
   1 /html/body/div/table
   2 /html/body/div/table/tbody/tr[2]/td[2]/div/div[2]/table

There are two tables having Version 2.5 and Jul 10, 2008, Moreover, addition of condition in Dgrep (e.g., -e "Version 2.4") will not cause unique table output, because the second table is included in the first table. Look at the node value carefully.

First four "steps" (unit delimited by "/") of the second node are identical with the first node. That means the second table is included in the first one. The last six steps of the second node tells that the table is in the second column (td[2]) of the second row (tr[2]) of the first table's <tbody>.

Actually, there are three <table> elements in sample-homepage.html. The first table listed in (6-26 output) is invisible. It is a kind of "container" to layout the top part (D-icon and "Data Processing Utitlity"), the lower left part ("Downloads" etc.) and the lower right part ("What is D?" and two visible tables). As this invisible table contains all the contents, any Dgrep will select this table (unless there is no result). Suchlike "layout usage" of <table> element is widely spread in the real world web pages ( though it is discouraged by W3C standards).

Anyway, once you locate the second node as your target table, the rest is same as the previous procedures. Use :

(6-27)

DfromHtml -p /html/body/div/table/tbody/tr[2]/td[2]/div/div[2]/table//tr

as mentioned in the previous section.

7. Miscellaneous topics

In this section, D-commands not used in the previous sections (thus, less frequently used) are briefly introduced.

7.1 Dhead and Dtail

Dhead is rarely used D-commnad, because it can be substituted by Dextract. Dtail is a little more used, because you can extract last N records even in case you don't know the total number of records.

Next example extracts from the third last to the second last D-record.

(7-1)

Dtail -3 input-file | Dhead -2

7.2 DtoCsv

DtoCsv, naturally, converts D-files into a CSV file. It is a reverse conversion of DfromCsv mentioned in 1.3.

In many cases, DtoLine is enough to hand D-records to other applications. The advantage of DtoCsv is mostly in automatic header line creation.

Note that specification of "CSV" file is not standardized universally. Interpretation depends on the application. Csv/tsv files produced by this program, usually, are accepted by major applications. But, there may be some cases, they are not properly converted.

The following command produces a "TSV" file of supply.d

(7-2)

DtoCsv -t "TAB" supply.d

You may need special key sequence to input TAB control character. See paragraphs after (6-16).

7.3 DfromXml

DfromXml is almost same program as DfromHtml. As XML is better structured than HTML and many tools are available, it is not so often that you need to use DfromXml.

The most prominent difference between DfromXml from DfromHtml is namespace. The manual describes the detail. Usually, you use the default prefix D: and/or the implicit binding.

The first example is about the default namespace. This tutorial itself is written in XHTML, which is an XML document with the default namespace as HTML (http://www.w3.org/1999/xhtml). The listing of <h2> elements under the <body><div> level can be obtained by:

(7-3)

DfromHtml -p /html/body/div/h2 D_tutorial.html | Dpr

The output will be:

(7-3 output)

rec# node                  text
   1 /html/body/div[1]/h2  CONTENTS
   2 /html/body/div[2]/h2  1. Getting started
   3 /html/body/div[3]/h2  2. Creation and validation of D-files
   4 /html/body/div[4]/h2  3. When a field repeats
   5 /html/body/div[5]/h2  4. Renaming the fields
   6 /html/body/div[6]/h2  5. Row-column transposition
   7 /html/body/div[7]/h2  6. HTML table reading
   8 /html/body/div[8]/h2  7. Miscellaneous topics
   9 /html/body/div[9]/h2  Appendix A. D-command index
  10 /html/body/div[10]/h2 Appendix B: Data views

Note: This output is from a certain version of this tutorial, and man not be same as the output from current version.

The document is also an XML document. You may think the command (7-3) works just by changing DfromHtml to DfromXml. But, it will fail.

In the XHTML document, <html> tag has default name space declaration like <html xmlns="http://www.w3.org/1999/xhtml" >. DfromXml gives prefix D: for the default name space. You can use this prefix with (7-3).

(7-4)

DfromXml -p /D:html/D:body/D:div/D:h2 D_tutorial.html | Dpr

The output will be the following.

(7-4 output)

rec# node               text
   1 /*/*[2]/*[4]/*[1]  CONTENTS
   2 /*/*[2]/*[5]/*[1]  1. Getting started
   3 /*/*[2]/*[6]/*[2]  2. Creation and validation of D-files
   4 /*/*[2]/*[7]/*[2]  3. When a field repeats
   5 /*/*[2]/*[8]/*[2]  4. Renaming the fields
   6 /*/*[2]/*[9]/*[2]  5. Row-column transposition
   7 /*/*[2]/*[10]/*[2] 6. HTML table reading
   8 /*/*[2]/*[11]/*[1] 7. Miscellaneous topics
   9 /*/*[2]/*[12]/*[2] Appendix A. D-command index
  10 /*/*[2]/*[13]/*[2] Appendix B: Data views

In this output, node value has ASTERISK (*) instead of tag names. When name spaces are used, libxml2 processor returns these form node names, because it does not know what prefix is used in the external world (in this case DfromXml).

The second example -- implicit binding is more simple. See the next XML document, in a file document.xml, which is the main part of ".docx" document.

(7-5)

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<w:document
  xmlns:wp="http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing"
  xmlns:w10="urn:schemas-microsoft-com:office:word"
  xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main"
  xmlns:v="urn:schemas-microsoft-com:vml"
  xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships"
  xmlns:o="urn:schemas-microsoft-com:office:office">
  <w:body>
    <w:p>
      <w:pPr>
        <w:pStyle w:val="style0"/>
      </w:pPr>
      <w:r>
        <w:rPr/>
        <w:t>Test</w:t>
      </w:r>
    </w:p>
     
  </w:body>
</w:document>

There are many name space declaration, but actually used is only w: prefix. You can use this prefix w: to extract actual text.

(7-6)

DfromXml -p //w:t document.xml

The output will be the following.

(7-6 output)

node:/w:document/w:body/w:p/w:r/w:t
text:Test

Naturally, default name space prefix D: and inplicit name space binding has some limitations. See the manual for the detail.

7.4 DtoTex

TeX is being out of fassion. It is still useful in some fields. DtoTex provides a way to typeset data through TeX using TeX macro mechanism.

By default, D-field name is used as a TeX macro name. You have to write TeX macro definition correspoinding to the D-fields. See the next command.

(7-7)

DtoTex schumann-op14a.d

The output will be thw following.

(7-7 output)

\op 14a
\date 1836
\title Sonate No.3
\atitle Grosse Sonate
\atitle Concert ohne Orchester
\version Erste Ausgabe
\category keyboard
\instrumentation piano
\pub 1836
\part 1
\tempo Allegro brillante
\key f
\part 2
\ptitle Quasi variazioni
\tempo Andantino de Clara Wieck
\key f
\part 3
\tempo Prestissimo possibile
\key f

TeX special characters in the values are escaped automatially, or you may keep them with -n field list. You need your macro definition to typeset this output. It is beyond the scope of this document.

7.5 Making D-command index (Appendix A)

The following procedure produces the Annex A (D-command index) from the HTML file of this document. The actual procedure the author used is slightly different from (7-8), but essential procedures are same. This procedure depends greatly on the conventions the author used in this document, (e.g., commmand examples are blockquoted and example numbers are written with <em> tag with "expno" class), these commands, nevertheless, show many useful examples.

(7-8)

① DfromHtml -p //blockquote/p/em[@class=\"expno\"]/../.. D_tutorial.html  | \
② Ded IF EXISTS blockquote THEN FIELD blockquote = { } ';'  \
    @id [ 1 ] = { } FI ';'  \
    @id = CONST "#" . FIELD @id ';'  \
    expno = FIELD p [ 0 ] ';'  \
    FIELD p [ 0 ] = { }  | \
③ Dproj @id,expno,p  | \
④ Dunbundle p  | \
⑤ Dselect p LIKE "^D" AND @id UNLIKE CONST _  | \
⑥ Duntie p "command:@^D[a-z]+[A-Za-z]*@*"  | \
⑦ Dunbundle command  | \
⑧ Dsort command  | \
⑨ Dbundle command,@id,expno  | \
⑩ Dorder command,@id,expno  | \
⑪ Dbundle command  | \
⑫ Dtie '@id://:<a href="%ls">,expno::%ls</a>' td  | \
⑬ Dpack -t " " td  | \
⑭ Drename command:td  | \
⑮ DtoXml -o table -f tbody -r tr -n td

① The first DfromHtml selects <em> nodes with the attribute class="expno" under a <p> element under a <blockquote> element, and makes D-records with its grandparent (thus <blockquote>) node. Note that REVERSE SOLIDUS (\) is required to pass QUOTATION MARK (") to Xpath.

② does some preparative processes. If the D-record has blockquote field, that means the second level <blockquote> is used in it. By convention they are notes within the example and should be eliminated with the @id associated to the note. Then, @id should be only one. NUMBER SIGN (#) is added to @id to use the value as a hyper link. The first paragraph is, by convention, the example number. Rename it as expno, and remove itself from paragraphs.

③ removes fields not used in the following processes.

At this point, the D-records may have more than one paragraphs (p fields) as in (3-5). ④ unbundles them and makes one paragraph per one D-record.

⑤ excludes unnecessary records. D-command example paragraph starts always with a LATIN CAPITAL LETTER D. In addition, examples like (1-2 output) are eliminated.

⑥ extracts D-command names from the paragraph. @STRING@ format with Repeat (*) option can extract words mathced to the pattern from a line.

⑦ unbundles command field, so that the result record is a triplet having @id, command and expno.

⑧ and ⑨ is "uniq" operation to eliminate duplication. The result of ⑦ has duplications if the same command is used more than one time in a same example.

From this point we start to construct HTML table output by ⑮ DtoXml. ⑩ is to change the field order for the convenience of the following procedures.

The output record of ⑪ has a command field and one or more pairs of @id and expno field. The sequence of these leaf pairs reserves the sequence in the input file, Dsort in ⑧ keeps the input record order, unless specified by the sort key specification.

⑫ makes a field td from a pair of @id and expno field. The result value is, for example, <a href="#n-1-1">(1-1)</a>

⑬ makes repeating td fields into one. ⑭ renames the field command to td, so that a D-record has only two td fields, of which first one has the command name as the value, and the second one has HTML formatted example number list.

The last step ⑮ constructs HTML <table> tags using one D-record as a <tr>. Note that td field must be listed with -n option, because it is already in HTML representation.


Appendix A. D-command index

Dbundle(1-14) (1-25) (1-27) (1-28) (1-29) (1-31) (1-32) (1-36) (1-37) (3-5) (3-8) (3-12) (3-22) (3-23) (3-24) (3-25) (3-26) (3-28) (3-29) (3-30) (3-36) (5-4) (6-16) (6-18) (6-19) (7-8)
Dcat(3-11) (3-20) (4-3) (6-13) (6-16) (6-17)
Dcompose(5-3) (6-3) (6-9)
Ddecompose(5-3) (6-9)
Ded(1-38) (1-39) (2-21) (4-4) (4-5) (6-2) (6-13) (6-15) (6-18) (6-19) (7-8)
Dextract(1-18) (6-2) (6-9) (6-22)
Dfd(1-3) (3-21b)
Dfdp(2-1) (2-7) (2-10) (3-21a)
Dfill(6-3)
Dfreq(1-11) (1-12) (1-20) (1-21) (1-22) (1-23) (1-24) (1-26) (1-28) (1-29) (1-30) (1-31) (1-32) (1-33) (1-36) (2-11)
DfromChunk(2-17) (2-19)
DfromCsv(1-10) (6-5) (6-7) (6-16) (6-18)
DfromHtml(6-2) (6-3) (6-5) (6-7) (6-9) (6-13) (6-21) (6-22) (6-23) (6-24) (6-25) (6-26) (6-27) (7-3) (7-8)
DfromLine(1-5) (1-7) (1-40) (2-6) (2-7) (2-8) (2-9) (2-10) (2-11) (2-14) (2-15)
DfromXml(7-4) (7-6)
Dgrep(6-24) (6-26)
Dhead(7-1)
Djoin(1-21) (1-22) (1-23) (1-24) (1-27) (1-28) (1-29) (1-30) (1-31) (1-32) (3-5) (3-9) (3-10) (3-12) (3-23) (3-24) (3-25) (3-26) (3-27) (6-9) (6-20)
Dmax(1-34)
Dmeans(1-35)
Dorder(3-11) (3-23) (3-24) (3-25) (3-29) (3-30) (3-37) (5-4) (6-20) (7-8)
Dpack(6-15) (7-8)
Dpaste(6-15)
Dpr(1-2) (1-3) (1-8) (1-12) (2-11) (2-21) (3-21b) (3-22) (3-23) (3-24) (3-25) (3-26) (3-29) (6-21) (6-24) (6-26) (7-3) (7-4)
Dproj(1-11) (1-13) (1-14) (1-15) (1-16) (1-17) (1-18) (1-19) (1-20) (1-21) (1-22) (1-23) (1-24) (1-25) (1-26) (1-27) (1-28) (1-29) (1-30) (1-31) (1-32) (1-33) (1-34) (1-35) (1-36) (1-37) (3-3) (3-11) (3-12) (3-28) (6-2) (6-3) (6-5) (6-7) (6-9) (6-13) (6-16) (6-18) (6-19) (6-20) (7-8)
Drc(1-33)
Drder(3-26) (3-36)
Drename(1-31) (3-11) (3-36) (3-37) (4-2) (4-3) (5-3) (6-3) (6-8) (6-9) (6-13) (6-17) (7-8)
Dselect(1-15) (1-16) (1-17) (1-18) (1-19) (1-20) (1-21) (1-22) (1-23) (1-24) (1-25) (1-26) (1-27) (1-28) (1-29) (1-31) (1-32) (1-33) (1-36) (2-2) (2-3) (2-5) (2-8) (2-11) (3-13) (3-22) (3-23) (3-24) (3-25) (4-3) (6-3) (6-15) (6-16) (6-18) (6-19) (6-20) (6-23) (7-8)
Dsort(1-14) (1-17) (1-25) (1-27) (1-35) (1-37) (3-12) (3-22) (3-23) (3-24) (3-25) (3-26) (3-28) (3-29) (3-30) (3-36) (3-37) (5-3) (5-4) (6-13) (6-19) (7-8)
Dtail(7-1)
Dtie(3-16) (3-18) (3-19) (5-4) (7-8)
DtoCsv(7-2)
DtoLine(6-5) (6-7) (6-16) (6-18)
DtoTex(7-7)
DtoXml(3-34) (3-36) (3-37) (7-8)
Dunbundle(1-25) (2-11) (3-3) (3-11) (3-31) (3-32) (5-4) (6-3) (6-13) (7-8)
Dunpack(5-4)
Duntie(5-4) (7-8)
Dupdate(1-40)

Appendix B: Data views

B.1.1 supply.d (1-10) in 1.4.1

            supply.d

rec# s# p# j# shipdate quantity
   1  1  1  1 70,1,12       200
   2  1  1  4 70,1,12       700
   3  2  3  1 70,1,17       400
   4  2  3  2 70,1,17       200
   5  2  3  3 70,1,17       200
   6  2  3  4 70,1,17       500
   7  2  3  5 70,1,17       600
   8  2  3  6 70,1,17       400
   9  2  3  7 70,1,17       800
  10  2  5  2 69,12,19      100
  11  3  3  1 70,2,2        200
  12  3  4  2 70,2,10       500
  13  4  6  3 70,1,31       300
  14  4  6  7 70,1,31       300
  15  5  2  2 70,1,23       200
  16  5  2  4 70,1,23       100
  17  5  3  7 70,1,31       100
  18  5  5  5 70,1,12       500
  19  5  5  7 70,1,12       100
  20  5  6  2 70,1,16       200
  21  5  1  4 70,2,9        100
  22  5  3  4 70,1,14       200
  23  5  4  4 70,1,24       800
  24  5  5  4 70,1,12       400
  25  5  6  4 70,2,5        500


B.2.1 supply-handmade.d in 2.1

s#:1
p#:1
j#:1
shipdate:70,1,12
quantity:200

s#:1
p#:1
j#:4
shipdate:70,1,12
quantity:700

s#:2
p#:3
j#:1
shipdate:70,1,17
quantity:400

s#:2
p#:3
j#:2
shipdata:70,1,17
quantity:200

s#:2
p#:3
j#:3
shipdate:70,1,17
quantity:200

s#:2
p#:3
j#:4
shipdate:70,1,17
quantity:500

s#:2
p#:3
j#:5
shipdate:70,1,17
quantity:600

s#:2
p#:3
j#:6
shipdate:70,1,17
quantity:400

s#:2
p#:3
j#:7
shipdate:70,1,17
quantity:800

s#:2
p#:5
j#:2
shipdate:69,12,19
quantity:1.3

s#:3
p#:3
j#:1
shipdate:70,2,2
quantity:200

s#:3
p#:4
j#:2
shipdate:70,2,10
quantity:500

s#:4
p#:6
j#:3
shipdate:70,1,31
quantity:300

s#:4
p#:6
j#:7
shipdate:70,1,31
quantity:300

s#:5
p#:2
j#:2
shipdate:70,1,23
quantity:200

s#:5
p#:2
j#:4
shipdate:70,1,23
quantity:100

s#:5
p#:3
j#:7
shipdate:70,1,31
quantity:100

s#:5
p#:5
j#:5
shipdate:70,1,12
quantity:500

s#:5
p#:5
j#:7
shipdate:70,1,12
quantity:100

s#:5
p#:6
j#:2
shipdate:70,1,16
quantity:200

s#:5
p#:1
j#:4
shipdate:70,2,29
quantity:100

s#:5
p#:3
j#:4
shipdate:70,1,14
quantity:200

s#:5
p#:4
j#:4
shipdate:70,1,24
quantity:800

s#:5
p#:5
j#:4
shipdate:70,1,12
quantity:400

s#:5
p#:6
j#:4
shipdate:70,2,5
quantity:500


B.2.2 websmpl.log in 2.2

223.98.45.100 - - [17/Oct/2002:15:19:11 +0900] "GET /cgi-bin/p03?id=A0027061 HTTP/1.0" 200 1305 4
109.151.249.228 - - [17/Oct/2002:15:19:11 +0900] "POST /cgi-bin/p02 HTTP/1.0" 200 1010 1
62.180.146.66 - - [17/Oct/2002:15:19:11 +0900] "GET /cgi-bin/p03?id=F1159172 HTTP/1.1" 200 3055 4
149.223.26.62 - - [17/Oct/2002:15:19:12 +0900] "GET /cgi-bin/p03?id=B4015628 HTTP/1.0" 200 1161 4
149.79.144.225 - - [17/Oct/2002:15:19:12 +0900] "GET /cgi-bin/p03?id=J0630286 HTTP/1.1" 200 1670 4
247.182.195.102 - - [17/Oct/2002:15:19:12 +0900] "GET / HTTP/1.1" 304 - 0
247.25.64.162 - - [17/Oct/2002:15:19:12 +0900] "GET /cgi-bin/p03?id=B4903411\" HTTP/1.1" 200 7217 12
62.77.228.32 - - [17/Oct/2002:15:19:13 +0900] "POST /cgi-bin/p02 HTTP/1.1" 200 979 2


B.2.3 Output from (2-15) in 2.3

num:223
num:98
num:45
num:100
num:17
num:2002
num:15
num:19
num:11
num:0900
num:03
num:0027061
num:1
num:0
num:200
num:1305
num:4

num:109
num:151
num:249
num:228
num:17
num:2002
num:15
num:19
num:11
num:0900
num:02
num:1
num:0
num:200
num:1010
num:1

num:62
num:180
num:146
num:66
num:17
num:2002
num:15
num:19
num:11
num:0900
num:03
num:1159172
num:1
num:1
num:200
num:3055
num:4

num:149
num:223
num:26
num:62
num:17
num:2002
num:15
num:19
num:12
num:0900
num:03
num:4015628
num:1
num:0
num:200
num:1161
num:4

num:149
num:79
num:144
num:225
num:17
num:2002
num:15
num:19
num:12
num:0900
num:03
num:0630286
num:1
num:1
num:200
num:1670
num:4

num:247
num:182
num:195
num:102
num:17
num:2002
num:15
num:19
num:12
num:0900
num:1
num:1
num:304
num:0

num:247
num:25
num:64
num:162
num:17
num:2002
num:15
num:19
num:12
num:0900
num:03
num:4903411
num:1
num:1
num:200
num:7217
num:12

num:62
num:77
num:228
num:32
num:17
num:2002
num:15
num:19
num:13
num:0900
num:02
num:1
num:1
num:200
num:979
num:2


B.2.4 mbox (2-19) in 2.4.2

From miyazawa@somewhere.jp  Fri Mar  1 20:10:48 2013
Return-Path: <miyazawa@somewhere.jp>
X-Original-To: miyazawa@elsewhere.jp
Delivered-To: miyazawa@elsewhere.jp
Received: from mailhost.somewhere.jp (mailhost.somewhere.jp [123.456.7.8])
by elsewhere.jp (Postfix) with ESMTP id 2B60D381428
for <miyazawa@elsewhere.jp>; Fri,  1 Mar 2013 20:10:48 +0900 (JST)
Received: from [123.456.45.43] (123.456.45.43 [123.456.45.43])
by mailhost.somewhere.jp (deepsmtpd.so 3.7.0)
with ESMTP id <61309CB0.50000@somewhere.jp>
for <miyazawa@elsewhere.jp>; Fri, 1 Mar 2013 20:10:40 +0900
Message-ID: <61309CB0.50000@somewhere.jp>
Date: Fri, 01 Mar 2013 20:10:40 +0900
From: MIYAZAWA Akira <miyazawa@somewhere.jp>
User-Agent: Mozilla/5.0 (X11; U; Linux i686; ja; rv:1.9.2.17) Gecko/20110414 SUSE/3.1.10 Thunderbird/3.1.10
MIME-Version: 1.0
To: miyazawa@elsewhere.jp
Subject: TEST mail
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
X-IP: 123.456.45.43
X-FROM-DOMAIN: somewhere.jp
X-FROM-EMAIL: miyazawa@somewhere.jp
Status: RO

HELLO WORLD!
THIS IS A SAMPLE MAIL BODY

From miyazawa@elsewhere.jp  Fri Mar  1 20:12:47 2013
Return-Path: <miyazawa@elsewhere.jp>
X-Original-To: miyazawa@elsewhere.jp
Delivered-To: miyazawa@elsewhere.jp
Received: by elsewhere.jp (Postfix, from userid 2508)
id 0A24638147A; Fri,  1 Mar 2013 20:12:47 +0900 (JST)
Date: Fri, 01 Mar 2013 20:12:47 +0900
To: miyazawa@somewhere.jp, miyazawa@elsewhere.jp
Subject: Re: TEST mail
References: <61309CB0.50000@somewhere.jp>
In-Reply-To: <61309CB0.50000@somewhere.jp>
User-Agent: Heirloom mailx 12.2 01/07/07
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Message-Id: <20130301111247.0A24638147A@elsewhere.jp>
From: miyazawa@elsewhere.jp (MIYAZAWA Akira)
Status: RO

HELLO! THIS IS REPLY.

From miyazawa@somewhere.jp  Fri Mar  1 20:14:59 2013
Return-Path: <miyazawa@somewhere.jp>
X-Original-To: miyazawa@elsewhere.jp
Delivered-To: miyazawa@elsewhere.jp
Received: from mailhost.somewhere.jp (mailhost.somewhere.jp [123.456.7.4])
by elsewhere.jp (Postfix) with ESMTP id 3BD3038159A
for <miyazawa@elsewhere.jp>; Fri,  1 Mar 2013 20:14:59 +0900 (JST)
Received: from [123.456.45.43] (123.456.45.43 [123.456.45.43])
by mailhost.somewhere.jp (deepsmtpd.so 3.7.0)
with ESMTP id <61309DA9.9060704@somewhere.jp>
for <miyazawa@elsewhere.jp>; Fri, 1 Mar 2013 20:14:49 +0900
Message-ID: <61309DA9.9060704@somewhere.jp>
Date: Fri, 01 Mar 2013 20:14:49 +0900
From: MIYAZAWA Akira <miyazawa@somewhere.jp>
User-Agent: Mozilla/5.0 (X11; U; Linux i686; ja; rv:1.9.2.17) Gecko/20110414 SUSE/3.1.10 Thunderbird/3.1.10
MIME-Version: 1.0
To: miyazawa@elsewhere.jp
Subject: Fwd: TEST mail
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
X-IP: 123.456.45.43
X-FROM-DOMAIN: somewhere.jp
X-FROM-EMAIL: miyazawa@somewhere.jp
Status: RO

THIS IS A REPLY.

-------- Original Message --------
Subject: TEST mail
Date: Fri, 01 Mar 2013 20:10:40 +0900
From: MIYAZAWA Akira <miyazawa@somewhere.jp>
To: miyazawa@elsewhere.jp

HELLO WORLD!
THIS IS A SAMPLE MAIL BODY



B.2.5 Full output from (2-19) in 2.4.2

From miyazawa@somewhere.jp  Fri Mar  1 20:10:48 2013
Return-Path:<miyazawa@somewhere.jp>
X-Original-To:miyazawa@elsewhere.jp
Delivered-To:miyazawa@elsewhere.jp
Received:from mailhost.somewhere.jp (mailhost.somewhere.jp [123.456.7.8]) by elsewhere.jp (Postfix) with ESMTP id 2B60D381428 for <miyazawa@elsewhere.jp>; Fri,  1 Mar 2013 20:10:48 +0900 (JST)
Received:from [123.456.45.43] (123.456.45.43 [123.456.45.43]) by mailhost.somewhere.jp (deepsmtpd.so 3.7.0) with ESMTP id <61309CB0.50000@somewhere.jp> for <miyazawa@elsewhere.jp>; Fri, 1 Mar 2013 20:10:40 +0900
Message-ID:<61309CB0.50000@somewhere.jp>
Date:Fri, 01 Mar 2013 20:10:40 +0900
From:MIYAZAWA Akira <miyazawa@somewhere.jp>
User-Agent:Mozilla/5.0 (X11; U; Linux i686; ja; rv:1.9.2.17) Gecko/20110414 SUSE/3.1.10 Thunderbird/3.1.10
MIME-Version:1.0
To:miyazawa@elsewhere.jp
Subject:TEST mail
Content-Type:text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding:7bit
X-IP:123.456.45.43
X-FROM-DOMAIN:somewhere.jp
X-FROM-EMAIL:miyazawa@somewhere.jp
Status:RO

From miyazawa@elsewhere.jp  Fri Mar  1 20:12:47 2013
Return-Path:<miyazawa@elsewhere.jp>
X-Original-To:miyazawa@elsewhere.jp
Delivered-To:miyazawa@elsewhere.jp
Received:by elsewhere.jp (Postfix, from userid 2508) id 0A24638147A; Fri,  1 Mar 2013 20:12:47 +0900 (JST)
Date:Fri, 01 Mar 2013 20:12:47 +0900
To:miyazawa@somewhere.jp, miyazawa@elsewhere.jp
Subject:Re: TEST mail
References:<61309CB0.50000@somewhere.jp>
In-Reply-To:<61309CB0.50000@somewhere.jp>
User-Agent:Heirloom mailx 12.2 01/07/07
MIME-Version:1.0
Content-Type:text/plain; charset=us-ascii
Content-Transfer-Encoding:7bit
Message-Id:<20130301111247.0A24638147A@elsewhere.jp>
From:miyazawa@elsewhere.jp (MIYAZAWA Akira)
Status:RO

From miyazawa@somewhere.jp  Fri Mar  1 20:14:59 2013
Return-Path:<miyazawa@somewhere.jp>
X-Original-To:miyazawa@elsewhere.jp
Delivered-To:miyazawa@elsewhere.jp
Received:from mailhost.somewhere.jp (mailhost.somewhere.jp [123.456.7.4]) by elsewhere.jp (Postfix) with ESMTP id 3BD3038159A for <miyazawa@elsewhere.jp>; Fri,  1 Mar 2013 20:14:59 +0900 (JST)
Received:from [123.456.45.43] (123.456.45.43 [123.456.45.43]) by mailhost.somewhere.jp (deepsmtpd.so 3.7.0) with ESMTP id <61309DA9.9060704@somewhere.jp> for <miyazawa@elsewhere.jp>; Fri, 1 Mar 2013 20:14:49 +0900
Message-ID:<61309DA9.9060704@somewhere.jp>
Date:Fri, 01 Mar 2013 20:14:49 +0900
From:MIYAZAWA Akira <miyazawa@somewhere.jp>
User-Agent:Mozilla/5.0 (X11; U; Linux i686; ja; rv:1.9.2.17) Gecko/20110414 SUSE/3.1.10 Thunderbird/3.1.10
MIME-Version:1.0
To:miyazawa@elsewhere.jp
Subject:Fwd: TEST mail
Content-Type:text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding:7bit
X-IP:123.456.45.43
X-FROM-DOMAIN:somewhere.jp
X-FROM-EMAIL:miyazawa@somewhere.jp
Status:RO

Subject:TEST mail
Date:Fri, 01 Mar 2013 20:10:40 +0900
From:MIYAZAWA Akira <miyazawa@somewhere.jp>
To:miyazawa@elsewhere.jp


B.3.1 Output from the third Dproj of (3-3) in 3.1

title:The Godfather
year:1972
star:Marlon Brando
star:Al Pacino

title:Singin' in the Rain
year:1952
star:Gene Kelly
star:Donald O'Connor
star:Debbie Reynolds


B.3.2 director.d (3-3) in 3.1

title:The Godfather
year:1972
director:Francis Ford Coppola

title:Singin' in the Rain
year:1952
director:Stanley Donen

title:Singin' in the Rain
year:1952
director:Gene Kelly


B.3.3 writer.d (3-3) in 3.1

title:The Godfather
year:1972
writer:Mario Puzo

title:The Godfather
year:1972
writer:Francis Ford Coppola


B.3.4 star.d (3-3) in 3.1

title:The Godfather
year:1972
star:Marlon Brando

title:The Godfather
year:1972
star:Al Pacino

title:Singin' in the Rain
year:1952
star:Gene Kelly

title:Singin' in the Rain
year:1952
star:Donald O'Connor

title:Singin' in the Rain
year:1952
star:Debbie Reynolds


B.3.5 tmp-director.d (3-5) in 3.2

title:The Godfather
year:1972
director:Francis Ford Coppola

title:Singin' in the Rain
year:1952
director:Stanley Donen
director:Gene Kelly


B.3.6 tmp-writer.d (3-5) in 3.2

title:The Godfather
year:1972
writer:Mario Puzo
writer:Francis Ford Coppola


B.3.7 tmp-star.d (3-5) in 3.2

title:The Godfather
year:1972
star:Marlon Brando
star:Al Pacino

title:Singin' in the Rain
year:1952
star:Gene Kelly
star:Donald O'Connor
star:Debbie Reynolds


B.3.8 star.d sorted by star in 3.3.1

title:The Godfather
year:1972
star:Al Pacino

title:Singin' in the Rain
year:1952
star:Debbie Reynolds

title:Singin' in the Rain
year:1952
star:Donald O'Connor

title:Singin' in the Rain
year:1952
star:Gene Kelly

title:The Godfather
year:1972
star:Marlon Brando


B.3.9 Result of (3-8) in 3.3.1

title:The Godfather
year:1972
star:Al Pacino

title:Singin' in the Rain
year:1952
star:Debbie Reynolds
star:Donald O'Connor
star:Gene Kelly

title:The Godfather
year:1972
star:Marlon Brando


B.3.10 Expected output from (3-9) in 3.3.2

title:The Godfather
year:1972
writer:Mario Puzo
writer:Francis Ford Coppola
director:Francis Ford Coppola
star:Marlon Brando
star:Al Pacino

title:Singin' in the Rain
year:1952
director:Stanley Donen
director:Gene Kelly
star:Gene Kelly
star:Donald O'Connor
star:Debbie Reynolds


B.3.11 Actual output from (3-9) in 3.3.2

title:The Godfather
year:1972
writer:Mario Puzo
writer:Francis Ford Coppola
director:Francis Ford Coppola
star:Marlon Brando
star:Al Pacino


B.3.12 new-director.d (3-11) in 3.3.2

rec#:1
fld#:1
title:The Godfather
year:1972
director:Francis Ford Coppola

rec#:2
fld#:1
title:Singin' in the Rain
year:1952
director:Stanley Donen

rec#:2
fld#:2
title:Singin' in the Rain
year:1952
director:Gene Kelly


B.3.13 new-writer.d (3-11) in 3.3.2

rec#:1
fld#:1
title:The Godfather
year:1972
writer:Mario Puzo

rec#:1
fld#:2
title:The Godfather
year:1972
writer:Francis Ford Coppola


B.3.14 new-star.d (3-11) in 3.3.2

rec#:1
fld#:1
title:The Godfather
year:1972
star:Marlon Brando

rec#:1
fld#:2
title:The Godfather
year:1972
star:Al Pacino

rec#:2
fld#:1
title:Singin' in the Rain
year:1952
star:Gene Kelly

rec#:2
fld#:2
title:Singin' in the Rain
year:1952
star:Donald O'Connor

rec#:2
fld#:3
title:Singin' in the Rain
year:1952
star:Debbie Reynolds


B.3.15 new-tmp-director.d (3-12) in 3.3.2

rec#:1
title:The Godfather
year:1972
director:Francis Ford Coppola

rec#:2
title:Singin' in the Rain
year:1952
director:Stanley Donen
director:Gene Kelly


B.3.16 new-tmp-writer.d (3-12) in 3.3.2

rec#:1
title:The Godfather
year:1972
writer:Mario Puzo
writer:Francis Ford Coppola


B.3.17 new-tmp-star.d (3-12) in 3.3.2

rec#:1
title:The Godfather
year:1972
star:Marlon Brando
star:Al Pacino

rec#:2
title:Singin' in the Rain
year:1952
star:Gene Kelly
star:Donald O'Connor
star:Debbie Reynolds


B.3.18 schumann-ops.d (3-20), (3-21a), (3-21b) in 3.5

op:14a
date:1836
title:Sonate No.3
atitle:Grosse Sonate
atitle:Concert ohne Orchester
version:Erste Ausgabe
category:keyboard
instrumentation:piano
pub:1836
part:1
tempo:Allegro brillante
key:f
part:2
ptitle:Quasi variazioni
tempo:Andantino de Clara Wieck
key:f
part:3
tempo:Prestissimo possibile
key:f

op:15
date:1838
title:Kinderscenen
category:keyboard
instrumentation:piano
pub:1839
part:1
ptitle:Von fremden Landern und Menschen
key:G
part:2
ptitle:Curiose Geschichte
key:D
part:3
ptitle:Hasche-Mann
key:h
part:4
ptitle:Bittendes Kind
key:D
part:5
ptitle:Glückes genug
key:D
part:6
ptitle:Wichtige Begebenheit
key:A
part:7
ptitle:Träumerei
key:F
part:8
ptitle:Am Camin
key:F
part:9
ptitle:Ritter vom Steckenpferd
key:C
part:10
ptitle:Fast zu ernst
key:gis
part:11
ptitle:Fürchtenmachen
key:G
part:12
ptitle:Kind im Einschlummern
key:e
part:13
ptitle:Der Dichter spricht
key:G


B.3.19 Output from (3-25) in 3.7

rec# j# p# pname color weight qoh s# sname loc    shipdate quantity
   1  4  1 Nut   Red       12  30  1 Smith London 70,1,12       700
                                   5 Adams Athens 70,2,9        100
   2  4  2 Bolt  Green     17  60  5 Adams Athens 70,1,23       100
   3  4  3 Screw Blue      17  30  2 Jones Paris  70,1,17       500
                                   5 Adams Athens 70,1,14       200
   4  4  4 Screw Red       14  10  5 Adams Athens 70,1,24       800
   5  4  5 Cam   Blue      12  20  5 Adams Athens 70,1,12       400
   6  4  6 Cog   Red       19  40  5 Adams Athens 70,2,5        500


B.3.20 Output from (3-26) in 3.7

                                      j#:1
                                  jname:Sorter
                                 mgr_e#:640028

rec# p# pname color weight qoh s# sname loc    shipdate quantity
   1  1 Nut   Red       12  30  1 Smith London 70,1,12       200
   2  3 Screw Blue      17  30  2 Jones Paris  70,1,17       400
                                3 Blake Paris  70,2,2        200


                                      j#:2
                                  jname:Punch
                                 mgr_e#:700128

rec# p# pname color weight qoh s# sname loc    shipdate quantity
   3  2 Bolt  Green     17  60  5 Adams Athens 70,1,23       200
   4  3 Screw Blue      17  30  2 Jones Paris  70,1,17       200
   5  4 Screw Red       14  10  3 Blake Paris  70,2,10       500
   6  5 Cam   Blue      12  20  2 Jones Paris  69,12,19      100
   7  6 Cog   Red       19  40  5 Adams Athens 70,1,16       200


                                      j#:3
                                  jname:Reader
                                 mgr_e#:680096

rec# p# pname color weight qoh s# sname loc    shipdate quantity
   8  3 Screw Blue      17  30  2 Jones Paris  70,1,17       200
   9  6 Cog   Red       19  40  4 Clark London 70,1,31       300


                                      j#:4
                                 jname:Console
                                 mgr_e#:660118

rec# p# pname color weight qoh s# sname loc    shipdate quantity
  10  1 Nut   Red       12  30  1 Smith London 70,1,12       700
                                5 Adams Athens 70,2,9        100
  11  2 Bolt  Green     17  60  5 Adams Athens 70,1,23       100
  12  3 Screw Blue      17  30  2 Jones Paris  70,1,17       500
                                5 Adams Athens 70,1,14       200
  13  4 Screw Red       14  10  5 Adams Athens 70,1,24       800
  14  5 Cam   Blue      12  20  5 Adams Athens 70,1,12       400
  15  6 Cog   Red       19  40  5 Adams Athens 70,2,5        500


                                      j#:5
                                 jname:Collator
                                 mgr_e#:690002

rec# p# pname color weight qoh s# sname loc    shipdate quantity
  16  3 Screw Blue      17  30  2 Jones Paris  70,1,17       600
  17  5 Cam   Blue      12  20  5 Adams Athens 70,1,12       500


                                      j#:6
                                 jname:Terminal
                                 mgr_e#:640014

rec# p# pname color weight qoh s# sname loc   shipdate quantity
  18  3 Screw Blue      17  30  2 Jones Paris 70,1,17       400


                                      j#:7
                                   jname:tape
                                 mgr_e#:710020

rec# p# pname color weight qoh s# sname loc    shipdate quantity
  19  3 Screw Blue      17  30  2 Jones Paris  70,1,17       800
                                5 Adams Athens 70,1,31       100
  20  5 Cam   Blue      12  20  5 Adams Athens 70,1,12       100
  21  6 Cog   Red       19  40  4 Clark London 70,1,31       300


B.3.21 spj.d (3-27) in 3.8

rec# s# p# j# shipdate quantity sname loc    pname color weight qoh jname    mgr_e#
   1  1  1  1 70,1,12       200 Smith London Nut   Red       12  30 Sorter   640028
   2  1  1  4 70,1,12       700 Smith London Nut   Red       12  30 Console  660118
   3  2  3  1 70,1,17       400 Jones Paris  Screw Blue      17  30 Sorter   640028
   4  2  3  2 70,1,17       200 Jones Paris  Screw Blue      17  30 Punch    700128
   5  2  3  3 70,1,17       200 Jones Paris  Screw Blue      17  30 Reader   680096
   6  2  3  4 70,1,17       500 Jones Paris  Screw Blue      17  30 Console  660118
   7  2  3  5 70,1,17       600 Jones Paris  Screw Blue      17  30 Collator 690002
   8  2  3  6 70,1,17       400 Jones Paris  Screw Blue      17  30 Terminal 640014
   9  2  3  7 70,1,17       800 Jones Paris  Screw Blue      17  30 tape     710020
  10  2  5  2 69,12,19      100 Jones Paris  Cam   Blue      12  20 Punch    700128
  11  3  3  1 70,2,2        200 Blake Paris  Screw Blue      17  30 Sorter   640028
  12  3  4  2 70,2,10       500 Blake Paris  Screw Red       14  10 Punch    700128
  13  4  6  3 70,1,31       300 Clark London Cog   Red       19  40 Reader   680096
  14  4  6  7 70,1,31       300 Clark London Cog   Red       19  40 tape     710020
  15  5  2  2 70,1,23       200 Adams Athens Bolt  Green     17  60 Punch    700128
  16  5  2  4 70,1,23       100 Adams Athens Bolt  Green     17  60 Console  660118
  17  5  3  7 70,1,31       100 Adams Athens Screw Blue      17  30 tape     710020
  18  5  5  5 70,1,12       500 Adams Athens Cam   Blue      12  20 Collator 690002
  19  5  5  7 70,1,12       100 Adams Athens Cam   Blue      12  20 tape     710020
  20  5  6  2 70,1,16       200 Adams Athens Cog   Red       19  40 Punch    700128
  21  5  1  4 70,2,9        100 Adams Athens Nut   Red       12  30 Console  660118
  22  5  3  4 70,1,14       200 Adams Athens Screw Blue      17  30 Console  660118
  23  5  4  4 70,1,24       800 Adams Athens Screw Red       14  10 Console  660118
  24  5  5  4 70,1,12       400 Adams Athens Cam   Blue      12  20 Console  660118
  25  5  6  4 70,2,5        500 Adams Athens Cog   Red       19  40 Console  660118


B.3.22 Output from (3-29) in 3.8

                                      s#:1
                                  sname:Smith
                                   loc:London

rec# p# pname color weight qoh j# jname   mgr_e# shipdate quantity
   1  1 Nut   Red       12  30  1 Sorter  640028 70,1,12       200
                                4 Console 660118 70,1,12       700


                                      s#:2
                                  sname:Jones
                                   loc:Paris

rec# p# pname color weight qoh j# jname    mgr_e# shipdate quantity
   2  3 Screw Blue      17  30  1 Sorter   640028 70,1,17       400
                                2 Punch    700128 70,1,17       200
                                3 Reader   680096 70,1,17       200
                                4 Console  660118 70,1,17       500
                                5 Collator 690002 70,1,17       600
                                6 Terminal 640014 70,1,17       400
                                7 tape     710020 70,1,17       800
   3  5 Cam   Blue      12  20  2 Punch    700128 69,12,19      100


                                      s#:3
                                  sname:Blake
                                   loc:Paris

rec# p# pname color weight qoh j# jname  mgr_e# shipdate quantity
   4  3 Screw Blue      17  30  1 Sorter 640028 70,2,2        200
   5  4 Screw Red       14  10  2 Punch  700128 70,2,10       500


                                      s#:4
                                  sname:Clark
                                   loc:London

rec# p# pname color weight qoh j# jname  mgr_e# shipdate quantity
   6  6 Cog   Red       19  40  3 Reader 680096 70,1,31       300
                                7 tape   710020 70,1,31       300


                                      s#:5
                                  sname:Adams
                                   loc:Athens

rec# p# pname color weight qoh j# jname    mgr_e# shipdate quantity
   7  1 Nut   Red       12  30  4 Console  660118 70,2,9        100
   8  2 Bolt  Green     17  60  2 Punch    700128 70,1,23       200
                                4 Console  660118 70,1,23       100
   9  3 Screw Blue      17  30  4 Console  660118 70,1,14       200
                                7 tape     710020 70,1,31       100
  10  4 Screw Red       14  10  4 Console  660118 70,1,24       800
  11  5 Cam   Blue      12  20  4 Console  660118 70,1,12       400
                                5 Collator 690002 70,1,12       500
                                7 tape     710020 70,1,12       100
  12  6 Cog   Red       19  40  2 Punch    700128 70,1,16       200
                                4 Console  660118 70,2,5        500


B.3.23 3-level.d: output from (3-30) in 3.8

s#:1
sname:Smith
loc:London
p#:1
pname:Nut
color:Red
weight:12
qoh:30
j#:1
jname:Sorter
mgr_e#:640028
shipdate:70,1,12
quantity:200
j#:4
jname:Console
mgr_e#:660118
shipdate:70,1,12
quantity:700

s#:2
sname:Jones
loc:Paris
p#:3
pname:Screw
color:Blue
weight:17
qoh:30
j#:1
jname:Sorter
mgr_e#:640028
shipdate:70,1,17
quantity:400
j#:2
jname:Punch
mgr_e#:700128
shipdate:70,1,17
quantity:200
j#:3
jname:Reader
mgr_e#:680096
shipdate:70,1,17
quantity:200
j#:4
jname:Console
mgr_e#:660118
shipdate:70,1,17
quantity:500
j#:5
jname:Collator
mgr_e#:690002
shipdate:70,1,17
quantity:600
j#:6
jname:Terminal
mgr_e#:640014
shipdate:70,1,17
quantity:400
j#:7
jname:tape
mgr_e#:710020
shipdate:70,1,17
quantity:800
p#:5
pname:Cam
color:Blue
weight:12
qoh:20
j#:2
jname:Punch
mgr_e#:700128
shipdate:69,12,19
quantity:100

s#:3
sname:Blake
loc:Paris
p#:3
pname:Screw
color:Blue
weight:17
qoh:30
j#:1
jname:Sorter
mgr_e#:640028
shipdate:70,2,2
quantity:200
p#:4
pname:Screw
color:Red
weight:14
qoh:10
j#:2
jname:Punch
mgr_e#:700128
shipdate:70,2,10
quantity:500

s#:4
sname:Clark
loc:London
p#:6
pname:Cog
color:Red
weight:19
qoh:40
j#:3
jname:Reader
mgr_e#:680096
shipdate:70,1,31
quantity:300
j#:7
jname:tape
mgr_e#:710020
shipdate:70,1,31
quantity:300

s#:5
sname:Adams
loc:Athens
p#:1
pname:Nut
color:Red
weight:12
qoh:30
j#:4
jname:Console
mgr_e#:660118
shipdate:70,2,9
quantity:100
p#:2
pname:Bolt
color:Green
weight:17
qoh:60
j#:2
jname:Punch
mgr_e#:700128
shipdate:70,1,23
quantity:200
j#:4
jname:Console
mgr_e#:660118
shipdate:70,1,23
quantity:100
p#:3
pname:Screw
color:Blue
weight:17
qoh:30
j#:4
jname:Console
mgr_e#:660118
shipdate:70,1,14
quantity:200
j#:7
jname:tape
mgr_e#:710020
shipdate:70,1,31
quantity:100
p#:4
pname:Screw
color:Red
weight:14
qoh:10
j#:4
jname:Console
mgr_e#:660118
shipdate:70,1,24
quantity:800
p#:5
pname:Cam
color:Blue
weight:12
qoh:20
j#:4
jname:Console
mgr_e#:660118
shipdate:70,1,12
quantity:400
j#:5
jname:Collator
mgr_e#:690002
shipdate:70,1,12
quantity:500
j#:7
jname:tape
mgr_e#:710020
shipdate:70,1,12
quantity:100
p#:6
pname:Cog
color:Red
weight:19
qoh:40
j#:2
jname:Punch
mgr_e#:700128
shipdate:70,1,16
quantity:200
j#:4
jname:Console
mgr_e#:660118
shipdate:70,2,5
quantity:500


B.3.24 Output from (3-36) in 3.9

<root>
<file>
 <group><jno>1</jno>
  <jname>Sorter</jname>
  <mgr_eno>640028</mgr_eno>
  <record>
   <pno>1</pno>
   <pname>Nut</pname>
   <color>Red</color>
   <weight>12</weight>
   <qoh>30</qoh>
   <leaf>
    <sno>1</sno>
    <sname>Smith</sname>
    <loc>London</loc>
    <shipdate>70,1,12</shipdate>
    <quantity>200</quantity>
   </leaf>
  </record>
  
  <record>
   <pno>3</pno>
   <pname>Screw</pname>
   <color>Blue</color>
   <weight>17</weight>
   <qoh>30</qoh>
   <leaf>
    <sno>2</sno>
    <sname>Jones</sname>
    <loc>Paris</loc>
    <shipdate>70,1,17</shipdate>
    <quantity>400</quantity>
   </leaf>
   <leaf>
    <sno>3</sno>
    <sname>Blake</sname>
    <loc>Paris</loc>
    <shipdate>70,2,2</shipdate>
    <quantity>200</quantity>
   </leaf>
  </record>
  
 </group>
 
 <group><jno>2</jno>
  <jname>Punch</jname>
  <mgr_eno>700128</mgr_eno>
  <record>
   <pno>2</pno>
   <pname>Bolt</pname>
   <color>Green</color>
   <weight>17</weight>
   <qoh>60</qoh>
   <leaf>
    <sno>5</sno>
    <sname>Adams</sname>
    <loc>Athens</loc>
    <shipdate>70,1,23</shipdate>
    <quantity>200</quantity>
   </leaf>
  </record>
 
  <record>
   <pno>3</pno>
   <pname>Screw</pname>
   <color>Blue</color>
   <weight>17</weight>
   <qoh>30</qoh>
   <leaf>
    <sno>2</sno>
    <sname>Jones</sname>
    <loc>Paris</loc>
    <shipdate>70,1,17</shipdate>
    <quantity>200</quantity>
   </leaf>
  </record>
 
  <record>
   <pno>4</pno>
   <pname>Screw</pname>
   <color>Red</color>
   <weight>14</weight>
   <qoh>10</qoh>
   <leaf>
    <sno>3</sno>
    <sname>Blake</sname>
    <loc>Paris</loc>
    <shipdate>70,2,10</shipdate>
    <quantity>500</quantity>
   </leaf>
  </record>
 
  <record>
   <pno>5</pno>
   <pname>Cam</pname>
   <color>Blue</color>
   <weight>12</weight>
   <qoh>20</qoh>
   <leaf>
    <sno>2</sno>
    <sname>Jones</sname>
    <loc>Paris</loc>
    <shipdate>69,12,19</shipdate>
    <quantity>100</quantity>
   </leaf>
  </record>
 
  <record>
   <pno>6</pno>
   <pname>Cog</pname>
   <color>Red</color>
   <weight>19</weight>
   <qoh>40</qoh>
   <leaf>
    <sno>5</sno>
    <sname>Adams</sname>
    <loc>Athens</loc>
    <shipdate>70,1,16</shipdate>
    <quantity>200</quantity>
   </leaf>
  </record>
 
 </group>
 
 <group><jno>3</jno>
  <jname>Reader</jname>
  <mgr_eno>680096</mgr_eno>
  <record>
   <pno>3</pno>
   <pname>Screw</pname>
   <color>Blue</color>
   <weight>17</weight>
   <qoh>30</qoh>
   <leaf>
    <sno>2</sno>
    <sname>Jones</sname>
    <loc>Paris</loc>
    <shipdate>70,1,17</shipdate>
    <quantity>200</quantity>
   </leaf>
  </record>
 
  <record>
   <pno>6</pno>
   <pname>Cog</pname>
   <color>Red</color>
   <weight>19</weight>
   <qoh>40</qoh>
   <leaf>
    <sno>4</sno>
    <sname>Clark</sname>
    <loc>London</loc>
    <shipdate>70,1,31</shipdate>
    <quantity>300</quantity>
   </leaf>
  </record>
 
 </group>
 
 <group><jno>4</jno>
  <jname>Console</jname>
  <mgr_eno>660118</mgr_eno>
  <record>
   <pno>1</pno>
   <pname>Nut</pname>
   <color>Red</color>
   <weight>12</weight>
   <qoh>30</qoh>
   <leaf>
    <sno>1</sno>
    <sname>Smith</sname>
    <loc>London</loc>
    <shipdate>70,1,12</shipdate>
    <quantity>700</quantity>
   </leaf>
   <leaf>
    <sno>5</sno>
    <sname>Adams</sname>
    <loc>Athens</loc>
    <shipdate>70,2,9</shipdate>
    <quantity>100</quantity>
   </leaf>
  </record>
 
  <record>
   <pno>2</pno>
   <pname>Bolt</pname>
   <color>Green</color>
   <weight>17</weight>
   <qoh>60</qoh>
   <leaf>
    <sno>5</sno>
    <sname>Adams</sname>
    <loc>Athens</loc>
    <shipdate>70,1,23</shipdate>
    <quantity>100</quantity>
   </leaf>
  </record>
 
  <record>
   <pno>3</pno>
   <pname>Screw</pname>
   <color>Blue</color>
   <weight>17</weight>
   <qoh>30</qoh>
   <leaf>
    <sno>2</sno>
    <sname>Jones</sname>
    <loc>Paris</loc>
    <shipdate>70,1,17</shipdate>
    <quantity>500</quantity>
   </leaf>
   <leaf>
    <sno>5</sno>
    <sname>Adams</sname>
    <loc>Athens</loc>
    <shipdate>70,1,14</shipdate>
    <quantity>200</quantity>
   </leaf>
  </record>
 
  <record>
   <pno>4</pno>
   <pname>Screw</pname>
   <color>Red</color>
   <weight>14</weight>
   <qoh>10</qoh>
   <leaf>
    <sno>5</sno>
    <sname>Adams</sname>
    <loc>Athens</loc>
    <shipdate>70,1,24</shipdate>
    <quantity>800</quantity>
   </leaf>
  </record>
 
  <record>
   <pno>5</pno>
   <pname>Cam</pname>
   <color>Blue</color>
   <weight>12</weight>
   <qoh>20</qoh>
   <leaf>
    <sno>5</sno>
    <sname>Adams</sname>
    <loc>Athens</loc>
    <shipdate>70,1,12</shipdate>
    <quantity>400</quantity>
   </leaf>
  </record>
 
  <record>
   <pno>6</pno>
   <pname>Cog</pname>
   <color>Red</color>
   <weight>19</weight>
   <qoh>40</qoh>
   <leaf>
    <sno>5</sno>
    <sname>Adams</sname>
    <loc>Athens</loc>
    <shipdate>70,2,5</shipdate>
    <quantity>500</quantity>
   </leaf>
  </record>
 
 </group>
 
 <group><jno>5</jno>
  <jname>Collator</jname>
  <mgr_eno>690002</mgr_eno>
  <record>
   <pno>3</pno>
   <pname>Screw</pname>
   <color>Blue</color>
   <weight>17</weight>
   <qoh>30</qoh>
   <leaf>
    <sno>2</sno>
    <sname>Jones</sname>
    <loc>Paris</loc>
    <shipdate>70,1,17</shipdate>
    <quantity>600</quantity>
   </leaf>
  </record>
 
  <record>
   <pno>5</pno>
   <pname>Cam</pname>
   <color>Blue</color>
   <weight>12</weight>
   <qoh>20</qoh>
   <leaf>
    <sno>5</sno>
    <sname>Adams</sname>
    <loc>Athens</loc>
    <shipdate>70,1,12</shipdate>
    <quantity>500</quantity>
   </leaf>
  </record>
 
 </group>
 
 <group><jno>6</jno>
  <jname>Terminal</jname>
  <mgr_eno>640014</mgr_eno>
  <record>
   <pno>3</pno>
   <pname>Screw</pname>
   <color>Blue</color>
   <weight>17</weight>
   <qoh>30</qoh>
   <leaf>
    <sno>2</sno>
    <sname>Jones</sname>
    <loc>Paris</loc>
    <shipdate>70,1,17</shipdate>
    <quantity>400</quantity>
   </leaf>
  </record>
 
 </group>
 
 <group><jno>7</jno>
  <jname>tape</jname>
  <mgr_eno>710020</mgr_eno>
  <record>
   <pno>3</pno>
   <pname>Screw</pname>
   <color>Blue</color>
   <weight>17</weight>
   <qoh>30</qoh>
   <leaf>
    <sno>2</sno>
    <sname>Jones</sname>
    <loc>Paris</loc>
    <shipdate>70,1,17</shipdate>
    <quantity>800</quantity>
   </leaf>
   <leaf>
    <sno>5</sno>
    <sname>Adams</sname>
    <loc>Athens</loc>
    <shipdate>70,1,31</shipdate>
    <quantity>100</quantity>
   </leaf>
  </record>
 
  <record>
   <pno>5</pno>
   <pname>Cam</pname>
   <color>Blue</color>
   <weight>12</weight>
   <qoh>20</qoh>
   <leaf>
    <sno>5</sno>
    <sname>Adams</sname>
    <loc>Athens</loc>
    <shipdate>70,1,12</shipdate>
    <quantity>100</quantity>
   </leaf>
  </record>
 
  <record>
   <pno>6</pno>
   <pname>Cog</pname>
   <color>Red</color>
   <weight>19</weight>
   <qoh>40</qoh>
   <leaf>
    <sno>4</sno>
    <sname>Clark</sname>
    <loc>London</loc>
    <shipdate>70,1,31</shipdate>
    <quantity>300</quantity>
   </leaf>
  </record>
 
 </group>
</file>
 
</root>


B.3.25 Output from (3-37) in 3.9

<root>
<file>
 <group1><sno>1</sno>
  <sname>Smith</sname>
  <loc>London</loc>
  <group2><pno>1</pno>
   <pname>Nut</pname>
   <color>Red</color>
   <weight>12</weight>
   <qoh>30</qoh>
   <record>
    <jno>1</jno>
    <jname>Sorter</jname>
    <mgr_eno>640028</mgr_eno>
    <shipdate>70,1,12</shipdate>
    <quantity>200</quantity>
   </record>

   <record>
    <jno>4</jno>
    <jname>Console</jname>
    <mgr_eno>660118</mgr_eno>
    <shipdate>70,1,12</shipdate>
    <quantity>700</quantity>
   </record>

  </group2>

 </group1>

 <group1><sno>2</sno>
  <sname>Jones</sname>
  <loc>Paris</loc>
  <group2><pno>3</pno>
   <pname>Screw</pname>
   <color>Blue</color>
   <weight>17</weight>
   <qoh>30</qoh>
   <record>
    <jno>1</jno>
    <jname>Sorter</jname>
    <mgr_eno>640028</mgr_eno>
    <shipdate>70,1,17</shipdate>
    <quantity>400</quantity>
   </record>

   <record>
    <jno>2</jno>
    <jname>Punch</jname>
    <mgr_eno>700128</mgr_eno>
    <shipdate>70,1,17</shipdate>
    <quantity>200</quantity>
   </record>

   <record>
    <jno>3</jno>
    <jname>Reader</jname>
    <mgr_eno>680096</mgr_eno>
    <shipdate>70,1,17</shipdate>
    <quantity>200</quantity>
   </record>

   <record>
    <jno>4</jno>
    <jname>Console</jname>
    <mgr_eno>660118</mgr_eno>
    <shipdate>70,1,17</shipdate>
    <quantity>500</quantity>
   </record>

   <record>
    <jno>5</jno>
    <jname>Collator</jname>
    <mgr_eno>690002</mgr_eno>
    <shipdate>70,1,17</shipdate>
    <quantity>600</quantity>
   </record>

   <record>
    <jno>6</jno>
    <jname>Terminal</jname>
    <mgr_eno>640014</mgr_eno>
    <shipdate>70,1,17</shipdate>
    <quantity>400</quantity>
   </record>

   <record>
    <jno>7</jno>
    <jname>tape</jname>
    <mgr_eno>710020</mgr_eno>
    <shipdate>70,1,17</shipdate>
    <quantity>800</quantity>
   </record>

  </group2>

  <group2><pno>5</pno>
   <pname>Cam</pname>
   <color>Blue</color>
   <weight>12</weight>
   <qoh>20</qoh>
   <record>
    <jno>2</jno>
    <jname>Punch</jname>
    <mgr_eno>700128</mgr_eno>
    <shipdate>69,12,19</shipdate>
    <quantity>100</quantity>
   </record>

  </group2>

 </group1>

 <group1><sno>3</sno>
  <sname>Blake</sname>
  <loc>Paris</loc>
  <group2><pno>3</pno>
   <pname>Screw</pname>
   <color>Blue</color>
   <weight>17</weight>
   <qoh>30</qoh>
   <record>
    <jno>1</jno>
    <jname>Sorter</jname>
    <mgr_eno>640028</mgr_eno>
    <shipdate>70,2,2</shipdate>
    <quantity>200</quantity>
   </record>

  </group2>

  <group2><pno>4</pno>
   <pname>Screw</pname>
   <color>Red</color>
   <weight>14</weight>
   <qoh>10</qoh>
   <record>
    <jno>2</jno>
    <jname>Punch</jname>
    <mgr_eno>700128</mgr_eno>
    <shipdate>70,2,10</shipdate>
    <quantity>500</quantity>
   </record>

  </group2>

 </group1>

 <group1><sno>4</sno>
  <sname>Clark</sname>
  <loc>London</loc>
  <group2><pno>6</pno>
   <pname>Cog</pname>
   <color>Red</color>
   <weight>19</weight>
   <qoh>40</qoh>
   <record>
    <jno>3</jno>
    <jname>Reader</jname>
    <mgr_eno>680096</mgr_eno>
    <shipdate>70,1,31</shipdate>
    <quantity>300</quantity>
   </record>

   <record>
    <jno>7</jno>
    <jname>tape</jname>
    <mgr_eno>710020</mgr_eno>
    <shipdate>70,1,31</shipdate>
    <quantity>300</quantity>
   </record>

  </group2>

 </group1>

 <group1><sno>5</sno>
  <sname>Adams</sname>
  <loc>Athens</loc>
  <group2><pno>1</pno>
   <pname>Nut</pname>
   <color>Red</color>
   <weight>12</weight>
   <qoh>30</qoh>
   <record>
    <jno>4</jno>
    <jname>Console</jname>
    <mgr_eno>660118</mgr_eno>
    <shipdate>70,2,9</shipdate>
    <quantity>100</quantity>
   </record>

  </group2>

  <group2><pno>2</pno>
   <pname>Bolt</pname>
   <color>Green</color>
   <weight>17</weight>
   <qoh>60</qoh>
   <record>
    <jno>2</jno>
    <jname>Punch</jname>
    <mgr_eno>700128</mgr_eno>
    <shipdate>70,1,23</shipdate>
    <quantity>200</quantity>
   </record>

   <record>
    <jno>4</jno>
    <jname>Console</jname>
    <mgr_eno>660118</mgr_eno>
    <shipdate>70,1,23</shipdate>
    <quantity>100</quantity>
   </record>

  </group2>

  <group2><pno>3</pno>
   <pname>Screw</pname>
   <color>Blue</color>
   <weight>17</weight>
   <qoh>30</qoh>
   <record>
    <jno>4</jno>
    <jname>Console</jname>
    <mgr_eno>660118</mgr_eno>
    <shipdate>70,1,14</shipdate>
    <quantity>200</quantity>
   </record>

   <record>
    <jno>7</jno>
    <jname>tape</jname>
    <mgr_eno>710020</mgr_eno>
    <shipdate>70,1,31</shipdate>
    <quantity>100</quantity>
   </record>

  </group2>

  <group2><pno>4</pno>
   <pname>Screw</pname>
   <color>Red</color>
   <weight>14</weight>
   <qoh>10</qoh>
   <record>
    <jno>4</jno>
    <jname>Console</jname>
    <mgr_eno>660118</mgr_eno>
    <shipdate>70,1,24</shipdate>
    <quantity>800</quantity>
   </record>

  </group2>

  <group2><pno>5</pno>
   <pname>Cam</pname>
   <color>Blue</color>
   <weight>12</weight>
   <qoh>20</qoh>
   <record>
    <jno>4</jno>
    <jname>Console</jname>
    <mgr_eno>660118</mgr_eno>
    <shipdate>70,1,12</shipdate>
    <quantity>400</quantity>
   </record>

   <record>
    <jno>5</jno>
    <jname>Collator</jname>
    <mgr_eno>690002</mgr_eno>
    <shipdate>70,1,12</shipdate>
    <quantity>500</quantity>
   </record>

   <record>
    <jno>7</jno>
    <jname>tape</jname>
    <mgr_eno>710020</mgr_eno>
    <shipdate>70,1,12</shipdate>
    <quantity>100</quantity>
   </record>

  </group2>

  <group2><pno>6</pno>
   <pname>Cog</pname>
   <color>Red</color>
   <weight>19</weight>
   <qoh>40</qoh>
   <record>
    <jno>2</jno>
    <jname>Punch</jname>
    <mgr_eno>700128</mgr_eno>
    <shipdate>70,1,16</shipdate>
    <quantity>200</quantity>
   </record>

   <record>
    <jno>4</jno>
    <jname>Console</jname>
    <mgr_eno>660118</mgr_eno>
    <shipdate>70,2,5</shipdate>
    <quantity>500</quantity>
   </record>

  </group2>
 </group1>
</file>

</root>


B.3.26 Xsl script to produce the HTML tables from the output of (3-37) in 3.9

(Result here.)

<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">

  <xsl:template match="/">
    <html>
      <head>
        <title>Spj sample: supplier - part - project view</title>
      </head>
      <body>
        <xsl:apply-templates select="root/file/group1" />
      </body>
    </html>
  </xsl:template>

  <xsl:template match="group1">
    <table border="1">
      <caption>j#:<xsl:value-of select="sno"/>; <xsl:value-of select="sname"/>, <xsl:value-of select="loc"/> </caption>
      <tbody>
        <tr>
          <th>p#</th>
          <th>pname</th>
          <th>color</th>
          <th>weight</th>
          <th>qoh</th>
          <th>j#</th>
          <th>jname</th>
          <th>mgr_e#</th>
          <th>shipdate</th>
          <th>quantity</th>
        </tr>
        <xsl:apply-templates select="group2"/>
      </tbody>
    </table>
  </xsl:template>

  <xsl:template match="group2">
    <xsl:apply-templates select="record"/>
  </xsl:template>

  <xsl:template match="record">
    <xsl:if test="position()=1">
      <tr>
        <td>
          <xsl:attribute name="rowspan">
            <xsl:value-of select="last()"/>
          </xsl:attribute>
          <xsl:value-of select="../pno"/>
        </td>
        <td>
          <xsl:attribute name="rowspan">
            <xsl:value-of select="last()"/>
          </xsl:attribute>
          <xsl:value-of select="../pname"/>
        </td>
        <td>
          <xsl:attribute name="rowspan">
            <xsl:value-of select="last()"/>
          </xsl:attribute>
          <xsl:value-of select="../color"/>
        </td>
        <td>
          <xsl:attribute name="rowspan">
            <xsl:value-of select="last()"/>
          </xsl:attribute>
          <xsl:value-of select="../weight"/>
        </td>
        <td>
          <xsl:attribute name="rowspan">
            <xsl:value-of select="last()"/>
          </xsl:attribute>
          <xsl:value-of select="../qoh"/>
        </td>
        <td>
          <xsl:value-of select="jno"/>
        </td>
        <td>
          <xsl:value-of select="jname"/>
        </td>
        <td>
          <xsl:value-of select="mgr_eno"/>
        </td>
        <td>
          <xsl:value-of select="shipdate"/>
        </td>
        <td>
          <xsl:value-of select="quantity"/>
        </td>
      </tr>
    </xsl:if>
    <xsl:if test="position()!=1">
      <tr>
        <td>
          <xsl:value-of select="jno"/>
        </td>
        <td>
          <xsl:value-of select="jname"/>
        </td>
        <td>
          <xsl:value-of select="mgr_eno"/>
        </td>
        <td>
          <xsl:value-of select="shipdate"/>
        </td>
        <td>
          <xsl:value-of select="quantity"/>
        </td>
      </tr>
    </xsl:if>
  </xsl:template>

</xsl:stylesheet>


B.3.27 HTML source of (3-38) in 3.9

(Indention is added for readability.)

<html>
  <head>
    <title>Spj sample: supplier - part - project view</title>
  </head>
  <body>
    <table border="1">
      <caption>j#:1; Smith, London</caption>
      <tbody>
        <tr>
          <th>p#</th>
          <th>pname</th>
          <th>color</th>
          <th>weight</th>
          <th>qoh</th>
          <th>j#</th>
          <th>jname</th>
          <th>mgr_e#</th>
          <th>shipdate</th>
          <th>quantity</th>
        </tr>
        <tr>
          <td rowspan="2">1</td>
          <td rowspan="2">Nut</td>
          <td rowspan="2">Red</td>
          <td rowspan="2">12</td>
          <td rowspan="2">30</td>
          <td>1</td>
          <td>Sorter</td>
          <td>640028</td>
          <td>70,1,12</td>
          <td>200</td>
        </tr>
        <tr>
          <td>4</td>
          <td>Console</td>
          <td>660118</td>
          <td>70,1,12</td>
          <td>700</td>
        </tr>
      </tbody>
    </table>
    <table border="1">
      <caption>j#:2; Jones, Paris</caption>
      <tbody>
        <tr>
          <th>p#</th>
          <th>pname</th>
          <th>color</th>
          <th>weight</th>
          <th>qoh</th>
          <th>j#</th>
          <th>jname</th>
          <th>mgr_e#</th>
          <th>shipdate</th>
          <th>quantity</th>
        </tr>
        <tr>
          <td rowspan="7">3</td>
          <td rowspan="7">Screw</td>
          <td rowspan="7">Blue</td>
          <td rowspan="7">17</td>
          <td rowspan="7">30</td>
          <td>1</td>
          <td>Sorter</td>
          <td>640028</td>
          <td>70,1,17</td>
          <td>400</td>
        </tr>
        <tr>
          <td>2</td>
          <td>Punch</td>
          <td>700128</td>
          <td>70,1,17</td>
          <td>200</td>
        </tr>
        <tr>
          <td>3</td>
          <td>Reader</td>
          <td>680096</td>
          <td>70,1,17</td>
          <td>200</td>
        </tr>
        <tr>
          <td>4</td>
          <td>Console</td>
          <td>660118</td>
          <td>70,1,17</td>
          <td>500</td>
        </tr>
        <tr>
          <td>5</td>
          <td>Collator</td>
          <td>690002</td>
          <td>70,1,17</td>
          <td>600</td>
        </tr>
        <tr>
          <td>6</td>
          <td>Terminal</td>
          <td>640014</td>
          <td>70,1,17</td>
          <td>400</td>
        </tr>
        <tr>
          <td>7</td>
          <td>tape</td>
          <td>710020</td>
          <td>70,1,17</td>
          <td>800</td>
        </tr>
        <tr>
          <td rowspan="1">5</td>
          <td rowspan="1">Cam</td>
          <td rowspan="1">Blue</td>
          <td rowspan="1">12</td>
          <td rowspan="1">20</td>
          <td>2</td>
          <td>Punch</td>
          <td>700128</td>
          <td>69,12,19</td>
          <td>100</td>
        </tr>
      </tbody>
    </table>
    <table border="1">
      <caption>j#:3; Blake, Paris</caption>
      <tbody>
        <tr>
          <th>p#</th>
          <th>pname</th>
          <th>color</th>
          <th>weight</th>
          <th>qoh</th>
          <th>j#</th>
          <th>jname</th>
          <th>mgr_e#</th>
          <th>shipdate</th>
          <th>quantity</th>
        </tr>
        <tr>
          <td rowspan="1">3</td>
          <td rowspan="1">Screw</td>
          <td rowspan="1">Blue</td>
          <td rowspan="1">17</td>
          <td rowspan="1">30</td>
          <td>1</td>
          <td>Sorter</td>
          <td>640028</td>
          <td>70,2,2</td>
          <td>200</td>
        </tr>
        <tr>
          <td rowspan="1">4</td>
          <td rowspan="1">Screw</td>
          <td rowspan="1">Red</td>
          <td rowspan="1">14</td>
          <td rowspan="1">10</td>
          <td>2</td>
          <td>Punch</td>
          <td>700128</td>
          <td>70,2,10</td>
          <td>500</td>
        </tr>
      </tbody>
    </table>
    <table border="1">
      <caption>j#:4; Clark, London</caption>
      <tbody>
        <tr>
          <th>p#</th>
          <th>pname</th>
          <th>color</th>
          <th>weight</th>
          <th>qoh</th>
          <th>j#</th>
          <th>jname</th>
          <th>mgr_e#</th>
          <th>shipdate</th>
          <th>quantity</th>
        </tr>
        <tr>
          <td rowspan="2">6</td>
          <td rowspan="2">Cog</td>
          <td rowspan="2">Red</td>
          <td rowspan="2">19</td>
          <td rowspan="2">40</td>
          <td>3</td>
          <td>Reader</td>
          <td>680096</td>
          <td>70,1,31</td>
          <td>300</td>
        </tr>
        <tr>
          <td>7</td>
          <td>tape</td>
          <td>710020</td>
          <td>70,1,31</td>
          <td>300</td>
        </tr>
      </tbody>
    </table>
    <table border="1">
      <caption>j#:5; Adams, Athens</caption>
      <tbody>
        <tr>
          <th>p#</th>
          <th>pname</th>
          <th>color</th>
          <th>weight</th>
          <th>qoh</th>
          <th>j#</th>
          <th>jname</th>
          <th>mgr_e#</th>
          <th>shipdate</th>
          <th>quantity</th>
        </tr>
        <tr>
          <td rowspan="1">1</td>
          <td rowspan="1">Nut</td>
          <td rowspan="1">Red</td>
          <td rowspan="1">12</td>
          <td rowspan="1">30</td>
          <td>4</td>
          <td>Console</td>
          <td>660118</td>
          <td>70,2,9</td>
          <td>100</td>
        </tr>
        <tr>
          <td rowspan="2">2</td>
          <td rowspan="2">Bolt</td>
          <td rowspan="2">Green</td>
          <td rowspan="2">17</td>
          <td rowspan="2">60</td>
          <td>2</td>
          <td>Punch</td>
          <td>700128</td>
          <td>70,1,23</td>
          <td>200</td>
        </tr>
        <tr>
          <td>4</td>
          <td>Console</td>
          <td>660118</td>
          <td>70,1,23</td>
          <td>100</td>
        </tr>
        <tr>
          <td rowspan="2">3</td>
          <td rowspan="2">Screw</td>
          <td rowspan="2">Blue</td>
          <td rowspan="2">17</td>
          <td rowspan="2">30</td>
          <td>4</td>
          <td>Console</td>
          <td>660118</td>
          <td>70,1,14</td>
          <td>200</td>
        </tr>
        <tr>
          <td>7</td>
          <td>tape</td>
          <td>710020</td>
          <td>70,1,31</td>
          <td>100</td>
        </tr>
        <tr>
          <td rowspan="1">4</td>
          <td rowspan="1">Screw</td>
          <td rowspan="1">Red</td>
          <td rowspan="1">14</td>
          <td rowspan="1">10</td>
          <td>4</td>
          <td>Console</td>
          <td>660118</td>
          <td>70,1,24</td>
          <td>800</td>
        </tr>
        <tr>
          <td rowspan="3">5</td>
          <td rowspan="3">Cam</td>
          <td rowspan="3">Blue</td>
          <td rowspan="3">12</td>
          <td rowspan="3">20</td>
          <td>4</td>
          <td>Console</td>
          <td>660118</td>
          <td>70,1,12</td>
          <td>400</td>
        </tr>
        <tr>
          <td>5</td>
          <td>Collator</td>
          <td>690002</td>
          <td>70,1,12</td>
          <td>500</td>
        </tr>
        <tr>
          <td>7</td>
          <td>tape</td>
          <td>710020</td>
          <td>70,1,12</td>
          <td>100</td>
        </tr>
        <tr>
          <td rowspan="2">6</td>
          <td rowspan="2">Cog</td>
          <td rowspan="2">Red</td>
          <td rowspan="2">19</td>
          <td rowspan="2">40</td>
          <td>2</td>
          <td>Punch</td>
          <td>700128</td>
          <td>70,1,16</td>
          <td>200</td>
        </tr>
        <tr>
          <td>4</td>
          <td>Console</td>
          <td>660118</td>
          <td>70,2,5</td>
          <td>500</td>
        </tr>
      </tbody>
    </table>
  </body>
</html>


B.4.1 rename-1.d (text view) (4-1) in 4.

cc:DE
nm:Michel
lc:de

cc:FR
nm:Marianne
lc:fr

cc:GB
nm:John Bull
lc:en

cc:US
nm:Uncle Sam
lc:en


B.4.2 Output from the Drename of (4-2) (text view) in 4.1

country-code:DE
name:Michel
language-code:de

country-code:FR
name:Marianne
language-code:fr

country-code:GB
name:John Bull
language-code:en

country-code:US
name:Uncle Sam
language-code:en


B.4.3 tmp-de.d (text view) (4-3) (text view) in 4.2

cc:DE
Name:Michel
lc:de


B.4.4 tmp-fr.d (text view) (4-3) (text view) in 4.2

cc:FR
nom:Marianne
lc:fr


B.4.5 tmp-en.d (text view) (4-3) (text view) in 4.2

cc:GB
name:John Bull
lc:en

cc:US
name:Uncle Sam
lc:en


B.4.6 Output from (4-3) (text view) in 4.2

cc:DE
Name:Michel
lc:de

cc:FR
nom:Marianne
lc:fr

cc:GB
name:John Bull
lc:en

cc:US
name:Uncle Sam
lc:en


B.4.7 Output from (4-4) in 4.3

cc:DE
lc:de
Name:Michel

cc:FR
lc:fr
nom:Marianne

cc:GB
lc:en
name:John Bull

cc:US
lc:en
name:Uncle Sam


B.4.8 Output from (4-5) (text view) in 4.4

cc:DE
Name:Michel
lc:de

cc:FR
nom:Marianne
lc:fr

cc:GB
name:John Bull
lc:en

cc:US
name:Uncle Sam
lc:en


B.5.1 transposition-1 (text view) of (5-1) in 5.1

year:2001
USD/CHF:1.6868
USD/EUR:1.1166
USD/GBP:0.6942
USD/JPY:121.5193

year:2002
USD/CHF:1.5561
USD/EUR:1.0608
USD/GBP:0.6663
USD/JPY:125.1998

year:2003
USD/CHF:1.3449
USD/EUR:0.8852
USD/GBP:0.6122
USD/JPY:115.9517

year:2004
USD/CHF:1.2426
USD/EUR:0.8050
USD/GBP:0.5460
USD/JPY:108.1542

year:2005
USD/CHF:1.2455
USD/EUR:0.8044
USD/GBP:0.5500
USD/JPY:110.1053


B.5.2 transposition-2.d (text view) of (5-2) in 5.1

currency:USD/CHF
2001:1.6868
2002:1.5561
2003:1.3449
2004:1.2426
2005:1.2455

currency:USD/EUR
2001:1.1166
2002:1.0608
2003:0.8852
2004:0.8050
2005:0.8044

currency:USD/GPB
2001:0.6942
2002:0.6663
2003:0.6122
2004:0.5460
2005:0.5500

currency:USD/JPY
2001:121.5193
2002:125.1998
2003:115.9517
2004:108.1542
2005:110.1053


B.5.3 Output from the Ddecompose of (5-3) (table view) in 5.1

Text view here.

rec# seq year fieldseq fieldname value
1 1 2001 1 USD/CHF 1.6868
2 1 2001 2 USD/EUR 1.1166
3 1 2001 3 USD/GBP 0.6942
4 1 2001 4 USD/JPY 121.5193
5 2 2002 1 USD/CHF 1.5561
6 2 2002 2 USD/EUR 1.0608
7 2 2002 3 USD/GBP 0.6663
8 2 2002 4 USD/JPY 125.1998
9 3 2003 1 USD/CHF 1.3449
10 3 2003 2 USD/EUR 0.8852
11 3 2003 3 USD/GBP 0.6122
12 3 2003 4 USD/JPY 115.9517
13 4 2004 1 USD/CHF 1.2426
14 4 2004 2 USD/EUR 0.8050
15 4 2004 3 USD/GBP 0.5460
16 4 2004 4 USD/JPY 108.1542
17 5 2005 1 USD/CHF 1.2455
18 5 2005 2 USD/EUR 0.8044
19 5 2005 3 USD/GBP 0.5500
20 5 2005 4 USD/JPY 110.1053

B.5.4 Output from the Ddecompose of (5-3) (text view) in 5.1

(table view here)

seq:1
year:2001
fieldseq:1
fieldname:USD/CHF
value:1.6868

seq:1
year:2001
fieldseq:2
fieldname:USD/EUR
value:1.1166

seq:1
year:2001
fieldseq:3
fieldname:USD/GBP
value:0.6942

seq:1
year:2001
fieldseq:4
fieldname:USD/JPY
value:121.5193

seq:2
year:2002
fieldseq:1
fieldname:USD/CHF
value:1.5561

seq:2
year:2002
fieldseq:2
fieldname:USD/EUR
value:1.0608

seq:2
year:2002
fieldseq:3
fieldname:USD/GBP
value:0.6663

seq:2
year:2002
fieldseq:4
fieldname:USD/JPY
value:125.1998

seq:3
year:2003
fieldseq:1
fieldname:USD/CHF
value:1.3449

seq:3
year:2003
fieldseq:2
fieldname:USD/EUR
value:0.8852

seq:3
year:2003
fieldseq:3
fieldname:USD/GBP
value:0.6122

seq:3
year:2003
fieldseq:4
fieldname:USD/JPY
value:115.9517

seq:4
year:2004
fieldseq:1
fieldname:USD/CHF
value:1.2426

seq:4
year:2004
fieldseq:2
fieldname:USD/EUR
value:0.8050

seq:4
year:2004
fieldseq:3
fieldname:USD/GBP
value:0.5460

seq:4
year:2004
fieldseq:4
fieldname:USD/JPY
value:108.1542

seq:5
year:2005
fieldseq:1
fieldname:USD/CHF
value:1.2455

seq:5
year:2005
fieldseq:2
fieldname:USD/EUR
value:0.8044

seq:5
year:2005
fieldseq:3
fieldname:USD/GBP
value:0.5500

seq:5
year:2005
fieldseq:4
fieldname:USD/JPY
value:110.1053


B.5.5 Output from the Dsort of (5-3) (table view) in 5.1

Text view here.

rec# seq year fieldseq fieldname value
1 1 2001 1 USD/CHF 1.6868
2 2 2002 1 USD/CHF 1.5561
3 3 2003 1 USD/CHF 1.3449
4 4 2004 1 USD/CHF 1.2426
5 5 2005 1 USD/CHF 1.2455
6 1 2001 2 USD/EUR 1.1166
7 2 2002 2 USD/EUR 1.0608
8 3 2003 2 USD/EUR 0.8852
9 4 2004 2 USD/EUR 0.8050
10 5 2005 2 USD/EUR 0.8044
11 1 2001 3 USD/GBP 0.6942
12 2 2002 3 USD/GBP 0.6663
13 3 2003 3 USD/GBP 0.6122
14 4 2004 3 USD/GBP 0.5460
15 5 2005 3 USD/GBP 0.5500
16 1 2001 4 USD/JPY 121.5193
17 2 2002 4 USD/JPY 125.1998
18 3 2003 4 USD/JPY 115.9517
19 4 2004 4 USD/JPY 108.1542
20 5 2005 4 USD/JPY 110.1053

B.5.6 Output from the Dsort of (5-3) (text view) in 5.1

(table view here)

seq:1
year:2001
fieldseq:1
fieldname:USD/CHF
value:1.6868

seq:2
year:2002
fieldseq:1
fieldname:USD/CHF
value:1.5561

seq:3
year:2003
fieldseq:1
fieldname:USD/CHF
value:1.3449

seq:4
year:2004
fieldseq:1
fieldname:USD/CHF
value:1.2426

seq:5
year:2005
fieldseq:1
fieldname:USD/CHF
value:1.2455

seq:1
year:2001
fieldseq:2
fieldname:USD/EUR
value:1.1166

seq:2
year:2002
fieldseq:2
fieldname:USD/EUR
value:1.0608

seq:3
year:2003
fieldseq:2
fieldname:USD/EUR
value:0.8852

seq:4
year:2004
fieldseq:2
fieldname:USD/EUR
value:0.8050

seq:5
year:2005
fieldseq:2
fieldname:USD/EUR
value:0.8044

seq:1
year:2001
fieldseq:3
fieldname:USD/GBP
value:0.6942

seq:2
year:2002
fieldseq:3
fieldname:USD/GBP
value:0.6663

seq:3
year:2003
fieldseq:3
fieldname:USD/GBP
value:0.6122

seq:4
year:2004
fieldseq:3
fieldname:USD/GBP
value:0.5460

seq:5
year:2005
fieldseq:3
fieldname:USD/GBP
value:0.5500

seq:1
year:2001
fieldseq:4
fieldname:USD/JPY
value:121.5193

seq:2
year:2002
fieldseq:4
fieldname:USD/JPY
value:125.1998

seq:3
year:2003
fieldseq:4
fieldname:USD/JPY
value:115.9517

seq:4
year:2004
fieldseq:4
fieldname:USD/JPY
value:108.1542

seq:5
year:2005
fieldseq:4
fieldname:USD/JPY
value:110.1053


B.5.7 Output from the Drename of (5-3) (table view) in 5.1

Text view here

rec# seq fieldname fieldseq currency value
1 1 2001 1 USD/CHF 1.6868
2 2 2002 1 USD/CHF 1.5561
3 3 2003 1 USD/CHF 1.3449
4 4 2004 1 USD/CHF 1.2426
5 5 2005 1 USD/CHF 1.2455
6 1 2001 2 USD/EUR 1.1166
7 2 2002 2 USD/EUR 1.0608
8 3 2003 2 USD/EUR 0.8852
9 4 2004 2 USD/EUR 0.8050
10 5 2005 2 USD/EUR 0.8044
11 1 2001 3 USD/GBP 0.6942
12 2 2002 3 USD/GBP 0.6663
13 3 2003 3 USD/GBP 0.6122
14 4 2004 3 USD/GBP 0.5460
15 5 2005 3 USD/GBP 0.5500
16 1 2001 4 USD/JPY 121.5193
17 2 2002 4 USD/JPY 125.1998
18 3 2003 4 USD/JPY 115.9517
19 4 2004 4 USD/JPY 108.1542
20 5 2005 4 USD/JPY 110.1053

B.5.8 Output from the Drename (5-3) (text view) in 5.1

(table view here)

seq:1
fieldname:2001
fieldseq:1
currency:USD/CHF
value:1.6868

seq:2
fieldname:2002
fieldseq:1
currency:USD/CHF
value:1.5561

seq:3
fieldname:2003
fieldseq:1
currency:USD/CHF
value:1.3449

seq:4
fieldname:2004
fieldseq:1
currency:USD/CHF
value:1.2426

seq:5
fieldname:2005
fieldseq:1
currency:USD/CHF
value:1.2455

seq:1
fieldname:2001
fieldseq:2
currency:USD/EUR
value:1.1166

seq:2
fieldname:2002
fieldseq:2
currency:USD/EUR
value:1.0608

seq:3
fieldname:2003
fieldseq:2
currency:USD/EUR
value:0.8852

seq:4
fieldname:2004
fieldseq:2
currency:USD/EUR
value:0.8050

seq:5
fieldname:2005
fieldseq:2
currency:USD/EUR
value:0.8044

seq:1
fieldname:2001
fieldseq:3
currency:USD/GBP
value:0.6942

seq:2
fieldname:2002
fieldseq:3
currency:USD/GBP
value:0.6663

seq:3
fieldname:2003
fieldseq:3
currency:USD/GBP
value:0.6122

seq:4
fieldname:2004
fieldseq:3
currency:USD/GBP
value:0.5460

seq:5
fieldname:2005
fieldseq:3
currency:USD/GBP
value:0.5500

seq:1
fieldname:2001
fieldseq:4
currency:USD/JPY
value:121.5193

seq:2
fieldname:2002
fieldseq:4
currency:USD/JPY
value:125.1998

seq:3
fieldname:2003
fieldseq:4
currency:USD/JPY
value:115.9517

seq:4
fieldname:2004
fieldseq:4
currency:USD/JPY
value:108.1542

seq:5
fieldname:2005
fieldseq:4
currency:USD/JPY
value:110.1053


B.5.9 Output from the first Dtie of (5-4) (table view) in 5.2

(Text view here)

rec# year .x
1 2001 USD/CHF:1.6868 → USD/EUR:1.1166 → USD/GBP:0.6942 → USD/JPY:121.5193
2 2002 USD/CHF:1.5561 → USD/EUR:1.0608 → USD/GBP:0.6663 → USD/JPY:125.1998
3 2003 USD/CHF:1.3449 → USD/EUR:0.8852 → USD/GBP:0.6122 → USD/JPY:115.9517
4 2004 USD/CHF:1.2426 → USD/EUR:0.8050 → USD/GBP:0.5460 → USD/JPY:108.1542
5 2005 USD/CHF:1.2455 → USD/EUR:0.8044 → USD/GBP:0.5500 → USD/JPY:110.1053

B.5.10 Output from the first Dtie of (5-4) (text view) in 5.2

(Table view here)

year:2001
.x:USD/CHF:1.6868 → USD/EUR:1.1166 → USD/GBP:0.6942 → USD/JPY:121.5193

year:2002
.x:USD/CHF:1.5561 → USD/EUR:1.0608 → USD/GBP:0.6663 → USD/JPY:125.1998

year:2003
.x:USD/CHF:1.3449 → USD/EUR:0.8852 → USD/GBP:0.6122 → USD/JPY:115.9517

year:2004
.x:USD/CHF:1.2426 → USD/EUR:0.8050 → USD/GBP:0.5460 → USD/JPY:108.1542

year:2005
.x:USD/CHF:1.2455 → USD/EUR:0.8044 → USD/GBP:0.5500 → USD/JPY:110.1053

' → ' here denotes TAB.


B.5.11 Output from the Dunpack of (5-4) (table view) in 5.2

Text view here.

rec# year .x
1 2001 USD/CHF:1.6868 → USD/EUR:1.1166 → USD/GBP:0.6942 → USD/JPY:121.5193
2 2002 USD/CHF:1.5561 → USD/EUR:1.0608 → USD/GBP:0.6663 → USD/JPY:125.1998
3 2003 USD/CHF:1.3449 → USD/EUR:0.8852 → USD/GBP:0.6122 → USD/JPY:115.9517
4 2004 USD/CHF:1.2426 → USD/EUR:0.8050 → USD/GBP:0.5460 → USD/JPY:108.1542
5 2005 USD/CHF:1.2455 → USD/EUR:0.8044 → USD/GBP:0.5500 → USD/JPY:110.1053

B.5.12 Output from the Dunpack of (5-4) (text view) in 5.2

Table view here.

year:2001
.x:USD/CHF:1.6868
.x:USD/EUR:1.1166
.x:USD/GBP:0.6942
.x:USD/JPY:121.5193

year:2002
.x:USD/CHF:1.5561
.x:USD/EUR:1.0608
.x:USD/GBP:0.6663
.x:USD/JPY:125.1998

year:2003
.x:USD/CHF:1.3449
.x:USD/EUR:0.8852
.x:USD/GBP:0.6122
.x:USD/JPY:115.9517

year:2004
.x:USD/CHF:1.2426
.x:USD/EUR:0.8050
.x:USD/GBP:0.5460
.x:USD/JPY:108.1542

year:2005
.x:USD/CHF:1.2455
.x:USD/EUR:0.8044
.x:USD/GBP:0.5500
.x:USD/JPY:110.1053


B.5.13 Output from the Dunbundle of (5-4) (table view) in 5.2

Text view here.

rec# year .x
1 2001 USD/CHF:1.6868
2 2001 USD/EUR:1.1166
3 2001 USD/GBP:0.6942
4 2001 USD/JPY:121.5193
5 2002 USD/CHF:1.5561
6 2002 USD/EUR:1.0608
7 2002 USD/GBP:0.6663
8 2002 USD/JPY:125.1998
9 2003 USD/CHF:1.3449
10 2003 USD/EUR:0.8852
11 2003 USD/GBP:0.6122
12 2003 USD/JPY:115.9517
13 2004 USD/CHF:1.2426
14 2004 USD/EUR:0.8050
15 2004 USD/GBP:0.5460
16 2004 USD/JPY:108.1542
17 2005 USD/CHF:1.2455
18 2005 USD/EUR:0.8044
19 2005 USD/GBP:0.5500
20 2005 USD/JPY:110.1053

B.5.14 Output from the Dunbundle of (5-4) (text view) in 5.2

Table view here

year:2001
.x:USD/CHF:1.6868

year:2001
.x:USD/EUR:1.1166

year:2001
.x:USD/GBP:0.6942

year:2001
.x:USD/JPY:121.5193

year:2002
.x:USD/CHF:1.5561

year:2002
.x:USD/EUR:1.0608

year:2002
.x:USD/GBP:0.6663

year:2002
.x:USD/JPY:125.1998

year:2003
.x:USD/CHF:1.3449

year:2003
.x:USD/EUR:0.8852

year:2003
.x:USD/GBP:0.6122

year:2003
.x:USD/JPY:115.9517

year:2004
.x:USD/CHF:1.2426

year:2004
.x:USD/EUR:0.8050

year:2004
.x:USD/GBP:0.5460

year:2004
.x:USD/JPY:108.1542

year:2005
.x:USD/CHF:1.2455

year:2005
.x:USD/EUR:0.8044

year:2005
.x:USD/GBP:0.5500

year:2005
.x:USD/JPY:110.1053


B.5.15 Output from the first Duntie of (5-4) (table view) in 5.2

Text view here

rec# year currency .y
1 2001 USD/CHF 1.6868
2 2001 USD/EUR 1.1166
3 2001 USD/GBP 0.6942
4 2001 USD/JPY 121.5193
5 2002 USD/CHF 1.5561
6 2002 USD/EUR 1.0608
7 2002 USD/GBP 0.6663
8 2002 USD/JPY 125.1998
9 2003 USD/CHF 1.3449
10 2003 USD/EUR 0.8852
11 2003 USD/GBP 0.6122
12 2003 USD/JPY 115.9517
13 2004 USD/CHF 1.2426
14 2004 USD/EUR 0.8050
15 2004 USD/GBP 0.5460
16 2004 USD/JPY 108.1542
17 2005 USD/CHF 1.2455
18 2005 USD/EUR 0.8044
19 2005 USD/GBP 0.5500
20 2005 USD/JPY 110.1053

B.5.16 Output from the first Duntie of (5-4)(text view) in 5.2

Table view

year:2001
currency:USD/CHF
.y:1.6868

year:2001
currency:USD/EUR
.y:1.1166

year:2001
currency:USD/GBP
.y:0.6942

year:2001
currency:USD/JPY
.y:121.5193

year:2002
currency:USD/CHF
.y:1.5561

year:2002
currency:USD/EUR
.y:1.0608

year:2002
currency:USD/GBP
.y:0.6663

year:2002
currency:USD/JPY
.y:125.1998

year:2003
currency:USD/CHF
.y:1.3449

year:2003
currency:USD/EUR
.y:0.8852

year:2003
currency:USD/GBP
.y:0.6122

year:2003
currency:USD/JPY
.y:115.9517

year:2004
currency:USD/CHF
.y:1.2426

year:2004
currency:USD/EUR
.y:0.8050

year:2004
currency:USD/GBP
.y:0.5460

year:2004
currency:USD/JPY
.y:108.1542

year:2005
currency:USD/CHF
.y:1.2455

year:2005
currency:USD/EUR
.y:0.8044

year:2005
currency:USD/GBP
.y:0.5500

year:2005
currency:USD/JPY
.y:110.1053


B.5.17 Output from the Dsort of (5-4) (table view) in 5.2

Text view here

rec# year currency .y
1 2001 USD/CHF 1.6868
2 2002 USD/CHF 1.5561
3 2003 USD/CHF 1.3449
4 2004 USD/CHF 1.2426
5 2005 USD/CHF 1.2455
6 2001 USD/EUR 1.1166
7 2002 USD/EUR 1.0608
8 2003 USD/EUR 0.8852
9 2004 USD/EUR 0.8050
10 2005 USD/EUR 0.8044
11 2001 USD/GBP 0.6942
12 2002 USD/GBP 0.6663
13 2003 USD/GBP 0.6122
14 2004 USD/GBP 0.5460
15 2005 USD/GBP 0.5500
16 2001 USD/JPY 121.5193
17 2002 USD/JPY 125.1998
18 2003 USD/JPY 115.9517
19 2004 USD/JPY 108.1542
20 2005 USD/JPY 110.1053

B.5.18 Output from the Dsort of (5-4) (text view) in 5.2

Table view here

year:2001
currency:USD/CHF
.y:1.6868

year:2002
currency:USD/CHF
.y:1.5561

year:2003
currency:USD/CHF
.y:1.3449

year:2004
currency:USD/CHF
.y:1.2426

year:2005
currency:USD/CHF
.y:1.2455

year:2001
currency:USD/EUR
.y:1.1166

year:2002
currency:USD/EUR
.y:1.0608

year:2003
currency:USD/EUR
.y:0.8852

year:2004
currency:USD/EUR
.y:0.8050

year:2005
currency:USD/EUR
.y:0.8044

year:2001
currency:USD/GBP
.y:0.6942

year:2002
currency:USD/GBP
.y:0.6663

year:2003
currency:USD/GBP
.y:0.6122

year:2004
currency:USD/GBP
.y:0.5460

year:2005
currency:USD/GBP
.y:0.5500

year:2001
currency:USD/JPY
.y:121.5193

year:2002
currency:USD/JPY
.y:125.1998

year:2003
currency:USD/JPY
.y:115.9517

year:2004
currency:USD/JPY
.y:108.1542

year:2005
currency:USD/JPY
.y:110.1053


B.5.19 Output from second Dtie of (5-4) (table view) in 5.2

Text view here

rec# .z currency
1 2001:1.6868 USD/CHF
2 2002:1.5561 USD/CHF
3 2003:1.3449 USD/CHF
4 2004:1.2426 USD/CHF
5 2005:1.2455 USD/CHF
6 2001:1.1166 USD/EUR
7 2002:1.0608 USD/EUR
8 2003:0.8852 USD/EUR
9 2004:0.8050 USD/EUR
10 2005:0.8044 USD/EUR
11 2001:0.6942 USD/GBP
12 2002:0.6663 USD/GBP
13 2003:0.6122 USD/GBP
14 2004:0.5460 USD/GBP
15 2005:0.5500 USD/GBP
16 2001:121.5193 USD/JPY
17 2002:125.1998 USD/JPY
18 2003:115.9517 USD/JPY
19 2004:108.1542 USD/JPY
20 2005:110.1053 USD/JPY

B.5.20 Output from the second Dtie of (5-4) (text view) in 5.2

Table view here

.z:2001:1.6868
currency:USD/CHF

.z:2002:1.5561
currency:USD/CHF

.z:2003:1.3449
currency:USD/CHF

.z:2004:1.2426
currency:USD/CHF

.z:2005:1.2455
currency:USD/CHF

.z:2001:1.1166
currency:USD/EUR

.z:2002:1.0608
currency:USD/EUR

.z:2003:0.8852
currency:USD/EUR

.z:2004:0.8050
currency:USD/EUR

.z:2005:0.8044
currency:USD/EUR

.z:2001:0.6942
currency:USD/GBP

.z:2002:0.6663
currency:USD/GBP

.z:2003:0.6122
currency:USD/GBP

.z:2004:0.5460
currency:USD/GBP

.z:2005:0.5500
currency:USD/GBP

.z:2001:121.5193
currency:USD/JPY

.z:2002:125.1998
currency:USD/JPY

.z:2003:115.9517
currency:USD/JPY

.z:2004:108.1542
currency:USD/JPY

.z:2005:110.1053
currency:USD/JPY


B.5.21 Output from second Duntie of (5-4) (table view) in 5.2

Text view here.

rec# 2005 2004 2003 2002 2001 currency
1 1.6868 USD/CHF
2 1.5561 USD/CHF
3 1.3449 USD/CHF
4 1.2426 USD/CHF
5 1.2455 USD/CHF
6 1.1166 USD/EUR
7 1.0608 USD/EUR
8 0.8852 USD/EUR
9 0.8050 USD/EUR
10 0.8044 USD/EUR
11 0.6942 USD/GBP
12 0.6663 USD/GBP
13 0.6122 USD/GBP
14 0.5460 USD/GBP
15 0.5500 USD/GBP
16 121.5193 USD/JPY
17 125.1998 USD/JPY
18 115.9517 USD/JPY
19 108.1542 USD/JPY
20 110.1053 USD/JPY

B.5.22 Output from the second Duntie of (5-4) (text view) in 5.2

Table view here

2001:1.6868
currency:USD/CHF

2002:1.5561
currency:USD/CHF

2003:1.3449
currency:USD/CHF

2004:1.2426
currency:USD/CHF

2005:1.2455
currency:USD/CHF

2001:1.1166
currency:USD/EUR

2002:1.0608
currency:USD/EUR

2003:0.8852
currency:USD/EUR

2004:0.8050
currency:USD/EUR

2005:0.8044
currency:USD/EUR

2001:0.6942
currency:USD/GBP

2002:0.6663
currency:USD/GBP

2003:0.6122
currency:USD/GBP

2004:0.5460
currency:USD/GBP

2005:0.5500
currency:USD/GBP

2001:121.5193
currency:USD/JPY

2002:125.1998
currency:USD/JPY

2003:115.9517
currency:USD/JPY

2004:108.1542
currency:USD/JPY

2005:110.1053
currency:USD/JPY


B.5.23 Output from the Dbundle of (5-4) (table view) in 5.2

Text view here

rec# 2001 currency 2002 2003 2004 2005
1 1.6868 USD/CHF 1.5561 1.3449 1.2426 1.2455
2 1.1166 USD/EUR 1.0608 0.8852 0.8050 0.8044
3 0.6942 USD/GBP 0.6663 0.6122 0.5460 0.5500
4 121.5193 USD/JPY 125.1998 115.9517 108.1542 110.1053

B.5.24 Output from the Dbundle of (5-4) (text view) in 5.2

Table view here

2001:1.6868
currency:USD/CHF
2002:1.5561
2003:1.3449
2004:1.2426
2005:1.2455

2001:1.1166
currency:USD/EUR
2002:1.0608
2003:0.8852
2004:0.8050
2005:0.8044

2001:0.6942
currency:USD/GBP
2002:0.6663
2003:0.6122
2004:0.5460
2005:0.5500

2001:121.5193
currency:USD/JPY
2002:125.1998
2003:115.9517
2004:108.1542
2005:110.1053


B.6.1 HTML-table-1.html (6-1) (source HTML) in 6.1

(This HTML source is simplified for explanation.)

<html>
<body>
<table>
 <tbody>
  <tr>
   <th>Country-name</th>
   <th>Country-code</th>
   <th>Language-code</th>
   <th>Currency-code</th>
  </tr>
  <tr>
   <td>FRANCE</td>
   <td>FRA</td>
   <td>fr</td>
   <td>EUR</td>
  </tr>
   <tr><td>GERMANY</td>
   <td>DEU</td>
   <td>de</td>
   <td>EUR</td>
  </tr>
   <tr><td>JAPAN</td>
   <td>JPN</td>
   <td>ja</td>
   <td>JPY</td>
  </tr>
   <tr><td>KOREA, REPUBLIC OF</td>
   <td>KOR</td>
   <td>ko</td>
   <td>KRW</td>
  </tr>
  <tr>
   <td>UNITED KINGDOM</td>
   <td>GBR</td>
   <td>en</td>
   <td>GBP</td>
  </tr>
 </tbody>
</table>
</body>
</html>


B.6.2 Output from the DfromHtml of (6-2), (6-3), (6-5) (text view) in 6.1

node:/html/body/table/tbody/tr[1]
th:Country-name
th:Country-code
th:Language-code
th:Currency-code

node:/html/body/table/tbody/tr[2]
td:FRANCE
td:FRA
td:fr
td:EUR

node:/html/body/table/tbody/tr[3]
td:GERMANY
td:DEU
td:de
td:EUR

node:/html/body/table/tbody/tr[4]
td:JAPAN
td:JPN
td:ja
td:JPY

node:/html/body/table/tbody/tr[5]
td:KOREA, REPUBLIC OF
td:KOR
td:ko
td:KRW

node:/html/body/table/tbody/tr[6]
td:UNITED KINGDOM
td:GBR
td:en
td:GBP


B.6.3 Output from the Dextract of (6-2) in 6.1.1

node:/html/body/table/tbody/tr[2]
td:FRANCE
td:FRA
td:fr
td:EUR

node:/html/body/table/tbody/tr[3]
td:GERMANY
td:DEU
td:de
td:EUR

node:/html/body/table/tbody/tr[4]
td:JAPAN
td:JPN
td:ja
td:JPY

node:/html/body/table/tbody/tr[5]
td:KOREA, REPUBLIC OF
td:KOR
td:ko
td:KRW

node:/html/body/table/tbody/tr[6]
td:UNITED KINGDOM
td:GBR
td:en
td:GBP


B.6.4 Output from the Ded of (6-2) in 6.1.1

node:/html/body/table/tbody/tr[2]
td:FRANCE
td:FRA
td:fr
td:EUR
Country-name:FRANCE
Country-code:FRA
Language-code:fr
Currency-code:EUR

node:/html/body/table/tbody/tr[3]
td:GERMANY
td:DEU
td:de
td:EUR
Country-name:GERMANY
Country-code:DEU
Language-code:de
Currency-code:EUR

node:/html/body/table/tbody/tr[4]
td:JAPAN
td:JPN
td:ja
td:JPY
Country-name:JAPAN
Country-code:JPN
Language-code:ja
Currency-code:JPY

node:/html/body/table/tbody/tr[5]
td:KOREA, REPUBLIC OF
td:KOR
td:ko
td:KRW
Country-name:KOREA, REPUBLIC OF
Country-code:KOR
Language-code:ko
Currency-code:KRW

node:/html/body/table/tbody/tr[6]
td:UNITED KINGDOM
td:GBR
td:en
td:GBP
Country-name:UNITED KINGDOM
Country-code:GBR
Language-code:en
Currency-code:GBP


B.6.5 HTML-table-1.d (6-2), (6-3), (6-5) (text view) in 6.1

Country-name:FRANCE
Country-code:FRA
Language-code:fr
Currency-code:EUR

Country-name:GERMANY
Country-code:DEU
Language-code:de
Currency-code:EUR

Country-name:JAPAN
Country-code:JPN
Language-code:ja
Currency-code:JPY

Country-name:KOREA, REPUBLIC OF
Country-code:KOR
Language-code:ko
Currency-code:KRW

Country-name:UNITED KINGDOM
Country-code:GBR
Language-code:en
Currency-code:GBP


B.6.6 Output from the Dfill of (6-3) (text view) in 6.1.2

node:/html/body/table/tbody/tr[1]
th:Country-name
th:Country-code
th:Language-code
th:Currency-code

node:/html/body/table/tbody/tr[2]
th:Country-name
th:Country-code
th:Language-code
th:Currency-code
td:FRANCE
td:FRA
td:fr
td:EUR

node:/html/body/table/tbody/tr[3]
th:Country-name
th:Country-code
th:Language-code
th:Currency-code
td:GERMANY
td:DEU
td:de
td:EUR

node:/html/body/table/tbody/tr[4]
th:Country-name
th:Country-code
th:Language-code
th:Currency-code
td:JAPAN
td:JPN
td:ja
td:JPY

node:/html/body/table/tbody/tr[5]
th:Country-name
th:Country-code
th:Language-code
th:Currency-code
td:KOREA, REPUBLIC OF
td:KOR
td:ko
td:KRW

node:/html/body/table/tbody/tr[6]
th:Country-name
th:Country-code
th:Language-code
th:Currency-code
td:UNITED KINGDOM
td:GBR
td:en
td:GBP


B.6.7 Output from the Dselect of (6-3) (text view) in 6.1.2

node:/html/body/table/tbody/tr[2]
th:Country-name
th:Country-code
th:Language-code
th:Currency-code
td:FRANCE
td:FRA
td:fr
td:EUR

node:/html/body/table/tbody/tr[3]
th:Country-name
th:Country-code
th:Language-code
th:Currency-code
td:GERMANY
td:DEU
td:de
td:EUR

node:/html/body/table/tbody/tr[4]
th:Country-name
th:Country-code
th:Language-code
th:Currency-code
td:JAPAN
td:JPN
td:ja
td:JPY

node:/html/body/table/tbody/tr[5]
th:Country-name
th:Country-code
th:Language-code
th:Currency-code
td:KOREA, REPUBLIC OF
td:KOR
td:ko
td:KRW

node:/html/body/table/tbody/tr[6]
th:Country-name
th:Country-code
th:Language-code
th:Currency-code
td:UNITED KINGDOM
td:GBR
td:en
td:GBP


B.6.8 Output from the Dunbundle of (6-3) (text view) in 6.1.2

node:/html/body/table/tbody/tr[2]
th:Country-name
td:FRANCE

node:/html/body/table/tbody/tr[2]
th:Country-code
td:FRA

node:/html/body/table/tbody/tr[2]
th:Language-code
td:fr

node:/html/body/table/tbody/tr[2]
th:Currency-code
td:EUR

node:/html/body/table/tbody/tr[3]
th:Country-name
td:GERMANY

node:/html/body/table/tbody/tr[3]
th:Country-code
td:DEU

node:/html/body/table/tbody/tr[3]
th:Language-code
td:de

node:/html/body/table/tbody/tr[3]
th:Currency-code
td:EUR

node:/html/body/table/tbody/tr[4]
th:Country-name
td:JAPAN

node:/html/body/table/tbody/tr[4]
th:Country-code
td:JPN

node:/html/body/table/tbody/tr[4]
th:Language-code
td:ja

node:/html/body/table/tbody/tr[4]
th:Currency-code
td:JPY

node:/html/body/table/tbody/tr[5]
th:Country-name
td:KOREA, REPUBLIC OF

node:/html/body/table/tbody/tr[5]
th:Country-code
td:KOR

node:/html/body/table/tbody/tr[5]
th:Language-code
td:ko

node:/html/body/table/tbody/tr[5]
th:Currency-code
td:KRW

node:/html/body/table/tbody/tr[6]
th:Country-name
td:UNITED KINGDOM

node:/html/body/table/tbody/tr[6]
th:Country-code
td:GBR

node:/html/body/table/tbody/tr[6]
th:Language-code
td:en

node:/html/body/table/tbody/tr[6]
th:Currency-code
td:GBP


B.6.9 Output from the Drename of (6-3) (text view) in 6.1.2

node:/html/body/table/tbody/tr[2]
fieldname:Country-name
value:FRANCE

node:/html/body/table/tbody/tr[2]
fieldname:Country-code
value:FRA

node:/html/body/table/tbody/tr[2]
fieldname:Language-code
value:fr

node:/html/body/table/tbody/tr[2]
fieldname:Currency-code
value:EUR

node:/html/body/table/tbody/tr[3]
fieldname:Country-name
value:GERMANY

node:/html/body/table/tbody/tr[3]
fieldname:Country-code
value:DEU

node:/html/body/table/tbody/tr[3]
fieldname:Language-code
value:de

node:/html/body/table/tbody/tr[3]
fieldname:Currency-code
value:EUR

node:/html/body/table/tbody/tr[4]
fieldname:Country-name
value:JAPAN

node:/html/body/table/tbody/tr[4]
fieldname:Country-code
value:JPN

node:/html/body/table/tbody/tr[4]
fieldname:Language-code
value:ja

node:/html/body/table/tbody/tr[4]
fieldname:Currency-code
value:JPY

node:/html/body/table/tbody/tr[5]
fieldname:Country-name
value:KOREA, REPUBLIC OF

node:/html/body/table/tbody/tr[5]
fieldname:Country-code
value:KOR

node:/html/body/table/tbody/tr[5]
fieldname:Language-code
value:ko

node:/html/body/table/tbody/tr[5]
fieldname:Currency-code
value:KRW

node:/html/body/table/tbody/tr[6]
fieldname:Country-name
value:UNITED KINGDOM

node:/html/body/table/tbody/tr[6]
fieldname:Country-code
value:GBR

node:/html/body/table/tbody/tr[6]
fieldname:Language-code
value:en

node:/html/body/table/tbody/tr[6]
fieldname:Currency-code
value:GBP


B.6.10 Output from the Dcompose of (6-3) (text view) in 6.1.2

node:/html/body/table/tbody/tr[2]
Country-name:FRANCE
Country-code:FRA
Language-code:fr
Currency-code:EUR

node:/html/body/table/tbody/tr[3]
Country-name:GERMANY
Country-code:DEU
Language-code:de
Currency-code:EUR

node:/html/body/table/tbody/tr[4]
Country-name:JAPAN
Country-code:JPN
Language-code:ja
Currency-code:JPY

node:/html/body/table/tbody/tr[5]
Country-name:KOREA, REPUBLIC OF
Country-code:KOR
Language-code:ko
Currency-code:KRW

node:/html/body/table/tbody/tr[6]
Country-name:UNITED KINGDOM
Country-code:GBR
Language-code:en
Currency-code:GBP


B.6.11 Dpr HTML-table-1.d in 6.1.2

rec# Country-name       Country-code Language-code Currency-code
   1 FRANCE             FRA          fr            EUR
   2 GERMANY            DEU          de            EUR
   3 JAPAN              JPN          ja            JPY
   4 KOREA, REPUBLIC OF KOR          ko            KRW
   5 UNITED KINGDOM     GBR          en            GBP


B.6.12 Output from the Dproj of (6-5) (text view) in 6.1.3

th:Country-name
th:Country-code
th:Language-code
th:Currency-code

td:FRANCE
td:FRA
td:fr
td:EUR

td:GERMANY
td:DEU
td:de
td:EUR

td:JAPAN
td:JPN
td:ja
td:JPY

td:KOREA, REPUBLIC OF
td:KOR
td:ko
td:KRW

td:UNITED KINGDOM
td:GBR
td:en
td:GBP


B.6.13 Output from the DtoLine of (6-5) (text view) in 6.1.3

"Country-name","Country-code","Language-code","Currency-code"
"FRANCE","FRA","fr","EUR"
"GERMANY","DEU","de","EUR"
"JAPAN","JPN","ja","JPY"
"KOREA, REPUBLIC OF","KOR","ko","KRW"
"UNITED KINGDOM","GBR","en","GBP"


B.6.14 HTML-table-2.html (6-6) (source HTML) in 6.2

(This HTML source is simplified for explanation.)

<html><body>
<table border="1"><tbody>

 <tr>
  <th></th>
  <th>HIGH</th>
  <th>LOW</th>
 </tr>

 <tr>
  <th>03-25</th>
  <td>12°C</td>
  <td>2°C</td>
 </tr>

 <tr>
  <th>03-26</th>
  <td>11°C</td>
  <td>1°C</td>
 </tr>

 <tr>
  <th>03-27</th>
  <td>10°C</td>
  <td>1°C</td>
 </tr>

 <tr>
  <th>03-28</th>
  <td>10°C</td>
  <td>2°C</td>
 </tr>

</tbody></table>
</body></html>


B.6.15 Output from the DfromHtml of (6-7), (6-9) (text view) in 6.2

node:/html/body/table/tbody/tr[1]
th:
th:HIGH
th:LOW

node:/html/body/table/tbody/tr[2]
th:03-25
td:12°C
td:2°C

node:/html/body/table/tbody/tr[3]
th:03-26
td:11°C
td:1°C

node:/html/body/table/tbody/tr[4]
th:03-27
td:10°C
td:1°C

node:/html/body/table/tbody/tr[5]
th:03-28
td:10°C
td:2°C


B.6.16 Output from the Dproj of (6-7), the first and the third Dproj of (6-9), (text view) in 6.2

th:
th:HIGH
th:LOW

th:03-25
td:12°C
td:2°C

th:03-26
td:11°C
td:1°C

th:03-27
td:10°C
td:1°C

th:03-28
td:10°C
td:2°C


B.6.17 Output from the DtoLine of (6-7) (text view) in 6.2.1

"","HIGH","LOW"
"03-25","12°C","2°C"
"03-26","11°C","1°C"
"03-27","10°C","1°C"
"03-28","10°C","2°C"


B.6.18 HTML-table-2.d (6-7), (6-8), (6-9) (text view) in 6.2

:03-25
HIGH:12°C
LOW:2°C

:03-26
HIGH:11°C
LOW:1°C

:03-27
HIGH:10°C
LOW:1°C

:03-28
HIGH:10°C
LOW:2°C


B.6.19 HTML-table-2-new.d of (6-8) (text view) in 6.2.1

date:03-25
HIGH:12°C
LOW:2°C

date:03-26
HIGH:11°C
LOW:1°C

date:03-27
HIGH:10°C
LOW:1°C

date:03-28
HIGH:10°C
LOW:2°C


B.6.20 Output from the Dextract 1 of (6-9) (text view) in 6.2.2

th:
th:HIGH
th:LOW


B.6.21 Output from the first Ddecompose of (6-9) (text view) in 6.2.2

seq:1
fieldseq:0
fieldname:th
value:

seq:1
fieldseq:1
fieldname:th
value:HIGH

seq:1
fieldseq:2
fieldname:th
value:LOW


B.6.22 Outpu from the second Dproj of (6-9) (text view) in 6.2.2

fieldseq:0
value:

fieldseq:1
value:HIGH

fieldseq:2
value:LOW


B.6.23 tmp.d (6-9) (text view) in 6.2.2

fieldseq:0
fieldname:

fieldseq:1
fieldname:HIGH

fieldseq:2
fieldname:LOW


B.6.24 Output from the Dextract 2- of (6-9) (text view) in 6.2.2

th:03-25
td:12°C
td:2°C

th:03-26
td:11°C
td:1°C

th:03-27
td:10°C
td:1°C

th:03-28
td:10°C
td:2°C


B.6.25 Output from the second Ddecompose of (6-9) (text view) in 6.2.2

seq:1
fieldseq:0
fieldname:th
value:03-25

seq:1
fieldseq:1
fieldname:td
value:12°C

seq:1
fieldseq:2
fieldname:td
value:2°C

seq:2
fieldseq:0
fieldname:th
value:03-26

seq:2
fieldseq:1
fieldname:td
value:11°C

seq:2
fieldseq:2
fieldname:td
value:1°C

seq:3
fieldseq:0
fieldname:th
value:03-27

seq:3
fieldseq:1
fieldname:td
value:10°C

seq:3
fieldseq:2
fieldname:td
value:1°C

seq:4
fieldseq:0
fieldname:th
value:03-28

seq:4
fieldseq:1
fieldname:td
value:10°C

seq:4
fieldseq:2
fieldname:td
value:2°C


B.6.26 Output from the fourth Dproj of (6-9) (text view) in 6.2.2

seq:1
fieldseq:0
value:03-25

seq:1
fieldseq:1
value:12°C

seq:1
fieldseq:2
value:2°C

seq:2
fieldseq:0
value:03-26

seq:2
fieldseq:1
value:11°C

seq:2
fieldseq:2
value:1°C

seq:3
fieldseq:0
value:03-27

seq:3
fieldseq:1
value:10°C

seq:3
fieldseq:2
value:1°C

seq:4
fieldseq:0
value:03-28

seq:4
fieldseq:1
value:10°C

seq:4
fieldseq:2
value:2°C


B.6.27 Output from the Djoin of (6-9) (text view) in 6.2.2

seq:1
fieldseq:0
value:03-25
fieldname:

seq:1
fieldseq:1
value:12°C
fieldname:HIGH

seq:1
fieldseq:2
value:2°C
fieldname:LOW

seq:2
fieldseq:0
value:03-26
fieldname:

seq:2
fieldseq:1
value:11°C
fieldname:HIGH

seq:2
fieldseq:2
value:1°C
fieldname:LOW

seq:3
fieldseq:0
value:03-27
fieldname:

seq:3
fieldseq:1
value:10°C
fieldname:HIGH

seq:3
fieldseq:2
value:1°C
fieldname:LOW

seq:4
fieldseq:0
value:03-28
fieldname:

seq:4
fieldseq:1
value:10°C
fieldname:HIGH

seq:4
fieldseq:2
value:2°C
fieldname:LOW


B.6.28 HTML-table-3.html (6-10) in 6.3

(This HTML source is simplified for explanation.)

<html><body>
<table border="1"><tbody>

 <tr>
  <th rowspan="2">Year</th>
  <th rowspan="2">Month</th>
  <th colspan="2">Tokyo</th>
  <th colspan="2">Osaka</th>
 </tr>

 <tr>
  <th>Maximum Temperature</th>
  <th>Minimum Temperature</th>
  <th>Maximum Temperature</th>
  <th>Minimum Temperature</th>
 </tr>

 <tr>
  <th rowspan="3">2004</th>
  <th>Oct</th>
  <td>28°C</td>
  <td>9°C</td>
  <td>30°C</td>
  <td>9°C</td>
 </tr>

 <tr>
  <th>Nov</th>
  <td>23°C</td>
  <td>8°C</td>
  <td>24°C</td>
  <td>8°C</td>
 </tr>

 <tr>
  <th>Dec</th>
  <td>25°C</td>
  <td>0°C</td>
  <td>21°C</td>
  <td>1°C</td>
 </tr>

 <tr>
  <th rowspan="3">2005</th>
  <th>Jan</th>
  <td>19°C</td>
  <td>-1°C</td>
  <td>15°C</td>
  <td>0°C</td>
 </tr>

 <tr>
  <th>Feb</th>
  <td>19°C</td>
  <td>0°C</td>
  <td>15°C</td>
  <td>-1°C</td>
 </tr>

 <tr>
  <th>Mar</th>
  <td>19°C</td>
  <td>1°C</td>
  <td>20°C</td>
  <td>0°C</td>
 </tr>

</tbody></table>
</body></html>


B.6.29 Output from DfromHtml of (6-13) in 6.3.1

node:/html/body/table/tbody/tr[1]
th:Year
@rowspan:2
th:Month
@rowspan:2
th:Tokyo
@colspan:2
th:Osaka
@colspan:2

node:/html/body/table/tbody/tr[2]
th:Maximum Temperature
th:Minimum Temperature
th:Maximum Temperature
th:Minimum Temperature

node:/html/body/table/tbody/tr[3]
th:2004
@rowspan:3
th:Oct
td:28°C
td:9°C
td:30°C
td:9°C

node:/html/body/table/tbody/tr[4]
th:Nov
td:23°C
td:8°C
td:24°C
td:8°C

node:/html/body/table/tbody/tr[5]
th:Dec
td:25°C
td:0°C
td:21°C
td:1°C

node:/html/body/table/tbody/tr[6]
th:2005
@rowspan:3
th:Jan
td:19°C
td:-1°C
td:15°C
td:0°C

node:/html/body/table/tbody/tr[7]
th:Feb
td:19°C
td:0°C
td:15°C
td:-1°C

node:/html/body/table/tbody/tr[8]
th:Mar
td:19°C
td:1°C
td:20°C
td:0°C


B.6.30 Output from the Dproj of (6-13) in 6.3.1

th:Year
@rowspan:2
th:Month
@rowspan:2
th:Tokyo
@colspan:2
th:Sapporo
@colspan:2

th:Maximum Temperature
th:Minimum Temperature
th:Maximum Temperature
th:Minimum Temperature

th:2004
@rowspan:3
th:Oct
td:28°C
td:9°C
td:24°C
td:0°C

th:Nov
td:23°C
td:8°C
td:19°C
td:-5°C

th:Dec
td:25°C
td:0°C
td:11°C
td:-9°C

th:2005
@rowspan:3
th:Jan
td:19°C
td:-1°C
td:7°C
td:-12°C

th:Feb
td:19°C
td:0°C
td:3°C
td:-11°C

th:Mar
td:19°C
td:1°C
td:9°C
td:-11°C


B.6.31 Output from the Dcat of (6-13) in 6.3.1

seq:1
th:Year
@rowspan:2
th:Month
@rowspan:2
th:Tokyo
@colspan:2
th:Sapporo
@colspan:2

seq:2
th:Maximum Temperature
th:Minimum Temperature
th:Maximum Temperature
th:Minimum Temperature

seq:3
th:2004
@rowspan:3
th:Oct
td:28°C
td:9°C
td:24°C
td:0°C

seq:4
th:Nov
td:23°C
td:8°C
td:19°C
td:-5°C

seq:5
th:Dec
td:25°C
td:0°C
td:11°C
td:-9°C

seq:6
th:2005
@rowspan:3
th:Jan
td:19°C
td:-1°C
td:7°C
td:-12°C

seq:7
th:Feb
td:19°C
td:0°C
td:3°C
td:-11°C

seq:8
th:Mar
td:19°C
td:1°C
td:9°C
td:-11°C


B.6.32 Output from the Drename of (6-13) in 6.3.1

seq:1
td:Year
@rowspan:2
td:Month
@rowspan:2
td:Tokyo
@colspan:2
td:Sapporo
@colspan:2

seq:2
td:Maximum Temperature
td:Minimum Temperature
td:Maximum Temperature
td:Minimum Temperature

seq:3
td:2004
@rowspan:3
td:Oct
td:28°C
td:9°C
td:24°C
td:0°C

seq:4
td:Nov
td:23°C
td:8°C
td:19°C
td:-5°C

seq:5
td:Dec
td:25°C
td:0°C
td:11°C
td:-9°C

seq:6
td:2005
@rowspan:3
td:Jan
td:19°C
td:-1°C
td:7°C
td:-12°C

seq:7
td:Feb
td:19°C
td:0°C
td:3°C
td:-11°C

seq:8
td:Mar
td:19°C
td:1°C
td:9°C
td:-11°C


B.6.33 Output from the Dunbundle of (6-13) in 6.3.1

seq:1
td:Year
@rowspan:2

seq:1
td:Month
@rowspan:2

seq:1
td:Tokyo
@colspan:2

seq:1
td:Sapporo
@colspan:2

seq:2
td:Maximum Temperature

seq:2
td:Minimum Temperature

seq:2
td:Maximum Temperature

seq:2
td:Minimum Temperature

seq:3
td:2004
@rowspan:3

seq:3
td:Oct

seq:3
td:28°C

seq:3
td:9°C

seq:3
td:24°C

seq:3
td:0°C

seq:4
td:Nov

seq:4
td:23°C

seq:4
td:8°C

seq:4
td:19°C

seq:4
td:-5°C

seq:5
td:Dec

seq:5
td:25°C

seq:5
td:0°C

seq:5
td:11°C

seq:5
td:-9°C

seq:6
td:2005
@rowspan:3

seq:6
td:Jan

seq:6
td:19°C

seq:6
td:-1°C

seq:6
td:7°C

seq:6
td:-12°C

seq:7
td:Feb

seq:7
td:19°C

seq:7
td:0°C

seq:7
td:3°C

seq:7
td:-11°C

seq:8
td:Mar

seq:8
td:19°C

seq:8
td:1°C

seq:8
td:9°C

seq:8
td:-11°C


B.6.34 Output form the first Ded of (6-13) in 6.3.1

seq:1
td:Year
@rowspan:2

seq:1
td:Month
@rowspan:2

seq:1
td:Tokyo
@colspan:2

seq:1
td:Tokyo
@colspan:2

seq:1
td:Sapporo
@colspan:2

seq:1
td:Sapporo
@colspan:2

seq:2
td:Maximum Temperature

seq:2
td:Minimum Temperature

seq:2
td:Maximum Temperature

seq:2
td:Minimum Temperature

seq:3
td:2004
@rowspan:3

seq:3
td:Oct

seq:3
td:28°C

seq:3
td:9°C

seq:3
td:24°C

seq:3
td:0°C

seq:4
td:Nov

seq:4
td:23°C

seq:4
td:8°C

seq:4
td:19°C

seq:4
td:-5°C

seq:5
td:Dec

seq:5
td:25°C

seq:5
td:0°C

seq:5
td:11°C

seq:5
td:-9°C

seq:6
td:2005
@rowspan:3

seq:6
td:Jan

seq:6
td:19°C

seq:6
td:-1°C

seq:6
td:7°C

seq:6
td:-12°C

seq:7
td:Feb

seq:7
td:19°C

seq:7
td:0°C

seq:7
td:3°C

seq:7
td:-11°C

seq:8
td:Mar

seq:8
td:19°C

seq:8
td:1°C

seq:8
td:9°C

seq:8
td:-11°C


B.6.35 Output from the second Ded of (6-13) in 6.3.1

seq:1
td:Year
@rowspan:2

seq:2
td:Year
@rowspan:2

seq:1
td:Month
@rowspan:2

seq:2
td:Month
@rowspan:2

seq:1
td:Tokyo
@colspan:2

seq:1
td:Tokyo
@colspan:2

seq:1
td:Sapporo
@colspan:2

seq:1
td:Sapporo
@colspan:2

seq:2
td:Maximum Temperature

seq:2
td:Minimum Temperature

seq:2
td:Maximum Temperature

seq:2
td:Minimum Temperature

seq:3
td:2004
@rowspan:3

seq:4
td:2004
@rowspan:3

seq:5
td:2004
@rowspan:3

seq:3
td:Oct

seq:3
td:28°C

seq:3
td:9°C

seq:3
td:24°C

seq:3
td:0°C

seq:4
td:Nov

seq:4
td:23°C

seq:4
td:8°C

seq:4
td:19°C

seq:4
td:-5°C

seq:5
td:Dec

seq:5
td:25°C

seq:5
td:0°C

seq:5
td:11°C

seq:5
td:-9°C

seq:6
td:2005
@rowspan:3

seq:7
td:2005
@rowspan:3

seq:8
td:2005
@rowspan:3

seq:6
td:Jan

seq:6
td:19°C

seq:6
td:-1°C

seq:6
td:7°C

seq:6
td:-12°C

seq:7
td:Feb

seq:7
td:19°C

seq:7
td:0°C

seq:7
td:3°C

seq:7
td:-11°C

seq:8
td:Mar

seq:8
td:19°C

seq:8
td:1°C

seq:8
td:9°C

seq:8
td:-11°C


B.6.36 Output from the Dsort of (6-13) in 6.3.1

seq:1
td:Year
@rowspan:2

seq:1
td:Month
@rowspan:2

seq:1
td:Tokyo
@colspan:2

seq:1
td:Tokyo
@colspan:2

seq:1
td:Sapporo
@colspan:2

seq:1
td:Sapporo
@colspan:2

seq:2
td:Year
@rowspan:2

seq:2
td:Month
@rowspan:2

seq:2
td:Maximum Temperature

seq:2
td:Minimum Temperature

seq:2
td:Maximum Temperature

seq:2
td:Minimum Temperature

seq:3
td:2004
@rowspan:3

seq:3
td:Oct

seq:3
td:28°C

seq:3
td:9°C

seq:3
td:24°C

seq:3
td:0°C

seq:4
td:2004
@rowspan:3

seq:4
td:Nov

seq:4
td:23°C

seq:4
td:8°C

seq:4
td:19°C

seq:4
td:-5°C

seq:5
td:2004
@rowspan:3

seq:5
td:Dec

seq:5
td:25°C

seq:5
td:0°C

seq:5
td:11°C

seq:5
td:-9°C

seq:6
td:2005
@rowspan:3

seq:6
td:Jan

seq:6
td:19°C

seq:6
td:-1°C

seq:6
td:7°C

seq:6
td:-12°C

seq:7
td:2005
@rowspan:3

seq:7
td:Feb

seq:7
td:19°C

seq:7
td:0°C

seq:7
td:3°C

seq:7
td:-11°C

seq:8
td:2005
@rowspan:3

seq:8
td:Mar

seq:8
td:19°C

seq:8
td:1°C

seq:8
td:9°C

seq:8
td:-11°C


B.6.37 tmp0.d (6-13), (6-14), (6-15), (6-16), (6-17) (text view) in 6.3

seq:1
td:Year

seq:1
td:Month

seq:1
td:Tokyo

seq:1
td:Tokyo

seq:1
td:Sapporo

seq:1
td:Sapporo

seq:2
td:Year

seq:2
td:Month

seq:2
td:Maximum Temperature

seq:2
td:Minimum Temperature

seq:2
td:Maximum Temperature

seq:2
td:Minimum Temperature

seq:3
td:2004

seq:3
td:Oct

seq:3
td:28°C

seq:3
td:9°C

seq:3
td:24°C

seq:3
td:0°C

seq:4
td:2004

seq:4
td:Nov

seq:4
td:23°C

seq:4
td:8°C

seq:4
td:19°C

seq:4
td:-5°C

seq:5
td:2004

seq:5
td:Dec

seq:5
td:25°C

seq:5
td:0°C

seq:5
td:11°C

seq:5
td:-9°C

seq:6
td:2005

seq:6
td:Jan

seq:6
td:19°C

seq:6
td:-1°C

seq:6
td:7°C

seq:6
td:-12°C

seq:7
td:2005

seq:7
td:Feb

seq:7
td:19°C

seq:7
td:0°C

seq:7
td:3°C

seq:7
td:-11°C

seq:8
td:2005

seq:8
td:Mar

seq:8
td:19°C

seq:8
td:1°C

seq:8
td:9°C

seq:8
td:-11°C


B.6.38 tmp1.d (6-15) (text view) in 6.3.1

seq:1
td:Year

seq:1
td:Month

seq:1
td:Tokyo

seq:1
td:Tokyo

seq:1
td:Sapporo

seq:1
td:Sapporo


B.6.39 Output from the second Dselect of (6-15) in 6.3.1

seq:2
td:Year

seq:2
td:Month

seq:2
td:Maximum Temperature

seq:2
td:Minimum Temperature

seq:2
td:Maximum Temperature

seq:2
td:Minimum Temperature


B.6.40 Output from the Dpaste of (6-15) in 6.3.1

seq:1
td:Year
seq:2
td:Year

seq:1
td:Month
seq:2
td:Month

seq:1
td:Tokyo
seq:2
td:Maximum Temperature

seq:1
td:Tokyo
seq:2
td:Minimum Temperature

seq:1
td:Sapporo
seq:2
td:Maximum Temperature

seq:1
td:Sapporo
seq:2
td:Minimum Temperature


B.6.41 Output from the Ded of (6-15) in 6.3.1

seq:1
td:Year
seq:2

seq:1
td:Month
seq:2

seq:1
td:Tokyo
seq:2
td:Maximum Temperature

seq:1
td:Tokyo
seq:2
td:Minimum Temperature

seq:1
td:Sapporo
seq:2
td:Maximum Temperature

seq:1
td:Sapporo
seq:2
td:Minimum Temperature


B.6.42 tmp2.d (6-15), (6-16) (text view) in 6.3.1

seq:1
td:Year
seq:2

seq:1
td:Month
seq:2

seq:1
td:Tokyo Maximum Temperature
seq:2

seq:1
td:Tokyo Minimum Temperature
seq:2

seq:1
td:Sapporo Maximum Temperature
seq:2

seq:1
td:Sapporo Minimum Temperature
seq:2


B.6.43 Output from the Dselect of (6-16) (text view) in 6.3.1

seq:3
td:2004

seq:3
td:Oct

seq:3
td:28°C

seq:3
td:9°C

seq:3
td:24°C

seq:3
td:0°C

seq:4
td:2004

seq:4
td:Nov

seq:4
td:23°C

seq:4
td:8°C

seq:4
td:19°C

seq:4
td:-5°C

seq:5
td:2004

seq:5
td:Dec

seq:5
td:25°C

seq:5
td:0°C

seq:5
td:11°C

seq:5
td:-9°C

seq:6
td:2005

seq:6
td:Jan

seq:6
td:19°C

seq:6
td:-1°C

seq:6
td:7°C

seq:6
td:-12°C

seq:7
td:2005

seq:7
td:Feb

seq:7
td:19°C

seq:7
td:0°C

seq:7
td:3°C

seq:7
td:-11°C

seq:8
td:2005

seq:8
td:Mar

seq:8
td:19°C

seq:8
td:1°C

seq:8
td:9°C

seq:8
td:-11°C


B.6.44 Output from the Dcat of (6-16) (text view) in 6.3.1

seq:1
td:Year
seq:2

seq:1
td:Month
seq:2

seq:1
td:Tokyo Maximum Temperature
seq:2

seq:1
td:Tokyo Minimum Temperature
seq:2

seq:1
td:Sapporo Maximum Temperature
seq:2

seq:1
td:Sapporo Minimum Temperature
seq:2

seq:3
td:2004

seq:3
td:Oct

seq:3
td:28°C

seq:3
td:9°C

seq:3
td:24°C

seq:3
td:0°C

seq:4
td:2004

seq:4
td:Nov

seq:4
td:23°C

seq:4
td:8°C

seq:4
td:19°C

seq:4
td:-5°C

seq:5
td:2004

seq:5
td:Dec

seq:5
td:25°C

seq:5
td:0°C

seq:5
td:11°C

seq:5
td:-9°C

seq:6
td:2005

seq:6
td:Jan

seq:6
td:19°C

seq:6
td:-1°C

seq:6
td:7°C

seq:6
td:-12°C

seq:7
td:2005

seq:7
td:Feb

seq:7
td:19°C

seq:7
td:0°C

seq:7
td:3°C

seq:7
td:-11°C

seq:8
td:2005

seq:8
td:Mar

seq:8
td:19°C

seq:8
td:1°C

seq:8
td:9°C

seq:8
td:-11°C


B.6.45 Output from the Dbundle of (6-16) (text view) in 6.3.1

seq:1
td:Year
seq:2
td:Month
td:Tokyo Maximum Temperature
td:Tokyo Minimum Temperature
td:Sapporo Maximum Temperature
td:Sapporo Minimum Temperature

seq:3
td:2004
td:Oct
td:28°C
td:9°C
td:24°C
td:0°C

seq:4
td:2004
td:Nov
td:23°C
td:8°C
td:19°C
td:-5°C

seq:5
td:2004
td:Dec
td:25°C
td:0°C
td:11°C
td:-9°C

seq:6
td:2005
td:Jan
td:19°C
td:-1°C
td:7°C
td:-12°C

seq:7
td:2005
td:Feb
td:19°C
td:0°C
td:3°C
td:-11°C

seq:8
td:2005
td:Mar
td:19°C
td:1°C
td:9°C
td:-11°C


B.6.46 Output from the Dproj of (6-16) (text view) in 6.3.1

td:Year
td:Month
td:Tokyo Maximum Temperature
td:Tokyo Minimum Temperature
td:Sapporo Maximum Temperature
td:Sapporo Minimum Temperature

td:2004
td:Oct
td:28°C
td:9°C
td:24°C
td:0°C

td:2004
td:Nov
td:23°C
td:8°C
td:19°C
td:-5°C

td:2004
td:Dec
td:25°C
td:0°C
td:11°C
td:-9°C

td:2005
td:Jan
td:19°C
td:-1°C
td:7°C
td:-12°C

td:2005
td:Feb
td:19°C
td:0°C
td:3°C
td:-11°C

td:2005
td:Mar
td:19°C
td:1°C
td:9°C
td:-11°C


B.6.47 Output from the DtoLine of (6-16) in 6.3.1

Year → Month → Tokyo Maximum Temperature → Tokyo Minimum Temperature → Sapporo Maximum Temperature → Sapporo Minimum Temperature
2004 → Oct → 28°C → 9°C → 24°C → 0°C
2004 → Nov → 23°C → 8°C → 19°C → -5°C
2004 → Dec → 25°C → 0°C → 11°C → -9°C
2005 → Jan → 19°C → -1°C → 7°C → -12°C
2005 → Feb → 19°C → 0°C → 3°C → -11°C
2005 → Mar → 19°C → 1°C → 9°C → -11°C

' → ' here denotes TAB.


B.6.48 HTML-table-3.d (6-16) (text view) in 6.3.1

Year:2004
Month:Oct
Tokyo Maximum Temperature:28°C
Tokyo Minimum Temperature:9°C
Sapporo Maximum Temperature:24°C
Sapporo Minimum Temperature:0°C

Year:2004
Month:Nov
Tokyo Maximum Temperature:23°C
Tokyo Minimum Temperature:8°C
Sapporo Maximum Temperature:19°C
Sapporo Minimum Temperature:-5°C

Year:2004
Month:Dec
Tokyo Maximum Temperature:25°C
Tokyo Minimum Temperature:0°C
Sapporo Maximum Temperature:11°C
Sapporo Minimum Temperature:-9°C

Year:2005
Month:Jan
Tokyo Maximum Temperature:19°C
Tokyo Minimum Temperature:-1°C
Sapporo Maximum Temperature:7°C
Sapporo Minimum Temperature:-12°C

Year:2005
Month:Feb
Tokyo Maximum Temperature:19°C
Tokyo Minimum Temperature:0°C
Sapporo Maximum Temperature:3°C
Sapporo Minimum Temperature:-11°C

Year:2005
Month:Mar
Tokyo Maximum Temperature:19°C
Tokyo Minimum Temperature:1°C
Sapporo Maximum Temperature:9°C
Sapporo Minimum Temperature:-11°C


B.6.49 Output from the first Drename of (6-17) (text view) in 6.3.2

row:1
value:Year

row:1
value:Month

row:1
value:Tokyo

row:1
value:Tokyo

row:1
value:Sapporo

row:1
value:Sapporo

row:2
value:Year

row:2
value:Month

row:2
value:Maximum Temperature

row:2
value:Minimum Temperature

row:2
value:Maximum Temperature

row:2
value:Minimum Temperature

row:3
value:2004

row:3
value:Oct

row:3
value:28°C

row:3
value:9°C

row:3
value:24°C

row:3
value:0°C

row:4
value:2004

row:4
value:Nov

row:4
value:23°C

row:4
value:8°C

row:4
value:19°C

row:4
value:-5°C

row:5
value:2004

row:5
value:Dec

row:5
value:25°C

row:5
value:0°C

row:5
value:11°C

row:5
value:-9°C

row:6
value:2005

row:6
value:Jan

row:6
value:19°C

row:6
value:-1°C

row:6
value:7°C

row:6
value:-12°C

row:7
value:2005

row:7
value:Feb

row:7
value:19°C

row:7
value:0°C

row:7
value:3°C

row:7
value:-11°C

row:8
value:2005

row:8
value:Mar

row:8
value:19°C

row:8
value:1°C

row:8
value:9°C

row:8
value:-11°C


B.6.50 Output from the Dcat of (6-17) in 6.3.2

seq:1
row:1
value:Year

seq:2
row:1
value:Month

seq:3
row:1
value:Tokyo

seq:4
row:1
value:Tokyo

seq:5
row:1
value:Sapporo

seq:6
row:1
value:Sapporo

seq:1
row:2
value:Year

seq:2
row:2
value:Month

seq:3
row:2
value:Maximum Temperature

seq:4
row:2
value:Minimum Temperature

seq:5
row:2
value:Maximum Temperature

seq:6
row:2
value:Minimum Temperature

seq:1
row:3
value:2004

seq:2
row:3
value:Oct

seq:3
row:3
value:28°C

seq:4
row:3
value:9°C

seq:5
row:3
value:24°C

seq:6
row:3
value:0°C

seq:1
row:4
value:2004

seq:2
row:4
value:Nov

seq:3
row:4
value:23°C

seq:4
row:4
value:8°C

seq:5
row:4
value:19°C

seq:6
row:4
value:-5°C

seq:1
row:5
value:2004

seq:2
row:5
value:Dec

seq:3
row:5
value:25°C

seq:4
row:5
value:0°C

seq:5
row:5
value:11°C

seq:6
row:5
value:-9°C

seq:1
row:6
value:2005

seq:2
row:6
value:Jan

seq:3
row:6
value:19°C

seq:4
row:6
value:-1°C

seq:5
row:6
value:7°C

seq:6
row:6
value:-12°C

seq:1
row:7
value:2005

seq:2
row:7
value:Feb

seq:3
row:7
value:19°C

seq:4
row:7
value:0°C

seq:5
row:7
value:3°C

seq:6
row:7
value:-11°C

seq:1
row:8
value:2005

seq:2
row:8
value:Mar

seq:3
row:8
value:19°C

seq:4
row:8
value:1°C

seq:5
row:8
value:9°C

seq:6
row:8
value:-11°C


B.6.51 tmp3.d (6-17), (6-18) in 6.3.2

column:1
row:1
value:Year

column:2
row:1
value:Month

column:3
row:1
value:Tokyo

column:4
row:1
value:Tokyo

column:5
row:1
value:Sapporo

column:6
row:1
value:Sapporo

column:1
row:2
value:Year

column:2
row:2
value:Month

column:3
row:2
value:Maximum Temperature

column:4
row:2
value:Minimum Temperature

column:5
row:2
value:Maximum Temperature

column:6
row:2
value:Minimum Temperature

column:1
row:3
value:2004

column:2
row:3
value:Oct

column:3
row:3
value:28°C

column:4
row:3
value:9°C

column:5
row:3
value:24°C

column:6
row:3
value:0°C

column:1
row:4
value:2004

column:2
row:4
value:Nov

column:3
row:4
value:23°C

column:4
row:4
value:8°C

column:5
row:4
value:19°C

column:6
row:4
value:-5°C

column:1
row:5
value:2004

column:2
row:5
value:Dec

column:3
row:5
value:25°C

column:4
row:5
value:0°C

column:5
row:5
value:11°C

column:6
row:5
value:-9°C

column:1
row:6
value:2005

column:2
row:6
value:Jan

column:3
row:6
value:19°C

column:4
row:6
value:-1°C

column:5
row:6
value:7°C

column:6
row:6
value:-12°C

column:1
row:7
value:2005

column:2
row:7
value:Feb

column:3
row:7
value:19°C

column:4
row:7
value:0°C

column:5
row:7
value:3°C

column:6
row:7
value:-11°C

column:1
row:8
value:2005

column:2
row:8
value:Mar

column:3
row:8
value:19°C

column:4
row:8
value:1°C

column:5
row:8
value:9°C

column:6
row:8
value:-11°C


B.6.52 Output from the Dselect of (6-18) (text view) in 6.3.2

column:1
row:1
value:Year

column:2
row:1
value:Month

column:1
row:3
value:2004

column:2
row:3
value:Oct

column:1
row:4
value:2004

column:2
row:4
value:Nov

column:1
row:5
value:2004

column:2
row:5
value:Dec

column:1
row:6
value:2005

column:2
row:6
value:Jan

column:1
row:7
value:2005

column:2
row:7
value:Feb

column:1
row:8
value:2005

column:2
row:8
value:Mar


B.6.53 Output from the Dproj of (6-18) (text view) in 6.3.2

row:1
value:Year

row:1
value:Month

row:3
value:2004

row:3
value:Oct

row:4
value:2004

row:4
value:Nov

row:5
value:2004

row:5
value:Dec

row:6
value:2005

row:6
value:Jan

row:7
value:2005

row:7
value:Feb

row:8
value:2005

row:8
value:Mar


B.6.54 Output from the Dbundle of (6-18) in 6.3.2

row:1
value:Year
value:Month

row:3
value:2004
value:Oct

row:4
value:2004
value:Nov

row:5
value:2004
value:Dec

row:6
value:2005
value:Jan

row:7
value:2005
value:Feb

row:8
value:2005
value:Mar


B.6.55 Output from the Ded of (6-18) (text view) in 6.3.2

row:row
value:Year
value:Month

row:3
value:2004
value:Oct

row:4
value:2004
value:Nov

row:5
value:2004
value:Dec

row:6
value:2005
value:Jan

row:7
value:2005
value:Feb

row:8
value:2005
value:Mar


B.6.56 Output from the DtoLine of (6-18) in 6.3.2

"row","Year","Month"
"3","2004","Oct"
"4","2004","Nov"
"5","2004","Dec"
"6","2005","Jan"
"7","2005","Feb"
"8","2005","Mar"


B.6.57 tmp4.d (6-18) (text view) in 6.3.2

row:3
Year:2004
Month:Oct

row:4
Year:2004
Month:Nov

row:5
Year:2004
Month:Dec

row:6
Year:2005
Month:Jan

row:7
Year:2005
Month:Feb

row:8
Year:2005
Month:Mar


B.6.58 Output from the Dselect of (6-19) (text view) in 6.3.2

column:3
row:1
value:Tokyo

column:4
row:1
value:Tokyo

column:5
row:1
value:Sapporo

column:6
row:1
value:Sapporo

column:3
row:2
value:Maximum Temperature

column:4
row:2
value:Minimum Temperature

column:5
row:2
value:Maximum Temperature

column:6
row:2
value:Minimum Temperature


B.6.59 Output from the Ded of (6-19) (text view) in 6.3.2

column:3
row:1
place:Tokyo

column:4
row:1
place:Tokyo

column:5
row:1
place:Sapporo

column:6
row:1
place:Sapporo

column:3
row:2
property:Maximum Temperature

column:4
row:2
property:Minimum Temperature

column:5
row:2
property:Maximum Temperature

column:6
row:2
property:Minimum Temperature


B.6.60 Output from the Dproj of (6-19) (text view) in 6.3.2

column:3
place:Tokyo

column:4
place:Tokyo

column:5
place:Sapporo

column:6
place:Sapporo

column:3
property:Maximum Temperature

column:4
property:Minimum Temperature

column:5
property:Maximum Temperature

column:6
property:Minimum Temperature


B.6.61 Output from the Dsort of (6-19) (text view) in 6.3.2

column:3
place:Tokyo

column:3
property:Maximum Temperature

column:4
place:Tokyo

column:4
property:Minimum Temperature

column:5
place:Sapporo

column:5
property:Maximum Temperature

column:6
place:Sapporo

column:6
property:Minimum Temperature


B.6.62 tmp6.d (6-19) (text view) in 6.3.2

column:3
place:Tokyo
property:Maximum Temperature

column:4
place:Tokyo
property:Minimum Temperature

column:5
place:Sapporo
property:Maximum Temperature

column:6
place:Sapporo
property:Minimum Temperature


B.6.63 Output from the Dselect of (6-20) (text view) in 6.3.2

column:3
row:3
value:28°C

column:4
row:3
value:9°C

column:5
row:3
value:24°C

column:6
row:3
value:0°C

column:3
row:4
value:23°C

column:4
row:4
value:8°C

column:5
row:4
value:19°C

column:6
row:4
value:-5°C

column:3
row:5
value:25°C

column:4
row:5
value:0°C

column:5
row:5
value:11°C

column:6
row:5
value:-9°C

column:3
row:6
value:19°C

column:4
row:6
value:-1°C

column:5
row:6
value:7°C

column:6
row:6
value:-12°C

column:3
row:7
value:19°C

column:4
row:7
value:0°C

column:5
row:7
value:3°C

column:6
row:7
value:-11°C

column:3
row:8
value:19°C

column:4
row:8
value:1°C

column:5
row:8
value:9°C

column:6
row:8
value:-11°C


B.6.64 Output from the first Djoin of (6-20) (text view) in 6.3.2

column:3
row:3
value:28°C
Year:2004
Month:Oct

column:4
row:3
value:9°C
Year:2004
Month:Oct

column:5
row:3
value:24°C
Year:2004
Month:Oct

column:6
row:3
value:0°C
Year:2004
Month:Oct

column:3
row:4
value:23°C
Year:2004
Month:Nov

column:4
row:4
value:8°C
Year:2004
Month:Nov

column:5
row:4
value:19°C
Year:2004
Month:Nov

column:6
row:4
value:-5°C
Year:2004
Month:Nov

column:3
row:5
value:25°C
Year:2004
Month:Dec

column:4
row:5
value:0°C
Year:2004
Month:Dec

column:5
row:5
value:11°C
Year:2004
Month:Dec

column:6
row:5
value:-9°C
Year:2004
Month:Dec

column:3
row:6
value:19°C
Year:2005
Month:Jan

column:4
row:6
value:-1°C
Year:2005
Month:Jan

column:5
row:6
value:7°C
Year:2005
Month:Jan

column:6
row:6
value:-12°C
Year:2005
Month:Jan

column:3
row:7
value:19°C
Year:2005
Month:Feb

column:4
row:7
value:0°C
Year:2005
Month:Feb

column:5
row:7
value:3°C
Year:2005
Month:Feb

column:6
row:7
value:-11°C
Year:2005
Month:Feb

column:3
row:8
value:19°C
Year:2005
Month:Mar

column:4
row:8
value:1°C
Year:2005
Month:Mar

column:5
row:8
value:9°C
Year:2005
Month:Mar

column:6
row:8
value:-11°C
Year:2005
Month:Mar


B.6.65 Output from the second Djoin of (6-20) (text view) in 6.3.2

column:3
row:3
value:28°C
Year:2004
Month:Oct
place:Tokyo
property:Maximum Temperature

column:4
row:3
value:9°C
Year:2004
Month:Oct
place:Tokyo
property:Minimum Temperature

column:5
row:3
value:24°C
Year:2004
Month:Oct
place:Sapporo
property:Maximum Temperature

column:6
row:3
value:0°C
Year:2004
Month:Oct
place:Sapporo
property:Minimum Temperature

column:3
row:4
value:23°C
Year:2004
Month:Nov
place:Tokyo
property:Maximum Temperature

column:4
row:4
value:8°C
Year:2004
Month:Nov
place:Tokyo
property:Minimum Temperature

column:5
row:4
value:19°C
Year:2004
Month:Nov
place:Sapporo
property:Maximum Temperature

column:6
row:4
value:-5°C
Year:2004
Month:Nov
place:Sapporo
property:Minimum Temperature

column:3
row:5
value:25°C
Year:2004
Month:Dec
place:Tokyo
property:Maximum Temperature

column:4
row:5
value:0°C
Year:2004
Month:Dec
place:Tokyo
property:Minimum Temperature

column:5
row:5
value:11°C
Year:2004
Month:Dec
place:Sapporo
property:Maximum Temperature

column:6
row:5
value:-9°C
Year:2004
Month:Dec
place:Sapporo
property:Minimum Temperature

column:3
row:6
value:19°C
Year:2005
Month:Jan
place:Tokyo
property:Maximum Temperature

column:4
row:6
value:-1°C
Year:2005
Month:Jan
place:Tokyo
property:Minimum Temperature

column:5
row:6
value:7°C
Year:2005
Month:Jan
place:Sapporo
property:Maximum Temperature

column:6
row:6
value:-12°C
Year:2005
Month:Jan
place:Sapporo
property:Minimum Temperature

column:3
row:7
value:19°C
Year:2005
Month:Feb
place:Tokyo
property:Maximum Temperature

column:4
row:7
value:0°C
Year:2005
Month:Feb
place:Tokyo
property:Minimum Temperature

column:5
row:7
value:3°C
Year:2005
Month:Feb
place:Sapporo
property:Maximum Temperature

column:6
row:7
value:-11°C
Year:2005
Month:Feb
place:Sapporo
property:Minimum Temperature

column:3
row:8
value:19°C
Year:2005
Month:Mar
place:Tokyo
property:Maximum Temperature

column:4
row:8
value:1°C
Year:2005
Month:Mar
place:Tokyo
property:Minimum Temperature

column:5
row:8
value:9°C
Year:2005
Month:Mar
place:Sapporo
property:Maximum Temperature

column:6
row:8
value:-11°C
Year:2005
Month:Mar
place:Sapporo
property:Minimum Temperature


B.6.66 Output from the Dproj of (6-20) (text view) in 6.3.2

value:28°C
Year:2004
Month:Oct
place:Tokyo
property:Maximum Temperature

value:9°C
Year:2004
Month:Oct
place:Tokyo
property:Minimum Temperature

value:24°C
Year:2004
Month:Oct
place:Sapporo
property:Maximum Temperature

value:0°C
Year:2004
Month:Oct
place:Sapporo
property:Minimum Temperature

value:23°C
Year:2004
Month:Nov
place:Tokyo
property:Maximum Temperature

value:8°C
Year:2004
Month:Nov
place:Tokyo
property:Minimum Temperature

value:19°C
Year:2004
Month:Nov
place:Sapporo
property:Maximum Temperature

value:-5°C
Year:2004
Month:Nov
place:Sapporo
property:Minimum Temperature

value:25°C
Year:2004
Month:Dec
place:Tokyo
property:Maximum Temperature

value:0°C
Year:2004
Month:Dec
place:Tokyo
property:Minimum Temperature

value:11°C
Year:2004
Month:Dec
place:Sapporo
property:Maximum Temperature

value:-9°C
Year:2004
Month:Dec
place:Sapporo
property:Minimum Temperature

value:19°C
Year:2005
Month:Jan
place:Tokyo
property:Maximum Temperature

value:-1°C
Year:2005
Month:Jan
place:Tokyo
property:Minimum Temperature

value:7°C
Year:2005
Month:Jan
place:Sapporo
property:Maximum Temperature

value:-12°C
Year:2005
Month:Jan
place:Sapporo
property:Minimum Temperature

value:19°C
Year:2005
Month:Feb
place:Tokyo
property:Maximum Temperature

value:0°C
Year:2005
Month:Feb
place:Tokyo
property:Minimum Temperature

value:3°C
Year:2005
Month:Feb
place:Sapporo
property:Maximum Temperature

value:-11°C
Year:2005
Month:Feb
place:Sapporo
property:Minimum Temperature

value:19°C
Year:2005
Month:Mar
place:Tokyo
property:Maximum Temperature

value:1°C
Year:2005
Month:Mar
place:Tokyo
property:Minimum Temperature

value:9°C
Year:2005
Month:Mar
place:Sapporo
property:Maximum Temperature

value:-11°C
Year:2005
Month:Mar
place:Sapporo
property:Minimum Temperature


B.6.67 HTML-table-3a.d (6-20) (text view) in 6.3.2

Year:2004
Month:Oct
place:Tokyo
property:Maximum Temperature
value:28°C

Year:2004
Month:Oct
place:Tokyo
property:Minimum Temperature
value:9°C

Year:2004
Month:Oct
place:Sapporo
property:Maximum Temperature
value:24°C

Year:2004
Month:Oct
place:Sapporo
property:Minimum Temperature
value:0°C

Year:2004
Month:Nov
place:Tokyo
property:Maximum Temperature
value:23°C

Year:2004
Month:Nov
place:Tokyo
property:Minimum Temperature
value:8°C

Year:2004
Month:Nov
place:Sapporo
property:Maximum Temperature
value:19°C

Year:2004
Month:Nov
place:Sapporo
property:Minimum Temperature
value:-5°C

Year:2004
Month:Dec
place:Tokyo
property:Maximum Temperature
value:25°C

Year:2004
Month:Dec
place:Tokyo
property:Minimum Temperature
value:0°C

Year:2004
Month:Dec
place:Sapporo
property:Maximum Temperature
value:11°C

Year:2004
Month:Dec
place:Sapporo
property:Minimum Temperature
value:-9°C

Year:2005
Month:Jan
place:Tokyo
property:Maximum Temperature
value:19°C

Year:2005
Month:Jan
place:Tokyo
property:Minimum Temperature
value:-1°C

Year:2005
Month:Jan
place:Sapporo
property:Maximum Temperature
value:7°C

Year:2005
Month:Jan
place:Sapporo
property:Minimum Temperature
value:-12°C

Year:2005
Month:Feb
place:Tokyo
property:Maximum Temperature
value:19°C

Year:2005
Month:Feb
place:Tokyo
property:Minimum Temperature
value:0°C

Year:2005
Month:Feb
place:Sapporo
property:Maximum Temperature
value:3°C

Year:2005
Month:Feb
place:Sapporo
property:Minimum Temperature
value:-11°C

Year:2005
Month:Mar
place:Tokyo
(6-20) property:Maximum Temperature
value:19°C

Year:2005
Month:Mar
place:Tokyo
property:Minimum Temperature
value:1°C

Year:2005
Month:Mar
place:Sapporo
property:Maximum Temperature
value:9°C

Year:2005
Month:Mar
place:Sapporo
property:Minimum Temperature
value:-11°C


B.6.68 Sample homepage in 6.4.2

Data Processing Utility

What is D?

D is a tool for data processing. It is a series of command line interface commands that perform file operations such as selection, projection, sort, join, bundling and unbundling, on D-files.


Some frequently used D commands

DselectSelection by a conditional expression
DprojProjection
DsortSorting by key values
DjoinJoin/matching of D-files by key values
DbundleVertical merge of D-records by key values
DunbundleSlicing D-records with a repeating group

Version history of D

VersionDatePlatforms
Version 2.5Jul 10, 2008Windows, Unix/Linux/Mac OS X
Version 2.4Nov 22, 2007Windows, Unix/Linux/Mac OS X
Version 2.3Mar 29, 2007Windows, Unix
Version 2.2Nov 11, 2004Windows, Solaris, SunOS4, Linux
Version 2.1Jun 2, 2004Windows, Solaris, SunOS4, Linux
Version 2.0Jul 3, 2003WIndows, Solaris, SunOS4
Version 1Unpublished 1993SunOS

B.6.69 sample-homepage.html (HTML source) in 6.4.2

Some of the style definitions are not shown here.

<html>
<body>
<div>
<table width="100%" cellspacing="0" cellpadding="0">
<col width="15%" />
<col width="85%" />

<tbody>
<tr>
<td colspan="2"><h1>
<img src="D.ico" width="64px" height="64px" style="vertical-align: middle">
 Data Processing Utility</h1></td>
</tr>
<tr>
  <td style="vertical-align: top; padding-top: 30px">
  <div class="leftpart">
  <ul>
    <li><a href="http://research.nii.ac.jp/~miyazawa/D/eng/archivedv.html">Downloads</a></li>
    <li><a href="http://research.nii.ac.jp/~miyazawa/D/man/eng/index.html">Documentation</a></li>
    <li><a href="http://research.nii.ac.jp/~miyazawa/D/eng/faq.html">FAQ</a></li>
  </ul>
  </div>
  </td>
  <td>
  <div class="mainpart" >
  <div id="what_is_D">
  <h2>What is D?</h2>

  <p>
  <b>D</b> is a tool for data processing.
  It is a series of command line interface commands
  that perform file operations
  such as <b>selection</b>, <b>projection</b>, <b>sort</b>,
  <b>join</b>, <b>bundling</b> and <b>unbundling</b>,
  on <b>D-files</b>.
  </p>
  
  </div>
  <hr/>
  <h2>Some frequently used D commands</h2>
  <table border="1">

    <tbody>
    <tr><th>Dselect</th><td>Selection by a conditional expression</td></tr>
    <tr><th>Dproj</th><td>Projection</td></tr>
    <tr><th>Dsort</th><td>Sorting by key values</td></tr>
    <tr><th>Djoin</th><td>Join/matching of D-files by key values</td></tr>
    <tr><th>Dbundle</th><td>Vertical merge of D-records by key values</td></tr>
    <tr><th>Dunbundle</th><td>Slicing D-records with a repeating group</td></tr>
    </tbody>
  </table>
  <hr/>
  
  <div id="version_history">
  <h2>Version history of D</h2>
  <table border="1" style="margin-left: 10">
    <thead><tr><th>Version</th><th>Date</th><th>Platforms</th></tr></thead>
    <tbody>
    <tr><td>Version 2.5</td><td>Jul 10, 2008</td><td>Windows, Unix/Linux/Mac OS X</td></tr>
    <tr><td>Version 2.4</td><td>Nov 22, 2007</td><td>Windows, Unix/Linux/Mac OS X</td></tr>
    <tr><td>Version 2.3</td><td>Mar 29, 2007</td><td>Windows, Unix</td></tr>
    <tr><td>Version 2.2</td><td>Nov 11, 2004</td><td>Windows, Solaris, SunOS4, Linux</td></tr>
    <tr><td>Version 2.1</td><td>Jun 2, 2004</td><td>Windows, Solaris, SunOS4, Linux</td></tr>
    <tr><td>Version 2.0</td><td>Jul 3, 2003</td><td>WIndows, Solaris, SunOS4</td></tr>
    <tr><td>Version 1</td><td>Unpublished 1993</td><td>SunOS</td></tr>
    </tbody>
  </table>

  </div>
  </div>
  </td>
</tr>
</tbody>

</table>
</div>
</body>
</html>