You are on page 1of 5

TCSS445A Databases Systems Design Spring 2004

Rose Data Modeler (logical)

Rational Rose uses a data modeler to model the conceptual, logical, and physical
database models, but also to generate DDLs commands, such as creating tables following
UML methodology.

Guidelines for using Rose Data Modeler

2) Logical data model: the next data model in Rose Data Modeler is the logical data
model. It is a refinement of the conceptual model, but we can create another class
diagram for it, that we call logical. We draw again the classes (we can just copy
and paste them from the conceptual diagram.
We need to work on this diagram so that we represent all its elements in a way
that will permit Rational Rose to translate it well into a data model, which is a set
of database tables.
o Create a logical class diagram in the Logical View, or work on the Main one,
which is what will be done in this tutorial.

o Modify, or redraw, the association between Employee and Dependent. So that


it is an aggregation. The result should look like on the following screen. Note
the full diamond arrow representing a strong relationship, also called a
composite aggregation, or an identifying relationship.
TCSS445A Databases Systems Design Spring 2004

o Specify the keys by right-clicking on the attribute(s) in the Logical View, and
selecting Data Modeler  Part of Object Identity.
o Also do not forget to make each class persistent, by selecting persistent on the
Detail tab of the corresponding class specification.

o Mapping the logical model into a data model. The data model is a new model
provided by Rational Rose.
First create a database in Component View  Data modeler  new 
Database. Give it the name you want for your target database, such as your
UW NetID.
Then create a new schema for your database in Logical View  Data Modeler
 new  Schema. Choose the database previously created, and the ANSI
SQL 92 formalism.
Map by choosing Company (package)  Data Modeler  Transform to data
model. Choose the schema and database.
TCSS445A Databases Systems Design Spring 2004

o Under the schema created, select Data modeler  new  data model
diagram. Add the tables to this diagram. It should look like this:
TCSS445A Databases Systems Design Spring 2004

Check that the PK and FK have been generated properly.

Potential Problems: if your tables do not look right, such as there are
additional keys created, then it means that you class diagram is nor right. Go
back to your class diagram, and modify the primary keys selected, if needed.
Another source of errors are the relations. There are sometimes some relations
not visible on the class diagram that Rose has not removed when you
graphically deleted them. You should check for each class that it has the right
number of relations under the Relations tab of the class specification. For
instance, in our example, Employee should have 2 relations listed, remove
additional ones (probably earlier ones), Computer should have only 1, and
Dependent should have also only 1.

3) Physical data model: The physical data model will refine the tables previously
generated. You can add there different elements (see online help), such as
domains, constraints, triggers, stored procedures, etc. One important feature will
be to specify which attributes must be unique, by opening the corresponding table,
and selecting the attribute as Unique. These are dependent upon the DBMS.
Stored procedures and triggers are not included in ANSI SQL 92.
4) Implementing the physical data model: The generation of the DDL is done
through the Forward Engineering Wizard. It will create the DDL file for each data
element represented in the Schema. You just right-click on the schema created,
then select Data Modeler  Forward engineer, and choose which elements you
want to generate, starting with tables (and views), then select the name of the file,
such as company.ddl. Here is the content of my company.ddl:
TCSS445A Databases Systems Design Spring 2004

I can use this file as a direct input to MySQL, on the command line:

mysql –v -p<password> <database> < company.ddl

for example: mysql -v -pxxxxx ibichind < company.ddl

I can also import this file into MySQL at the command line:

mysql> source compant.ddl