12.07.2015 Views

Query Unnesting in Object Oriented Database - Ijoes.org

Query Unnesting in Object Oriented Database - Ijoes.org

Query Unnesting in Object Oriented Database - Ijoes.org

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

14Bharti Joshi, Rostom D MorenaOne essential feature of declarative query languages is the nest<strong>in</strong>g ofqueries. In SQL, nested queries are used to express complex conditions.This is also true <strong>in</strong> object-oriented SQL like query languages. But objectoriented nested queries serve other purposes as well: They are used toaccess nested structures and to produce nested result. There are manyrecent proposals on OODB query optimization that are focused on unnest<strong>in</strong>gnested queries. <strong>Query</strong> unnest<strong>in</strong>g appears more often <strong>in</strong> OODB queries than<strong>in</strong> relational queries, because OODB query languages allow complexexpressions at any po<strong>in</strong>t <strong>in</strong> a query. Current OODB systems evaluate nestedqueries <strong>in</strong> a nested loop fashion, which does not leave many opportunitiesfor optimization. Most unnest<strong>in</strong>g techniques for OODB queries are actuallybased on similar techniques for relational queries. If considered <strong>in</strong> isolation,query unnest<strong>in</strong>g itself does not result <strong>in</strong> performance improvement; <strong>in</strong>stead,it makes possible other optimizations, which would not be possible otherwise.II.Related Work:The purpose of this section is familiariz<strong>in</strong>g the reader briefly with pastwork.A) Jie L<strong>in</strong> O-Algebra:Jie L<strong>in</strong> used an <strong>Object</strong> algebra, called O-algebra, designed for process<strong>in</strong>gOODB queries[1]. The operands of O-algebra are collections of objects ofthe same <strong>in</strong>ternal type. Each object has the form (o,v) where o is an objectid and v is a tuple of properties.. In present method only one level of nest<strong>in</strong>gis allowed. However, tuple components can be sets but not sets of sets.The front end bulk data type objects are mapped to <strong>in</strong>ternal objects with onebulk data type property and the front end complex objects can bedecomposed to objects with atmost one level nest<strong>in</strong>g. Due to uniformity ofoperands and the simplicity of operators, a powerful set of algebraic lawscan be obta<strong>in</strong>ed.L<strong>in</strong> used procedures to convert OQL queries to O-Algebra queries.Usually <strong>in</strong> OODB queries, bulk data (set, list and bag) is commonlyconstructed and the constructions are expressed by nested queries. Hepresented a general solution to reduce nested queries <strong>in</strong> OODB queries. As© 2011 Journal Anu Books Authors are responsible for any plagiarism issues.


Research Cell: An International Journal of Eng<strong>in</strong>eer<strong>in</strong>g Sciences ISSN: 2229-6913 Issue Dec. 2011, Vol. 515O-Algebra does not allow nested sub expressions, when OQL queries areconverted to O-Algebra queries, nested queries are already reduced.L<strong>in</strong> <strong>in</strong>troduced an SQL –like <strong>in</strong>termediate language, called SOQL, whichserves as a bridge for facilitat<strong>in</strong>g the transformation from OQL to O-Algebra.SOQL does not have any nested queries. A given OQL query can always beconverted <strong>in</strong>to this form by name substitut<strong>in</strong>g. In OQL, the nested queriescan appear <strong>in</strong> any clauses. SOQL does not allow nested queries. Instead itrepresents sub queries by methods. For nested queries <strong>in</strong> OQL, it istransformed <strong>in</strong> to a method of SOQL and a method call is generated <strong>in</strong> ma<strong>in</strong>query. Notice that the methods <strong>in</strong> SOQL are <strong>in</strong>dependent queries. Thereforewhen the OQL queries are translated <strong>in</strong>to the SOQL queries, the nestedqueries have actually been reduced.This approach is more general because it is not restricted by the patternsof nested queries.B) Fegaras Monoid Algebra:Fegaras presented a new query unnest<strong>in</strong>g algorithm that generalizesmany unnest<strong>in</strong>g techniques. Method proposed by Fegaras is capable ofremov<strong>in</strong>g any form of query nest<strong>in</strong>g. He has utilized monoid comprehensioncalculus for remov<strong>in</strong>g queries. Fegaras claims that his algorithm unneststhe queries that cannot be normalized by the normalization algorithm us<strong>in</strong>gtwo rewrite rules only. Queries are translated <strong>in</strong>to monoid comprehensions,which serve as an <strong>in</strong>termediate form, and then translated <strong>in</strong>to version of thenested relational algebra that supports aggregation, quantification, outer jo<strong>in</strong>sand outer unnest<strong>in</strong>gs. <strong>Query</strong> unnest<strong>in</strong>g is performed dur<strong>in</strong>g the translationof monoid comprehensions <strong>in</strong>to algebraic forms. He used both calculusand algebras as an <strong>in</strong>termediate forms because the calculus resemblescurrent OODB languages and easy to normalize, while the algebra is lowerlevel and can be directly translated <strong>in</strong>to the execution algorithms.Fegaras unnest<strong>in</strong>g algorithm is quite simple. For each box thatcorresponds to a nested query it converts reductions <strong>in</strong>to nests, jo<strong>in</strong>s <strong>in</strong>toouter jo<strong>in</strong>s and unnest <strong>in</strong>to outer unnest. At the same time it embeds theresult<strong>in</strong>g boxes at the po<strong>in</strong>ts immediately before they are used. He has givenvarious transformation rules for unnest<strong>in</strong>g OODB queries by translat<strong>in</strong>gterms <strong>in</strong> monoid calculus.© 2011 Journal Anu Books Authors are responsible for any plagiarism issues.


16Bharti Joshi, Rostom D MorenaC) Horng ASR Technique:He has used query process<strong>in</strong>g architecture. In this the declarative queryexpression is first parsed to <strong>in</strong>ternal form which is composed of pars<strong>in</strong>gtrees and several tables such as variable table, path expression table, classtable etc..The <strong>in</strong>ternal form is then translated <strong>in</strong>to a query graph by <strong>Query</strong>Graph Generator. Execution plan Generator is the process of query mapp<strong>in</strong>gquery graph to a sequence of data manipulation operators. F<strong>in</strong>ally, theRuntime <strong>Database</strong> Executor runs the execute plan to generate query results.He proposed an algorithm to transform a query Expression <strong>in</strong>to a querygraph. Queries are expressed <strong>in</strong> OQL. The idea of the transformation isbased on the <strong>in</strong>ternal storage structure, Access support Relation. He mappeda path expression <strong>in</strong> a query to an ASR storage structure. A path expressionmaps to a comb<strong>in</strong>ation of Simple nodes and Navigate-L<strong>in</strong>ks. A path decidesthe order of execution of navigation. Access Support Relations techniquesare <strong>in</strong>troduced as a means for optimiz<strong>in</strong>g query process<strong>in</strong>g <strong>in</strong> OODBMS.The general idea is to ma<strong>in</strong>ta<strong>in</strong> separate Structures to redundantly storethose object references that are frequently traversed <strong>in</strong> database queries.He def<strong>in</strong>ed a set of operators to manipulate ASRs <strong>in</strong> the query process<strong>in</strong>g.These operators are I/O Operators, Basic Operators and Extended operatorsAll and Exist. Execution plan generation is the process of mapp<strong>in</strong>g a <strong>Query</strong>graph to a set of operators. Above method can handle large amount pathexpressions that exist <strong>in</strong> an object oriented queries.III. Our Algorithm for Process<strong>in</strong>g a nested query:We dist<strong>in</strong>guish three k<strong>in</strong>ds of dependencies <strong>in</strong> OODBMSProjection dependency ( a reference to an outer variables occurs <strong>in</strong> theselect clause)Range dependency(a reference to an outer variables occurs <strong>in</strong> the fromclause)Predicate dependency( a reference to an outer variables occurs <strong>in</strong> thewhere clause)Our algorithm is based on cluet [3] classification of nested queries. Hisclassification extends the relational classification of which four types ofnested queries are more added.© 2011 Journal Anu Books Authors are responsible for any plagiarism issues.


18Bharti Joshi, Rostom D Morena// type A or N rarely occurs <strong>in</strong> SELECT ClauseReduce the range dependency to predicate dependency us<strong>in</strong>g typebased rewrit<strong>in</strong>gThen call Unnest_JA(query_block,<strong>in</strong>ner_query_block)for each predicate <strong>in</strong> the FROM clause of query_blockif predicate is a nested predicate(i.e conta<strong>in</strong>s <strong>in</strong>ner query block)// this type of nest<strong>in</strong>g rarely occurs can be unnest us<strong>in</strong>g map operation, nestedloops and cross products.return}In expla<strong>in</strong><strong>in</strong>g procedure unnest (), it is useful to model a nested querywith a multi-way tree whose nodes are query blocks, where the outermostquery block is the root and the <strong>in</strong>nermost query blocks are the leaves.Procedure unnest () searches down through the levels of a nested queryfrom the outermost query block until it f<strong>in</strong>ds the <strong>in</strong>nermost query blocks. Itthen exam<strong>in</strong>es the leaf block to determ<strong>in</strong>e the type of nest<strong>in</strong>g present, andtransforms the parent to canonical form by call<strong>in</strong>g the appropriatetransformation procedures. After this is done for all nested predicates <strong>in</strong>query_block, the recursion then unw<strong>in</strong>ds one level and the query blockimmediately above is processed <strong>in</strong> the same way, cont<strong>in</strong>u<strong>in</strong>g the unw<strong>in</strong>d<strong>in</strong>guntil lastly the outermost, or root, query block is transformed. The algorithmrepresented <strong>in</strong> procedure unnest () solves the problem of correctlytransform<strong>in</strong>g a type-JA query with multiple levels of nest<strong>in</strong>g.Predicate dependency is very popular <strong>in</strong> RDBMS. In OODBMS any threedependency can occur. To illustrate projection dependency lets see exampleSelect tuple(dept: d,Emps: select eFrom e <strong>in</strong> EmployeeWhere e.dept=d)From d <strong>in</strong> departmentAfter rewrit<strong>in</strong>gSelect tuple(dept: d, emps:des)From d <strong>in</strong> Department© 2011 Journal Anu Books Authors are responsible for any plagiarism issues.


20Bharti Joshi, Rostom D Morena[7]. Atk<strong>in</strong>son, M., Bancilhon, F., DeWitt, D., Dittrich, K., Maier, D, and Zdonik, S.”The<strong>Object</strong>-<strong>Oriented</strong> <strong>Database</strong> System Manifesto,” <strong>in</strong> Bancilhon et. al. (eds.)Build<strong>in</strong>gan <strong>Object</strong>-<strong>Oriented</strong> <strong>Database</strong> System: The Story of O2. M<strong>org</strong>an Kaufman, 1992.[8]. Kim, W., “<strong>Object</strong>-<strong>Oriented</strong> <strong>Database</strong> Systems: Promises, Reality, and Future,”<strong>in</strong> Modern <strong>Database</strong> Systems: The <strong>Object</strong> Model, Interoperability and Beyond.[9]. Reda Alhajj,”An <strong>Object</strong>-<strong>Oriented</strong> <strong>Query</strong> Model: An Algebraic Approach withClosure.” Journal of Information Science and Eng<strong>in</strong>eer<strong>in</strong>g 16, 499-533(2000)* * * * *© 2011 Journal Anu Books Authors are responsible for any plagiarism issues.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!