Part 3: Creating a Database Diagram and Reversing it Back into a Class Diagram
In this section you create a database diagram based on the database structures generated from the original class diagram. Then, you reverse the database into a class diagram and see what you can expect from this iterative process.
show more or lessRead more...

Class models can be used for logical and physical representation of your information system. Logical models can be transformed into physical model. Because different rules can be used for creating the physical model, the reverse transformation of a physical model into a logical model has only few chances if any to be returned to the original picture.

Step 1: Add a New Database Diagram

For this new graphical component you need to create the appropriate databound component. To create the View Object and add it as data control, perform the following steps:

  1. From the main menu, select File | New to open the New Gallery.

    New menu option
  2. In the New Gallery dialog, select General | Projects and Database Project.

    New Gallery dialog

    Click OK.

  3. In the New Project window, type ReverseLogicalModel as the name.

    The New Project

    Click OK.

  4. The new project is now in the application Navigator. Double-click the ReverseLogicalModel project to open its properties.

    The Application Navigator
  5. In the Project Properties dialog, select the Dependencies node and click the Edit button Edit button to create a new dependency.

    The Project Properties dialog
  6. In the Edit Dependencies dialog, expand the PhysicalModel project and check the Build Output checkbox.

    The Edit Dependencies dialog

    Click OK. Click OK again.

  7. Click the Save All button Save All icon to save your work.

  8. Right-click the ReverseLogicalModel node in the Application Navigator and select New from context..

    Context menu from the Application Navigator
  9. In the New Gallery, select the General | Diagrams category, and then, Database Diagram.

    The New Gallery

    Click OK.

  10. In the Create Database Diagram dialog, enter Database Diagram as the name.

    The Create Database Diagram dialog

    Click OK.

  11. A new empty diagram opens in the edit pane.

    The empty database diagram
  12. In the Application Navigator, expand the PhysicalModel | Database1 | SCOTT nodes, then multi-select department_locations, Departments, Emp, and Locations and drag the definitions onto the diagram.

    Drag and drop into the database diagram
  13. Reorganize the default layout of the database diagram. In the diagram, right-click and select Layout Shapes --> Row.

    Context menu
  14. Adjust the model so that it looks like the following:

    Database diagram
  15. Click Save All Save All icon to save your work.

Step 2: Create the Reverse Project
Now that the model component is available as a databound component, you can use it to create a new rendering as a Thematic Map.
  1. Back in the Database diagram, right-click and Select All.

    Context menu
  2. Right-click within any Table and select Transform --> Model Only.

    Context menu
  3. Click OK on the Transform dialog.

    The Transform dialog
  4. Click Save All Save All icon to save your work.

  5. In the Application Navigator, expand the scott node. It should now look like the following:

    The Application Navigator
  6. Right-click the ReverseLogicalModel node in the Application Navigator and select New.

    Context menu from the Application Navigator
  7. In the New Gallery dialog, select Diagrams as the category and then Class Diagram.

    The New Gallery dialog

    Click OK.

  8. In the Create Class Diagram dialog, type Reverse Class Diagram as the name.

    The Create Class Diagram dialog

    Click OK.

  9. In the Application Navigator, under the scott package name, select all components except the package.uml_pck one. Drag the selection onto the new diagram.

    Dropping class definitions on diagram
  10. Right-click within the diagram and select Lay Out Shapes --> Row to reorganize the diagram layout.

    Context menu
  11. Arrange the layout so that it looks like the following:

    Class Diagram
  12. Select the Reverse Class Diagram tab and drag it onto the diagram so that the editor splits in two views.

    Class Diagram
  13. The editor pane is now splitted horizontally. Click the LogicalDatabase.class_diagram tab to open it in the split view and observe both schemas.

    Class Diagram
  14. If needed, adjust the layout so that you can see both diagrams.

    Class Diagram

    Notice now the differences between the original class diagram design and the reverse one.
    The reversed class diagram is just a class representation of a database diagram. As such it misses some semantics that were in the original class diagram.
    Examples of non reversible concepts:
    - Many to many relationtionship can't be reversed from the DepartmentLocations table
    - Sub-classes can't be reversed from the empType attribute
    - Primary key attributes are reversed back as class attributes
    - Foreign key attributes are reversed back as class attributes
    - The meaning of associations is lost (emps in dept).
    These are some examples of semantic information that the class diagram is not able to recreate from a reverse engineering operation. This class diagram shouldn't be reused for transformation again or you would end up with inconsistency.

You've successfully completed this tutorial.

Summary
In this tutorial you discovered how to use the UML Class modeler to make your database design. You learned how to: To learn more about modeling and database development, refer to:

Bookmark Print Expand all | Hide all
Back to top

Did you find this page helpful?



Copyright © 2011, Oracle and/or its affiliates. All rights reserved.