Type Checking vs Type Inference

The ODMG standard presents, rather informally, some details of a type system for checking OQL
queries using type information about the classes, extents, named objects and query definitions
from a given database schema. Recently, there have been some efforts to formalise this type
system. Their common objective is to ensure that the query execution will not fail due to type
errors. This is also reflected by the following statement in the ODMG standard:

”OQL is a functional language where operators can freely be composed, as long as the operands
respect the type system”

The core of the type checking model is a set of typing rules which derive the type of OQL
constructs based on the types of their constituent parts (operands or subqueries). If a subquery
is just an identifier its type is looked up either in the query environment, if it is a local
range variable, or in the database schema, if it is a named object, a query definition or an
extent. Hence, knowledge of the schema type information of a database is essential for type
checking. On the other hand, type inference derives the most general type of a query without
accessing any schema information. Whilst doing that, it establishes restrictions on the properties
of a schema, in order that a certain query may be well-typed with respect to it.

This technique could be exploited in distributed database applications where we often need to
check the typability of a query against multiple schemata. It would also be useful in order to tranform
queries into equivalent forms that fit different schema specifications. Finally, a type inference model
could be exploited in contexts where we have a limited knowledge of schema information (semistructured
or unstructured databases).

OQL type inference is particularly interesting, because of the complexity of the type model of the
language. Besides class types and simple types, the type model includes structures, as well as multiple
collection types (sets, bags, lists, arrays and dictionaries). The wide variety of OQL constructs leads
to multiple combinations of these types, and thus to a rather complex type system. Type inference is
studied in detail as a part of this thesis.

Advertisements

, , , , , , , ,

  1. Leave a comment

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: