Upload
franklin-patrick
View
222
Download
1
Embed Size (px)
Citation preview
MIT5314: Database Applications Slide # 1
Visible Analyst
Dr. Peeter Kirs Fall 2003
An Introduction To Using Visual Analyst to Create an
ERD
MIT5314: Database Applications Slide # 2
Visible Analyst
Dr. Peeter Kirs Fall 2003
Visible Analyst is a Computer Aided Software Engineering (CASE) Tool
Among the models included are: Functional Decomposition (Business Model)
• Shows the business functions and processes they support in a hierarchical structure
Entity Relationship Diagram (Data Model) • Shows the data entities of an application and the relationship
between the entities
Object Model (Object Class Model) • Shows classes of Objects, Subclasses, Aggregations, and
Inheritance
• A quick Note: In January 2003, The Visible Developer Professional Edition was selling for $1,995 (Cheap!)
MIT5314: Database Applications Slide # 3
Visible Analyst
Dr. Peeter Kirs Fall 2003
Visible Analyst Models (Continued) State Transition Model (Real Time Model)
• Shows object transition to and from various states and conditions and the events or triggers cause them to change between different states
Process Model (Data Flow Diagrams) • Shows how things occur in the organization via a sequence of
processes, actions, stores, inputs and outputs.
• Processes are decomposed into more detail, producing a layered hierarchical structure
Product Model (Structure Chart) • Shows a hierarchical, top-down design map of how the application
will be programmed, built, integrated, and tested
MIT5314: Database Applications Slide # 4
Visible Analyst
Dr. Peeter Kirs Fall 2003
Visible Analyst Models (Continued) Use-Case Model
• Shows the relationship between a user and the information system
Activity Model• A special form of the state diagram representing the performance of
actions or subactivities
Sequence Model• Shows how objects collaborate in some behavior
Collaboration Model• Shows an interaction organized around the objects in the interaction
and their links to each other
Repository Model (Database Project_• The Bible of Systems Analysis and Design
MIT5314: Database Applications Slide # 5
Visible Analyst
Dr. Peeter Kirs Fall 2003
Open the Visible Analyst Program The First Thing You will see is the start-up menu
MIT5314: Database Applications Slide # 6
Visible Analyst
Dr. Peeter Kirs Fall 2003
The Next thing you will see is the main menu:
To start a new project, select New Project from the File Menu
MIT5314: Database Applications Slide # 7
Visible Analyst
Dr. Peeter Kirs Fall 2003
When you do, another pop-up menu will appear:
You have now created a Project called Medical which will be stored (in this case) at C:\VISABLE Analyst\Data
Click the OK Button
MIT5314: Database Applications Slide # 8
Visible Analyst
Dr. Peeter Kirs Fall 2003
Once you have created a project, Visible Analyst, by default, assumes you will creating a new diagram:
It just happens to be an ERD
(Which is what we want)
Click the OK Button
MIT5314: Database Applications Slide # 9
Visible Analyst
Dr. Peeter Kirs Fall 2003
You will now see the ERD Drawing Screen:
Let’s First add the Entity PHYSICIAN
Click on the Entity Button
When you do, your cursor will change:
MIT5314: Database Applications Slide # 10
Visible Analyst
Dr. Peeter Kirs Fall 2003
• Move the cursor to some position on the screen (Or keep it where it is)
• Then Right Click
• Another Pop-up menu will then appear asking you to name the entity (Object)
• Label it PHYSICIAN
PHYSICIAN
• Then Press OK
MIT5314: Database Applications Slide # 11
Visible Analyst
Dr. Peeter Kirs Fall 2003
You Have now created the Entity Physician
• Next, we need to change to the select mode
• Next we right-click on our entity PHYSICIAN(A Pop-up Menu Will appear)
Define …Change Item …
Stylize …Text Settings …Colors …
CutCopy
Delete
• Choose Define(We are going to add attributes)
MIT5314: Database Applications Slide # 12
Visible Analyst
Dr. Peeter Kirs Fall 2003
• Before we can go any further, we need to save our diagram
• Let’s label our diagram as MEDICAL DATABASE
MEDICAL DATABASE
• And then Press OK
MIT5314: Database Applications Slide # 13
Visible Analyst
Dr. Peeter Kirs Fall 2003
• A New Pop-up Menu Will appear
• This menu will first ask us for a description of the entity
• Describe what the database is for
(This will become part of the Repository)
• Put in an appropriate description
Contains Information about the Physician employed by the hospital
MIT5314: Database Applications Slide # 14
Visible Analyst
Dr. Peeter Kirs Fall 2003
• Alias ??
Contains Information about the Physician employed by the hospital
(We will talk about that later --- Maybe ---)
• To add an attribute, Simply move your cursor to the add field, and start typing in the field name
PHYSID
• As soon as you do, some default values come up
Char No
• These values refer to the data type, the length, and whether or not a Null value can be entered
MIT5314: Database Applications Slide # 15
Visible Analyst
Dr. Peeter Kirs Fall 2003
• Notes ??
Contains Information about the Physician employed by the hospital
PHYSID Char No• A GREAT idea – Put in
thoughts about what this means – if it turns out to be wrong, you can change it later
This will be the primary key for the PHYSICIAN table. It will also be the foreign key in table PATIENT
• We will first have to change the null (or missing) values, as necessary • In our case, we know that
PHYSID should be of length 9
9
• Now ADD the attribute to the entity
MIT5314: Database Applications Slide # 16
Visible Analyst
Dr. Peeter Kirs Fall 2003
• And the attribute has been added
• For the time being, let’s assume that this is the only attribute
• Click on the EXIT button
A Dialogue Box will remind to save our entry
• Click ‘YES’
MIT5314: Database Applications Slide # 17
Visible Analyst
Dr. Peeter Kirs Fall 2003
• It may not look like we did anything, but we did
• There are three ways of viewing the screen:
• The ENTITY LEVEL (which we are in)
• The PRIMARY KEY LEVEL
• The ATTRIBUTE LEVEL
• To see the attribute added, Click on the ATTRIBUTE Level View
MIT5314: Database Applications Slide # 18
Visible Analyst
Dr. Peeter Kirs Fall 2003
• Notice that the Entity (PHYSICIAN) and the one attribute we entered (PhysID) are displayed
• Click on the PRIMARY KEY LEVEL Button
• While we are at it, let’s look at the PRIMARY KEY LEVEL screen
MIT5314: Database Applications Slide # 19
Visible Analyst
Dr. Peeter Kirs Fall 2003
Where is all the information?Where is all the information?• The PRIMARY KEY LEVEL Screen
Shows ONLY the Entity Name and the Primary Key
• Let’s make PhysID the primary key
• Once again, RIGHT-CLICK on the entity
Define …Change Item …
Stylize …Text Settings …Colors …
CutCopy
Delete • And again, Choose DEFINE
• We didn’t designate a Primary Key
MIT5314: Database Applications Slide # 20
Visible Analyst
Dr. Peeter Kirs Fall 2003
• Adding a Primary Key is extremely simple
• Click on the primary key button
• A new dialogue Box will appear
• Click on the attribute you wish to make a Primary Key
• And it will appear in the “Columns in Key” Box
PhysID
• Now just press the OK Button
MIT5314: Database Applications Slide # 21
Visible Analyst
Dr. Peeter Kirs Fall 2003
• Notice that PhysID is now the Primary Key
• Now let’s go back and see our Diagram Screen
• Click on the EXIT button(This time there will be no reminder to save the object)
MIT5314: Database Applications Slide # 22
Visible Analyst
Dr. Peeter Kirs Fall 2003
• Remember, we are still in the PRIMARY KEY LEVEL screen
• Let’s Add another Attribute (You know the drill)
• RIGHT-CLICK on the entity
Define …Change Item …
Stylize …Text Settings …Colors …
CutCopy
Delete
• And again, Choose DEFINE
MIT5314: Database Applications Slide # 23
Visible Analyst
Dr. Peeter Kirs Fall 2003
• Let’s Add the attribute ‘PhysName’
PhysName
• Once again, the default values will appear in the ‘Type’ and ‘Null’ Fields
Char No
What if we don’t Want the data type ‘Char’ or
we wished to allow ‘Null’ Values?
What if we don’t Want the data type ‘Char’ or
we wished to allow ‘Null’ Values?
• Change them
MIT5314: Database Applications Slide # 24
Visible Analyst
Dr. Peeter Kirs Fall 2003
• Let’s change the attribute ‘PhysName’ to an integer
PhysName Char No
(Yes -- I know that’s dumb, but bear with me)
• Click on the Scroll Bar button
MIT5314: Database Applications Slide # 25
Visible Analyst
Dr. Peeter Kirs Fall 2003
• The list of all available data types will appear
• Choose the one you want
• Integer ???• Small Integer ???
MIT5314: Database Applications Slide # 26
Visible Analyst
Dr. Peeter Kirs Fall 2003
• Clicking on the ‘Null’ Scroll Bar will cause the possibilities to be displayed
• At any rate, we want the attribute ‘PhysName’ to be of data type ‘Char’ and of length 30
(Which we would signify by entering ’30’ in the length field)30
MIT5314: Database Applications Slide # 27
Visible Analyst
Dr. Peeter Kirs Fall 2003
• Once again, after we have added our attribute, we need to add it to the list
MIT5314: Database Applications Slide # 28
Visible Analyst
Dr. Peeter Kirs Fall 2003
• As soon as we hit the add button, it will be added to the list
• Let’s go back to the Diagram Screen
• Click Exit(Again, there will be no reminder to save)
MIT5314: Database Applications Slide # 29
Visible Analyst
Dr. Peeter Kirs Fall 2003
(I have added a few more Attributes)
• Notice that we are in ATTRIBUTE LEVEL Mode
What if we want to add a constraint to an attribute ??
What if we want to add a constraint to an attribute ??
• Not a problem all we need to do is go back to the ‘Define’ menu
Define …Change Item …
Stylize …Text Settings …Colors …
CutCopy
Delete
MIT5314: Database Applications Slide # 30
Visible Analyst
Dr. Peeter Kirs Fall 2003
• Click on the ‘Check Constraints’ Tab
MIT5314: Database Applications Slide # 31
Visible Analyst
Dr. Peeter Kirs Fall 2003
• Click on the ‘Column Check Constraints’ Scroll Bar
(The complete list of attributes will appear)
• Highlight the attribute you wish to put conditions on and click
MIT5314: Database Applications Slide # 32
Visible Analyst
Dr. Peeter Kirs Fall 2003
• Click the ‘Add/Remove’ Button
• Add the condition
MIT5314: Database Applications Slide # 33
Visible Analyst
Dr. Peeter Kirs Fall 2003
• Now let’s add the entity ‘PATIENT’• Click on the ‘Entity’ Button
• Put the entity wherever you want
• Once again, the label entity dialogue box will ask you to label the object
PATIENT
• After that, Click on the ‘OK’ Button
MIT5314: Database Applications Slide # 34
Visible Analyst
Dr. Peeter Kirs Fall 2003
• Add ‘PATIENT’ Attributes as we did before(Make sure you first choose the
‘Select Mode’)
• Notice also that I have expanded the ENTITY folder
MIT5314: Database Applications Slide # 35
Visible Analyst
Dr. Peeter Kirs Fall 2003
• We’re now ready to link the tables together• Choose the appropriate relationship from the menu bar
(In our case, this is a one (mandatory) to many (optional) relationship)
MIT5314: Database Applications Slide # 36
Visible Analyst
Dr. Peeter Kirs Fall 2003
• After you click on the relationship button, simply connect the tables with your cursor
MIT5314: Database Applications Slide # 37
Visible Analyst
Dr. Peeter Kirs Fall 2003
• Another Dialogue box will appear asking you questions about the relationship
• May a Physician have Zero patients?• Enter the name of the relationship
from PHYSICIAN to PATIENT
Treats
• Enter the name of the relationship from PATIENT to PHYSICIAN
Treated By
• Click the ‘OK’ Button
MIT5314: Database Applications Slide # 38
Visible Analyst
Dr. Peeter Kirs Fall 2003
• And we have set up a relationship between the tables
Have We ?? Have We ?? • One nice feature about Visible Analyst is that it will
Analyze our diagram for us
MIT5314: Database Applications Slide # 39
Visible Analyst
Dr. Peeter Kirs Fall 2003
• Click on the ‘DIAGRAM’ Tool bar option
SymbolsLines
TextConstruct
Change Item
Split Dataflow
Modify View
Delete
Stylize
ConnectSnap Symbols
Snap Lines
Analyze
• Now click on the ‘Analyze’ Option
• Another Menu will pop-up with available options
• Click the ‘OK’ Button
• And, we Appear to be OK
MIT5314: Database Applications Slide # 40
Visible Analyst
Dr. Peeter Kirs Fall 2003
• Keep in mind that Visible Analyst is MORE that just a diagramming tool
• It also maintains our REPOSITORY
MIT5314: Database Applications Slide # 41
Visible Analyst
Dr. Peeter Kirs Fall 2003
Before going on, let’s review what a Repository does:• A repository is a database for a project that contains information
both captured from your diagrams and entered directly by you.
• It contains metadata that describes the organization’s data and data processing resources
• Provides information about:• What users must know what
• What automated CASE tools that are used to specify and develop information systems
• All Applications that access and manipulate data
• The DBMS that maintain the repository and update system privileges, passwords, and other information
MIT5314: Database Applications Slide # 42
Visible Analyst
Dr. Peeter Kirs Fall 2003
• Now, getting back to our Example:
• To check our repository, click on the ‘REPOSITORY’ Tool bar option
MIT5314: Database Applications Slide # 43
Visible Analyst
Dr. Peeter Kirs Fall 2003
• Let’s do a Key Analysis
• We forgot to add our foreign key
MIT5314: Database Applications Slide # 44
Visible Analyst
Dr. Peeter Kirs Fall 2003
• The procedure for adding a foreign key is straight-forward
• RIGHT-CLICK on the entity
• And again, Choose DEFINE
Define …Change Item …
Stylize …Text Settings …Colors …
CutCopy
Delete
MIT5314: Database Applications Slide # 45
Visible Analyst
Dr. Peeter Kirs Fall 2003
• One of the options on the ‘Define Item’ Menu is ‘Foreign Keys’
MIT5314: Database Applications Slide # 46
Visible Analyst
Dr. Peeter Kirs Fall 2003
• First, Click on the attribute you wish as a foreign key
• Then click on the field you want to relate the foreign key with
(The attribute will be added)
Physician
• Save it• And Exit
MIT5314: Database Applications Slide # 47
Visible Analyst
Dr. Peeter Kirs Fall 2003
• Notice that our ATTRIBUTE LEVEL Screen reflects the addition of the foreign key
• Let’s check our repository to make sure everything is OK
DefineDivisions
Key AnalysisKey Synchronization
Model Balancing
Report Query
Syntax Check
Generate Database SchemaGenerate DDS
Generate Code
Reports
• Pick Key AnalysisWhat is going on ?? What is going on ??
MIT5314: Database Applications Slide # 48
Visible Analyst
Dr. Peeter Kirs Fall 2003
There are actually a few problems:• Remember how we defined our PHYSICIAN Table• And our PATIENT Table
• We have a mismatch between PHYSICIAN.PhysID and PATIENT.Physician
MIT5314: Database Applications Slide # 49
Visible Analyst
Dr. Peeter Kirs Fall 2003
• Another benefit of Visible Analyst is that it will correct these types of problems automatically
• Once again, Click on ‘Repository’
DefineDivisions
Key AnalysisKey Synchronization
Model Balancing
Report Query
Syntax Check
Generate Database SchemaGenerate DDS
Generate Code
Reports
• Now Click on ‘Key Synchronization’
• The Pop-up Menu will give you some options
• Click ‘OK’
MIT5314: Database Applications Slide # 50
Visible Analyst
Dr. Peeter Kirs Fall 2003
• You will be asked to save your synchronization
• So, Save it
NameItWhatYouWish
• Save this file too
MIT5314: Database Applications Slide # 51
Visible Analyst
Dr. Peeter Kirs Fall 2003
Are we OK now ?? Are we OK now ?? • Let’s Check ---
DefineDivisions
Key AnalysisKey Synchronization
Model Balancing
Report Query
Syntax Check
Generate Database SchemaGenerate DDS
Generate Code
Reports
• Click on ‘Key Analysis’
• We appear to be OK
MIT5314: Database Applications Slide # 52
Visible Analyst
Dr. Peeter Kirs Fall 2003
Let’s once again take a look at our tables:• First, our PHYSICIAN Table• Next, our PATIENT Table
• The Issue has been resolved
MIT5314: Database Applications Slide # 53
Visible Analyst
Dr. Peeter Kirs Fall 2003
• I have added two more entities(You know how to do this)
• Let’s add the Associative entity TREATMENT
• Aside from clicking on the ‘Associative Entity’ Button (instead of the ‘Entity’ Button, the procedure is the same
MIT5314: Database Applications Slide # 54
Visible Analyst
Dr. Peeter Kirs Fall 2003
• First, let’s relate PATIENT and TREATMENT(This is a (mandatory) 1 to (optional) Many relationship)
• Next use the mouse to connect the entities
• Then fill in the necessary information
MIT5314: Database Applications Slide # 55
Visible Analyst
Dr. Peeter Kirs Fall 2003
• Let’s Check
Are we OK now ?? Are we OK now ??
SymbolsLines
TextConstruct
Change Item
Split Dataflow
Modify View
Delete
Stylize
ConnectSnap Symbols
Snap Lines
Analyze
• Note that this is a WARNING not an ERROR
MIT5314: Database Applications Slide # 56
Visible Analyst
Dr. Peeter Kirs Fall 2003
• Let’s Check that
But what about the Repository ?? But what about the Repository ?? DefineDivisions
Key AnalysisKey Synchronization
Model Balancing
Report Query
Syntax Check
Generate Database SchemaGenerate DDS
Generate Code
Reports
• Once again, we forgot our Foreign Keys
MIT5314: Database Applications Slide # 57
Visible Analyst
Dr. Peeter Kirs Fall 2003
• Open the ‘DEFINE’ Menu(Right-Click on TREATMENT)
• Go to the ‘Foreign Keys’ Option
• First link PATIENT and TREATMENT
• Choose the relationship• Then add the attribute
• Move it to the Link
Patient
• This time, Click on ‘Migrate’
MIT5314: Database Applications Slide # 58
Visible Analyst
Dr. Peeter Kirs Fall 2003
Migrate ?? Migrate ?? Key Synchronization ‘migrates’ primary keys across normalized relationships to make Foreign Keys in other Entities
It also adds descriptive information about the relationship and the related entities to the Repository
When you created the entity, the Repository created an ‘Associator’ Element Name for it
Visible Analyst uses this information for Key Analysis and Synchronization
MIT5314: Database Applications Slide # 59
Visible Analyst
Dr. Peeter Kirs Fall 2003
• Do the same thing for the other relationships
• Select the relationship between TREATMENT and PRESCRIPTION
• Add the attribute
• Move it to the Link
Prescription
• Migrate
• Do it again for the relationship between TREATMENT and ILLNESS
MIT5314: Database Applications Slide # 60
Visible Analyst
Dr. Peeter Kirs Fall 2003
• Notice that a strange thing has happened:• The attribute names have been changed to correspond with
their labels in the tables they refer to:
(Due to Synchronization)
• We could change them, or just leave them as is
MIT5314: Database Applications Slide # 61
Visible Analyst
Dr. Peeter Kirs Fall 2003
Are we OK now ?? Are we OK now ?? • Let’s Check
DefineDivisions
Key AnalysisKey Synchronization
Model Balancing
Report Query
Syntax Check
Generate Database SchemaGenerate DDS
Generate Code
Reports
MIT5314: Database Applications Slide # 62
Visible Analyst
Dr. Peeter Kirs Fall 2003
• The Only thing we haven’t done is set-up our Unary Relationship (But we know how to)
• Right-Click on PHYSICIAN
• Choose ‘Define’
• Add the field ‘Supervisor’
• Draw the relationship
• Set ‘Supervisor’ as a Foreign Key
-- And We’re Done ---
MIT5314: Database Applications Slide # 63
Visible Analyst
Dr. Peeter Kirs Fall 2003
• First, Go to the ‘File’ Option
How do we Open a Different Project ?? How do we Open a Different Project ??
MIT5314: Database Applications Slide # 64
Visible Analyst
Dr. Peeter Kirs Fall 2003
• Now Select the project• Let’s Choose Project TEST
• Then Click ‘OK’
MIT5314: Database Applications Slide # 65
Visible Analyst
Dr. Peeter Kirs Fall 2003
• Choose (highlight) Entity
• Now open up the ‘Diagram’
MIT5314: Database Applications Slide # 66
Visible Analyst
Dr. Peeter Kirs Fall 2003
• Let’s Open the Driver’s License ERD
MIT5314: Database Applications Slide # 67
Visible Analyst
Dr. Peeter Kirs Fall 2003
• Let’s Review the ERD:
The Department of Motor Vehicles (DMV)
Has Many Evaluators
Each Evaluator Gives many Road Tests
Many Individuals Apply for Licenses
An Applicant May take may Road Tests
The DMV May (Must?) Issue Many Drivers Licenses
MIT5314: Database Applications Slide # 68
Visible Analyst
Dr. Peeter Kirs Fall 2003
Let’s Look at some of Visible Analyst’s other (ERD) options:
• We can Establish Database Security
• We can Modify The Balancing Rules
• We can Modify The SQL Dialect
MIT5314: Database Applications Slide # 69
Visible Analyst
Dr. Peeter Kirs Fall 2003
• We can Even:• Generate the DDS
(Data Descriptor Specification)
• Generate the SQL Code Needed
• Create Reports
• Create Report Queries
-- BUT NOT WITH THE STUDENT VERSION ---
MIT5314: Database Applications Slide # 70
Visible Analyst
Dr. Peeter Kirs Fall 2003
?? Any Questions ????? Any Questions ???