Browse Prior Art Database

Method for Querying a Class Hierarchy Stored in a Normalized Relational Table Without Using Recursive SQL

IP.com Disclosure Number: IPCOM000125489D
Original Publication Date: 2005-Jun-03
Included in the Prior Art Database: 2005-Jun-03
Document File: 3 page(s) / 40K

Publishing Venue

IBM

Abstract

When a class hierarchy is stored in a normalized relational table, each row contains a class and its immediate parent class. Recursive query is required to query about the class hierarchy, that are what is the parent hierarchy or the derived classes of a given class. Using recursive query has many drawbacks including unacceptable processing overhead, portability issues, and code complexity. This article decribes a method for querying a class hierarchy stored in a normalized relational table without using recursive query.

This text was extracted from a PDF file.
At least one non-text object (such as an image or picture) has been suppressed.
This is the abbreviated version, containing approximately 55% of the total text.

Page 1 of 3

Method for Querying a Class Hierarchy Stored in a Normalized Relational Table Without Using Recursive SQL

The main idea of our approach is to save the entire class inheritance path of each class and provide a build method to automate the conversion of a class hierarchy stored in a normalized relational table into an array of lists. Each list represents a class and its inheritance hierarchy starting from its immediate parent class all the way to the root. a set of query methods to answer typical queries against a class hierarchy such as, what is the parent class hierarchy of a class? what classes derived from a class? given a class, is it one of the classes on the class hierarchy? what is the relationship between two classes?

Both the build and query methods are simple and generic. Any application can use the build method to convert any shape or size of a class hierarchy into an array of lists. If the class hierarchy changes, an application can run the build method to buildthe array of lists again to reflect the changed class hierarchy. After the array of list is built, an application can choose to store these lists in files, memory or a relational table. A performance critical application can build the array of lists once during initialization, store them in memory, and use the provided query methods to answer typical queries mentioned above.

The provided build method is described below.

buildArrayOfList (classList, parentClassList, arryOfList) - this method is used to build an array of lists to represent a class hierarchy. The input classList contains all the classes, while the input parentClassList[i] contains the immediate parent class of classList[i]. An application can use a simple SELECT statement to read the entire normalized relational table to build these two lists.

A

Class Hierarchy Relational Table

Figure 1

Class

Parent Class

other attributes

A

A

B

A

C

A

B C D

D

A

E

B

F

B

G

E H I J

G

F

B

H

C

K

H

I

D

K

L

L

J

D

J

1

[This page contains 1 picture or other non-text object]

Page 2 of 3

For the table shown in Figure 1, the input (i.e. classList and parentClassList) to and the array lists (i.e. arrayOfLists) built by this method are shown below:

classL is t p a...