1. Field
Embodiments of the invention relate to retrieving data objects from a data store with hierarchical relationship information based on table relationships described in a data model.
2. Description of the Related Art
A relational database stores information in different tables. In many cases, the tables contain information that is not isolated, but, instead, is relevant to information in other tables in the relational database. The relationship between various tables can be recognized through primary and foreign key definitions. To query information through multiple related tables, users can write Structured Query Language (SQL) statements that join the relevant tables to form one result set. However, the result set returned by the SQL typically returns the data in a single dimension list of values, and the hierarchical information between these tables is lost.
For instance, consider a specific example in which a relational database contains information about books. A properly normalized relational database stores the information about these books in various related tables. One table may store the book's information, such as a title, a number of pages, and an International Standard Book Number (ISBN). Another, separate table may store the information about the one or more authors of the book, and these two tables are related using primary keys and foreign keys. There may be other tables that store information about the book's publisher's information or the subject category, etc. To retrieve the full information of the book, users need to manually write a custom SQL statement that joins the relevant table. At a high level, the SQL statement may be:
Executing this type of SQL statement will return a list of rows in a result set. Each row in the result set contains the value of each column that the user included in the SQL statement. The information about the “books” may be retrieved by reading the values in each of the result set rows. However, there are two main problems with this.
The first problem is that the returned information is in one single dimension, and the inherently hierarchical information about these tables is lost. For this example, it is more natural to consider the book's main information “contains” the other related information (e.g. authors, publishers). The one dimensional list lacks a description of the relationship between the values.
The second problem is that, for tables that contain one to many relationships (e.g. a book that is written by multiple authors), the relevant information is spread across multiple rows of a table. As a particular example, say Book 1 is written by Authors A and B, and Book 2 is written by Authors C and D. Then, a user wants to retrieve the book's title, the ISBN number, and the author's first name. After executing a SQL statement, the returned information is separated across multiple rows in the result set, such as the following:
Again, the relationship of values from different tables is lost in the result set.
Thus, there is a need for a technique that retrieves data objects from a data store with hierarchical relationship information.
Provided are a method, computer program product, and system for generating a Graphical User Interface (GUI) based on relationships between tables identified in a data model and displaying the GUI to enable selection of the tables and columns in the tables. Via the GUI, a selection of at least one of the tables and a selection of at least one of the columns in the at least one of the selected tables are received. A statement is generated based on the selected tables and the selected columns. The statement is executed to obtain results. The results are processed to create a data object having a hierarchical structure that indicates the relationships between the tables.
Referring now to the drawings in which like reference numbers represent corresponding parts throughout:
In the following description, reference is made to the accompanying drawings which form a part hereof and which illustrate several embodiments of the invention. It is understood that other embodiments may be utilized and structural and operational changes may be made without departing from the scope of the invention.
The server computer 150 includes a relational database 160, and the relational database 160 includes tables 162 containing data that defines one or more data objects 164. A data object may be described as a set of data elements (or attributes) of interest related to an object. In certain embodiments, the data objects 164 include attributes. In alternative certain embodiments, the data objects 164 include attributes as well as methods or functions to perform operations on the attributes. Data from the tables 162 together with a data model 140 represents one or more data objects 164, Although, the relational database 160 is shown at server 150, the relational database 160 may be located at the server computer 120 in certain embodiments.
The data object retriever 130 uses information regarding the table relationships (which are considered to be bidirectional) to provide a way for users to query information inside a relational database 160 and to automatically generate a list of “objects”, such as a list of books. Because relationships are treated as bidirectional, a table may be related to itself, forming a cycle. For example, when a book is selected, the authors of the book may be displayed. Then, an author may be selected, and all books written by the author are displayed, including the original book that was selected.
The data object retriever 130 includes a data model information parser 132 to analyze the relationship information of relevant tables. The data object retriever 130 includes an interface generator 134 that generates a GUI 135 to enable users to provide information and to specify query criteria, such as what information to include in the data object 164. The data object retriever 130 includes a statement generator 136 to automatically create the desired statement (e.g., a SQL statement) based on information provided from the data model information parser 132 and user provided information via the GUI 135 from the interface generator 134. The data object retriever 130 includes a feed generator that runs the statement, processes the data returned from the relational database 160, and formats the result properly for the end user as a feed accessible through a Uniform Resource Locator (URL). In certain embodiments, a feed may be described as a data format (e.g., an XML data format) used for providing users with content. In certain embodiments, the feed is an ATOM feed.
The data model information parser 132, the interface generator 134, the statement generator 136, and the feed generator 138 of the data object retriever 130 provide a way for the user to retrieve data from multiple related tables from the relational database 160, without writing statements to retrieve the data manually. In addition, the data object retriever 130 allows the user to obtain a data object that maintains the hierarchical information structure of the data.
That is, the data object retriever 130 provides users a way to retrieve a data object 164 that maintains hierarchical relationships between information in the tables 162. As a particular example, say Book 1 is written by Authors A and B, and Book 2 is written by Authors C and D. Then, a user wants to retrieve the book's title, the ISBN number, and the author's first name. In this example, the core “object” of information is a book, and embodiments provide a result set, as a data object, that is more natural to the user by grouping together the information relevant to a particular “object” in one piece and by representing the information in a way that maintains the hierarchy of the information, such as the Extensible Markup Language (XML) tree illustrated in
In certain embodiments, the data model information parser 132, the interface generator 134, the statement generator 136, and the feed generator 138 of the data object retriever 130 are provided as a plug-in. That is, the plug-in integrates the data model information parser 132, the interface generator 134, the statement generator 136, and the feed generator 138 into one seamless interface for the user to retrieve result sets, as data objects, as an ATOM feed. In certain embodiments, to use the plug-in, the user obtains a data model 140.
In block 302, the data model information parser 132 of the data object retriever 130 parses the data model to obtain information about the relationships between in the tables 162. In block 304, the interface generator 134 generates a GUI 135 based on the relationships. In certain embodiments, the GUI 135 is displayed at the client computer 100. In block 306, in response to user selection of tables, columns, and/or rows via the GUI 135, the statement generator 136 of the data object retriever 130 automatically constructs the statement (e.g., a SQL statement) that joins the selected tables, that identifies the selected columns, and that identifies the selected rows based on any additional filtering criteria specified by the user. In certain embodiments, the statement generator 136 generates unambiguous filter criteria for multiple references of a same table. For example, when a book is selected, the authors of the book may be displayed; then, an author may be selected, and all books written by the author are displayed. Thus, there may be filter criteria at each selection.
In block 308, the feed generator 138 of the data object retriever 130 executes the statement to obtain result set. In block 310, the feed generator 138 of the data object retriever 130 processes the result set to create a data object 164 having a hierarchical structure that indicates the relationships between the tables. In certain embodiments, the data object 164 is returned as an ATOM feed.
Once the data model file has been obtained, the data model file is used as input by the data object retriever 130. The data object retriever 130 asks the user for this data model file and other information (e.g., such as a host name, a port, a user name, and a password) to access a database source.
Once the user provides this information, the data model information parser 132 analyzes the data model file. This data model file contains detailed information such as:
In certain embodiments, the data model information parser 132 may use Eclipse Modeling Framework Project (EMF) JAVA libraries to parse through the data and loads the parsed information into memory as JAVA objects. (JAVA is a trademark or registered trademark of Oracle and/or its affiliates.)
The interface generator 134 generates the GUI 135 illustrated in
After the user has selected the desired columns to include in the data object, the GUI 135 also allows the user to specify additional criteria to select rows of tables. For example, the user can choose to only include books that are over a certain number of pages or only books written by a certain author.
Based on the information gathered from the GUI 135, the statement generator 136 automatically constructs the statement (e.g., a SQL statement) that joins the selected tables, identifies the selected columns, and identifies the selected rows based on additional filtering criteria. This statement is passed to the feed generator 138. The following is an example SQL statement that may be generated by the statement generator 136:
The feed generator 138 executes the statement, processes the returned results, constructs the data object 164, and returns the data object 164 to the user. The data object 164 returned to the user has a hierarchical structure that indicates the relationships between the tables that were selected. In certain embodiments, the data object 164 is returned as an ATOM feed. Then, for the user to retrieve this feed, the user uses the URL to the feed.
Thus, embodiments retrieve data objects from a relational database 160 based on table relationships described in a data model and represent the data object in a hierarchical data format (e.g., XML). Embodiments allow users to define a data object by selecting from a tree displayed in a GUI. Embodiments build an XML template for data retrieved from a relational database 160.
Thus, instead of having a one dimensional list, embodiments provide a structure that maintains the hierarchy of information, such as in an XML tree, to present data to the user in a way that more closely describes the relationships between the values in different tables.
As will be appreciated by one skilled in the art, aspects of the present invention may be embodied as a system, method or computer program product. Accordingly, aspects of the present invention may take the form of an entirely hardware embodiment, an entirely software embodiment (including firmware, resident software, micro-code, etc.) or an embodiment combining software and hardware aspects that may all generally be referred to herein as a “circuit,” “module” or “system.” Furthermore, aspects of the present invention may take the form of a computer program product embodied in one or more computer readable medium(s) having computer readable program code embodied thereon.
Any combination of one or more computer readable medium(s) may be utilized. The computer readable medium may be a computer readable signal medium or a computer readable storage medium. A computer readable storage medium may be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any suitable combination of the foregoing. More specific examples (a non-exhaustive list) of the computer readable storage medium would include the following: an electrical connection having one or more wires, a portable computer diskette, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or Flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, solid state memory, magnetic tape or any suitable combination of the foregoing. In the context of this document, a computer readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device.
A computer readable signal medium may include a propagated data signal with computer readable program code embodied therein, for example, in baseband or as part of a carrier wave. Such a propagated signal may take any of a variety of forms, including, but not limited to, electro-magnetic, optical, or any suitable combination thereof. A computer readable signal medium may be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device.
Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to wireless, wireline, optical fiber cable, RF, etc., or any suitable combination of the foregoing.
Computer program code for carrying out operations for aspects of the present invention may be written in any combination of one or more programming languages, including an object oriented programming language such as JAVA, Smalltalk, C++ or the like and conventional procedural programming languages, such as the “C” programming language or similar programming languages. The program code may execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer or entirely on the remote computer or server. In the latter scenario, the remote computer may be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or the connection may be made to an external computer (for example, through the Internet using an Internet Service Provider).
Aspects of the embodiments of the invention are described below with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems) and computer program products according to embodiments of the invention. It will be understood that each block of the flowchart illustrations and/or block diagrams, and combinations of blocks in the flowchart illustrations and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions/acts specified in the flowchart and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer readable medium that can direct a computer, other programmable data processing apparatus, or other devices to function in a particular manner, such that the instructions stored in the computer readable medium produce an article of manufacture including instructions which implement the function/act specified in the flowchart and/or block diagram block or blocks.
The computer program instructions may also be loaded onto a computer, other programmable data processing apparatus, or other devices to cause a series of operational processing (e.g., operations or steps) to be performed on the computer, other programmable apparatus or other devices to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide processes for implementing the functions/acts specified in the flowchart and/or block diagram block or blocks.
The code implementing the described operations may further be implemented in hardware logic or circuitry (e.g., an integrated circuit chip, Programmable Gate Array (PGA), Application Specific Integrated Circuit (ASIC), etc. The hardware logic may be coupled to a processor to perform operations.
The data object retriever 130 may be implemented as hardware (e.g., hardware logic or circuitry), software, or a combination of hardware and software.
Input/Output (I/O) devices 1212, 1214 (including but not limited to keyboards, displays, pointing devices, etc.) may be coupled to the system either directly or through intervening I/O controllers 1210.
Network adapters 1208 may also be coupled to the system to enable the data processing system to become coupled to other data processing systems or remote printers or storage devices through intervening private or public networks. Modems, cable modem and Ethernet cards are just a few of the currently available types of network adapters 1208.
The computer architecture 1200 may be coupled to storage 1216 (e.g., a non-volatile storage area, such as magnetic disk drives, optical disk drives, a tape drive, etc.). The storage 1216 may comprise an internal storage device or an attached or network accessible storage. Computer programs 1206 in storage 1216 may be loaded into the memory elements 1204 and executed by a processor 1202 in a manner known in the art.
The computer architecture 1200 may include fewer components than illustrated, additional components not illustrated herein, or some combination of the components illustrated and additional components. The computer architecture 1200 may comprise any computing device known in the art, such as a mainframe, server, personal computer, workstation, laptop, handheld computer, telephony device, network appliance, virtualization device, storage controller, etc.
The flowchart and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present invention. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams and/or flowchart illustration, and combinations of blocks in the block diagrams and/or flowchart illustration, can be implemented by special purpose hardware-based systems that perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
The terminology used herein is for the purpose of describing particular embodiments only and is not intended to be limiting of the invention. As used herein, the singular forms “a”, “an” and “the” are intended to include the plural forms as well, unless the context clearly indicates otherwise. It will be further understood that the terms “comprises” and/or “comprising,” when used in this specification, specify the presence of stated features, integers, steps, operations, elements, and/or components, but do not preclude the presence or addition of one or more other features, integers, steps, operations, elements, components, and/or groups thereof.
The corresponding structures, materials, acts, and equivalents of all means or step plus function elements in the claims below are intended to include any structure, material, or act for performing the function in combination with other claimed elements as specifically claimed. The description of embodiments of the present invention has been presented for purposes of illustration and description, but is not intended to be exhaustive or limited to the invention in the form disclosed. Many modifications and variations will be apparent to those of ordinary skill in the art without departing from the scope and spirit of the invention. The embodiments were chosen and described in order to best explain the principles of the invention and the practical application, and to enable others of ordinary skill in the art to understand the invention for various embodiments with various modifications as are suited to the particular use contemplated.
The foregoing description of embodiments of the invention has been presented for the purposes of illustration and description. It is not intended to be exhaustive or to limit the embodiments to the precise form disclosed. Many modifications and variations are possible in light of the above teaching. It is intended that the scope of the embodiments be limited not by this detailed description, but rather by the claims appended hereto. The above specification, examples and data provide a complete description of the manufacture and use of the composition of the embodiments. Since many embodiments may be made without departing from the spirit and scope of the invention, the embodiments reside in the claims hereinafter appended or any subsequently-filed claims, and their equivalents.
Number | Date | Country | |
---|---|---|---|
Parent | 13074472 | Mar 2011 | US |
Child | 13543552 | US |