Graphical database access

Abstract: A graphical interface for a database is provided to simplify the definition of individual predicates, the definition of the relationship of predicates, the editing of predicates, and the editing of the relationship of predicates is simplified. The interface is dynamic and interactive for the user thereby facilitating the completion of the task being performed. The user need not remember the related column information for a specified predicate because the system will provide that information simultaneously with the predicate definition in a form that supports the direct manipulation of the related information. The predicates and their relationship are displayed simultaneously with the definition activities for both the initial definition and any subsequent editing activities. The user may select this information and drag it to the desired location to proceed on the desired activity.

Description: The present invention relates to database access, and in particular to a graphical technique for improving database queries and the like. Databases have become the subject of significant recent interest, not only because of the increasing volume of data being stored and retrieved by computerized databases but also by virtue of the data relationships which can be established during the storage and retrieval processes. Structured Query Language (SQL), and in particular ANSI SQL, has become a preferred language for communicating queries to relational databases. As a consequence, there presently exist thousands of relational databases and thousands of related queries directed to such databases. Given the investment in such databases and queries, migration is not only a desirable feature, but a substantially necessary capability for new relational database systems and methods. The concept of portraying a query in a graphical depiction on a display screen of a workstation is a relatively new approach to relational database interfacing. Visual queries, often referred to as graphical queries, utilize workstation graphics to represent query objectives heretofore defined by SQL statements. A visual query presents a pictorial depiction of the objectives of a search, thereby eliminating any need for a user to learn a query language, improving the rate at which SQL queries can be formulated, and reducing the defect or error rate of queries. Queries which obtain information from relational databases are conventionally defined with ANSI standard Structure Query Language (SQL) statements. These statements define in computer recognizable terms the tables from which the data is to be extracted, the columns of interest, the conditions rows must satisfy, what columns are to be included, how the select columns are to be grouped, the order of the columns, distinctiveness constraints in the columns, connections of data within tables, and lower level or subqueries to be integrated into the base queries. A simple text describing SQL and its uses appears in the IBM Operating Systems/2 Extended Edition Database Manager Structured Query Language (SQL) Concepts booklet published by IBM Corporation in 1991. In addition to the ANSI standard SQL statements, there exist a number of nonstandard SQL statements within the relational database community. Thus, any bidirectional translation resource must have the diversity of structure to interface a broad spectrum of relational database SQL language variances. With the growing prevalence of relational databases, communication networks and workstations, the training and experience of a representative system user has decreased in relation to the resources available. The dilemma created by these various events is threefold. First, there exists an established and valuable base of queries formulated with classical SQL expressions. Second, there is a growing usage of relational databases and networks accessing their information. The end users of such databases are routinely less proficient in the very tools needed to efficiently and accurately access the relational database information. Finally, users of database access methods do not receive direct feedback of changes based on their manipulation of the database. Thus, a distinct need exists to be able to convert query statements into visual representations understandable by novice database users, and, in the compliment, to convert graphically or visually represented queries into SQL format statements usable in existing databases and network environments. As noted earlier, comprehensive bidirectionality of the translation is important from the perspective of migrating from established SQL queries to their graphical or visual query equivalents. It is inefficient to require the regeneration of existing SQL queries into the visual environment. At the same time, new visual queries should be available in SQL format for use on existing hardware with existing relational databases. Comprehensive bidirectionality and direct manipulation via a graphical display is lacking in the prior art. Some technologies do exist for providing very limited translation from SQL to a visual or graphical depiction. Representative examples are described in "Graphical User Languages for Querying Information: Where to look for criteria?" by Hrohr, as published in 1988 IEEE Workshop On Visual Languages , May 1988, pages 14-20; "Design and Implementation of An Interactive Graphical Query Interface for a Relational Database Management System" by Czejdo et al, as appeared in 1988 IEEE Workshop On Visual Languages , May 1988 pages 21-28; and "End-User Access to Relational Databases Metaphor Database Server" by Benjamin et al, as appeared in the summer 1987 issue of InfoDB . Unfortunately, the translations described in such publications are lacking both in comprehensive bidirectionality and scope of diversity. Namely, the focus is only directed toward translating from SQL to visual or graphical depictions. Furthermore, the translations are not ANSI standard SQL comprehensive, in that the row condition is incapable of handling diverse logical relationships, no mathematical relationships are permitted for column data, and subquery handling is absent. The article "User Interfaces for Structural Engineering Relational Database" by Howard et al as appeared in Engineering With Computers , 1988, pages 239-249, recognizes the importance of bidirectional translation between a text based query, the defined Engineering Query Language and graphical representations. However the article does not disclose how such desirable objectives can be accomplished. The article recognizes the potential need for translating relatively complex query formulations and applying them directly from a graphical interface to a database, but makes no attempt to present a solution. An article by Faloutos, F., and Sellis, T., entitled, "An Efficient Pictorial Database System for PSQL", IEEE Transactions on Software Engineering , Vol. 14, No. 5, May 1988, discusses a prior art technique for searching a K or B-tree database using efficient data structures for optimizing the search. The report discusses access techniques for retrieving information and displaying the information on graphical displays. For example, demographic information can be used to retrieve information and format it graphically to reflect population in various sections of the United States. An improvement to further optimize the access of data for subsequent graphic display is disclosed in US Patent 4,905,163 and IBM Technical Disclosure Bulletin Vol. 30, No. 1, June 1987, Intelligent Scheduling. Query and Reporting Data Base . An example of a dynamic, graphical display for a knowledge base application is found in US Patent 4,752,889 to Neuron Data. The patent discloses a graphical tree structure depiction of a knowledge base that is updated after changes are made to the database via user line commands. EP-A-491517 discloses a system and method for graphically representing a WHERE or HAVING clause of an SQL query directed to a relational database. Logical operators are defined and linked to predicates using a tree structure format. It is preferred that the SQL format and tree structure graphic format queries appear simultaneously. "Direct Manipulation Techniques for Row Conditions in Structured Query Language Query Objects", p398-400, IBM Technical Disclosure Bulletin, Vol 33, No 3B, Aug 1990, describes direct manipulation techniques to be used in a graphical user interface model to create and edit the row conditions in a SQL query. The parts of the condition are depicted as objects and allow direct manipulation to support the creation and edit tasks. In the prior art there are various programs that allow a user to define WHERE clause predicates. For example, users have access to programs for defining SQL queries that includes the WHERE clause. This input is a text string in a separate panel, or a string in the flow of 10 the entire query command text. Users may enter the command language text in either form. However, all known current approaches have several deficiencies. First, the predicate definition is not initiated by the direct manipulation of the column object. Second, the resulting predicate is not immediately displayed in relation to the other defined 15 predicates. Third, the predicate is not displayed simultaneously with an indicator for the table column to which it relates. Fourth, the predicate is not displayed in graphical form. Fifth, the predicates themselves are not accessible for direct manipulation. Sixth, the column information is not displayed simultaneously with the predicate information. The impact of these problems with current implementations is that extra time is required for users to define predicates. The inaccessibility of the related information causes delays and errors because human memory is relied upon to replicate information that is already known to the system. The set of predicates in a disjointed text string cause errors because the user cannot discern if the defined predicates will produce the desired condition. The current approaches do not aid the user in the performance of the action desired; i.e., the definition of predicates in the row conditions to achieve a desired subset of database records. Accordingly, the invention provides a method for graphically forming a query in a database by direct manipulation of displayed objects representing columns in a table in the database, said method comprising the steps of: displaying graphically as objects the columns in a database table; selecting by direct manipulation one of said displayed column objects; defining a predicate for the query for the selected column object; and displaying graphically the predicate with any previously defined predicates for the query. It is preferred that the database is relational. The invention also provides apparatus for graphically forming a query in a database by direct manipulation of displayed objects representing columns in a table in the database, said apparatus comprising: means for displaying graphically as objects the columns in a database table; means for selecting by direct manipulation one of said displayed column objects; means for defining a predicate for the query for the selected column object; and means for displaying graphically the predicate with any previously defined predicates for the query. Thus the visual presentation of database information using a graphical display and the provision of direct manipulation of a screen object permits the handling of complex formulations, including, but not limited to, the definition of complex logical and algebraic relationships between columns and the manipulation of hierarchical queries composed of subqueries. The means for selecting the entries will typically be pointer means such as are provided in a conventional graphical user interface. In this way, the definition of individual predicates, the definition of the relationship of predicates, the editing of predicates, and the editing of the relationship of predicates is simplified and rendered dynamic and interactive for the user thereby facilitating the completion of the task being performed. The user need not remember the related column information for a specified predicate because the system will provide that information simultaneously with the predicate definition in a form that supports the direct manipulation of the related information. The predicates and their relationship are displayed simultaneously with the definition activities for both the initial definition and any subsequent editing activities. The user may select this information and drag it to the desired location to proceed on the desired activity. User performance on the row condition task is enhanced by having direct manipulation of the related column to initialize the task. The user is also supported for direct manipulation of the sub-tasks that comprise the predicate definition task. The user can see the relationship of the several predicates in a simple to understand graphic form making the system easier to use. The user is not required to memorize information that can be provided by the system. This makes the system easier to use by both novice and experienced users, and no matter what the skill level of the user, errors are reduced as a results of the graphical interface which provides only the valid operations for selected objects. The invention can be implemented by the inclusion of the appropriate control systems in a conventional computer to access data structures to determine the current status of a database and display the logical relationships of the information stored in the database graphically. A user employs a pointing device to select and change portions of the database and its logical relationships via the graphic user interface. The selection and changes are dynamically applied to the relational database via modifications to the underlying data structures and reflected graphically on the display. Additional, dynamic data structures, called presentation objects are created based on user created information defining relationships, new tables, groups, constraints, row conditions, having conditions, SQL statements, categories and sets of existing database information. The dynamic data structures can ultimately become part of the original database. Data structures called presentation objects can be dynically created for use in the direct manipulation and change of a database. An embodiment of the invention will now be described by way of example with reference to the following drawings: Figure 1a is a block diagram of a personal computer system; Figure 1b schematically depicts a workstation connected to a network with a relational database; Figures 2 and 3 are illustrations of visual query displays; and Figures 4 , 5 and 6 are detailed flowcharts of the method of the invention. A representative hardware environment is depicted in Figure 1a , which illustrates a typical hardware configuration of a workstation having a central processing unit 10 , such as a conventional microprocessor, and a number of other units interconnected via a system bus 12 . The workstation shown in Figure 1a includes a Random Access Memory (RAM) 14 , Read Only Memory (ROM) 16 , an I/O adapter 18 for connecting peripheral devices such as disk units 20 to the bus, a user interface adapter 22 for connecting a keyboard 24 , a mouse 26 , a speaker 28 , a microphone 32 , and/or other user interface devices such as a touch screen device (not shown) to the bus, a communications adapter 34 for connecting the workstation to a data processing network and a display adapter 36 for connecting the bus to a display device 38 . A network of workstations, including an IBM brand PS/2 workstation, is illustrated in Figure 1b , having resident thereon a relational database, such as the OS/2 Extended Edition base operating system including the OS/2 Extended Edition relational database program. Workstation 39 includes nonvolatile storage for the database, such as a hard disk, optical disk or tape drive media, and means for communicating into a network, generally at 40 , having attached thereto further databases 41 and 42 as well as distinct non-proximate workstations such as 43 . It is desired to allow a relatively inexperienced relational database user of workstation 39 to create, modify and execute relational database queries encompassing a broad and historical base of information. It is also contemplated that preexisting queries formulated in classical SQL format are conveyed to workstation 39 and subjected to conversion into visual or graphical queries equivalent for display on a graphic display 44 . The user may thereafter refine the query, execute the query and dynamically view the results on the graphic display. A basic tenet of the user interface architecture for Structured Query Language (SQL) queries is that unlike the computer with its mathematical language and rigid parsing rules, humans use categories to organize information and understand relationships between objects. An object is any actual entry in a relational database. The information necessary for the computer to perform a query of a relational database using SQL is visually structured into related objects with the text representing the objects of interest and the graphical representation of these objects depicting the relationships that exist or are of interest to the requester. The reader is referred to IBM's SQL REFERENCE , SC26-4380 (1989) for a detailed description of statements in the Structured Query Language (SQL). These statements include create, alter, and drop objects; retrieve, insert, update, and delete data in them; and grant and revoke privileges over them. The publication gives a complete description of all SQL elements and an alphabetic list of all SQL statements implemented by IBM, with descriptions of their syntax, options, and effects. Relational database queries may require row conditions to specify the data records that should be included in a report. The row condition is composed of a set of logically linked predicates. Usually in defining predicates for the row condition, the user needs to have a list of table information on hand and then types the predicates in a flat textual form. By providing a graphical user interface for defining queries in accordance with the present invention, table objects may be displayed in graphical form. Each column of a table is a directly manipulable object displayed in the client area of the table object window. Through a mechanism composed of direct manipulations and a dialog box, predicates may be defined against a column or a combination of columns. After each predicate is defined, it is immediately put into an independent window, the row condition window, and displayed with the previously defined predicates. In the row condition window, predicates and the logical relationships among them may be shown in graphical form. By graphically displaying the row condition window and the table windows simultaneously, a user may view the defined predicates together with the referenced columns. Figure 2 shows a user interface design of Visual Query in which a new predicate will be defined through a dialog box. In Figure 2 , the Visual Query - Primary - ABC 210 is the primary window for defining a query. The Staff 220 and ORG 230 are windows of tables referenced in a SQL query definition. The contents of each table window is the list of columns belonging to the table. Initially, the Row Condition Window 250 is invisible. It becomes visible after the first predicate is defined. The contents in the Row Condition Window show the defined predicates and their relationships (in Boolean logic). The user can examine the information displayed in the Row Condition Window 250 and the table windows 220 , 230 to choose the column names for defining more predicates to build the row condition (Where condition). The user can double click a column entry in a table window to define a predicate based on the column. When a column entry is double clicked, a dialog box, such as the Condition Definition dialog box 240 shown in Figure 2 , will be displayed for defining a predicate against the column. After the user commits the Condition Definition dialog box 240 , the dialog box is closed and the newly defined predicate will be displayed in the Row Condition Window 250 . Figure 3 shows the screen display after the user commits the dialog box 240 shown in Figure 2 . The newly defined predicate MANAGER in BestMgr 330 is displayed with the previously defined predicates 320 in the Row Condition Window 310 . Note that the newly defined predicate 330 is not linked with any other predicate yet. After the predicate 330 is displayed, the user can then specify its link relationships with the other predicates shown in the Row Condition Window. In accordance with the present invention, predicates are defined by directly manipulating the column objects and the results are immediately displayed in the row condition window. By putting all the defined predicates together in the row condition window, the predicates can be grouped and linked by direct manipulations to define the final row condition. Furthermore, the table objects (including its columns) and the defined predicates are displayed in graphical form simultaneously on the screen. Whenever a predicate is manipulated in the row condition window, the information of column objects are available on the screen, thereby providing the user with a decision aid in both defining new predicates and modifying existing predicates. Figures 4 , 5 and 6 are detailed flowcharts illustrating a method in accordance with the subject invention (see also the pseudo-code listing of appendix A). Processing commences at function block 400 when a column entry is selected. Then, in function block 410 a dialog box is created for the selected column entry and a test is performed at decision block 420 to determine if the dialog box is committed. If not, then control is returned at terminal 430 . If the dialog box is committed, then the text of the selected comparison operation is obtained at function block 440 and another test is performed at decision block 450 to determine if the right side has been entered. If not, then control is passed to function block 470 where a pointer object is initialized. If the right side has been entered, then the pointer object is initialized to the right side in function block 460 . Regardless of which side has been selected, control is passed via label 480 to function block 500 of Figure 5 where the length for displaying the pointer object is calculated. Function block 510 stores the entered data of each field in the dialog box, function block 520 locates an appropriate screen location for displaying the predicate, and a test is performed at decision block 530 to determine if the first predicate has been defined. If this is the first predicate, then the row condition window is presented in function block 540 . If not, then control is passed to function block 550 where the predicate is displayed and a test is performed at decision block 560 to determine if the default settings are used. If no default settings are being used, then control passes via label 580 through label 610 of Figure 6 to terminal 640 where control is returned to the calling program. If default settings are specified then control is passed via label 570 through label 600 to function block 620 where the root and node are displayed. Then, at function block 630 , an object is created to link the root and the node and display the result to the user before passing control back to the calling routine at terminal 640 .

Claims: A method for graphically forming a query in a database by direct manipulation of displayed objects representing columns in a table (220) in the database, said method comprising the steps of: displaying graphically as objects the columns in a database table; selecting by direct manipulation one of said displayed column objects; defining a predicate for the query for the selected column object; and displaying graphically the predicate (310) with any previously defined predicates (320) for the query. The method of claim 1, wherein the logical relationship between said predicate and any previously defined predicates can be specified graphically by direct manipulation to define a row condition. The method of claim 2, wherein the predicate and any previously defined predicates are displayed in a row condition window (310), simultaneously with the display of the table column objects. The method of any preceding claim, wherein the database is relational. Apparatus for graphically forming a query in a database by direct manipulation of displayed objects representing columns in a table (220) in the database, said apparatus comprising: means for displaying graphically as objects the columns in a database table; means for selecting by direct manipulation one of said displayed column objects; means for defining a predicate for the query for the selected column object; and means for displaying graphically the predicate (310) with any previously defined predicates (320) for the query. The apparatus of claim 5, wherein the logical relationship between said predicate and any previously defined predicates can be specified graphically by direct manipulation to define a row condition. The apparatus of claim 5 or 6, wherein the predicate and any previously defined predicates are displayed in a row condition window (310), simultaneously with the display of the table column objects. The apparatus of any of claims 5 to 7, wherein the database is relational.

Inventors: BANNING KENNETH RAY, JAMES WENDY SUE, LI SHIH-GONG, BANNING, KENNETH RAY, JAMES, WENDY SUE, LI, SHIH-GONG
Applicants: IBM, INTERNATIONAL BUSINESS MACHINES
Application year: 1993
Main classification: G06F17
IPC codes: G06F3, G06F12, G06F17