Extracting UML/OCL Integrity Constraints and Derived Types from Relational Databases

1,544 views

Published on

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.

Published in: Technology
0 Comments
2 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
1,544
On SlideShare
0
From Embeds
0
Number of Embeds
571
Actions
Shares
0
Downloads
26
Comments
0
Likes
2
Embeds 0
No embeds

No notes for slide

Extracting UML/OCL Integrity Constraints and Derived Types from Relational Databases

  1. 1. © AtlanMod - atlanmod-contact@mines-nantes.fr Extracting UML/OCL Integrity Constraints and Derived Types from Relational Databases Valerio Cosentino Salvador Martínez {valerio.cosentino, salvador.martinez}@mines-nantes.fr
  2. 2. 07/10/13 © AtlanMod - atlanmod-contact@mines-nantes.fr Outline  Introduction  Approach overview  Model Extraction  Constraint Extraction  Conclusion and future work
  3. 3. 07/10/13 © AtlanMod - atlanmod-contact@mines-nantes.fr 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
  4. 4. 07/10/13 © AtlanMod - atlanmod-contact@mines-nantes.fr 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)
  5. 5. 07/10/13 © AtlanMod - atlanmod-contact@mines-nantes.fr 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
  6. 6. 07/10/13 © AtlanMod - atlanmod-contact@mines-nantes.fr 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
  7. 7. 07/10/13 © AtlanMod - atlanmod-contact@mines-nantes.fr Model Extraction  Example: human resource database
  8. 8. 07/10/13 © AtlanMod - atlanmod-contact@mines-nantes.fr 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
  9. 9. 07/10/13 © AtlanMod - atlanmod-contact@mines-nantes.fr Declarative constraints  Declarative constraints:  Example:
  10. 10. 07/10/13 © AtlanMod - atlanmod-contact@mines-nantes.fr SQL to OCL  Projection and selection:  Example:
  11. 11. 07/10/13 © AtlanMod - atlanmod-contact@mines-nantes.fr SQL to OCL  Join:  Example:
  12. 12. 07/10/13 © AtlanMod - atlanmod-contact@mines-nantes.fr SQL to OCL  Group and having clause:  Example:
  13. 13. 07/10/13 © AtlanMod - atlanmod-contact@mines-nantes.fr 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
  14. 14. 07/10/13 © AtlanMod - atlanmod-contact@mines-nantes.fr 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.
  15. 15. 07/10/13 © AtlanMod - atlanmod-contact@mines-nantes.fr PL/SQL to OCL  Trigger:  Example: SQL to OCL mappings
  16. 16. 07/10/13 © AtlanMod - atlanmod-contact@mines-nantes.fr 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
  17. 17. 07/10/13 © AtlanMod - atlanmod-contact@mines-nantes.fr 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
  18. 18. 07/10/13 © AtlanMod - atlanmod-contact@mines-nantes.fr Questions

×