52
Building Geodatabases with Rational Rose GIS by ESRI

Building Geodatabases with Rational Rose

  • Upload
    others

  • View
    6

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Building Geodatabases with Rational Rose

Building Geodatabases with Rational Rose

GIS by ESRI™

Page 2: Building Geodatabases with Rational Rose

Copyright © 2002 ESRI.All rights reserved.Printed in the United States of America.

The information contained in this document is the exclusive property of ESRI. This work is protected under United States copyright law and otherinternational copyright treaties and conventions. No part of this work may be reproduced or transmitted in any form or by any means, electronic ormechanical, including photocopying and recording, or by any information storage or retrieval system, except as expressly permitted in writing by ESRI. Allrequests should be sent to Attention: Contracts Manager, ESRI, 380 New York Street, Redlands, CA 92373-8100, USA.

The information contained in this document is subject to change without notice.

U.S. GOVERNMENT RESTRICTED/LIMITED RIGHTSAny software, documentation, and/or data delivered hereunder is subject to the terms of the License Agreement. In no event shall the U.S. Government

acquire greater than RESTRICTED/LIMITED RIGHTS. At a minimum, use, duplication, or disclosure by the U.S. Government is subject to restrictions as

set forth in FAR §52.227-14 Alternates I, II, and III (JUN 1987); FAR §52.227-19 (JUN 1987) and/or FAR §12.211/12.212 (Commercial Technical Data/

Computer Software); and DFARS §252.227-7015 (NOV 1995) (Technical Data) and/or DFARS §227.7202 (Computer Software), as applicable. Contractor/

Manufacturer is ESRI, 380 New York Street, Redlands, CA 92373-8100, USA.

ESRI, ArcInfo, ArcGIS, ArcCatalog, and GIS by ESRI are trademarks, registered trademarks, or service marks of ESRI in the United States, the European

Community, or certain other jurisdictions.

Other companies and products mentioned herein are trademarks or registered trademarks of their respective trademark owners.

attribution_RationalRose.pmd 5/31/2002, 12:30 PM1

Page 3: Building Geodatabases with Rational Rose

IN THIS DOCUMENT

1

Building geodatabases with Rational Rose

• Designing the object model inRational Rose

• The ArcInfo UML Model

• Creating UML packages and classdiagrams

• Creating clones of classes withthe Class Wizard

• Creating feature datasets andfeature classes

• Adding fields to a feature class

• Setting tagged values

• Creating relationship classes,domains, subtypes, relationshiprules, and geometric networks

• Exporting your UML model to theXMI file

• Checking your model for errors

The geodatabase brings the physical representation of geographicfeatures closer to their actual real-world counterparts. It is possible tocreate hydrants, mains, and valves and to define a number ofcharacteristics for each, such as fields, validation rules, relationships, andsubtypes. The Computer-Aided Software Engineering (CASE) toolssubsystem allows you to create blueprints of the structure of thegeodatabase using a graphical language—the Unified Modeling Language(UML). Using class diagrams, you can represent geodatabase elements,such as feature datasets or geometric networks, and clearly see therelationships among them.

This document discusses how you can use Rational SoftwareCorporation’s Rational Rose® to construct your UML.

RationalRose.pmd 11/7/2002, 5:10 PM1

Page 4: Building Geodatabases with Rational Rose

2 BUILDING GEODATABASES WITH RATIONAL ROSE

Designing the object model in Rational Rose

UML models are created using specialized tools, such asMicrosoft® Visio® or Rational Rose, then exported to anintermediate format: the Microsoft Repository or an XMLMetadata Interchange (XMI) file. The CASE tools will read themodel and allow you to create the geodatabase schema and,optionally, generate code to define custom behavior.

XMI is an Object Management Group (OMG) standard thatspecifies how to store a UML model in an XML file. ESRI®

ArcGIS™ now reads models in XMI files, as well as modelsstored in the Microsoft Repository.

This document discusses how to create your UML diagram usingRational Rose. You will learn about:

• Creating a new framework

• The ArcInfo™ UML Model

• Creating UML packages and class diagrams

• Creating feature datasets

• Creating feature classes

• Setting tagged values

• Creating relationship classes

• Creating domains

• Creating subtypes

• Creating relationship rules

• Creating a geometric network

• Exporting a model to XMI

This document discusses how to create models with RationalRose only. It does not touch on general modeling concepts orhow to actually create geodatabase schemas. For information onthese subjects, see Building a Geodatabase.

RationalRose.pmd 11/7/2002, 5:10 PM2

Page 5: Building Geodatabases with Rational Rose

BUILDING GEODATABASES WITH RATIONAL ROSE 3

Creating a new framework

In Rational Rose, you can create a new framework. A framework inRational Rose is a set of predefined model elements that allowyou to model your system. The purpose of a specific framework isto define the architecture of systems of a certain kind or toprovide a set of reusable components. Frameworks are used astemplates when creating a new model. Each framework is stored ina separate folder in \Framework\Frameworks folder (the frameworklibrary) in your Rational Rose installation folder.

If the Framework Wizard Add-In is installed and activated, theFile > New command opens the Create New Model dialog box.This dialog box displays a number of frameworks that can beused when creating a new model.

1. Start Rational Rose.

2. In Rational Rose, click File and click Open.

3. To create a new framework, click Make New Framework.

4. Click OK. The Framework Wizard then starts.

5. Type a name for your new framework—for example, “ArcInfoUML Model”.

6. Browse to the Rational Rose Drawing template which islocated under your ArcGIS installation in the CaseTools\UmlModels directory and select the ArcInfo UML Model templatefile. The ArcInfo UML template model will be used as thetemplate when creating new models from this framework.

7. Click the Start Diagram dropdown arrow and select theWorkspace.

8. Click Next. u

3 4

567

8

RationalRose.pmd 11/7/2002, 5:10 PM3

Page 6: Building Geodatabases with Rational Rose

4 BUILDING GEODATABASES WITH RATIONAL ROSE

9. A summary of the new framework is shown. Click Finish. 10. When the Framework Wizard is finished, a folder with thesame name as the new framework, containing the specifiedfiles, has been created in the \Framework\Frameworks folder,and the new framework is available to the user for creatingnew models.

9

Q

RationalRose.pmd 11/7/2002, 5:10 PM4

Page 7: Building Geodatabases with Rational Rose

BUILDING GEODATABASES WITH RATIONAL ROSE 5

The ArcInfo UMLModelThe ArcInfo UML Model hasfour packages: Logical view,ESRI Classes, ESRI Interfaces,and Workspace. These UMLpackages act as directorieswhere different parts of theentire object model are main-tained. The Logical Viewpackage is the root level andcontains the other threepackages.

Logical View package

1. Click the plus sign next to theLogical View package toexpand the tree view.

Tip

Workspace packageDatabase designers and develop-ers must use the Workspacepackage to create objects anddatabase designs.

1

RationalRose.pmd 11/7/2002, 5:10 PM5

Page 8: Building Geodatabases with Rational Rose

6 BUILDING GEODATABASES WITH RATIONAL ROSE

1. In the Browser tree, click theplus sign next to theWorkspace package toexpand the tree view.

2. Select the Workspacepackage and right-click it.Point to New and clickPackage. Type the name ofyour new package.

3. Select the new package andright-click it. Point to New andclick Class Diagram to createa new diagram. Type thename of your new classdiagram.

Creating UMLpackages andclass diagramsA package contains any numberof UML elements, such as otherpackages, classes, interfaces,and diagrams. There is no limitto the number of packages anobject model may contain. Forexample, you could have amodel that has the followingpackages: Domains,ElectricUtils, and Landbase.

Tip

Class diagramTo activate your class diagram,double-click it. Creating severalclass diagrams can help youreduce diagram cluttering. Apackage can contain many classdiagrams, and UML elements canappear in any diagram.

See Also

See also ‘Creating feature datasets’in this document.

1

2

3

RationalRose.pmd 11/7/2002, 5:10 PM6

Page 9: Building Geodatabases with Rational Rose

BUILDING GEODATABASES WITH RATIONAL ROSE 7

Creating clonesof classes withthe Class WizardThe Class Wizard allows you toclone a new class from anexisting class whereby theclone is an exact replica of theexisting class.

Creating clones of existingclasses is convenient whencreating certain geodatabaseelements, such as subtypes,domains, and geometricnetworks.

1. Right-click on the classdiagram and click ClassWizard.

2. Click Clone the class basedon an existing class.

3. Click Next. u

1

2

3

RationalRose.pmd 11/7/2002, 5:10 PM7

Page 10: Building Geodatabases with Rational Rose

8 BUILDING GEODATABASES WITH RATIONAL ROSE

4. Click the dropdown arrowand select the packagewhere the source class islocated.

5. Click the class that you wantto clone.

6. Click Next. u

Tip

Setting the stereotypeWhen cloning the domains andgeometric network templates, makesure you reset the stereotype foreach class cloned.

For example:

• A coded value domain classshould have a stereotype ofCodedValueDomain.

• A range domain class shouldhave a stereotype ofRangeDomain.

• A geometric network classshould have a stereotype ofGeometricNetwork.

5

6

4

RationalRose.pmd 11/7/2002, 5:10 PM8

Page 11: Building Geodatabases with Rational Rose

BUILDING GEODATABASES WITH RATIONAL ROSE 9

7. Enter the name of the newclass.

You can also enter a descrip-tion of the class you arecreating.

8. Click Next.

9. Click the package withinwhich the class will becreated.

10. Click Next. u

7

8

9

Q

RationalRose.pmd 11/7/2002, 5:10 PM9

Page 12: Building Geodatabases with Rational Rose

10 BUILDING GEODATABASES WITH RATIONAL ROSE

11. Click the class diagramwithin which the class will becreated.

12. Click Next.

13. Click Finish.W

E

R

RationalRose.pmd 11/7/2002, 5:10 PM10

Page 13: Building Geodatabases with Rational Rose

BUILDING GEODATABASES WITH RATIONAL ROSE 11

Creating featuredatasetsFeature datasets are modeled inUML as stereotyped packagesthat you create under thegeodatabase workspacepackage. A feature datasetpackage cannot be createdunder another feature datasetpackage; however, otherpackages created for organiza-tional puposes can. Forexample, a package to hold all ofthe subtypes for a particularclass can be created under afeature dataset package.

1. In the Browser, double-clickthe Workspace diagram toopen it.

2. In the UML Toolbox, click thePackage icon and click thediagram. Type the name ofthe package.

3. In the Browser tree, right-clickthe new package and selectOpen Specification. u

Tip

Feature datasetsFeature datasets have a spatialreference associated with them.Spatial references are not modeledin UML. Instead, the spatialreference for a feature dataset isset when generating the schema inArcCatalog™.

3

2

RationalRose.pmd 11/7/2002, 5:10 PM11

Page 14: Building Geodatabases with Rational Rose

12 BUILDING GEODATABASES WITH RATIONAL ROSE

4. In the Package Specificationdialog box, click the Stereo-type dropdown arrow andtype or selectFeatureDataset.

5. Click OK.

The Browser will show thename and stereotype of thepackage.

5

4

5

RationalRose.pmd 11/7/2002, 5:10 PM12

Page 15: Building Geodatabases with Rational Rose

BUILDING GEODATABASES WITH RATIONAL ROSE 13

Creating a feature class

1. In the Browser tree underESRI Classes, click theparent class Feature. Dragand drop the class onto yourdiagram.

2. In the UML Toolbox, click theClass icon and click ontoyour diagram to add a newclass. u

Creating featureclassesFeature classes are representedby UML classes in the model.Feature classes can be createdin the Workspace package or ina feature dataset package.

1

2

1

2

RationalRose.pmd 11/7/2002, 5:10 PM13

Page 16: Building Geodatabases with Rational Rose

14 BUILDING GEODATABASES WITH RATIONAL ROSE

3. In the diagram, select thenew class and right-click it.Select Open Specification.

4. Type the name of the featureclass.

5. Click OK to accept thechanges. u

Tip

Feature classesSelect your new package and right-click. Select New and click Class.In the Browser, enter the name ofyour new class and select and dragthe new class onto your diagram.

Tip

Abstract classesYour model may include abstractclasses. Fields in abstract classesare inherited by the class descen-dants. To create an abstract, checkthe Abstract check box on theDetail tab located in the ClassSpecification dialog box to mark aclass as abstract.

Abstract notation is indicated bydisplaying the class name in italicson the diagram.

4

5

3

RationalRose.pmd 11/7/2002, 5:10 PM14

Page 17: Building Geodatabases with Rational Rose

BUILDING GEODATABASES WITH RATIONAL ROSE 15

6. In the UML Toolbox, click theGeneralization button. Clickon the new class and dragand click the parent class.

6

RationalRose.pmd 11/7/2002, 5:10 PM15

Page 18: Building Geodatabases with Rational Rose

16 BUILDING GEODATABASES WITH RATIONAL ROSE

1. In the diagram, double-clickthe new class.

2. Click the Attributes tab.

3. Right-click and select Insertfrom the context menu.

4. Double-click the newattribute. u

Adding fields to afeature classYou can add fields to a featureclass by adding attributes tothe UML class.

The field type is one of thevalues of the esriFieldTypeenumeration—for example,esriFieldTypeInteger.

A domain created beforehandcan be used as the attributetype as well.

Tip

Default valueYou can set the default for a field byentering the value in the InitialValue text box in the Class AttributeSpecification dialog box. Defaultvalues are optional.

2

3

4

1

RationalRose.pmd 11/7/2002, 5:10 PM16

Page 19: Building Geodatabases with Rational Rose

BUILDING GEODATABASES WITH RATIONAL ROSE 17

5. Click the field Type. Enter theType of the field—for ex-ample,“esriFieldTypeString”—orclick the Type dropdownarrow and click the Type offield.

6. To add more than one field,place the mouse pointer inthe Attribute form and right-click. Select Insert and type aname.

7. Click OK.

8. The fields appear as at-tributes of the class in thediagram.

To set tagged values, see‘Setting tagged values’ in thisdocument.

7

5

8

RationalRose.pmd 11/7/2002, 5:10 PM17

Page 20: Building Geodatabases with Rational Rose

18 BUILDING GEODATABASES WITH RATIONAL ROSE

Setting taggedvaluesYou use tagged values to setadditional properties of UMLelements. For example, you canset the Length (in characters) ofa string field by using a taggedvalue.

Tagged values are recognizedon several other UML elements:class, interface, attribute,associations, and so on.

Setting tagged values forattribute fields

1. Double-click the UML Class.

2. Click the Attributes tab.

3. Double-click the attributefield. u

Tip

Tagged values forattributesExamples of tagged values for theattributes include the following:

• Length: number of characters ofa string field.

• Precision: number of digits of anumber. Applies to all numericfields.

• Scale: number of decimal digits.Applies to double and singlefields.

• AllowNulls: Boolean. Applies toall fields.

1

2

3

RationalRose.pmd 11/7/2002, 5:10 PM18

Page 21: Building Geodatabases with Rational Rose

BUILDING GEODATABASES WITH RATIONAL ROSE 19

4

5

4. Click the TaggedValues taband click the Set dropdownarrow.

5. Select the appropriate set oftags—for example, Field.

6. Click <Property Name> inModel Properties.

7. Click the Value row forLength and type a value forthe tag. For example, type“50” for the length of theaddress field.

8. Click Override.

9. Click OK.

7

8

6

RationalRose.pmd 11/7/2002, 5:10 PM19

Page 22: Building Geodatabases with Rational Rose

20 BUILDING GEODATABASES WITH RATIONAL ROSE

Setting tagged values forclasses

1. Click the UML Class. Right-click it and click OpenSpecification.

2. Click the TaggedValues taband click the Set dropdownarrow. Select FeatureClass. u

1

Tip

Tagged values for classesExamples of tagged values forfeature classes include thefollowing:

• Alias

• ConfigKeyword

• HasM

• HasZ

• GeometryType

• AncillaryRole

2

RationalRose.pmd 11/7/2002, 5:10 PM20

Page 23: Building Geodatabases with Rational Rose

BUILDING GEODATABASES WITH RATIONAL ROSE 21

3. Click <Property Name> inModel Properties.

4. Click the Value for the tagand type or select theappropriate value. Forexample, selectesriGeometryPolygon as thegeometry type for theBuilding feature class.

5. Click Override.

6. Click OK. 4

3

5

RationalRose.pmd 11/7/2002, 5:10 PM21

Page 24: Building Geodatabases with Rational Rose

22 BUILDING GEODATABASES WITH RATIONAL ROSE

CreatingrelationshipclassesUML associations representrelationship classes amongfeature classes and objectclasses (tables).

Relationship classes can becreated among leaf classes.Primary and foreign key fieldsmust be present in the classes.

Tagged values for relationshipclasses include the following:

• OriginClass: the name of theorigin class.

Example: PowerPole

• OriginPrimaryKey: the nameof the primary key field inthe origin class.

Example:OriginPrimaryKey=OBJECTID

• OriginForeignKey: the nameof the foreign key field in thedestination class.

Example:OriginForeignKey=PoleID u

Creating nonattributedrelationship classes

1. In the UML Toolbox, click theAssociation button.

2. Connect the two classes.Create the association bydragging a line from thedestination class to the originclass. u

2

1

RationalRose.pmd 11/7/2002, 5:10 PM22

Page 25: Building Geodatabases with Rational Rose

BUILDING GEODATABASES WITH RATIONAL ROSE 23

3. Double-click the association.Type a name for the associa-tion.

4. To name the associationends, click field Role A andRole B. Type a name for eachassociation end.

5. To set the multiplicity for therelationship class, click theRole A Detail and Role BDetail tabs. You must set themultiplicity for each end.

6. Type the multiplicity value orclick the dropdown arrow andselect the multiplicity. Con-nect the two classes.

7. To create a compositerelationship, click theAggregate check box.

Use the Aggregate field to seta direction to the whole/partrelationship among instancesof these classes. Only oneend of the relationship maybe the aggregate. u

The cardinality of the relation-ship class is derived from themultiplicity of both associationends. Because the cardinality ofa relationship class can be only1-1, 1-M, or M-N, the only validmultiplicity values are 1 and *(many). The name of anassociation end becomes arelationship class path label.

Tip

Composite relationshipsIn a composite relationship, one ofthe objects controls the lifetime ofthe associated objects. You cancreate a composite relationship byusing an aggregation instead of anassociation.

3

4

7

5

5

Tip

Using OBJECTID as a keyfieldOBJECTID is defined in the Objectclass and is inherited by all otherclasses. If a field typed as OID isused as the primary key, then theforeign key must be typed asesriFieldTypeInteger.

RationalRose.pmd 11/7/2002, 5:10 PM23

Page 26: Building Geodatabases with Rational Rose

24 BUILDING GEODATABASES WITH RATIONAL ROSE

8. Click OK.

The relationship class isshown as an associationbetween two classes. Thename of the association isthe name of the relationshipclass.

6

8

The relationship class is shownas an association betweenclasses.

RationalRose.pmd 11/7/2002, 5:10 PM24

Page 27: Building Geodatabases with Rational Rose

BUILDING GEODATABASES WITH RATIONAL ROSE 25

Creating attributedrelationship classes

1. Create the UML associationrepresenting the relationshipclass by following steps 1through 8 of ‘Creatingnonattributed relationshipclasses’ in this document.

2. In the UML Toolbox, click theClass button and click ontoyour diagram to add a newclass. Type the name of theassociation as the name ofthe new class.

3. Double-click the new class. u

1

2

RationalRose.pmd 11/7/2002, 5:10 PM25

Page 28: Building Geodatabases with Rational Rose

26 BUILDING GEODATABASES WITH RATIONAL ROSE

4. Click the Stereotypedropdown arrow and type orselect RelationshipClass.

5. Follow steps 1 through 5 of‘Adding fields to a featureclass’ in this document to addfields to the relationshipclass.

6. Click OK.

The keys for the relationshipclass are set in UML usingtagged values.

7. To set the tagged values forthe relationship class, followsteps 1 through 7 of ‘Settingtagged values for relation-ship classes’ in this docu-ment.

You should set the tags forthe origin primary key, originforeign key, destinationprimary key, destinationforeign key, and notification.

4

6

RationalRose.pmd 11/7/2002, 5:10 PM26

Page 29: Building Geodatabases with Rational Rose

BUILDING GEODATABASES WITH RATIONAL ROSE 27

Setting tagged values forrelationship classes

1. To set the tagged values forthe relationship class, clickthe TaggedValues tab.

2. Click the Set field and clickthe dropdown arrow. ClickRelationship Class.

3. Click <Property Name> inModel Properties. u

12

3

Tip

Association tagged valuesThe tagged value should be in theassociation and not in the classwith the attributes of the relation-ship.

A relationship class can have itsown set of attributes. You canmodel such relationship classesby adding a UML class namedafter the relationship andstereotyped asRelationshipClass. The fields ofthe relationship class aremodeled in the same way asfields in any other class.Foreign keys must be includedin the class representing theattributed relationship. Many-to-many relationships arealways attributed.

The following tagged values arerecognized for attributedrelationship classes:

• IsAttributed: should be“True”.

• OriginClass: the name of theorigin class.

Example:OriginClass=Owner

• OriginPrimaryKey: the nameof the primary key field in theorigin class.

Example:OriginPrimaryKey=OBJECTID u

RationalRose.pmd 11/7/2002, 5:10 PM27

Page 30: Building Geodatabases with Rational Rose

28 BUILDING GEODATABASES WITH RATIONAL ROSE

4. In the <Property Name> inthe Model Properties, clickthe Value field for a property.

Enter a value or click thevalue dropdown arrow andselect a value.

5. Click Override.

6. Repeat steps 1 through 5 toset the primary origin key, theprimary foreign key, and thenotification.

7. Click OK.

4

5

7

• OriginForeignKey: the nameof the foreign key field in thedestination class.

Example:OriginForeignKey=OwnerID

• DestinationPrimaryKey: thename of the primary key fieldin the destination class.

Example:DestinationPrimaryKey=OBJECTID

• DestinationForeignKey: thename of the foreign key fieldin the attributed relation-ship.

Example:DestinationForeignKey=BuildingID

• Notification: one of thevalues of theesriRelNotification enumera-tion.

Example:Notification=esriRelNotificationBoth

RationalRose.pmd 11/7/2002, 5:10 PM28

Page 31: Building Geodatabases with Rational Rose

BUILDING GEODATABASES WITH RATIONAL ROSE 29

Creating a domain

1. Click Tools from the Mainmenu and click Class Wizard.

2. Click Clone the class basedon an existing class.

3. Click Next. u

Creating domainsDomains are modeled in UMLas stereotyped classes.Domains can be used as thetype of a field to define the typeand valid values for the field.

The first three attributes in theclass define the field type, themerge policy, and the splitpolicy. The type for any ofthese attributes is not importantand can be left unspecified. Theinitial value, however, is theactual setting. For example, thefollowing is a validMergePolicy:

• Attribute name:MergePolicy

• Attribute type: <Blank>

• Attribute Initial Value:esriMPTDefaultValue

The valid initial values forFieldType, MergePolicy, andSplitPolicy are taken from theesriFieldType, esriMergePolicy,and esriSplitPolicy enumera-tions, respectively.

In addition to the standardattributes of domains(FieldType, MergePolicy, andSplitPolicy), range domainshave MinValue and MaxValue. u

1

2

RationalRose.pmd 11/7/2002, 5:10 PM29

Page 32: Building Geodatabases with Rational Rose

30 BUILDING GEODATABASES WITH RATIONAL ROSE

4. Click the dropdown arrowand click Templates.

5. Click the class that you wantto clone:

TemplateCodedValueDomain

or

TemplateRangeDomain

Click Next.

6. Enter the name of the domainclass.

You can also enter a descrip-tion of the class you arecreating.

7. Click Next. u

The initial values in MinValueand MaxValue define the actualrange. The type of theseattributes is not important andcan be left unspecified.

Coded value domains can haveany number of UML attributesrepresenting the set of permis-sible values. The initial valuedefines the valid code, and thename of the attribute is thename of the code. The type ofthese attributes is not importantand can be left unspecified.

To facilitate the creation ofdomains, the ArcInfo UMLModel has template domainsthat can be cloned and modi-fied.

Tip

Class WizardYou can run the Class Wizard fromthe diagram by right-clicking onthe diagram and selecting ClassWizard from the context menu.

4

5

6

7

RationalRose.pmd 11/7/2002, 5:10 PM30

Page 33: Building Geodatabases with Rational Rose

BUILDING GEODATABASES WITH RATIONAL ROSE 31

8. Click the package withinwhich the domain class willbe created.

9. Click Next.

Follow the Class Wizardinstructions to complete thecloning of the domain class.

When you reach the lastdialog box of the wizard, clickFinish. The domain class willbe copied to the parentcategory you selected.

You must reset the stereotypefor the domain class youcreated.

10. Repeat steps 1 through 9 tocreate each domain.

Tip

DomainsWhen creating the domains usingthe Class Wizard, the cloned classwill not contain the stereotype forthe domain. You will have to set thestereotype for each cloned domainclass.

Examples of stereotypes for thedomain include the following:

• CodedValueDomain

• RangeDomain

Tip

Domain packageDomain classes should be createdwithin a Domain package underthe Workspace package.

You must set the stereotype forthe domain class you created.

8

9

RationalRose.pmd 11/7/2002, 5:10 PM31

Page 34: Building Geodatabases with Rational Rose

32 BUILDING GEODATABASES WITH RATIONAL ROSE

CodedValue domain

1. Double-click the codedvaluedomain and click the At-tributes tab.

2. Double-click the attribute.

3. Type the type of field withwhich this domain will beassociated in the Initial valuetext box.

4. Click OK.

5. Double-click MergePolicy.

6. Type the merge policy in theInitial value text box.

7. Click OK.

8. Double-click SplitPolicy.

9. Type the split policy in theInitial value text box.

10. Click OK.

11. Double-click the Code1attribute. u

Tip

Tagged values for domainsAn example of a tagged value forthe domain includes the following:

• Description: string value

Tip

Adding additional codesIn the UML attribute form, you canadd additional codes by right-clicking the attribute form. Clickinsert and enter the name. Tab overto each property and enter or selecta value.

3

4

1

2W

RationalRose.pmd 11/7/2002, 5:10 PM32

Page 35: Building Geodatabases with Rational Rose

BUILDING GEODATABASES WITH RATIONAL ROSE 33

12. Type the code name.

13. Type the code in the Initialvalue text box.

14. Click OK.

15. Repeat steps 11 through 14for the other codes.

E

T

R

RationalRose.pmd 11/7/2002, 5:10 PM33

Page 36: Building Geodatabases with Rational Rose

34 BUILDING GEODATABASES WITH RATIONAL ROSE

Range domain

1. Double-click the rangedomain and click the At-tributes tab.

2. Double-click the attribute.

3. Type the type of field withwhich this domain will beassociated in the Initial valuetext box.

4. Click OK.

5. Double-click MergePolicy.

6. Type the merge policy in theInitial value text box.

7. Click OK.

8. Double-click SplitPolicy.

9. Type the split policy in theInitial value text box.

10. Click OK.

11. Double-click the MinValueattribute. u

3

4

1

2

W

RationalRose.pmd 11/7/2002, 5:10 PM34

Page 37: Building Geodatabases with Rational Rose

BUILDING GEODATABASES WITH RATIONAL ROSE 35

12. Type the minimum value forthe range domain in theInitial value text box.

13. Click OK.

14. Double-click the MaxValueattribute.

15. Type the maximum value forthe range domain in theInitial value text box.

16. Click OK.

E

R

RationalRose.pmd 11/7/2002, 5:10 PM35

Page 38: Building Geodatabases with Rational Rose

36 BUILDING GEODATABASES WITH RATIONAL ROSE

Setting domains in afeature class

1. Double-click the featureclass.

2. Click the Attributes tab.

3. Double-click the attributeproperty. u

1

2

3

RationalRose.pmd 11/7/2002, 5:10 PM36

Page 39: Building Geodatabases with Rational Rose

BUILDING GEODATABASES WITH RATIONAL ROSE 37

4. Click the Type dropdownarrow and click the domainyou want to associate withthe attribute as the type.

5. To associate a default valuewith this attribute, type thevalue in the Initial valuetextbox.

The value must correspondto a value set in the domainyou are associating with theattribute.

6. Click OK.

7. Repeat steps 3 through 6until you have associateddefault values and domainswith all the attributes.

8. The field appears in the classwith its domain as its typeand its default value as itsinitial value.

4

5

6

8

RationalRose.pmd 11/7/2002, 5:10 PM37

Page 40: Building Geodatabases with Rational Rose

38 BUILDING GEODATABASES WITH RATIONAL ROSE

CreatingsubtypesSubtypes are modeled in UMLas classes related to the parentclass through an associationstereotyped as Subtype. Youcan specify domains anddefault values for the fields inthe subtype.

A field in the parent class mustbe stereotyped asSubtypeField. Its initial value isthe subtype code of the defaultsubtype. The subtype fieldmust be typed as“esriFieldTypeInteger” in theparent class.

All subtypes must have aunique value for the subtypefield—this unique value is itssubtype code. Fields in thesubtype must match those ofthe parent class in name andtype, but not all the fields of theparent class have to be presentin the subtype. The subtypefield, however, is a requiredfield in the subtype.

Initial values must be type-compatible with the type of thefield. The type of a field can bea domain previously created.

Defining the subtype fieldfor the feature class

1. In the diagram, double-clickthe class for which you wantto create a subtype.

2. Click the Attributes tab.

3. Double-click the attribute thatwill be the subtype field. u

1

2

3

RationalRose.pmd 11/7/2002, 5:10 PM38

Page 41: Building Geodatabases with Rational Rose

BUILDING GEODATABASES WITH RATIONAL ROSE 39

4. Click the Stereotypedropdown arrow and type orselect SubtypeField.

5. Type the subtype code of thedefault subtype in the Initialvalue text box.

6. Click OK.

7. The subtype field appears asa property of the class with astereotype of SubtypeField.

4

5

6

7

RationalRose.pmd 11/7/2002, 5:10 PM39

Page 42: Building Geodatabases with Rational Rose

40 BUILDING GEODATABASES WITH RATIONAL ROSE

Tip

When to include a field in asubtypeA field should be included in asubtype only when you want toassociate a default value or domainwith it. Fields inherited fromabstract classes can be included insubtypes.

See Also

See also ‘Creating clones of classeswith the Class Wizard’ in thisdocument.

Creating a subtype

1. To create a new subtype,follow steps 1 through 13 of‘Creating clones of classeswith the Class Wizard’ in thisdocument.

2. Double-click the new class.

3. Click the Attributes tab.

4. Select the attributes that donot contain a default valueand delete the attributes.

5. Double-click the subtypeattribute. u

2

5

3

4

RationalRose.pmd 11/7/2002, 5:10 PM40

Page 43: Building Geodatabases with Rational Rose

BUILDING GEODATABASES WITH RATIONAL ROSE 41

Tip

Setting the initial value forthe subtype fieldBe careful when setting the initialvalue for the subtype field in yoursubtypes. Its value has to be uniqueacross all the subtypes of a class.

6. Click the Initial value fieldand type a code for thissubtype.

The initial value must beunique across all the sub-types of a class.

7. Click OK.

8. The initial value is displayedas the default value in thesubtype class.

7

6

8

RationalRose.pmd 11/7/2002, 5:10 PM41

Page 44: Building Geodatabases with Rational Rose

42 BUILDING GEODATABASES WITH RATIONAL ROSE

Associating the subtypewith its parent class

1. In the UML Toolbox, click theAssociation button. Click onthe subtype class, drag theassociation, then click theparent class.

2. In the diagram, double-clickthe association.

3. Click the Stereotypedropdown arrow and type orselect Subtype.

4. Click OK.

5. In the diagram, right-click theassociation and click thestereotype label menucommands to hide or displaythe stereotype name.

3

4

5

1

RationalRose.pmd 11/7/2002, 5:10 PM42

Page 45: Building Geodatabases with Rational Rose

BUILDING GEODATABASES WITH RATIONAL ROSE 43

Creatingrelationship rulesRelationship classes can have aset of relationship rules. Theserules control which subtypes ofobjects from the origin classcan be related to whichsubtypes of the destinationclass.

Relationship rules are repre-sented by a UML associationbetween subtypes. Multiplicityin association ends is used toset the cardinality of therelationship rule.

A value of 1..3 means at leastone and no more than threeobjects of this subtype can berelated.

The cardinality range of bothends must be compatible withthe cardinality of the parentrelationship class (in theexample, 1-1..3 is compatiblewith 1-M).

1. In the UML Toolbox, click theAssociation button. Connectthe two subtypes betweenwhich you want to create arelationship rule.

2. Double-click the association.

3. Type the name of the rela-tionship between the parentclasses as the name for thisassociation.

4. Click Apply. u

See Also

For more information on relation-ship rules, see Building aGeodatabase.

3

4

1

RationalRose.pmd 11/7/2002, 5:10 PM43

Page 46: Building Geodatabases with Rational Rose

44 BUILDING GEODATABASES WITH RATIONAL ROSE

5. Click the Role A Detail tab.

6. Type the valid cardinality asthe multiplicity of the associa-tion end.

7. Click Apply.

8. Click the Role B Detail tab.

9. Type the valid cardinality asthe multiplicity of the associa-tion end.

10. Click OK.

In the diagram, relationshipmultiplicity is displayed.

6

7

85

Q

Q

RationalRose.pmd 11/7/2002, 5:10 PM44

Page 47: Building Geodatabases with Rational Rose

BUILDING GEODATABASES WITH RATIONAL ROSE 45

CreatinggeometricnetworksA geometric network is modeledwith a UML class stereotypedas GeometricNetwork. UMLbinary associations are used toassociate the network featureclasses in the model with thegeometric network.

The geometric network UMLclass and all associated featureclasses must be created underthe same feature dataset UMLpackage.

The only attribute in a geomet-ric network class defines thenetwork type. When you clonethe template, the attribute isalready in the class.

Tip

Feature datasetsMake sure you have created afeature dataset before creating ageometric network. A geometricnetwork can exist only inside afeature dataset.

1. In the UML diagram, right-click and click Class Wizard.

2. Click the Clone the classbased on an existing classbutton.

3. Click Next.

4. Click the dropdown arrowand click Templates.

5. ClickTemplateGeometricNetwork.

6. Click Next.

7. Type a name for yourgeometric network. ClickNext. u

4

5

6

7

RationalRose.pmd 11/7/2002, 5:10 PM45

Page 48: Building Geodatabases with Rational Rose

46 BUILDING GEODATABASES WITH RATIONAL ROSE

8. Click the dataset where thegeometric network will becreated. Click Next.

Follow the Class Wizardinstructions to create thegeometric network. Thegeometric network will beadded automatically intoyour diagram.

9. Double-click the new class.

10. Set the stereotype of theclass to beGeometricNetwork.

11. In the UML Toolbox, click theAssociation button andconnect the network featureclasses to the geometricnetwork.

8

Q

W

W

RationalRose.pmd 11/7/2002, 5:10 PM46

Page 49: Building Geodatabases with Rational Rose

BUILDING GEODATABASES WITH RATIONAL ROSE 47

Exporting yourUML model to theXMI fileBefore you can generate yourgeodatabase schema from yourUML model, you must firstexport it to an XMI file.

The tool to export your UMLmodel to the XMI is not astandard tool within RationalRose. The exporter can bedownloaded from the RationalWeb site.

Exporting to a RationalRose XMI file

1. In Rational Rose, click Toolsand click Export Model toUML.

2. Click the XMI 1.1 button.

3. Click the Single file button.

4. Click the button that willallow you to check errors andwarnings.

5. Click OK.

For more information, clickthe Help button. u

1

2

3

4

5

RationalRose.pmd 11/7/2002, 5:10 PM47

Page 50: Building Geodatabases with Rational Rose

48 BUILDING GEODATABASES WITH RATIONAL ROSE

6. A message dialog box willdisplay. Click No if you do notwant to see messages. ClickYes if you want to seemessages. Clicking Yes willdisplay a message for allerrors and warnings.

7. Browse to navigate to thedirectory where you want tosave the XML file.

8. Type a name for your XMLfile.

9. Click Save.

10. Click OK.

6

7

8

9

Q

RationalRose.pmd 11/7/2002, 5:10 PM48

Page 51: Building Geodatabases with Rational Rose

BUILDING GEODATABASES WITH RATIONAL ROSE 49

Checking yourmodel for errorsThe semantics checker can beused to make sure your modelsare valid. If errors are found, areport will be automaticallycreated. The report can beprinted or exported to a numberof formats.

The semantics checker workson models already exported tothe Microsoft Repository or anXMI file.

You should run the semanticschecker before using theSchema Wizard.

Tip

Saving your new scriptSaving the new script will allowyou to rerun the semantics checkerafter you close and restart RationalRose.

Running the semanticschecker

1. To run the SemanticsChecker in Rational Roseyou will have to create a newscript. In Rational Rose, clickTools and click New Script.

2. Add the following code to theScript Editor Window:

Dim pSemCheck As Object

Set pSemCheck = CreateObject(“UmlSemCheck.SemChecker”)

pSemCheck.StartChecker

3. Click the Start button to runthe Semantics Checker. u

See Also

For more information on RationalRose Scripting, see Rational RoseHelp.

1

2

3

RationalRose.pmd 11/7/2002, 5:10 PM49

Page 52: Building Geodatabases with Rational Rose

50 BUILDING GEODATABASES WITH RATIONAL ROSE

A report is generated listing all of the modeling errors.

4. Select the source of yourmodel. In Rational Rose,models are stored in XMIfiles.

5. Type the path to the XMI fileor click Browse to navigate toit.

6. Click Check.

If errors are found, a report isgenerated listing all of themodeling errors.

Tip

OptionsChanging the options for the reportallows you to modify the errorreport. By default, the first twooptions will be checked.

5

4

6

RationalRose.pmd 11/7/2002, 5:10 PM50