System, method, and program for object building in queries over object views
First Claim
1. A software tool comprising program code on a computer usable medium, the software tool comprising:
- means for receiving view definitions; and
means for generating object-oriented class definitions from the view definitions, wherein a view collection v is of the view type V and has an implementation M for V specified as a SELECT statement, and wherein the means for generating produces the class definitions according to the following rules;
a) ordering elements in an object language class constructor as an ordering of elements in a FROM clause of M;
b) passing, as an argument to an object constructor, a handle on a binding of an ith element, if the ith element in the FROM clause is a view type; and
c) passing, as another argument to the object constructor, a row type if the jth element in the FROM clause of M is a relational table and ordering arguments of the row type as an order to columns present in the row type.
1 Assignment
0 Petitions
Accused Products
Abstract
The system, method, and program of this invention enables an object language application to issue a query over a view and to receive back, as query results, handles to application type objects which can be further manipulated by the application. A view is defined herein as a collection of a view type, and a view type is defined as a class or type. Upon receipt of the query referencing a view type, a query engine generates a query plan that builds mock (i.e., proxy) application type objects in memory based upon the view types. The application objects have a form that is consistent with the class definition for a type of object returned as a result. The application can run methods on the application type objects or point to other application type objects from the handles, to the application objects, that are returned to the application; and these manipulations will be understood by the query engine. In a preferred embodiment, query rewrite optimizations are applied to the queries over views requiring object building in order to optimize the evaluation of the query and the building of view objects as query results.
-
Citations
7 Claims
-
1. A software tool comprising program code on a computer usable medium, the software tool comprising:
-
means for receiving view definitions; and means for generating object-oriented class definitions from the view definitions, wherein a view collection v is of the view type V and has an implementation M for V specified as a SELECT statement, and wherein the means for generating produces the class definitions according to the following rules; a) ordering elements in an object language class constructor as an ordering of elements in a FROM clause of M; b) passing, as an argument to an object constructor, a handle on a binding of an ith element, if the ith element in the FROM clause is a view type; and c) passing, as another argument to the object constructor, a row type if the jth element in the FROM clause of M is a relational table and ordering arguments of the row type as an order to columns present in the row type.
-
-
2. A method performed by a computer program on a computer usable medium, the method comprising:
-
receiving view definitions; and generating object-oriented class definitions from the view definitions, wherein a view collection v is of the view type V and has an implementation M for V specified as a SELECT statement, and wherein the step of generating produces the class definitions according to the following rules; a) ordering elements in an object language class constructor as an ordering of elements in a FROM clause of M; b) passing, as an argument to an object constructor, a handle on a binding of an ith element, if the ith element in the FROM clause is a view type; and c) passing, as another argument to the object constructor, a row type if the jth element in the FROM clause of M is a relational table and ordering arguments of the row type as an order to columns present in the row type.
-
-
3. A method performed by a query engine in a data processing system, the method comprising:
-
receiving from an application having an object-oriented language, a query referencing a view type; generating application objects in memory, at run-time, from the view type; and returning handles on the application objects to the application, wherein given a view collection v of view type V and an associated implementation M for V specified as a SELECT statement, the view type application objects of type V are generated for a query over v according to the following rules; a) If V is a view type, an object building procedure call used to build V has arguments whose ordering is that of elements in the FROM clause of M, and if the ith element in the FROM clause is a view type, then a handle on the binding to the ith element is passed as argument to the object building procedure call; and b) If V is a view type and the jth element in the FROM clause of M is a relational table, the object building procedure call used to create V has as its jth element a row type that is passed as argument to the call, wherein the row type is a generic type that is built based upon a schema of the row type, and the order of arguments is given by the order of columns present in the row type.
-
-
4. A method implemented in a query processing system, the method comprising:
-
receiving, from an application, a query referencing a view type; generating a query plan having an object building procedure call having arguments whose ordering is that of elements in a FROM clause of the query; passing, as an argument to the object building procedure call, a handle on a binding to an ith element if the ith element in the FROM clause is a view type; and passing, as a jth argument to the object building procedure call, a row type based upon a schema of a database row, if the jth element in the FROM clause is a relational table.
-
-
5. A query engine comprising:
-
means for receiving, from an application, a query referencing a view type; means for generating a query plan having an object building procedure call having arguments whose ordering is that of elements in a FROM clause of the query; means for passing, as an argument to the object building procedure call, a handle on a binding to an ith element if the ith element in the FROM clause is a view type; and means for passing, as a jth argument to the object building procedure call, a row type based upon a schema of a database row, if the jth element in the FROM clause is a relational table.
-
-
6. A query system comprising:
-
means for receiving from an application having an object-oriented language, a query referencing a view type; means for generating application objects in memory, at run-time, from the view type; and means for returning handles on the application objects to the application, wherein given a view collection v of view type V and an associated implementation M for V specified as a SELECT statement, the means for generating produces the view type application objects of type V for the query over v according to the following rules; a) If V is a view type, an object building procedure call used to build V has arguments whose ordering is that of elements in the FROM clause of M, and if the ith element in the FROM clause is a view type, then a handle on the binding to the ith element is passed as argument to the object building procedure call; and b) If V is a view type and the jth element in the FROM clause of M is a relational table, the object building procedure call used to create V has as its jth element a row type that is passed as argument to the call, wherein the row type is a generic type that is built based upon a schema of the row type, and the order of arguments is given by the order of columns present in the row type.
-
-
7. A program on a computer usable medium for processing queries, the program comprising:
-
means for receiving, from an application, a query referencing a view type; means for generating a query plan having an object building procedure call having arguments whose ordering is that of elements in a FROM clause of the query; means for passing, as an argument to the object building procedure call, a handle on a binding to an ith element if the ith element in the FROM clause is a view type; and means for passing, as a jth argument to the object building procedure call, a row type based upon a schema of a database row, if the jth element in the FROM clause is a relational table.
-
Specification