Valerio Cosentino and Salvador Martinez presented in the International Workshop on OCL, Model Constraint and Query Languages (OCL 2013) co-located with MODELS 2013 their work on the extraction of OCL integrity constraints and derived types from relational databases. Valerio briefly describes their approach.
The goal of this work is to complement existing works on reverse engineering of relational databases all focused on derive a UML class diagram from the database schema (using the typical table-to-class mapping rules). In this work, we enrich the generated UML model with a set of OCL invariants representing the integrity constraints and derivations rules included in the database schema.
Our approach is a two-step process:
1. Model Extraction. It focuses on the extraction of the structural elements of the schema. It is composed by two operations respectively dedicated to create the UML classes and associations corresponding to the database tables and their relations and to extend this model by adding a set of derived classes to represent the database views.
2. Constraint Extraction. It focuses on inferring the OCL invariants required to complement the UML model. Substeps of this method cover the declarative constraints (CHECK, UNIQUE,…) and the analysis of triggers (since, beyond other applications, triggers can also be used to enforce complex integrity constraints). Key elements in the Constraint Extraction step are the SQL-to-OCL and PL/SQL-to-OCL transformations, which are used to map SQL and PL/SQL constructs to OCL.
The full paper is available here and the slides used in the presentation of the paper below: