OBJECT ORIENTED QUERY LANGUAGES Object Oriented Database Seminar Omar Alasam Julien Aubry Julien Fontaine Bénédicte Gruss School of Computing Beng CNDS 4 Napier University PLAN Background Requirements Specifications Divergence from SQL Current Situation Query optimisation Future Direction BACKGROUND Object-Oriented Databases Concepts Objects and Identity Complex objects Encapsulation Classes Inheritance Overloading, Overriding and late binding BACKGROUND 2 Query Languages SQL took 15 years to become the standard of RDBMS Programming languages were first used to query OODB Users demand on a SQL-like query facility for OODB. No standard yet accepted Today, each OODBMS has its own query language implemented. OOQL Requirements The Object-Oriented Database System Manifesto, 1989 High level language Efficient Application independent Used to interactively query the database online. OQL requirements An OQL should provide: Descriptiveness Closure Completeness Expressive power Extensibility orthogonality Query Language issues Should the query language be integreted in the programming language? How to access the data: Simple data Complex data What is a result to a query ? Query language issues 2 Possibility to make join request Management of sets of objects Equal access to attributes and methods Consequences of class hierarchy SQL versus OQL New concepts have to be added to SQL: Object IDs Members Methods Derived data Hierarchy Recursion O2 Query Query language used by O2 DBMS 2 Modes:interactive & programming When interactive, can violate encapsulation High-level SQL-like language Generic methods already defined LIFOO Used by O2 Pure interrogation language Quantification, aggregation and Ordering OK Does not support recursive queries Functional language (handles functional syntax ; min, max..) Gemstone Result of a query: set of class identical as the queried class Queries: Boolean operations combined to path expression: Tasks select: {:t | (t.man_years > 20 & (t.leader.specialization = ‘DB’)} OSQL Used by IRIS Very close to SQL Syntax Use of recursive cursor Result of a query is an existing object Aggregation and Ordering not supported Foreign functions can be used Data Model is Multi-Model SQL 3 Object-Oriented version of the famous QL Use of ADT so as to describe classes Encapsulation assured thanks to flags Use of constructors, destructors and actors Compatibility with SQL 92 ADT:Abstract Data Type OQL Defined by ODMG OQL adopts the type system of the application Functional Query Language Orthogonal Query Language Query Optimisation Introduction: Difficulties of OODBMS Queries. Optimisation Issues Additional Data Types: definition of new types and classes through inheritance can both assist and prevent optimisation of queries Complex Objects: The path expressions and query closure of OODBMS query languages complicate the processing of queries in several ways Methods and Encapsulation: creation of new objects, object identities (OIDs). Cost Determination of evaluating methods. Optimisation Issues Cont. Algebras and Calculi Optimisation: The lack of a standard, Algebra is variable based. Algebraic optimisation has the advantage that a query can be transformed using well-defined operators. Extensible Optimisers: Ability to change with time through ``Optimiser Generators'': builds optimisers based on information on the data model, query language, algebra, calculi and cost model. The Query Processing Methodology: Scope of Future Work A Standard Extensible Optimiser Framework. Better Cost Models. Better Algebras and Rewrite Systems. Eliminating Method Evaluation. Indexing of Path Expressions. Pre-computation and Caching. Solutions and Evaluation: Simple evaluation, dynamic programming methods, Evolutionary Algorithms and randomised search. Final words on Query Optimisation: It is hard to provide a scheme for evaluating the success of a research into query optimisation, the only real criterion being faster average execution time of queries. OOQL Future Directions Innovation in the area of OODBMS query languages ! Research in OOQL: Super OODBMS Query Language: Polishing ODMG-93 OQL Connection to Rule Systems End-users Queries Graphical Query Construction OOQL Future Directions 2 Future Work Scope and Expectations from: ODMG-93 OQL and Rule Systems. Implementation before evaluation. Good end-user OODBMS query mechanism driven by strong industrial backing. Conclusion ODMG defined a standard with OQL OQL is competing with SQL 3 Vendors also have their own OOQL The popularity of OODB depends a lot on the query language that will be adopted.