Section two presents the ontology we have
defined for the new SQL:2003. Section three
presents an example of a database definition using
the new SQL:2003 which is represented using the
ontology. In section four the metrics definition and
formalization using OCL is shown. Finally, the last
section presents the conclusions and future work.
2 SQL:2003 ONTOLOGY
Among the different languages present in the earliest
DBMS, SQL has imposed itself as a “de iure” and
“de facto” database standard.
Recently, the last version of the standard has been
published, SQL:2003 (ISO/IEC 9075, 2003) which
makes revisions to all parts of SQL:1999 and
includes some new issues (Eisenberg et al., 2004).
The fact of having a standard is fundamental.
However, sometimes standards are hard to
understand and it is difficult to extract all the
information contained. It usually happens that
standards are not free of inconsistencies due to the
big amount of information that they try to cover. In
that case, most of the advantages derived of the
disposal of a standard disappear.
For avoiding most of these problems, the
standard can be complemented by its ontology. In
such a manner the ontology helps in finding the
information and detecting inconsistencies which is
essential in order to define the metrics based on the
concepts of the standard.
An ontology is a specification of a
conceptualization. This means that, through the
definition of an ontology, we try to formalize and
recover the knowledge of a given domain.
So, we developed an ontology for the SQL:2003.
For doing it, we have used several parts of the
standard. We have worked mainly with the
information of the part 1 (Framework) but basically
with the one of part 2 (Foundation) of the standard.
In the other hand, we also reengineered the Part 11
(Information and Definition Schema) considering
those schemata as metamodels of the SQL:2003
which represent in their tables all the concepts of the
language.
The ontology was thought for the object-
relational aspects of a database schema, discarding
elements such as triggers and stored procedures, as
they are not needed for the metrics we consider in
this work. The inclusion of these elements can be
easily done because the main components are
included in this version and the discarded ones are
related to them.
The ontology has been divided into two. One
contains all the aspects related to data types (figure
1) and the other all the information about the SQL
schema objects (figure 2).
Figure 1 shows three different kinds of Data
Types: Predefined, Constructed and User Defined
Types. Constructed Types can be Composite or
Reference Types. Composite Types can be
Collections (Arrays or Multiset – a new type of the
SQL:2003 standard) composed by Elements, or Row
Types, which in turn are composed by Fields. Each
Element or Field has one Data Type.
The User Defined Types can be either Distinct
Types (which are defined over one Predefined Data
Type) or Structured Types
1
. Structured Types are
composed by Attributes and by one or more Method
Specifications. Inheritance is allowed among
Structured Types, Row Types and Reference Types.
Figure 2 illustrates four different SQL schema
objects: Constraints, Domains, User Defined Types
and Tables.
Constraints can be Assertions, Domain
Constraints or Table Constraints (Unique
Constraints including Primary Keys, Table Check
Constraints and Referential Constraints – the latter
for representing the foreign keys).
Domains are used by Columns and can include a
Domain Constraint.
Tables can be Derived Tables – and particularly
Views, Transient Tables or Base Tables. They are
composed by Columns that can be defined as
Identity Columns or Generated Columns. Columns
can be defined over a Domain and they can have
Referential Constraints or Unique Constraints (or
Primary Keys) defined.
Base Tables can also be part of an inheritance
hierarchy. They are defined over a Data Type
(through a Reference Type) and they can have
Candidate Keys.
1
Structured types are entities corresponding to classes in
object-oriented notations. Thus, when we use the word
“class” in this document, we refer to the ontology
entity StructuredType.
A FORMAL DEFINITION FOR OBJECT-RELATIONAL DATABASE METRICS
335