Академический Документы
Профессиональный Документы
Культура Документы
Microsoftss Visio is a general purpose diagramming program. Its strength is the existence of dozens of
templates which set up the page and stencils which contain pre-drawn shapes. Although you can start
from scratch if you wish, this is seldom wise. Normally, you select an appropriate template for what
you want to do (draw a map, produce an organization chart, PERT chart, database diagram, computer
network diagram, etc.) and then drag and drop the pre-drawn shapes and arrange as desired. A stencil is
available for producing UML diagrams.
If you encounter problems accessing Visio, you might try to logon using the generic
sslab/utdallas local account with Domain set as this computer.
Begin by copying the folder p:\briggs\g6383\uml to c:\my documents
This example is based in ESRI Designing Databases Using ArcInfo
Drawing a Map with Visio
1. Open Visio and Select appropriate Template
Go to Start/All Programs/Microsoft Office and select Microsoft Visio 2003
Click Cancel button to dismiss the splash screen (if it appears).
Go to File/New/Map/directional map(US units) to select the directional maps
template
2. Stencils are shown down the left side
--the Road Shapes stencil should currently be open, displaying its road shapes
--click another stencil name (e.g Transportation) to show available shapes from that stencil
--go to File/Open/My Documents/UML/US Canada & Mexico.vss
An additional stencil is added to the list. It contains outlines of states.
You can make any additional Visio stencil (and its shapes) available this way.
3. Drag the Texas outline onto the drawing page
--use the object handles to resize the outline to be about 6x 6
--note that geographic accuracy is NOT maintained since you can change the aspect ratio!!!
--click the Road Shapes stencil to display its shapes
--drag a bridge shape and place it over the Red River
--drag a road shape (square) and have it go N/S over the bridge
--drag a second road shape (round), connect to first and angle at 45
--drag the IH marker symbol and place on 1st road
--double the IH marker and you can change its number to 35
--drag another IH marker place it on 2nd road and number it 45
--click the Landmark Shapes stencil and drag a North arrow onto the page
(dont ask me why a North Arrow is a Landmark!!!)
--go to File/Save and save the document as c:\usr\init\Texas
4. To work with several drawings simultaneously, simply open another template with
--File/New/Map/Directional map (or any other type of template)
--select the one you wish to work with using
Window pull down menu to select by name
Or ctrl/Tab to scroll through all open drawings
--close all drawings by successively selecting File/Close (no need to save any)
Drawing a UML Diagram---generic approach
5. Open Visio (if not already open). Cancel splash screen if necessary and go to:
1
If you close these windows, re-opened by going to UML pull down menu.
Close the Pan &Zoom window to give you more space.
6. There are a variety of stencils for use at different stages of the design process. For example, the
UML Use Case stencil is used for modeling the users needs as discussed in class. In this demo,
we will concentrate on modeling the data, so click on Static Structure stencil to open it. It should
have shapes such as Package, Class, Data Type
--the Static Structure Diagram is the main type of diagram used in UML modeling
--Static Structure diagrams are used for both Logical Modeling (in essence, E/R diagrams) and
can then be developed into Physical Models specific for ESRI GDB via ArcCatalog.
--however, Visio knows nothing of ESRI as yet, which is how it should be since we are in the
Conceptual stage of the design
7.
8. Draw Generic UML Static Structure Diagram
--from UML Static Structure stencil, drag two Class shapes onto page and arrange vertically
--what are classes?
--zoom in to about 150% (use View/Zoom/150%, or type 150 in the Zoom box on toolbar)
--double click the top class box to open its Properties dialog
In Categories box, click Class, and then for Name, enter Vehicle
place check in boxes for: IsRoot and IsAbstract (what does this mean?)
Click Attributes tab, and click New button
In Attribute column, enter SeatingCapacity, (note: no spaces in names!)
In Type column
select VB::Integer
Click OK to close dialog
--from UML Static Structures stencil, drag a Generalization onto the page
Connect triangle end to Vehicle class, and other end to the other class
click any place on the page away from the shapes
be sure that no red appears in the boxes or the line
Double click the lower class box (probably labeled Class2)
In Categories box, click Class, for Name, enter Airplane
In Categories box, click Attributes,, then click the Vehicle tab at bottom.
--the attribute SeatingCapacity is inherited from abstract Vehicle class
Click the tab at bottom labeled Airplane
--click the New button and add the attribute CrewSize as VB-Integer
Click ok to close dialog
9. Note that on the drawing page:
The box name Vehicle is in italics to indicate that this is an abstract class.
The attributes (variables) are listed for each box:
--although SeatingCapacity is an attribute of Airplane, its not listed in the Airplane box
on the diagram. This is for simplicity since we know it will be inherited from Vehicle
where its listed.
10. Note in the Model Explorer window
2
14. Save under a different name so that we dont damage the template (best done now)
File/Save as, navigate to c:\my documents\uml and name it MyCityUML
3
From UML Static Structures stencil, drag another Class & place on page below Features box.
Double click new class to open its Property Editor and name it Building. Click OK.
From UML Static Structures stencil, drag a Generalization & place between these boxes
Connect the Generalization arrow head to the Features class.
Connect other end to the Building class.
Be sure there is no red showing on the diagram, or any entry in the Status Window
--these indicate errors. Fix them!!!
21.3 We now add a third class which is not spatial:
From UML Static Structures stencil, drag a Class & place on page by Object box.
Double click the box and name it Owner Click OK.
From UML Static Structures stencil, drag a Generalization and connect arrow head to Object
box, and other end to Owner class.
Since this class does not have spatial geometry it is connected to the object class and not
the feature class.
21.4 Note: the Generalization connections provide for inheritance of attributes. They are not
association or relationships in the sense that we have used these terms. To see their
effect:
double click on the Owner class to open the UML Class Properties dialog,
In Categories box, select Attributes
click the Object tab at bottom of Attributes table
note the ESRI ObjectID variable which has been inherited. Click OK.
22. Copy Classes into the Use Case Diagrams and Model Relationships
If necessary, open all the package folders under Workspace in the Model Exp.
(all expansion boxes need to have a - ; if have +, click it to open)
Note that the MyCity Overview package (folder) has 4 items: the MyCity Classes diagram plus
Building, Owner and Parcel classes.
Note that the MyCity Use Cases package contains only diagrams.
Double click the Owner Classes diagram to open its page (its blank)
From Model Exp., drag the Parcel and Owner classes under MyCity Overview onto the
empty page. Zoom in if needed by changing the red frame size in Pan&Zoom window.
Repeat for Land Mngmnt Use Cases.
Double click Property Classes diagram in Model Explorer to open its diagram
From the Model Exp., drag the Parcel, Owner & Building classes under MyCity
Overview onto the empty page. Zoom in if needed by changing the red frame size.
Note: Although we talked of copying tables from Overview to each use case, in fact these are
more like shortcuts. Its the same table. Its simply present in multiple diagrams. If we change it
in one diagram, changes are automatically reflected wherever the table appears.
(Saved as MyCityUML_A.vsd)
23. Add attributes to the class tables.
Double click Parcel class either in the Model Explorer or the MyCity Classes diagram page.
The UML Class Properties dialog opens. In Categories. box, select Attributes
Be sure Parcel is selected at the bottom of the table (like an Excel worksheet selection)
Widen the Type column (in same way as you do in Excel, by dragging its edge)
Click the New button to add a new attribute
In the Name column, enter ParcelValue
In the Type column, click the down arrow and scroll to esriFieldTypeDouble
Click the Duplicate button to add another attribute of the same type
Name this Tax
6
25. Set tagged values for attribute fields (optionaldo #26 first)
Tagged Values can also be used to set properties for attributes, such as the maximum length
(number of digits) for a string variable.
Double click the Parcel class in Model Exp., In Categories. box, select Attributes
Click the CityName row to select it, then click the Properties button (lower right)
Select Tagged Values tab, then click New button
For Tag enter:
Length
For value enter:
25
and click OK, OK, to close dialogs
26. Adding more Attributes and Spatial Geometry Definitions (optional)
There are more attributes we could add (as in Step #23), and more spatial geometries we need
to define (as in step #24). These are listed below. To save time, we will not do this in class now;
instead, we will later read in a model which includes them.
Add attributes as in Step23
To Owner Class
OwnerName as esriFieldTypeString
OwnerID as esriFieldTypeInteger
To Building Class
Stories as esriFieldTypeInteger
7
Height as esriFieldTypeDouble
BuildingValue as esriFieldTypeDouble
APN (for Assessor Parcel Number) as esriFieldTypeInteger
To Parcel class
CityName, with type esriFieldTypeString
Define Spatial Geometry as in Step 24:
For Building class as esriGeometryPolygon
Saved as MyCityUML_B.vsd (with additional attributes included.)
27. Modeling Relationships: Creating a Relationship Class for 1 to Many Relationship
We will now model the relationship between Parcel and Building.
Double click the Property Classes diagram in the LandMngmnt Use Case to open it.
Zoom in if necessary
From the Static Structure stencil, drag a Composition shape onto the diagram
Connect the diamond end to Parcel and the other end to Building
Double click the line and the UML Associations Properties dialog opens
Name the relationship APNRel (Assesor parcel number relationship)
Under End Name, enter APNRel:Parcel (for the parcel end)
Set its Multiplicty to 1
APNRel:Bldg (for the building end)
Set its Multiplicty to * (for many) Click OK
To have the Relationship name show on the diagram, right click the line and select
Shape Display Options, Place check in Name box.
We now use tagged values to specify the key fields
Double click the APNRel line in the diagram--UML Assoc. Properties dialog opens:
In Categories. box, select Tagged Values
Click the New button
For Tag name enter: OriginPrimaryKey
For Value enter:
APN
Click OK
Click New button again to enter a second tagged value
For Tag name enter: OriginForeignKey
For Value enter:
APN
Click OK
Click New button again to enter a third tagged
value
For Tag name enter: Notification
For Value enter: esriRelNotificationBoth Click OK
Click New button again
For Tag name enter: OriginClass
For Value enter: Parcel
Click OK
Properties dialog should look like this.
Check all spellings, spaces and cases!!!
Click OK to close Properties dialog.
You have created a relationship named APNRel
Its a composite type (implemented via Notification) in which Parcel controls the life
of building. If parcel deleted, building is automatically deleted. (Perhaps not a good idea
since could have parcel consolidation with building remaining!)
Its cardinality is one (Parcel) to many (Buildings).
APN is the key field in the entity classes
(Saved as MyCityUML_C.vsd)
8
28. Modeling Relationships: Creating an Attributed Relationship Class for Many to Many
Relationship.
(only do this in class if time permits)
A Relationship class can have its own attributes (in a table) to describe the nature of the
relationship between the entity objects. These are normally used to model many to many
relationships.
28.1 Add association.
Double click the Owner Classes diagram in the TaxMngmnt Use Case to open it.
Zoom in if necessary
From the Static Structure stencil, drag a Binary Association shape onto the diagram
Connect one end to Parcel and the other end to Owner
Double click the line and the UML Associations Properties dialog opens
Name the relationship OwnsRel (Owners relationship)
Under End Name, enter OwnsRel:Parcel (for the parcel end)
Set its Multiplicty to * (for many)
OwnsRel:Owner (for the Owner end)
Set its Multiplicty to * (for many) Click OK to close.
To have the names show on the diagram, right click the line and select Shape Display
Options, Place check in Names box.
28.2 Add association class
For many to many relationships, an intermediate key table is needed. This stores the key
values needed to match objects between classes, and may also have additional attributes
describing the relationship.
From the Static Structure stencil, drag another Class shape onto the diagram and
position it below the relationship line. Double click the new class to open its properties.
For name enter: OwnsRel
Under Stereotype, choose RelationshipClass (scroll down to find this)
Click OK to close the properties dialog.
(note: the name of the key class table must be same as relationship name)
28.3 Add attributes to key table
Double click the OwnsRel class box and add the following attributes and specify their type
APN--- esriFieldTypeInteger
OwnerID ---esriFieldTypeInteger
PercentOwns---esriFieldTypeDouble
BuyDate---esriFieldTypeDate
SellDate---esriFieldTypeDate
Click Ok to Close Properties Box
28.4 Establish Key fields
Note: this is done with the relationship line, not the key class.
Again, tagged values specify the key fields
Double click the OwnsRel line in the diagram
UML Assoc. Properties dialog opens: In Categories box, select Tagged Values
Click the New button
For Tag name enter: OriginPrimaryKey
For Value enter:
APN
Click OK
9
Repeat this process to add the following tag names and values
OriginForeignKey ---APN
DestinationPrimaryKey ---- OwnerID
DestinationForeignKey ---- OwnerID
Notification ---esriRelNotificationBoth
IsAttributed ---True
OriginClass ---Parcel
Note: OriginClass is necessary when trying to transform the
model into XMI format.
Properties box should look like this when finished. Check all spellings and cases!!! Click OK to
close.
28.5 To Summarize
You modeled a many to many relationship.
Relationship attributes are stored in a key table with same name as the relationship.
The key class table must contain the same key fields as in the origin and destination tables.
The key fields are identified using tags on the relationship (association line) linking the origin
and destination tables.
(Saved as MyCityUML_X.vsd)
29. Modelling Other Geodatabase Capabilities
It is also possible to include other geodatabase capabilities in your UML modeling including:
Feature Datasets
Subtypes
Domains (both range and coded value)
Networks; Connectivity Rules, Edge-Edge Rules, Edge-Junction Rules
30. Exporting Model to XMI and Loading into a Geodatabase via ArcCatalogOverview of Process
Our next steps are to:
(i) export our model to XMI.
(ii) check the model for errors
(iii) Use ArcCatalog to create the Geodatabase schema from XMI
XMI is the industry standard for object repositories. If you are using Visio 2000, you can also
export to MS Object Repository. However, XMI is much faster and preferred to MS Repository
because it is an open standard.
There are three preparatory things you may need to do:
(1) load the model MyCityUML_X.vsi before proceeding. This should not have any errors and thus
will load correctly! It is in the uml folder which you downloaded from P: to C:\My documents\uml
(2) Be sure the file uml.dtd is in the folder where your XMI file will be saved (this can be the same
folder where your Visio files are saved).
This file can be found in C:\Program Files\arcgis\CaseTools\Utilities\ It was already placed in
the uml folder on the P:/ drive, so if you copied this folder to c:\My Documents\uml and are
now saving your files there you should be OK.
(3) If you are not in the computer lab, you will need to install the XMI Export facility on your
computer. Go to http://support.esri.com, search on XMI Export, and follow the instructions in
HowTo: Visio 2003 Professional UML to XMI Export Facility Installation (Article ID 26105)
10
31.
13