Upload
valerio-cosentino
View
913
Download
1
Tags:
Embed Size (px)
DESCRIPTION
Relational databases usually enforce relevant organizational business rules. This aspect is ignored by current database reverse engineering approaches which only focus on the extraction of the structural part of the conceptual schema. Other database elements like triggers, views, column constraints, etc. are not considered by those methods. As a result, the generated conceptual schema is incomplete since integrity constraints and derivation rules enforced by the database are not represented. In this sense, this paper extends existing approaches by enriching the generated (UML) conceptual schema with a set of OCL integrity constraints and derivation rules inferred from the database schema. Our method has been implemented in a prototype tool for the Oracle database management system.
Citation preview
© AtlanMod - [email protected]
Extracting UML/OCL Integrity Constraints andDerived Types from Relational Databases
Valerio CosentinoSalvador Martínez
{valerio.cosentino, salvador.martinez}@mines-nantes.fr
07/10/13 © AtlanMod - [email protected]
Outline
Introduction Approach overview Model Extraction Constraint Extraction Conclusion and future work
07/10/13 © AtlanMod - [email protected]
Introduction
Relational databases play a key role in most organizations
They store relevant information according to:– Schema: data structure definitions and relations– Integrity constraints (declarative, operational):
implementation of organization policies/business rules
These constraints should evolve together with the organization policies
07/10/13 © AtlanMod - [email protected]
Introduction
Discovering/understanding the business rules in a db is:– Time-consuming (querying/browsing the database) – Error-prone (manual analysis)– Tailored process (each SQL vendor offers slight
variations for the standard language) Model Driven Engineering offers:
– Homogeneous representation (schema + constraints)– Higher abstraction level (no SQL vendor specificities)– Automatation of repetitive activities (extraction of
schema and constraints)
07/10/13 © AtlanMod - [email protected]
Approach overview
Model Extraction translates tables, relations and views into UML classes and associations
Constraint Extraction focuses on inferring the OCL expressions required to complement the UML model
07/10/13 © AtlanMod - [email protected]
Model Extraction
Mappings:– Tables → classes– Views → derived classes– Columns → class's attributes– Database data types → UML data types
CHAR(n), VARCHAR2(n) → String Integer, Float, Date → Integer, Real, Date Number(precision, scale) → if precision = 0 Integer else Real
– Foreign keys → associations between classes– SQL queries → associations' cardinalities
07/10/13 © AtlanMod - [email protected]
Constraint Extraction
Declarative constraints:– PRIMARY KEY– UNIQUE– NOT NULL– CHECK
Operational constraints:– Triggers: PL/SQL - SQL code automatically executed in
response to certain database events Key elements: SQL-to-OCL and PL/SQL-to-OCL
– they map SQL and PL/SQL constructs to OCL
07/10/13 © AtlanMod - [email protected]
Triggers
Triggers are composed by:– Triggering event: SQL statement, database or user event– Trigger condition (optional): boolean expression– Triggered action: PL/SQL block (procedural and SQL code)
They can be executed: instead of, before or after performing the triggering event
Example:
07/10/13 © AtlanMod - [email protected]
PL/SQL to OCL
All triggers that embed in their action a PL/SQL statement raising an exception defined by the user are classified as business-relevant– Two ways to use user exceptions:
RAISE statement (Override an already-defined exception) RAISE APPLICATION ERROR statement
These exceptions are generally nested in conditional statements. For each exception, the conditions triggering the exception are mapped to an equivalent OCL expression.
07/10/13 © AtlanMod - [email protected]
Refining OCL Constraints
UML stereotype mechanisms are used to annotate each OCL constraint extracted from a Trigger with the information of the events that apply to it (insert, update, delete)
Annotated OCL constraints can be merged together when:– they are semantically-equivalent– they are applied to different events
Example:
07/10/13 © AtlanMod - [email protected]
Conclusion and future work
MDE benefits:– Modular and generic approach– Automatic extraction of the organization policies in
databases Future work
– Test the framework on a real database application– Extend the OCL language with additional libraries for
representing calendar-based constraints– Integrate the extracted business rules with those ones
extracted from other system's components
07/10/13 © AtlanMod - [email protected]
Questions