• No results found

Nine. Chapter. A Reporting Tool Using Programming by Example for Format Designation. Tetsuya Masuishi. Nobuo Takahashi. Hitachi, Ltd.

N/A
N/A
Protected

Academic year: 2021

Share "Nine. Chapter. A Reporting Tool Using Programming by Example for Format Designation. Tetsuya Masuishi. Nobuo Takahashi. Hitachi, Ltd."

Copied!
16
0
0

Full text

(1)

Chapter

Nine

A Reporting Tool Using

Programming by

Example for Format

Designation

Tetsuya Masuishi

Hitachi, Ltd.

Nobuo Takahashi

Hitachi, Ltd.

S R L

(2)

ABSTRACT

This chapter describes a report tool in which report formats are designated by PBE-like (programming by example)operations. Users specify a sample layout of an example row of relational table data on a sheet and select an it-eration pattern of the sample layout. The tool extracts a set of general for-matting rules from the sample layout. The rules consist of absolute posi-tions of noniterative data, relative posiposi-tions of iterative data, the iteration pattern, and the increment of the iteration. The tool interprets the rules and generates new reports of the format for different table data.

9.1

Introduction

Data warehouse technologies have enabled centralized data management for decision support and planning applications. The decision makers print various formats of reports based on the data of the centralized database. Many end users, sometimes decision makers themselves, have to design the report formats, since the formats represent the view of the data and cause considerable effects on the decision. Such reports for decision making in Ja-pan are reconstructed table-style reports that include instance text strings and numerical data, while most of such reports in the states include graphs that already imply analysis of the results.

The reconstruction is needed because relational tables in practical use usually have many columns. (We have assumed the data are stored in a re-lational database.)The reconstruction is applied so that several columns of data can fit within the width of the paper. It is difficult to grasp reports that exceed both of the width and the height of the paper. Since the number of rows of tables is usually big enough to exceed the height of the paper, we need to reconstruct the relational table to make reports of many pages flow in one direction that we can handle easily. Figure 9.1 shows an example of a Japanese-style reconstructed table report. Japanese reports usually include many ruled lines to separate adjacent data, rather than tabulation spaces, perhaps because Japanese words are not separated by spaces.

Many software packages called reporting tools support such reconstruc-tion. Reporting tools usually have a scripting language to make programs. A program generates a report of a fixed format by embedding various data of a relational database.

TNT Job Number:[002564]Author:[Lieberman]Page:176

S R L

V:\002564\002564.VP

(3)

This chapter describes the user interface of a report tool that desig-nates formats of reports. The user interface is designed in a programming-by-example (PBE)manner (Cypher 1993; Myers 1992). A user creates a sam-ple report for examsam-ple table data. The tool extracts the implied formatting rules. The tool interprets the rules to generate reports reading relational ta-ble data as input. The extraction process is deterministic and does not in-clude any statistical recognition or learning process.

Sugiura and Koseki (1996)show a data entry system from email text into a database. The system generates a macro program that reads email text, extracts data from the text, and inserts the data into database. A generaliza-tion process is employed to generate a general–purpose macro program from a history of sample operations. Our problem is easier because the in-put is a structured table in a database, not email text in natural language.

Chapter Nine: A Reporting Tool Using Programming by Example 177

S R L

Figure

9.1

Reconstruction Relational Table Data

No Name Sex Balance Address

Taro Suzuki M 890 Kashimada, Saiwai, Kawasaki Hanako Sato . . . . . . . . . . . . . F 549-6 Shinano-cho,Totsuka,Yo.. $ 88.75 0 1 2 3

Taro Suzuki Balance $ 88.75

Hanako Sato

Address 549-6 Shinano-cho,Totsuka,Yo..

Address

Balance

Address 890 Kashimada, Saiwai, Kawasaki 0 Balance

1

2

3 . . .

(4)

Instead, our system employs a simple generalization process for just one example.

Myers (1991)uses just one example for text formatting. The generaliza-tion process includes parsing the example text special words (e.g., Chapter,

Section, and Appendix), numbers, separators, and decorations (e.g., lines

and boxes). The parsing process encounters ambiguity. Our problem is well structured enough to make the system deterministic and easy to use.

9.2

System Overview

The reporting tool is used in two phases, the (1)format-making phase and the (2)report-generating phase. The two phases can be done by different users, and some users may do just the latter phase.

Making formats: In this phase, a user makes a format, not a report.

Con-ventional reporting tools do not require table data for making formats, but this tool requires table data to make a sample report. (Users always need table data even for the usual tools used when they “debug” their formats.)The tool extracts a set of formatting rules and stores them in a persistent file called a format file.

Generating reports: Other users generate reports by specifying a format

file and table data. Table data can be specified by a file name if the data are stored in a file such as in CSV (Comma Separated Value)file format or a set of retrieval statements such as select statements in SQL (Struc-tured Query Language)for a connected relational database.

9.2.1

System Configuration

The tool consists of the Format Editor, which enable users to edit interac-tively to make format files, and the Report Generator, which allows users to generate reports by specifying a format file and relational table data (Fig. 9.2). The Format Editor is an interactive editor for a user to make a sample report using a set of relational table data, extract a set of formatting rules, and save them into a format file. (A format file is a conventional file that in-cludes a set of formatting rules in our proprietary file format.)The editor reads a format file and example table data.

TNT Job Number:[002564]Author:[Lieberman]Page:178

S R L

V:\002564\002564.VP

(5)

9.3

User Interface of Format Editor

We have employed a PBE-like user interface for the Format Editor. A user makes a sample report to make formatting rules, without needing to specify general formatting rules directly. The set of rules works as a program that generates reports for other sets of relational table data. So, the process of the format editor is a kind of programming by example. Since some of the rules are specified directly by the user for practical use, the process is a sim-ple and practical version of PBE.

9.3.1

Window Configuration

The Format Editor consists of two main windows: the Sheet window and the

Table Data window. The Sheet window shows the sample report as a sheet

image. The Table Data window shows the example table data as a relational table image. The user can copy and paste table data (both numerical and string)to the Sheet window.

Chapter Nine: A Reporting Tool Using Programming by Example 179

S R L

Figure

9.2

Example Relational table data

Format editor

Format file

Relational table data

Report generator Report Specifying a format and table data Making a sample report System configuration.

(6)

The editing scheme of the Sheet window is as follows: 1. Put objects on the Sheet window.

2. Specify iterative objects, called a block. 3. Specify iteration pattern for the block. 4. Specify increment of the iteration.

The objects on the Sheet window consist of a fixed text string, including col-umn names; functions; ruled lines; and example data. Any text strings can be put on the Sheet window, and usual text string attributes such as fonts can be specified. The user can also copy and paste useful column names from the Table Data window to the Sheet window. Some built-in functions are provided (e.g., date, time, etc.); they work as variables. Ruled lines can be drawn on the Sheet window, and usual line attributes such as width and pattern can be specified.

When starting up the Format Editor, a default example row—the first row—is highlighted on the Table Data window. The user can change the ex-ample row by clicking the mouse button. Multiple exex-ample rows can be se-lected for special cases. For example, seven example rows are necessary to make a report showing weekly trends generated from daily table data.

9.3.2

Specifying Iteration

The system makes a report by iterating a print of a specified set of objects with a fixed increment of position. The user specifies which object is itera-tive or not. A rectangular area that surrounds the iteraitera-tive objects is called a

block. The user can specify iterative objects by specifying a block by a

rect-angular rubber band of the mouse.

The system also provides iteration patterns, some of which are shown in Figure 9.3. The user chooses a pattern from the menu of the provided pat-terns. The increment of position for the iteration can be specified in two ways: the user can specify the increment directly, or the system can calcu-late the increment when the user put in data other than those from the ex-ample row(s)(Fig. 9.4).

The Sheet window displays the final image of the sample report, which includes iterated images of the iterative objects. The iterated images are produced by the example table data of the corresponding rows, which are calculated by incrementing the row numbers of the specified example row(s)by the number of the example row(s), typically one.

TNT Job Number:[002564]Author:[Lieberman]Page:180

S R L

V:\002564\002564.VP

(7)

S R L

Figure

9.3

Block Block Bl ock Block

Examples of iteration patterns.

Figure

9.4

C1 D1[0] C2 D2[0] Block C1 D1[1] C2 D2[1] C3 D3[1] C1 D1[2] C3 D3[2] C1 D1[3] C2 D2[3] C3 D3[3] Calculated Increment Sheet window Sample placement of other data than the example row Table window C1 C2 C3 D3[0] D2[0] D1[0] D3[1] D2[1] D1[1] D3[2] D2[2] D1[2] D3[3] D2[3] D3[5] D2[4] D1[4] D1[3] D3[0] Example Row C3

(8)

9.3.4

Adjustment

After the image of the sample report is displayed, some adjustments can be made to create sophisticated reports. For example, conditions for page and column breaks can be specified. The typical condition is “When the data of the specified column change, create a new page.” Also, when a col-umn has repeatedly occurring data, they may be unified (Fig. 9.5).

9.4

Extracting Formatting Rules

The Format Editor stores a set of formatting rules for a sample report. For-matting rules consist of the following information:

• the list of objects on the sheet,

• information about the block, including its absolute position and size;

TNT Job Number:[002564]Author:[Lieberman]Page:182

S R L

Figure

9.5

C1 C2 C3 X C2[0] C3[0] C4[0] C5[0] C4 C5 C2[1] C3[1] C4[1] C5[1] C2[2] C3[2] C4[2] C5[2] C2[3] C3[3] C4[3] C5[3] X X Y C1 C2 C3 C2[0] C3[0] C4[0] C5[0] C4 C5 C2[1] C3[1] C4[1] C5[1] C2[2] C3[2] C4[2] C5[2] C2[3] C3[3] C4[3] C5[3] X Y

Unification of repeatedly occurring data.

V:\002564\002564.VP

(9)

• the attributes of noniterative objects and their absolute position on the sheet;

• the attributes of iterative objects, including, for example data, (1)col-umn name, (2)relative row displacement in the example table from the base of the example row, and (3)relative position in the sheet from the base position of the block, and, for other objects, (1)their attributes and (2)relative position in the sheet from the base position of the block (delta X and delta Y);

• the specified iteration pattern and the increment; and • specified adjustments.

9.5

Generating Reports

When a format file and a set of table data are given to the Report Gener-ator, it creates a report according to the algorithm, briefly described as follows:

1. Put the entire noniterative object on the sheet.

2. Iterate the following substep for all rows of the table data: Put all of the iterative objects at the current position, substituting the example data to the given table data at the current row of the iteration.

3. Apply any adjustments.

9.6

Example of the Process

We describe here an example of how the system works, starting with making a format. Figure 9.6 shows the window status of the Format Editor just after the user has specified an example data file. The Table Data window displays the example data as a table. The Sheet window displays an empty sheet on which the user is drawing an example report.

The user draws an example report on the sheet window by copying and pasting objects from the Table Data window to the Sheet window (Figs. 9.7

Chapter Nine: A Reporting Tool Using Programming by Example 183

S R L

(10)

TNT Job Number:[002564]Author:[Lieberman]Page:184

S R L

Sheet Window

Table Data Window

Tetsuya Masuishi

1 M Machida, Japan

Name

No. Sex Balance Address

Nobuo Takahashi 2 M Yokohama, Japan Keiko Tanikawa 3 F Suginami, Japan Shiho Kojima 4 F Kawasaki, Japan $55.00 $10.00 $ 0.00 $10.00

Represents

example data

Represents

resulting

report image

for example data

Format editor.

Copy and paste.

Sheet Window

Copy & paste

example data

Table Data Window

Tetsuya Masuishi

Tetsuya Masuishi

1 M Machida, Japan

Name

No. Sex Balance Address

Nobuo Takahashi 2 M Yokohama, Japan Keiko Tanikawa 3 F Suginami, Japan Shiho Kojima 4 F Kawasaki, Japan $55.00 $10.00 $ 0.00 $10.00

Example

row

Figure

9.7

V:\002564\002564.VP Wednesday, December 20, 2000 9:37:10 AM

(11)

and 9.8). The objects include the table data of the example row and column header. The Sheet window works as a usual drawing program (Fig. 9.9). The user can put text strings directly from the keyboard and draw lines using the mouse.

When the user has finished editing the block, the next thing to do is specifying the iteration. The user changes the Format Editor to the itera-tion mode and specifies the block and the iteraitera-tion displacement with the mouse (Fig. 9.10). He or she can imply the iteration by copy-and-pasting the other data from the example row (Fig. 9.11). This implication does not re-quire that the user change the editor mode.

When the user sees the example report image on the Sheet window, the user saves the format to a file, as one usually does in drawing programs. The

Chapter Nine: A Reporting Tool Using Programming by Example 185

S R L

Figure

9.8

Table Data Window

Tetsuya Masuishi

1 M Machida, Japan

Name No.

No.

Sex Balance Address

Nobuo Takahashi 2 M Yokohama, Japan Keiko Tanikawa 3 F Suginami, Japan Shiho Kojima 4 F Kawasaki, Japan $55.00 Tetsuya Masuishi 1 Address Balance $55.00 $10.00 $ 0.00 $10.00

Many things are

copied to the sheet

Column header

can also be copied

Sheet Window

(12)

TNT Job Number:[002564]Author:[Lieberman]Page:186 S R L Tetsuya Masuishi 1 M Machida, Japan Name

No. Sex Balance Address

Nobuo Takahashi 2 M Yokohama, Japan Keiko Tanikawa 3 F Suginami, Japan Shiho Kojima 4 F Kawasaki, Japan $55.00 Tetsuya Masuishi Address Balance $55.00 $10.00 $ 0.00 $10.00

Copy and paste

again

1 Machida, Japan

Reshape

Color

Sheet Window

Edit on the Sheet window.

Sheet Window

Table Data Window

Tetsuya Masuishi

1 M Machida, Japan

Name

No. Sex Balance Address

Nobuo Takahashi 2 M Yokohama, Japan Keiko Tanikawa 3 F Suginami, Japan Shiho Kojima 4 F Kawasaki, Japan $55.00 $10.00 $ 0.00 $10.00

Block

Iteration

Displacement

Keiko Tanikawa Address Balance $ 0.00 3 Suginami, Japan Tetsuya Masuishi Address Balance $55.00 1 Machida, Japan Nobuo Takahashi Address Balance $10.00 2 Yokohama, Japan

After changing the Format Editor to the “iteration mode”, specify the block and the iteration displacement by the mouse.

Figure

9.10

Specifying iteration.

V:\002564\002564.VP

(13)

Format Editor extracts the format rules from the example report (Fig. 9.12) and save the rules to the file.

The extracted formatting rule works as a report generation program. Fig-ure 9.13 shows a pseudo-expression of the formatting rules in C-like lan-guage. Another user can apply the formatting rules in the file to other data and generate another report (Fig. 9.14).

9.7

Evaluation

We have applied the system described here to a real project at a Japanese company. End users and information technology (IT)staff there have devel-oped more than five hundred formats. The applied formats include the

following: S

R L

Sheet Window

Table Data Window

Tetsuya Masuishi

1 M Machida, Japan

Name

No. Sex Balance Address

Nobuo Takahashi 2 M Yokohama, Japan Keiko Tanikawa 3 F Suginami, Japan Shiho Kojima 4 F Kawasaki, Japan $55.00 $10.00 $ 0.00 $10.00 Keiko Tanikawa Address Balance $ 0.00 3 Suginami, Japan Tetsuya Masuishi Address Balance $55.00 1 Machida, Japan Nobuo Takahashi Address Balance $10.00 2 Yokohama, Japan

Data of another

rowimplies the

iteration displacement

Figure

9.11

Implication of iteration.

(14)

TNT Job Number:[002564]Author:[Lieberman]Page:188 S R L

Figure

9.12

Keiko Tanikawa Address Balance $ 0.00 3 Suginami, Japan Tetsuya Masuishi Address Balance $55.00 1 Machida, Japan Nobuo Takahashi Address Balance $10.00 2 Yokohama, Japan

For example rowdata:

column name, position,

size, color, etc.

For rowdata other

than example row,

displacement

(delta X, delta Y)

For column header:

character string,

position, size, color, etc.

Sheet Window

Extracted information.

Pseudo-expression of formatting rules.

Sheet Window Name[2] “Address” “Balance” Address[2] Name[0] “Address” “Balance” Balance[0] Address[0] Name[1] “Address” “Balance” Address[1] Balance[1] Balance[2] No. [2] No. [0] No. [1]

Figure

9.13

V:\002564\002564.VP Wednesday, December 20, 2000 9:37:36 AM

(15)

Reports for planning and decision making—sales reports for sales

per-sons and divisions, sales reports for products and areas, and cost reports for products

Mission-critical forms—monthly reports to customers, bills, and

in-house order forms

Images—employee files including facial photo images and price lists

with product photo images

We have been informed that staff could make all the formats using the For-mat Editor. They required using some functions for more detailed presenta-tion, such as round corners for crossing ruled lines.

Chapter Nine: A Reporting Tool Using Programming by Example 189

S R L Address Boston, MA Sheet Window Susan Stevens Address Balance $ 5.00 3 San Francisco, CA Thomas Williams Address Balance $150.00 1 NewOrleans, LA John Smith Address Balance $20.00 2 Boston, MA Sheet Window Name[2] “Address” “Balance” No. [2] Address[2] Name[0] “Address” “Balance” Balance[0] No. [0] Address[0] Name[1] “Address” “Balance” No. [1] Address[1] Balance[1] Balance[2]

Formatting rules

Resulting

Report

Thomas Williams 1 M NewOrleans, LA Name

No. Sex Balance Address

John Smith 2 M Susan Stevens 3 F San Francisco, CA Mary Mayfield 4 F Los Angeles, CA $150.00 $20.00 $ 5.00 $ 0.00

Data

Boston, MA

Figure

9.14

(16)

End users could make report formats as well as IT people–there was no difference between the two groups’ products. End users, who usually does not make general programs, could also make report formats that generate many reports according to data. This result indicates that the PBE paradigm worked well at this evaluation site.

9.8

Conclusion

We have designed the extraction process to be deterministic for practical use. The system extracts formatting rules deterministically, not statistically. Just one sample report is needed for extracting general formatting rules. To make this possible, some generating information, such as iteration, can be specified directly. This design was possible because the problem of generat-ing reports from relational table data is well structured.

References

Cypher, Allen, ed. 1993. Watch what I do: Programming by demonstration. Cam-bridge, Mass.: MIT Press.

Myers, Brad A. 1991. Text formatting by demonstration. In Proceedings CHI.

———. 1992. Demonstrational interfaces: A step beyond direct manipulation. IEEE

Computer (August): 61–73.

Sugiura, A., and Y. Koseki. 1996. Simplifying macro definition in programming by demonstration. In Proceedings UIST.

TNT Job Number:[002564]Author:[Lieberman]Page:190

S R L

V:\002564\002564.VP

Figure

Figure 9.4 C1 D1[0] C2 D2[0] Block C1 D1[1] C2 D2[1] C3 D3[1] C1 D1[2] C3 D3[2] C1 D1[3] C2 D2[3] C3 D3[3] Calculated Increment Sheet window Sample placement ofother data than theexample row Table windowC1C2 C3 D3[0]D2[0]D1[0]D3[1]D2[1]D1[1]D3[2]D2[2]D1[2]
Table Data Window
Table Data Window
Table Data Window

References

Related documents

5:00 AM 5:30 AM 6:00 AM 6:30 AM 7:00 AM 7:30 AM 8:00 AM 8:30 AM 9:00 AM 9:30 AM 10:00 AM 10:30 AM 11:00 AM 11:30 AM 12:00 PM 12:30 PM 1:00 PM 1:30 PM 2:00 PM 2:30 PM 3:00 PM 3:30

To mitigate the conflict between the mining company and gold panners from the neighbouring villages, a mutually negotiated agreement between the management of the Ity mine and

Through the experimental results, we validated that the IIFDL improved root-mean-square error (RMSE) by 29.98% and prediction overshoot by 70.93%, compared with existing methods.

The Chloride Mass Balance (CMB) method was used to obtain long-term recharge values for the Santa Susana Field Laboratory (SSFL) site, which features a groundwater flow system

The aims of this project is to develop a smart charging controller to enable controlled charging of electrical vehicles without overloading the grid (G2V), reduce the

Setting up your first basic store: This chapter covers creating a first basic store with Shopify and introduces the admin, where you’ll develop and run your store8. The key

PM 2.5 R&P TEOM 1400a Method 701 Method 702 TEOM 50ºC Gravimetric Continuous Toxics Canister Method 150 GC/MS 1 in 6 days Carbonyl DNPH Cartridge Method 202 HPLC

Cybersecurity is a key area of risk management for businesses and organizations, and has been demonstrated to affect information systems early in the life cycle

● SIB (scale, index, base) byte ── when the addressing-mode specifier indicates that an index register will be used to compute the address of an operand, an SIB byte

Model attack patterns CAPEC Attack pattern models CAPEC attack patterns CAPEC attack domain categories STRIDE threat categories Target-based refinements Relevant attack

Samer, a displaced Syrian barber, has taken refuge along with his young family in the Zaatari Refugee Camp in Jordan.. Despite filling his time with meaningful work, caring for

Facet joint arthropathy - osteophyte formation and distortion of joint alignment MRI Axial T2 L3-L4 disk Psoas Paraspinal muscles Psoas Paraspinal NP AF MRI Axial T2 PACS, BIDMC

Social support, self-esteem, and self-efficacy will have indirect relationships with the academic performance of double orphans in Shan State, Myanmar such that

Namun begitu, penyimpangan tingkah laku membawa pengertian negatif sebagaimana yang dijelaskan oleh Robinson dan Bennett (1995) bahawa penyimpangan tingkah laku merupakan

The relevant facts were: (1) Craig was driving a crew member home at the time of the accident; (2) Craig used his personal vehicle to drive his crew to the oil rig site and back;

The Republic of Argentina (Republic) appeals from the district court’s orders of attachment and execution (Thomas P. Griesa, Judge) entered in late 2008 over Argentine social

N/A  NOT  Satisfied  8:00 AM  9:00 AM  186  149  10:00 AM  11:00 AM  50  42  11:00 AM  12:00 PM  73  76  12:00 PM  1:00 PM  134  99  2:00 PM  3:00 PM  75  59 

Featuring open edge computing platforms, the IG502 is capable of data optimization, real-time response, agile connection and intelligent analysis on the IoT edge, thus

Networking Break 10:00 – 10:30 Luncheon Break 12:00 – 1:00 Networking Break 2:30 – 3:00 Case sTuDY January 19 – 21, 2016 yellowkniFe, nt. Human

GTA firewall with static IP address Advanced Identity <EMAIL ADDRESS>,  firewall1@example.com Remote Gateway 00.00.00.00 Network

Mathematics/Computer Science: 6-8 credits Any MAT General Education course Any CIS General Education course Wellness & Exercise Sci.: 3 credits WEX 101 and WEX-DHF-EXP

Lower Division Certificate in Cybersecurity – Network Security (Approved 01-22-13) The certificate programs are designed for students interested in network security. Lower