Publishedby:
TechnicsPublications,LLC
2LindsleyRoad,BaskingRidge,NJ07920U.S.A.
www.technicspub.com
CoverdesignbyMarkBrye
EditedbyErinElizabethLong
CartoonsbyAbbyDenson,www.abbycomix.com
Allrightsreserved.Nopartofthisbookmaybereproducedortransmittedinanyformorbyanymeans,electronicormechanical, including photocopying, recording or by any information storage and retrieval system, without writtenpermissionfromthepublisher,exceptfortheinclusionofbriefquotationsinareview.
Theauthorandpublisherhavetakencareinthepreparationofthisbook,butmakenoexpressedorimpliedwarrantyofanykindandassumenoresponsibilityforerrorsoromissions.Noliability isassumedfor incidentalorconsequentialdamagesinconnectionwithorarisingoutoftheuseoftheinformationorprogramscontainedherein.
Embarcadero®,theEmbarcaderoTechnologieslogos,andallotherEmbarcaderoTechnologiesproductorservicenamesare trademarksor registered trademarksofEmbarcaderoTechnologies, Inc.Allother trademarksarepropertyof theirrespectiveownersandshouldbetreatedassuch.
Copyright©2015byTechnicsPublications,LLC
ISBN,printed.9781634620925
ISBN,PDF9781634620956
ISBN,Kindle9781634620932
ISBN,ePub9781634620949
FirstPrinting2011
SecondPrinting2015completelyrevised
LibraryofCongressControlNumber:2015910686
EmbarcaderoTechnologies, Inc. isa leadingproviderofaward-winning tools forapplicationdevelopersanddatabaseprofessionals so they candesign systems right, build them faster and run thembetter, regardless of their platformorprogramminglanguage.NinetyoftheFortune100andanactivecommunityofmorethanthreemillionusersworldwiderelyonEmbarcaderoproductstoincreaseproductivity,reducecosts,simplifychangemanagementandcomplianceandaccelerate innovation. The company’s flagship tools include: Embarcadero®DBArtisan®,Delphi®, ER/Studio®, RapidSQL®,andRADStudio.Foundedin1993,EmbarcaderoisheadquarteredinAustin,Texas,withofficeslocatedaroundtheworld.Embarcaderoisonlineatwww.embarcadero.com.
ContentsataGlance
SECTIONI:FoundationCHAPTER1:DataModelOverview
CHAPTER2:ER/StudioFunctionality
CHAPTER3:ER/StudioLandscape
SECTIONII:DataModelObjectsCHAPTER4:Entities
CHAPTER5:Submodels
CHAPTER6:AttributesandDomains
CHAPTER7:Relationships
SECTIONIII:Conceptual,Logical,andPhysicalDataModelsCHAPTER8:ConceptualDataModels
CHAPTER9:LogicalDataModels
CHAPTER10:PhysicalDataModels
SECTIONIV:AdditionalER/StudioFeaturesCHAPTER11:DataDictionary
CHAPTER12:DataLineage
CHAPTER13:Importing,Exporting,Printing,andReporting
CHAPTER14:NamingStandards
CHAPTER15:Compare/MergeUtility
CHAPTER16:FeaturesforAgileTeamsandContinuousImprovement
APPENDIXA:References
APPENDIXB:AnswerstoExercises
APPENDIXC:Glossary
APPENDIXD:ER/StudioCommandsQuickReference
Index
ContentsReadmefirst!
ConventionsUsedinThisBook
What’sDifferentinthe2ndEdition?
HowtoGettheMostoutofThisBook
SECTIONIFoundation
CHAPTER1DataModelOverview
FindingYourWay
RepresentinganInformationLandscape
LeveragingtheDataModel
EmbarkingonOurPublishingAdventure
EXERCISE1.1:EducatingYourNeighbor
CHAPTER2ER/StudioFunctionality
EXERCISE2.1:LearningMoreAbouttheER/StudioFamily
NewFeaturesinER/Studio
My“Top10”FavoriteFeaturesofER/Studio
EXERCISE2.2:InstallingandStartingER/Studio
CHAPTER3ER/StudioLandscape
UsingtheWindowsDataModelExplorer
DataModelWindow
OverviewWindow
ZoomWindow
UsingtheMenusApplicationMenus
ShortcutMenus
UsingtheToolbars
UsingKeyboardCommands
UsingtheStatusBar
EXERCISE3.1:CreatingaNewDataModelCreatingTitleBlocks
EditingTitleBlocks
DeletingTitleBlocks
EXERCISE3.2:SavingYourDataModel
EXERCISE3.3:ClosingandOpeningExistingDataModels
EXERCISE3.4:GettingComfortablewithER/Studio
SECTIONIIDataModelObjects
CHAPTER4Entities
EntityExplanation
EntityTypes
EntitiesinER/StudioCreatingEntities
CreatingTextBlocks
EditingEntities
ChangingtheNameofanEntity
MovingEntities
ResizingEntities
ChangingtheAppearanceofEntities
CopyingEntities
FindingEntities
FindEntity/View
UniversalNamingUtility
DeletingEntities
EXERCISE4.1:CreatingEntities
CHAPTER5Submodels
SubmodelExplanation
SubmodelsinER/StudioCreatingSubmodels
EditingSubmodels
MovingSubmodels
DeletingSubmodels
EXERCISE5.1:ChangingSettingsinSubmodels
EXERCISE5.2:CreatingThreeMoreSubmodels
EXERCISE5.3:CreatingTitleBlocksforEachSubmodel
CHAPTER6AttributesandDomains
AttributeExplanation
AttributeTypes
AttributesinER/StudioCreatingAttributes
EditingAttributes
MovingAttributes
DefiningAttributes
ChangingtheAppearanceofAttributes
CopyingAttributes
FindingAttributes
DeletingAttributes
EXERCISE6.1:CreatingAttributes
KeyExplanationCandidateKey
PrimaryandAlternateKeys
SurrogateKey
ForeignKey
InversionEntry
EXERCISE6.2:ClarifyingCustomerID
KeysinER/StudioCreatingaKey
EditingaKey
EXERCISE6.3:CreatingKeys
DomainExplanation
CHAPTER7Relationships
RelationshipExplanation
RelationshipTypes
Cardinality
Independentvs.DependentEntities
Recursion
Containment
Subtyping
EXERCISE7.1:ReadingaModel
DataModelingNotations
RelationshipsinER/StudioCreatingRelationships
CreatingSubtypes
CreatingRecursiveRelationships
DuplicateRelationships
DuplicateAttributes
CreatingContainmentRelationships
EditingRelationships
MovingRelationships
ChangingtheAppearanceofRelationships
FindingRelationships
DeletingRelationships
EXERCISE7.2:CreatingRelationships
SECTIONIIIConceptual,Logical,andPhysicalDataModels
CHAPTER8ConceptualDataModels
ConceptualDataModelExplanation
RelationalandDimensionalConceptualDataModelsRelationalCDMExample
DimensionalCDMExample
CreatingaConceptualDataModelStep1:AsktheFiveStrategicQuestions
Step2:IdentifyandDefinetheConcepts
ForRelational
ForDimensional
Step3:CapturetheRelationships
ForRelational
ForDimensional
Step4:DeterminetheMostUsefulForm
ForRelational
ForDimensional
Step5:ReviewandConfirm
EXERCISE8.1:CreatingaConceptualDataModel
EXERCISE8.3:SegmentingthePublisherCDMintoSubmodels
EXERCISE8.4:CreatingaConceptualDataModelforYourOrganization
CHAPTER9LogicalDataModels
LogicalDataModelExplanation
RelationalandDimensionalLogicalDataModelsRelationalLDMExample
DimensionalLDMExample
CreatingaRelationalLogicalDataModelNormalization
InitialChaos
FirstNormalForm(1NF)
SecondNormalForm(2NF)
ThirdNormalForm(3NF)
Abstraction
CreatingaDimensionalLogicalDataModel
EXERCISE9.1:CreatingaDimensionalLogicalDataModel
CHAPTER10PhysicalDataModels
PhysicalDataModelExplanation
RelationalandDimensionalPhysicalDataModelsRelationalPDMExample
DimensionalPDMExample
CreatingaPhysicalDataModelinER/StudioGeneratingaPhysicalDataModelfromaLogicalDataModel
GeneratingaPhysicalDataModelfromaDatabase(ReverseEngineering)
ReverseEngineeringfromMicrosoftAccess®
ReverseEngineeringfromMongoDB®
ReverseEngineeringfromHive®
GeneratingaPhysicalDataModelfromaSQLFile
GeneratingaDatabaseUsingER/Studio
EditingTables
CustomizingDatatypeMapping
DenormalizationRolldownDenormalization
RollupDenormalization
StarSchema
DenormalizinginER/Studio
EXERCISE10.1:Denormalizing
Views
ViewsinER/Studio
EXERCISE10.2:CreatingViews
Indexing
IndexinginER/Studio
EXERCISE10.3:Indexing
Partitioning
PartitioninginER/Studio
EXERCISE10.4:Partitioning
EXERCISE10.5:TracingfromPhysicalBacktoLogical
SECTIONIVAdditionalER/StudioFeatures
CHAPTER11DataDictionary
ImportingaDataDictionary
TypesofObjectsImportedfromaDataDictionaryDomains
DomainsinER/Studio
EXERCISE11.1:CreatingDomains
User-DefinedDatatypes
User-DefinedDatatypesinER/Studio
EXERCISE11.2:CreatingUser-DefinedDatatypes
ReferenceValues
ReferenceValuesinER/Studio
EXERCISE11.3:CreatingReferenceValues
Attachments
AttachmentsinER/Studio
Exercise11.4:CreatingAttachments
CHAPTER12DataLineage
UsingtheDataLineageTab
DefiningSourceSystemsinER/Studio
CreatingDataMovementRulesinER/Studio
CreatingaDataFlowinER/Studio
UsingtheTableEditortoFurtherDocumentLineage
UsingtheColumnEditortoFurtherDocumentLineage
Exercise12.1:CreatingaDataLineage
ALessFormalWaytoConnectThings:User-DefinedMappings
CHAPTER13Importing,Exporting,Printing,andReporting
ImportingintoER/StudioImportingfromExternalMetadata
ImportingfromanERXFile
ImportingfromaSQLFile
ExportingoutofER/StudioExportingtoExternalMetadata
ExportingtoXML
ExportingtoaSQLfile
ExportinganImage
PrintinginER/Studio
ReportinginER/Studio
Exercise13.1:Importing,Exporting,Printing,andReporting
CHAPTER14NamingStandards
CreatingaNamingStandardsTemplate
ApplyingtheNamingStandardsUtility
AssigningNamingStandardstoObjects
AutomaticNamingTranslation
Exercise14.1:CreatingaNamingStandardTemplate
CHAPTER15Compare/MergeUtility
ComparingModelsandSubmodelsinER/Studio
Exercise15.1:RunningtheCompareandMergeUtility
CHAPTER16FeaturesforAgileTeamsandContinuousImprovement
MacrosRunningMacros
Top5FavoriteMacros
CreatingMacros
EditingMacros
DeletingMacros
RenamingMacros
Exercise16.1:CreatingandRunningMacros
ReusableProcedureLogicReusableTriggers
ReusableProcedures
Libraries
ChangeManagement
NamedReleases
ModelValidation
APPENDIXAReferences
APPENDIXBAnswerstoExercises
EXERCISE1.1:EducatingYourNeighbor
EXERCISE5.1:ChangingSettingsinSubmodels
EXERCISE6.2:ClarifyingCustomerIDDocumentUniquenessProperties
DocumenttheCharacteristicsoftheIdentifier
DefinetheCustomer
EXERCISE7.1:ReadingaModel
EXERCISE8.1:CreatingaConceptualDataModel
APPENDIXCGlossary
APPENDIXDER/StudioCommandsQuickReference
MostFrequentlyUsedCommands
ModelLevelCommands
EntityandTableLevelCommands
SublevelCommands
AttributeandKeyCommands
RelationshipCommands
MacroCommands
Index
Readmefirst!
DataModelingMadeSimplewithEmbarcaderoER/StudioDataArchitectwillprovidethebusinessorITprofessionalwithapracticalworkingknowledgeofdatamodelingconceptsandbestpractices,alongwithhowtoapplytheseprincipleswithER/Studio.You’llbuildmanyER/Studiodatamodelsalong theway,applyingbestpractices tomaster these tenobjectives:
1. YouwillknowwhyadatamodelisneededandwhichER/Studiomodelsarethemostappropriateforeachsituation.
2. Youwillbeabletoreadadatamodelofanysizeandcomplexitywiththesameconfidenceasreadingabook.
3. YouwillknowhowtoapplyallofthekeyfeaturesofER/Studio.4. Youwillbeabletobuildrelationalanddimensionalconceptual,logical,and
physicaldatamodelsinER/Studio.5. Youwillknowhowtocreateanefficientphysicaldatamodelbothbyforward
engineeringalogicaldatamodelandbyreverseengineeringadatabase.6. Youwillimprovedatamodelqualityandimpactanalysisresultsbyleveraging
ER/Studio’scompare/mergeutility.7. YouwillachieveenterprisearchitecturethroughER/Studio’sdatalineage
functionality.8. YouwillbeabletoapplyER/Studio’sdatadictionaryfeatures.9. Youwilllearnwaysofimportingandexportingthedatamodelaswellashowto
printandreportfromER/Studio.10. YouwillleverageER/Studio’snamingstandardsfunctionalitytoimprovenaming
consistency.
Thisbookcontainsfoursections.SectionIintroducesdatamodelingalongwithER/Studiofunctionalityand landscape.Youwill learnwhydatamodeling is socritical to softwaredevelopment, and even more importantly, why data modeling is so critical tounderstanding the business. You will also learn about the ER/Studio environment.Chapter1explainsthedatamodelandwhyitisaninvaluablewayfindingtoolinelicitingrequirements and capturing a precise representation of the business. This chapter alsointroducesthepublishercasestudy,whichwewillusethroughoutthetexttoexplaindatamodelconceptsandER/Studiofunctionality.Chapter2introducesyoutoER/StudioDataArchitect (thedatamodeling software and themain component in theER/Studio suite).LearnwhatER/Studiocandoandhowtoinstallandstartthesoftware.Chapter3coversatabroadlevelwhatfeaturesarewithineachER/Studiotab,window,menu,andtoolbar.Bytheendofthissection,youwillhavecreatedandsavedyourfirstdatamodelinER/Studio
Objective
Section 1 2 3 4 5 6 7 8 9 10
I ü ü ü
II ü ü ü
III ü ü ü ü ü
IV ü ü ü ü ü
andbereadytostartmodelinginSectionII!
Section II explains all of the symbols and text on a data model. Chapter 4 defines asubmodel and how to work with one. Chapter 5 defines an entity and instances anddiscusses the different categories of entities.The three different levels atwhich entitiesmay exist—conceptual, logical, and physical—are also explained.Chapter 6 defines anattribute and key, distinguishing the terms candidate, primary, surrogate, foreign, andalternatekey. Domains are also introduced in this chapter. Chapter 7 defines rules andrelationships. Cardinality and labels are explained so that the reader can read any datamodel as easily as reading a book. Other types of relationships, such as recursiverelationshipsandsubtyping,arealsodiscussed.Bytheendofthissection,youwillbeableto “read” adatamodelof any sizeor complexity aswell as create andmodify entities,attributes,andrelationshipsinER/Studio.
SectionIIIexploresthethreedifferentlevelsofmodels:conceptual,logical,andphysical.Aconceptualdatamodel (CDM) represents thebusinessneedwithinadefinedscope,alogical data model (LDM) the detailed business solution, and a physical data model(PDM) the detailed technical solution. Chapter 8 focuses on the CDM, Chapter 9 theLDM, andChapter10 the PDM.By the end of this section, youwill be able to createconceptual,logical,andphysicaldatamodelsinER/Studio.
Section IV discusses additional features of ER/Studio: Chapter 11 covers the datadictionary;Chapter12 data lineage; Chapter 13 import, export, printing, and reporting;Chapter 14 naming standards; Chapter 15 the compare and merge functionality; andChapter 16 iterative development practices including agile, macros, reusable procedurelogic,changemanagement,andmodelvalidation.
To connect the book’s contentwith the key objectives stated on the previous page, thefollowingtableshowstheprimarysectionsthatsupporteachobjective.
Keypointsareincludedattheendofeachchapterasawaytoreinforceconcepts.Everychapterstartswithapoemintheformofahaiku,whichisathree-linepoemcontainingfivesyllablesinthefirstline,seveninthesecond,andfiveinthethird.Afterall,thereisalotofcreativityindatamodeling!
The book is loaded with hands-on exercises along with their answers provided in
Objectnames e.g.,CustomerLastNameisanattributewithintheCustomerentity.
menuoptions e.g.,Insert>Entityreferstothe“Entity”optiononthe“Insert”menu.
Tool,tab,screen,orwindowname
e.g.,DatatypeMappingEditor,DataModelExplorer
<keyboardkeys> e.g.,<ALT+I>,then<E>
(Meanspressandholdthe<ALT>keyandthenpressthe<I>key,thenreleasebothandpressthe<E>key.)
<dialogbuttons> e.g.,<OK><Cancel><Help>
Menu Toolbar Explorer ShortcutKey
ShortcutMenu
Insert>Entity Modelingtoolbar: Right-clickonEntities,NewEntity…
<ALT+I>,then<E>
Right-clickonwhitespace,InsertEntity
BecomeanER/StudioHotshot:
ChooseView>DiagramAndObjectDisplay
Options,orclickontheicon ,andthenexperimentwiththedisplaylevelsettings.ThethreesettingsthatarerelevantinthischapterareDefinition,Note,andEntity.Definitiondisplaysthedefinitionofeachentityintheentitybox,Notedisplaysthenote,andEntityjustdisplaystheentitynameinthebox.ChooseEntityforthefollowingexample.
AppendixB.AppendixAcontainsallofthebook’sreferences,AppendixCaglossaryofthetermsusedthroughoutthetext,andAppendixDaquickreferencesheetofER/Studiocommands.Thereisalsoacomprehensiveindex.
ConventionsUsedinThisBookYouwillseethetermobjectusedfrequentlythroughoutthetext.Objectincludesanydatamodelcomponentsuchasentities,attributes,andrelationships.Asyouworkthroughthebook,youwillseereferencestoobjectsindatamodels,keysonthekeyboard,andsectionsoftheER/StudioenvironmentsuchasoptionsonER/Studiomenus,toolsonthepalette,anddialogbuttons.Wemakeuseofthefollowingsimpleconventions:
In addition to the above conventions, there are two types of spreadsheets youwill seefrequently throughout the text, one describing different ways to invoke the samecommand, and one describing tabs available on a screen. Here is an example of thespreadsheetshowingdifferentwaystoinvokethesamecommand,inthiscasecreatinganentity:
Tab Here’swhatyouneedtoknow:
Attributes Choosewhich attributes of the entities selected to include in the submodel. If youdeselect an attribute,ER/Studiocandisplayanellipsistoindicatethatnotallattributesaredisplayed.
Definition Enteradefinitionforthesubmodel.
AttributeBindings Bindanexternalpieceofinformation,suchasaMicrosoftWorddocumentorPDFfile,tothesubmodel.Veryusefulforrequirementsdocuments,userstories,etc.
SecurityInformation ChangeorviewthecurrentsecurityinformationasdefinedintheDataDictionary.(DataDictionarywillbediscussedinChapter11.)
DataModelingExperience
ER/StudioExperience
SuggestedApproach
LittleorNone LittleorNone StartatthebeginningofthetextandreadthroughChapter10onPhysicalDataModels(SectionsIthroughIII).MakesureyoudoallofthedatamodelingandER/Studio exercises, and saveSectionIV for after you get comfortablewithbasicER/Studiofunctionality.
GoodorGreat LittleorNone YoucanskipChapter1andgostraighttoChapters2and3togetcomfortablewiththeER/Studiolandscape.Then,ineachofthechaptersinSectionsIIand
ThisspreadsheetdescribesfivewaystocreateanentitysuchasselectingtheInsertmenuandthenselectingEntityorright-clickingonanywhitespacearoundthedatamodelandthenselectingInsertEntity. In thesamespreadsheet, thereareoften tips related to thesecommandssuchaschoosingdifferentwaystoviewtheentitiesonthediagram.Thesetipswill helpyouquicklybecomeanER/StudioHotshot!The second spreadsheet describeseachtabonascreenasinthisexamplefromChapter5onsubmodels:
Tokeepthisbooksimple,insteadofgoingintodetailoneachtab,we’llbrieflydescribeeach tab as shown in the above spreadsheet including coveringwhich settings aremostimportanttoknow.
What’sDifferentinthe2ndEdition?ER/Studiohasbeenupdatedwithmanypowerful features that aredescribed in this textincluding support for NoSQL and for agile development. In addition, a number ofcorrections fromthe firsteditionwereappliedaswellasupdatesbasedonmyevolvingperspective on data modeling and updates on how to use ER/Studio based on mycontinuedexperienceusingthetoolonmanydatamodelingassignments.
HowtoGettheMostoutofThisBookHereisasuggestedapproachtoleveragingthisbookbaseduponyourdatamodelingandER/Studioexperience:
III,brieflyscanthedatamodelingsectionsandfocusontheER/Studio-specificsections. Save Section IV for after you get comfortable with the basicER/Studiofeatures.
GoodorGreat GoodorGreat Youcantreatthisbookasareference,andwheneveryouneedarefresherinacertain topic, you can use the table of contents and index to find that topic.Make sure you read about the latest features of ER/Studio inChapter2 andreadthefeaturechaptersfromSectionIV.
Thisbookwill explaindatamodelingandhow touseER/Studiowhile stillmaintainingthespiritofkeeping it simple.Keeping it simple required resisting the temptation togointomoredetailthannecessaryandsavingthemoreadvancedstufffortheER/StudioUserGuidethatcomeswiththeproduct.
I am a firm believer in the 80/20 rule; you can learn 80 percent of datamodeling andER/Studiofunctionalityin20percentofthetime,andthenlearntheremaining20percentyouneedtoknowovertimebypracticingwiththetoolandbytakingonmoreandmorechallengingdatamodelingassignments.
Iamalsoafirmbelieverinplaying.Wemightaswellhavefunlearning,sothroughoutthebook,feelfreetoplaywiththebuttonsandmenusandseewhathappens.Youcanalwayshittheundobuttonorcloseyourdatamodelwithoutsavingit.
Datamodeling ismore thana jobor a career—it is amindset, an invaluableprocess, ahealthyaddiction,awayoflife.RemembertoKeepItSimpleandenjoytheride!
SECTIONIFoundation
This section introduces data modeling and the ER/Studio landscape. Learn why datamodeling is so critical to software development and, evenmore importantly, why data
modeling is so critical to understanding the business. You will also learn about theER/Studioenvironment.
Chapter1explainsthedatamodelandwhyitisaninvaluablewayfindingtoolinelicitingrequirements and capturing a precise representation of the business. This chapter alsointroducesthepublishercasestudywewillusethroughoutthetext.Chapter2 introducesyoutoER/StudioDataArchitect(ER/Studio).LearnwhatER/Studiocandoandhowtoinstallandstart thesoftware.Chapter3coversatabroad levelwhat featuresarewithineachER/Studiotab,window,menu,andtoolbar.Bytheendofthissection,youwillhavecreatedandsavedyourfirstdatamodelinER/StudioandbereadytostartingmodelinginSectionII!
CHAPTER1DataModelOverview
HowdoIgetthere?Maps,blueprints,datamodelsPleaseshowmetheway
IgavethesteeringwheelaheavytapwithmyhandsasIrealizedthat,onceagain,Iwascompletely lost. It was about an hour before dawn, I was driving in France, and animportantbusinessmeetingawaitedme.Ispottedagasstationupaheadthatappearedtobeopen.Iparked,wentinside,andshowedtheattendanttheaddressofmydestination.
Idon’tspeakFrenchandtheattendantdidn’tspeakEnglish.Theattendantdid,however,recognize the name of the company I needed to visit. Wanting to help and unable tocommunicateverbally, theattendant tookoutapenandpaper.Hedrewlinesforstreets,circles for roundabouts along with numbers for exit paths, and rectangles for his gasstationandmydestination,MFoods.ThepicturehedrewresembledFigure1.1.
Figure1.1Simplificationofgeographiclandscape
With this custom-mademap,which containedonly the information thatwas relevant tome,Iarrivedatmyaddresswithoutmakingasinglewrongturn.ThismapwasamodeloftheactualroadsIneededtotravel.
Amap simplifies a complex geographic landscape in the same way that a data modelsimplifiesacomplexinformationlandscape.Inmanycases,thecomplexitiesintheactualdatacanmakethoseroundaboutsinFrancelookridiculouslysimple.
Thischapterexplainsthedatamodelandintroducesthepublishingcasestudythatappearsineachchapter,allowingyoutobuildonpriorwork.
FindingYourWayIfthetermdatamodeldoesnotexciteyouoryourbusinessusers,trythetermwayfindingtoolinstead.Wayfindingencompassesallofthetechniquesandtoolsusedbypeople(andanimals)tofindtheirwayfromonesitetoanother.Iftravelersnavigatebythestars,forexample, the stars are theirwayfinding tools.Maps and compasses are alsowayfindingtools.
Allmodels arewayfinding tools.Amodel is a set of symbols and text used tomake acomplex concept easier to grasp. The world around us is full of obstacles that canoverwhelm our senses and make it very challenging to focus only on the relevantinformationneededtomakeintelligentdecisions.Amaphelpsavisitornavigateacity.Anorganizationcharthelpsanemployeeunderstandreportingrelationships.Ablueprinthelpsanarchitectcommunicatebuildingplans.Themap,organizationchart,andblueprintarealltypesofmodelsthatrepresentafiltered,simplifiedviewofsomethingcomplex,withthegoalof improvingawayfindingexperiencebyhelpingpeopleunderstandpartof therealworld.
ItwouldprobablyhavetakenmehoursoftrialanderrortoreachmydestinationinFrance,whereas that simple map the gas station attendant drew provided me with an almostinstantaneousbroadunderstandingofhowtoreachmydestination.Amodelmakesuseofstandardsymbolsthatallowonetograspthecontentquickly.Inthemaphedrewforme,the attendant used lines to symbolize streets and circles to symbolize roundabouts.Hisskillfuluseofthosesymbolshelpedmevisualizethestreetsandroundabouts.
RepresentinganInformationLandscapeAdatamodelisawayfindingtoolforbothbusinessanddataprofessionalsthatusesasetof symbols and text to precisely explain a subset of real information to improvecommunication within the organization and thereby lead to a more flexible and stableapplicationenvironment.AlinerepresentsamotorwayonamapofFrance.Aboxwiththeword“Customer”withinitrepresentstheconceptofarealCustomer,suchasBob,IBM,orWalmart,onadatamodel.
Ourbroaddefinitionofadatamodelas“asetofsymbolsandtextthatpreciselyexplainasubsetofrealinformation”encompassesmodelsinmanydifferentforms.Datamodelscanlookliketheboxandlinedrawingsthatarethesubjectofthisbook,ortheycantakeotherformssuchasUnifiedModelingLanguage(UML)ClassDiagrams,spreadsheets,orStateTransitionDiagrams.Allof thesemodels arewayfinding toolsdesignedwith the singlepurposeofsimplifyingcomplexinformationtofacilitatecommunicationinourrealworld.
LeveragingtheDataModelPrecision,with respect to data modeling, means there is a clear, unambiguous way ofreadingeverysymbolandtermonthemodel.Youmightarguewithothersaboutwhethertheruleisaccurate,butthatisadifferentargument.Inotherwords,itisnotpossiblefor
youtoviewasymbolonamodelandsay“IseeAhere”andforsomeoneelsetoviewthesamesymbolandrespond“IseeBhere.”Inadatamodel,precisionisprimarilytheresultofapplyingastandardsetofsymbols.Thetrafficcirclesthegasstationattendantdrewformewerestandardsymbolswebothunderstood.Therearealsostandardsymbolsusedindatamodels,aswewilldiscovershortly.
Traditionally, data models have been built during the analysis and design phases of aprojecttoensuretherequirementsforanewapplicationarefullyunderstoodandcorrectlycapturedbefore theactualdatabase iscreated.Due tobeingprecise, thedatamodelhasadditionalusesaswell:
Tounderstandanexistingapplication.Thedatamodelprovidesasimpleandprecisepictureoftheconceptswithinanapplication.Wecanderiveadatamodelfromanexistingapplicationbyexaminingtheapplication’sdatabaseandbuildingadatamodelofitsstructures.Thetechnicaltermfortheprocessofbuildingdatamodelsfromexistingapplicationsisreverseengineering.Recently,amanufacturingorganizationneededtomovea25-year-oldapplicationtoanewdatabaseplatform.Thiswasaverylargeapplication,sotounderstanditsstructures,wereverseengineeredthedatabaseintoadatamodel.Tomanagerisk.Adatamodelcancapturetheconceptsandinteractionsthatareimpactedbyadevelopmentprojectorprogram.Whatistheimpactofaddingormodifyingstructuresforanapplicationalreadyinproduction?Howmanyofanapplication’sstructuresareneededforarchivalpurposes?Manyorganizationstodaypurchasesoftwareandthencustomizeit.Oneexampleofmanagingriskthroughimpactanalysiswouldbetousedatamodelingtodeterminewhatimpactmodifyingitsstructureswouldhaveonthepurchasedsoftware.
Tolearnaboutthebusiness.Asaprerequisitetoalargedevelopmenteffort,itusuallyisnecessarytounderstandhowthebusinessworksbeforeyoucanunderstandhowtheapplicationsthatsupportthebusinesswillwork.Beforebuildinganorderentrysystem,forexample,youneedtounderstandtheorderentrybusinessprocess.Oneofmyfavoritesentencesintheclassic1978textDataandRealitybyWilliamKentoccursduringasectionwhereKentisdiscussingthestepsrequiredtobuildadatabasetostorebookinformation:So,onceagain,ifwearegoingtohaveadatabaseaboutbooks,beforewecanknowwhatonerepresentativestandsfor,wehadbetterhaveaconsensusamongallusersastowhat“onebook”is.Toeducateteammembers.Whennewteammembersneedtocomeuptospeedordevelopersneedtounderstandrequirements,adatamodelisaneffectiveexplanatorymedium.Apictureisworthathousandwords,andadatamodelisapicturethatcanconveyinformationatdifferentlevelsofdetail.Wheneveranewpersonjoinedourdepartment,Ispentsometimewalkingthroughaseriesofdatamodelstoeducatethepersononconceptsandrulesasquicklyaspossible.
EmbarkingonOurPublishingAdventure
Inadditiontobeingadatamodeler,IamalsotheCEOofalargepublishingempirecalled
TechnicsPublications,LLC. “Empire”might be a slight exaggeration, as I am also theonlyemployee.Beingaone-personcompanyhasaverylargeadvantagehowever,inthatIknow the publishing business inside and out. I can describe every step necessary toproduceabook.PublishingisagreatexampletouseinthisbookbecauseIcanbeyourbusinessexpert,andtogetherwewillbuildthedatamodelsfromideathroughdesign.
In fact, let’s build our first publishing data model right now! However, instead of thetypicalboxesandlinesweassociatewithadatamodel,let’sstartwithadatamodelintheformofaspreadsheet.Datamodelscomeinmanyforms,andperhapsthemostcommonformofdatamodelweworkwithonadailybasisisthespreadsheet.Aspreadsheetisarepresentationofapaperworksheetcontainingagriddefinedbyrowsandcolumnswhereeach cell in the grid can contain text or numbers. The columns often contain differenttypesofinformation.
TitleName AuthorName
TitleRetailPrice
CategoryName
TitleDescription
DataModelingMadeSimplewithEmbarcaderoER/StudioDataArchitect
SteveHoberman $59.95 DATAMODELING/DATABASEDESIGN
Buildaworkingknowledgeofdatamodelingconceptsandbestpractices,alongwithhowtoapplytheseprincipleswithER/Studio…
As a publisher, I need to submit information about each new title to many stores anddistributors. Businesses such as Amazon.com® and Barnes & Noble® need to knowinformationaboutanupcomingtitlesotheycansellthetitleontheirWebsitesandintheirstores.
Takeamomentandlookatthefrontandbackcoversofthisbook.Whatinformationdoyousee?Table1.1containsasubsetoftheinformationIsawwhendoingthisexercise.DataModelingMadeSimplewithEmbarcaderoER/StudioDataArchitect
SteveHoberman
$59.95
DATAMODELING/DATABASEDESIGN
Buildaworkingknowledgeofdatamodelingconceptsandbestpractices,alongwithhowtoapplytheseprincipleswithER/Studio…
Table1.1InformationonthefrontandbackcoverofDataModelingMadeSimplewithEmbarcaderoER/StudioDataArchitect
Wecanalsolistthegraphics,barcode,etc.,butthisisenoughtogetusstarted.
Wecannowtake this informationand list it in the formofaspreadsheet,asyousee inTable1.2.
Table1.2SpreadsheetoffrontandbackcoverofDataModelingMadeSimplewithEmbarcaderoER/StudioDataArchitect
Inthefirstrowwelistedthetypeofinformationandinthesecondrow,thevaluesfromTable1.1.Thisisadatamodelbecauseitisrepresentingdatausingasetofsymbolsandtext—in this case, in the common formof a spreadsheet.Of course, there is quite abitmoreinformationwecanmodelinthisspreadsheet,butinordertokeepthingsreadableinthelayoutonthispage,wecanstopherefornowandconfidentlyconcludethatwehavecompletedourfirstdatamodel.
There are three very important similarities between the exercise we just completed onmodelingtheinformationonthistitleandanymodelingassignmentwedoforreal:
1. Process.Theprocesswewentthrough,wherewelookedatsomethingambiguous(suchasabookcover)andbroughtprecisiontoit,iswhatthedatamodelerspendsatleasthalftheirtimeworkingon.Datamodelersarefantasticorganizers.Wecantakecompletechaosandbringclaritybyorganizingandsorting“things”—inthiscase,descriptiveinformationaboutatitlebecomesneatlyorganizedintoaspreadsheet.
2. Creativity.Therearemanywayswecancommunicateinformationviaadata
model.YoucanchooseInformationEngineering(IE,forshort),whichisthenotationusedinthisbook;IntegrationDefinitionforInformationModeling(IDEF1X);ObjectRoleModeling(ORM);theUnifiedModelingLanguage(UML)ClassDiagram;spreadsheets—thelistgoeson.Itcomesdowntoknowingwhichnotationtheaudienceforthedatamodelwouldbestunderstand.Afterall,adatamodelisacommunicationtool,andthereforeweshouldchoosethevisualthatiseasiesttocommunicate.Sowecanbeverycreativeonwhichformattingtouseinagivensituation.Inthisfirstpublishingexample,wehavechosentousetheeasy-to-understandspreadsheetformat.
3. 80/20rule.EverymodelingassignmentIhaveeverworkedonhasbeenconstrainedbytime.IalwayswishIhadmoretimetocompletethedatamodel:“IfonlyIhadonemoreweek,Icouldreallymakethisperfect.”Inreality,weneverreachperfection,andIhavelearnedovertheyearstofollowthe80/20ruleofdatamodeling:in20percentofthetimewecangetthedatamodel80percentcomplete.Questionsandissuesareraisedduringthedatamodelingprocess,andtogofrom80to100percentcompleterequiresansweringthesequestionsandresolvingtheseissues.Inthisbookexample,youweregivenjustafewmomentstothinkabouttheinformationonthiscover—that’snotalotoftime!
However, there is onevery important differencebetween themodel you just completedandtheoneswedoforreal:Thereisnoonearoundtoargueoursolutionwithus!Thatis,shouldwe call it a “Title” or a “Book”?What’s a good definition for “Title” anyway?Thesetypesofdiscussionsareoftenwherethedatamodelerspendsquiteabitoftime.
Ifthedatamodelerspendsabout50percentoftheirtimeorganizinginformation,theother50 percent can be spent working with different groups to come to consensus onterminologyanddefinitions.SohalfthetimeweareOrganizersandtheotherhalfweareDiplomats—prettyimportantroles!
EXERCISE1.1:EducatingYourNeighborReinforceyourownunderstandingofwhatadatamodelisbyexplainingtheconceptofadatamodel to someone completely outside theworld of IT such as a neighbor, familymember,orfriend.Didtheygetit?
KeyPointsAdatamodelisawayfindingtoolforbothbusinessanddataprofessionalsthatusesasetofsymbolsandtexttopreciselyexplainasubsetofrealinformation.Thegoalistoimprovecommunicationwithintheorganizationandtherebyleadtoamoreflexibleandstableapplicationenvironment.
Inadditiontousingdatamodelstobuildnewapplications,datamodelscanalsobeleveragedinunderstandingexistingapplicationsandbusinessareas,performingimpactanalysis,andeducatingteammembers.
Practicethe80/20rulewhenitcomestodatamodeling:20percentofthetime,wecangetitatleast80percentright—andthatlast20percenttakesalotmoretimetocompleteandmaynotbeworththeeffortanyway.
CHAPTER2ER/StudioFunctionality
Go–GiveitaTryInstallER/StudioApowerfultool
In this chapter, we introduce you to ER/Studio Data Architect (often shortened to“ER/Studio,”whichisthetermwewilluseinthisbook).YouwilllearnwhatER/Studiocando andhow to install and start the software.ER/Studio is a datamodeling tool foreliciting, representing, and reporting on data requirements and for designing anddescribingdatabases.Wewill learnhowto leverageER/Studio functionality,whichwillallowyoutobuildapplicationswithgreateraccuracyandsuccess,increasetheuseofdatastandards,andenhancecollaborationwithinyourorganization.ER/StudioDataArchitectoffers:
Model-drivendesignenvironment
Completedatabaselifecyclesupport
Enterprisemodelmanagement
Datalineagedocumentation
Enterprisecommunicationcapabilities
Datawarehouseandintegrationsupport
Qualitydatabasedesigns
ER/Studio Enterprise Team Edition contains a number of software developmentproductivitytoolsincludingER/StudioDataArchitect.ER/StudioEnterpriseTeamEditionisapowerfulbusiness-drivendataarchitecturesolutionthatcombinesmulti-platformdatamodeling, design, and reporting with cross-organizational team collaboration. Data,business process, and software modeling interfaces allow business analysts and dataarchitects to understand, design, and communicate about data architectures across theorganization for improvedalignmentbetweenbusinessand IT. Inaddition toER/StudioDataArchitect,ER/StudioEnterpriseTeamEditionincludes:
BusinessArchitect.Thisprocessmodelingtoolenablesarchitectstocreateconceptualandbusinessprocessmodelsfordatacontext.BusinessArchitectenablescompaniestovisualize,understandandrefinetherelationshipsbetweenbusinessprocessesanddataaspartoftheirenterprisearchitecture.BusinessArchitectmakesiteasytomodelhowdataisincorporatedintobusinessprocessesbyallowinguserstobothmodelandanalyzetherelationshipsbetweenbusinessprocessesanddata.Withthiscapability,dataarchitectsandbusinessuserscancometoacommon
understandingofthebusiness.AsharedrepositorybetweenDataArchitectandBusinessArchitectmeansuserscanseamlesslymodelsystemsconceptually,logically,andphysicallyinacollaborativeandintegratedenvironment.Repository.Theserver-sidemodelmanagementsystemsolvestheday-to-daychallengesofmodelinginateamenvironment,wheremodelcollaboration,versioning,security,andobjectreusearevital.TheRepositoryallowsmultipleuserstocollaborateondataandbusinessprocessmodelingprojectswithreal-timeconcurrentaccessthatallowsteammemberstoshareandre-useassetsacrossprojects.Thiscollaborativeworkingenvironmentallowsorganizationstomaintaincompliancewithbusinessstandardsandmandatoryregulationswhilemoreeffectivelyleveragingenterprisedataasacorporateasset.TheRepositoryalsoprovidessupportformodelversionmanagement,designedtoallowdataprofessionalstoeasilymanageallsuccessivestatesofmodelsandmodelmetadataandtrackchangesmadetothemodels.SoftwareArchitect.Anobject-orientedmodelingtoolforapplicationarchitectstovisuallyanalyzeanddesigncomplexsoftwareapplications.SoftwareArchitectsimplifiesthedesignstageofaprojectbyorganizingandvisualizingtherequirements,subsystems,logicalandphysicalelements,andstructuralandbehavioralpatternsofintensivesoftwaresystems.Itprovidesdeveloperswithpowerfulproductivityfacilitiesthroughpre-definedpatterns,modelauditsandmetricsforqualityassurance,andprojectreportdocumentation.SoftwareArchitectsupportspopularindustrystandardslikeOMG’sUnifiedModelingLanguage(UML)2.0andObjectConstraintLanguage(OCL)aswellasprovidingXMIimport/exportoptionsandexportstomanyothercommonformats.
MetaWizard.Thesebridgeshelpdataprofessionalsintegratemetadatafrommultipledatasources,includingmodelingtools,businessintelligence,ETLplatforms,andindustry-standardexchangeformats(XMI,XML,andXSD).ThistoolenablesER/Studiotointegratewithmorethanseventyotherapplicationsbysharingmetadatathroughanimport-exportcapability.TeamServer.Thisserver-sidecomponentservesasthecentralhubforbusinessglossariesandmetadataforthebusiness-drivendataarchitecture.Itprovidesawebuserinterfacethatprovidestherightlevelofaccesstobothbusinessanddatastakeholders.Thisdatamodelandmetadatacollaborationplatformfordataprofessionals,developers,andbusinessanalystsprovidesgreatermeaningandvaluetoenterprisedata,helpingcompaniesfind,know,andprotecttheirvaluableassets.Employeesacrosstheorganizationhavetheabilitytouseandimprovemetadata,addingcontext,consistency,andcompliance,andenablingfasterandmoreeffectivedecision-makingusingmoreaccuratedata.
EXERCISE2.1:LearningMoreAbouttheER/StudioFamily
YoucanlearnmoreabouteachoftheER/Studiocomponentsandeditionsanddownload
trialversionsathttp://www.embarcadero.com/products/er-studio.
NewFeaturesinER/StudioThisbookisbasedonER/StudioDataArchitectrelease11,whichisamajorreleasewithanumberofnew features includingnumerousdatabase-specific enhancements.Thekeyfeaturesforrelease11are:
ChangeManagement.AllowingyoutocollaborateinanAgileenvironment,theChangeManagementCentermanagesmultiplemodelersworkinginthesamemodelaswellasprovidingtheabilitytotrackandmanagethechangesmadetothemodel.Modelchangescanbeassociatedwithagiledevelopmentworkflowstoriesandtasks.MoreonthisinChapter16.WelcomePage.TheWelcomePageistheopeningwindowthatopenswhenyoustartER/Studio.Itcontainslinkstoyourrecentfiles,plustheabilitytocreatenewmodels,openthereverseengineer,orimportwizardsinasingleclick.TheWelcomePagealsoincludesanumberofhelpfulvideostoguideyouthroughsomeofthemoreimportantfeaturesand,fornewusers,asimplegettingstartedvideo.MoreontheWelcomePagelaterinthischapter.AutomatedNamingStandards.NamingStandardshavebeenaneffectivemethodofkeepingyourmodelsinlinewithanyorganizationalnamingconventionsandcompliancethatisinplace;however,nowtheAutomatedNamingStandardsfeatureallowsyoutocreateandmodifywhileautomaticallyapplyingyournamingstandardtemplates.MoreonthisinChapter14.NewInstaller.Streamliningtheinstallprocess,thenewWiXinstallermeansyouhavemorepowerwithfewerkeystrokes.Moreonthislaterinthischapter.EnhancedPlatformSupport.Whilerelease11didnotintroduceadditionalplatformsupport,itdoesincludethenewplatformsupportaddedtorecentreleases,includingnativeround-tripsupportforHadoopHivetablesandMongoDBdatabases.ER/StudioalsokeepscurrentonthelatestreleasesofpopularplatformsincludingOracleandTeradata.MoreonthisinChapter10.GlossaryIntegration.Thebusinessglossaryisanextremelyimportantsourceofinformationforcollaborationbetweenallstakeholdersincludingdatamodelers,businessanalysts,developers,andsubjectmatterexperts.MoreonthisinChapter11.UserInterfaceEnhancements.Toeasekeyboardnavigation,thetaborderhasbeenimprovedonthedialogboxes.Tolearnaboutallofthenewfeatures,orformoredetailsonthesefeatures,pleaserefertotheER/StudioUserGuide.
My“Top10”FavoriteFeaturesofER/Studio
1. Intuitive.ER/Studioisveryeasytolearn.ThecommandsIwaslookingforseemedtobewhereIexpectedtofindthem.ThisisdueinparttobeingverycomfortablewiththeMicrosoftWindowsenvironmentandER/Studiohavingbeenbuiltwitha
highdegreeofconsistencywithproductslikeMicrosoftWord®andnavigationlikeMicrosoftExplorer®.IalsolikethatthelistofpossiblecommandsfromthemenuschangesbasedonwhatIamworkingon.Forexample,highlightinganentitywouldbringupentity-specificcommandsunderthemenus.
2. Cannotstartwithphysical.Topromotesoundsoftwaredevelopmentpractices,ER/Studiodoesnotpermitcreatingaphysicaldatamodelfromscratch.Insteadthephysicaldatamodelmustbebaseduponanexistinglogicaldatamodelorreverseengineeredfromanexistingdatabase(suchastheactualdatabaseordatadefinitionlanguagelikeSQL).MoreonthisinChapter10,PhysicalDataModels.
3. ModelerExplorer.TheModelerExplorerwindowisextremelyusefulandintuitive.Inmostmodelingtools,Icloseallofthewindowsexceptformydiagramwindowtomaximizerealestateforthediagram.InER/StudioIcankeepModelerExploreropenduringmymodelinganditisanextremelyquickanduser-friendlywaytonavigateormodifyadatamodel.
4. Levelofcustomization.ThelevelofcustomizationwithER/Studioisextremelyimpressive.Forexample,Tools>Optionsbringsupanincrediblenumberofsettingsthatcanbechangedtopersonalizethedisplay,enforcerulesonthemodel,facilitateSQLgeneration,etc.Youwilllearnmoreaboutthispowerfulfeaturethroughoutthebook.
5. Lineage.YoucandocumentandviewmappingsrightinER/StudioaswellasuseER/StudioDataLineage,whichisaseparatetoolintheER/StudioXEfamilythatallowsyoutoexploreexistingorproposedExtraction,Transformation,andLoad(ETL)mappingstoquicklyandaccuratelyperformimpactanalysis.Asadatamodeler,weareresponsiblefornotjustthemodels,butalsothemappings.ER/Studioallowsyoutocapturethemappings.Chapter12iscompletelydedicatedtolineage.
6. UniversalNamingUtility.UsingtheUniversalNamingUtility,youcangloballysearchfor,andreplaceifdesired,names,strings,andattachmentvalueoverridesforboundattachments.Youdefineyoursearchandthenconfinethesearchtospecificobjectswithinyourmodels.MoreonthisinChapter4onfindingentities,andChapter6onfindingattributes.
7. Help!TheUserGuideinER/Studioisextremelycomprehensive.Inaddition,hitting<F1>orselectinghelpfromtheHelpmenuoronanyofthescreensbringsupdetailedandhyperlinkedinformationstraightfromtheUserGuide.ThedocumentationisinformativeandexplainsmanyofthemoreadvancedfeaturesofER/Studio.IfyouwouldlikemoredetailsonanyER/Studiofeatureasyougothroughthistext,justhit<F1>.
8. Versioncompatibility.ER/Studiocanloadmodelsfromearlierversionsintonewerversions,bringingthemodelsuptothelatestrelease.
9. Macros.ER/Studiocomesshippedwithover70macrosandalsoprovidesyouwiththefunctionalitytoedittheseexistingmacrosorcreateyourown.Thesemacroscan
saveyoulotsoftimeandimprovedataconsistencywithinyourorganization.10. DataDictionary.EvenwithoutusingtheRepository,youcansharedomains,rules,
referencevalues,andothervaluabletypesofmetadataacrossmodelsusingtheDataDictionary.
EXERCISE2.2:InstallingandStartingER/StudioIfyoudonotyetownalicenseofER/StudioDataArchitect,youcandownloada14-daytrialathttp://www.embarcadero.com/downloads.
Doubleclickonthedownloadedfileandfollowthewizardtoinstallthesoftware.Acceptthe licensing terms, click <Next>, and then select the destination folder where theapplicationshouldbestored.Ichosethedefaultlocationandhit<Next>.
Thenextscreenin the installationwizardwill letyouchoosetheRepositoryServeryouwould like to connect with. Choose your server from the drop-down list or keep thedefaultofNoneifyoudonothaveaserverordonotwanttodecideononeatthispoint.Youcanalwaysselecttheserverlater.Click<Next>.
ThenextscreenwillletyousethowyouwouldliketheapplicationtoappearintheStartmenu. I kept the default and hit <Next>. Then click <Install> and ER/Studio will beinstalled.Afterinstallation,youaregiventheoptionofdisplayingtheReadmefileorjustclicking<Finish>.
YoucannowlaunchER/StudiofromtheStartmenuandentertheprovidedlicensedetails.For thedefaultnotation,choose IE(Crow’sFeet).This is thenotationwewillbeusingthroughoutthebook.YoucanalwayschangethenotationlaterunderTools>OptionsandthenclicktheLogicalorPhysicaltabwhereyoucanchoosethenotationtype.
After completing registration, the first screen youwill see is theEmbarcadero ProductRegistrationscreen.Ifyoudownloadedatrialversion,enterthetemporaryserialnumberontheproductregistrationscreen.IfyouhaveanaccountfortheEmbarcaderoDeveloperNetwork(EDN),enteryourEDNloginnameoremailandpasswordinformationonthisscreen as well. (Contact http://www.embarcadero.com/support if you have issuesregistering.)
IfyouareusingtheER/StudioRepository,makesureyouhavecompatibleversionsoftheRepositoryandDataArchitect.That is, ifyouupgradeone,upgrade theother toensurecompatibility.Also,multipleversionsofER/Studiocanberunonthesamemachine,butitisnotadvisabletosharemodelsbetweenversions.Onceyouhaveupgradedyourmodels,youmaywanttoremovetheolderversions.
Alongwith the installation of the software comes a number of samplemodels you canplaywith.Wewillbeopeningoneofthesesamplemodelsinthenextchapter.
TheWelcome Page shown in Figure 2.1 is the first screen we encounter after startingER/Studio.
Menu Toolbar Explorer ShortcutKey ShortcutMenu
View,followedbythetoolbarname
n/a n/a <ALT+V>,followedbytheletterfortheappropriatetoolbarname
n/a
Thisisagreatstartingpointforbothnewandexperiencedusers.Thereareshortcutlinkstoyourmostrecentlyopenedfilespluslinkstocreatingnewmodels,reverseengineering,and importing externalmetadata.TheWelcomePage also includes a number of helpfulvideos toguideyou through someof themore important features and, fornewusers, asimplegettingstartedvideo.
TheWelcomePageactsasbothawindowandatoolbar.Itactsasawindowbecauseitcanstayactivewhileotherwindowsareopenedduringthecourseofyourmodelingactivitiesandcanalsobeclosedsimilartoanywindowbyclickingthe‘x’intheupperrighthandcorner. It actsa toolbarbecause therearemany functions thatcanbe invoked from thiswindow, and it can bemade to appear or disappear as with any toolbar through thesecommands:
KeyPointsER/Studioisadatamodelingtoolforeliciting,representing,andreportingondatarequirementsandfordesigninganddescribingdatabases.
ER/StudioEnterpriseTeamEditioncontainsanumberofsoftwaredevelopmentproductivitytoolsalongwithER/StudioDataArchitect.ER/StudioEnterpriseTeamEditionisapowerfuldataarchitecturesolutionthatcombinesbusiness,data,andapplicationmodelinginamulti-platformenvironment.
ThereareanumberofnewfeaturesinER/StudioDataArchitectincludingAutoNamingStandardsandenhanceddatabaseplatformsupport.
YoucanlearnmoreabouteachoftheER/StudioEnterpriseTeamEditionproductsanddownloadtrialversionsathttp://www.embarcadero.com/products/er-studio.
CHAPTER3ER/StudioLandscape
GetthebigpictureWindows,menus,shortcutkeys,
TimetogetfeetwetIn this chapter, learn at a broad levelwhat features arewithin eachER/Studiowindow,menu,andtoolbar.Bytheendofthischapter,youwillhaveopenedanexistingdatamodelaswellascreatedandsavedyourfirstdatamodelinER/Studio.Areyouready?
Theapplication interface shown inFigure3.1hasa standardMicrosoft®Windows® lookandfeelandisdividedintoseveral tabbedwindowsthat letyounavigateandcustomizeyourworkspace.WewillbrieflydescribeeachofthedifferentsectionsofthisworkspaceincludingallofthecalloutsinFigure3.1.
Figure3.1ER/StudioLandscape
UsingtheWindowsIn addition to theWelcome Page, there are four windows in ER/Studio: Data ModelExplorer,DataModel,Overview,andZoom.We’lldescribeeachinthissection.
DataModelExplorer
TheDataModelExplorerhelpsyounavigatedatamodelsandtheirobjects,reusedesignelements,andcreatenewobjects.TheDataModelExplorerhasfourtabsthatofferaccesstoimportantfunctionality,enablingyoutoefficientlymanageyourdatamodels:
DataModel.UsesaWindows-likefilestructuretonavigateandmodifyadatamodel.Thiscontainment-typestructureworksverywellfordatamodelsasyoucannavigatefromadatamodeltoasubmodel(submodelsdiscussedinChapter5)totheentitieswithinthissubmodel(entitiesdiscussedinChapter4)andthentotheattributeswithineachentity(attributesdiscussedinChapter6).
DataDictionary.Helpsyoumanagedatadictionaryobjectsincludingattachments,defaults,rules,referencevalues,user-defineddatatypes,domains,reusableprocedurallogic,reusableprocedures,andlibraries.DataLineage.Providesavisual,drag-and-dropinterfacetoenableyoutodocumenthowdatamovesbetweenthetargetandsourcesystemsalongwithwhyandwhenthedataismoved.DatalineagedocumentstheExtraction,Transformation,andLoad(ETL)ofdatamovementandtherelevantcomputationsrequiredwhenmovingdatabetweendisparatesystems.Youcancreatedatamovementrulesthatcandictate,forexample,whenthedatashouldbearchivedoraspecificvaluerangethedatamustfallwithininordertobemoved.Macros.Allowsyoutoadd,edit,rename,delete,andrunmacros.Youcanalsocreatefoldersinwhichtostoremacrosforeasierreference.ER/Studiocomeswithmanyusefulmacrosinstalledrightoutofthebox.
DataModelWindow
TheDataModelWindow is thepalettewherewedo thedatamodeling anddisplay thedatamodels.We canmove diagram objects, copy and paste them into a new location,resizethediagramobjects,andchangetheircolors.
OverviewWindow
TheOverviewWindowallowsyoutonavigatelargedatamodelsbyprovidingathumbnailviewoftheentiremodel.ItisagoodideatohidetheOverviewWindowwhenworkinginsmalldiagrams.YoucanopenandclosetheOverviewWindowasneededusingtheViewmenu or by pressing <F9>.When you zoom in or out, theOverviewWindow places aborder around the portion of the model displayed in theData Model Window. In theOverviewWindow,clickon thesectionof themodelyouwould like toseedisplayed ingreaterdetail.
ZoomWindow
TheZoomWindow isusefulwhenworkingona largediagramas it shows thearea thatyourcursorpassesoverinlargerscale—verysimilartohowamagnifyingglassworks.ItisagoodideatohidetheZoomWindowwhenworkinginsmalldiagrams.YoucanopenandclosetheZoomWindowasneededusingtheViewmenuorbypressing<F8>.Youcanalsomovethewindowbydraggingitbyitstitlebar.
UsingtheMenusThere are both application and shortcutmenus that can be used inER/Studio.You canaccess theentireER/Studio featureset fromtheapplicationmenus.Youcanalsoaccessselectedfeaturesfromshortcutmenus.ER/Studioapplicationmenusareacrossthetopoftheuserinterface,andshortcutmenusareavailablewhenyouright-clickonanobjectoron thewhite space in a diagram.Allmenus are context-sensitive and therefore changedepending on what is selected in the Data Model Window. Note that functionalityavailableinapplicationmenusorshortcutmenusisalsoavailablethroughthetoolbars.
ApplicationMenus
ER/Studioapplicationmenusprovideaccess toall functionality.Themenusarecontext-sensitive and change depending on what is selected in theData Model Window. Theapplicationmenudiffersforlogicalandphysicaldatamodels.Hereisabriefdescriptiononeachofthemenus:
File.Usethismenuformodelleveloperationssuchastocreate,open,close,andsavedatamodels.Youcanalsoimport,export,andprintmodelsunderthismenu.UnderDiagramProperties…,youcancapturedescriptiveinformationaboutthemodelincludingmodelname,modeler,andattachments.Edit.Usethismenuforobjectleveloperationssuchasundoandredo,copyandpaste,andtofindandeditobjects.Youcanalsoselectalloftheobjectsonthemodelorselectallofagivenobjecttype(suchasselectingallentities).View.Usethismenufordeterminingwhatshouldbedisplayedonthescreensuchaswhichtoolbarsandwhattodisplaywhenhoveringyourmouseoverobjects.YoucanalsozoominandoutusingthismenuorentertheDiagramandObjectDisplayOptions…feature,whichallowsyoutodecidewhatwilldisplayonthemodel.Insert.Usethismenuforcreatingnewmodelobjectssuchasentitiesandrelationships.Youcanalsopanaroundthemodelwiththerelationshipnavigationfeature,whichisawonderfulwaytowalkthroughthemodelbyhighlightingeachrelationshiponaselectedentity.Model.Usethismenuformodelleveloperationssuchasinvokingthedatadictionary,capturinglineage,andgeneratingphysicaldatamodels.Youcanchangethemodelnotationherebetweenrelationalanddimensional,performdatamodelvalidationfunctions,andcreateandeditsubmodels.Youcanalsosetmodeloptions,suchasthemaximumlengthofanentityname,underthismenu.Format.Usethismenuforobjectcolors,fonts,andalignment.Alignmentincludesarrangingentitiesconsistently,suchasleft-justified,aswellasselectingwhetherstraightorelbowedrelationshiplinesarepreferred.Layout.Usethismenufordecidingwhichlayoutthemeworksbestsuchascircularandtreelayout.Thesesettingscanbeappliedtotheentiremodelortojustaselectedsubset.Tools.UsethismenuforaccessingvariousER/StudiotoolssuchastheUniversalNamingUtilityandtheDatatypeMappingEditor.YoucanalsoinvoketheOptionsfunctionfromtheToolsmenu,whichcontainsmanytabsonmodelpreferencessuchasdefiningnamingrules,modelnotation,defaultdatatype,datatypemappings,rolenameprefixes,andattributeorder.Throughoutthisbook,wewillreturntotheOptionsfunctiontosetmodeldefaults.Repository.UsethismenuforinteractingwiththeRepositoryandmodelsthathavebeensavedthere.YoucanalsologintoestablishaTeamServerconnectioninordertoactivatebusinessglossaryintegrationwithER/StudioDataArchitect.MacroShortcuts.Usethismenuforaddinguptotenpre-definedmacrosoryourownmacrostothemenuforeasyaccess.
Menu Toolbar Explorer ShortcutKey
ShortcutMenu
View,followedbythetoolbarname n/a n/a <ALT+V>,followedbytheletterfortheappropriatetoolbarname
n/a
BecomeanER/StudioHotshot:
ER/Studioallowsyoutomovetoolbarsanywhereon the ER/Studio workspace. You can also docktoolbars anywhere on the perimeter of theworkspace.Toundockatoolbar,clickandholdthetoolbarhandle(thefourverticaldotstotheleftofthetoolbar)anddragittoanewlocation.Todockatoolbar,double-clickthetitlebarofthetoolbar.
Window.Usethismenuforarrangingtheopenwindowsorforminimizing,closing,orrestoringthem.Help.UsethismenuforaccessingtheUserGuideaswellasotherusefulreferencessuchastheOnlineCommunity.Thismenualsoincludeslicensingandversioninformation.
ShortcutMenus
ER/Studioshortcutmenusofferaneasymethodofaccessingobjectfunctionality.Shortcutmenus offer a subset of the functionality you can access from the toolbars or menus,specifictotheobjectofinterest.Toaccessashortcutmenu,right-clickonanobjectoronanywhitespaceintheDataModelWindow.
UsingtheToolbarsToolbar buttons offer quick access to common features of ER/Studio. All functionalityaccessiblefromtoolbarbuttonsarealsoaccessiblefromthemenus(andshortcutmenus).ER/Studiotoolbarsarecontext-sensitiveandthereforebecomeactiveorinactive(grayedout)accordingtowhatyouaredoing.
There are six toolbars in ER/Studio: Application, Diagram, Modeling, Layout &Alignment,DrawingShapes,andRepository.We’lldescribeeachinthissection,withtheexceptionoftheRepositorytoolbarbecausetheRepositoryisaseparatetool.Thetoolbarscanbedisplayedorhiddenthroughthesecommands:
TheApplicationtoolbarcontainsiconsforcreating,opening,andsavingmodelsaswellasiconsforsomehandytoolssuchasthenamingstandardutility.Figure3.2showseachoftheiconsonthistoolbaralongwithitsname.
Figure3.2Applicationtoolbar
TheDiagram toolbarcontains iconsforselectingandviewingobjects.Figure3.3showseachoftheiconsonthistoolbaralongwithitsname.
Figure3.3Diagramtoolbar
TheModeling toolbar contains icons for creating objects. The tools available on theModelingtoolbardependonwhetheryourdatamodelislogicalorphysical,relationalordimensional,andthedesignatedplatformforthephysicaldatamodel.MoreonthesetypesofmodelsinSectionIII.Figure3.4showseachoftheiconsonthistoolbaralongwithitsname.
Figure3.4Modelingtoolbar
TheLayout&Alignment toolbar contains icons to quickly and accurately arrange yourentirediagramorasubsetofentities.MoreonthistoolbarinChapter4,Entities.Figure3.5showseachoftheiconsonthistoolbaralongwithitsname.
Figure3.5Layout&Alignmenttoolbar
TheDrawingShapes toolbar contains icons for different shapes such as rectangles andlines.Figure3.6showseachoftheiconsonthistoolbaralongwithitsname.
Figure3.6DrawingShapestoolbar
Drawingshapeshavenofixedmeaninginyourdiagrams,soyoucandeterminehowtheyareusedandinterpreted.Theycanrepresentobjectsinyourmodelthatarenotcommonlyrepresentedbydatamodelingsyntaxaswellascommunicatetheconceptofcontainmentsuchasgroupingobjectsbysubjectareaorstatus(e.g.,“TheboxaroundthesefiveentitiesindicatestheywillbeimplementedinPhaseII.”).
UsingKeyboardCommandsKeyboard commands, function keys, and shortcuts offer alternative ways to accessER/Studio functionality without using the mouse. Below are the most commoncommands;wewillcoveradditionalcommandsthroughoutthebook.
Herearethemostcommonkeyboardcommands:
PageUp:ScrollsuptheDataModelWindow.PageDown:ScrollsdowntheDataModelWindow.UpArrow:Scrollsuponeline.
DownArrow:Scrollsdownoneline.RightArrow:Scrollsoveronepositiontotheright.LeftArrow:Scrollsoveronepositiontotheleft.<->:Decreaseszoomlevelbyonestep(firstclickonmodelwhitespace).<SHIFT+F8>:AllowsyoutofreezetheZoomwindowsothatyoucanpanaroundthediagramandstillmaintainfocusonaspecificdiagramobject.ThesamecommandunfreezestheZoomwindow.<CTRL+Home>:Scrollstotheupperlefthandpageofthemodel.
Herearethefunctionkeys:
<F1>:OpenstheonlineHelp.<F4>:OpenstheFindEntity/Viewdialog.<F7>:Activatesordeactivatesshadowing.<F8>:Opensorclosesazoomwindow.
DiagramMode Statistic Definition
Logical Entities Total number of entities in the current model orsubmodel
Views Totalnumberofviewsinthecurrentmodelorsubmodel
Attributes Total number of attributes in the current model orsubmodel
Relationships Total number of relationships in the current model orsubmodel
Physical Tables Totalnumberoftablesinthecurrentmodelorsubmodel
Views Totalnumberofviewsinthecurrentmodelorsubmodel
Columns Total number of columns in the current model orsubmodel
ForeignKeys Total number of foreign keys in the current model orsubmodel
<F9>:Opensorclosestheoverviewwindow.
Herearethemostcommonshortcuts:
Double-click:Allowsyoutoedittheobjectyoudouble-clickedon.<CTRL+A>:SelectsallentitiesintheDataModelWindow.<CTRL+C>:Copiestheselectedstructures.<CTRL+V>:Pasteswhathasbeencopiedintotheactivewindow.<CTRL+Z>:Restoresyourmodeltothelaststageofedit(theinvaluable“undo”command).<CTRL+Y>:Redoesthelastundocommand(the“redo”command).<Delete>:Removeswhatishighlightedfromthedatamodel.
UsingtheStatusBarER/Studioprovidesstatisticspertainingtoyourdatamodelinthestatusbaratthebottomoftheapplication.Table3.1describesthestatisticsavailableonthestatusbar.
Table3.1Whatappearsonthestatusbar
Note that in the physical diagrammodel, what is displayed is specific for that type ofdatabase.Forexample,thenumberoftableswoulddisplayforanOracledatabaseandthe
Menu Toolbar Explorer ShortcutKey ShortcutMenu
Tools>Options… n/a n/a <ALT+T>,then<P> n/a
Menu Toolbar Explorer ShortcutKey
ShortcutMenu
numberofcollectionswoulddisplay foraMongoDBdatabase.YoucandisplayorhidetheStatusBarunderOptions:
OncetheOptionswindowappears,gototheApplicationtabandchangethesettingshowncircledinFigure3.7.
Figure3.7WheretoturntheStatusBaronandoff
TurningthestatusbaronandoffusingOptionswilldeterminewhetherthisbarwillappearwhen you create a newmodel. To hide or show the status bar in your currently openmodel,useView>StatusBar.
EXERCISE3.1:CreatingaNewDataModelIfER/Studioisnotopen,clickWindowsStart>Embarcadero>ERStudioDataArchitect.IfyouareusingtheAll-AccessToolbox,opentheToolboxandclickonER/StudioDataArchitect.Theversionyouareusing,suchas11.0,willappearasthesuffixinthenamesoftheproduct.Thisbookisbasedonversion11.0.
Createanewdatamodelusingoneofthefollowingcommands:
File>New Application
toolbar:
n/a <CTRL+N>
or
<ALT+F>,then<N>
n/a
BecomeanER/StudioHotshot:
Youcanchangethelookandfeelofthescreensbyright-clickinginthegrayspacenearthemenusandtoolbarsandselectingCustomize.Youcanexperimentwiththedifferentstylesandchooseyourfavorite.IampartialtotheMicrosoft®Office2003style.Model>ModelOptionswillallowyoutosetsomeimportantdatamodelingparametersincludingmodelnotationandtextcase.
Menu Toolbar Explorer ShortcutKey ShortcutMenu
ThescreeninFigure3.8appears.
Figure3.8NewModelscreen
Thisscreendefaultstocreatinganewdatamodel,andfromthedrop-downyoucanselecteitherRelationalorDimensional,whichwillbothbediscussed inSectionIII starting inChapter8.Youcanalsoreverse-engineeranexistingdatabase.Reverse-engineeringmeanstakinganactualdatabasestructureandimportingit intoER/Studiotocreateapictureofwhat the database looks like. Reverse-engineering is a great first step in understandinghowanexistingapplicationworks(especiallywhenthatexistingapplicationmaynothavebeen properly data modeled to begin with). You will learn how to reverse-engineer inChapter10. The third option on this submenu is to import a datamodel from differentformats such as CA ERwin® Data Modeler® (discussed in Chapter 13) or SQL files(discussedinChapter10).Forthepublishingdatamodel,whichwewilluseandmodifythroughout the text, gowith thedefault andclick<OK> to create anew relationaldatamodel.
CreatingTitleBlocks
ThefirstobjectwearegoingtocreateinthisnewmodelisaTitleBlock,whichprovidesimportantidentificationinformationsuchastheprojectnameandmodeler.ItisalwaysagoodideatostartwithaTitleBlockbeforemodelingsoprintoutsofourmodelwillnevergetmixedupwithotherprintouts.
Insert>TitleBlock DrawingShapestoolbar: n/a <ALT+I>,then<B> Right-clickonwhitespace,InsertTitleBlock
BecomeanER/StudioHotshot:
ER/Studiosupports“stickybuttons,”meaningyoucancreatemanyoccurrencesofanobjectandthen,whenyouaredone,right-clickonanywhitespacetoreturnthecursortothedefaultselectorsymbol.
Menu Toolbar Explorer ShortcutKey ShortcutMenu
Edit>EditTitleBlock… n/a n/a <ALT+E>,then<E>
Or
Double-clickonthetitleblock
Right-clickonTitleBlock,EditTitleBlock…
EditingTitleBlocks
Onceyouhavecreatedatitleblock,youcaneditittomodifyitscontentsbyselectingitandchoosingoneofthesecommands:
Fillintheoptions.Ifilledthisoutforme,asshowninFigure3.9.Youshouldfillitoutforyourselfandclick<OK>.NotethattheFileNameandSubmodelareread-only,asarethecreationandmodificationdates.Note,too,thattheblankboxtotherightofthecopyrightyearcontainsthecopyrightholderinformation.
Figure3.9TitleBlockscreen
AfterclickingOK,theobjectinFigure3.10appears(withtheinformationyouenteredinit).
Menu Toolbar Explorer ShortcutKey ShortcutMenu
Edit>DeleteTitleBlock n/a n/a <DELETE>
or
<ALT+E>,then<D>
Right-clickonTitleBlock,DeleteTitleBlock
Menu Toolbar Explorer ShortcutKey ShortcutMenu
File>Save
or
File>SaveAs
Applicationtoolbar: n/a <CTRL+S>
orforSave:
<ALT+F>,then<S>
orforSaveAs:
<ALT+F>,then<A>
n/a
Menu Toolbar Explorer ShortcutKey ShortcutMenu
Figure3.10TitleBlockobject
DeletingTitleBlocks
Createafewtitleblocks,highlightthem,anduseoneofthefollowingoptionstoremovethem:
EXERCISE3.2:SavingYourDataModel
Findagoodfilelocationtostoreyourmodel,typePublishing,andclick<Save>.Wewillbeworkingon thispublishingdatamodel throughout the text.Note thatER/Studiofileshavethe.dm1filetype.
Congratulations!YouhavejustcreatedandsavedyourfirstdatamodelinER/Studio.Nowlet’sstartfillingitinwithdatamodelingobjectsinthenextsection!
EXERCISE3.3:ClosingandOpeningExistingDataModelsClosethemodelthatyouhavejustcreated:
File>Close n/a n/a <ALT+F>,then<C> n/a
Menu Toolbar Explorer ShortcutKey ShortcutMenu
File>Open Applicationtoolbar: n/a <CTRL+O>
or
<ALT+F>,then<O>
n/a
Tab Here’swhatyouneedtoknow:
Information Capture basic information about the model that will appear in the Title Block object bydefaultincludingName,Author,Company,Version,andCopyright.
Description Enteradefinitionforthemodel.
AttributeBindings Bindanexternalpieceofinformation,suchasaMicrosoftWorddocumentorPDFfile,tothemodel.Veryusefulforrequirementsdocuments,userstories,etc.AttachmentsarecreatedintheAttachmentsfolderoftheDataDictionary(discussedinChapter11)andmustbeaddedtothemodelbeforetheywilldisplayonthistab.
Menu Toolbar Explorer ShortcutKey ShortcutMenu
Tools>Options n/a n/a <ALT+T>,then<P> n/a
Notethatifyoudidn’talreadysaveyourmodel,youwillbepromptedtosaveitbeforeitisclosed.Nowopenoneofthesamplemodelsthatcomesinstalledwiththetool:
Let’s open Adventure Works, which is in the Sample Models folder. In the DiagramProperties dialog, you can document basic information about your data model. DataenteredonthisdialogisusedwhengeneratingreportsaboutthemodelandisalsousedtopopulatetheTitleBlock.ChooseFile>DiagramProperties,thenmakeyourselftheauthorintheInformationtab.ImpresseveryonebecauseyoucreatedthismodeleventhoughyouareonlyuptoChapter3inthisbook!
Therearethreetabsonthisscreen:
EXERCISE3.4:GettingComfortablewithER/StudioBeforeyouclosetheAdventureWorksmodel,let’schangesomeoptionsforfuturemodels.ER/StudiohasanincrediblenumberofcustomizationswecanchoosefromunderOptions:
WewillplaywithdifferenttabsunderOptionsthroughoutthebook,butforthisexerciselet’slookatthreetabs:Application,Directories,andLogical.
Under theApplications tab, there is a section forApplicationDefaults. If the checkboxShow Status Bar is checked, the status barwill appear at the bottom of the ER/StudioLandscape.CheckShowFullPathInTitleBar,click<OK>,andseewhathappens.You
Menu Toolbar Explorer ShortcutKey ShortcutMenu
Format>Colors&Fonts… Diagramtoolbar:
n/a <ALT+O>,then<C> Right-clickonwhitespace,Colors&Fonts…
willnotice that in the tab thatpreviously justcontainedthenameof themodel,wenowhavethefullpathname.Ifyoulikethissetting,youcankeepit;otherwise,gobackintoOptionsandturnitoff.
Let’sgoback intoOptions, and this time to theDirectories tab.This tab allowsyou todefine the default directories for models and model-related artifacts such as macros.Choosewhereyouwouldlikeyourmodelstobestoredorjustkeepthedefaultpath.
The Logical tab has some neat features we’ll cover shortly, but for now click theBackgroundColorbuttonandchooseyourfavoritecolorforthebackground.Notethatmypersonalpreferenceisalightgraybackground,butchoosewhatsuitsyou!
Click<OK>andnoticethatthebackgroundcolordidnotchangetoyourselection.Thisisbecause you changed the background color for allmodels going forward. Some of thesettingsunderOptions,suchasdisplayingthepathname,applydirectlytothemodelyouareworking inandallsubsequentmodels.Somesettings,suchas thebackgroundcolor,applyonlytomodelsgoingforward.
Here’showyoucanchangethebackgroundcolorofthecurrentlyopenmodel:
Clickon<SetColor>toselectacolorfortheopenmodelandclick<OK>toapplythiscolortothebackgroundofyouropenmodel.Notethatifyouclosethemodelandcreateanewone,youwillseethebackgroundcoloryouselectedfromtheOptionsmenu.
Asanaside,ifyouclickonanyoftheobjects(e.g.Entity,View,Key)thatappearintheColors&Fontswindow,theobjectclickedonwillappearinthedrop-downmenuandyoucansetthecolorforthisobject.
Fortheremainderofthisexercise,continueplayingwiththetoolsinthenewmodelyoucreated. Just spend some timeclickingaroundandgettingyourself into trouble. It’s thebestwaytolearn.We’llformallygothroughER/Studiofunctionality,butitdoesn’thurttogive yourself a preview by just clicking on things and seeingwhat happens.Your datamodelisalreadysaved,andyoucanalwaysexitthemodelwithoutsavingorcreateanewdatamodelandplaythere.
KeyPointsTherearefourwindowsinER/Studio:DataModelExplorer,DataModel,Overview,andZoom.
Menuandtoolbarselectionsarecontext-sensitiveandchangedependingonthetypeofdatamodelorwhatiscurrentlyselected.
Shortcutmenusofferaneasymethodofaccessingobjectfunctionality.Shortcutmenusofferthesamefunctionalityyoucanaccessfromthetoolbarsormenus.
TherearesixtoolbarsinER/Studio:Application,Diagram,Modeling,Layout&Alignment,DrawingShapes,andRepository.
ER/Studioprovidesstatisticspertainingtoyourdatamodelinthestatusbaratthebottomoftheapplication.
ATitleBlockprovidesimportantidentificationinformationsuchastheprojectnameandmodeler.
SECTIONIIDataModelObjects
Thissectionexplainsallof theobjectsonadatamodel.By theendof thissection,youwillbeableto“read”adatamodelofanysizeorcomplexityaswellascreateandmodifyentities,attributes,andrelationshipsinER/Studio.
Chapter4definesanentityandinstancesanddiscussesthedifferentcategoriesofentities.Thethreedifferentlevelsatwhichentitiesmayexist—conceptual,logical,andphysical—arealsoexplained.Chapter5definesa submodelandhow toworkwithone.Chapter6defines an attribute and key, distinguishing the terms candidate, primary, surrogate,foreign key, and alternate key. Domains are also introduced in this chapter. Chapter 7definesaruleandrelationship.Cardinalityandlabelsareexplainedsothatthereadercanread any datamodel as easily as reading a book.Other types of relationships, such asrecursiverelationshipsandsubtyping,arealsodiscussed.
CHAPTER4Entities
Category Definition Examples
Who Personororganizationofinteresttotheenterprise.Thatis,“Whoisimportanttothebusiness?”Oftena“who”isassociatedwitharolesuchasCustomerorVendor.
Employee,Patient,Player,Suspect,Customer,Vendor,Student,Passenger,Competitor,Author
What Productorserviceofinteresttotheenterprise.Itoftenreferstowhattheorganizationmakesthatkeepsitinbusiness.Thatis,“Whatisimportanttothebusiness?”
Product,Service,RawMaterial,FinishedGood,Course,Song,Photograph,Title
When Calendarortimeintervalofinteresttotheenterprise.Thatis,“Whenisthebusinessinoperation?”
Time,Date,Month,Quarter,Year,Calendar,Semester,FiscalPeriod,Minute
Where Locationofinteresttotheenterprise.Locationcanrefertoactualplacesaswellaselectronicplaces.Thatis,“Whereisbusinessconducted?”
MailingAddress,DistributionPoint,WebsiteURL,IPAddress
Why Eventortransactionofinteresttotheenterprise.Theseeventskeepthebusinessafloat.Thatis,“Whyisthebusinessinbusiness?”
Order,Return,Complaint,Withdrawal,Deposit,Compliment,Inquiry,Trade,Claim
How Documentationoftheeventofinteresttotheenterprise.DocumentsrecordtheeventssuchasaPurchaseOrderrecordinganOrderevent.Thatis,“Howdoesthebusinesskeeptrackofevents?”
Invoice,Contract,Agreement,Account,PurchaseOrder,SpeedingTicket,PackingSlip,TradeConfirmation
ConceptsofinterestWho,What,When,Where,Why,andHow
EntitiesaboundThis chapter defines an entity and instances and discusses the different categories ofentities. The three different levels atwhich entitiesmay exist—conceptual, logical, andphysical—arealsoexplained.WewillpracticecreatingentitiesinER/Studio.
EntityExplanationAnentityrepresentsacollectionofinformationaboutsomethingthatthebusinessdeemsimportant andworthyof capture.Anounornounphrase identifies a specific entity.Anentity fits into one of six categories: who,what, when,where, why, or how. Table 4.1containsadefinitionofeachoftheseentitycategoriesalongwithexamples.
Table4.1Definitionsandexamplesofentitycategories
Entityinstancesaretheoccurrencesorvaluesofaparticularentity.Thinkofaspreadsheet
as being an entitywith the column headings representing the pieces of information (orproperties)abouttheentity.Eachspreadsheetrowcontainingtheactualvaluesrepresentsan entity instance. The entity Customer may have multiple customer instances withnamesBob, Joe, Jane, and so forth. The entityAccount can have instances of Bob’scheckingaccount,Bob’ssavingsaccount,Joe’sbrokerageaccount,andsoon.
EntityTypesThe beauty of datamodeling is that you can take the same information and show it atdifferentlevelsofdetaildependingontheaudience.Inthisbookwediscussthreelevelsofdetail:conceptual,logical,andphysical.Entitiesexistatallthreelevels.
For an entity to exist at a conceptual level, it must be both basic and critical to thebusiness.What is basic and critical depends verymuch on the concept of scope. At auniversal level, therearecertainconceptscommon toall companies suchasCustomer,Product,andEmployee.Makingthescopeslightlynarrower,agivenindustrymayhavecertain unique concepts. Campaign, for example, will be a valid concept for anadvertisingcompany,butperhapsnotforotherindustrieslikehealthcare.Inthepublishingdatamodel,Author,Title, andOrder are conceptual entities, shown as names withinrectangles(seeFigure4.1).ER/StudioBusinessArchitectcanbeusedtocreateconceptualmodelsthatcanthenbeexportedtoDataArchitect.
Figure4.1Sampleconceptualentities
Entities at a logical level represent the business at a more detailed level than at theconceptual level. Frequently, a conceptual entity represents many logical data modelentities. Logical entities contain properties called “attributes,”whichwewill discuss inChapter 6. Figure 4.2 shows the three corresponding logical entities based upon theconceptualentitiesfromFigure4.1.
Figure4.2Samplelogicalentities
Ataphysicallevel,theentitiescorrespondtotechnology-specificobjectssuchasdatabasetables in a relational database management systems (RDBMS) or collections in theNoSQLdatabaseMongoDB.Thephysical level is thesameas the logical levelwith theexception of compromises that were needed tomake up for deficiencies in technology(oftenrelatedtoperformanceorstorage).
Figure4.3showsthethreecorrespondingphysicalentitiesbaseduponthelogicalentitiesfromFigure4.2.Thephysicalentitiesalsocontaindatabase-specificinformationsuchas
Menu Toolbar Explorer ShortcutKey
ShortcutMenu
Insert>Entity Modelingtoolbar: Right-clickonEntities,NewEntity…
<ALT+I>,then<E>
Right-clickonwhitespace,InsertEntity
BecomeanER/StudioHotshot:
ChooseView>DiagramAndObjectDisplay
Options,orclickontheicon ,andthenexperimentwiththedisplaylevelsettings.(Ifawarningmessageappearsthatthecurrentundohistorywillbecleared,thismeansthatthebufferholdingthelistofchangesyoumadeuptothispointwillbeemptied.So,forexample,ifyoucreatedanentitybefore
clickingon ,youwillnotbeabletoundocreatingthisentity.Youcanstilldeletetheentity;youjustcan’tremoveitbyhitting
theformatandlengthofanattribute(AuthorLastName is50characters)andwhethertheattributeisrequiredtohaveavalue(AuthorTaxIdentifier isnotnullandthereforerequiredtohaveavalue,butAuthorBirthDateisnullandthereforenotrequiredtohaveavalue).
Figure4.3Samplephysicalentities
In an RDBMS, these physical entities become database tables or views. In NoSQLdatabases,thesephysicalentitiesbecometransformedintohowtheunderlyingtechnologyviews the entity. For example, inMongoDB (a document-based database) these entitiesbecomecollections.Thegeneral term“structure”willbeused to refer to theunderlyingdatabase components independent of whether the database is a RDBMS or NoSQLsolution.
EntitiesinER/StudioInthissectionwewillpracticecreatingandeditingentitiesforthepublishingdatamodel.
CreatingEntities
<CTRL-Z>.Ifyoudon’twanttoseethiswarningagain,clickDonotdisplaythisdialogagain.)ThethreesettingsundertheEntitytabthatarerelevantinthischapterareDefinition,Note,andEntity.Definitiondisplaysthedefinitionofeachentityintheentitybox,Notedisplaysaplacefortextotherthanthedefinition(suchasquestionsandissues),andEntityjustdisplaystheentitynameinthebox.ChooseEntityforourexample.Thestatusbaratthebottomofthescreenshowsthenumberofentitiesinthemodelorsubmodel.YoucanhideorshowthisstatusbarusingView>StatusBaror<ALT+V>,then<S>.YoucancustomizetheinformationthatpopsupwhenyouhoverthemouseoveranentityunderView>CursorPopupHelpOptions>EntityHelp.
CreatetheentitiesAuthor,Title,ElectronicTitle,andPrintTitleusingavarietyoftheoptions above. (Electronic titles are ebooks such as those in Kindle or Adobe PDFformat.)
YoumayhaveamodelthatlookssimilartoFigure4.4.
Figure4.4Firstentities
Notice that I accidently created the extra entitiesEntity14 andEntity15. Did you dosomethingsimilar?Thismighthavehappenedbecause thecursor remained in theentitysymbol so that when we clicked, an entity appeared. Notice that having these “stickybuttons”isagreatfeaturebecausewecancreatealotofentitiesinverylittletimejustbyclicking.
Whenyouwanttoturnthestickybuttonsfeatureoff,justright-clickonanywhitespaceandthecursorreturnstoitsdefaultselectorsymbol.Nowhowdowegetridoftheseextraentitiesthatwecreated?StaytunedfortheDeletingEntitiessectionlaterinthischapter.(You can play though and experiment with how to delete them—playing is alwaysstronglyencouraged!)CreatingTextBlocks
Usetextblockstoinsertusefulinformationintothediagramsuchasexamplesofanentity.Youcanaddmultipletextblocksatspecificpointsthroughoutthediagramtoaddclarityandhelpwithorganization.Whenyounolongerneedtouseatextblockinyourdiagram,
Menu Toolbar Explorer ShortcutKey ShortcutMenu
Insert>TextBlock DrawingShapestoolbar: n/a <ALT+I>,then<X> Right-clickonwhitespace,Insert>TextBlock
Menu Toolbar Explorer ShortcutKey ShortcutMenu
Edit>EditEntity… n/a Right-clickonentity,Entities,EditEntity…
<ALT+E>,then<E>
Or
Double-clickontheentity
Right-clickonentity,EditEntity…
youcandeletethetextblock.
IntheDataModelWindow,clickanddragwhereyouwanttoplacethetextblock,enterthe text you want to display, and then right-click to deselect the Text Block creator.Double-clickon the textblock toenterorchange textat a later time.To resize the textbox,selectthetextbox,grabasizinghandleanddragtothedesiredposition.Changethefontattributesbyright-clickingthetextblockandthenclickingColors&Fonts.
EditingEntities
Highlighttheentityanduseoneofthesetechniques:
Tab Here’swhatyouneedtoknow:
Attributes Create,edit,andarrangeattributes.We’llcoverthistabinChapter6,AttributesandDomains.
Keys Define primary, alternate, and inversion entry keys on the attributes.We’ll cover this tab inChapter 6,AttributesandDomains.
Figure4.5EntityEditorscreen
ThescreeninFigure4.5canberesizedbyclickinganddraggingthelowerrightcorner.Thisscreencanalsobecomemaximizedbyclickingthesquaresymbolintheupperrightcorner(totheleftofthe“x”thatclosesthewindow)andthenreturnedbacktoitsoriginalsizebyclickingthetwosquaresymbolsintheupperrightcorner.Thereare14tabsonthisscreen:
Relationships Viewandeditrelationshipsbetweenentities.We’llcoverthistabinChapter7,Relationships.
Definition Definetheentity.Ifthetargetdatabasesupportsit,ER/Studioaddsthisdefinitionasatablecommentwhengenerating SQL code. The macroDefinitionEditor allows for easily entering definitions for multipleobjects.MoreonmacrosinChapter16.
Note Captureanyother textoutside thedefinitionsuchasquestions toaskbusinessexperts,known issues,oraction items.HTML tags used inNoteswill be applied as formatting in theHTML reports. ThemacroNotesEditorallowsforeasilyenteringnotesformultipleobjects.MoreonmacrosinChapter16.
WhereUsed Seewhichlogicalandphysicaldatamodelsandsubmodelscontaintheentity.Fromthistabyoucaneditmappingsanduser-definedmappings.
Constraints Display, create, and edit constraints.A constraint is a rule that is checked before data is allowed in thedatabase. For a table instance (also called a record), these are rules that can be created and edited todeterminewhatcanbeaddedtothedatabasetable.TheseconstraintsbecomepartoftheSQLusedtobuildthetable.Thisisatabthatwouldbeusedinthephysicaldatamodelbutnotthelogicaldatamodel.
Dependencies Displaytheviewsthatdependonthisentity.Thisisatabthatwouldbeusedinthephysicaldatamodelbutnotthelogicaldatamodel.
Permissions Selectdetailedpermissions(e.g.,insert,select,update,anddelete)forusersandrolesforthisentity.Thisisatabthatwouldbeusedinthephysicaldatamodelbutnotthelogicaldatamodel.
NamingStandards Applydifferentnamingstandardstodifferentobjectswhenportionsofamodelrequiredifferentversionsofastandard.Forexample,someobjectsalreadyexistinthedatabaseandyoumaynotwanttoapplyanewernamingstandard to them.Whenselected, theFreezeNamesoptionprevents changes to thenameof theselected attribute when naming standards are applied. We’ll cover this tab in Chapter 14, NamingStandards.
CompareOptions Selectwhich,ifany,properties(e.g.,entityname,definition,notes)oftheentitytoignorewhencomparingthisentitytoanotherusingtheCompareandMergeUtility,whichwillbediscussedinChapter15.
DataLineage Maptherulesfromsourcetotargetentitiesinthemodel.We’llcoverthistabinChapter12,DataLineage.
SecurityInformation AssignsecuritysettingsthataredefinedintheDataDictionarytothisentity.TheDataDictionarywillbediscussedinChapter11.
AttachmentBindings Bindanexternalpieceofinformation,suchasaMicrosoftWorddocumentorPDFfile,totheentity.Veryusefulforrequirementsdocuments,userstories,etc.AttachmentsarecreatedintheAttachmentsfolderoftheDataDictionary(discussedinChapter11)andmustbeaddedtothemodelbeforetheywilldisplayonthistab.
Menu Toolbar Explorer ShortcutKey ShortcutMenu
Edit>EditEntity(intheupperleftcorneryoucanrenametheentity)
n/a ModifyName <ALT+E>,then<E>(intheupperleftcorneryoucanrenametheentity)
Right-clickonentity,EditEntity…(intheupperleftcorneryoucan
ChangingtheNameofanEntity
Highlighttheentityanduseoneofthesetechniques:
renametheentity)
MovingEntities
Tomove entities,make sure the cursor is in the selection shape (the arrow buttonfromtheDiagramToolbar).Thenclickanddragtheentities to theirdesiredspots.Youcanmovemultipleentitiesatthesametimebyclickinganddraggingoverthemtoselectthemorbypressingandholding<CTRL>whileyouclickeachentity.
Once the entities are selected, the cursor changes to and then you can drag theentities toanew location.Averyquickandaccuratewayofaligningentitieswitheachother,suchasleftjustifiedorspacedevenly,istousetheLayoutandAlignment toolbar.RecallFigure3.5repeatedhereasFigure4.6.
Figure4.6Layout&Alignmenttoolbar
Highlighttheentitiesyouwouldliketoalignandthenclickononeoftheseicons.
TheLayout&Alignment toolbar contains icons to quickly and accurately arrange yourentirediagramorasubsetofentities.Therearefivetypesoflayoutsthatwillarrangetheentirediagramorasubsetofhighlightedentities:
Circularlayout.Revealsthedependenciesandrelationshipsbetweenthedatamodelobjects,emphasizinggroupstructurebyrearrangingthedatamodelintooneormorecircularpatterns.ThislayoutcanbeusedforaninitialstarschemadesignasdiscussedinChapter10,PhysicalDataModels.Itisalsousefulwhenyouhaveaverylargedatamodelandwanttoshow“clumps”ofrelatedentitiesforeasiercommunication.Forexample,ifeachclumpisasubjectarea,youcouldapplyacircularpatterntojusttheorder-relatedentities,anothercircularpatterntojustthecustomer-relatedentities,andsoonforeachsubjectareatomakethemodeleasiertoread.
Menu Toolbar Explorer ShortcutKey
ShortcutMenu
Format>ResizeEntity/View n/a n/a <ALT+O>,then<R>
n/a
BecomeanER/StudioHotshot:
Thesimplestwaytoresizeanentityisbyselectingtheentityandthendraggingthesizehandles.ER/Studiocanautomaticallyresizeentities,tables,andviews.Youcanhighlightmultipleentitiesbyusingthe<SHIFT>or<CTRL>keys(orbyclickinganddraggingovermultipleentities)andresizealloftheselectedentitiesatonce.Youcanrestoretheentitytoitsoriginalsizebyright-clickingontheentityandchoosingResizeorbyclicking<CTRL+R>.
Hierarchicallayout.Organizesentitiesinahierarchicalpatternbasedonthedirectionoftherelationshipbetweentheentities.Youcanusethislayoutforarranginglogicaldimensions,whichwillbediscussedinChapter9,LogicalDataModels.Itcanalsobeeasiertoreadadatamodelfromthetopofthepagedown,makingthisausefularrangementpattern.Orthogonallayout.Rearrangesthedatamodelintosquare-line,rectangularpatternsthatuseonlyhorizontalandverticallinerouting.Orthogonallayoutshavefewcrossingsandallowminimalstretchingofentitiesthathaveahighnumberofrelationships.Thislayoutisveryusefulforhighlynormalizeddatamodels.NormalizationwillbediscussedinChapter9,LogicalDataModels.Symmetriclayout.Providesasymmetricalpatterncenteredonasingleentitywhereperipheralentitiesmovetotheedgeofthediagram.Thisisgreatforastarschemadesign(similartothecircularlayout).Treelayout.Rearrangesyourdiagramintoatreepatternwithparentandchildentities,producingadatamodelthatcontainsarootentityandonlyoneuniquepathfromtherootentitytoanyotherentity.Treelayoutscanhavebranchesandsiblingswhereparenttochildrelationshipsareinherent.Thiscanbeidealforexplainingcomplexhierarchies,taxonomies,andsubtypingstructures(subtypingdiscussedinChapter7).
TheGlobalicononthistoolbarmakesthearrangementallatonce.Incrementalperformsthearrangementinstages.Layoutallowsyoutosetparametersforeachofthefivetypesof layouts,andRefreshapplies thesechanges to thediagram.The remainingbuttonsonthetoolbarallowyoutoalignselectedentitiesdifferentways.
ResizingEntities
ER/Studioautomaticallydeterminestheproperdimensionsoftheentitytofitthetextthatitdisplays.However,youcanstillresizetheentitybyselectingitandusingoneofthesecommands:
Menu Toolbar Explorer ShortcutKey ShortcutMenu
Tools>Options n/a n/a <ALT+T>,then<P> n/a
Menu Toolbar Explorer ShortcutKey
ShortcutMenu
Format>EntityColorandFontSettings n/a Right-clickonentity,EntityColorandFontSettings
<ALT+O>,click
onEntityColorandFontSettings
Right-clickonentity,EntityColorandFontSettings
BecomeanER/StudioHotshot:
Youcanhighlightmultipleentitiesbyusingthe<SHIFT>or<CTRL>keys(orbyclickinganddraggingovermultipleentities)andthenchangetheirfontsandcolorsallatonce.
ChangingtheAppearanceofEntities
There are a number of settings for changing theway entities appear on the screen andwhen printed.One such setting is the shadow feature,whichmakes the entities appearthree-dimensional.ThisshadowfeatureisturnedonbydefaultbutcanbeturnedonandoffunderOptions:
Select the Display tab and then click or unclick the Shadow checkbox under ModelDisplay.Aswith a number of other settingsunder options, turningon andoff shadowsimpacts futuremodelsbutnot theone currentlyopen.To turnon andoff shadowing inyour currentmodel, simply hit <F7>.Using certain colors and fonts can help highlightportionsofthemodelanddistinguishsectionsofthemodelfromothersections:
Afterapplyingoneofthecommandsabove,youaregiventhreeoptions:
1. Entity/AttributesColorsandFonts.Thisoptionprovidesthemostfunctionalityinadjustingcolorsandfonts.
2. EntityBackground/OutlineColor.Thisisthesimplestwayjusttochangetheentitybackgroundoroutlinecolor.
3. SetEntitytoUseSubmodelDefaults.Thiswillresetthecolorsandfontstothesubmodeldefaults.
Ifyouchoosethefirstoption,thescreeninFigure4.7appears.
Menu Toolbar Explorer ShortcutKey
ShortcutMenu
Format>Colors&Fonts Diagramtoolbar: n/a <ALT+O>,then<C>
Right-clickonwhitespace,Colors&Fonts
Figure4.7ColorsandFontsscreen
From this screenyoucanchange the colors and fontsof entities andalso attributes.Tochange the coloror fontsof attributes,make a selection from thedrop-downmenuandclick<SetColor>and<SetFont>.IfyouclickthecheckboxApplytoallsubmodels, thecolorandfontchangesyoumakeherewillapplytothissameobjectineverysubmodelinwhichitappears.(Submodelsarethesubjectofthenextchapter.)Click<OK>toexitthescreenandhaveyourchangesapplied.
Thereisaveryquickwaytochangethecolorofallofaparticularobjectsuchasforallentities:
Clickontheentitysymbolortextorchoosetheappropriateentitypropertyfromthedrop–down,andclick<SetColor>toselectthecoloryouwouldlike.Click<OK>toexitthisscreenandapplyyourchanges.
CopyingEntities
Highlight the entity or entities you would like to copy and then choose one of thesecommands:
Menu Toolbar Explorer ShortcutKey
ShortcutMenu
Edit>Copy,thenEdit>Paste Diagramtoolbar:
(copy),then
(paste)
DragentitiestotheDataModelWindow
<CTRL+C>then<CTRL+V>
or
<ALT+E>,then<C>forcopy,<ALT+E>,then<P>forpaste
Right-clickentity,Copy,thenright-clickonwhitespace,Paste
BecomeanER/StudioHotshot:
Youcanhighlightmultipleentitiesbyusingthe<SHIFT>or<CTRL>keys(orbyclickinganddraggingovermultipleentities)andcopyalloftheselectedentitiesatonce.
YoucanalsocutandpastebyusingtheiconontheDiagramtoolbar.
Menu Toolbar Explorer ShortcutKey
ShortcutMenu
Edit>FindEntity/View… Applicationtoolbar:
n/a <F4>
or
<ALT+E>,then<F>
Right-clickonwhitespace,FindEntity
Menu Toolbar Explorer Shortcut Shortcut
Thenameofthenewobjectwillbethenameoftheoriginalobjectappendedby_1suchas Entity_1. If you create another copy of the object, the new object would be namedEntity_2.Thecopiedobjectcanbepastedintoanothermodelorsubmodelinthesamefileorinanotheropendiagram.
FindingEntities
Therearetwotechniquesforfindingentities:FindEntity/ViewandthepowerfulUniversalNamingUtility.FindEntity/View
FindEntity/View isveryuseful for locatingasingleentityby the first few lettersof theentity’sname.
UniversalNamingUtility
Ifyouneedamorepowerfulsearch,suchaslocatingseveralentitiesorattributesorevensearchingbyanypartof theentity’sname,use theUniversalNamingUtility.Using theUniversalNamingUtility,youcangloballysearch,andreplaceifdesired,names,strings,andattachmentvalueoverrides forboundattachments.Youdefineyoursearchand thenconfinethesearchtospecificobjectswithinyourmodels.
Key Menu
Tools>UniversalNamingUtility Applicationtoolbar:
n/a <CTRL+F> n/a
BecomeanER/StudioHotshot:
Once your results come back from a search, youcanhighlightallorasubsetofthereturnedentitiesand click Create Submodel to create a newsubmodel that contains just the highlightedentities.Thisisagreatfeatureforquicklycreatingasubmodelof just theareayouare interested in,whichisveryusefulforimpactanalysis.
ThescreeninFigure4.8appears.Let’sreplaceanyTitletermonourmodelwiththewordBook.Iwillignorewhetheritisupperorlowercase( )andIwanttoreplaceiteverywhere the term appears, regardless of whether the entity is named Title or TitleCategory,soImakesure isnotchecked.
Menu Toolbar Explorer ShortcutKey
ShortcutMenu
Edit>DeleteEntity Diagramtoolbar: Right-clickonentity,DeleteEntity
<DELETE>
or
<ALT+E>,then
Right-clickonentity,DeleteEntity
Figure4.8UniversalNamingUtilityresults
ThisisanextremelypowerfulfeatureofER/Studioaswecanreplacetermsinattachmentsandthroughouttheentiremodel.Youcanevencreateareportofsearchresultsbyclicking<Report>.RTF-formattedreportsare idealforprintdistribution,whileHTML-formattedreportsarebettersuitedforbrowserviewing.MoreonreportsinChapter13.
DeletingEntities
Highlight the entity or entities you would like to delete and use one of the followingoptions:
<D>
BecomeanER/StudioHotshot:
Toselectmultipleentitiesfordeletion,pressandhold<CTRL>whileclickingtheentitiesorclickanddragovertheentities.Sometimesyouwilldeleteanentityandreceiveamessageaskingwhetheryouwouldliketodeletetheentityfromtheentiredatamodelorjustthesubmodel.Ifyoudeletetheentityjustfromthesubmodel,thisentitywillstillexistinthemodel.Moreonsubmodelsinthenextchapter.
EntityName Definition
Category Asubjectthatisofinteresttoabookstore,wholesaler,reader,orattendee.Fortitles,categoriesaredefinedaccordingtowherethebooksshouldbeplacedonshelves(whetheractualshelvesortopicsonawebsite).Examples include Database, Business Intelligence, and Data Modeling. For seminars and conferences,categoriesincludethesubjectmattersuchasAgileDevelopmentorDataModeling.
Language Thespeechofacountry,region,orgroupofpeopleincludingitsvocabulary,syntax,andgrammar.Titlescan be translated into different languages such as Japanese and Spanish, and training can be taught indifferentlanguages.
Speaker Theindividualwhowillbeteachingaseminarorpresentingataconference.
Conference A forum for getting speakers and attendees together for discussing a topic of interest such as for datamodelinganddatawarehousing.
Seminar Thetrainingonaparticulartopicinaparticularlocationonaparticulardate.SometimescalledaClassorWorkshopsuchastheAdvancedDataModelingWorkshop.
Offering Agenericwayof referring to a title, conference, or seminar.Anoffering is a term for anyproduct thatTechnicsPublicationssells.
EXERCISE4.1:CreatingEntitiesTechnicsPublications,thepublisherwearemodeling,publishesbooksandalsoorganizesseminarsandconferences.Create thefollowingentitiesalongwith theirdefinitions.Usethe techniques taught in this chapter for resizing, coloring, font changing, moving,copyingandpasting,etc.,andalsopracticetheundofeature(<CTRL+Z>forshort).
Table4.2Createtheseentities
Eachexercisebuildson thepriorone, so in thenext chapterwewill assign the entitiesfromthisexercise(plustheoneswecreatedearlierinthischapter)tosubmodels.
KeyPointsAnentityrepresentsacollectionofinformationaboutsomethingthatthebusinessdeemsimportantandworthyofcapture.Anentityfitsintooneofseveralcategories:who,what,when,where,why,orhow.Anounornounphraseidentifiesaspecificentity.Entityinstancesaretheoccurrencesorvaluesofaparticularentity.
Anentitycanexistattheconceptual,logical,orphysicallevelofdetail.
TherearemultiplewaystoperformalmostanyactioninER/Studio.
Withtheclickofabutton,youcanarrangeyourentirediagramorasubsetofentitiesusingoneoffivetypesoflayouts:circular,hierarchical,orthogonal,symmetric,andtree.
Double-clickingonanentitybringsuptheeditwindow.
Usetextblockstoinsertusefulinformationintothediagramsuchasexamplesofanentity.
UsingtheUniversalNamingUtility,youcangloballysearch(andreplace,ifdesired)names,strings,andattachmentvalueoverridesforboundattachments.
“Stickybuttons”areagreatfeaturebecausewecancreatealotofentitiesinverylittletimejustbyclicking.Whenyouwanttoturnthestickybuttonsfeatureoff,justright-clickonanywhitespaceandthecursorwillreturntoitsdefaultselectorsymbol.
CHAPTER5Submodels
Modelgettingbig?DisplayinsmallerpiecesSubmodelsmakesense
Datamodelscanbevery large, so tomaintainauseful communication tool, these largemodelsneedtobebrokendownintomanageablechunkscalledsubmodels.ThischapterwillexplainthesubmodelandshowyouhowtoworkwithsubmodelsinER/Studio.
SubmodelExplanationAsubmodelisadisplayofpartofadatamodel.Submodelsareusedtomakeiteasiertounderstandlargecomplexdatamodels.Someonemayonlybeinterestedinseeingasubsetofthemodel,sodisplayingthemodelindigestiblepiecesenhancescommunication.Justlike we can create a folder on our computer and then add subfolders, we can createsubmodelswithinourlargermodel(andevensubmodelswithinsubmodels).
On the left sideofFigure5.1 is a typicalMicrosoftWindows file structure, andon therightsideareER/Studiosubmodelsdefinedwithinalargermodel.Thesubmodeliconisafolderwith amagnifying glass.Notice that in the submodelCustomers, there are twonestedsubmodels,DirectandIndirect.
Whenchangingsettingsspecifictoasubmodelsuchasthesubmodel’sbackgroundcolorormodel layout,only thatsubmodel is impacted.Whenchangingsettingsspecific toanobject on a submodel, such as changing an entity name, that entity name is changedeverywhere(notjustinthesubmodel).Soforexample,ifwerenameClienttoCustomerinonesubmodel,thisentitywillnowbecalledCustomereverywhereitappearsandnotjustinthatonesubmodel.
Menu Toolbar Explorer ShortcutKey
ShortcutMenu
Model>CreateSubmodel… Right-clickwheresubmodelshouldbeadded,CreateSubmodel…
<ALT+M>,then<C>
Right-clickonwhitespace,CreateSubmodel…
BecomeanER/StudioHotshot:
Youcannestsubmodelswithinsubmodels.Forexample,wecanhavetheTransactionsubmodelcontainsubmodelsOrder,Return,andCredit.Youcanclickanddragsubmodelstobeincludedinanothersubmodeljustlikedraggingfolderstocreatesubfolders.Ashortcutforcreatingasubmodelwithentitiesalreadyinitistohighlightthoseentitiesyouwouldliketohaveinthenewsubmodelandthenuseoneoftheapproachesabovetocreateyoursubmodel.Youcanhighlightmultipleentitiesbykeepingthe<CTRL>keydepressed.ER/Studioautomaticallyincludesrelationshipsbetweenentitiesifrelated
Figure5.1Comparingafolderstructurewiththesubmodelconcept
SubmodelsinER/StudioWhenwecreate adatamodel, theMainModel submodel is also created.Thinkof theMainModel submodel as a holding area for everything that we create in our model.Whenwecreateanewsubmodel,onlythoseobjectsweassigntothatsubmodelwillbedisplayed.Whenwecreateanewentityinthatsubmodel,thatentitywillalsoexistintheMainModel.
CreatingSubmodels
entitiesarepartofthesubmodel.Youcaneditthesubmodeltoincludeorexcludespecificrelationships.
Let’screatethesubmodelTitlebyusingoneof theseapproaches.TheCreateSubmodelscreenshouldappearasinFigure5.2.
Figure5.2CreateSubmodelScreen
Notethatthisscreencanberesizedbyclickinganddraggingthelowerrightcorner.
Choose the entities (or other submodels) you would like in the new submodel byhighlightingintheleftpaneandclickingthe icon.Ifyouwanttoremoveanitemyouhave selected, highlight it in the right pane and click the icon. You can highlightmultiple entities or submodels using the <SHIFT> or <CTRL> keys. There are severalsettingsonthisscreenthatareimportanttomention:
PlaceNewObjectsNearExistingObjects,whenchecked,willplacetheentitiesyouassigntothesubmodelnearexistingentitiesinthissubmodel(ortowardsthecenterofthesubmodeliftherearenopre-existingentitiesinthesubmodel).Ifleftunchecked,theentitieswillappearinthesamepositionstheywereintheirsourcesubmodel.InheritObjectsAddedtoNestedSubmodels,whenchecked,meansifanentityisaddedtoanestedsubmodel(thechild),itwillautomaticallybedisplayedintheparentsubmodel.SoiftheOrdersubmodelisnestedwithintheTransactionsubmodel,andweaddtheentityEmployeetotheOrdersubmodel,theentityEmployeewillalsobeaddedtotheTransactionsubmodelifthischeckboxis
Tab Here’swhatyouneedtoknow:
Attributes Choose which attributes of the entities selected to include in the submodel. If you deselect anattribute,ER/Studiocandisplayanellipsis toindicatethatnotallattributesaredisplayed.Iwouldadviseusingthisfeatureonlywhentheentitycontainsanextremelyhighnumberofattributesand,forreadability,whendisplayingonlyasubsetofattributesmakessense.
Definition Enteradefinitionforthesubmodel.
AttributeBindings Bind an external piece of information, such as a Microsoft Word document or PDF file, to thesubmodel.Veryusefulforrequirementsdocuments,userstories,etc.AttachmentsarecreatedintheAttachmentsfolderoftheDataDictionary(discussedinChapter11)andmustbeaddedtothemodelbeforetheywilldisplayonthistab.
SecurityInformation Change or view the current security information as defined in the Data Dictionary (discussed inChapter11).
selected.Showallavailableitems,whenchecked,willshowallpossiblesubmodelsandentitiesthatcanbeaddedtothesubmodel.Whenunchecked,onlythoseentitiesandsubmodelsthatalreadyhavebeenassignedtothesubmodelwillappear.Thatis,thesourceandtargetpaneswouldcontainthesameobjectswhenthisfeatureisunchecked.Goodideatokeepthisonechecked.AutomaticallyIncludeRelationships,whenchecked,meansalloftherelationshipsassociatedwiththeentitiesyouselectwillalsobebroughtintothesubmodel.Goodideatoleavethisonecheckedtoo.SelectRelatedObjects…allowsyoutobringinwhatisrelatedtotheentityinadditiontotheentity.IusethisfeatureforanumberofsituationsincludingwhenIwanttoseewhatisrelatedtoanentityorgroupofentities.ItisalsousefulwhenIneedtodoamodelreviewwithagroupofusersinjustonearea,butIneedtoshowtheboundariesofthatarea.(Thatis,ifIreviewtheOrderarea,IwouldbeinterestedinshowingthatordersconnecttoanotherareasuchasEmployee.)Thenumber1issetbydefault,meaningthatonlyentitiesorsubmodelswithdirectrelationshipswillbebroughtin.Ifyousetthisnumberto2,grandparentswillbebroughtinaswellasparents.Forexample,ifOrderisrelatedtoEmployeeandEmployeeisrelatedtoBeneficiary,bothEmployeeandBeneficiarywouldbebroughtin.SelectRelatedObjects…appearstwiceonthisscreen,soyouhavetheoptionofselectingtheparents,grandparents,etc.,andthenbringingthemoverusingtheleftbutton.Alternately,youcanfirstbringovertheentitiesyouneedandthendecideontheparents,grandparents,etc.,usingtherightbutton.
TherearefourothertabsontheCreateSubmodelscreen:
Assign theentitiesTitle,ElectronicTitle,andPrintTitle to theTitlesubmodel. Click<OK>whendoneexploringeachtab.TheTitlesubmodelisnowcreated.
EditingSubmodels
Menu Toolbar Explorer ShortcutKey
ShortcutMenu
Model>EditSubmodel… n/a Right-clickonsubmodel,EditSubmodel…
<ALT+M>,then<E>
Right-clickonwhitespace,EditSubmodel…
BecomeanER/StudioHotshot:
Youcanalsoaddacommenttoamodelorsubmodelbyhighlightingthemodelor
submodelinExplorerandclicking ontheApplicationtoolbar.Commentscanbeusedtocapturethecurrentstateofthemodel,outstandingissues,theaudienceforthediagram,etc.IfyouareusingtheRepository,commentscanbeviewedbyallER/Studiousers.
Menu Toolbar Explorer ShortcutKey
ShortcutMenu
Format>Colors&Fonts Diagramtoolbar: n/a <ALT+O>,then<C>
Right-clickonwhitespace,Colors&Fonts
Menu Toolbar Explorer ShortcutKey
ShortcutMenu
Model>DeleteSubmodel… n/a Right-clickonsubmodeltodeleteandchooseDeleteSubmodel
<ALT+M>,then<D>
n/a
Youcanalsoeasilychangethebackgroundcoloronasubmodel:
ChooseModelBackgroundfromthedrop-downlist(orclickanywhereinthewhitespacewithinthiswindowtobringupModelBackgroundinthedrop-downlist)andclick<SetColor>toselectthecoloryouwouldlike.Click<OK>toexitthisscreenandapplyyourchanges.
MovingSubmodels
Toassistyouinanalyzingyourdatamodel,youcanmovesubmodelsfromonemodeltoanother.Youcanalsomovesubmodelstonestthemwithinothersubmodels.OntheMaintoolbar, click the Selection tool (the arrow). In the Data Model Explorer, click thesubmodelyouwanttomoveandthendragittoanothermodelorsubmodel.
DeletingSubmodels
EXERCISE5.1:ChangingSettingsinSubmodels
Setting Appliedtoonlysubmodel Appliedtoentiremodel
Changingsubmodel’sbackgroundcolor
Changinganentity’sname
Changinganentity’sbackgroundcolor
Resizinganentity
Creatinganentity
Deletinganentity
Rearrangingentities
Assigntothissubmodel… Theseentities
Offerings Offering
Title
ElectronicTitle
PrintTitle
Category
ConferenceSeminar
Speaker
Playwithsubmodelsandfillinthefollowingspreadsheet,whichcaptureswhichsettingsarespecifictoagivensubmodelandwhichsettingsapplytothemodelinitsentirety.Foreachsetting,putan‘x’inthe“Appliedtoonlysubmodel”columnifchangingthissettingonly impacts the submodel, and put an ‘x’ in the “Applied to entiremodel” column ifchangingthissettingwillimpacttheentiredatamodel.SeeAppendixforanswers.
EXERCISE5.2:CreatingThreeMoreSubmodelsCreate three more submodels for our publisher design: Offerings, Conferences, andSeminars. The Offering submodel will contain everything in our model, and theConferencesandSeminarssubmodelswillcontainsubsets,asshowninTable5.1.
Conferences Conference
Speaker
Seminars Seminar
Speaker
Menu Toolbar Explorer ShortcutKey
ShortcutMenu
Insert>TitleBlock DrawingShapestoolbar:
n/a <ALT+I>,then<B>
Right-clickonwhitespace,InsertTitleBlock
BecomeanER/StudioHotshot:
ER/Studiosupports“stickybuttons,”meaningyoucan create many occurrences of an object andthen,whenyouaredone,right-clickonanywhitespace to return the cursor to the default selectorsymbol.
Table5.1AssignmentofEntitiestoSubmodels
EXERCISE5.3:CreatingTitleBlocksforEachSubmodelCreateaTitleBlockforeachofthefoursubmodels(theTitlesubmodelcreatedearlierinthischapterandthethreefromthepreviousexercise).TheTitleBlockprovidesimportantidentification information about your model or submodel that by default includes theprojectname,filename,submodel,version,modificationdate,andcopyright.
KeyPointsAsubmodelisadisplayofpartofadatamodel.Submodelsareusedtomakeiteasiertounderstandlarge,complexdatamodels.
SubmodelsareorganizedverysimilartothefilestructureinMicrosoftWord.
Whenchangingmodelaestheticsinasubmodel,suchasthesubmodel’sbackgroundcolorormodellayout,onlythatsubmodelisimpacted.Whenchangingmodelcontentinasubmodel,suchasrenaminganentity,thatentitynameisrenamedeverywhere(notjustinthesubmodel).
Youcannestsubmodelswithinsubmodels.
CHAPTER6AttributesandDomains
SpreadsheetshavecolumnsSimilartoattributesMeasureanddescribe
This chapter defines an attribute and defines keys, distinguishing between candidate,primary,surrogate,foreign,andalternatekeys.Domainsarealsodiscussedinthischapter.Wewillpracticecreatingandeditingattributes,keys,anddomainsinER/Studio.
AttributeExplanationAn attribute is an elementary piece of information of importance to the business thatidentifies, describes, or measures instances of an entity. The attributeClaim Numberidentifieseachclaim.TheattributeStudentLastNamedescribes the lastnameofeachstudent.TheattributeGrossSalesAmountmeasuresthemonetaryvalueofatransaction.Returning to our spreadsheet analogy from Chapter 4, the column headings on aspreadsheetareattributes.Thecellsbeneatheachcolumnheadingarethevaluesforthatcolumnheading.Attributescanbethoughtofasthecolumnheadingsinaspreadsheet,thefields on a form, or the labels on a report. Author Last Name and Title ISBN areexamplesofattributesfromourpublishingdatamodel.
AttributeTypesAs with entities, attributes can exist at conceptual, logical, and physical levels. Anattributeattheconceptuallevelmustbeaconceptbothbasicandcriticaltothebusiness.Wedonotusuallythinkofattributesasconcepts,butdependingonthebusinessneed,theycan be. When I worked for a telecommunications company, Phone Number was anattributeso important to thebusiness that itwas representedonanumberofconceptualdatamodels.
Anattributeonalogicaldatamodelrepresentsabusinessproperty.Eachattributeshowncontributes to the business solution and is independent of any technology includingsoftware and hardware. For example,AuthorLastName is an attribute because it hasbusinesssignificanceregardlessofwhetherrecordsarekept inapaperfileorwithinthefastest database out there. An attribute on a physical datamodel represents a databasecolumn. The attribute Author Last Name might be represented as the columnAUTH_LAST_NM within the RDBMS tableAUTH or represented as the field nameAuthorLastNameintheMongoDBcollectionLibraryCardCatalog.
AttributesinER/Studio
Menu Toolbar Explorer ShortcutKey
ShortcutMenu
Edit>EditEntity… n/a Right-clickonentity,NewAttribute
<ALT+E>,then<E>OrDouble-clickontheentity
Right-clickonentity,EditEntity
BecomeanER/StudioHotshot:
Ifyouareusingdomainsinyourdatamodel,youcanclickanddragadomainintoanentitytocreateanewattribute.WewillexplaindomainslaterinthischapterandshowyouhowtocreateandmanagetheminChapter11,DataDictionary.Thestatusbaratthebottomofthescreenshowsthenumberofattributesinthemodelorsubmodel.YoucanhideorshowthisstatusbarusingView>StatusBaror<ALT+V>,then<S>.
In thissectionwewillpracticecreatingandmodifyingattributesfor thepublishingdatamodel.
CreatingAttributes
Highlight the entity where you would like to create attributes and use one of thesetechniques:
Any of these approaches brings up theEntityEditor screen.Make sure you are on theAttributes tab and click <Add> to create a new attribute. Figure 6.1 contains themostimportantsectionoftheEntityEditorscreen,followedbyadescriptionofeachproperty.
Figure6.1NewAttributescreen
DomainNamedropdown.Listsalldefineddomains.Youcanassignanyavailabledomaintoanattribute.Moreondomainslaterinthischapter.CreateDomaincheckbox.AllowsyoutocreateanewdomainthatisautomaticallyaddedtotheDataDictionary.Thischeckboxwillbecomeactiveonceadomainnameisenteredwhereitsays[NONE].AttributeName.Thefullnamethatwillappearonthedatamodelfortheattribute.LogicalRolename.Sometimesonalogicaldatamodel,thereisaneedtogiveaforeignkeyadifferentnamethanitsprimarykey.Thenameyoutypeinherewillbethenameoftheforeignkey.Foreignkeyswillbeexplainedshortlyinthischapter.DefaultColumnName.Thecolumnnameonthephysicaldatamodelis,bydefault,thesamenameastheattributenameonthelogicaldatamodel(logicaldata
modelsarediscussedinChapter9,andphysicaldatamodelsarediscussedinChapter10).Ifyouwantthephysicalcolumnnametobedifferentthanthelogicalattributename,typeanewcolumnnameinthebox.ER/Studiousesthisnamewhengeneratingthephysicaldatamodel.DefaultColumnRolename.Sometimesonaphysicaldatamodel,thereisaneedtogiveaforeignkeyadifferentnamethantheprimarykeyitcomesfrom.Primaryandforeignkeyswillbeexplainedshortlyinthischapter.Thenameyoutypeinherewillbethenameoftheforeignkey.HideKeyAttributecheckbox.Althoughnotarecommendedpracticebecauseitcanimpacttheintegrityofthedatabasedesign,ER/Studiodoesgiveyoutheoptionofcreatingapartialkeyrelationship.Whenarelationshipisdefinedbetweentwoentities,theprimarykeyofoneoftheentities(theparent)ispropagatedtotheotherentity(thechild)asaforeignkey.Sometimesthesekeyscanbecumbersomeintermsofsizeorcomplexity.Apartialkeyrelationshipiswhenonlypartoftheprimarykey(asubsetofattributes)ispropagatedastheforeignkey(insteadofthewholeprimarykey).Byclickingthischeckbox,theattributewillbehiddeninthechildentity.Itwilldisplayasunavailablewheneditingthechildtable,butyoucanmakeitavailableagainlaterbyunclickingthischeckbox.LogicalOnlycheckbox.Ifselected,theattributewillnotbeimplementedasacolumnwhengeneratingaphysicaldatamodel.Thiscanbeusefulwhenlogicallymodelingfuturephasesofaproject.
SynchronizeColumnRolenamewithLogicalRolenamecheckbox.Availablewhentheattributeselectedisaforeignkey.Allowsyoutochangetherolenamesofforeignattributesorcolumnstothesamenamesasotherattributesorcolumnsinthesameentityortable.Duplicateswillbeunifiedwhentheuserendstheeditsession.AddtoPrimaryKey?checkbox.Whenchosen,addstheselectedattributetotheentity’sprimarykey.EditForeignKeyDatatypecheckbox.Whenselectedforachildobject,youcaneditthedatatypevaluesoftheforeignkey.Whenthisoptionisselected,changesmadetothisrelationshipintheparentarenotpropagatedtothechilduntilyoudeselectthisoption,preservingtheforeignkeyoverrides.
Figure6.2containsthetabssectionoftheAttributessectionoftheEntityEditorscreen.
Figure6.2AttributeTabs
Clickingthe iconallowsyou tomove the tabs to theright tonavigate throughall14
Tab Here’swhatyouneedtoknow:
Datatype Choosetheformat(e.g.,character,date,decimal)andwidth(alsocalled“length”)oftheattributeaswellaswhethertheattributeisrequired(AllowNulls?settoNo)oroptional (AllowNulls? set toYes).Scaleisusedfordecimalformatstodefinehowmanyplacesthereshouldbetotherightofthedecimalpoint.TheIdentityPropertysettingsisusefulwhenyouhaveacounterastheprimarykey.Click Identity Column; Seed then allows you to decide the starting number while Incrementdetermines how much to add to that number each time an instance is created. For example, ifCustomerisidentifiedbyCustomerID,whichyoudefineasanidentitycolumn(clicktheIdentityColumncheckbox),byenteringaSeedof5andanIncrementof15,thefirstcustomerwillhaveaCustomerIDvalueof5,thesecondcustomeravalueof20,thethirdavalueof35,etc.
Default We can assign a default value to this attribute that will be carried through to the data definitionlanguagetobuildthedatabase.WecanenteradefaultvaluehereoruseadefaultvalueasdefinedintheDataDictionary,whichwillbediscussedinChapter11.
Rule/Constraint Wecanassignaconstrainttothisattributethatwillbecarriedthroughtothedatadefinitionlanguageto build the database.We can enter a constraint here or use a constraint as defined in the Data
Dictionary.
Definition This is where the full definition for the attribute is stored. If the target database supports it,ER/Studio adds this definition as an attribute comment when generating SQL code. The macroDefinitionEditor allows for easily entering definitions formultiple objects.More onmacros inChapter16.
Notes Usethisforanyother textoutsidethedefinitionsuchasquestionstoaskbusinessexperts,knownissues,oractionitems.HTMLtagsusedinNoteswillbeappliedasformattingintheHTMLreports.ThemacroNotesEditor allows foreasilyenteringnotes formultipleobjects.Moreonmacros inChapter16.
WhereUsed Seewhichlogicalandphysicaldatamodelsandsubmodelscontaintheattribute.Fromthistabyoucaneditmappingsanduser-definedmappings.
ReferenceValues Reference values are attributes that define allowed data. They represent look-up table columns,code-valueranges,oraruleorconstraintappliedtoacolumn.Referencevaluescanbedefinedasarangeofvaluesorasanitemizedlist.Youcanbindtheattributetoareferencevalueonthistab.
NamingStandards Allowsyoutoapplydifferentnamingstandardstodifferentobjectswhenportionsofamodelrequiredifferent versionsof a standard.For example, someobjects already exist in thedatabase andyoumaynotwanttoapplyanewernamingstandardtothem.TheFreezeNamesoption,whenselected,prevents any naming standards applied to the model from changing the name of the attributeselected.We’lltalkmoreaboutthistabinChapter14,NamingStandards.
CompareOptions Selectwhich, ifany,properties(e.g.,datatype,domain,nullability)of theattribute to ignorewhencomparingthisattributetoanotherusingtheCompareandMergeUtility,whichwillbediscussedinChapter15.
DataLineage Maptherulesfromsourcetotargetattributesinthemodel.We’llcoverthistabinChapter12,Data
Lineage.
SecurityInformation Youcanassignsecuritysettings thataredefined in theDataDictionary to thisattribute.TheDataDictionarywillbediscussedinChapter11.
tabs.
AttachmentBindings Bind an external piece of information, such as a Microsoft Word document or PDF file, to theattribute.Veryusefulforrequirementsdocuments,userstories,etc.Attachmentsarecreated in theAttachmentsfolderoftheDataDictionaryandmustbeaddedtothemodelbeforetheywilldisplayonthistab.
DataMovementRules We can assign a data movement rule to this attribute and it will be carried through to the datadefinition language to build the database.We can enter a datamovement rule here or use a datamovementruleasdefinedonthelineagetab,whichwillbediscussedinChapter12.
Menu Toolbar Explorer ShortcutKey
ShortcutMenu
Edit>EditEntity… n/a Right-clickonentity,EditEntity…
<ALT+E>,then<E>
Or
Double-clickontheentity
Right-clickonentity,EditEntity
EditingAttributes
Highlight the entity where you would like to edit attributes and use one of thesetechniques:
Any of these approaches brings up theEntityEditor screen.Make sure you are on theAttributestabandhighlighttheattributeyouwouldliketoeditandclick<Edit>.
MovingAttributes
Clickon theattribute selection tool on theDiagramToolbar and thenclickon anddraganattributetomoveittoanotherlocationwithinthatentityortoanotherentity.You
canalsomoveattributesupordownbyusingthe and buttonsintheEntityEditorontheAttributestab.
TheDiagramandObjectDisplayOptionsscreen(invokedeitherthroughView>DiagramAndObjectDisplayOptionsor ontheDiagramtoolbar)containstheLogicalAttributeOrderradiobutton.Whenselected,theprimarykeyoftheentitydisplaysatthetop.Theotherattributesdisplay in theorderdesignated in theEntityEditorof thecorrespondingentity.
DefiningAttributes
IntheEntityEditorontheAttributestab,thereareasetofsmallertabsonthebottomof
thescreen.Clickontheblackrightarrow tonavigateovertotheDefinitiontab.Youcanwriteyourdefinitionhere.
ThemacroDefinitionEditor allows for easily enteringdefinitions formultipleobjects.MoreonmacrosinChapter16.
ChangingtheAppearanceofAttributes
Menu Toolbar Explorer ShortcutKey
ShortcutMenu
Format>EntityColorandFontSettings n/a Right-clickonentity,EntityColorandFontSettings
<ALT+O>,click
onEntityColorandFontSettings
Right-clickonentity,EntityColorandFontSettings
Menu Toolbar Explorer ShortcutKey
ShortcutMenu
Format>Colors&Fonts Diagramtoolbar: n/a <ALT+O>,then<C>
Right-clickonwhitespace,Colors&Fonts
Menu Toolbar Explorer ShortcutKey
ShortcutMenu
Tools>Options n/a n/a <ALT+T>,then<P>
n/a
Using certain colors and fonts can help call attention to attributes.Highlight the entitywhereyouwouldliketochangetheappearanceofoneormoreattributesanduseoneofthesecommands:
After applying one of the commands above, chooseEntity/AttributesColors andFonts.From theCategory section of this screen, you can choose types of attributes, such asprimarykeys,andthenclick<SetColor>and<SetFont>.Click<OK>toexitthescreen.
Thereisaveryquickwaytochangethecolorofallattributesatonce:
Clickonthetypeofattribute(e.g.Key,Attribute,Trigger)intheEntitybox,orchoosetheappropriatetypeofattributefromthedrop-downandclick<SetColor>toselectthecoloryouwouldlike.Click<OK>toexitthisscreenandapplyyourchanges.
Youcandisplayvariouspropertiesoftheattributes(suchasdomainandnullability)underOptions:
ThenselecttheDisplaytab.
TheDisplayMode:drop-downallowsyoutoselectwhatshouldbedisplayedwithintheentityboxes.Theoptionsforattributesare:
Attribute(ModelOrder).Displaystheentitiesandalltheirattributesinthedefaultorderaccordingtothemodeltype.Inthelogicaldatamodel,forexample,theattributesappearastheynormallywouldinalogicaldatamodel,primarykeysfirst.Attribute(LogicalOrder).DisplaystheentitiesandalltheirattributesinLogicalOrderregardlessofwhetheryouareviewingthelogicalorphysicaldatamodel.
Menu Toolbar Explorer ShortcutKey
ShortcutMenu
Edit>Copy,thenEdit>Paste Diagramtoolbar:
(copy),then
(paste)
DragattributestothedesiredentityintheDataModelWindow
<CTRL+C>then<CTRL+V>
or
<ALT+E>,then<C>forcopy,<ALT+E>,then<P>forpaste
n/a
BecomeanER/StudioHotshot:
Aneasywaytocopyattributesistoclickon
theattributeselectiontool ontheDiagramToolbarandthenhighlighttheattributeyouwouldliketocopyfromthesourceentity.Pressthe<CTRL>keywhileclickinganddraggingtheattributetothetargetentity.Releasethemousebuttonandyouwillseethattheattributewascopied.Ifyouwouldliketocopymorethanoneattribute,youcanhighlightmultipleattributesonthesourceentitybykeepingthe<CTRL>keypressedwhileyouclickonattributes,ortocopyseveralattributesinarow,youcanhighlightthefirstattributeandthenholddownthe<SHIFT>keywhilepressingthelastattribute.Thiswillhighlightseveralattributesatonce.
YoucanalsocutandpastebyusingtheiconontheDiagramtoolbar.
WhentheattributesareinLogicalOrder,ER/Studiosequencestheattributessothattheprimarykeysarealwaysontop.
Attribute(PhysicalOrder).DisplaystheentitiesandalltheirattributesinPhysicalOrderregardlessofwhetheryouareviewingthelogicalorphysicaldatamodel.WhentheattributesareinPhysicalOrder,ER/Studiosequencestheattributestoreflecttheirorderinthephysicaldatamodelwithoutregardtowhethertheprimarykeysareontopornot.
CopyingAttributes
Highlight theattributeyouwould like tocopyusing theattributeselection tool andthenchooseoneofthesecommands:
Acopyof theattribute iscreatedwith thesamenameas theoriginal if theattributehasbeen copied to a different entity. If the attribute has been copied to the same entity, anumbersuffixwillbeadded(suchasTitle_Name_1ifTitle_Nameiscopiedtothesameentity)topreventduplicateattributenamesfromoccurringinthesameentity.
FindingAttributes
Menu Toolbar Explorer ShortcutKey
ShortcutMenu
Tools>UniversalNamingUtility Applicationtoolbar:
n/a <CTRL+F> n/a
Menu Toolbar Explorer ShortcutKey
ShortcutMenu
Edit>DeleteAttribute Diagramtoolbar: Right-clickonattribute,DeleteAttribute
<DELETE>
or
<ALT+E>,then<D>
n/a
BecomeanER/StudioHotshot:
Youcanalsodouble-clicktheparententityortableintheDataModelWindowtobringuptheentityortableeditor.Intheeditor,youcanselecttheattributetodeleteandthenclick<Delete>.Alloftheseoptionstodeleteanattributewilldisplayafinalwarningmessage(“Areyousureyouwanttodelete?”),withtheexceptionofusingthecuticonontheDiagramtoolbar,whichwilldeletetheattributewithoutafinalwarning.
Createinthisentity… Theseattributes
Offering OfferingID
OfferingName
OfferingPriceAmount
RecallourdiscussiononfindingentitiesinChapter4usingtheUniversalNamingUtility.Using the Universal Naming Utility, you can globally search and replace, if desired,names, strings, and attachment value overrides for bound attachments.You define yoursearchandthenconfinethesearchtospecificattributeswithinyourmodels.
DeletingAttributes
Highlighttheattributeorattributesyouwouldliketodeleteanduseoneofthefollowingoptions:
EXERCISE6.1:CreatingAttributes
In the previous chapter we assigned entities to submodels. For this exercise, add thefollowingattributestoeachoftheseentitiesasshowninTable6.1.
Title ISBN
SubtitleName
ElectronicTitle TitleInstantDownloadIndicator
PrintTitle TitlePageCount
Category CategoryCode
CategoryName
Conference ConferenceHotelName
ConferenceStartDate
ConferenceEndDate
Seminar SeminarStartDate
SeminarEndDate
Speaker SpeakerTaxID
SpeakerFirstName
SpeakerLastName
Table6.1AssignmentofEntitiestoSubmodels
Asanaside,onyourdatamodelsyoumaynoticebitmapsnexttoeachattributetotheleftofeachnamesuchasadiamondsymbol.YoucanturnthesebitmapsonandoffthroughDiagram and Object Display Options. Choose View > Diagram And Object DisplayOptions(orclickontheicon )andclickonoroffAttributeBitmapsontheEntitytab.
KeyExplanationThere is a lot of data out there, but how do you sift through it all to findwhat you’relookingfor?That’swherekeyscomein.Akeyisoneormoreattributeswhosepurposesinclude enforcing rules, efficiently retrieving data, and allowing navigation from oneentity to another. This section defines candidate, primary, and alternate keys. Surrogatekeys, foreign keys, and their importance are also explained. You will be creating andeditingeachtypeinER/Studio.
CandidateKey
A candidate key is one ormore attributes that uniquely identify an entity instance.AnISBN (International Standard Book Number) is assigned to every title. The ISBNuniquelyidentifieseachtitleandisthereforethetitle’scandidatekey.WhentheISBNforthistitle,9781634620925,isenteredintomanysearchenginesanddatabasesystems,thebookentity instanceDataModelingMadeSimpleWithEmbarcaderoER/Studiowill bereturned (try it!).TaxID can be a candidate key for an organization in some countriessuchastheUnitedStates.AccountCodecanbeacandidatekeyforanaccount.AVIN(VehicleIdentificationNumber)identifiesavehicle.
StudentNumber StudentFirstName StudentLastName StudentBirthDate
Sometimes a single attribute identifies an entity instance such as ISBN for a title.Sometimes it takesmore than one attribute to uniquely identify an entity instance. Forexample,bothaPromotionTypeCodeandPromotionStartDatemaybenecessarytoidentify a promotion.Whenmore than one attribute makes up a key, we use the termcompositekey.Therefore,PromotionTypeCodeandPromotionStartDatetogetherareacompositecandidatekeyforapromotion.
Acandidatekeyhasfourmaincharacteristics:
Unique.Acandidatekeyvaluemustnotidentifymorethanoneentityinstance(oronereal-worldthing).Mandatory.Acandidatekeymaynotbeempty(alsoknownasnullable).Eachentityinstancemustbeidentifiedbyexactlyonecandidatekeyvalue.Therefore,thenumberofdistinctvaluesofacandidatekeyisalwaysequaltothenumberofdistinctentityinstances.IftheentityTitlehasISBNasitscandidatekey,andifthereare500titleinstances,therewillalsobe500uniqueISBNs.Non-volatile.Acandidatekeyvalueonanentityinstanceshouldneverchange.Minimal.Acandidatekeyshouldcontainonlythoseattributesthatareneededtouniquelyidentifyanentityinstance.Iffourattributesarelistedasthecompositecandidatekeyforanentity,butonlythreearereallyneededforuniqueness,thenonlythosethreeshouldmakeupthecandidatekey.
Figure6.3containsadatamodelbeforecandidatekeyshavebeenidentified.
EachStudentmayattendoneormanyClasses.
EachClassmaycontainoneormanyStudents.Figure6.3Datamodelbeforecandidatekeyshavebeenidentified
Note that we have a many-to-many relationship between Student andClass that wasreplacedbytheentityAttendanceandtwoone-to-manyrelationships(moreonthisinournormalizationsection).Inreadingamany-to-manyrelationship,Ihavefoundithelpfultoignore the entity in the middle (Attendance, in this example) and just read the labelsbetween theentitiesoneitherside.Forexample,eachStudentmayattendoneormanyClasses andeachClassmay contain one ormanyStudents.Table 6.2 contains samplevaluesforeachoftheseentities.
Student
SM385932 Steve Martin 1/25/1958
EM584926 Eddie Murphy 3/15/1971
HW742615 Henry Winkler 2/14/1984
MM481526 Mickey Mouse 5/10/1982
DD857111 Donald Duck 5/10/1982
MM573483 Minnie Mouse 4/1/1986
LR731511 Lone Ranger 10/21/1949
EM876253 Eddie Murphy 7/1/1992
AttendanceDate
5/10/2015
6/10/2015
7/10/2015
ClassFullName ClassShortName ClassDescriptionText
DataModelingFundamentals DataModeling101 Anintroductoryclasscoveringbasicdatamodelingconceptsandprinciples.
AdvancedDataModeling DataModeling301 Afast-pacedclasscoveringtechniquessuchasadvancednormalizationandraggedhierarchies.
TennisBasics TennisOne Forthosenewtothegameoftennis,learnthekeyaspectsofthegame.
Juggling Learnhowtokeepthreeballsintheairatonce!
Attendance
Class
Table6.2SamplevaluesforFigure6.3
Basedonourdefinitionofacandidatekeyandacandidatekey’scharacteristicsofbeingunique,non-volatile,andminimal,whatwouldyouchooseasthecandidatekeysforeachoftheseentities?
For Student, Student Number appears to be a valid candidate key. There are eightstudentsandeightdistinctvalues forStudentNumber.SounlikeStudentFirstNameand Student Last Name, which can contain duplicates like Eddie Murphy, StudentNumber appears tobeunique.StudentBirthDatecan also contain duplicates such as5/10/1982,which is theStudentBirthDate forbothMickeyMouseandDonaldDuck.However, the combination ofStudent FirstName,StudentLastName, and StudentBirthDatemaymakeavalidcompositecandidatekey.
ForAttendance, we are currently missing a candidate key. Although theAttendanceDateisuniqueinoursampledata,wewillprobablyneedtoknowwhichstudentattendedwhichclassonthisparticulardate.
ForClass, on first glance it appears that any of its attributes are unique, and wouldtherefore qualify as a candidate key. However, Juggling does not have aClass ShortName. Therefore, becauseClass Short Name can be empty, we cannot consider it acandidatekey. Inaddition,oneof thecharacteristicsofacandidatekey is that it isnon-volatile. I know, based on my teaching experience, that class descriptions can change.Therefore,ClassDescriptionTextalsoneedstoberuledoutasacandidatekey,leavingClassFullNameasthebestoptionforacandidatekey.
PrimaryandAlternateKeys
Eventhoughanentitymaycontainmorethanonecandidatekey,wecanonlyselectonecandidatekeytobetheprimarykeyforanentity.Aprimarykeyisthecandidatekeythathasbeenchosentobetheuniqueidentifierforanentity.Analternatekeyisacandidatekeythat,althoughunique,wasnotchosenastheprimarykeybutstillcanbeusedtofindspecificentityinstances.
Wehaveonlyone candidate key in theClass entity, soClassFullName becomes ourprimary key. We have to make a choice in Student, however, because we have twocandidatekeys.WhichStudentcandidatekeywouldyouchooseastheprimarykey?
Inselectingonecandidatekeyoveranotherastheprimarykey,considersuccinctnessandprivacy.Succinctnessmeansif thereareseveralcandidatekeys,choosetheonewiththefewest attributes or shortest length. In terms of privacy, it is possible that one ormoreattributes within a candidate key will contain sensitive data whose viewing should berestricted.Wewanttoavoidhavingsensitivedatainourentity’sprimarykeybecausetheprimary key can propagate as a foreign key and therefore spread this sensitive datathroughoutourdatabase.
Consideringsuccinctnessandprivacyinourexample,IwouldchooseStudentNumberoverthecompositeStudentFirstName,StudentLastName,andStudentBirthDate.It is more succinct and contains less sensitive data. Figure 6.4 shows our data modelupdatedwithprimaryandalternatekeys.
Figure6.4Datamodelupdatedwithprimaryandalternatekeys
InER/Studio,primarykeyattributesareshownabovethelineintherectangles.Youwillnoticetwonumbersfollowingthekeyabbreviationssuchas“AK.”Thefirstnumberisthegrouping number for an alternate key, and the second number is the ordering of theattributewithin the alternate key. So there are three attributes required for theStudentalternatekey:StudentFirstName,StudentLastName,andStudentBirthDate.Thisisalso the order inwhich the alternate key indexwill be created, becauseStudent FirstName hasa “1”after thecolon,StudentLastName a “2,”andStudentBirthDate a“3.”
Attendancenowhas as its primarykeyStudentNumber andClassFullName,whichappeartomakeavalidprimarykey.
Sotosummarize,acandidatekeyconsistsofoneormoreattributesthatuniquelyidentifyanentityinstance.Thecandidatekeythatisdeterminedtobethebestwaytoidentifyeachunique record in the entity becomes the primarykey.Theother candidate keys becomealternatekeys.Keyscontainingmorethanoneattributeareknownascompositekeys.
In the next chapter, on relationships, we will distinguish independent and dependententities. In this student data model, we see examples of these two types of entities.Independententitiesarerectanglesthathaveintheirprimarykeyonlyattributesthattheyown(suchasStudentandClassinthisexample),anddependententitiesarebub-tangles(rectangleswithroundedcorners)thathaveintheirprimarykeyatleastoneprimarykeyfromanotherentity.InthecaseofAttendance,theonlywaywecanidentifyAttendanceDateisbyknowingwhichStudenthasattendedaparticularClass.
SurrogateKey
A surrogate key is a unique identifier for a table, often a counter and always system-generatedwithoutintelligence,meaningasurrogatekeycontainsvalueswhosemeaningsare unrelated to the entities they identify. (In other words, you can’t look at a monthidentifierof1andassumethatitrepresentstheMonthentityinstancevalueofJanuary.)Surrogate keys shouldnot bevisible to thebusiness.They remainbehind the scenes tohelp maintain uniqueness, allow for more efficient navigation across structures, andfacilitateintegrationacrossapplications.
Surrogatekeysarealsoefficient.You’veseenthataprimarykeymaybecomposedofoneormoreattributesoftheentity.Asinglesurrogatekeyismoreefficienttousethanhavingtospecifythreeorfour(orfiveorsix)attributestolocatethesinglerecordyou’relookingfor. Surrogate keys are useful for integration, which is an effort to create a single,consistentversionofthedata.Applicationssuchasdatawarehousesoftenhousedatafrom
ClassID ClassFullName ClassShortName ClassDescriptionText
1 DataModelingFundamentals
DataModeling101 Anintroductoryclasscoveringbasicdatamodelingconceptsandprinciples.
2 AdvancedDataModeling DataModeling301 Afast-pacedclasscoveringtechniquessuchasadvancednormalizationandraggedhierarchies.
3 TennisBasics TennisOne Forthosenewtothegameoftennis,learnthekeyaspectsofthegame.
4 Juggling Learnhowtokeepthreeballsintheairatonce!
more than one application or system. Surrogate keys enable us to bring togetherinformation about the same entity instance that is identified differently in each sourcesystem.
Whenusingasurrogatekey,alwaysmakeanefforttodeterminethenaturalkey,whichiswhatthebusinesswouldconsidertobethewaytouniquelyidentifytheentity,andthendefine an alternate keyon this natural key.For example, assuming a surrogate key is amoreefficientprimarykeythanClassFullName,wecancreatethesurrogatekeyClassID forClass and define an alternate key onClassFullName as shown in Figure 6.5.Table6.3containsthevaluesinClass.
Figure6.5DatamodelupdatedwithsurrogatekeyonClass
Table6.3Classvaluesupdatedwithasurrogatekey
ForeignKey
Aforeignkeyisoneormoreattributesthatprovidealinktoanotherentity.Aforeignkeyallows a database management system to navigate from one structure to another. Forexample, if we need to know the customer who owns an account, we would want toinclude theCustomer ID in theAccount entity. TheCustomer ID inAccount is theprimarykeyforCustomer.UsingthisforeignkeybacktoCustomerenablesthedatabasemanagementsystemtonavigatefromaparticularaccountoraccountstothecustomerorcustomers thatowneachaccount.Likewise, thedatabasecannavigate fromaparticularcustomerorcustomerstofindalloftheiraccounts.Aforeignkeyisautomaticallycreatedwhenwedefinearelationshipbetweentwoentities(relationshipswillbecovered in thenextchapter).
InFigure6.5, thereare two foreignkeys inAttendance.TheStudentNumber foreignkeypointsback to aparticular student in theStudent entity.TheClassID foreign key
StudentNumber ClassID AttendanceDate
SM385932 1 5/10/2015
EM584926 1 5/10/2015
EM584926 2 6/10/2015
MM481526 2 6/10/2015
MM573483 2 6/10/2015
LR731511 3 7/10/2015
pointsbacktoaparticularClassintheClassentity.Table6.4containsafewAttendanceentityinstances.
Table6.4Attendanceentityinstances
BylookingatthesevaluesandrecallingthesamplevaluesfromTable6.4,welearnthatSteveMartinandEddieMurphybothattendedtheDataModelingFundamentalsclasson5/10/2015.EddieMurphyalsoattendedtheAdvancedDataModelingClasswithMickeyandMinnieMouseon6/10/2015.LoneRangertookTennisBasics (byhimself,asusual)on7/10/2015.
InversionEntry
Sometimes there isaneed to retrievedata rapidlyfromastructure toanswerabusinessqueryormeetacertain response time.An inversionentry (IE for short) is akeywhichallowsquickaccesstothosecolumnsinthekey.AnIEisalsoknownasasecondarykeyornon-uniqueindex.Forexample,inFigure6.5weaddedanIEtoStudentLastNameinStudenttoallowforquickretrievalwheneveranyqueriesrequireStudentLastName.
EXERCISE6.2:ClarifyingCustomerIDDuringarecenttrainingclass,IwasshowingexamplesofbothcompleteandincompletedefinitionsandsharedthefollowingincompletedefinitionforCustomerID:ACustomerIDistheuniqueidentifierforaCustomer.
“WhatelsecanyousayaboutCustomerIDanyway?”aparticipantasked.
WhatelsecanyousayaboutCustomerID(oranyidentifier)toaddmoremeaningtoitsdefinition?SeeAppendixBformyanswers.
KeysinER/StudioInthissectionwewillpracticecreatingandmodifyingkeysforourpublishingdatamodel.
CreatingaKey
Menu Toolbar Explorer ShortcutKey
ShortcutMenu
Edit>EditEntity… n/a Right-clickonentity,EditEntity…
<ALT+E>,then<E>
Or
Double-clickontheentity
Right-clickonentity,EditEntity
BecomeanER/StudioHotshot:
Therearetwoquickshortcutsforcreatingprimarykeys. In the Attributes tab there is an Add toPrimary Key? checkbox. You can also use the
attribute selection tool to click and dragattributesinto(andoutof)theprimarykeyspace.
Highlighttheentitywhereyouwouldliketocreateakeyanduseoneofthesecommands:
Any of these approaches brings up theEntityEditor screen.Make sure you are on theKeys tab.Keysaredefinedonlyonexistingattributes,somakesurethereisatleastoneattributeintheentityweareediting.Click<Add>tocreateanewkey.Ifcreatingalternatekeysorinversionentries,usetheradiobuttonstodecidewhichtypeofkeyitis,giveitaname,and thenselect thoseattributes thatshouldbepartof thekeyasshown inFigure6.6.
Figure6.6KeyEditorscreen
Tab Here’swhatyouneedtoknow:
CompareOptions Selectwhich, ifany,properties(e.g.,name, indexoptions,attachments)of thekeyto ignorewhencomparing this key to another using theCompare andMergeUtility, whichwill be discussed inChapter15.
AttachmentBindings Bindanexternalpieceofinformation,suchasaMicrosoftWorddocumentorPDFfile,tothekey.Very useful for requirements documents, user stories, etc. Attachments are created in theAttachmentsfolderoftheDataDictionary(discussedinChapter11)andmustbeaddedtothemodelbeforetheywilldisplayonthistab.
Menu Toolbar Explorer ShortcutKey
ShortcutMenu
Edit>EditEntity… n/a Right-clickonentity,EditEntity…
<ALT+E>,then<E>
Or
Double-clickontheentity
Right-clickonentity,EditEntity
Menu Toolbar Explorer ShortcutKey
ShortcutMenu
Tools>Options n/a n/a <ALT+T>,then<P>
n/a
TheKey Type section on this screen allows you to select whether you are creating analternatekeyorinversionentryaswellasifyouwouldliketopreventakeyfrombeingimplementedwhengeneratingaphysicaldatamodelorSQL,donebyselectingLogicalOnly. Then highlight those attributes you would like to be part of the key and click<Add>. You can sequence the attributes using the <Up> and <Down> buttons; whenyou’redone,click<OK>.
Therearetwomoretabsonthisscreen:
EditingaKey
Highlighttheentitywhereyouwouldliketoeditthekeyanduseoneofthesecommands:
Anyof these approachesbringsup theEntityEditor screen.Highlight the attribute youwouldliketoeditontheKeystabandclick<Edit>.
EXERCISE6.3:CreatingKeysFirst,let’smakesurethekeyswecreatewillbedisplayed.OpenOptions:
Under theDisplay tab, select Attribute (Logical Order) from theDisplay Mode drop-
Createinthisentity… Thesekeys
Offering PrimarykeyonOfferingID
AlternatekeyonOfferingName
Title PrimarykeyonISBN
AlternatekeyonSubtitleName
ElectronicTitle InversionentryonTitleInstantDownloadIndicator
Category PrimarykeyonCategoryCode
AlternatekeyonCategoryName
Speaker PrimarykeyonSpeakerTaxID
AlternatekeyonboththeSpeakerFirstNameandSpeakerLastName
Conference AlternatekeyonConferenceHotelName
AlternatekeyonboththeConferenceStartDateandConferenceEndDate
Seminar AlternatekeyonboththeSeminarStartDateandSeminarEndDate
down.Thiswillpositionallprimarykeycolumnsbeforenon-keycolumns.SelectPhysicalOrder toposition thekeys tomimic theorder in thephysical datamodel,meaning thatprimarykeyscanappearbeforeorafternon-keycolumns.SelectLogicalOrdertopreventprimarykeysfrombeingreorderedintheEntityEditor.
Createthefollowingkeysforeachofourentities:
DomainExplanationThecompletesetofallpossiblevaluesthatanattributecanbeassignediscalledadomain.Adomainisasetofvalidationcriteria thatcanbeappliedtomore thanoneattribute; itprovides ameansof standardizing the characteristicsof the attributes.For example, thedomainDate, which contains all possible valid dates, can be assigned to any of theseattributes:
EmployeeHireDate
OrderEntryDate
ClaimSubmitDate
CourseStartDate
Anattributemustnevercontainvaluesoutsideofitsassigneddomain.Thedomainvaluesare defined by specifying the actual list of values or a set of rules.EmployeeGenderCode, for example,maybe limited to thedomainof female andmale.EmployeeHireDatemayinitiallybeassignedtherulethatitsdomaincontainonlyvaliddates.Therefore,thismayincludevaluessuchas:
February15th,2005
25January1910
20150410
March10th,2050
BecauseEmployeeHireDateislimitedtovaliddates,itdoesnotincludeFebruary30th.Wecanrestrictadomainwithadditionalrules.Forexample,byrestrictingtheEmployeeHireDate domain to dates earlier than today’s date, we would eliminateMarch 10th,2050.ByrestrictingEmployeeHireDatetoYYYYMMDD(thatis,year,month,anddayconcatenated),wewouldeliminatealltheexamplesgivenexceptfor20150410.AnotherwayofrefiningthissetofvaluesistorestrictthedomainofEmployeeHireDatetodatesthat fall on a Monday, Tuesday, Wednesday, Thursday, or Friday (that is, the typicalworkweek).
Therearethreebasicdomaintypes:
Format.Formatdomainsspecifythestandardtypesofdataonecanhaveinadatabase.Forexample,Integer,Character(30),andDateareallformatdomains.List.Listdomainsaresimilartoadrop-downlist.Theycontainafinitesetofvaluesfromwhichtochoose.Listdomainsarerefinementsofformatdomains.TheformatdomainforOrderStatusCodemightbeCharacter(10).Thisdomaincanbefurtherdefinedthroughalistdomainofpossiblevalues{Open,Shipped,Closed,Returned}.Range.Rangedomainsallowallvaluesthatarebetweenaminimumandmaximumvalue.Forexample,OrderDeliveryDatemustbebetweentoday’sdateandthreemonthsinthefuture.Aswithlistdomains,rangedomainsarearefinedversionofaformatdomain.
Domainsareveryusefulforanumberofreasons:
Improvesdataqualitybycheckingagainstadomainbeforeinsertingdata.Thisistheprimaryreasonforhavingadomain.Bylimitingthepossiblevaluesofanattribute,thechancesofbaddatagettingintothedatabasearereduced.Forexample,ifeveryattributethatrepresentsmoneyisassignedtheAmountdomain,consistingofalldecimalnumbersupto15digitsinlengthincludingtwodigitsafterthedecimalpoint,thenthereisagoodchancethateachoftheseattributesactuallydocontaincurrency.GrossSalesAmount,whichisassignedtheamountdomain,wouldnotallowthevalueR2D2tobeadded.
Thedatamodelcommunicatesevenmore.Whenwedisplaydomainsonadata
model,thedatamodelcommunicatesthataparticularattributehasthepropertiesofaparticulardomain,sothedatamodelbecomesamorecomprehensivecommunicationtool.Welearn,forexample,thatGrossSalesAmount,NetSalesValueAmount,andListPriceAmountallsharetheAmountdomainand,therefore,sharepropertiessuchthattheirvalidvaluesarelimitedtocurrency.Greaterefficiencyinbuildingnewmodelsandmaintainingexistingmodels.Whenadatamodelerembarksonaproject,shecanuseastandardsetofdomains,therebysavingtimebynotreinventingthewheel.AnynewattributethatendsinAmount,forexample,wouldbeassociatedwiththestandardAmountdomain,savinganalysisanddesigntime.
KeyPointsAnattributeisapropertyofimportancetothebusinesswhosevaluescontributetoidentifying,describing,ormeasuringinstancesofanentity.
Akeyisanattributeorsetofattributesthathelpsusfindentityinstances.
Acandidatekeyconsistsofoneormoreattributesthatuniquelyidentifyanentityinstance.Thecandidatekeythatisselectedasthebestwaytoidentifyeachuniquerecordintheentitybecomestheprimarykey.Theothercandidatekeysbecomealternatekeys.Keyscontainingmorethanoneattributeareknownascompositekeys.
Asurrogatekeyisaprimarykeywithnoembeddedintelligencethatisasubstituteforanaturalkey.ItisusedbyITtofacilitateintegrationandintroducedatabaseefficiencies.
Aforeignkeypointsfromoneentityinstancetoanother.
Adomainisasetofvalidationcriteriathatcanbeappliedtomorethanoneattribute.
Therearethreebasicdomaintypes:format,list,andrange.
CHAPTER7Relationships
RulesallaroundusRelationshipstellthetaleConnectingthedots
Thischapterdefines rulesandrelationships.Cardinalityand labelsareexplainedso thatyoucanreadanydatamodelaseasilyasreadingabook.Othertypesofrelationships,suchasrecursiverelationshipsandsubtyping,arealsodiscussed.LearnhowtocreateandeditallofthesedifferenttypesofrelationshipsinER/Studio.
RelationshipExplanationA relationship is displayed as a line connecting two entities that captures the rule ornavigation path between them. If the two entities areEmployee andDepartment, therelationshipcancapturetherules“EachEmployeemustworkforoneDepartment”and“EachDepartmentmaycontainoneormanyEmployees.”
RelationshipTypesReturning to our publishing data model, here are some rules that we can model asrelationships:
Eachauthormaywriteoneormanytitles.
Eachtitlemustbewrittenbyoneormanyauthors.
Eachtitlemustbelongtooneormanycategories.
Eachcategorymaycontainoneormanytitles.
Thethreelevelsofgranularity(conceptual,logical,andphysical)thatapplytoentitiesandattributesalsoapplytotherelationshipsthatconnectentities.Conceptualrelationshipsarehigh-level rules that connect key concepts. Logical relationships are detailed businessrulesthatenforcetherulesbetweenthelogicalentities.Physicalrelationshipsaredetailedtechnology-dependent rules between the physical structures (tables, views, or files) thattherelationshipconnects.
InRDBMS, these physical relationships eventually become database constraints,whichensurethatdataadherestotherules.A“constraint”isaphysicaltermforarelationship,similar to an entity becoming a table and an attribute becoming a column. In NoSQLdatabases, these physical relationships become transformed into how the underlyingtechnology views the relationship. For example, in MongoDB, a document-baseddatabase,theserelationshipscanbecomecontainmentrelationships.
CardinalityInarelationshipbetweentwoentities,cardinalitycaptureshowmanyinstancesfromoneentityparticipateintherelationshipwithinstancesoftheotherentity.Itisrepresentedbythesymbolsthatappearonbothendsofarelationshipline.It is throughcardinalitythatthedatarulesarespecifiedandenforced.Withoutcardinality,themostwecansayaboutarelationship is that twoentitiesareconnected insomewaythrougharule.Forexample,EmployeeandDepartmenthavesomekindofrelationship,butwedon’tknowmorethanthis.
Forcardinality,thechoicesaresimple:zero,one,ormany.Many(somepeoplereaditasmore) means any number greater than zero. Each side of a relationship can have anycombinationofzero,one,ormany.Specifyingzerooroneallowsustocapturewhetherornotanentity instance isrequired ina relationship.Specifyingoneormanyallowsus tocapturehowmanyofaparticularinstanceparticipatesinagivenrelationship.
Becausewehaveonlythreecardinalitysymbols,wecan’tspecifyanexactnumber(otherthanthroughdocumentation)asin“ACarcontainsfourTires.”Wecanonlysay,“ACarcontainsmanyTires.”
Eachof the cardinality symbols is illustrated inFigure7.1,whichcontainsAuthor andTitle.Thebusinessrulesare:
EachAuthormaywriteoneormanyTitles.
EachTitlemustbewrittenbyoneAuthor.
Figure7.1AuthorandTitle,take1
The small vertical linemeansone. (Looks like a 1, doesn’t it?) The circlemeans zero.(Lookslikeazerotoo!)Thezeroimpliesoptionalityanddoesnotexcludethevalueone,sointheaboveexampleanauthorcanwritejustonetitletoo.
The triangle with a line through the middle meansmany. Some people call themanysymbolacrow’sfoot.Relationship linesare frequently labeled toclarify therelationshipand express the rule that the relationship represents.A datamodel is a communicationtool,andifyouthinkoftheentitiesasnouns,therelationshiplabelisapresenttenseverb.Wearejustreadingasentence:
EachAuthormaywriteoneormanyTitles.
Havingazerointhecardinalitymakesususeoptional-soundingwordssuchasmayorcan
whenreadingtherelationship.Withoutthezero,weusemandatory-soundingtermssuchasmustorhaveto.Soinsteadofbeingredundantandsaying:
EachAuthormaywritezero,oneormanyTitles.
Wetakeoutthewordzerobecauseitisexpressedusingthewordmay,whichimpliesthezero:
EachAuthormaywriteoneormanyTitles.
Everyrelationshiphasaparentandachild.Theparententityappearsontheonesideoftherelationship,andthechildappearsonthemanysideoftherelationship.InFigure7.1,theparententityisAuthor,andthechildentityisTitle.WhenIreadarelationship,Istartwiththeentityontheonesideoftherelationship(theparententity)first.“EachAuthormaywrite one ormanyTitles.” It’s then followed by reading the relationship from themanyside:“EachTitlemustbewrittenbyoneAuthor.”
Ialsoalwaysusethewordeachinreadingarelationship,startingwiththeparentside.Thereasonforthewordeachisthatyouwanttospecify,onaverage,howmanyinstancesofoneentityrelatetoadifferententityinstance.
InFigure7.1wemodeledthataTitlemustbewrittenbyoneAuthor.Let’snowallowaTitletobewrittenbymorethanoneAuthor.SeeFigure7.2.
Figure7.2AuthorandTitle,take2
Thisisanexampleofamany-to-manyrelationship, incontrast tothepreviousexample,whichwasaone-to-manyrelationship.Thebusinessrulesherereadasfollows:
EachAuthormaywriteoneormanyTitles.
EachTitlemustbewrittenbyoneormanyAuthors.
WriteinFigure7.2isanexampleofarelationshiplabel.Makesurerelationshiplabelsareasdescriptiveaspossible.Herearesomeexamplesofgoodlabelnames:
contain
workfor
own
initiate
categorize
applyto
Always avoid the following words as label names as they provide no additionalinformation to the reader.You canuse thesewords in combinationwithotherwords tomakeameaningfullabelname;justavoidusingthesewordsbythemselves:
has
have
associate
participate
relate
be
Auseful techniqueforcheckingwhether relationshipnamesmakesense is to read themoutaloudtoacolleaguewho’snotdirectlyinvolvedincreatingthemodel.If theydon’tunderstandwhatyoumean,youmayneedtoreconsideryourchoiceofverb.Forexample,replacetherelationshipsentence:
EachPersonmustbeassociatedwithoneCompany.
with
EachPersonmustbeemployedbyoneCompany.
Fortunately, in ER/Studio, as you write the verb on the relationship label in theRelationship Editor, the sentence phrase is automatically written so you can check themeaningfulness of the label. ER/Studio uses thewordsA orAn instead ofEach at thebeginning of the sentence and also prefers plural verbs over singular verbs for therelationship label. For example, inER/Studio, “AnAuthorwrites one ormanyTitles”insteadof“EachAuthormaywriteoneormanyTitles.”Eitherapproachworksfine,justremember tobeconsistent throughout themodel.Manymodelerscapture labelsonbothsidesoftherelationshiplineinsteadofjustonesideasshowninthischapter.Inweighingsimplicityversusprecision,Ichosesimplicity.Theotherlabelcanoftenbeinferredfromthelabelthatappearsonthemodel.Forexample,ifwriteistheverbphrasefromAuthortoTitle,thenwrittenbyisassumedtobetheverbphrasefromTitletoAuthor.
Independentvs.DependentEntitiesLet’slookat thetwomodelsinFigure7.3.CustomerandAccount in thefirstexample(andCustomerinthesecondexample)arerectangles,yetAccountinthesecondexampleis a rectangle with rounded corners, called a bub-tangle. The rectangles with straight,right-anglecornersareindependent,andthosewithroundedcornersaredependent.
Figure7.3Independentanddependententities
An independent entity, such asCustomer in both examples andAccount in the firstexample,isanentitywhereeachoccurrence(instance)canbefoundusingonlyattributesthat it owns like aCustomer ID. A dependent entity, such asAccount in the secondexample,canonlybefoundbyusingatleastoneattributefromadifferententity,suchasCustomerIDfromCustomer.
Tomake the explanation of independent and dependent clearer, Figure 7.4 contains themodelsfromFigure7.3withexamplevaluesfortwoattributeswithinAccount,AccountNumber,andtheforeignkeybacktoCustomer,CustomerID.(Makingupactualvaluesisalwaysagoodwaytoexplainandvalidateadatamodel.)
Figure7.4Independentanddependententitieswithsamplevalues
On the model in Example 1, we see that Account Number is unique, and thereforeretrieving a specific Account requires only knowing the Account Number and notneeding to know anything from Customer, making Account an independent entity.However, in Example 2,AccountNumber 34 repeats three times, so the only way toknowtoreturnaspecificaccountistoknowwhothecustomeris.SothecombinationofCustomer ID and Account Number is required to distinguish a particular account,makingAccountinExample2adependententity.
Noticealso that the relationship line looksdifferentwhenconnecting toan independentversesdependent entity.Thedotted linemeansnon-identifying and the solid linemeansidentifying. Identifyingrelationshipsmeanthat theentityon themanyside(thechild) isalwaysgoingtobeadependententitytotheentityontheoneside(theparent).
Recursion
Arecursiverelationshipisarulethatexistsbetweeninstancesofthesameentity.Aone-
to-many recursive relationship describes a hierarchy, whereas a many-to-manyrelationshipdescribesanetwork.Inahierarchy,anentityinstancehasatmostoneparent.Inanetwork,anentityinstancecanhavemorethanoneparent.Let’sillustratebothtypesof recursive relationships usingEmployee. See Figure 7.5 for a one-to-many recursiveexampleandFigure7.6foramany-to-manyexample.
EachEmployeemaymanageoneormanyEmployees.
EachEmployeemaybemanagedbyoneEmployee.Figure7.5AnEmployeemayworkforoneManager
UsingsamplevaluessuchasBobandJillandsketchingahierarchyornetworkcanreallyhelpunderstand,andthereforevalidate,cardinality.InFigure7.5,forexample,wheretheone-to-manycapturesahierarchy,eachemployeemayworkforatmostonemanager.YetinFigure7.6,wherethemany-to-manycapturesanetwork,eachemployeemayworkforoneormanymanagerssuchasJaneworkingforBob,Ken,andSven.(IwoulddefinitelyupdatemyresumeifIwereJane.)
Figure7.6AnEmployeemayworkforoneormanyManagers
EachEmployeemaymanageoneormanyEmployees.
EachEmployeemaybemanagedbyoneormanyEmployees.
It is interesting to note that in both figures, there is optionality on both sides of therelationship. In these examples, it implies we can have an Employeewho has no boss
(suchasMary)andanEmployeewhoisnotamanager(suchasJane).
Datamodelershave a love-hate relationshipwith recursion.On theonehand, recursionmakesmodelingacomplexbusinessideaveryeasyandleadstoaveryflexiblemodelingstructure.WecanhaveanynumberoflevelsinanorganizationhierarchyinFigure7.5,forexample.Ontheotherhand,someconsiderusingrecursiontobetakingtheeasywayoutofadifficultmodelingsituation.Therearemanyrulesthatcanbeobscuredbyrecursion.For example, where is the Regional Management Level in Figure 7.6? It is hiddensomewhereintherecursiverelationship.Thoseinfavorofrecursionarguethatyoumaynotbeawareofall the rulesand that recursionprotectsyou fromhavingan incompletemodel. Recursion adds a level of flexibility that ensures any rules not previouslyconsideredarealsohandledbythemodel.It isthereforewisetoconsiderrecursiononacase-by-casebasis,weighingobscurityagainstflexibility.
ContainmentA containment relationship is used for nested objects within a supported database. Forinstance, if youhave reverse engineerednestedobjectswithinMongoDB, thesewill beaddedwithacontainmentrelationship to theobject theyarenestedwithin.ContainmentrelationshipswillappearasanoptiononlyonthephysicalmodelwhenthetargetdatabaseisonethatsupportsnestingsuchasMongoDB.Forexample,Figure7.7containsalogicaldatamodelforOrderandOrderLine.
Figure7.7OrderandOrderLineLDM
Assume this will be implemented inMongoDB. The physical data modeler decides todenormalizeOrderType andOrder Status intoOrder, but shewants to treatOrderLineasanarray.Anarray inMongoDB(alsoknownasanestedstructure) iswhen thechild(inthiscaseOrderLine)canappearanynumberoftimesintheparent(inthiscaseOrder).Forexample,hereisaMongoDBOrderdocumentwiththreeOrderLines (butitcouldalsoeasilybetenlinesor100lines):Order:
{orderNumber:“4839-02”,
orderShortDescription:“Professorreviewcopiesoftitles”,
orderScheduledDeliveryDate:ISODate(“2014-05-15”),
orderActualDeliveryDate:ISODate(“2014-05-17”),
orderWeight:8.5,
orderTotalAmount:19.85,
orderTypeCode:“02”,
orderTypeDescription:“UniversitiesSales”,
orderStatusCode:“D”,
orderStatusDescription:“Delivered”,
orderLine:
[{productID:“9781935504375”,
orderLineQuantity:1
},
{productID:“9781935504511”,
orderLineQuantity:3
},
{productID:“9781935504535”,
orderLineQuantity:2
}]}
WecanshowthisasanarrayinER/StudiousingacontainmentrelationshipasshowninFigure7.8.
Figure7.8OrderMongoDBcollection
OrderisthecollectionandOrderLineisthenestedobject.Collectionsaredisplayedasrectangles, and nested objects are displayed as rectangles with rounded corners. EachOrderLinemustbelongtooneOrder,andeachOrdermaycontainoneormanyOrderLines.
Subtyping
Subtypinggroupsthecommonattributesandrelationshipsofentitieswhileretainingwhatisspecialwithineachentity.Subtypingisanexcellentwayofcommunicatingthatcertainconcepts are very similar and for showing examples. For instance, the publishing datamodelinFigure7.9containsnosubtyping.
EachAuthormaywriteoneormanyElectronicTitles.
EachElectronicTitlemustbewrittenbyoneormanyAuthors.
EachAuthormaywriteoneormanyPrintTitles.
EachPrintTitlemustbewrittenbyoneormanyAuthors.
Figure7.9Publishingexamplebeforesubtyping
Rather than repeat the relationship toAuthor,we can introduce subtyping as shown inFigure 7.10. The subtyping relationship implies that all of the properties from thesupertype are inherited by the subtype.Therefore, there is an implied relationship fromAuthor to Electronic Title as well as from Author to Print Title. Not only doessubtyping reduce redundancy on a data model, but it makes it easier to communicatesimilarities acrosswhat otherwisewould appear to be distinct and separate concepts.Asubtype cluster can be either complete or incomplete. Complete means all possiblesubtype entities are included in the subtype cluster.An example of a complete subtypeclusterisoneinwhichPersonisthesupertypeandMaleandFemalearethesubtypes.Anexampleofan incompletesubtypecluster isone inwhichAccount is thesupertypeandCheckingAccount andSavingsAccount are subtypes. There could be other types ofaccountsaswell,suchasBrokerageAccount,makingthissubtypeincomplete.
EachAuthormaywriteoneormanyTitles.
EachTitlemustbewrittenbyoneormanyAuthors.
EachTitlemaybeeitheranElectronicTitleorPrintTitle.
EachElectronicTitleisaTitle.
InformationEngineering(IE) IntegrationDefinitionforInformationModeling
(IDEF1X)
EachPrintTitleisaTitle.
Figure7.10Publishingexampleaftersubtyping
A subtype cluster can be either exclusive or inclusive. Exclusive or non-overlappingmeansthateachsupertypecanbeonlyonesubtypeatatime.APersoniseitheraMaleorFemalebutnotboth.Inclusiveoroverlappingmeansthateachsupertypecanbemorethanone subtype at the same time. AnAccount can be both aChecking Account and aSavingsAccount.
EXERCISE7.1:ReadingaModelPracticereadingtherelationshipsinthismodel.SeeAppendixBforthesentencesyoucanreadfromthismodel.
DataModelingNotationsNowthatyouarecomfortablereadingrelationships,youcanreadrelationshipsinanydatamodeling notation. There are a number of different data modeling notations that arepopular, and in general, once you are comfortable with the concepts of zero, one, andmany, you just need to know the symbols used to show these in any data modelingnotation.ThetwomostpopulardatamodelingnotationsareInformationEngineering(IE)andIntegrationDefinitionforInformationModeling(IDEF1X).IEnotationisbeingusedthroughout this book. Figure 7.11 contrasts IE with IDEF1X notation using the priorexamplesfromFigure7.10.
Menu Toolbar Explorer ShortcutKey ShortcutMenu
Insert>RelationshipModelingtoolbar:
Right-clickonRelationships,NewRelationship…
<ALT+I>,then<R>
Right-clickonwhitespace,InsertRelationship
BecomeanER/StudioHotshot:
Areyoua“drop-downer”ora“clicker”?WhenyoucreatearelationshipinDataModelExplorer,youcanchoosewhichentitiestherelationshipshouldconnectviadrop-downs.Fortheotherfourtechniques,thecursorhaschangedintoarelationshipsymbol.Clickfirstontheparententityandthenthechildentity,andtherelationshiplineappears.Notethatthecursorwillstayintherelationshipsymbol,allowingyoutocreatemanyrelationshipseasily.Whenyouwanttoturnthisstickybuttonsfeatureoff,justright-click
Figure7.11ComparingIEwithIDEF1X
To change the data modeling notation, Choose View > Diagram And Object DisplayOptions, or click on the icon and then click the Relationship tab. In DisplayPreferencessection,choosethedesirednotationandthenclick<OK>.ER/StudiosupportstwodifferentvariationsofIE(Martin/FinkelsteinandCrowsFoot),andalsohasanotationwhere foreign keys are hidden. I am using the IE Crows Foot notation throughout thebook.
RelationshipsinER/StudioIn this sectionwewill practice creating andmodifying relationships for the publishingdatamodel.
CreatingRelationships
onanywhitespaceandthecursorreturnstoitsdefaultselectorsymbol.ER/Studiosupportssounddesignpracticesbyautomaticallypropagatingtheprimarykeyfromtheparenttothechildentityasaforeignkey.IntheRelationshipEditor,youhavetheoptionofpropagatingalternatekeysfromparenttochildentityaswell.Thestatusbaratthebottomofthescreenshowsthenumberofrelationshipsinthemodelorsubmodel.YoucanhideorshowthisstatusbarusingView>StatusBaror<ALT+V>,then<S>.
Symbol Name Example
Identifying
EachAuthormaywriteoneormanyTitles.
EachTitlemustbewrittenbyoneAuthor.
Non-identifying,mandatory
Practice creating relationships between Author and Title using each of these fivetechniques.Click<CTRL+Z>,whichisyourfaithfulundobutton,aftereachtechniqueexcept for the last technique so thatyouhave something similar to themodel inFigure7.12.
EachAuthormaywriteoneormanyTitles.
EachTitlemustbewrittenbyoneAuthor.
Figure7.12EachAuthormaywriteoneormanyTitles
There are five typesof relationships that canbe created, andwe’ll illustrate eachusingAuthorandTitle.SeeTable7.1.
EachAuthormaywriteoneormanyTitles.
EachTitlemustbewrittenbyoneAuthor.
Non-identifying,optional
EachAuthormaywriteoneormanyTitles.
EachTitlemaybewrittenbyoneAuthor.
One-to-one
EachAuthormaywriteoneTitle.
EachTitlemaybewrittenbyoneAuthor.
Non-specific(many-to-many)
EachAuthormaywriteoneormanyTitles.
EachTitlemustbewrittenbyoneormanyAuthors.
Table7.1Exampleofeachrelationshiptype
CreatingSubtypes
Menu Toolbar Explorer ShortcutKey
ShortcutMenu
Insert>SubtypeCluster>CompleteorIncomplete
Modelingtoolbar: n/a n/a Right-clickonwhitespace,Insert>SubtypeCluster>CompleteorIncomplete
BecomeanER/StudioHotshot:
Tocreateasubtyperelationship,makesureyouareonalogicaldatamodelassubtypestructuresdonotexistinaphysicaldatamodel.Clickanentitytodesignateitastheparent(supertype)andthenclickthechild(subtype).Youcanaddmultipleentitiestothesubtypeclusterbypressing<CTRL>whileclickingthedesiredentities.Thesubtypediscriminatorisanattributethatdistinguisheseachofthesubtypeentitiesfromoneanother.Forexample,GenderCodewouldbethesubtypediscriminatorinthegendersubtypecluster.Youcanaddanentitytoasubtypeclusterbychoosingtheidentifyingorsubtyperelationship,clickingthesubtypeclustersymbolnexttothesupertypeyouwanttoassociatetheentitywith,andthenclickingtheentityyouwanttoaddtothesubtypecluster.
CreatingRecursiveRelationships
Arecursiverelationshipiswhenanentityisrelatedtoitself.Forexample,let’ssaytherearerelationshipsbetweentitles,suchasthesecondeditionofaparticulartitlereplacesthefirstedition.WewouldthereforewanttocreatearelationshipfromtheTitleentitytotheTitleentity.WhenwedothisinER/Studio,theRecursiveRelationshipscreenappearsasshowninFigure7.13.
Figure7.13RecursiveRelationshipscreen
Usingthiseditoryoucanassignrolenamestoanyduplicatekeystodifferentiatethenativeandforeignkey.Recallfromanearlierdiscussionthatarolenameisanothernamegivento a foreign key. The rolename cannot be the same as an existing attribute or columnname.DuplicateRelationships
If there is already a relationship between two entities and we create an additionalrelationshipbetweenthesesametwoentities, theDuplicateRelationship screenappears.Whenwecreateda second relationship fromAuthor toTitle, the screen inFigure7.14appeared.
Figure7.14DuplicateRelationshipscreen
Usingthiseditoryoucanassignrolenamestoanyduplicateforeignkeys.DuplicateAttributes
Let’ssaywehavethemodelinFigure7.15andwanttocreatearelationshipfromAuthortoTitle.
Figure7.15AuthorTaxIdentifieralreadypresentinTitle
NoticethatTitlealreadycontainstheAuthorTaxIdentifier.Thiswouldbe theforeignkey from Author after we create our relationship. Therefore, when we draw therelationshipfromAuthor toTitle, theDuplicateAttributeEditor screenappearsas in
Menu Toolbar Explorer ShortcutKey
ShortcutMenu
Figure7.16.
Figure7.16DuplicateAttributeEditorscreen
Wehaveseveralchoicesonthisscreen:
ReplaceExistingAttributewithpropagatingAttribute.Ifselected,ER/Studioreplacestheattributeinthechildwiththepropagatedforeignkeyattribute.RolenamepropagatingAttribute.Ifselected,youcanrenametheforeignkeysothatthenativeattributeinthechildentitycanstillexistwithitsoriginalname.Afterpropagation,bothattributeswillexistinthechildentity.ChangeExistingAttributeNametoallowpropagatingAttributeName.Ifselected,youcanrenametheoriginalnativeattributeinthechildentitysothattheattributenamefromtheparententitycanbeusedfortheforeignkey.Afterpropagation,bothattributeswillexistinthechildentity.UnifyExistingAttributewithpropagatingAttribute.Ifselected,ER/Studiounifiesthepropagatingforeignkeywiththenativeattributeinthechildtable.Iftherelationshipislaterdeleted,ER/Studioleavesthenativechildattribute.
CreatingContainmentRelationships
Tocreateacontainmentrelationship,makesureyouare inaphysicaldatamodelwherethetargetdatabasesupportsnestedobjects(suchasMongoDB).
Insert>Containmentrelationship Modelingtoolbar: n/a n/a n/a
BecomeanER/StudioHotshot:
AcontainmentrelationshipcanonlybecreatedfromaCollectiontoaNestedObject.
EditingRelationships
TheRelationshipEditor screenwill allowyou to enter additional information about therelationship. If you created the relationship via Data Model Explorer, this screenautomaticallyappears. Ifyoucreated the relationshipusingoneof theother techniques,double-clickontherelationshiplinetobringuptheRelationshipEditor.SeeFigure7.17.
Thisscreencanberesizedbyclickinganddraggingthelowerrightcorner.Thisscreencanalsobecomemaximizedbyclickingthesquaresymbolintheupperrightcorner(totheleftofthe‘x’whichclosesthewindow),andthenreturnedbacktoitsoriginalsizebyclickingthetwosquaresymbolsintheupperrightcorner.
Notice the Relationship Editor contains parent and child entity and primary keyinformationfollowedbyaseriesoftabs.TheLogicalOnlycheckboxifcheckedwillnotcopythisrelationshiptothephysical—therelationshipwillonlyexistonthelogicaldatamodel.
Tab Here’swhatyouneedtoknow:
Properties Changethetypeofrelationship,includingexistenceandcardinality.
Phrases Writethebusinessreasonfortherelationship.Youcanaddverbphrasesonbothsidesoftherelationship.IreallylikethatER/Studiocreatessentencesbasedontheseverbphrases.Ifyouwriteaverbphrasethatdoesnotappearonthemodel,mostlikelyyouwillneedtoturnonthe
verbphrasethroughView>DiagramAndObjectDisplayOptions,orclickontheiconandthenclicktheRelationshiptab.ClickonVerbPhrasesandthenclick<OK>.
Name Ifyoufeel it isusefulyoucancreatebothbusinessandphysical (constraint)namesfor therelationship.
Trigger Settheactionstotakewhenaparentorchildinstanceisdeleted.
Definition Thisiswherethefulldefinitionfortherelationshipisstored.
Note Use this for anyother textoutside thedefinition suchasquestions to askbusiness experts,knownissues,oractionitems.HTMLtagsusedinNoteswillbeappliedasformattingintheHTMLreports.ThemacroNotesEditorallowsforeasilyenteringnotesformultipleobjects.
Figure7.17RelationshipEditor
Thereare9tabsonthisscreen:
MoreonmacrosinChapter16.
RoleName Renameaforeignkeyattribute.Thisisusefulwhenthesameforeignkeycouldappearmorethan once in the same entity and we need to therefore avoid duplicates. (For example,CountryofResidenceandCountryofCitizenship.)
CompareOptions Select which, if any, properties (e.g., cardinality, definition, notes) of the relationship toignorewhencomparingthisrelationshiptoanotherusingtheCompareandMergeUtilityasdiscussedinChapter15.
AttachmentBindings Bindanexternalpieceofinformation,suchasaMicrosoftWorddocumentorPDFfile,totherelationship. Very useful for requirements documents, user stories, etc. Attachments arecreatedintheAttachmentsfolderoftheDataDictionary(discussedinChapter11)andmustbeaddedtothemodelbeforetheywilldisplayonthistab.
Menu Toolbar Explorer ShortcutKey
ShortcutMenu
Whenyouaredonemakingyourchanges,click<OK>toexittheeditor.
MovingRelationships
Youcanclickanddragonarelationshiplinetomoveittoanewlocation.Youcanalsoclick anddragon the relationship label toposition it in adifferentplace.Asyoumoveyourcursorovertherelationshipline,youwillnoticethatthecursorshapechangesintoatwo-directionalarrowindicatingyoucanclickanddragtomovetherelationshipline.Asyou move your cursor over the relationship label, the cursor changes into a four-directionalarrowindicatingyoucanclickanddragtomovetherelationshiplabel.
Youcanalsomovearelationshipbyright-clickingontherelationshiplineandchoosingoneofthefollowingoptions:
LayoutRelationship.ChooseElbowedifyouwouldliketheoptiontohavetherelationshiplinegoaroundotherentitiesorrelationships,orchooseStraightifwouldliketherelationshiplinetobeasshortanddirectaspossible.StraightenRelationshipLine.Sometimestherelationshiplineisslightlymisaligned,andchoosingthisoptiontakesoutthejaggedness.Afterchoosingthisoption,itisalsoeasiertoclickanddragandhavetheresultinglinestillbestraight.ResetToDefaultDockingPosition.Redrawstherelationshiplinetowhatitlookedlikewhenitwasfirstcreated.RemoveAllBends.Thisoptiontakesoutallofthe90-degreerelationshiplinedirectionchanges,sometimesresultinginadiagonalline.
Youcanselectall therelationshiplinesinthedatamodelbypressing<CTRL+A>andthenapplyoneoftheseoptionsaswell.
ChangingtheAppearanceofRelationships
You can decide whether hovering on a relationship line brings up a description of therelationship:
View>CursorPopupHelpOptions>DisplayRelationshipHelp
n/a n/a n/a n/a
Menu Toolbar Explorer ShortcutKey ShortcutMenu
n/a n/a Right-clickonrelationship,RelationshipColor
n/a Right-clickonrelationship,RelationshipColor
Menu Toolbar Explorer ShortcutKey
ShortcutMenu
Format>Colors&Fonts Diagramtoolbar: n/a <ALT+O>,then<C>
Right-clickonwhitespace,Colors&Fonts
Youcanalsoapplyautolayouts.Whenyouusetheautolayouts,ER/Studioorganizesthedatamodel objects according to the specificationsof that particular layout.Each layouthasdifferentspecificationsforthewayrelationshipsbendandhowrelationshipsdockorintersectwithentitiesandattributes.Youcanmovethedockingpositionsofrelationshiplinesonparentorchildentities.
TherearetwokindsofbendsinER/Studio,NbendsandOrthogonalbends.NBendsarerelationshiplinesthatbendatanyangle,whileOrthogonalbendsonlybendata90-degreeangle. BothHierarchical andOrthogonal auto layouts use onlyOrthogonal relationshiplines.All other auto layouts use straight relationship lines.You can also create straightrelationshiplinesthatareverticalorhorizontal.
Youcanalsochange thecolorsof relationships.Usingcertaincolorsandfontscanhelphighlightportionsofthemodelanddistinguishsectionsofthemodelfromothersections:
Afterapplyingoneofthecommandsabove,youaregiventwooptions:
EditSettings.Choosethecoloryouwouldlikeforthehighlightedrelationshipandclick<OK>.Ifyouwouldliketochangethisrelationshipcoloreverywherethisrelationshipappears,clickApplytoallsubmodels.SetRelationship(s)toUseSubmodelDefaults.Thiswillresetthecolorsandfontstothesubmodeldefaults.
Thereisaveryquickwaytochangethecolorofalloftherelationshipsatonce:
Clickontherelationshipsymbol,orchooseRelationshipsfromthedrop-downandclick<SetColor>toselectthecoloryouwouldlike.Click<OK>toexitthisscreenandapplyyourchanges.
Tochangethestyleofrelationshiplinesinallnewdatamodels,openOptions:
Menu Toolbar Explorer ShortcutKey
ShortcutMenu
Tools>Options n/a n/a <ALT+T>,then<P>
n/a
Menu Toolbar Explorer ShortcutKey
ShortcutMenu
Insert>RelationshipNavigation Diagramtoolbar: n/a <ALT+I>,then<G>
n/a
Menu Toolbar Explorer ShortcutKey ShortcutMenu
Edit>DeleteRelationship n/a Right-clickonrelationship,DeleteRelationship
<DELETE>
or
<ALT+E>,then<D>
Right-clickonrelationship,Edit>DeleteRelationship
BecomeanER/StudioHotshot:
Toselectmultiplerelationships,pressandhold<CTRL>whileclickingtheentities,orclickanddragovertherelationships.Sometimesyouwilldeletearelationshipandreceiveamessageaskingwhetheryouwouldliketodeletetherelationshipfromtheentiredatamodelorjustthesubmodel.Ifyoudeletetherelationshipfromjustthesubmodel,thisrelationshipwillstillexistinthemodel.WecoveredsubmodelsinChapter5.
The Model Display area also contains other display options for relationships such asdisplayingcardinalityandverbphrases.
FindingRelationships
RelationshipNavigationhighlightsrelationships,makingiteasier toseewhichentitiesarelationshipconnectsaswellasprovidingamethodforyoutowalksomeonethroughthemodel.That is, the relationshipsbecomehighlightedoneata timeasyouright-clickonentities,soyoucandiscussarelationship.Whenfinished,right-clickagaintomoveontothenextrelationship.TobringupRelationshipNavigation,useoneoftheseoptions:
DeletingRelationships
Highlight the relationship (or relationships)youwould like todeleteanduseoneof thefollowingoptions:
Youcandeleteasubtypeifyounolongerwanttoincludeitinyourdatamodel.Youcanalsoaddorremoveentitiesfromasubtypeclusterinmuchthesamewayyouaddordeleterelationships between entities. Delete a subtype by selecting the subtype and thenchoosing Edit > Delete Subtype Cluster. Deleting a subtype cluster deletes allrelationshipsbetweentheparententity(supertype)andthechildentities(subtypes).
EXERCISE7.2:CreatingRelationshipsIn previous chapters, we created entities, submodels, attributes, and keys for ourpublishing example. Now let’s relate the entities to each other. Convert the followingbusinessassertionsintorelationshipsonourdatamodel(remembertoaddtheverbphraseandmakesureitappearsonthediagram):
EachOfferingcanbeaTitle,Conference,orSeminar.
EachTitleisanOffering.
EachConferenceisanOffering.
EachSeminarisanOffering.
EachAuthormaywriteoneormanyTitles.
EachTitlemustbewrittenbyoneormanyAuthors.
EachTitlecanbeanElectronicTitleoraPrintTitle.
EachElectronicTitleisaTitle.
EachPrintTitleisaTitle.
EachCategorymaycontainoneormanyOfferings.
EachOfferingmaybelongtooneormanyCategories.
EachSpeakermaypresentatoneormanyConferences.
EachConferencemustcontainoneormanySpeakers.
EachSpeakermayteachatoneormanySeminars.
EachSeminarmustcontainoneormanySpeakers.
KeyPointsAruleisvisuallycapturedonadatamodelbyalineconnectingtwoentities,calledarelationship.
Cardinalityisrepresentedbythesymbolsonbothendsofarelationshipthatdefinethenumberofinstancesofeachentitythatcanparticipateintherelationship.Thethreesimplechoicesarezero,one,ormany.
Labelsaretheverbsthatappearontherelationshiplines.Labelsshouldbeasdescriptiveaspossibletoretaindatamodelprecision.
Arecursive(reflexive)relationshipisarulethatexistsbetweeninstancesofthesameentity.
Subtypinggroupsthecommonattributesandrelationshipsofentitieswhileretainingwhatisspecialwithineachentity.Subtypingisanexcellentwayofcommunicatingthatcertainconceptsareverysimilarandforshowingexamples.
SECTIONIIIConceptual,Logical,andPhysicalDataModels
SectionIIIexploresthethreedifferentlevelsofmodels:conceptual,logical,andphysical.Aconceptualdatamodel (CDM) represents thebusinessneedwithinadefinedscope,alogical data model (LDM) the detailed business solution, and a physical data model(PDM) the detailed technical solution. Chapter 8 focuses on the CDM, Chapter 9 theLDM,andChapter10thePDM.
Inadditiontothesethreelevelsofdetail,therearealsotwodifferentmodelingmindsets:
Mindset
Relational Dimensional
Typesof
models
CDM Keyconceptsandtheirbusinessrules,suchasa“EachCustomermayplaceoneormanyOrders.”
Keyconceptsfocusedaroundoneormoremeasures,suchas“IwanttoseeGrossSalesAmountbyCustomer.”
LDM Allattributesrequiredforagivenapplicationorbusinessprocess,neatlyorganizedintoentitiesaccordingtostrictbusinessrulesandindependentoftechnologysuchas“EachCustomerIDvaluemustreturnatmostoneCustomerLastName.”
Allattributesrequiredforagivenreportingapplication,focusedonmeasuresandindependentoftechnologysuchas“IwanttoseeGrossSalesAmountbyCustomerandviewthecustomer’sfirstandlastname.”
PDM TheLDMmodifiedforaspecifictechnologysuchasdatabaseoraccesssoftware.Forexample,“Toimproveretrievalspeed,weneedanon-uniqueindexonCustomerLastName.”Or“Toimproveretrievalspeed,weneedtoembedthisMongoDBcollectionwithinthatMongoDBcollection.”
relationalanddimensional.Relationaldatamodelingistheprocessofcapturinghowthebusinessworksbypreciselyrepresentingbusinessrules,whiledimensionaldatamodelingis the process of capturing how the business is monitored by precisely representingnavigation.
Themajordifferencebetweenrelationalanddimensionaldatamodelsisinthemeaningoftherelationshiplines.Onarelationaldatamodelarelationshipcommunicatesabusinessrule,andondimensionaldatamodeltherelationshipcommunicatesanavigationpath.Ona relational datamodel, for example,we can represent the business rule “ACustomermust have at least one Account”. On a dimensional data model we can display themeasureGrossSalesAmountalongwithallofthenavigationpathsthatauserneedstoseeGrossSalesAmountatsuchasbyday,month,year,region,account,andcustomer.The dimensional data model is all about viewing measures at different levels ofgranularity.
Thefollowing tablesummarizes these three levelsofdetailand twomodelingmindsets,leadingtofivedifferenttypesofmodels:
Bytheendofthissectionyouwillbeabletocreaterelationalanddimensionalconceptual,logical,andphysicaldatamodelsinER/Studio.
CHAPTER8ConceptualDataModels
Relational Dimensional
ConceptualDataModel(CDM) “One-pager”onbusinessrules “One-pager”onnavigation
LogicalDataModel(LDM) Detailedbusinesssolutiononbusinessrules Detailedbusinesssolutiononnavigation
PhysicalDataModel(PDM) Detailedtechnicalsolution
NeedtheBigPicture?Nocommondefinitions?
BuildaCDM!The highlighted row in Table 8.1 shows the focus of this chapter: the conceptual datamodel(CDM).
Table8.1TheConceptualDataModelisthefocusofthischapter
ACDMshowsthekeyconceptsinaparticularareaandhowtheseconceptsinteractwitheachother.Thischapterdefinesaconcept,followedbyanexplanationoftheimportanceof the conceptual data model and concept definitions. Then both relational anddimensional CDMs will be discussed. Then we provide a summary of the five-stepapproachtobuildingaconceptualdatamodel.Weconcludethischapterwithadescriptionof the support providedbyER/Studio forCDMs and a couple of exercises to reinforcewhatyou’velearned.
ConceptualDataModelExplanationAconceptisakeyideathatisbothbasicandcriticaltoyouraudience.“Basic”meansthistermisprobablymentionedmany timesaday inconversationswith thepeoplewhoaretheaudienceforthemodel.“Critical”meansthebusinesswouldbeverydifferentornon-existentwithoutthisconcept.
Themajorityofconceptsareeasy to identifyand include ideas thatarecommonacrossindustries,suchasCustomer,Employee,andProduct.AnairlinemaycallaCustomeraPassenger, and a hospital may call aCustomer aPatient, but in general they are allpeoplewhoreceivegoodsorservices.Eachconceptwillbeshowninmuchmoredetailatthe logical and physical phases of design. For example, theCustomer concept mightencompass the logical entities Customer, Customer Association, CustomerDemographics,CustomerType,andsoon.
Manyconcepts,however,canbemorechallengingtoidentify,astheymaybeconceptstoyour audience but not to others in the same department, company, or industry. Forexample,Account wouldmost likely be a concept for a bank and for amanufacturingcompany.However, theaudience for thebankconceptualdatamodelmightalso requireCheckingAccountandSavingsAccounttobeontheirmodel,whereastheaudienceforthe manufacturing conceptual data model might, instead, require General LedgerAccountandAccountsReceivableAccounttobeonthemodel.
In our publishing data model, for example, an audience that needs to see the entirecompanyonaconceptualmayjust require theentityOrder,yet incommunicatingwiththesalesdepartment, theSalesConceptualDataModelwillhavemoredetails, showingnotonlyOrderbutalsoOrderLineandOrderAdjustment.
Conceptssuchas thosein theprecedingdiscussionarerepresentedonaconceptualdatamodel.Aconceptualdatamodelisaone-pagedatamodelthatcapturesthebusinessneedandprojectscope,designedforaparticularaudience.Limitingtheconceptualdatamodeltoonepageisimportantbecauseitforcesthemodelerandparticipantstoselectonlykeyconcepts.Wecanfit20conceptsononepagebutnot500concepts.Agoodruleofthumb,therefore, is toaskyourself if theaudiencefor thismodelwouldincludethisconceptasoneofthetop20conceptsintheirbusiness.Thiswillruleoutconceptsthatareattoolowalevelofdetail;theywillappearinthemoredetailedlogicaldatamodel.Ifyou’rehavingtrouble limiting the number of concepts, think about whether or not there are otherconceptsintowhichtheonesyou’rediscussingcouldbegrouped,suchasgroupingOrderLine intoOrder. These higher concepts are the ones you should be including in theconceptualdatamodel.
Theconceptualdatamodelincludesconcepts,theirdefinitions,andtherelationshipsthatshowhow these concepts interactwith each other.Unlike the logical and physical datamodels,aswewillsee,conceptualdatamodelsmaycontainmany-to-manyrelationships.AsampleconceptualdatamodelappearsinFigure8.1.
In this diagram, the displaypreferences inER/Studio havebeen changed to display theconcept definitions. To display definitions on themodel, chooseView >DiagramAndObjectDisplayOptions,orclickontheicon andthenchooseDefinitionasthedisplaylevel.
Note: The ER/Studio Business Architect application provides conceptual modelingcapabilitieswhichcanbeexportedintoDataArchitect.However,inthisexamplewearebuildingaconceptualmodelinDataArchitect.
Figure8.1HealthcareFacilityAppointmentConceptualDataModel
BusinessRules(listedintheorderwewouldtypicallywalksomeonethroughthemodel):
EachPersonmaybeaProvider,aPatient,orbothaProviderandaPatient.Notethatwhenthesubtypingsymboldoesnothavean‘X’initscenter(asshowninFigure8.1),itindicatesthatamemberofthesupertypecanplaymorethanonesubtyperole.Thisiscalledaninclusive(overlapping)subtype.Here,aparticularpersoncanbebothaproviderandapatient.
EachProviderisaPerson.
EachPatientisaPerson.
EachProvidermayofferoneormanyAppointments.
EachPatientmaymakeoneormanyAppointments.
EachSchedulemaybeconsultedtosetuponeormanyAppointments.
EachDepartmentmayaccommodateoneormanyAppointments.
EachAppointmentmustinvolveoneProvider,onePatient,oneDepartment,and
oneSchedule.
NoticeonthemodelinFigure8.1thatconceptssuchasProviderandPatientarelikelytobe considered concepts throughout the healthcare industry.There are also slightlymoredetailed concepts on this model, such as Schedule and Appointment, which areconsideredbasicandcriticalandarethereforeconceptsfortheparticularaudienceforthisconceptualdatamodel.Yetthesemoredetailedconceptsmaynotbeconsideredconceptswithinadifferentdepartment,suchasaccountingandmarketing,inthissamehealthcarecompany.
During the conceptual data modeling phase, documenting clearly and completely whateachconceptmeansiscritical.Alltoooften,wewaituntilitistoolateinthedevelopmentprocesstogetdefinitions.Waitingtoolongusuallyleadstonotwritingdefinitionsatallordoingarushjobbywritingquickdefinitionphrasesthathavelittleornousefulness.Ifthedefinitions behind the terms on a data model are nonexistent or poor, multipleinterpretationsoftheconceptbecomeastrongpossibility.Imagineabusinessruleonourmodel that states that an Employee must have at least one Benefits Package. If thedefinitionofEmployee is lacking,wemaywonder, for example,whether this businessruleincludesjobapplicantsandretiredemployees.
Byagreeingondefinitionsattheconceptuallevel,themoredetailedlogicalandphysicalanalysiswillgomoresmoothlyandtakeless time.Forexample,definitionscanaddressthequestion,“DoesCustomerincludepotentialcustomersoronlyexistingcustomers?”
When theconceptualdatamodel iscomplete,which includesconceptdefinitions, it isapowerfultoolthatcanprovideanumberofimportantbusinessbenefits:
Providesbroadunderstanding.Wecancaptureextremelycomplexandencompassingbusinessprocesses,applicationrequirements,andevenentireindustriesonasinglepieceofpaper.Thisenablespeoplewithdifferentbackgroundsandrolestounderstandandcommunicatewitheachotheronthesameconcepts,agreeingonordebatingissues.Definesscopeanddirection.Byvisuallyshowingconceptsandtheirbusinessrules,wecanmoreeasilyidentifyasubsetofthemodeltoanalyze.Forexample,wecanmodeltheentireLogisticsdepartmentandthenscopeoutofthisaparticularlogisticsapplicationthatwewouldliketobuild.Thebroadperspectiveofaconceptualdatamodelcanhelpusdeterminehowplannedandexistingapplicationswillcoexist.Itcanprovidedirectionandguidanceonwhatnewfunctionalitythebusinesswillneednext.Offersproactiveanalysis.Bydevelopingahigh-levelunderstandingoftheapplication,thereisastrongchancewewillbeabletoidentifyimportantissuesorconcerns,savingsubstantialtimeandmoneylateron.Examplesincludetermdefinitiondifferencesanddifferentinterpretationsofprojectscope.BuildsrapportbetweenITandthebusiness.AmajorityoforganizationshavesomeissuesofinternalcommunicationbetweenthebusinessandITdepartments.Buildingaconceptualdatamodeltogetherisagreatwaytoremoveorreducethesecommunicationbarriers.Ononeoccasion,akeybusinessuserandIsketchedouta
Customer Acustomerisapersonororganizationwhoobtainsourproductforresale.Apersonororganizationmusthave obtained at least one product from us to be considered a customer. That is, prospects are notcustomers.Also,onceacustomer,alwaysacustomer,soevencustomersthathavenotobtainedanythingin50yearsare still consideredcustomers.Thecustomer isdifferent than theconsumer,whopurchases theproductforconsumptionasopposedtoresale.
Account Anaccountisacontractualarrangementbywhichourbankholdsfundsonbehalfofacustomer.
AccountBalance Anaccountbalanceisafinancialrecordofhowmuchmoneyacustomerhaswithourbankattheendofagiventimeperiodsuchassomeone’scheckingaccountbalanceattheendofamonth.
ConsumerAffairsCDM,whichnotonlyincreasedmybusinessunderstanding,butalsoledtoastrongrelationshipwiththiskeyuser.
RelationalandDimensionalConceptualDataModelsRecall from this section’s introduction that relational data modeling is the process ofcapturing how the business works by precisely representing business rules, whiledimensionaldatamodelingis theprocessofcapturinghowthebusiness ismonitoredbyprecisely representing navigation. There are both relational and dimensional conceptualdatamodels.
RelationalCDMExample
Therelationalconceptualmodelincludesconcepts,theirdefinitions,andtherelationshipsthatcapturethebusinessrulesbindingtheseconcepts.Unlikethelogicalandphysicaldatamodels,aswewillsee,conceptualmodelsmaycontainmany-to-manyrelationships.Forexample,Figure8.2containspartofafinancialrelationalCDM.
Figure8.2FinancialrelationalCDMsubset
Followingisafulllistoftheconceptdefinitionswearrivedatfromourmeetingswiththeprojectsponsor:
AccountBalance Anaccountbalanceisafinancialrecordofhowmuchmoneyacustomerhaswithourbankattheendofagiventimeperiodsuchassomeone’scheckingaccountbalanceattheendofamonth.
Country Acountryisarecognizednationwithitsowngovernment,occupyingaparticularterritory,whichisincludedintheISOcountrycodelisting.
BusinessRules(listedintheorderwewouldtypicallywalksomeonethroughthemodel):
EachCustomermayownoneormanyAccounts.
EachAccountmustbeownedbyoneormanyCustomers.
EachAccountmaycontainoneormanyAccountBalances.
EachAccountBalancemustbelongtooneAccount.
Notice that in thisexampledefinitionswerenotdisplayeddirectlyon thediagramasonthemodelinFigure8.1.Ifindthatifthedatamodelissmallenough(andthedefinitionsareshortenough), itcanbeavaluablecommunication tool todisplay thedefinitionsonthe diagram. I also choose to display the definitions when I need to highlight poor orlackingdefinitionsordefinitionsthatIknowwillspurdebate.
DimensionalCDMExample
Tounderstandanddocumentourreportingrequirements,wecanalsobuildadimensionalCDMsuchastheexampleinFigure8.3.
Figure8.3FinancialdimensionalCDMusingthesamenotationastherelationalCDM
Inthiscase,we’dliketoseecertainmeasuresaroundaccountbalances(suchasAccountBalanceAmount)ataRegion,Account,andMonthlevelandthenhavetheabilitytonavigatetohigherlevels(e.g.,viewingAccountBalanceAmountataCountrylevel).WetakemeasuressuchasAccountBalanceAmountupanddownhierarchies.AhierarchyiswhenanentityinstanceisachildofatmostoneotherentityinstancesuchasthemonthJanuary2016belongingtoonlytheyear2016.
Conceptdefinitions:
Region Aregionisourbank’sowndefinitionofdividingacountryintosmallerpiecesforbranchassignmentorreportingpurposes.
Customer Acustomerisapersonororganizationwhoobtainsourproductforresale.Apersonororganizationmusthaveobtainedatleastoneproductfromustobeconsideredacustomer.Thatis,prospectsarenotcustomers.Also,onceacustomer,alwaysacustomer,soevencustomersthathavenotobtainedanythingin50yearsarestillconsideredcustomers.Thecustomerisdifferentthantheconsumer,whopurchasestheproductforconsumptionasopposedtoresale.
Account Anaccountisacontractualarrangementbywhichourbankholdsfundsonbehalfofacustomer.
Year Ayearisaperiodoftimecontaining365days,consistentwiththeGregoriancalendar.
Month Amonthiseachofthetwelvenamedperiodsintowhichayearisdivided.
ThemodelinFigure8.3wascreatedusingthesamesymbolsweusedfortherelational,whichiscalledInformationEngineering(IE)notation.ER/StudiocontainsaseparatesetofsymbolswecanusetobuildthedimensionalmodelasshowninFigure8.4.
Figure8.4FinancialdimensionalCDMusingdimensionalnotation
TherelationshiplineshavethesameappearanceasinFigure8.3,yettheentitiesappearasbub-tangles. There are several different types of entities on a dimensionalmodel, eachtypedistinguishedwithadifferenticon.
AccountBalance isanexampleofa fact table (onaconceptualand logicaldatamodeloftencalleda“meter”).TheiconforameterinER/Studioisthegraphsymbolbecausewearemeasuringthehealthofabusinessprocess.Ameterisanentitycontainingarelatedsetofmeasures.Itisnotaperson,place,event,orthing,aswefindontherelationalmodel.Instead, it is a bucket of commonmeasures. As a group, commonmeasures address abusiness process such as Profitability, Employee Satisfaction, or Sales. Themeter is so
important to thedimensionalmodel that thenameof themeter isoften thenameof theapplication:theSalesmeter,theSalesDataMart.
Region,Account, andMonth are examples of dimensions, distinguished by the threehorizontal lines icon.Adimension is a subjectwhosepurpose is to addmeaning to themeasures.Allofthedifferentwaysoffiltering,sorting,andsummingmeasuresmakeuseofdimensions.
Country, Customer, and Year are examples of snowflakes, distinguished by thesnowflakeicon.Thesearehigherlevelsinahierarchy.Ahierarchyiswhenahigherlevelcancontainmanylowerlevelsbutalowerlevelcanbelongto,atmost,onehigherlevel.Thesehigherlevelsindicatethatwecanviewthemeasuresinthemeterattheselevelsaswell.Forexample,wecanviewAccountBalanceAmountat theCountry,Customer,andYearlevel.
Wewillexplainadditionaldimensional terminology inChapter9,LogicalDataModels.WhenIbuildadimensionaldatamodel,IusethenotationIthinkmyaudiencewillbestunderstand.IwillusetheIEnotationwhenmyaudienceisalreadyveryfamiliarwiththismodeling notation from the relational data models but often use the dimensional datamodelingnotationwhenmyaudienceislessfamiliarwithdatamodeling.
CreatingaConceptualDataModelTherearefivestepstoconceptualdatamodelingasillustratedinFigure8.5.
Figure8.5Fivestepstoconceptualdatamodeling
Beforeyoubeginanyproject, therearefivestrategicquestionsthatmustbeasked(Step1). These questions are a prerequisite to the success of any application effort. Next,identifyalloftheconceptswithinthescopeoftheapplicationyouarebuilding(Step2).Make sure each concept is clearly and completely defined. Then determine how theseconceptsarerelatedtoeachother(Step3).Often,youwillneedtogobacktoStep2atthispointbecauseincapturingrelationshipsyouoftencomeupwithnewconcepts—andthentherearenewrelationshipsbetweenthesenewconcepts.Next,decidethemostusefulformformakingsureyourworkduringthisphaseisputtogooduse(Step4).Someonewillneedtoreviewyourworkanduseyourfindingsduringdevelopment,sodecidingonthe most useful form is an important step. As a final step, review your work to getapprovaltomoveontothelogicaldatamodelingphase(Step5).
Step1:AsktheFiveStrategicQuestions
Therearefivequestionsthatneedtobeasked(refertotheexampleinFigure8.6):
1. Whatistheapplicationgoingtodo?Preciselyandclearlydocumenttheanswertothisquestioninafewsentences.Makesuretoincludewhetheryouarereplacinganexistingsystem,deliveringnewfunctionality,integratingseveralexistingapplicationstogether,etc.Always“beginwiththeendinmind,”andsoyouknowexactlywhatyouaregoingtodeliver.Thisquestionhelpsdeterminethescopeoftheapplication.
2. “Asis”or“tobe”?Youneedtoknowifthereisarequirementtounderstandandmodelthecurrentbusinessenvironment(thatis,the“asis”view)ortounderstandandmodelaproposedbusinessenvironment(thatis,the“tobe”view).
3. Isanalyticsarequirement?Analytics,ininformalterms,isthefieldofplayingwithnumbers.Thatis,takingmeasurementssuchasGrossSalesAmountorInventoryCountandviewingthematdifferentlevelsofgranularitysuchasbydayoryear.Ifthereisarequirementforanalytics,atleastpartofyoursolutionneedstobedimensional.Relationalmodelingfocusesonbusinessrules,anddimensionalmodelingfocusesonbusinessquestions.
4. Whoistheaudience?Thatis,whoisthepersonorgroupwhoisthevalidatorandcanconfirmyourunderstandingoftheCDM,andwhowillbetheusersoftheCDM?Itisagoodpolicywithanythingyouproducetodetermineearlyonwhowillcheckyourwork(thevalidators)andwhowillbetherecipientorusersofyourwork.Thisquestionwillensureyouchoosetheidealdisplayformatforyourconceptualdatamodel.Notethatifthevalidatorsandusersvaryconsiderablyintheirtechnicalexpertise,youmayneedmorethanoneformfortheCDM.
5. Flexibilityorsimplicity?Intermsofdesign,thereisalwaysabalancingactbetweenflexibilityandsimplicity.Ifyouareleaningmoretowardsflexibility,youwillmostlikelyusesomegenerictermssuchasEventinsteadofOrderorPersoninsteadofEmployee.
Who? What? When? Where? Why? How?
1.Customer
2.
3.
4.
5.
1.Account
2.
3.
4.
5.
1.AccountOpenDate
2.
3.
4.
5.
1.Branch
2.
3.
4.
5.
1.CheckDebit
2.DepositCredit
3.InterestCredit
4.MonthlyStatementFee
5.WithdrawalDebit
1.Check
2.DepositSlip
3.WithdrawalSlip
4.BankAccountStatement
5.AccountBalance
Account Anaccountisanarrangementbywhichourbankholdsfundsonbehalfofacustomer.Thisarrangementincludestheamountoffundsweholdonbehalfofacustomeraswellasahistoricalperspectiveofallofthetransactionsthathaveimpactedthisamountsuchasdepositsandwithdrawals.Anaccountisstructuredfor a particular purpose such as for stock investing,which is called a “brokerage account”; for interest-bearing,whichiscalleda“savingsaccount”;andforcheckwriting,whichiscalleda“checkingaccount.”Anaccountcanonlybeoneofthesetypes.Thatis,anaccountcannotbebothcheckingandsavings.
Figure8.6Sampleanswerstothefivestrategicquestionsforastudentapplication
Step2:IdentifyandDefinetheConcepts
Now that we have direction, we can work with the business experts to identify theconceptswithinthescopeoftheapplicationandcomeupwithanagreed-upondefinitionforeachconcept.ForRelational
Toidentifyanddefinetherelationalconcepts,recallourdefinitionofanentityasanounornounphrasethatfitsintooneofsixcategories:who,what,when,where,why,orhow.WecanusethesesixcategoriestocreateaConceptTemplateforcapturingtheentitiesonourconceptualdatamodel.SeeTable8.2.
Table8.2Concepttemplate
Table8.3containsacompletedconcepttemplateforanAccountSystem.
AccountProjectConcepts
Table8.3Completedconcepttemplateforanaccountapplication
Herearesomeoftheconceptdefinitions:
AccountBalance Anaccountbalanceisafinancialrecordofhowmuchmoneyacustomerhaswithourbankattheendofagiventimeperiodsuchassomeone’scheckingaccountbalanceattheendofamonth.Theaccountbalanceisimpactedbymanytypesoftransactionsincludingdepositsandwithdrawals.Theaccountbalanceamountis restricted to justasingleaccount.That is, ifwewanted toknowBob thecustomer’snetworth toourbank,wewouldneedtosumtheaccountbalancesforallofBob’saccounts.
AccountOpenDate Theday,month,andyearthatacustomerfirstopenstheiraccount.Thisisthedatethatappearsonthenewaccount application form and is often not the same date as when the account first becomes active anduseable. It may take 24-48 hours after the application is submitted for the account to be useable. Theaccountopendatecanbeanydayoftheweekincludingadatewhenthebankisclosed(if thecustomersubmitstheapplicationusingourwebsiteoffhours).
BankAccountStatement Aperiodicrecordoftheeventsthathaveimpactedtheaccount.Eventsincludewithdrawals,deposits,etc.Thebankaccountstatementisusuallyissuedmonthlyandincludesthebeginningaccountbalance,arecordof all events, and the ending account balance.Also listed are bank fees and, if applicable, any interestaccrued.
Question Yes No
CananEntityAberelatedtomorethanoneEntityB?
CananEntityBberelatedtomorethanoneEntityA?
ForDimensional
For dimensional, we need to determine the specific business questions that must beanswered.Forexample,imaginethatweworkwiththebusinessanalystsforauniversityandidentifythefollowingfourquestions:
1. Showmethenumberofstudentsreceivingfinancialaidbydepartmentandsemesterforthelastfiveyears.[FromFinancialAidOffice]
2. Showmethenumberofstudentsonfullorpartialscholarshipbydepartmentandsemesterforthelastfouryears.[FromAccountingDepartment]
3. Howmanystudentsgraduatedbydepartmentandsemesteroverthelastthreeyears?[FromAlumniAffairs]
4. Howmanystudentsappliedtotheuniversityoverthelasttenyears?Iwanttocompareapplicationsfromhighschoolstudentsvs.otheruniversities.[FromAdmissionsDepartment]
Step3:CapturetheRelationshipsForRelational
Relational is all about capturing the business rules, so our objective at the relationalconceptuallevelistodeterminewhichentitiesrelatetoeachotherandthenarticulatetherules. For each relationship line on our model, we find ourselves asking up to eightquestions:twoonparticipation,twoonoptionality,anduptofourquestionsonsubtyping.SeeTable8.4.
CananEntityAexistwithoutanEntityB?
CananEntityBexistwithoutanEntityA?
ArethereexamplesofEntityAthatwouldbevaluabletoshow?
ArethereexamplesofEntityBthatwouldbevaluabletoshow?
DoesanEntityAgothroughalifecycle?
DoesanEntityBgothroughalifecycle?
Question Yes No
CanaCustomerownmorethanoneAccount? ü
CananAccountbeownedbymorethanoneCustomer? ü
CanaCustomerexistwithoutanAccount? ü
CananAccountexistwithoutaCustomer? ü
ArethereexamplesofCustomerthatwouldbevaluabletoshow? ü
ArethereexamplesofAccountthatwouldbevaluabletoshow? ü
DoesaCustomergothroughalifecycle? ü
DoesanAccountgothroughalifecycle? ü
Table8.4Eightquestionstoaskforeachconceptualrelationship
The first two questions are on participation, and the answers to these questions willdeterminewhether there is a one ormany symbol on the relationship line next to eachentity.Forexample,if“Yes”EntityAcanberelatedtomorethanoneEntityBthentherewillbeamanysymbolontherelationshiplinenexttoEntityB.
The next two questions are on optionality, and the answers to these questions willdeterminewhetherthereisazerosymbolontherelationshiplinenexttoeitherentity.Forexample,if“Yes”EntityAcanexistwithoutEntityB,thentherewillbeazerosymbolontherelationshiplinenexttoEntityB.
Theanswers to thenextfourquestionswilldeterminewhereweintroducesubtypingontheconceptualdatamodel.Whenexampleswillaidcommunicationorifitisimportanttoexplainthelifecycleofaconcept,thensubtypingneedstobeaddedtothemodel.
Table8.5showsanexampleforourAccountapplication.
CanaBranchcontainmorethanoneAccount? ü
CananAccountbelongtomorethanoneBranch? ü
CanaBranchexistwithoutanAccount? ü
CananAccountexistwithoutaBranch? ü
ArethereexamplesofBranchthatwouldbevaluabletoshow? ü
DoesaBranchgothroughalifecycle? ü
StudentCount
FinancialAidIndicator 1
Semester 1,2,3
Year 1,2,3,4
Department 1,2,3
ScholarshipIndicator 2
GraduationIndicator 3
Table8.5Partialsetofanswerstotheeightquestionsforanaccountapplication
Shadingwasusedintheabovetableasawaytogroupthequestionsforeachrelationshiptogether. That is, the unshaded rows answer the questions on the relationship betweenCustomer andAccount and the shaded rows answer the questions on the relationshipbetweenBranchandAccount.NoticealsosinceweansweredtheexampleandlifecyclequestionsforAccountforAccount’srelationshipwithCustomer,wedidnotneedtoaskthesequestionsagainwhenAccountisrelatedwithBranch.ForDimensional
Fordimensional,weneedtotakethebusinessquestionsweidentifiedinthepriorstepandthencreateaGrainMatrix.Agrainmatrixisaspreadsheetwherethemeasuresfromthebusiness questions become columns and the dimensional levels from the businessquestions become rows. The purpose of a grain matrix is to efficiently scope analyticapplications.Itispossibletoelicithundredsofbusinessquestions,andafterplottingthesequestions on a grain matrix, we make the observation that questions from differentdepartmentscanactuallybeverysimilartoeachother.Byconsolidatingquestions,wecanscopeapplicationsthataddresstheneedsformorethanonedepartment.Table8.6containsacompletedgrainmatrixforourStudentApplication.
HighSchoolApplicationIndicator 4
UniversityApplicationIndicator 4
Table8.6Completedgrainmatrixforastudentapplication
Inthisgrainmatrix,wetookeachofthefourquestionsfromStep2andparsedthemsothatthemeasurefromeachquestion(StudentCount)becameacolumnandthelevelsofdetail ineachquestionbecame rows.Thenumbers in thegrainmatrix referback to thequestionnumbers.
Step4:DeterminetheMostUsefulForm
Someonewill need to reviewyourwork and use your findings during development, sodecidingthemostusefulformisanimportantstep.Weknowtheusersforthemodelaftergetting an answer to Strategic Question #4 from Step 1:Who is our audience? WhatpersonorgroupisthevalidatorandcanconfirmourunderstandingoftheCDM,andwhowillbetheusersoftheCDM?ForRelational
Ifthevalidatorandusersarealreadyfamiliarwithdatamodelingnotation,thedecisionisaneasyone:usethetraditionaldatamodelingnotationtheyarecomfortablewithsuchasthis example in Figure 8.7. Refer back to the answers from Step 3 to see how theseanswers impacted the cardinality on this model. Subtyping has been introduced forAccount because there was a need to show examples ofAccount and subtyping wasintroducedforCustomerbecauseCustomergoesthroughalifecycle.
Figure8.7Traditionaldatamodelingnotation
However,veryfrequentlyattheconceptuallevel,thevalidator(andsometimestheuserstoo)isnotfamiliarwithtraditionaldatamodelingnotationorsimplydoesn’twanttoseeadatamodel. In thesesituations,becreativewithhowyoudisplay themodel,comingupwithavisualthattheaudienceforthemodelwouldunderstand.Forexample,Figure8.8contains a business sketch that can be used instead of the traditional data modelingnotation.
Figure8.8Businesssketchinsteadofthetraditionaldatamodel
Insteadoftheword“Branch”insidearectangle,thismodelcontainsapictureofabranch.Insteadofsubtypingsymbols,thesubtypesareshowninsidethesupertype.Insteadoftheword “Bank Account Statement” inside a rectangle, a shape which represents a largedocumentisused.DifferentshapesareusedforsmallerdocumentssuchasaWithdrawalSlipandbuttonshapesareusedtorepresenttransactionssuchasanInterestCredit.ForDimensional
Figure 8.9 shows the dimensional model with the traditional notation and Figure 8.10showsmyfavoriteconceptualdimensionalform,theAxisTechnique.
Theaxistechniqueiswhenyouputthebusinessprocessyouaremeasuringinthecenter(e.g.StudentAttrition)with each axis representing a dimension. The notches on eachaxisrepresentthelevelsofdetailthatarerequiredtoseethemeasuresinthemeter.Thisformworksverywellwhentheaudiencehaslimitedexposuretodatamodeling.
Figure8.10Axistechniquedatamodelingnotation
Step5:ReviewandConfirm
Thevalidatorswillneedtoreviewourdatamodelandfrequentlyduringthissteptherearechanges that require us to go back to Step 2 and refine the concepts.Most likely (andhopefully)thevalidatorswereinvolvedduringtheprocessofbuildingtheconceptual,andthereforeinmanycasesthisreviewstepbecomesaformality.
EXERCISE8.1:CreatingaConceptualDataModelTechnicsPublicationsneedsareportingapplicationtotrackbooksales.Thedatamodelswebuildthroughthischapterandthenexttwowillbeusedasthedesignforabooksalesanalyticssystemwherebooksalescanbetrackedbydifferentparameters.
For this exercise, create a dimensionalCDM to track book sales at the level ofmonth,region,and title.Thenallownavigation frommonth toquarterandyear, fromregion tocountry,andfromtitletocategory.
Create two separate datamodels in ER/Studio, one built using information engineeringnotationandtheotherdimensionalnotation.Recallthatwhenwecreateanewdatamodel,wearegivenachoicefromadrop-downwhethertoselectRelationalorDimensional.Sobuild twodatamodels for the sameexample,one relational, theotherdimensional.SeeAppendixBformymodelstocomparewhenyou’redone.
TitleSales Acollectionofmeasures thatdeterminehowourbooksalesaredoingsuchasTitleSalesQuantityandTitleGrossSalesAmount.
Country Acountryisarecognizednationwithitsowngovernment,occupyingaparticular territory,andwhichisincludedintheISOcountrycodelisting.
Region Aregionisourowndefinitionofdividingacountryintosmallerpiecesforreportingpurposes.
Category A category is a grouping of like titles, commonly grouped by a subject so one knowswhich section toassignthebookonashelfatabookstoreorlibrary.
Title A title is a work for publication, distinguished by the Library of Congress by an ISBN (InternationalStandardBookNumber).
Year Ayearisaperiodoftimecontaining365days,consistentwiththeGregoriancalendar.
Quarter Aquarteriseachofthefournamedperiodsintowhichayearisdivided.
Month Amonthiseachofthetwelvenamedperiodsintowhichayearisdivided.
Asanaside(andoutsidethescopeofthisexercise),ER/StudioBusinessArchitectoffersprocess modeling functionality, which is extremely useful at the conceptual modelingstage,anditalsomapsprocesswithdataconcepts.IfyouarenotfamiliarwithBusinessArchitect,youcandownloadatrialathttp://www.embarcadero.com/downloads.
EXERCISE8.2:AddingDefinitionstoaDataModel
Addthefollowingdefinitionstooneofthedatamodelsyoucreatedinthepriorexerciseand thendisplay themodel so that thedefinitionsappearon the screen. (HINT:ChooseView>DiagramAndObjectDisplayOptions or click on the icon and then chooseDefinitionasthedisplaylevel.)
If you are looking for a quickway to enter these definitions, use themacroDefinitionEditor,which canbe runby clicking theMacros tab inExplorer, right-clicking on theDefinitionEditor,andchoosingRun.SeeAppendixBformymodelwhenyou’redone.
Conceptdefinitions:
EXERCISE8.3:SegmentingthePublisherCDMintoSubmodels
Create a separate submodel for each dimension in one of the models you created inExercise8.1.ThereshouldbeaseparatesubmodelforCalendar,Geography,andTitle.
EXERCISE8.4:CreatingaConceptualDataModelforYourOrganization
IdentifyanareawithinyourorganizationthatisinneedofaCDMandbuilditforthemin
ER/Studiousingtheapproachfromthischapter.Don’tforgetthedefinitions!
KeyPointsAconceptisakeytermthatisbothbasicandcriticaltoyouraudience.
Aconceptualdatamodel(CDM)isasetofsymbolsandtextthatrepresentskeyconceptsandtherulesbindingthesekeyconceptsforaspecificbusinessorapplicationscopeandforaparticularaudience.
TherelationalCDMincludesconcepts,theirdefinitions,andtherelationshipsthatshowhowtheseconceptsinteractwitheachother.ThedimensionalCDMincludesconcepts,theirdefinitions,andthenavigationpathsrequiredtoanalyzemeasuresatdifferentlevelsofdetail.
TocreateaCDMinER/Studio,chooseView>DiagramAndObjectDisplayOptionsorclickontheicon andthenchooseEntityorDefinitionasthedisplaylevel.
CHAPTER9LogicalDataModels
Relational Dimensional
ConceptualDataModel(CDM) ‘One-pager’onbusinessrules ‘One-pager’onnavigation
LogicalDataModel(LDM) Detailedbusinesssolutiononbusinessrules Detailedbusinesssolutiononnavigation
PhysicalDataModel(PDM) Detailedtechnicalsolution
Whatdoesbusinessneed?Forgetthetechnology
EnterlogicalThehighlightedrowinTable9.1showsthefocusofthischapter,whichisthelogicaldatamodel(LDM).
Table9.1TheLogicalDataModelisthefocusofthischapter
ALDMtakesthebusinessneeddefinedonaconceptualdatamodeldowntothenextlevelofabusinesssolution.Thatis,onceyouunderstandatabroadlevelthescopeofaneffortandwhatbusinesspeoplerequiretosolvetheirproblem,thenextstepistocomeupwithasolution for them in the form of a LDM. In this chapter, the logical data model isexplainedalongwithacomparisonofrelationalanddimensionalmindsets.Weexplaintherelationaltechniquesofnormalizationandabstraction,anddimensionalterminologysuchas meters and dimensions. We will also practice building logical data models inER/Studio.
LogicalDataModelExplanationAlogicaldatamodel (LDM) isabusiness solution toabusinessproblem. It ishow themodeler captures the business requirements without complicating the model withimplementationconcernssuchassoftwareandhardware.
On the conceptual data model, we might learn, for example, what the terms, businessrules, and scope would be for a new order entry system. After understanding therequirementsfortheorderentrysystem,wecreateaLDMcontainingalloftheattributesand business rules needed to deliver the application. For example, the conceptual datamodelwillshowthataCustomermayplaceoneormanyOrders.TheLDMwillcaptureallofthedetailsbehindCustomerandOrdersuchasthecustomer’sname,theiraddress,
theordernumber,andwhatisbeingordered.
RelationalandDimensionalLogicalDataModelsRecall from this section’s introduction that relational data modeling is the process ofcapturing how the business works by precisely representing business rules, whiledimensionaldatamodelingis theprocessofcapturinghowthebusiness ismonitoredbypreciselyrepresentingnavigation.Therearebothrelationalanddimensional logicaldatamodels.
Youhaveseenexamplesofbothrelationalanddimensionalconceptualdatamodels(recallFigures8.3and8.4 fromthechapteronconceptualdatamodeling);Figures9.1and9.2showthesetwoexamplesatalogicallevel.Let’sgothroughhoweachofthesearebuilt,startingwithrelational.
RelationalLDMExample
The relational logical data model includes entities along with their definitions,relationships,andattributes.Forexample,Figure9.1containspartofafinancialrelationalLDM.
BusinessRules(listedintheorderwewouldtypicallywalksomeonethroughthemodel):
EachCustomermayownoneormanyAccounts.
EachAccountmustbeownedbyoneormanyCustomers.
EachAccountmaycontainoneormanyAccountBalances.
EachAccountBalancemustbelongtooneAccount.
Figure9.1FinancialrelationalLDMsubset
DimensionalLDMExample
Figure9.2showsadimensionalLDM.
Figure9.2FinancialdimensionalLDM
We takemeasures such asAccountBalanceAmount up and downhierarchies. In thiscase,we’d like toseeAccountBalanceAmountataRegion,Account,andMonth leveland thenhave the ability tonavigate tohigher levels such asviewingAccountBalanceAmountataCountrylevelinsteadofthemoregranularRegionlevel.
Makesureeveryattributeissingle-valuedandprovidesafactcompletelyandonlyaboutitsprimarykey.
Regionisaninterestingleveltodiscuss.Oftenwhenbuildingadimensionaldatamodel,we trace back themeasures andways of looking at thesemeasures to a relational datamodelthatwilleventuallybethesourceforthedimensionaldata.Onourrelationaldatamodel inFigure9.1,wehave anAccountBranchCode in theAccount entity.On thecorresponding dimensional data model, however, there is no need to know what thebranch code is—only the higher level of Region. Therefore, each Region has to bederivedfromthecorrespondingBranchCodebecauseinthiscase,RegionwasrequestedasaneasierleveltonavigatethanBranch.
CreatingaRelationalLogicalDataModelThetwotechniquesusedtobuildtherelationallogicaldatamodelarenormalizationandabstraction.
Normalization
WhenIturned12,Ireceivedatrunkfullofbaseballcardsasabirthdaypresentfrommyparents.Iwasdelighted,notjustbecausetheremayhavebeenaHankAaronorPeteRoseburiedsomewhere in that trunk,butbecauseI loved toorganize thecards. Icategorizedeachcardaccording toyearand team.Organizing thecards in thiswaygavemeadeepunderstandingoftheplayersandtheirteams.Tothisday,Icananswermanybaseballcardtriviaquestions.
Normalization, in general, is the process of applying a set of rules with the goal oforganizingsomething. Iwasnormalizing thebaseballcardsaccording toyearand team.Wecanalsoapplyasetofrulesandnormalizetheattributeswithinourorganizations.Justas thosebaseballcards layunsorted in that trunk,ourcompanieshavehugenumbersofattributes spread throughout departments and applications. The rules applied tonormalizing the baseball cards entailed first sorting by year and then by teamwithin ayear.Therulesfornormalizingourattributescanbeboileddowntoasinglesentence:
Theunderlinedtermsrequiremoreofanexplanation.
Single-valued means an attribute must contain only one piece of information. IfConsumerNamecontainsboththeconsumer’sfirstandlastname,forexample,wemustsplitConsumerName into twoattributes:ConsumerFirstNameandConsumerLastName.
Providesafactmeansthatagivenprimarykeyvaluewillalwaysreturnnomorethanoneofeveryattributethatisidentifiedbythiskey.IfaCustomerIdentifiervalueof123forexample, returns three customer last names (Smith,Jones, andRoberts), it violates thispartofthenormalizationdefinition.
Completelymeansthattheminimalsetofattributesthatuniquelyidentifyaninstanceofthe entity is present in the primary key. If, for example, there are two attributes in an
entity’sprimarykey,butonlyoneisneededforuniqueness,theattributethatisnotneededforuniquenessshouldberemovedfromtheprimarykey.
Onlymeansthateachattributemustprovideafactabouttheprimarykeyandnothingelse.Thatis,therecanbenohiddendependencies.Forexample,assumeanOrderisidentifiedby an Order Number. Within Order, there are many attributes including OrderScheduledDeliveryDate,OrderActualDeliveryDate,andOrderOnTimeIndicator.OrderOnTimeIndicatorcontainseitheraYesoraNo,providingafactaboutwhethertheOrderActualDeliveryDateislessthanorequaltotheOrderScheduledDeliveryDate.OrderOnTimeIndicator,therefore,providesafactaboutOrderActualDeliveryDateandOrderScheduledDeliveryDate,notdirectlyaboutOrderNumber.OrderOnTimeIndicator is an example of a derived attribute,meaning it is calculated.Derivedattributesareremovedfromanormalizedmodel.
So a general definition for normalization is that it is a series of rules for organizingsomething. Asmentioned, the series of rules can be summarized as:Every attribute issingle-valuedandprovidesafactcompletelyandonlyaboutitsprimarykey.Aninformaldefinition I frequently use for normalizing is “A formal process of asking businessquestions.”We cannot determine if every attribute is single-valued and provides a factcompletelyandonlyaboutitsprimarykeyunlessweunderstandthedata.Tounderstandthedata,weusuallyneedtoasklotsofquestions.EvenforanapparentlysimpleattributesuchasPhoneNumber,forexample,wecanaskmanyquestions:
Whosephonenumberisthis?Doyoualwayshavetohaveaphonenumber?
Canyouhavemorethanonephonenumber?Doyoueverrecognizetheareacodeasseparatefromtherestofthephonenumber?Doyoueverneedtoseephonenumbersoutsideagivencountry?Whattypeofphonenumberisthis?Thatis,isitafaxnumber,mobilenumber,etc.?Doesthetimeofdaymatter?Forexample,doweneedtodistinguishbetweenthephonenumberstouseduringworkinghoursandoutsideworkinghours?Ofcourse,thatwouldleadtoadiscussiononwhatwemeanby“workinghours.”
To ensure that every attribute is single-valued and provides a fact completely and onlyaboutitsprimarykey,weapplyaseriesofrulesinsmallsteps,whereeachstep(orlevelof normalization) checks something that moves us towards our goal. Most dataprofessionalswouldagreethatthefullsetofnormalizationlevelsisthefollowing:
firstnormalform(1NF)
secondnormalform(2NF)
thirdnormalform(3NF)
Boyce/Coddnormalform(BCNF)
fourthnormalform(4NF)
fifthnormalform(5NF)
EmpId DeptCd Phone1 Phone2 Phone3 EmpName DeptName EmpStartDate EmpVestedInd
Eachlevelofnormalizationincludesthelowerlevelsofrulesthatprecedeit.Ifamodelisin 5NF, it is also in 4NF, BCNF, and so on. Even though there are higher levels ofnormalizationthan3NF,manyinterpretthetermnormalizedtomean3NF.Thisisbecausethehigherlevelsofnormalization(thatis,BCNF,4NF,and5NF)coverspecificsituationsthat occur much less frequently than the first three levels. Therefore, to keep thingssimple,thischapterfocusesonlyonfirstthroughthirdnormalforms.InitialChaos
IwoulddescribethetrunkofbaseballcardsIreceivedasbeinginachaoticstatebecausetherewasnoordertothecards.Justabunchofcardsthrowninalargebox.Iremovedthechaos by organizing the cards.The termchaos can be applied to any unorganized pile,includingattributes.Wemayhaveastrongunderstandingofeachoftheattributes,suchastheirnameanddefinition,butwelackknowledgeastowhichentitytheattributeshouldbeassigned.WhenIpickouta1978PeteRosefromtheboxandput thiscard in the1978pile, I start bringing orderwere therewas chaos—similar to assigningCustomerLastNametothecustomerpile(calledtheCustomerentity).
Let’s walk through an example. Figure 9.3 contains a bunch of what appears to beemployeeattributes.
Figure9.3Initialchaoticstate
Oftendefinitionsareofpoorqualityormissingcompletely,and let’sassumethat this isthe case with this Employee entity. We are told, however, that Employee VestedIndicatorcaptureswhetheranEmployeeiseligibleforretirementbenefits(avalueofYfor“yes”meanstheemployeeiseligible,andavalueofNfor“no”meanstheemployeeisnoteligible)andthisindicatorisderivedfromtheemployee’sstartdate.Forexample,ifan employee has worked for the company for at least five years then this indicatorcontainsthevalueY.
What is lacking at this point, andwhatwill be solved though normalization, is puttingtheseattributesintotherightentities.
Itisveryhelpfultohavesomesamplevaluesforeachoftheseattributes,solet’sassumethespreadsheetinTable9.2isarepresentativesetofemployeevalues.
123 A 973-555-1212
678-333-3333
343-222-1111
HenryWinkler
DataAdmin 4/1/2012 N
789 A 732-555-3333
678-333-3333
343-222-1111
SteveMartin
DataAdmin 3/5/2007 Y
565 B 333-444-1111
516-555-1212
343-222-1111
MarySmith
DataWarehouse 2/25/2006 Y
744 A 232-222-2222
678-333-3333
343-222-1111
BobJones DataAdmin 5/5/2011 N
Table9.2SampleemployeesFirstNormalForm(1NF)
Recallthattheseriesofrulescanbesummarizedas:Everyattributeissingle-valuedandprovidesafactcompletelyandonlyaboutitsprimarykey.FirstNormalForm(1NF)isthe“single-valued”part. Itmeans that foragivenprimary-keyvalue,wecan find,atmost,oneofeveryattributethatdependsonthatprimarykey.
EnsuringeachattributeprovidesafactaboutitsprimarykeyincludescorrectingthemoreblatantissueshowninTable9.2aswellasaddressingrepeatinggroupsandmulti-valuedattributes.Specifically,themodelerneedsto:
Moverepeatingattributestoanewentity.Whentherearetwoormoreofthesameattributeinthesameentity,theyarecalledrepeatingattributes.Thereasonrepeatingattributesviolate1NFisthatforagivenprimarykeyvalue,wearegettingmorethanonevaluebackforthesameattribute.Repeatingattributesoftentakeasequencenumberaspartoftheirnamesuchasphonenumberinthisemployeeexample.Wecanfindourselvesaskingmanyquestionsjusttodetermineifthereareanyrepeatingattributesweneedtoaddress.Wecanhaveaquestiontemplatelikethis:“Cana[[insertentitynamehere]]havemorethanone[[insertattributenamehere]]?”Sotheseareallvalidquestionsinouremployeeexample:
CananEmployeehavemorethanoneEmployeeIdentifier?CananEmployeehavemorethanoneDepartmentCode?CananEmployeehavemorethanonePhoneNumber?CananEmployeehavemorethanoneEmployeeName?CananEmployeehavemorethanoneDepartmentName?CananEmployeehavemorethanoneEmployeeStartDate?CananEmployeehavemorethanoneEmployeeVestedIndicator?
Separatemulti-valuedattributes.Multi-valuedmeansthatwithinthesameattributewearestoringatleasttwodistinctvalues.Inotherwords,thereareatleasttwodifferentbusinessconceptshidinginoneattribute.Forexample,EmployeeNamemaycontainbothafirstnameandlastname.EmployeeFirstNameandEmployeeLastNamecanbeconsidereddistinctattributes;andtherefore,HenryWinklerstoredinName,ismulti-valuedbecauseitcontainsbothHenryand
Winkler.Wemayfindourselvesaskingmanyquestionsjusttodetermineifthereareanymulti-valuedattributesweneedtoidentify.Wecanuseanotherquestiontemplate:“Doesa[[insertattributenamehere]]containmorethanonepieceofbusinessinformation?”Sotheseareallvalidquestionsinouremployeeexample:
DoesanEmployeeIdentifiercontainmorethanonepieceofbusinessinformation?DoesaDepartmentCodecontainmorethanonepieceofbusinessinformation?
DoesaPhoneNumbercontainmorethanonepieceofbusinessinformation?DoesanEmployeeNamecontainmorethanonepieceofbusinessinformation?DoesaDepartmentNamecontainmorethanonepieceofbusinessinformation?DoesanEmployeeStartDatecontainmorethanonepieceofbusinessinformation?DoesanEmployeeVestedIndicatorcontainmorethanonepieceofbusinessinformation?
After talkingwithabusinessexpertandanswering thesequestionsbasedon thesampledatafromTable9.2,weupdatethemodelwhichappearsinFigure9.4.
Figure9.4FromChaosto1NF
We learned that althoughPhoneNumber1,PhoneNumber 2, andPhoneNumber 3appearas repeatingattributes, theyare really threedifferentpiecesof informationbaseduponthesamplevaluesweweregiven.PhoneNumber3containedthesamevalueforallfouremployees, andwe learnedaftervalidatingwith thebusinessexpert that this is theorganization’s phone number.PhoneNumber 2 varied by department, so this attributewas renamed toDepartment Phone Number.Phone Number 3 is different for eachemployee,andwelearnedthat thisis theEmployeePhoneNumber.Wealsoweretoldthat Employee Name does contain more than one piece of information and thereforeshouldbesplitintoEmployeeFirstNameandEmployeeLastName.SecondNormalForm(2NF)
Recallthattheseriesofrulescanbesummarizedas:Everyattributeissingle-valuedandprovidesafactcompletelyandonlyaboutitsprimarykey.FirstNormalForm(1NF)isthe“single-valued” part. SecondNormal Form (2NF) is the “completely” part. Thismeanseach entitymust have theminimal set of attributes that uniquely identifies each entityinstance.
Aswith1NF,wewillfindourselvesaskingmanyquestionstodetermineifwehavetheminimalprimarykey.Wecanuseanotherquestiontemplate:“Arealloftheattributesintheprimarykeyneededtoretrieveasingleinstanceof[[insertattributenamehere]]?”IntheEmployeeexampleshowninFigure9.4, the“minimalsetofprimarykey instances”areEmployeeIdentifierandDepartmentCode.
Sotheseareallvalidquestionsforouremployeeexample:
ArebothEmployeeIdentifierandDepartmentCodeneededtoretrieveasingleinstanceofEmployeePhoneNumber?ArebothEmployeeIdentifierandDepartmentCodeneededtoretrieveasingleinstanceofDepartmentPhoneNumber?ArebothEmployeeIdentifierandDepartmentCodeneededtoretrieveasingleinstanceofOrganizationPhoneNumber?ArebothEmployeeIdentifierandDepartmentCodeneededtoretrieveasingleinstanceofEmployeeFirstName?
ArebothEmployeeIdentifierandDepartmentCodeneededtoretrieveasingleinstanceofEmployeeLastName?ArebothEmployeeIdentifierandDepartmentCodeneededtoretrieveasingleinstanceofDepartmentName?ArebothEmployeeIdentifierandDepartmentCodeneededtoretrieveasingleinstanceofEmployeeStartDate?ArebothEmployeeIdentifierandDepartmentCodeneededtoretrieveasingleinstanceofEmployeeVestedIndicator?
Normalization is a process of asking business questions. In this example,we could notcomplete 2NFwithout asking the business “Can anEmployeework formore than oneDepartmentatthesametime?”Iftheansweris“Yes”or“Sometimes,”thenthefirstmodelinFigure9.5ontheleftisaccurate.Iftheansweris“No,”thenthesecondmodelprevails.
Figure9.5Employeeexamplein2NF
ThirdNormalForm(3NF)
Recallthattheseriesofrulescanbesummarizedas:Everyattributeissingle-valuedandprovidesafactcompletelyandonlyaboutitsprimarykey.FirstNormalForm(1NF)isthe“single-valued”part.SecondNormalForm(2NF)isthe“completely”part.ThirdNormal
Form(3NF)isthe“only”part.
3NF requires the removal of hidden dependencies. Each attribute must be directlydependentontheprimarykeyandnotdirectlydependentonanyotherattributeswithinthesameentity.
Thedatamodelisacommunicationtool.Therelationallogicaldatamodelcommunicateswhich attributes are facts about the primary key and only the primary key. Hiddendependencies complicate the model and make it difficult to determine how to retrievevaluesforeachattribute.
Toresolveahiddendependency,youwilleitherneedtoremovetheattributethatisafactaboutnon-primarykeyattribute(s)fromthemodeloryouwillneedtocreateanewentitywith a different primary key for the attribute that is dependent on the non-primary keyattribute(s).
Aswith1NFand2NF,wewill findourselvesaskingmanyquestions touncoverhiddendependencies.Wecanuseanotherquestion template:“Is [[insertattributenamehere]]afactaboutanyotherattributeinthissameentity?”
Sotheseareallvalidquestionsforourcontactexample:
IsEmployeePhoneNumberafactaboutanyotherattributeinEmployee?IsOrganizationPhoneNumberafactaboutanyotherattributeinDepartment?IsDepartmentPhoneNumberafactaboutanyotherattributeinDepartment?IsEmployeeFirstNameafactaboutanyotherattributeinEmployee?IsEmployeeLastNameafactaboutanyotherattributeinEmployee?IsDepartmentNameafactaboutanyotherattributeinDepartment?IsEmployeeStartDateafactaboutanyotherattributeinEmployee?IsEmployeeVestedIndicatorafactaboutanyotherattributeinEmployee?
Note thatEmployee Vested Indicatormay be a fact aboutEmployee Start Date asEmployeeVested IndicatorcanbecalculatedYorN based upon the employee’s startdate. Figure 9.6 shows the model now in 3NF after removing the derived attribute,EmployeeVestedIndicator.
Figure9.6Employeeexamplein3NF
You will find that the more you normalize, the more you go from applying rulessequentially to applying them inparallel.For example, insteadof first applying1NF toyourmodeleverywhere,thenwhenyouaredoneapplying2NF,andsoon,youwillfindyourselflookingtoapplyalllevelsatonce.Thiscanbedonebylookingateachentityandmakingsuretheprimarykeyiscorrectandcontainsaminimalsetofattributesandthatallattributesarefactsaboutonlytheprimarykey.
Abstraction
Normalizationisamandatorytechniqueontherelationallogicaldatamodel.Abstractionisanoptionaltechnique.Abstractionbringsflexibilitytoyourdatamodelsbyredefiningand combining some of the attributes, entities, and relationships within themodel intomoregenericterms.
Forexample,wecantakeournormalizeddatamodelandabstractEmployee intoPartyandRole,asshowninFigure9.7.
Figure9.7Employeeabstracted
Notice the extra flexibilitywe gainwith abstraction.By abstractingEmployee into thePartyRoleconcept,wecanaccommodateadditionalroleswithoutchangestoourmodeland most likely without changes to our application. Roles such as Contractor andConsumer can be added gracefullywithout updates to ourmodel. However, this extraflexibilitydoescomewithaprice.Actually,threehighprices:
Lossofcommunication.Theconceptsweabstractarenolongerrepresentedexplicitlyonthemodel.Thatis,whenweabstract,weoftenconvertcolumnnamestoentityinstances.Forexample,EmployeeisnolongeranexplicitentitybutisinsteadanentityinstanceofPartyRole,withaRoleTypeCodevalueof03forEmployee.Oneofthemainreasonswemodelistoaidcommunication,butabstractingcandefinitelyhindercommunication.Lossofbusinessrules.Whenweabstract,wecanalsolosebusinessrules.Tobemorespecific,therulesweenforcedonthedatamodelbeforeabstractionnowneedtobeenforcedthroughothermeanssuchasthroughprogrammingcode.IfwewantedtoenforcethatanEmployeemusthaveaStartDate,forexample,wecannolongerenforcethisrulethroughtheabstracteddatamodelinFigure9.7.Additionaldevelopmentcomplexity.Abstractingrequiressophisticateddevelopmenttechniquestoturnattributesintovalueswhenloadinganabstractstructure,ortoturnvaluesbackintoattributeswhenpopulatingastructurefromanabstractsource.ImaginetheworktopopulatePartyRolefromthesourceEmployee.ItwouldbemucheasierforadevelopertoloaddatafromanentitycalledEmployeeintoanentitycalledEmployee.Thecodewouldbesimpleranditwouldbeveryfasttoload.
Soalthoughabstractionprovidesflexibilitytoanapplication,itdoescomewithacost.Itmakesthemostsensetouseabstractionwhenthemodeleroranalystanticipatesadditional
typesofsomethingcominginthenearfuture.IntheexamplefromFigure9.7,additionaltypesofpeoplemightincludeContractorandConsumer.
CreatingaDimensionalLogicalDataModelRecallthedimensionaldatamodelfromearlierinthischapter,repeatedhereinFigure9.8.
In a dimensional model, each structure is assigned a Table Model type, which isdistinguished by an icon displayed in the upper left corner of the entity box. You canfurtherdescribethestructureintheTableEditorbyassigningitaTableTypethatdisplaysatthebottomoftheentity(e.g.,Fixed).TheTableTypedoesnotchangehowthedataishandledbutprovidesinformationtothereaderaboutthedatainthestructure.Itispurelyfordocumentationpurposes.
AccountBalance isanexampleofafacttable(onaconceptualandlogicaldatamodel,this is often called a “meter”). The icon for ameter in ER/Studio is the graph symbolbecause we are measuring something. A meter is an entity containing a related set ofmeasures. It is not a person, place, event, or thing, aswe find on the relationalmodel.Instead, it is a bucket of common measures; in this case, just the measure AccountBalanceAmount. As a group, common measures address a business process such asProfitability,EmployeeSatisfaction,orSales.
Figure9.8FinancialdimensionalLDM
Afacttablecanbefurtherclassifiedintoonethesefourtypes:
Aggregate.Alsoknownasasummarization,anaggregatecontainsinformationthatisstoredatahigherlevelofgranularitythantranslationleveldetails.Aggregatesprovidequickaccesstodataandcanbeveryuser-friendlystructuresforusersandreportingtools.AccountBalanceisanaggregate.Atomic.Containsthelowestlevelofdetailavailableinthebusiness,oftenthesamelevelofdetailthatexistsinoperationalsystemssuchasorderentrysystems.An
exampleofanatomicfactintheaccountbalancesubjectareawouldbetheindividualbankaccountwithdrawalanddeposittransactions.
Cumulative.Alsoknownasaccumulating,cumulativecaptureshowlongittakestocompleteabusinessprocess.Forexample,trackinghowlongittakesfromapplicationthroughcompletionofahomemortgageapplicationwouldberepresentedinacumulativefact.Snapshot.Containstime-relatedinformationthatdetailsspecificstepsinthelifeoftheentity.Forexample,snapshotinformationforasalecouldcontaininformationsuchaswhentheorderwascreated,confirmed,shipped,delivered,andpaidfor.
Region,Account, andMonth are examples of dimensions, distinguished by the threehorizontal lines icon.Adimension is a subjectwhosepurpose is to addmeaning to themeasures.Allofthedifferentwaysoffiltering,sorting,andsummingmeasuresmakeuseof dimensions. Dimensions have their own attributes. A dimension can be furtherclassifiedintoonethesesixtypes:
FixedDimension.AlsoknownasaType0SlowlyChangingDimension(SCDforshort),afixeddimensioncontainsvaluesthatdonotchangeovertime.Forexample,GenderisafixeddimensioncontainingthevaluesMaleandFemale.Degenerate.Adimensionwhoseattribute(s)havebeenmovedtothefacttable.AdegeneratedimensionismostcommonwhentheoriginaldimensioncontainedonlyasingledataattributesuchasatransactionidentifierlikeanOrderNumber.Multi-Valued.Amulti-valueddimensioncanhelpyoumodelasituationwheretherearemultiplevaluesforanattributeorcolumn.Forexample,ahealthcarebillcanhavealineitemofDiagnosisforwhichtherecouldbemultiplevalues.Bestpracticemodelingdictatesthatthereshouldbeasinglevalueforeachlineitem.Tomodelthismulti-valuedsituation,youcouldcreateamulti-valuedstructurethatcapturesthediagnosisinformationandweighseachdiagnosissothatthetotaladdsuptoone.Ragged.Inaraggeddimension,theparentofatleastonememberismissingfromthelevelimmediatelyabovethemember.Raggeddimensionsallowforhierarchiesofindeterminatedepthsuchasorganizationalchartsandpartsexplosions.Shrunken.Ashrunkentableisaversionofthefacttableoftencontainingattributesthatarenotmeasures.Itisoftenusedwhentherearelargetextstringsthatareatthesamelevelofdetailasthefacttableandarestoredinaseparatestructureforspaceorqueryefficiencyreasons.SlowlyChangingType0through6.SlowlyChangingDimension(SCD)Type0isequivalenttothefixeddimensionconceptwherevaluesdonotchangeovertime.SCDType1meansweareonlystoringthecurrentviewandignoringhistory.SCDType2meanswewantallhistory(Type2istheTimeMachine).SCDType3meanswewantonlysomehistorysuchasthemostcurrentstateandthepreviousstateorthemostcurrentstateandtheoriginalstate.SCDType6iswhenwehaveacomplexdimensionwithvaryinghistoryneeds;forexample,ifpartofthedimensionisaType1,partisaType2,andpartisaType3(1+2+3=6).Types0,1,2,and3are
thebuildingblocksformoreadvancedhistoryrequirementssuchastheType6.
Country, Customer, and Year are examples of snowflakes, distinguished by thesnowflakeicon.Thesearehigherlevelsinahierarchy.Ahierarchyiswhenahigherlevelcancontainmanylowerlevels,butalowerlevelcanbelongtoatmostonehigherlevel.Thesehigherlevelsindicatethatwecanviewthemeasuresinthemeterattheselevelsaswell.Forexample,wecanviewAccountBalanceAmountat theCountry,Customer,andYearlevel.Snowflakescanalsohavetheirownattributes.Snowflakescanbefurtherclassifiedusingthesamedescriptorsasjustmentionedwithdimensions.
EXERCISE9.1:CreatingaDimensionalLogicalDataModel
SaveyourdimensionalconceptualdatamodelfromExercise8.1asanewmodelandaddat least threeattributes toeachof theentities.Remember tochange thedisplay levelsothatattributesappearonthemodel.(HINT:ChooseView>DiagramAndObjectDisplayOptions or click on the icon and under theEntity tab choose the Logical AttributeOrderdisplaylevel.)
KeyPointsAlogicaldatamodel(LDM)representsadetailedbusinesssolution.
Arelationallogicaldatamodelrepresentshowthebusinessworks.Adimensionallogicaldatamodelrepresentswhatthebusinessismonitoring.
Normalizingisaformalprocessofaskingbusinessquestions.Normalizationensuresthateveryattributeisafactaboutthekey(1NF),thewholekey(2NF),andnothingbutthekey(3NF).
Abstractionbringsflexibilitytoyourlogicaldatamodelsbyredefiningandcombiningsomeoftheattributes,entities,andrelationshipswithinthemodelintomoregenericterms.
Thereareanumberofimportanttermsuniquetodimensionalmodelingincludingmetersanddimensions.
Therearedifferenttypesofmetersincludingaggregate,atomic,cumulative,andsnapshot.
Therearedifferenttypesofdimensionsincludingfixeddimension,degenerate,multi-valued,ragged,shrunken,andslowchanging.
CHAPTER10PhysicalDataModels
Relational Dimensional
ConceptualDataModel(CDM) “One-pager”onbusinessrules “One-pager”onnavigation
LogicalDataModel(LDM) Detailedbusinesssolutiononbusinessrules Detailedbusinesssolutiononnavigation
PhysicalDataModel(PDM) Detailedtechnicalsolution
Let’sgetPhysicalCompromisetheLogical
EfficiencyrulesThehighlightedrowinTable10.1showsthefocusofthischapter,whichisthephysicaldatamodel(PDM).
Table10.1ThePhysicalDataModelisthefocusofthischapter
APDMtakesthebusinesssolutiondefinedonalogicaldatamodeltothenextlevelofatechnical solution. That is, once you solve the problem independent of software andhardware concerns, you can then make adjustments for software and hardware. Thischapterwill explain themost popular techniques formaking adjustments to a businesssolution (LDM) tocreateanefficient technical solution (PDM). Iwillexplain thePDMand then discuss the techniques of denormalization, views, indexing, and partitioning.Although these techniques apply to relational, dimensional, and NoSQL models, theirnamesmaydifferdependingonwhich typeofmodel theyareapplied to. Iwill explaintheseterminologydifferencesinthischapteraswell.Aswiththeconceptualandlogicaldatamodelingchapters,bepreparedtopracticeeverythinginER/Studio!
PhysicalDataModelExplanationThe physical data model (PDM) is the logical data model compromised for specificsoftwareorhardware.On theCDM,we learnwhat the terms,business rules,andscopewouldbeforaneworderentrysystem.Afterunderstanding theneedforanorderentrysystem, we create a LDM representing the business solution. It contains all of theattributes and business rules needed to deliver the system. For example, the conceptualdatamodelwill show thataCustomermayplaceoneormanyOrders.TheLDMwillcaptureallofthedetailsbehindCustomerandOrdersuchasthecustomer’sname,theiraddress,andtheordernumber.Afterunderstandingthebusinesssolution,wemoveontothe technical solution and build the PDM. We may make some modifications to the
CustomerandOrderstructures,forexample,forfactorssuchasperformanceorstorage.
WhilebuildingthePDM,weaddresstheissuesthathavetodowithspecifichardwareorsoftwaresuchas:
Wehaveabigdatascenario,sohowcanweprocessalotofdataveryquicklyandthenafterwardsanalyzeitveryquickly?Howcanwemakethisinformationsecure?Howcanweanswerthisbusinessquestioninlessthantwoseconds?
Note that in the early days of data modeling, when storage space was expensive andcomputerswereslow,thereweremajormodificationsmadetothePDMtomakeitworkefficiently.Insomecases,thePDMlookedlikeitwasforanentirelydifferentapplicationthan theLDM.As technology improved, thePDMstarted lookingmore like theLDM.Fasterandcheaperprocessors,cheaperandmoregenerousdiscspaceandsystemmemory,andalsospecializedhardwarehaveallplayed theirpart tomake thephysical lookmorelike its logical counterpart. However, with big data processing and analytical toolsbecomingmoremainstream, there is now (at least temporarily) a large difference againbetween physical and logical. Physical big data designs can even be file- or document-basedtoallowforfastloadingandanalyzingofdata.Sobeawareofphysicaldatamodelsthatareallinonetable(orfile);itmaybetheoptimaldesigndependingonthedatabasetechnology.
RelationalandDimensionalPhysicalDataModelsRecall from this section’s introduction that relational data modeling is the process ofcapturing how the business works by precisely representing business rules, whiledimensionaldatamodelingis theprocessofcapturinghowthebusiness ismonitoredbypreciselyrepresentingnavigation.Therearebothrelationalanddimensionalphysicaldatamodels.
Youhave seenexamplesofboth relational anddimensional conceptual and logicaldatamodels (recall Figures 8.3 and 8.4 from the chapter on conceptual data modeling andFigures 9.1 and 9.2 from the chapter on logical datamodeling). Figures 10.1 and 10.2showthesetwoexamplesataphysicallevel.Let’sgothroughhoweachofthesearebuilt,startingwithrelational.
RelationalPDMExample
The relational PDM includes entities with their definitions, relationships, and columnsalongwiththeirdefinitions.NotethatinRDBMSthetermtableisusedinsteadofthetermentity andcolumn instead ofattribute on the physical datamodel. Figure 10.1 containspart of a financial relational PDM. Compromises such as combining Customer andAccountintoonestructureweremadetothismodel,mostlikelytoimprovedataretrievalperformanceortomakeiteasierfordeveloperstoextract,transform,andload(ETL)data.
Figure10.1FinancialrelationalPDMsubset
DimensionalPDMExample
Tounderstandanddocumentourreportingrequirements,wecanalsobuildadimensionalPDMsuchastheexampleinFigure10.2.Thismodel,calledastarschema(whichwe’llcover shortly), is similar to its logical counterpart except that each dimension from thedimensionalLDMhasbeenflattenedonthemodelfromFigure9.2intoonestructure.
Figure10.2FinancialdimensionalPDM
CreatingaPhysicalDataModelinER/StudioIn ER/Studio, it is wisely assumed that a physical data model cannot be created fromscratch but instead must be based upon an existing logical data model or reverseengineered from an existing database (such as the actual database or a data definitionlanguagelikeSQL).We’llgointobothapproachesinthissection.
GeneratingaPhysicalDataModelfromaLogicalDataModel
To design the most effective data model possible, create the logical design before thephysical design. The logical data modeling process will bring up important inputs todesignthatwillleadtoamoreefficientandsupportablephysicaldatamodelandthereforedatabase.
TheGeneratePhysicalModelWizard inER/Studio automatically creates a relational ordimensionalphysicaldatamodelbasedona logicaldatamodel, freeingyoutofocusonperformancetuningduringthephysicalmodeldesignphase.Thewizardcanassistyoubyensuring conformance with the basic naming and syntax rules of the target databaseplatformandbyenforcinglogicalrulessuchaskeysandrelationships.
Togenerateaphysicaldatamodelfromalogicaldatamodel,useoneofthesecommands:
Menu Toolbar Explorer ShortcutKey
ShortcutMenu
Model>GeneratePhysicalDataModel… Applicationtoolbar:
Right-clickonmodel,GeneratePhysicalDataModel…
<ALT+M>,then<G>
Model>GeneratePhysicalDataModel…
Let’sgenerateaphysicaldatamodelfromourpublisherrelationallogicaldatamodel.ThefirstpageoftheGeneratePhysicalModelscreenappears,asshowninFigure10.3.
Figure10.3GeneratePhysicalModelPage1of5
MakesureyougiveyourPDManame, selectwhether thePDMwillbea relationalordimensionalPDM,andselectthecorrecttargetdatabaseplatformfromthatdrop-down.Ichose Oracle 11g for this example. With every new release of ER/Studio comes newfeatures that are supported for each database platform. For example, ER/Studio 11
Menu Toolbar Explorer ShortcutKey
ShortcutMenu
Database>ChangeDatabasePlatform… Applicationtoolbar:
Right-clickonphysicaldatamodel,ChangeDatabasePlatform…
<ALT+B>,then<C>
n/a
includes the ability to suppress index names for Teradata, Partition by Growth forUniversalTableSpace(UTS)forDB2,andAdvancedCompressionforOracleDatabase11g.
Asanaside,youcanalwayschangethedatabaseplatformatalatertime.Makesureyouareinthephysicaldatamodelwhoseplatformyouwouldliketochangeandthenfollowthesesteps:
ChoosingValidate after generating PhysicalModel means a number of checks will bemadeagainststandardsdefinedinthedatadictionary.TheWizardQuickLaunchallowsyoutoloadafilethatcontainsyourpreferredsettingswheneveryougenerateaphysicaldatamodel.Thiscanbeareal timesaverifyougeneratephysicaldatamodelsoftenandcan also increase consistency across the physical datamodels. On the last page of thewizard (Page 5), you are given the option of saving your settings for generating futurephysicaldatamodels.
Click<Next>toadvancetoPage2of5.SeeFigure10.4.
On this screen you can choose which entities you would like converted into physicalstructures for yourPDMaswell as customize certain settings onkeys and indexes.Animportant radio button to consider isHow do you wish to resolve external FKs in thisSubmodel?CheckingDeleteAttributesmeans that ifyoubring inasubsetof tablesandsomeof these tablescontain foreignkeysback toother tables thatwerenotbrought in,theseforeignkeyswithhiddenrelationshipswillbedeleted.
Figure10.5GeneratePhysicalModelPage3of5
NoticetherearefourtabsonthePage3of5screen.IwenttotheGeneralOptionstabandselectedtheradiobuttontoReplacewithunderscores,whichwillreplacespacesbetweenentityandattributetermsonthelogicalwithunderscoresonthephysical.
Click <Next> to advance to Page 4 of 5. See Figure10.6. This screen is useful if youknowdetailsonhowmuchspaceeachtablewilluseinitiallyorgrowovertime.Justleaveblankifyoudon’tknow.
Figure10.6GeneratePhysicalModelPage4of5
Click<Next>toadvancetoPage5of5.SeeFigure10.7.
On this screen you can decide how to resolvemany-to-many relationships (callednon-specific)aswellasselectwhichlogicalmodelingcomponentstoforwardengineersuchassubmodels,textblocks,anddrawingshapes.TheQuickLaunchcanstorecommonsettingssothatanoperationcanbereusedonthismodeloronanyothermodels.Youcanreusethesettingsonanothermodelbychoosing theUseFile-BasedQuickLaunchSetting optionwhensavingtheQuickLaunchinformationonthispageofthewizard.
Menu Toolbar Explorer ShortcutKey
ShortcutMenu
Tools>Options n/a n/a <ALT+T>,then<P>
n/a
Figure10.7GeneratePhysicalModelPage5of5
Click<Finish>toexitthewizardandgeneratethephysicaldatamodel.
GeneratingaPhysicalDataModelfromaDatabase(ReverseEngineering)
ER/Studioallowsyoutocreateanewphysicaldatamodelbyreverse-engineeringalivedatabaseorimportingaSQLfile.FirstopentheOptionsscreen.
Using theApplication tab underOptions, you can specify whether reverse engineeringalwaysproducesboth logical andphysicaldatamodelsorproduces logicaldatamodels
Menu Toolbar Explorer ShortcutKey
ShortcutMenu
File>New Application
toolbar:
n/a <CTRL+N>
or
<ALT+F>,then<N>
n/a
only.Youcanalsospecifythecolumnsequencefornewmodelsthatyoureverseengineer.Once applied, this customizationwill apply to all of your reverse-engineering projects.Click<OK>toexitOptionsandhaveyoursettingssaved.
Toreverseengineerfromadatabase,theinitialstepsarethesameascreatinganynewdatamodel.
ThescreeninFigure10.8appears.
Figure10.8Newmodelscreen
Reverse-engineer means taking an actual database structure and importing it intoER/Studio to create a picture ofwhat the database looks like.Reverse-engineering is agreatfirststepinunderstandinghowanexistingapplicationworks(especiallywhenthatexistingapplicationmaynothavebeenproperlydatamodeledtobeginwith!).Thethirdoption on this submenu is to import a data model from different formats such as CAERwin®DataModeler®orSQLfiles.WewilldiscusshowtoimportfromCAERwin®DataModeler® inChapter13andhow to import fromSQL in thischapteras importing fromSQLisalsoreverseengineering.
ChooseReverse-engineeringanexistingdatabaseandclick<Login…>.
WewillreverseengineeraMicrosoftAccess®database,aMongoDBdatabase,andaHivedatabase.WewillkeepthedefaultsettingsthrougheachoftheWizards.Forlearningmoreaboutspecificsettingswhenreverseengineering,refertotheUserGuideorhit<F1>onthisscreen.ReverseEngineeringfromMicrosoftAccess®
Onthisfirstscreen, titledReverseEngineerWizard–Page1of5,click<Setup…>andchooseMSAccessDatabasefromtheUserDSN tab.UndertheDatasource:drop-down,chooseMSAccessDatabase.Click<Next>andtheSelectDatabasescreenappears.IuseanAccessdatabase tohandledatamodelingclass registration, so I selected thisAccess
fileonthisscreen,enteredtheusernameandpassword,andclicked<Next>toadvancetoPage2of theWizard.(Notethat inorder toreverseengineeradatabase,youmusthavebothCONNECT andRESOURCE roles assigned to your user ID for the database youwanttoaccess.)
Ikeptallof thedefault settingsonPage2.However, ifyouwould like toalsobring inSystemTables,makesurethisischeckedaswell.Click<Next>andPage3givesyoutheoptiontochoosewhichtablestoreverseengineer.Onceyouaredoneselectingthetables,click<Next>togotoPage4oftheWizard,showninFigure10.9.
Figure10.9Page4oftheReverseEngineerWizard
On this screen there are three sections, each distinguished by a blue arrow. The firstsectioncontainscheckboxesyoucanselectifyouwouldlikeER/Studiototakeaguessatwhat theprimaryand foreignkeys and indexes shouldbe if theyarenotdefined in thedatabase.Definitelychecktheseboxesifyoubelievethedatabasedoesnothavekeysorindexesdefinedanditisyourjobtobuildabettermodel.Thesecheckboxescangiveyouagreatheadstartonimprovingthemodel.Ininferringprimarykeys,ER/Studioexaminestheuniqueindexesonatable.Ininferringforeignkeys,youcanchoosewhethertohaveER/Studio look for indexes whose columns match the names, datatype properties, andcolumnsequencesofaprimarykeyorchoose tohaveER/Studio just infer foreignkeysfromnames. Ifyouchoose InferDomains,ER/Studio creates adomain for eachuniquecombinationofacolumnnameanditsassociateddatatypeproperties.Thesecondsection
onthisscreenallowsyoutoalsobringinotherstructuressuchasviewsandtriggers.Thethird sectionallowsyou todecidehow to arrange themodelonce it is brought into thetool.IkeptCircularcheckedandclicked<Next>togotoPage5oftheWizard,showninFigure10.10.
Figure10.10Page5oftheReverseEngineerWizard
On this screen you can decide whether the model should be reverse engineered usingrelational or dimensional structures and optionally apply a naming standard template tothe logical names. (More on naming standards in Chapter 14.) You can also save thesettingsyouhavechosenduringthisWizardasaQuickLaunch,meaningjustbyloadingtheQuick Launch file you can automatically apply the settings you chose during theWizard to save time in future reverse engineering efforts and also improve consistency.YoucanloadyoursavedQuickLaunchfileonPage1ofthisWizard.QuickLaunchwasdiscussedearlierinthischapter.Click<Finish>andthedatabasewillbeimported.ReverseEngineeringfromMongoDB®
Onthisfirstscreen, titledReverseEngineerWizard–Page1of5,click theConnectionType: Native/Direct Connection and choose MongoDB from the drop-down. Enter theDatasource,which in the case ofMongoDB is the host name of theMongoDB server.Alternately,usersmayspecifyaMongoDBconnectionURIinstandardformat.Ifyouareunsure of theMongoDBhost name, rungetHostName() at the commandprompt.Click<AdvancedOptions…>.ThescreeninFigure10.11appears.
Figure10.11MongoDBAdvancedLoginOptions
Choose theAuthentication Type.MongoDB-CR is the default setting and admin is thedefaultauthenticationdatabase(whichcanbechangedbyunclickingUseDefault).Usersmaychoose toencrypt theconnection toMongoDBwithSSLbychecking theUseSSLoption.
Click<OK>andthescreeninFigure10.12appears.
Figure10.12Page2oftheReverseEngineerWizard
Choose theobjectsyouwould like to include,and thenumberofMongoDBdocumentsthat shouldbe analyzed inorder to include all potential document fields and embeddeddocuments. Then click <Finish>. Then you can select the database you would like toreverseengineerandclick<Ok>.ReverseEngineeringfromHive®
Onthisfirstscreen, titledReverseEngineerWizard–Page1of5,click theConnectionType: Native/Direct Connection and choose Hive from the drop-down. Enter theDatasource,whichinthecaseofHiveisthehostnameoftheHiveserver.
Asyougothroughthewizard,youwillseemanysimilaritieswiththeMongoDBreverseengineer process including the option to choose which columns to skew and cluster(bucketing).
GeneratingaPhysicalDataModelfromaSQLFile
Menu Toolbar Explorer ShortcutKey
ShortcutMenu
File>New Application
toolbar:
n/a <CTRL+N>
or
<ALT+F>,then<N>
n/a
Followthesamestepsasintheprevioussectionforcreatinganewmodel.
YouwillseethescreeninFigure10.13.Thistime,choosetheImportModelFrom:radiobuttonandselectSQLFilefromthedrop-downlist.
Figure10.13NewModelScreen
Click <Import> and the screen in Figure 10.14 appears, which has most of the samesettingsthatwerediscussedwhenreverseengineeringanAccessdatabase.
On this screen, there are seven sections, each distinguished by a blue arrow. The firstsectioniswhereyouselecttheSQLfileyouwouldliketoimport.Thesecondsectioniswhereyouselectthetargetdatabaseplatform,andthethirdsectioniswhereyoucanaskER/Studiototakeaneducatedguessregardingwhattheprimaryandforeignkeysshouldbe, alongwith domains. If you choose InferDomains, ER/Studio creates a domain foreachuniquecombinationofacolumnnameanditsassociateddatatypeproperties.
Menu Toolbar Explorer ShortcutKey
ShortcutMenu
Database>GenerateDatabase… Right-clickonphysicaldatamodel,GenerateDatabase…
<ALT+B>,then<G>
Right-clickonmodelwhitespace,GenerateDatabase…
Figure10.14ImportDatabaseSQLFilescreen
Thefourthsectionallowsyoutochoosethelayoutinwhichtheimportedstructureswillbearranged, thefifthsectionwhetherrelationalordimensional,andthesixthsectiononwhether you want to use the Physical Parser, which if checked will apply a platform-specific syntax interpreter. The seventh section, when checked, will create customdatatypesforunsupportedtypes.Click<OK>andthefilewillbeimported.
GeneratingaDatabaseUsingER/StudioOnce the physical data is created, we can have ER/Studio generate the database. InExplorer,clickonthephysicaldatamodel.
I would like to generateMongoDB JSON code. Page 1 of 3 appears of the wizard asshowninFigure10.15.
Figure10.15Page1oftheDDLGenerationWizard
ThefilepathfortheDatabaseCreationScriptFileiswheretheJSONcodewillbestored.OnPage2of 3 you candecidewhich collections to generate.OnPage3of 3 you canfinalizethesettingsandthengeneratetheJSON.ThefieldnameswillappearintheJSONbutnotthefieldvaluesbecausethereisnodatastoredinER/Studio.Figure10.16containsanexampleoftheJSONthatwillappear.
Menu Toolbar Explorer ShortcutKey
ShortcutMenu
Clickontable,Edit>EditTable… n/a Right-clickontable,EditTable…
Clickontable,<ALT+E>,then<E>
Right-clickonentity,EditTable…
Figure10.16SampleJSONcode
EditingTablesThestepsforeditinganentityaresimilarforeditingatable:
TheTableEditorappearsasshowninFigure10.17.Manyofthesettingsherearesimilarto what appeared under the Entity Editor. This screen can be resized by clicking anddraggingthelowerrightcorner.Thisscreencanalsobemaximizedbyclickingthesquaresymbolintheupperrightcorner(totheleftofthe“x,”whichclosesthewindow)andthenreturned back to its original size by clicking the two square symbols in the upper rightcorner.
Tab Here’swhatyouneedtoknow:
Columns Create,edit,andarrangecolumns.
DDL Viewandedit theDataDefinitionLanguage(DDL).DDListhelanguagethatisusedtobuildthedatabasefromthePDM.
Indexes Viewthekeysthatwerecreatedonthecorrespondingtableinthelogicaldatamodelandalsoaddnewindexesthatwillbephysicalonly(suchasthoseaddedtoimproveretrievalperformance).
Figure10.17TableEditor
There are 17 standard tabs on this screen, each described in the following spreadsheet.There are also additional tabs displayed depending on the particular database you havechosen(e.g.,OraclewillhaveseveraldifferenttabsthanTeradata).
ForeignKeys View and edit the relationships that were created on the corresponding table in the logical datamodel.
Definition Thisiswherethefulldefinitionforthetableisstored.Ifthetargetdatabasesupportsit,ER/Studioadds thisdefinitionasa tablecommentwhengeneratingSQLcode.ThemacroDefinitionEditorallowsforeasilyenteringdefinitionsformultipleobjects.MoreonmacrosinChapter16.
Note Usethisforanyother textoutsidethedefinitionsuchasquestionstoaskbusinessexperts,knownissues,oractionitems.HTMLtagsusedinNoteswillbeappliedasformattingintheHTMLreports.ThemacroNotesEditor allows foreasilyenteringnotes formultipleobjects.Moreonmacros inChapter16.
WhereUsed Seewhichlogicalandphysicaldatamodelsandsubmodelscontainthetable.Fromthistabyoucaneditmappingsanduser-definedmappings.
Storage Definetable-specificparameters,suchasextentsandtablecompression,thatwillbeusedwhenthistableiscreatedinthedatabase.
Constraints Aconstraintisarulethatischeckedbeforedataisallowedinthedatabase.Foratableinstance(alsocalledarecord),thesearerulesthatcanbecreatedandeditedtodeterminewhatcanbeaddedtothedatabasetable.TheseconstraintsbecomepartoftheSQLusedtobuildthetable.
Dependencies Displaystheviewsandotherdatabase-specificobjectsthatdependuponthistable.
CapacityPlanning Setthevolumetricsinformationsuchasthenumberofinitialrowsthetablewillcontainandtablerateofgrowth.
Permissions Selectdetailedpermissions(e.g.,insert,select,update,anddelete)forusersandrolesforthistable.Thisisatabthatwouldbeusedinthephysicaldatamodelandnotthelogicaldatamodel.
NamingStandards Allowsyoutoapplydifferentnamingstandardstodifferentobjectswhenportionsofamodelrequiredifferent versionsof a standard.For example, someobjects already exist in thedatabase andyoumaynotwanttoapplyanewernamingstandardtothem.TheFreezeNamesoption,whenselected,prevents any naming standards applied to the model from changing the name of the attributeselected.We’lltalkmoreaboutthistabinChapter14,NamingStandards.
CompareOptions Select which, if any, properties (e.g., table name, definition, notes) of the table to ignore whencomparing this table toanotherusing theCompareandMergeUtility,whichwill be discussed inChapter15.
DataLineage Map the rules fromsource to target tables in themodel.We’ll cover this tab inChapter12, DataLineage.
SecurityInformation You can assign security settings that are defined in the Data Dictionary to this table. The DataDictionarywillbediscussedinChapter11.
AttachmentBindings Bindanexternalpieceofinformation,suchasaMicrosoftWorddocumentorPDFfile,tothetable.Very useful for requirements documents, user stories, etc. Attachments are created in theAttachmentsfolderoftheDataDictionary(discussedinChapter11)andmustbeaddedtothemodelbeforetheywilldisplayonthistab.
CustomizingDatatypeMapping
Menu Toolbar Explorer ShortcutKey
ShortcutMenu
Tools>DatatypeMappingEditor n/a n/a <ALT+T>,thenchooseDatatypeMappingEditor
n/a
BecomeanER/StudioHotshot:
Themappingchangesyoumakewillonlybeeffectivefornewphysicaldatamodelsyougenerate,andnotexistingones.
When you generate the physical data model from the logical data model, the logicalformats and lengths are converted into database-specific formats and lengths. Forexample,alogicalattributedefinedasintegermaybeconvertedintothenumberformatinOracle. When you set the physical database option (such as to Oracle or Teradata), adefaultmappingconvertsallofthelogicalformatsandlengthstophysical.
Youcan,however,changethisdefaultmappingbyusingtheDatatypeMappingEditor.
ThescreeninFigure10.18appearswhereyoueditthedata-type.
Figure10.18DatatypeMappingEditor
Denormalization
Denormalization is the process of selectively violating normalization rules andreintroducing redundancy into the model (and, therefore, the database). This extraredundancycanreducedataretrievaltime,whichistheprimaryreasonfordenormalizing.We can also denormalize to create amore user-friendlymodel. For example,wemightdecide to denormalize company information into an entity containing employeeinformation because usually when employee information is retrieved, companyinformationisalsoretrieved.
Thereareanumberofdifferentwaystodenormalize.Inthissection,we’lldiscussthetwomost common, Rolldown and Rollup. We will apply these two techniques to anOffering/Category subsetofourpublisher logicaldatamodel.SeeFigure10.19 for thestarting point logical forOffering andCategory and their physical counterparts usingeachofthesetwotechniques.
OurNormalizedStartingPoint:
RolldownDenormalization:
RollupDenormalization:
Figure10.19OfferingandCategorylogicalwithtwodifferentphysicaldesigns
RolldownDenormalization
Rolldownisthemostcommonofthedenormalizationtechniques.Theparententityintherelationshipdisappears,andalloftheparent’scolumnsandrelationshipsaremoveddowntothechildentity.You’llrecallthatthechildentityisonthemanysideoftherelationshipandcontainsaforeignkeybacktotheparententity,whichappearsontheonesideoftherelationship.
Inadditiontochoosingdenormalizationbecauseoftheneedforfasterretrievaltimeorformoreuserfriendlystructures,rolldowncanbechoseninthefollowingsituations:
Whenyouneedtomaintaintheflexibilityofthenormalizedmodel.Foldingthecolumnsandrelationshipstogetherusingrolldownstillallowsone-to-oneandone-to-manyrelationshipstobestored(butnotenforcedinthedatabase).InFigure10.19,forexample,wedidnotlosetheflexibilitythatanOfferingcanbelongtomanyCategories.Whenyouwanttoreducedevelopmenttimeandcomplexity.Oftenthereisadirectrelationshipbetweenthenumberoftablesandrelationshipsonamodelandtheamountofeffortitwilltaketodeveloptheapplication.Adeveloperwillneedtowritecodethatjumpsfromonetabletoanothertocollectcertaincolumns,andthiscantaketimeandaddcomplexity.Denormalizingintofewertablesusingrolldownmeansthecolumnsandrelationshipsfromdifferententitiesnowexistinthesameentity.InFigure10.19,forexample,ifthedeveloperneedstoretrievebothofferinginformationandthecategoryname,theycaneasilydosofromthesameentity,Assignment.
RollupDenormalization
Inrollup,thesamecolumnorgroupofcolumnsisrepeatedtwoormoretimesinthesameentity.Alsoknownasanarray,rolluprequiresmakingthenumberoftimessomethingcanoccurstatic.Recallthatin1NFweremovedrepeatinggroups;rollupmeansweareaddingback in repeating groups. We had to decide in Figure 10.19, for example, that themaximumnumberofcategoriesanofferingcanbeassignedisthree.
Inadditiontochoosingdenormalizationbecauseoftheneedforfasterretrievaltimeorformoreuserfriendlystructures,repeatinggroupsmaybechoseninthefollowingsituations:
Whenitmakesmoresensetokeeptheparententityinsteadofthechildentity.Whentheparententityisgoingtobeusedmorefrequentlythanthechildentity,oriftherearerulesandcolumnstopreserveintheparententityformat,itmakesmoresensetokeeptheparententity.Whenanentityinstancewillneverexceedthefixednumberofcolumnsadded.InFigure10.19,weareonlyallowinguptothreecategoriesforanoffering.Ifwehadafourthcategoryforanoffering,forexample,howwouldwehandlethis?
StarSchema
Denormalization is a term that is applied exclusively to relational physical datamodelsbecauseyoucan’tdenormalizesomethingunlessithasalreadybeennormalized.However,denormalizationtechniquescanbeappliedtodimensionalmodelsaswell—youjustcan’t
use the termdenormalization.So the relational term rolldown, for example, can still beapplied to a dimensionalmodel; we just need to use a different term like flattening orcollapsing.
Astarschemais themostcommondimensionalphysicaldatamodelstructure.Thetermmeterfromthedimensionallogicaldatamodelisreplacedwiththetermfacttableonthedimensionalphysicaldatamodel.Astarschemaresultswheneachsetoftablesthatmakeupadimensionisflattenedintoasingletable.Thefacttableisinthecenterofthemodel,and each of the dimensions relate to the fact table at the lowest level of detail. A starschema is relatively easy to create and implement, and it visually appears simplistic tobothITandthebusiness.
Recall the dimensional logical datamodel example from Figure 10.2, repeated here inFigure10.20.
Figure10.20FinancialdimensionalPDM
A star schema is when each hierarchy is flattened into a single table. So on this starschema,CustomerisflattenedintoAccount,CountryisflattenedintoRegion,andYearisflattenedintoMonth.
DenormalizinginER/Studio
Menu Toolbar Explorer ShortcutKey ShortcutMenu
Model>DenormalizationMapping>RollupsorRolldowns
Modelingtoolbar: n/a <ALT+M>,then<Z>,theneither<R>forRollupsor<O>forRolldowns
Right-clickononeofhighlightedentities,DenormalizationMapping>RollupsorRolldowns
ER/Studio comes equipped with denormalization wizards to help you optimize thephysical design. The wizards automate the denormalization process and keep the tiesbetweenthephysicaltablesandthelogicalentities.Thedenormalizationwizardsavailabledependonwhich tablesare selected.Forexample, if two tables that are related toeachotherareselected,thevalidoperationswouldberollupsorrolldowns.
To bring up the denormalization wizard, highlight those entities you would likedenormalizedonthephysicaldatamodelanddecidewhetheryouwouldliketorolluporrolldown.
We saw examples of rolldown and rollup in the previous section where we combinedentities thathadaone-to-manyrelationship.Wecanalsoapplyrolldownandrolluptoasubtyping structure. The subtyping structure needs to be resolved on the physical datamodel as there is no subtyping relationship defined in a relational database. There arethree ways of resolving the subtyping symbol on the physical data model: identity,rolldown, and rollup.All three types, alongwith the original subset from the publisherlogicaldatamodel,areshowninFigure10.21.
Identityisthestartingpointwhenwefirstgeneratethephysicalfromthelogical.Identityistheclosesttosubtypingitselfbecausethesubtypingsymbolisreplacedwithaone-to-onerelationshipforeachsupertype/subtypecombination.Wedidnotdenormalizeyet,andidentitymaypossiblybethefinalphysicalstructureaswemaynotneedtodenormalize.Themainadvantageofidentityisthatallofthebusinessrulesatthesupertypelevelandatthesubtypelevelremainthesameasinthelogicaldatamodel.Thatis,wecancontinuetoenforce relationships at the supertype or subtype levels as well as enforce that certaincolumnsberequiredatthesupertypeorsubtypelevels.IdentityallowsustostillrequirethePrintVersionWeightAmountforprintversionsandtheeBookDownloadSizeforebooks, forexample.Themaindisadvantageof identity is that it can takemore time toretrieve data as it requires navigatingmultiple tables to access both the supertype andsubtypeinformation.
Recall that rolldownmeanswearemoving theattributesand relationshipsof theparententitydown to the child entity. In the caseof subtyping, thismeanswearemoving thesupertype’sattributesandrelationshipsdownintoeachofthesubtypes.Rollingdowncanproduce amore user-friendly structure than identity or rolling up, because subtypes areoftenmoreconcreteconcepts thansupertypes,making it easier for theusersof thedatamodel to relate to the subtypes. However, we are repeating relationships and columns,whichcouldreduceanyuser-friendlinessgainedfromremovingthesupertype.Inaddition,therollingdowntechniqueenforcesonly thoserulespresent in thesubtypes.Thiscould
OriginalLogical Identity
Rolldown Rollup
also lead to a less flexible data model as we can no longer easily accommodate newsubtypeswithoutmodifyingthedatamodel.IfanewtypeofTitleisrequiredinadditiontoPrintVersionandeBook,thiswouldrequireefforttoaccommodate.
Figure10.21OriginalLDMsubtypingstructureplusthreewaysofresolvingonthephysical
Rollup means rolling up the child entity into the parent. With subtyping, this meansmoving the subtypes’ attributes and relationships up into the supertype. The subtypesdisappear,andallcolumnsandrelationshipsonlyexistatthesupertypelevel.Rollingupaddsflexibilitytothedatamodelbecausenewtypesofthesupertypecanbeadded,oftenwithnomodelchanges.However, rollingupcanalsoproduceamoreobscuremodelastheaudiencefor themodelmaynot relate to thesupertypeaswellas theywould to thesubtypes. Inaddition,wecanonlyenforcebusiness rulesat the supertype level,not thesubtype level. For example, now Print Version Weight Amount and the eBookDownloadSizeareoptionalinsteadofrequired.Whenwerollup,weoftenneedawaytodistinguish the original subtypes from each other, sowe frequently add a type columnsuchasTitleTypeCode.
EXERCISE10.1:DenormalizingForthisexercise,createallfourofthemodelsfromFigure10.21.Firstcreatethelogicalandthengeneratethreedifferentphysicaldatamodels:identity,rolldown,androllup.
Views
Aview isavirtual table. It isadynamic“view”orwindowintooneormore tables (orother views) where the actual data is stored. A view is defined by a SQL query thatspecifieshowtocollectdatafromitsunderlyingtables.ASQLqueryisarequest thatauser(orreportingtool)makesofthedatabasesuchas“BringmebackallCustomerIDswhere theCustomer is 90 days ormore behind in their bill payments.”The differencebetween a query and a view, however, is that the instructions in a view are alreadypreparedfortheuser(orreportingtool)andstoredinthedatabaseasthedefinitionoftheview,whereasaqueryisnotstoredinthedatabaseandmayneedtobewritteneachtimeaquestionisasked.
Figure 10.22 contains a view ofAssignment andCategory to create a simple way todisplayofferingsalongwiththeirassignedcategories.
OfferingName CategoryName
TheDAMA-DMBOKPrintEdition DAMA-DMBOK
TheDAMADictionaryofDataManagement2ndEdition,PrintFormat
DAMA-DMBOK
PortugueseVersionofDAMA-DMBOK DAMA-DMBOK
DataModelingMasterClass–Spring2015 PublicSeminars
Figure10.22Viewcreatingalistingofofferingswiththeircategories
BehindthisviewisthefollowingSQLqueryneededtoretrievetheauthorsandtheirtitles:
CREATEVIEW“OfferingCategoryView”ASSELECTAssg.”OfferingName”,Ca.”CategoryName”FROMAssignmentAssg,CategoryCaWHEREAssg.”CategoryName”=Ca.”CategoryName”ORDERBYAssg.”CategoryPriorityNumber”DESCHereisasampleoftheresultsreturned:
ViewsinER/StudioTo create a view, first create the view box and then relate this box to its underlyingentities.Tocreateaviewbox,chooseoneoftheseoptions:
Menu Toolbar Explorer ShortcutKey
ShortcutMenu
Insert>View Modelingtoolbar: Right-clickonViews,NewView…
<ALT+I>,then<V>
Right-clickonwhitespace,InsertView
BecomeanER/StudioHotshot:
ER/Studiosupports“stickybuttons,”meaningyoucancreatemanyoccurrencesofanobjectandthen,whenyouaredone,right-clickonanywhitespacetoreturnthecursortothedefaultselectorsymbol.Thestatusbaratthebottomofthescreenshowsthenumberofviewsinthemodelorsubmodel.YoucanhideorshowthisstatusbarusingView>StatusBaror<ALT+V>then<S>.
Menu Toolbar Explorer ShortcutKey ShortcutMenu
Insert>Relationship>ViewRelationship Modelingtoolbar: n/a <ALT+I>,then
<R>,then<V>Right-clickonwhitespace,InsertRelationship>ViewRelationship
BecomeanER/StudioHotshot:
Viewrelationshipscannotbeedited,buttheycanbedeleted.Youcancreatemorethanonerelationshipfromthesametabletotheview.Doingsoautomaticallycreatesanaliasfortheparenttablethatisreplicatedmorethanonceintheview.
ChooseView>DiagramAndObjectDisplayOptionsorclickontheicon andthenexperimentwiththedisplaylevelsettingsontheViewtab.
Menu Toolbar Explorer ShortcutKey
ShortcutMenu
Clickonview,Edit>EditDatabaseView… n/a Right-clickonview,Edit>EditDatabaseView…
Clickonview,<ALT+E>,then<E>
Right-clickonview,EditDatabaseView…
Torelate thisview to itsunderlyingentities,youwillneed tocreateaviewrelationshipfromeachoftheentitiesthatareneededfortheview,totheviewbox.Chooseoneoftheseoptions:
WecanbringuptheViewEditortomodifytheview.
Afterapplyingoneofthesecommands,theViewEditorappears(seeFigure10.23).ThisistheplacetomodifytheSQLquerythatgeneratestheview.
Thisscreencanberesizedbyclickinganddraggingthelowerrightcorner.Thisscreencanalsobecomemaximizedbyclickingthesquaresymbolintheupperrightcorner(totheleft
Tab Here’swhatyouneedtoknow:
Table Decidewhichtablesareneededfortheview.Therearefourarrowbuttonsthatallowyoutoselectsingletablesoralltablesandremovesingletablesoralltables.
Column Decidewhichcolumnswithinthetablesyouselectedyouwouldlikeintheview.Youalsohavetheoptiontoresequencethecolumns,giveeachcolumnanalias(adifferent,usuallysimpler,name—very useful when the same column can appear multiple times in the view), and add columnexpressionsforsituationswhenthecolumndidnotexistinoneofthesourcetablessuchasaderivedcolumnforsalesamount.ThistabdefinestheSELECTpartoftheSQLquery.
ofthe“x,”whichclosesthewindow)andthenreturnedbacktoitsoriginalsizebyclickingthetwosquaresymbolsintheupperrightcorner.
Figure10.23ViewEditorscreen
Thereare15tabsonthisscreen:
Where Optionallyaddconditionsthatmustbemettobringbackrecordsinthisquery.ThistabdefinestheWHEREpartoftheSQLquery.
GroupBy Optionallydecidehowyouwouldliketherecordstobeorganized.ThistabdefinestheGROUPBYpartoftheSQLquery.
Having IfyoudidaGROUPBY,youcanrestricttheresultsreturnedintheGROUPBYconditionbyusingaHAVINGclause.ThistabdefinestheHAVINGpartoftheSQLquery.
DDL DefinestheDataDefinitionLanguage(DDL)fortheviewSQLquery.TheDDLgivesthedatabasesoftware(e.g.,Oracle,Teradata,etc.),theinstructionsonhowtobuildthedatabase,andinthiscasehowtobuildtheview.YoucandisplayandedittheSQLqueryhere.
Options Sortthecolumnsalphabetically.
Definition Thisiswherethefulldefinitionfortheviewisstored.Ifthetargetdatabasesupportsit,ER/StudioaddsthisdefinitionasaviewcommentwhengeneratingSQLcode.
Notes Usethisforanyother textoutsidethedefinitionsuchasquestionstoaskbusinessexperts,knownissues,oractionitems.HTMLtagsusedinNoteswillbeappliedasformattingintheHTMLreports.
WhereUsed See which physical data models and submodels contain the view. From this tab you can editmappingsanduser-definedmappings.
Dependencies Create, edit, or delete any scripted procedures that are bound to the view. If any procedures orfunctionsareboundtotheview,thefolderisexpandable.
PreSQL&PostSQL EnterSQLtobeappliedbefore(PreSQL)orafter(PostSQL)theCREATEOBJECTstatement.
Permissions Selectdetailedpermissions(e.g.,insert,select,update,anddelete)forusersandrolesforthisview.
SecurityInformation Assign security settings that aredefined in theDataDictionary to thisview.TheDataDictionarywillbediscussedinChapter11.
AttachmentBindings Bindanexternalpieceofinformation,suchasaMicrosoftWorddocumentorPDFfile,totheview.Very useful for requirements documents, user stories, etc. Attachments are created in theAttachmentsfolderoftheDataDictionary(discussedinChapter11)andmustbeaddedtothemodelbeforetheywilldisplayonthistab.
EXERCISE10.2:CreatingViewsCreatetheviewalongwithSQLstatementfromFigure10.22.
Indexing
An index is a value and a pointer to instances of that value in a table. In Chapter 6,Attributes andDomains,we talked about and created primary keys, alternate keys, andinversion entries. Primary keys, alternate keys, and inversion entries are converted intoindexesonthephysicaldatamodel.Primaryandalternatekeysareconvertedintounique
Menu Toolbar Explorer ShortcutKey
ShortcutMenu
Clickontable,Edit>EditTable… n/a Right-clickontable,EditTable…
Clickontable,<ALT+E>,then<E>
Right-clickonentity,EditTable…
indexes,andinversionentriesareconvertedintonon-uniqueindexes.
IndexinginER/StudioYou can create additional indexes on the physical data model, both unique and non-unique.
GototheIndexes tabtoviewtheindexesthatmigratedfromthelogicaldatamodelandalso to add more indexes by clicking the <ADD> button. The screen in Figure 10.24appears.
Figure10.24IndexEditor
Name the indexandoptionallydecidewhether it shouldonlyexiston thephysicaldatamodel(bycheckingPhysicalOnly)andwhetheritisauniqueindex(bycheckingUniqueConstraint).Youcanthenhighlightthosecolumnsyouwouldlikeintheindexandclickthe<ADD>button. Ifyouhavemore thanonecolumn inan index (calleda compositeindex),youcanresequencethecolumnsintheindexusingthe<UP>and<DOWN>arrowkeys. It is important toarrange thecolumns inasequence that theywillbeaccessedbymost often. For example, if we add an index on first name and last name columns, it
wouldbeimportanttoknowhowthesecolumnsareaccessedmostfrequently—eitherbyfirstnamefirstorlastnamefirst.Thisishowweshouldsequencethecolumns.
EXERCISE10.3:IndexingIn Figure 10.25 you can see that we added a non-unique index (inversion entry) onOfferingNameandOfferingPriceAmount.Createthisindexonyourmodel.
Figure10.25Non-uniqueaddedtomodel
Note that if the index is not displaying on the model, make sure the Inversion Entrycheckbox is checked under Diagram and Object Display Options (choose View >DiagramAndObjectDisplayOptionsorclickontheicon ),andintheTabletab,clickonInversionEntry.
PartitioningPartitioning iswhen a table is split up into two ormore tables. Vertical partitioning iswhencolumnsaresplitup,andhorizontaliswhenrowsaresplitup.Itiscommonforbothhorizontalandverticaltobeusedtogether.Thatis,whensplittingrowsapartweinmanycaseslearnthatcertaincolumnsonlybelongwithonesetofrows.
Bothverticalandhorizontalpartitioningarecommontechniqueswhenbuildinganalyticssystems.Atablemightcontainalargenumberofcolumnsandperhapsonlyasubsetarevolatileandchangeoften,sothissubsetcanbeverticallypartitionedintoaseparatetable.Orwemighthave tenyearsoforders ina table,and to improvequeryperformancewehorizontally partition by year so that when queries are run within a given year theperformancewillbemuchfaster.
Partitioningcanbeusedas a reactive technique,meaning that evenafter an applicationgoeslive,thedesignermightchoosetoaddpartitioningaftermonitoringperformanceand
Menu Toolbar Explorer ShortcutKey ShortcutMenu
Model>DenormalizationMapping>HorizontalSplits…
Modelingtoolbar: Right-clickontable,DenormalizationMapping>HorizontalSplits…
<ALT+M>,then<Z>,then<H>
Right-clickonentity,DenormalizationMapping>HorizontalSplits…
spaceanddeterminethatanimprovementisneeded.
PartitioninginER/StudioTocreateahorizontalpartition,highlighttheentityandchooseoneoftheseoptions:
IwouldliketocreateahorizontalpartitiononAssignmentfromFigure10.25,whereweput offerings less than $10 in one partition and offerings $10 or higher in a secondpartition.
Afterstartingthewizard,thescreeninFigure10.26appears,andIselecttwosplits(oneforofferingslessthan$10andtheotherforofferings$10orgreater).
Figure10.26Page1of4oftheHorizontalSplitWizard
Iclick<Next>,andI’mthengiventheoptionofchangingthetablenamesonPage2oftheWizard.IchoseLessThan10and10orMoreasthetwotablenames.SeeFigure10.27.
Figure10.27Page2of4oftheHorizontalSplitWizard
Iclick<Next>,andinPage3I’mgiventheoptiontoremovecertainrelationshipsfromcertainpartitions.Iwillkeepalloftherelationshipsintact.SeeFigure10.28.
Figure10.28Page3of4oftheHorizontalSplitWizard
Iclick<Next>,andinPage4I’mgiventheoptiontonamethisHorizontalsplit.IcallitSplitBasedOnPrice.SeeFigure10.29.
Menu Toolbar Explorer ShortcutKey Shortcut
Figure10.29Page4of4oftheHorizontalSplitWizard
Iclick<Finish>toexitthewizard.AnoteappearsthatIneedtofixtheSQLfortheviewcreatedbecausetheviewisnowreferencingthepre-splittable.Thisisaneasyfixinthevieweditor.ThemodelinFigure10.30appears.
Figure10.30HorizontalSplitbasedonprice
Tocreateaverticalpartition,chooseoneoftheseactions:
Menu
Clickontable,Model>DenormalizationMapping>VerticalSplits…
Modelingtoolbar: Right-clickontable,DenormalizationMapping>VerticalSplits…
Clickontable,<ALT+M>,then<Z>,then<V>
Right-clickonentity,DenormalizationMapping>VerticalSplits…
The Vertical Split Wizard is identical to the Horizontal Split Wizard, with theexceptionofPage2ofthewizard,whereyoucanclickanddragcolumnstothetablesforassignment.
EXERCISE10.4:PartitioningCreatethehorizontalsplitasshowninFigure10.30.Ifyouarefeelingadventurous,playwithverticalpartitioningaswell.
EXERCISE10.5:TracingfromPhysicalBacktoLogical
Oneof theneatfeatures inER/Studio is theability toeasilyperformimpactanalysisbytracingtablesbacktoothertablesandalsobacktotheirlogicaldatamodelentitythroughtheWhereUsedtabintheTableEditor.Forthisexercise,playwiththisfeature,andwhileyoudo,thinkofallofthepossibleusesfortablelineage.Whatanawesomefeature!
KeyPointsThephysicaldatamodel(PDM)isthelogicaldatamodelcompromisedforspecificsoftwareorhardware.
InER/Studio,thephysicaldatamodelmustbebasedonanexistinglogicaldatamodelorreverseengineeredfromanexistingdatabase(suchastheactualdatabaseoradatadefinitionlanguagesuchasSQL).
Denormalizationistheprocessofselectivelyviolatingnormalizationrulesandreintroducingredundancyintothemodel(and,therefore,thedatabase).
Astarschemaiswheneachsetoftablesthatmakeupadimensionisflattenedintoasingletable.
Aviewisavirtualtable.Itisadynamic“view”orwindowintooneormoretables(orotherviews)wheretheactualdataisstored.
Anindexisavalueandapointertoinstancesofthatvalueinatable.
Partitioningiswhenatableissplitupintotwoormoretables.Verticalpartitioningiswhencolumnsaresplitup,andhorizontaliswhenrowsaresplitup.
ER/Studiosupportsforwardandreverseengineeringofbothrelational(e.g.,Oracle,Teradata)andNoSQLdatabases(e.g.,MongoDB,Hive).
SECTIONIVAdditionalER/StudioFeatures
Section IV discusses additional features of ER/Studio. Chapter 11 covers the datadictionary;Chapter12,data lineage;Chapter13, import,export,printing,andreporting;Chapter 14, naming standards; Chapter 15, the compare and merge functionality; and
Chapter16,severalfeaturesforagileteamsandcontinuousimprovement.PleaserefertotheER/StudioUserGuide forother featuresavailable inER/Studioaswell as formoredetailsoneachoftheadditionalfeaturesdiscussedinthissection.
CHAPTER11DataDictionary
Menu Toolbar Explorer ShortcutKey
ShortcutMenu
File>ImportDataDictionary n/a n/a <ALT+F>,then<Y>
n/a
BecomeanER/StudioHotshot:
TheNorthwinddatamodelthatshipswithER/Studiohasafantasticdatadictionary.YoucanopenanydatamodelandimporttheNorthwinddatadictionary,whichisintheSampleDataModelsfolder.
Importanttoshare,Enterpriseconsistency,Savetimeandeffort
TheDataDictionary is a feature of ER/Studio that allows the sharing ofmany objectsincludingdomains,defaults,rules,andattachments.IfyouareusingtheRepository,youcansharethedatadictionaryacrossyourorganization.Objectsinthedatadictionarycanbe imported into your data model, saving time and leading to greater enterpriseconsistency. If you are not using the Repository, you can still import data dictionaryobjectsfromanotherER/Studiofileintoyourdatamodel.
Inthischapter,weassumeyouarenotusingtheRepositoryandthereforewillexplainhowtoimportadatadictionaryintoER/Studio.Iwillprovideanoverviewtoseveraltypesofobjects that can be imported from a data dictionary including domains, user datatypes,referencevalues,andattachments.Additionaltypesofobjectscanbeimportedaswellbutareoutsidethescopeofthischapter.
ImportingaDataDictionaryIf you are not using the Repository, you can still import data dictionary objects fromanotherER/Studio file intoyourcurrentER/Studio file.Anychangesyoumake toyourlocal data dictionary objects, however, will not be propagated back into a central datadictionary,whichisonlypossiblewhenusingtheRepository.
When you import a data dictionary, the new objects aremergedwith the existing datadictionaryinyourdatamodel.Youcanimportthedatadictionaryofanotherdatamodeldiagram(.dm1file),whichcansaveyoumodeling timeand increaseconsistencyacrosstheenterprise.
Youcancopydatadictionaryobjectssuchasdomainsfromonedictionarytoanother.Justright-clickontheobjectyouwouldliketocopy,selectCopyDictionaryObjects,locatethetargetdatadictionary,andthenright-clickonanynodeandselectPasteDataDictionaryObjects.
Uponexecutingoneofthesecommands,thescreeninFigure11.1appears.
Figure11.1Importdatadictionaryoptions
TotherightoftheFileLocationtextbox,selectthebuttonwiththethreedotsandchoosethe ER/Studio filewhose data dictionary youwould like to import. You can select theNorthwind datamodel from the SampleDataModels folder. If there aremultiple datadictionariesassociatedwiththedatamodelyouselected,choosetheoneyouwouldliketoimport from theDataDictionary drop-down. In the case of theNorthwind datamodel,thereisonlyonedatadictionary,soitisalreadyselectedandgrayedouttoindicateitwillbeimported.
IntheResolveImportedObjectswithDuplicateNamessectiononthisscreen,choosehowyouwanttohandlenameduplicationsbyselectingoneoftheoptionslisted.Forexample,if you currently have the domainCity in your existing model, and the imported datadictionarycontainsaCitydomainaswell,choosingRenameimportedobjectswith ‘_1’will rename the importedCity domainCity_1, choosing Update existing objects withimporteddatawillupdatetheCitydomaininyourmodelwiththeimportedCitydomain,andchoosingSkipimportofduplicateobjectwillnotbringintheCitydomainfromtheimporteddatadictionary.Afterchoosingoneofthesethreeoptions,click<OK>.ClickontheDataDictionarytabonthebottomoftheExplorerpane(asshowninFigure11.2)andyouwillseewhatwasimported.
Figure11.2ImporteddatadictionaryfromNorthwinddatamodel
TypesofObjectsImportedfromaDataDictionaryThereareseveraltypesofobjectsthatareimportedintoyourdatamodelwhenimportingadata dictionary including domains, user-defined datatypes, reference values, andattachments.
Domains
RecallourdefinitionofadomainfromChapter6:Adomainisasetofvalidationcriteria
Menu Toolbar Explorer ShortcutKey ShortcutMenu
n/a n/a Right-clickonDomains(oronadomainfolder)thenchooseNewDomain
n/a n/a
BecomeanER/StudioHotshot:
Tocreateanewfolderfordomains,right-clickonDomainsoranydomainfolder,andchooseNewFolder.Domainscanbedraggedanddroppedintoanentitytocreateanewattributewiththisassigneddomain.Toeditadomain,double-clickonitsnameinExplorertolaunchtheeditor.
thatcanbeappliedtomorethanoneattribute; itprovidesameansofstandardizingthecharacteristicsoftheattributes.
Creating a domain allows you to define the object once and then use it repeatedly byapplying the domain to attributes. You construct domains as you would attributes,specifyinganame,datatypeproperties,nullstatus,defaultvalues,andvalidationrules.Bydefining a domain, you also gain the power of propagating changes to the underlyingdomaindefinitiontoallattributesthatreferenceit.Forexample,ifyoumakeanychangesto thedomainCity, thenallattributes thatuse thisdomainwillnowreflect theupdatedCitydomain.
ER/Studioallowsyou toorganizeyourdomainsusingdomain folders.Youcanclassifydomains in unique groups by creating different domain folders such as domains formeasures,names,IDs,etc.Whenyoudeleteadomainfolder,alldomainsandsubfolderswithin that folder are also deleted.Domain integrity refers to the rules governingwhatvaluesanattributecanbeassigned.Byrestrictingandvalidatinganattribute’svalues,youcan implement important business rules such as ensuring that a checking accountmaintainsapositivebalanceorpreventingtheentryofinvalidphonenumbers.
DomainsinER/Studio
Domainsarecreatedandmanagedinthedatadictionary.Youcandefinedomainstocreate“templates” or reusable attributes.For example, a domainBusinessDate can be createdfor attributes that are constrained by a business date such as Order Entry Date orEmployeeHireDate.Referencevalues,defaults,andrulescanbeimplementeddirectlyonadomain.Forexample,wecansetthedefaultvalueofMondaytoBusinessDate.
DomainsappearundertheDataDictionarytabinExploreraswasseeninFigure11.2.Tocreateanewdomain,usethefollowingcommand:
TheAddDomainscreenappearsasinFigure11.3.
Tab Here’swhatyouneedtoknow:
Datatype Definetheformatandwhetherthedomainisrequired(allownullsequalsNo)ornotrequired(allownullsequalsYes).Ifyouselectadata typethatcanbeusedasasurrogatekey,suchasTINYINT,you can click on Identity Column and choose the starting value (Seed) and the increment value(Increment).
Default EnteradefaultvalueforDeclarativeDefaultorchooseanotherdefaultfromtheDefaultBindinglist.Youwillseeadefaultinthedrop-downwhenadefaultvaluehasbeenboundtothedomain(DataDictionary>Defaults>EditDefaultDefinition>Binding Information).ThedefaultsyouchoosewillappearintheSQLproducedwhenyouselectGenerateDatabasefromthephysicaldatamodel.
Rule/Constraint SimilartotheDefaulttab,youcanaddacheckconstraintorchooseavaluefromthedrop-downif
Figure11.3AddDomainscreen
EnteradomainnameintheDomainNametextbox.IchoseBusinessDate.Youwillalsoneed to give the domain an attribute and column name.The attribute namewill be thenamechosenwheneverthisdomainisusedtocreateanewattributeinthelogicalmodel.Thecolumnnamewillbeappliedsimilarlyinthephysicalmodel.Thenamemaybethesameasthedomainname,ifyouwish.
ClickingonReceiveParentModificationsmeans that if there is a parent domain to thedomainwe are creating, changes to this parent domainwill also be applied to the newchilddomain.
ClickingonSynchronizeDomain andAttribute/ColumnNamesmeans that the domain,attribute,andcolumnnameswillallbethesame.Therefore,ifyouentereddifferentnamesin the Domain, Attribute, and Column fields on this screen, clicking this synchronizecheckboxwillmakeallofthenamesthesame.
TheApplynullabilitytoallboundcolumnscheckboxbecomesavailablewhenyouselectadatatypethatcanhavenulls;youcanchoosetodisallownullsbyclickingNoforAllowNulls.Therearetentabsonthisscreen:
onehasalreadybeendefinedinthedatadictionary.Thisisatabthatwouldbeusedforcolumns,notforattributes.
ReferenceValues Bindreferencevaluestothedomain.Referencevaluesareattributesthatdefinealloweddatavalues.We’lltalkaboutreferencevaluesshortly.Youcanchooseareferencevaluefromthedrop-downlistifyouwouldlikethedomainconstrainedbyspecificvaluessuchaspostalcodesorcurrencies.
NamingStandards When aNaming Standards Template is bound to a domain, that template overrides the NamingStandardsTemplateselected in theNamingStandardsUtilityor theGeneratePhysicaldatamodelutility.Thisallowsyoutoapplydifferentnamingstandardstodifferentobjectswhenportionsofamodel require different versions of a standard. For example, if some objects already exist in thedatabaseandyoudonotwanttoapplyanewernamingstandardtothem.
Definition Definethedomain.
Note Captureanyothertextoutsidethedefinitionsuchasquestionstoaskbusinessexperts,knownissues,oractionitems.UsingHTMLtagsinNoteswillgetappliedasformattingintheHTMLreports.
OverrideControls Controls what can or cannot be overridden on attributes bound to this domain. The GeneralOverrides area contains allow/disallowoptions fordatatypes,defaults, etc.Name Synchronizationcompletelydetaches thedomainname from thebound attributes.Bydetaching thedomainname,you can change the domain namewithout impacting the names of the attributes assigned to thisdomain. Attachment Synchronization keeps attachments in the domain in sync with the boundattribute.Anyattachmentsaddedtoadomainwillpropagatetotheattributes.Youcanstilladdotherattachmentsdirectlytotheattributes.
AttachmentBindings Bind an external piece of information, such as a Microsoft Word document or PDF file, to thedomain.Veryuseful for requirementsdocuments,user stories, etc.Attachments are created in theAttachmentsfolderofthedatadictionaryandmustbeaddedtothemodelbeforetheywilldisplayonthistab.
BindingInformation Selecttheobjectclassesand/orspecificobjectstowhichyouwanttobindthisattachment.Youcanoverridethissettingbyusingtheattributetaboftheentity.
Click<OK>tosaveyourchangesandexittheeditor.
EXERCISE11.1:CreatingDomains
Createanamedomainandassignittoallattributesinourpublishingdatamodelthatarenames:OfferingName, CategoryName, Speaker FirstName, SpeakerLastName,andConferenceHotelName.
User-DefinedDatatypes
Auser-defineddatatype isacombinationof formatand length thatyoucandefineonceandusemanytimes.Dependingonthetypeofdatabase,theseuser-definedtypescanalsobe forward engineered into the database. User-defined datatypes are a powerfulmechanismforensuringtheconsistentdefinitionofdomainproperties throughoutadatamodel. You can build a user-defined datatype from base datatypes, specifying width,precision,andscale,asapplicable.Inaddition,youcanbindrulesanddefaultstotheuser-defineddatatypetoenforcedomainintegrity.Aftercreatingauser-defineddatatype,youcan use it in attributes and domainswithout needing to define its underlying definition
Menu Toolbar Explorer ShortcutKey ShortcutMenu
n/a n/a Right-clicktheUserDatatypesnodeandthenselectNewUserDatatype…
n/a n/a
each time. User-defined datatypes are particularly useful with commonly referencedattributesinadatabasesuchasPhoneNumber,PostalCode,orPartNumber.
Creating a user-defined datatype and using it many times eliminates the tedium andpotential for errors users can encounter when manually editing each attribute. Forexample, you can define a surrogate key in thePart table, PartNo, as an integer forefficiency.Youcandefineauserdatatype,PartNumber,torepresenteveryuseofPartNothroughoutthedatabasedesign.Subsequently,youlearnthatthedatatobeconvertedfroma legacy system contains some part numbers in character format. To accommodate thechange, you only need to edit the definition of PartNumber from an integer to acharacter-based user datatype. ER/Studio automatically converts all columns usingPartNumbertothenewdefinition.
Although only a few database platforms currently support user-defined datatypes,ER/Studio extends their utility to all database platforms in the physical data model.ER/Studio automatically converts user-defined datatypes to their base definitions whengeneratingSQLcodeforanydatabaseplatformsthatdonotprovidenativesupport.
User-DefinedDatatypesinER/Studio
Tocreateanewuser-defineddatatype,clickontheDataDictionarytab,andthenchoosethefollowingcommand:
TheEditUser-DefinedDatatypescreenappearsasshowninFigure11.4.
Tab Here’swhatyouneedtoknow:
UDT Definetheformatandwidthofthenewdatatypeandwhethertheuser-defineddatatypeisrequired(allownullsequalsNo)ornotrequired(allownullsequalsYes).TheApplynullabilitytoallboundcolumnscheckboxbecomesavailablewhenyouselectadatatype thatcanhavenulls,butyoucanchoosetodisallownullsbyclickingNoinAllowNulls.Ifyouwouldliketobindthenewdatatypetoadefaultvalueorrule,choosethedesiredonefromthedrop-downmenus.
AttachmentBindings Bindanexternalpieceofinformation,suchasaMicrosoftWorddocumentorPDFfile,totheuser-defineddatatype.Veryusefulforrequirementsdocuments,userstories,etc.Attachmentsarecreatedin theAttachments folderof thedatadictionaryandmustbeadded to themodelbefore theywilldisplayonthistab.
BindingInformation Selecttheobjectclassesand/orspecificobjectstowhichyouwanttobindthisattachment.Youcanoverridethissettingusingtheattributetaboftheentity.
Figure11.4EditUser-DefinedDatatypescreen
YoucanenterthenameofthenewdatatypeafterDatatypeName.Therearethreetabsonthisscreen:
Click<OK>tosaveyourchangesandexittheeditor.
EXERCISE11.2:CreatingUser-DefinedDatatypes
Createauser-defineddatatypecalledStandardName andassign it to thenamedomainyoucreatedinthelastexercise.Didchangingthisnamedomainautomaticallypropagatethechangetoalloftheattributesyoutiedtothisdomaininthelastexercise?
ReferenceValues
ReferenceValuesarerangesofvaluesoritemizedliststhatdefinealloweddata.Theycanbeassignedtoattributesordomains.
Menu Toolbar Explorer ShortcutKey
ShortcutMenu
n/a n/a Right-clicktheReferenceValuesnodeandthenselectNewReferenceValue…
n/a n/a
BecomeanER/StudioHotshot:
You can import or export multiple referencevalues fromExcel using amacro.On theMacrotab of the Data Model Explorer, choose SampleMacros>MetaDataManagementMacros to seetheimportandexportreferencevaluemacrosthatareavailable.
Tab Here’swhatyouneedtoknow:
ReferenceValue Enteranameforthereferencevalueandclicktheradiobuttonforeitherdefiningarangeoralist.IfyouclickByRange,enteraminimumandmaximumvalue.IfyouclickByList,youcanenteralistofvaluesanddescriptionforeachvalue.(Double-clickintheValuecolumntoenteravalue.)
ReferenceValuesinER/Studio
To create a new reference value, click on theDataDictionary tab and then choose thefollowingcommand:
TheReferenceValueEditorappearsasshowninFigure11.5.
Figure11.5ReferenceValueEditor
Therearefourtabsonthisscreen:
Definition Definethereferencevalue.
AttachmentBindings Bind an external piece of information, such as aMicrosoftWord document or PDF file, to thereferencevalue.Veryusefulforrequirementsdocuments,userstories,etc.AttachmentsarecreatedintheAttachmentsfolderofthedatadictionaryandmustbeaddedtothemodelbeforetheywilldisplayonthistab.
BindingInformation Selecttheobjectclassesand/orspecificobjectstowhichyouwanttobindthisattachment.Youcanoverridethissettingusingtheattributetaboftheentity.
Menu Toolbar Explorer ShortcutKey ShortcutMenu
n/a n/a Right-clicktheAttachmentsfolderandthenselectNew
n/a n/a
Click<OK>tosaveyourchangesandexittheeditor.
EXERCISE11.3:CreatingReferenceValues
Create a reference value called NameList and enter about ten different names (yourchoice).ThenassignNameListtoyournamedomain.
Attachments
Anattachment isadocument thatyoucanassociatewithanER/Studioobjectsuchasadata model, entity, or attribute. Attachments and attachment types offer a structuredmethodforyoutoassociateanexternalpieceofinformationtoyourdatamodel.Youcanextend your metadata this way and include supporting documentation such as meetingnotes, risk analysis, and spreadsheets.You canbind attachments to virtually any file orapplicationonyoursystem.
Attachmentsareorganizedintotwokeyobjects:
AttachmentTypes.Anorganizationalsystemwhereyoucangrouptogethersimilarattachmentsandspecifywhichobjectscanhavethistypeofattachmentboundtothem.Attachmenttypesdefinethescopeoftheattachmentscreatedunderneaththem.Useattachmenttypestoorganizeattachmentsbytheobjecttypestowhichtheyareapplied(e.g.,entities,relationships,attributes),bythebusinesssubjectarea(e.g.,customer,product,account),orbyfunction(e.g.,issues,questions,requirementdocuments).Onceyoucreateanattachment,youcanbindittoanydatamodelobjectsassociatedwiththeattachmenttype.Attachment.InformationthatyoucanassociatewiththediagramobjectstypesselectedfortheAttachmentType.Attachmentscantakemanydifferentformssuchasanexternalfile,adate,oralist.
AttachmentsinER/Studio
Let’s first create a new attachment type and then a new attachment. To create a newattachment type, click on the Data Dictionary tab, and then choose the followingcommand:
AttachmentType…
Tab Here’swhatyouneedtoknow:
Name Enteranamefortheattachmenttypeand,optionally,adescription.
AttachmentTypeUsage Any object classes you select here will be bound to this attachment type and will be displayedsubsequentlyontheBindingInformationtaboftheAttachmentEditor.
Menu Toolbar Explorer ShortcutKey ShortcutMenu
n/a n/a Right-clickontheattachmenttypeandselectNewAttachment…
n/a n/a
TheAttachmentTypeEditorscreenappearsasinFigure11.6.
Figure11.6AttachmentTypeEditorscreen
Therearetwotabsonthisscreen:
To create a new attachment, click on the Data Dictionary tab and then choose thefollowingcommand:
TheAttachmentEditorscreenappearsasshowninFigure11.7.
Tab Here’swhatyouneedtoknow:
Name Enteranamefortheattachmentand,optionally,adescription.
Value Selectwhatkindofdatathisattachmentcontains.ForTextListdatatypes,youcanlistpossibledatavalues and then set the default value. ForExternalFilePath, for example, you can browse for aspecificfilesuchasaMicrosoftWordfile.
BindingInformation Selecttheobjectclassesand/orspecificobjectstowhichyouwanttobindthisattachment.Youcanoverridethissettingusingtheattributetaboftheentity.
Figure11.7AttachmentTypeEditorscreen
Therearethreetabsonthisscreen:
Exercise11.4:CreatingAttachments
Createanewattachmenttypeforissuesandthenanewattachmentthatisalistofissuesspecific toourpublisherexample.Createa testMicrosoftWorddocumentandbind thisWorddocumenttothisattachment.
KeyPointsThedatadictionaryisafeatureofER/Studiothatenablesreuseofmanyobjectsacrossdatamodelsincludingdomains,defaults,andattachments.
Creatingadomainallowsyoutodefinetheobjectonceandthenuseitrepeatedlybyapplyingthedomaintotheentityattributesandtablecolumns.Domainsarereusableattributetemplatesthatpromoteconsistentattributedefinitions.
Auser-defineddatatypeisacombinationofformatandlengththatyoucandefineonceandusemanytimes.
Referencevaluesarerangesofvaluesoritemizedliststhatdefinepermitteddata.Theycanbeassignedtoattributesordomains.
AnattachmentisadocumentthatyoucanassociatewithanER/Studioobjectsuchasadatamodel,entity,orattribute.Attachments
andattachmenttypesofferastructuredmethodforyoutoassociateanexternalpieceofinformationwithyourdatamodel.
CHAPTER12DataLineage
Needtoknowthesource?DataLineageishow,Let’sconnectthedots
TheDataLineage featureofER/Studioenablesyou todocument themovementofdatafrompointAtopointB(andanyintermediatestepsinbetween).PointsAandBcanbeanythingfromflatfilessuchasXML,datamodels,databasessuchasMongoDB,Access,Teradata,OracleandDB2,andExcelworksheets.ThismovementissometimesreferredtoasExtraction,Transformation,andLoad(ETL)orsourcetotargetmapping.Inadditiontofunctionality within ER/Studio for documenting and view mappings, you can also useER/Studio Data Lineage, which is a separate tool in the ER/Studio family, to exploreexistingorproposedETLmappingstoquicklyandaccuratelyperformimpactanalysis.
Figure12.1containsacommondatamovementprocessfordatawarehousing.
Figure12.1Datawarehousedatamovementprocess
Inthisillustration,thedataissourcedfromvarioussystemsontheleftandfedtoadatawarehouse that stores the data in a format that is more conducive to reporting. Thisreduces the amount of overhead on the source systems so resources are not used forreportingdirectlyonthem.Thedataalsomustbecleansedtoensurethequalityofthedataused for reporting, multi-dimensional cubes, data mining applications, etc., which aretargeted for specific audiences and purposes. An organization using ER/Studio wouldhopefullyhaveamodelofeachsourceapplicationsuchasOrderEntry,theenterprisedatawarehouse,andthedifferentreportingapplications.
Thereneedstobeadatamapping(alsoknownas“datalineage”)that“connectsthedots”from each source system to the enterprise datawarehouse and then from the enterprisedatawarehousetoeachreportingapplication.ThismappingdocumentisprovidedtotheETLdeveloperastheirrequirementsdocumentsotheycandevelopthecodenecessarytoimplementthemapping.
In ER/Studio, you can document and view data lineage using theData Lineage tab inModelExplorer.Youcancreateavisualizationofthedatamovementandtransformationsoyoucanseetherelationshipsbetweenthesourceandtarget,howthedataflowsfromone table to another, andhow the data is transformed.You can further expand the datalineagedocumentationintheTableEditorandintheTableColumnEditor.
We’llfirsttalkaboutusingtheDataLineagetabandthencovertheTableEditorandtheTableColumnEditor.
UsingtheDataLineageTab
Youcandocumenteverythingthatisneededtotakedatafromasourceandloaditintoatarget.Therearethreemaincomponentsrequiredtodocumentlineage:sources,rules,anddataflows.SourcesarethestartingpointsforthelineageandmaybeotherER/Studiodatamodels, a SQL file, or a database. Rules are the types of changes (also known as“transformations”)thatcanbeappliedtothesourcestructurespriortoloadingthetargetstructures.Thedataflowisonecompletemapping,whichincludesspecificsources,rules,andtargets.Targetsarethestructuresonthecurrentmodelthatweareloading.
Forexample, inFigure12.2,wehaveAuthor fromoneof themodels fromChapter10(RecallFigure10.17)asthetargetmodel,andwehavePersonfromthedatamodelthatisgoingtosendusauthordataasthesource.
OurgoalistodocumenthowtopopulatetheAuthorcolumns.Themodelweareworkingin containsAuthor, and this is our target.Wedefine the sourcePerson and one of therules for populating Author, which is a create rule for when to add new authors.Wheneverwecomeacrossasocialsecuritynumberinthesourcethatdoesnotmatchanyofthetaxidentifiersinthetarget,wecreateanewAuthorrecord.DatafromthePersonFNamecolumnwillloadintotheAuthorFirstNamecolumn,anddatafromthePersonLnamecolumnwillloadintotheAuthorLastNamecolumn.
Person Author
SocialSecurityNumber
FName LName CreateRule TaxID FirstName
LastName
Figure12.2ExampleoflineagefromPersontoAuthor
So using the data from Table 12.1 as an example, this particular rulewould only loadHenryWinklerandEddieMurphy,asthesearetheonlytwoauthorsthatdonotcurrentlyexist.RobinWilliamsalreadyexists,so this recordwouldnotbe loaded.Thisdataflowexampleisjustoneofthemanyruleswewouldneedtocreate.Thisisacreatedataflow(and a simple one!), yet there could bemanyother data flows to handle updating data,deletingdata,archivingdata,etc.
123-45-6789 Robin Williams Don’t load, alreadyexists
123-45-6789 Robin Williams
343-53-4421 Henry Winkler New record— loadthis!
333-54-4911 Eddie Murphy New record— loadthis!
Menu Toolbar Explorer ShortcutKey ShortcutMenu
n/a n/a Right-clickonOtherSourcesandthenselectNewSource…
n/a n/a
Table12.1SampledataneedingtobeloadedfromPersontoAuthor
The target is alreadydefined forus as this is ouropenmodel.Let’sgo throughhow todefinesources,rules,andthenthecompletedataflow.
DefiningSourceSystemsinER/StudioData sources can originate from the model you are working in, from external sourcesimported into theactivediagram,or fromdatasourcescreatedon theDataLineage tab.ThesourcecanbeimportedfromotherER/Studiofiles,databases,orSQLfiles.IfyouareusingtheRepository,toaddanewsource,clickontheDataLineagetabandthenchoosethefollowingcommand:
Youmay receive the pop up window in Figure 12.3, which warns you that the list ofchangesyoumadeuptothispointwillbeerasedfromtheundohistory,meaningonceyouproceed,youwill notbeable toundoanychangesyoumadepreviously.Youcanclick<Yes> and also suppress thismessage from appearing in the future by clickingDo notdisplaythisdialogagain.
Figure12.3Undo/RedoWarningpopup
TheDataSourcePropertieseditorappearsasinFigure12.4.
Tab Here’swhatyouneedtoknow:
General ThenameyouprovideherewillbedisplayedasadatasourceintheOtherSourcesnodewithintheDataLineagetab.Selectfromthedrop-downthetypeofsourceitis(whetherLogical,Physical,FlatFile,orOther).Youcanalsoaddadefinitionforthesourceonthistab.ConnectivityPropertiesareuseful toenterwhenconnecting toadatabase.Youcan leave thissectionon thescreenemptyforER/Studiofilesthatyouaresourcingfrom.
ModelUsage This is a read-onlydisplayof the sourcedefinedon theGeneral tab.Ensure that itmatches yourintentions.
Menu Toolbar Explorer ShortcutKey ShortcutMenu
n/a n/a Right-clickonOtherSourcesandthenselectImportNewSource…
n/a n/a
Figure12.4DataSourcePropertieseditor
Therearetwotabsonthisscreen:
Ifyouarenotusing theRepository, toaddanewsource,clickon theDataLineage tabandthenchoosethefollowingcommand:
Thefirstofafive-pagewizardappears.SeeFigure12.5forPage1of5.
IcreatedadatamodeljustcontainingthePersonentityfromFigure12.2,andIselectedthismodelbyclickingontheyellowfoldertotherightofFromamodelinanotherDM1file.Aswithotherwizards,youaregiventheoptiontoloadsettingsfromapriorimportsourceoperation.Click<Next>togoontoPage2ofthewizardasshowninFigure12.6.
Figure12.5ImportSource–Page1of5
Figure12.6ImportSource–Page2of5
On this screen, you can select themodel youwould like to import. I chose the Personphysicaldatamodel.Click<Next>togoontoPage3ofthewizardasshowninFigure12.7.
Figure12.7ImportSource–Page3of5
On this screen, select the types ofmetadata youwould like imported.The default is tobring ineverything.Click<Next> togoon toPage4of thewizardas shown inFigure12.8.
Onthisscreenyoucanselecttheentitiesyouwouldliketoimport.BecauseourmodelinthisexamplehasjustthesingleentityPerson, it isaneasyscreentocomplete.Youcanalsooptionally saveyour settings soyou can load them to save time thenext timeyouimportasource.Click<Next>togoontoPage5ofthewizardasshowninFigure12.9.Onthisscreen,wecangothrougheachsourceentityanddecidewhat todoifanentitywiththatsamenamealreadyexistsinourmodel.InthiscaseitiseasybecausethePersonentity does not exist in ourmodel.We can also run a report to review these results inHTMLorRTF format.Click<Finish> tocomplete thewizard.Youwillnotice thenewsourceappearingintheOtherSourcesfolder.
Menu Toolbar Explorer ShortcutKey ShortcutMenu
n/a n/a Right-clicktheDataMovementRulesnodeandthenNewDataMovementRule
n/a n/a
Figure12.9ImportSource–Page5of5
CreatingDataMovementRulesinER/StudioDataMovementrulesdescribethedifferentwaysinwhichsourceandtargettablescanberelated.Typescanincludecreate,update,archive,backup,etc.Youcanrelatesourcedatato one or more tables and entities in the samemodel, the active diagram, or to tablesimportedfromexternalsystems.Toaddadatamovementrule,clickontheDataLineagetabandthenchoosethefollowingcommand:
TheDataMovementRuleeditorappearsasinFigure12.10.
Tab Here’swhatyouneedtoknow:
RuleInformation Enteranamethat indicates theoperationandobjectsactedon,dependingonthespecificsofyourbindingdefinition.UndertheRuleTypedrop-down,selectthegenericruletypethatbestdescribesthe data movement such as a create rule or archive rule. Under Rule Text, document your datamovementplan,perhapsaddinginstructionsorcontingencyplans.
BindingInformation Selecttheobjectclassesand/orspecificobjectstowhichyouwanttobindthisattachment.YoucanoverridethissettingusingtheDataLineagetaboftheentity.
Figure12.10DataMovementRuleeditor
Therearetwotabsonthisscreen:
Afterclicking<OK>youwillnoticethenewruleappearingintheDataMovementRulesfolder.
CreatingaDataFlowinER/StudioNowlet’sput thepieces togetherbycreatingaDataFlow.Thedata floworganizesandencapsulates one data transformation and the source tables and columns used in thetransformationtoproducethetargetdata.Tocreateadataflow,clickontheDataLineagetabonthebottomoftheExplorerpane(asshowninFigure12.11).
Menu Toolbar Explorer ShortcutKey ShortcutMenu
n/a n/a Right-clicktheDataFlowsnodeandthenselectCreateDataFlow
n/a n/a
Figure12.11DataLineagetabfromExplorerpane
Iftherearenotyetanydatalineagesdefined,thepop-upinFigure12.12willappear.
Figure12.12DataLineagepop-up
You are then prompted to enter the name of the new data lineage. See Figure 12.13. IenteredAuthorPopulation.Click<OK>.
Figure12.13Enterdatalineageflowname
YouwillnoticethenewdataflownowappearsintheDataFlowsfolder.
Toaddadatalineageafteroneisalreadyadded,clickontheDataLineage tabandthenchoosethefollowingcommand:
Now that we created a data flow, we can create a complete mapping in ER/Studioincludingtransformations.ClickontheAuthorPopulationdataflow.ThedataflowviewappearsintheDataModelWindow.
Let’sstartbyclickinganddragging thePersonentity fromtheOtherSources folder ontheLineagetabtotheDataModelWindow.
ER/Studiocontainsourtargetentities intheLocalModelssubfolderontheLineagetab.
Menu Toolbar Explorer ShortcutKey ShortcutMenu
Insert>TransformationModelingtoolbar:
Right-clickondataflow,CreateTransformation
<ALT+I>,then<T> Clickonwhitespace,InsertTransformation
Menu Toolbar Explorer ShortcutKey ShortcutMenu
Insert>DataStream
Modelingtoolbar:
n/a <ALT+I>,then<D> Clickonwhitespace,InsertDataStream
FindAuthorandclickanddragAuthor totheDataModelWindow,which isour targetentity.
Thencreateatransformationobject.
ClickanywhereintheDataModelWindowtocreatethetransformationobject.
Nowlet’s“connectthedots.”Thatis,createaline(calleda“datastream”)fromthesourceentitytothetransformationandthenfromthetransformationtothetargetentity.Tocreateadatastream,chooseoneofthesecommands:
Click on the source entity, Person, and then click on the transformation entity. Thiscreatesadatastreamintothetransformation.NextclickonthetransformationentityandthenclickonAuthor.This creates a seconddata stream from the transformation to thetargetentity.
Next,double-clickonthetransformationobjecttobringuptheTransformationEditor.SeeFigure12.14.
Enteranameforthetransformation(IchosePersonToAuthorCreate)andselectatypeoftransformationfromtheType:drop-downlist.The type is thehigh-level functionof thetransformationsuchasadirectmaporlookup.Ifyouareunsureofthetype,youcanleaveitunspecified.
Tab Here’swhatyouneedtoknow:
Columns Define the input and output columns. Click the rectangle with the three dots for both input andoutputtoaddthecolumns.
Definition Describethetransformation.Thereisalsoatextfiletocapturetheactualtransformationcode.
DataMovementRules Chooseoneofthedatamovementrulesthatwerepreviouslydefined.Youcanusethearrowkeytomove the rule to the rightpaneand thencustomize the rule, if needed,byenteringactualvalues.(Double-clickinthevaluescellandawindowwillappearwhereyoucanenterthevalues.)
Attachments Bind an external piece of information, such as a Microsoft Word document or PDF file, to thetransformation.Veryusefulforrequirementsdocuments,userstories,etc.
Figure12.14TransformationEditor
Therearefourtabsonthisscreen:
Click<OK>toexittheeditor,andnowyouhavecompletedyourfirstdataflow!
UsingtheTableEditortoFurtherDocumentLineageYoucandouble-clickanyentitytoentertheEntityEditorandchoosetheDataLineagetabtoexpandthedocumentationonthedataflowsuchashowoftenisthedatasourcedandwhenitwaslastsourced.Youcanalsoassignadditionalrulestotheentityonthistab.
UsingtheColumnEditortoFurtherDocumentLineageAt the column/attribute level, you can document additional transformation logic forsource/targetattributemapping.SimplybringuptheEntityEditor,choose theAttributestabandselecttheattributeyouwouldliketodocumentETLfor,andclick<Edit>.Clickon theDataLineage for the attribute tab. Click the Edit button to enter transformationinformation.
Exercise12.1:CreatingaDataLineageWalkthroughtheexampleinthischapterandpracticemappingPersontoAuthor.Ifyouarefeelingadventurous,addmoreadvancedtransformationlogictothemapping.
ALessFormalWaytoConnectThings:User-DefinedMappings
A User-Defined Mapping (UDM) is a relationship you can build between any objectswithin thesameER/Studiofile.Forexample, ifyouhavebuilta logicaldatamodelandwould like toseehow itmaps toa legacydatabase togaugeoverlapandgaps,youcanimportthelegacydatabasephysicaldatamodelanduserUDMstoconnectittothelogicaldatamodel.
UDMs are created purely for communication purposes and do not ever get forwardengineeredintocode.TocreateaUDM,right-clickontheentityeitheronthedatamodeldiagram or in Explorer and selectWhere Used…The screen in Figure 12.15 appears.Double-click on the model name or the pencil symbol, and then you can choose theentitiesyouwouldliketheentitytohaveaconnectionwith.
Whena logicaldatamodel is forwardengineered intoaphysicaldatamodel, theWhereUsedtabwillcontainthemappingsbetweenlogicalandphysical.Auser-definedmappingiscreatedbetweenlogicalandphysicalentities.
Figure12.15WhereUsed
KeyPointsTheDataLineagefeatureofER/StudioenablesyoutodocumentthemovementofdatafrompointAtopointB(andanyintermediatestepsinbetween).PointsAandBcanbeanythingfromflatfilessuchasXML,datamodels,databasessuchasMongoDB,Access,Teradata,OracleandDB2,andExcelworksheets.
Therearethreemaincomponentsrequiredtodocumentlineage:sources,rules,anddataflows.
SourcesarethestartingpointsforthelineageandmaybeeitherotherER/Studiodatamodels,aSQLfile,oradatabase.
Rulesarethetypesofchanges(alsoknownas“transformations”)thatcanbeappliedtothesourcestructurespriortoloadingthetargetstructures.
Thedataflowisonecompletemapping,whichincludesspecificsources,rules,andtargets.
Targetsarethestructuresonourcurrentmodelthatweareloading.
CHAPTER13Importing,Exporting,Printing,andReporting
Menu Toolbar Explorer ShortcutKey ShortcutMenu
File>New…,thenImportModelFrom
or
File>ImportFile
Applicationtoolbar:n/a <ALT+F>,then<N>
or
<ALT+F>,then<M>
n/a
ImportandExportWow,manydifferentformats
PrintandreporttooER/Studiocontainsanumberoffeaturesforgettingmodelinformationinandoutofthetool.Thereistheabilitytoimportandexportinmultipleformatsaswellasprintingandreporting,whichwillallbediscussedinthischapter.
ImportingintoER/StudioInadditiontoallofthedatabasesthatyoucanreverseengineerintoER/Studio,thereareover100differentformatsthatcanbeimportedintothetool.Youcanevenimportfromother data modeling tools such as CA ERwin Data Modeler® and SAP SybasePowerDesigner®.
Toimport,chooseoneofthefollowingcommands:
ImportingfromExternalMetadata
IfyouselectedFromExternalMetadata…,thefirstofthreescreensappearsasshowninFigure13.1.
Figure13.1ImportExternalMetadataPage1of3
Choosethetypeofinputsourcefromthedrop-downlist.Ichosetoimportadatamodelfrom CA ERwin Data Modeler version 7.x. After making a selection, click on therectanglewiththethreedotstoselectthefileyouwouldliketoimport.Onthisscreen,youarealsoprovidedwithtipsforimportingfromtheformatyouselected.Inthiscase,it isrecommendedtofirstconverttheERwinmodeltoanXMLformat.IopenedadatamodelinERwinDataModeler,savedit inXMLRepositoryformat,andthenselectedthisfile.SeeFigure13.2forthedatamodelinnativeERwinformat.
Figure13.2ERwindatamodeltobeimportedintoER/Studio
Youcan clickon anyof thevalues, such asAsmetadata,migratedefaultvalues, and adrop-downappearsallowingyoutoselectadifferentvalue.Tipsappearforeachselectedrow.Onthisscreen,let’skeepalloftheotherdefaultsandclick<Next>sothatthescreeninFigure13.3appears.Moresettingsthatyoucanchangeappearwithtipsasinthepriorscreen.
Figure13.4ImportExternalMetadataPage3of3
There are different status and error codes provided during import. Any statementsprefacedbygreenorbluecirclesrepresentstatusorinformation,andanythinginred,suchasorangeandredtrianglesorredcircles,arewarningsorerrormessagesthatwillneedtobeaddressedbeforeimporting.Ifyouwanttoreturntothesemessages,youcansavethemtoafilebyclicking<SavetoFile…>orprintthembyclicking<Print…>.Click<Finish>to complete the import process and view yourmodel in ER/Studio as shown in Figure13.5.
Figure13.5ER/StudiomodelofERwinimportedmodelfromFigure13.2
ImportingfromanERXFile
AnERXfilewasoriginallyanERwinfilecreatedinCAERwinDataModelerversion3.x;other tools such as Silwood Technology’s Safyr® also export metadata to this format.Selecttheappropriatefileandfollowtheinstructions.Similartoimportingfromexternalmetadata,youwillhavetheoptiontosaveorprintthelogfile.Whendone,click<Close>
Menu Toolbar Explorer ShortcutKey
ShortcutMenu
File>ExportFile n/a n/a <ALT+F>,then<F>
n/a
BecomeanER/StudioHotshot:
MacroscanbeusedtoexportportionsofthemodelintoExcel.MacroswillbediscussedinChapter16.
and save the newmodel.Note thatCAERwinDataModeler version 3.x is a very oldversion of ERwin, but since other tools use this format, you may come across it.RemembertousetheImportExternalMetadatawizarddiscussedintheprevioussectionwhenimportingdatamodelscreatedinamorerecentversionofCAERwinDataModeler.ImportingfromaSQLFile
ThiswascoveredinthereverseengineeringdiscussioninChapter10.
ExportingoutofER/Studio
InadditiontoallofthedatabasesthatyoucanforwardengineeroutofER/Studio, thereareover100differentformatsthatcanbeexportedfromthetool.Toexport,chooseoneofthefollowingcommands:
ExportingtoExternalMetadata
IfyouselectedExternalMetadata…,thefirstofthreescreensappearsasshowninFigure13.6.
Figure13.6ExportExternalMetadataPage1of3
IamgoingtotakethedatamodelweimportedfromCAERwinDataModelerandsenditback toCAERwinDataModeler. I created a new file on this screen and left the othervaluesonthescreenunchanged.Click<Next>andthesecondscreenappearsasinFigure13.7.
Figure13.7ExportExternalMetadataPage2of3
Ileftthesedefaultsalone.Click<Next>andthethirdscreenappearsasinFigure13.8.
Figure13.8ExportExternalMetadataPage3of3
Notethatitmighttakesometimeforthisthirdscreentoappear.Click<Finish>andtheCAERwinDataModelerversionof themodelhasnowbeencreated.Iopenedit inCAERwinDataModelertotestit,anditwasaccuratelycreatedandlookedidenticaltoFigure13.2.
ExportingtoXML
TheeXtensibleMarkupLanguage(XML)isadocumentformatthatisastandardfordatarepresentation and exchange on the Internet. XML is also now supported by manyapplications and platforms, allowing data modelers and application developers tocollaborate on service-oriented architecture (SOA) initiatives. For example, the datamodelermodels the data and the relationships that describe how applications exchangedata and exports the model to XML, which the application developer can then use toensurethattheapplicationsinterfacecorrectly.
If you selectedXMLFile as your export choice, youwill need to choose one of threeoptions:
SchemaDefinition(XSD).TheXSDformallydescribestheelementsinanXMLdocument.Itisanabstractrepresentationofanobject’scharacteristicsandhowtheobjectrelatestootherobjects.TheXSDisusedtoverifythateachelementinanXMLdocumentconformstotheelementrulesdescribedintheXSD.Schemasaremostoftenusedine-commerce,datacontrol,anddatabase-styleapplicationswhere
BecomeanER/StudioHotshot:
TherearealsoquiteafewXMLexportoptionsavailablethroughtheExternalMetadatafunctionincludingXMLMetadataInterchange(XMI).TheXMIfileformatwasdesignedprimarilytoallowtheexchangeofdatabetweendatamodelingapplications.YoucanuseXMLeditingapplications,suchasMicrosoftXMLNotepad,Eclipse,VisualStudio,andAltovaXMLSpy,toviewandedittheschemaafterexport.
characterdatacontentmustbevalidated,strictdatacontrolisneeded,orwherestrongdatatypingisrequired.Forexample,manyapplicationsuseanXSDtovalidateparametersinconfigurationfiles.DocumentTypeDefinition(DTD).TheDTDisanotherXMLschemalanguageusedintraditionaltextdocumentpublishingapplications.TheDTDisadescriptioninXMLdeclarationsyntaxofaparticulartypeorclassofdocuments.Itdefineswhatnamesareusedforcertainelementtypes,wheretheymayoccurandhowtheelementsfittogetherandalsoensuresthatalldocumentsconformingtotheDTDareconstructedandnamedinaconsistentmanner.Validatorsinapplications,suchaseditors,searchengines,browsers,anddatabasescanreadtheDTDbeforereadingtheXMLfileinordertopreparetodisplayorotherwiseworkwiththeXMLdocument.
XMLSchemaGeneration.TheXMLSchemaGenerationWizardcreatesschemasthatcanbebasedonalogicalorphysicaldatamodel,asubmodel,orevenspecificobjectsofamodelorsubmodel.ThiswizardallowsyoutocustomizetheXMLschemastructurebyclickingthedesiredoptionsanddraggingtheavailableobjectsfromthedatabasedesignintoatreerepresentingtheXMLschema.Thiswizardprovidesadvancedoptionstotransformrelationalentitiesandattributesintocomplextypes,elementsandattributes,definesnamingstandardsanddatatypemapping,andincorporatestheQuickLaunchsystemusedinotherwizardstosaveprevioussettingsandstreamlinerepetitiveoperations.
ExportingtoXSDorDTDarethesameprocess—simplycreateafilenameunderwhichtosavethefileandyouaredone.ForXMLSchemaGeneration,however,thereisafive-pagewizard,thefirstpageappearinginFigure13.9.
Create a file name for the targetXML schemaby clicking on the yellow envelope andcreating a new file name. Similar to other wizards, you are given the option to loadprevioussettingsthatyousavedatapriortime.YouwillhaveanoptiononPage5tosaveyoursettingsfromthistimetouseforfutureexports.Click<Next>togotoPage2of5,showninFigure13.10.
You can add a namespace (a grouping of identifiers or symbols used inmodular codedesign)andotherinformationandthenclick<Next>togotoPage3of5,showninFigure13.11.
Figure13.11XMLSchemaGenerationPage3of5
Therearemanyoptionsacrossthefivetabs.Ikeptthedefaultsandclicked<Next>togotopage4of5,showninFigure13.12.
Figure13.12XMLSchemaGenerationPage4of5
Menu Toolbar Explorer ShortcutKey ShortcutMenu
File>ExportImage n/a n/a <ALT+F>,then<E> n/a
On this screen, you can select which objects should be exported and how they shouldappearintheXMLfile.Click<Next>togotoPage5of5,showninFigure13.13.
Figure13.13XMLSchemaGenerationPage5of5
Similartootherwizards,youaregiventheoptiontosaveyoursettingsforQuickLaunchlater.Click<Finish>andyouaregiventheoptiontoviewtheXMLschema.
ExportingtoaSQLfile
ThiswascoveredinChapter10.
ExportinganImage
FromER/Studio, you can create a screenshot imageofyourdatamodel todistribute toyour reviewers. This feature is very handy if your audience does not have a copy ofER/Studioand theyneed toseeonly thevisual (andnot themetadatabehind themodelsuch as definitions). Alternatively, you could always email them a screenshot plus anExcelspreadsheetthatyougeneratedviaoneofthesuppliedmacros.Forthescreenshot,youcanchoose fromseveraldifferent image formats includingEMF, JPEG,GIF,BMP,andPNG.Useoneofthesecommands:
YouwillseethescreeninFigure13.14.
Menu Toolbar Explorer ShortcutKey ShortcutMenu
Tools>Options n/a n/a <ALT+T>,then<P> n/a
Menu Toolbar Explorer ShortcutKey
ShortcutMenu
File>Print… Application
toolbar:
Right-clickonmodelorsubmodelfolder,PrintModel…
<ALT+F>,then<T>
or
<CTRL+P>
Right-clickonwhitespace,PrintModel…
Figure13.14SaveAsImagescreen
Choosetheimageformat(suchasJPEG)fromthedrop-downandcreateanewfilenameusingtheyellowfolder.Youarealsogiventheoptionofselectingthequalityoftheimage,wherethehigherthequalityoftheimage,thelargertheimagesize.Click<OK>tosaveyourmodelintheformatyouspecified.
PrintinginER/StudioToprintthemodel,firstmakesuretherightsettingsareselectedunderOptions.
Then choose theDisplay tab. Select PageBoundaries to display the diagram lines thatshow how the model will be printed. Then to print, choose one of the followingcommands:
BecomeanER/StudioHotshot:
Before printing your model, display the pageboundaries so you can optimally place yourobjects for better viewing and printing. ChooseTools>Options>Display>PageBoundaries.
ThescreeninFigure13.15appears.
Figure13.15Printscreen
Therearealotofreallyneatoptionsyoucanselectforprinting.Youalsohavetheoptionofsavingyoursettingsforfutureusebyclicking<SaveSettings>.UnderPageScaleyoucandecide thescalingof themodel.ForsmallmodelsFitPage isagoodchoice.UnderBorder & Background, you can decide whether the model gets printed in color orgrayscaleandwhetheryouwouldlikethegridandbordertobeprintedaswell.UndertheNameandDateLabelyoucanaddauditing information to themodel.UnderMultipagePrinting,youcanprintpagenumbersandcropmarks tomake it easy to tape thepagestogetherforlargemodels.
Choosethedesiredsettingsandclick<OK>toprintthemodel.
ReportinginER/StudioTogenerateareport,chooseoneofthefollowingcommands:
Menu Toolbar Explorer ShortcutKey ShortcutMenu
Tools>GenerateReports… Applicationtoolbar:
Right-clickonmodel,GenerateReports…
<ALT+T>,then<R> Right-clickonwhitespace,GenerateReports…
The first of four screens appears as shown in Figure 13.16.On this screen, first selectwhetheryouwould like toproducea report inHTMLformator inRTFformat.HTMLreportsaregreatforsharingontheInternetorIntranet.RTFstandsforRichTextFormat,andthisistheformattochooseifyouwouldliketoviewandoptionallyeditthereportina tool likeMicrosoftWord.Next, select the directory for the report by clicking on therectangle with the three dots. Optionally, you can load your settings from a prior gothroughtheReportWizardusingtheQuickLaunchoption.NoteonthefinalpageofthewizardyouwillbegiventheoptiontosaveyoursettingsasafutureQuickLaunch.IfyouselectUseenhancedversion, theHTML filewill bemuch smaller in size and thereforequickertoopenandnavigateinabrowser.Click<Next>tomoveontoPage2asseeninFigure13.17.
Figure13.17ReportWizardPage2of4
Onthisscreen,youcanselectthemodelsyouwouldliketogenerateareportfromintheleftpaneandtheobjectsyouwouldliketoreportonintherightpane.Whendone,click<Next>andmoveontoPage3asseeninFigure13.18.
Figure13.18ReportWizardPage3of4
Thisscreencontainsquitea fewformattingchoices including theoption touploadyourownlogotothereport.Click<Next>togotothefinalscreenasseeninFigure13.19.IfyouchoseRTFreportsinsteadofHTMLreports,Page3istheonlyscreenthatwouldlookdifferent.TherewouldbeformattingoptionsarounddisplayinginatoolsuchasMicrosoftWord including the ability to add a table of contents and page breaks. Here you cancapture author and copyright information and optionally save your settings for a futuretime through theReportWizard. Click <Finish> to complete thewizard and create thereport.
Exercise13.1:Importing,Exporting,Printing,andReporting
Importadatamodelfromanotherdatamodelingtoolorreverseengineerfromanexistingdatabase.Thenexperimentwith theprintingand reporting features inER/Studio.When
youarecomfortablewiththefeaturesavailableforprintingandreporting,exportyourdatamodeltoanXMLfile.
Figure13.19ReportWizardPage4of4
KeyPointsInadditiontoallofthedatabasesthatyoucanreverseengineerintoER/Studio,thereareover100differentformatsthatcanbeimportedintothetool.YoucanevenimportfromotherdatamodelingtoolssuchasCAERwinDataModeler®andSAPSybasePowerDesigner®.
Thereisasimilarvarietyintheformatstowhichyoucanexportout.
Therearealotofreallyneatoptionsyoucanselectforprinting.YoucancreatebothHTMLandRTFformats,andjustlikeforprinting,therearelotsofoptionsyoucanchoosetogivethereportsyourcustomizedtouch!
CHAPTER14NamingStandards
Menu Toolbar Explorer ShortcutKey ShortcutMenu
Tools>Options n/a n/a <ALT+T>,then<P> n/a
Menu Toolbar Explorer Shortcut Shortcut
WhatshouldIcallit?Arosebyanyothernameisstillarose
ER/StudioprovidessupportfornamingstandardsthroughtheNamingStandardsTemplateand Naming Standards Utility. The Naming Standards Template allows you to definemany standards across your organization, including an abbreviation list used toautomaticallyconvertlogicaltophysicalnamesandviceversa,andcase,namelength,andprefix standards. TheNaming Standards Utility is used to apply the naming standardstemplatestoamodelorobjectswithinamodel.
This chapter will explain how to use the Naming Standards Template and NamingStandardsUtilityaswellashowtoassignnamingstandardstoobjects.
CreatingaNamingStandardsTemplateBefore creating the Naming Standards Template, view the default naming standardoptions. You can specify naming rules, such as maximum length, case, andsynchronizationlevelbetweenentitiesandtables,underOptions.
ThefirstdecisiontomakeiswhetheryouwouldliketheNamingStandardTemplatetobeboundjusttothecurrentdatamodel(internal)orwhetheryouwouldlikethetemplatetobeusedbymultipledatamodels(external).Ifitwilljustbeusedinternallyinthecurrentmodel, the template becomes part of the model’s data dictionary. If it’s part of anorganizationstandardtobeusedbymultiplemodels,thetemplateissavedasanXMLfileandcanbeimportedandappliedasneeded.
Sotheinternaltemplateissavedinthemodel’sdatadictionary,andtheexternalissavedas anXML file in theModel directorywith a file extensionof .nst.Another differencebetween the two is that theAttachmentBindings andBindingInformation tabs are onlyavailablefortheinternaltemplate.
To create a naming standard template (either internal or external), click on the DataDictionarytabinExplorerandchooseoneofthesecommands:
Key Menu
Tools>NamingStandardsTemplateEditor… n/a Right-clickonNamingStandardsTemplate,thenNewNamingStandardsTemplate…
n/a n/a
BecomeanER/StudioHotshot:
Youcanhavemultiplenamingstandardstemplatesinthesamedatamodel.Youcaneditanamingstandardtemplatebydouble-clickingonit.Youcandeleteanamingstandardtemplatebyselectingthetemplateandclickingthe<Delete>key.
Tab Here’swhatyouneedtoknow:
Name Createanameforthetemplateandalsoenteradescription.Ifyouarecreatinganinternaltemplate,therearetwoadditionalsettingsavailableonthistabthatarenotavailableontheexternaltemplate;you can import an externalNamingStandardsTemplate, or you can export one. If you decide toimport,thiswouldbetheXMLtemplatefile.Ifyoudecidetoexport,youwillbecreatinganXMLtemplatefilethatothermodelscanthenuse.
Logical Set the maximum length for each logical object type, the case (e.g., upper or lower case), andoptionallyaprefixand/orsuffixforeachlogicalobjecttype.
Physical Set themaximum length for each physical object type, the case (e.g., upper or lower case), andoptionallyaprefixand/orsuffixforeachphysicalobjecttype.
Mapping Define rules on the terms that can be used in the model. There are three sub-tabs on this tab:Abbreviations,Order,andGeneral.TheAbbreviationstabiswhereyoucanenter(orimport/export)abbreviations,bothlogicalandphysical.Youcanalsoconstruct thebuildingblocksofeachname,such as an attribute can be named with a Prime word (e.g., Customer or Product), Qualifiers(sometimescalledModifiers), andaClass (sometimescalledaClasswordorClassword).So, forexample,inCustomerLastName,Customer is thePrime,Last is theQualifier, andName is theClass.Youcanalsomakecertainabbreviationsillegal.
ThePriority column is used to resolve duplicate physical abbreviations as names are transformedfromphysicaltological.ThedefaultvalueofthePriorityfieldisPrimary.Theprioritychanges toSecondarywhenyoudefineamappingforaphysicalnamethatisalreadymappedtoalogicalname.Youcanchange thepriorityby selecting thepriority field, clicking thedownarrowand selectinganotherpriority.
TheOrdertaballowsyoutodecidethesequenceofprime,qualifier,andclass.Forexample,shoulditbeCustomerLastNameorCustomerNameLast?
TheGeneral tab contains settings for how the terms should be separated (e.g., by underscore orspace)andhowtohandlecharactersthatarenotallowedtobeusedsuchas$or#.
AttachmentBindings Bind an external piece of information, such as a Microsoft Word document or PDF file, to thetemplate.Veryusefulforrequirementsdocuments,userstories,etc.AttachmentsarecreatedintheAttachmentsfolderofthedatadictionary(discussedinChapter11)andmustbeaddedtothemodel
Therearesixtabsfortheinternaltemplateandfourfortheexternal(AttachmentBindingsandBindingInformationtabsareonlyavailablefortheinternaltemplate).
beforetheywilldisplayonthistab.
DataMovementRules We can assign a data movement rule to this attribute that will be carried through to the datadefinition language to build the database.We can enter a datamovement rule here or use a datamovementruleasdefinedonthelineagetab,whichwasdiscussedinChapter12.
Menu Toolbar Explorer ShortcutKey ShortcutMenu
Model>NamingStandardsUtility… Applicationtoolbar:
Right-clickonmodelname,NamingStandardsUtility…
<ALT+M>,then<T> Right-clickonwhitespace,NamingStandardsUtility…
Tab Here’swhatyouneedtoknow:
Options Selectwhichtemplateyouwouldlikeappliedtothemodelaswellaswhetheryouwouldlikeanynameconversionstobeperformedwhengoingfromlogicaltophysicalorvice-versa.YoucanalsoloadsettingsfromapriorrunorcreatenewQuickLaunchsettings.
Output Selectwhichobjectsyouwouldliketoapplythetemplatetoaswellaswhichobjectsyouwouldliketofreeze.Whenselected,theFreezeNamesoption in theseeditorspreventsanynamingstandardsappliedtothemodelfromchangingthenameoftheobjectselected.
Menu Toolbar Explorer ShortcutKey ShortcutMenu
Tools>Options n/a n/a <ALT+T>,then<P> n/a
ApplyingtheNamingStandardsUtilityWeapplythenamingstandardstemplate toadatamodel throughtheNamingStandardsUtility.
Therearetwotabsthatappear:
Click<OK>whendone.
AssigningNamingStandardstoObjectsTheNamingStandardsTemplate canalsobeapplied todomains, attributes, andentitiesthroughtheNamingStandardstabintheobjecteditors.
AutomaticNamingTranslationInsteadofapplyingnamingstandardsatcertainpointsduringthemodelingphase,youcanopttoautomaticallynametheentitiesandattributes.ThisisoneofthenewerfeaturesinER/Studio.
Toenableautomaticnaming,choosetheNamingHandlingtabunderOptions.
ThescreeninFigure14.1appears.
Figure14.1In-EditorNamingStandardsscreen
Checking the Use entity/table NST for children option allows the naming standardstemplate tied to the parent entity (the one on the one side of the relationship) to beautomaticallyappliedtothechildentities.
There are other interesting settings on this same tab. The logical and physical namehandling options control what happens when you change the name of an object. Forexample, ifwechange thenameof a logical attribute,CompleteSynchronization underPhysical Name Handling Options will update the corresponding physical column.CheckingAllowunificationwheneditingnamesallowsyoutochangetherolenamesofforeignattributestothesamenamesasotherattributesinthesameentity.
Exercise14.1:CreatingaNamingStandardTemplate
Doesyourorganizationhaveanamingstandard?Ifnot,checkouttheinternationalnamingstandard,ISO-11179.(Therearegoodtipsonwritingdefinitionsinthisstandard,too.)Ifyoudohave a naming standard, create an externalNamingStandardTemplate for yourstandard.Thenapply theNamingStandardsUtility to oneof yourmodels basedon thestandardyoudefinedinthetemplate.Enterpriseconsistencydoesfeelgood,doesn’tit?
KeyPointsTheNamingStandardsTemplateallowsyoutodefinemanystandardsacrossyourorganizationincludinganabbreviationlistusedtoautomaticallyconvertlogicaltophysicalnamesandviceversaaswellascase,namelength,andprefixstandards.
TheNamingStandardsUtilityisusedtoapplythenamingstandardstemplatestoamodelorobjectswithinamodel.
TheNamingStandardsTemplatecanalsobeappliedtodomains,attributes,andentitiesthroughtheNamingStandardstabintheobjecteditors.
CHAPTER15Compare/MergeUtility
ThesametheyshouldbeCompareandMergebringorder
LifeisbackincheckTheCompareandMergeUtilityallowsyoutoreconciledifferencesbetweenmodelsinthesame fileorbetweenamodelandadatabase.Forexample, imagineyouhavedesignedandcreatedamodelandthencreatedadatabasebasedonthatdatamodel.Adatamodeleralters themodelandadds theattributeEmployeeGender to theEmployeeentitywhileindependently,adatabaseadministratoralters theDepartment table in thedatabaseandaddsacolumnDepartmentNametothetable.Themodelandthedatabasearenolongerinsynch.ApplyingtheCompareandMergeUtilitycanidentifydifferencessuchastheseandmergethemodelanddatabasesotheyarebackinsynch.
TheCompare and Merge Utility compares, merges, and synchronizes models from avarietyofcomparisontargets.Itcanperformdifferentkindsofcomparisons.Youcanusethe information from thesecomparisons toperformmergesor tocreatedetailed reports.Youcancompareandmergealogicaldatamodelwith:
Aphysicaldatamodelinthesame.dm1fileAlogicaldatamodelofanotherER/StudiodatamodelAphysicaldatamodelofanotherER/Studiodatamodel.
Youcancompareandmergeaphysicaldatamodelwith:
ThelogicaldatamodelofthesamedatamodelAnotherphysicaldatamodelofthesamedatamodelthatsharesthesameDBMSplatform(andversion)AlogicaldatamodelofanotherER/StudiodatamodelAphysicaldatamodelofanotherER/StudiodatamodelthatsharesthesameDBMSplatform(andversion)Adatabase(includingaNoSQLdatabasesuchasMongoDB)orSQLfile.
Youcancompareandmergeasubmodeltoasubmodelwithinthesamedatamodel.
ComparingModelsandSubmodelsinER/StudioUsingtheCompareandMergeUtility,youcancomparetwomodels,twosubmodels,oramodelwithasubmodelandmergeanydifferencesfound,ifrequired.Youcanalsoreportonthedifferences,andoptionallysynchronizeyoursourcemodelwithanothermodelorupdate thesourceor targetmodelsselectively.Openthefirstmodel(orsubmodel) tobe
Menu Toolbar Explorer ShortcutKey ShortcutMenu
Model>CompareandMergeUtility… Applicationtoolbar: Right-clickonsource
model(orsubmodel),CompareandMergeUtility…
<ALT+M>,then<M> Right-clickonwhitespace,CompareandMergeUtility…
synchronized.Wecancallthismodelthe“source,”although“source”and“target”namesarearbitrary,andenteroneofthesecommands:
ThefirstpageofafivepagewizardappearsasshowninFigure15.1.
Onthisscreen,youcanselectwhatyouwouldliketocompareyourdatamodeltoaswellas loadQuickLaunch settings from a prior compare andmerge operation. I decided tocompare my model to another ER/Studio model, so I selected the second option andclickedontheyellowfoldertobringupthebrowsewindow,whichallowsmetoselectthetargetmodel.Click<Next>tomoveontothesecondpageasshowninFigure15.2.Onthisscreen,wecanpickthesubsetofthetargetfiletocomparewith.Thereareonelogicaldatamodelandtwophysicaldatamodels,andIchosetheonelogicaldatamodel.Icouldhavealsorefinedthecomparisontoasubmodelinthetargetmodel.Click<Next>tomoveontothethirdpageasshowninFigure15.3.
Figure15.1CompareandMergeUtilityPage1of5
Figure15.3CompareandMergeUtilityPage3of5
On this screen, you can select the types ofmetadata to be compared between the twomodels. By default, everything is selected. The General Options tab contains moreadvancedsettingssuchaswhethertoignorecasewhencomparingnamesandwhethertoexcludedefinitionsfromthecomparisonwhendealingwithnewphysicalstructures.Click<Next>tomoveontothefourthpageasshowninFigure15.4.
On this screen, you can select the specific objects for comparison including entities,views, users, roles, and shapes.Optionally, you can also saveyour settings for a futurecompare andmerge operation.Click <Next> tomove on to the fifth page as shown inFigure15.5.Thisscreencontainstheresultsofthecompareandmerge.UndertheFilterResults drop-down,youcan showa subsetof themergeoperation tomake theexerciseeasier for comparison. Ifyouclickononeof the resolutionvalues, suchas Ignore, youwill notice that a drop-down appears and provides you with several actions, includingignore the difference between the twomodels, delete from the current (also known assource)model,ormergeintothetargetmodel.YouarealsogiventheoptiontoproduceareportinRTForHTMLformatbyclickingon<Report>.
Figure15.5CompareandMergeUtilityPage5of5
Ifyouclickon<…>totherightofSaveMatches,youcandefineamappingbetweentwomodels that will be saved so the next time the Compare and Merge Utility is run,ER/Studio will recognize that these two objects match and will not flag them as adifference. For example, if you define a mapping betweenCustomer inModel A andClientinModelB,thenCustomerandClientwillbeconsideredamatchandwillnotbeflaggedduring the compare andmergeprocess. If amapping ismadeacrossER/Studiofiles,thisiscalledaUniversalMapping.IfamappingismadewithinanER/Studiofile,thisiscapturedthroughaUser-DefinedMapping.
When you are done with the Compare and Merge Utility, click <Finish> to exit thewizard.Youwillbepromptedtosavethemodelsthathavebeenchanged.
Exercise15.1:RunningtheCompareandMergeUtilityComparea logicaldatamodelwith its reverse-engineereddatabase.Pickadatabase thatyouthinkcouldbedifferentfromthelogical.Runthefullcompareandmergeutilityandproduceareporttotaketoyourcolleaguestodiscussthedifferencesanddecidewhetherthelogicalorphysicalshouldchange.
KeyPoints
TheCompareandMergeutilityallowsyoutoreconciledifferencesbetweenmodelsinthesamefileorbetweenamodelandadatabase.
Thisutilityisagreatwaytocatchchangesmadetoadatabasethathavenotbeenconsistentlyreflectedinthelogical.
CHAPTER16FeaturesforAgileTeamsandContinuousImprovement
Menu Toolbar Explorer ShortcutKey
ShortcutMenu
n/a n/a Right-clickonmacro,RunMacro
Right-clickonmacro,then<U>
n/a
BecomeanER/StudioHotshot:
Youcanaddanymacroasashortcutbyright-clickingonthemacro,choosingAdd/RemovetoShortcuts,andthenselectingwhereyouwouldliketoadditto(orremoveitfrom).If
GettheprojectdoneIterativedev–Ready?Fasterandfaster
Thischapterwilldiscussanumberoffeaturesusefulforiterativedevelopmentpracticesincludingmacros,reusableprocedurelogic,changemanagement,andmodelvalidation.
MacrosAmacro is a function that isnotpartof the standard setofER/Studio functionalitybutwhichautomatesorsimplifiescomplexorrepetitivetasks.Forexample,thereisamacroinER/Studiothatallowsyoutoconvertallnamestouppercaseor lowercase.ER/Studiocomeswithover70macros,andyoucanalsocreateyourown.Wewilltalkaboutrunning,creating,editing,deleting,andrenamingmacrosinthissection.
RunningMacros
Tocreateamacro,clickontheMacrotabonthebottomoftheExplorerpane(asshowninFigure16.1).
Figure16.1MacrotabfromExplorerpane
Youcanrunanyofthemacrosthatappearusingoneofthesecommands:
youchooseMainMenu,itwillappearundertheMacroShortcutsmenu.Somemacrosrequirehighlightingtheobjectthatthemacroisbeingappliedtobeforerunningthemacro.Ifyoureceiveanerrormessagerunningaparticularmacro,itcouldbeduetonothavingtheobjectselectedpriortorunning.
Menu Toolbar Explorer ShortcutKey ShortcutMenu
Tools>BasicMacroEditor
n/a Right-clickonmacroormacrofolder,AddMacro…
Right-clickonmacroormacrofolder,then<A>
or
<ALT+T>,then<B>
n/a
Top5FavoriteMacros
HereisalistofmyTop5favoritemacros(innoparticularorder):
1. ExportMetaDatatoExcel.Veryquickandaccuratewaytodisplayallofthemodel’smetadatainaspreadsheetformat.
2. DefinitionEditor.Makesitveryeasytoenterdefinitionsformultipleentitiesand/orattributes.
3. NotesEditor.Averyquickwaytoenterissuesorothertypesofnotes.4. GetRelatedTables.Greatforhighlightingportionsofacomplexdiagram.Select
oneormoreentitiesandrunthismacrotohighlightinthediagramwhattheentitiesrelateto.Youcanchoosetohighlightparents,children,orboth.
5. ConvertNameCase.Selectoneormoreentitiesandrunthismacrotochangethecase.Muchquickerandlesserrorpronethandoingthismanually,whichIhavehadtodointhepast!
CreatingMacros
InExplorer,clickontheMacrostabonthebottomofthewindow.Youcancreateanewmacrousingoneofthesecommands:
ThescreeninFigure16.2appears.
Menu Toolbar Explorer ShortcutKey ShortcutMenu
n/a Applicationtoolbar: Right-clickonmacro,EditMacro…
Right-clickonmacro,then<E>
n/a
Figure16.2MacroEditor
ER/Studio is equippedwith awell-documented automation interface driven by the SaxBasiclanguage(aderivativeoftheVisualBasicforApplicationslanguage).Therearetwomainreasonstousetheautomationinterface:
AutomateRoutineTasks.Automatetedious,routinemodelingtasksorcustomizeER/Studiotoenforcemodelingpracticesinyourorganization.Forexample,youcanwriteamacrothatwillautomaticallycolorizechildtablescontainingpropagatedforeignkeys.Oryoucanwriteamacrotoautomaticallyinsertaspecificnameandprimarykeyintonewentitiesastheyarecreated.CollaboratewithOtherApplications.ER/StudiomodelscontainvaluablemetadatayoucanaccessfromapplicationssuchasMicrosoftExcel,Access,andOutlook.UsingER/Studio’sautomationinterface,youcancollaboratewithanyexternalapplicationthathasanexposedAPIoritsownautomationinterface.
EditingMacros
InExplorer,clickontheMacrostabonthebottomofthewindow.Youcaneditamacrousingoneofthesecommands:
or
<ALT+T>,then<B>
Menu Toolbar Explorer ShortcutKey ShortcutMenu
n/a n/a Right-clickonmacro,DeleteMacro
Right-clickonmacro,then<D>
n/a
Menu Toolbar Explorer ShortcutKey ShortcutMenu
n/a n/a Right-clickonmacro,RenameMacro
Right-clickonmacro,then<N>
n/a
ViewingthesourcecodeforanexistingmacroisagreatwaytopickuptipsonworkingwiththeSaxBasiclanguage.
DeletingMacros
InExplorer,clickontheMacrostabonthebottomofthewindow.Youcandeleteamacrousingoneofthesecommands:
RenamingMacros
InExplorer, click on theMacros tab on the bottom of thewindow.You can rename amacrousingoneofthesecommands:
Exercise16.1:CreatingandRunningMacros
Openyourpublishingdatamodelandpracticerunningsomeofthemacros,especiallymy“Top5”favorites.Ifyouarefeelingadventurous,youcaneditsomeofthesemacrosandseewhathappens.Youcanalsotrycreatingyourown.Liveontheedge!
ReusableProcedureLogic
Reusableprocedurelogiciscodethatiscreatedonceyetcanbeusedmanytimes.UndertheDataDictionarytab,youcancreatethreetypesofreusableprocedurelogic,whichareorganizedbydatabaseplatform:
ReusableTriggersReusableProceduresLibraries
ReusableTriggers
Adatabasetrigger(triggerforshort)isproceduralcodethatisautomaticallyexecutedinresponsetocertaineventsonaparticular tableorviewinadatabase.Atriggerexecuteswhen data modification operations such as INSERT, UPDATE, or DELETE occur.Becausetriggersarecustomizableandfireautomatically,theyareoftenusedtomaintain
Menu Toolbar Explorer ShortcutKey
ShortcutMenu
n/a n/a Right-clickonthedatabase(e.g.Oracle)andselect
NewTrigger…
n/a n/a
BecomeanER/StudioHotshot:
Once the trigger is created, you can edit it bydouble-clicking its name under the DataDictionarytab.
Menu Toolbar Explorer ShortcutKey ShortcutMenu
n/a n/a Right-clickonthedatabase(e.g.,Oracle)andselectNewProcedure…
n/a n/a
BecomeanER/StudioHotshot:
Oncetheprocedureiscreated,youcanedititbydouble-clickingitsnameundertheDataDictionarytab.
referentialintegrityinadatabase.
InER/Studio you canwrite the code for the trigger and then reference this codemanytimes.Click on the table on the physical datamodel that the triggerwill impact. Thenunder the Data Dictionary tab by expanding Reusable Procedural Logic and thenReusableTriggers.
YoucanenteryourcodeinBASICaswellasimportorexportexistingBASICcodefiles(.basfiles).
ReusableProcedures
Aprocedureisacompartmentalizedsetofcodethatperformsoneormoreoperations.Forexample,ifthereisasetoflogicthatneedstobeappliedtodeterminewhetheracustomerorderiseligibleforadiscount,aprocedurecanapplythislogic.Similartothetrigger,youcancreateaprocedureundertheDataDictionarytabbyexpandingReusableProceduralLogicandthenReusableProcedures.
YoucanenteryourcodeinBASICaswellasimportorexportexistingBASICcodefiles(.basfiles).
Libraries
A library contains blocks of code used to generate SQL for Reusable Triggers andReusableProcedures.Thisletsyoureuseblocksofcode.Reusabletriggersorprocedure
Menu Toolbar Explorer ShortcutKey ShortcutMenu
n/a n/a Right-clickon
LibrariesandselectNewLibrary…
n/a n/a
BecomeanER/StudioHotshot:
Oncethelibraryiscreated,youcanedititbydouble-clickingitsnameundertheDataDictionarytab.
Menu Toolbar Explorer ShortcutKey ShortcutMenu
Repository>ChangeManagementCenter
Repositorytoolbar n/a <ALT+R>,then<H> n/a
code can call library functions. The editor that launcheswhen creating new procedurallogicistheSaxBasiceditor,whichiscompatiblewithMicrosoftVisualBasic.Similartohow to create triggers and reusableprocedures, youcan create a libraryunder theDataDictionarytabbyexpandingReusableProceduralLogic.
ChangeManagementChangeManagementisafeatureoftheRepositoryandnotdirectlyavailableinER/StudioDataArchitect.However,itisanimportantfeatureofagiledevelopment,andthereforewewillbrieflydiscussithere.
ChangeManagementisamodelcheck-in/check-outfeaturesothatmultiplemodelerscanworkwithin the samemodel at different times. This feature also records every changemadetothemodelandwhomadethechangeforauditpurposes.Italsoallowsassigningtasks to data model changes which can connect agile user stories with subsets of themodel.
ToinvokeChangeManagement:
WhentheChangeManagementCenter isopened, thereare twotabsasshowninFigure16.3:Thefirstisforentry/displayoftasksandthesecondshowsthechangerecords.Thetaskscanalsobeexpandedtoshowchangerecordsindentedbeneaththem.
Figure16.3ChangeManagementCenter
The change management capability is also flexible to fit different work practices byallowing tasks to be associated to changes at check-in or check-out.The change recordviewisshowninFigure16.4.
Achangerecordcanbeselected,whichthenallowsthe<Details>buttontobeclicked,asshowninFigure16.5.
Thechangedetailsareindicatedbytheyellowdeltasymbols.Inthisexample,acolumnwasinsertedbeforeanother.Dependentviewsthatwereimpactedbythechangearealsoindicated.
Figure16.5ChangeRecordDetails
NamedReleasesNamed Releases are read-only archived snapshots of diagrams managed within theRepository.Thesesnapshotsareusefulforviewingthestateofadatamodelataparticularpointintime,suchasattheendofanagilesprint.Youcanviewanamedrelease,but,ingeneral,youcannotmodifyit.Aspecialrepositoryoperation,RollbackDiagram,letsyoucheckinanamedreleaseasthelatestversionofadiagram.OncetheRollbackoperationiscompleted, you can check out the diagram (or a portion of it) to modify it. UnderRepository > Releases, you will find operations to create, retrieve, and delete namedreleases.
ModelValidation
Model Validation contains over 50 checks to improve the quality of your logical orphysicaldatamodelsuchascatchingmissingobjectdefinitions,unuseddomains,identical
Menu Toolbar Explorer ShortcutKey ShortcutMenu
Model>ValidateModel… Applicationtoolbar:
Right-clickonmodel,ValidateLogical[orPhysical]DataModel…
<ALT+M>,then<V> Model>ValidateModel…
uniqueindexes,andcircularrelationships.Youcanchoosewhichvalidationoptionstouseandsortthereportresultsfoundbythewizardtohighlighthigherpriorityitemsthatneedtobeaddressed.
ToinvoketheModelValidationwizard:
TheModelValidationappearsasshowninFigure16.6.OntheValidationOptionstab,youcanchoose the rulesyouwould likecheckedforeachmodelcomponent.On theObjectSelection tab,youcanchoosewhichpartsof themodel tocheck.Click<SelectAll> tocheck the entire datamodel.Click <RunValidation>.Now theOutput tab contains theresultsof thecheck.Click<ExportResults> toexport thechecks inacommadelimitedfile.
Figure16.6ModelValidationWizard
KeyPointsAmacroisafunctionthatisnotpartofthestandardsetofER/Studiofunctionality,whichautomatesorsimplifiescomplexorrepetitivetasks.
ER/Studiocomesshippedwithover70existingmacrosandalsoprovidesyouwiththefunctionalitytoedittheseexistingmacrosaswellastocreateyourown.
Reusableprocedurelogiciscodethatiscreatedonceyetcanbeusedmanytimes,whichincludestriggers,procedures,andlibraries.
ChangeManagementisamodelcheck-in/check-outfeaturethatprovidesdetailedtraceabilityofchangesimplementedandassociatedwithtasks.
NamedReleasesareread-onlyarchivedsnapshotsofdiagramsmanagedwithintheRepository.
ModelValidationcontainsover50checkstoimprovethequalityofyourlogicalorphysicaldatamodelsuchascatchingmissingobjectdefinitions,unuseddomains,identicaluniqueindexes,andcircularrelationships.
APPENDIXAReferences
Burns,Larry.BuildingtheAgileDatabase:HowtoBuildaSuccessfulApplicationUsingAgileWithout Sacrificing DataManagement. Technics Publications, LLC, 2011. ISBN9781935504153.
DAMA International. The DAMA Dictionary of Data Management, 2nd Edition: Over2,000 Terms Defined for IT and Business Professionals. Technics Publications, LLC,2011.ISBN9781935504122.
DAMAInternational.TheDAMAGuide to theDataManagementBodyofKnowledge.TechnicsPublications,LLC,2009.ISBN9780977140084.
Hay,DavidC.EnterpriseModelPatterns:DescribingtheWorld(UMLVersion).TechnicsPublications,LLC,2011.ISBN9781935504054.
Hoberman, Steve. Data Modeling Master Class Training Manual 6th Edition. TechnicsPublications,LLC,2015.ISBN9781634620901.
Hoberman,Steve.TheDataModeler’sWorkbench.ToolsandTechniquesforAnalysisandDesign.JohnWiley&Sons,2001.ISBN0471111759.
Hoberman, Steve, and Burbank, Donna and Bradley, Chris. Data Modeling For theBusiness:AHandbookforAligningtheBusinesswithITusingHigh-LevelDataModels.TechnicsPublications,LLC,2009.ISBN9780977140077.
Hoberman,Steve.DataModelingMadeSimple2ndEdition:APracticalGuideforBusiness& Information Technology Professionals. Technics Publications, LLC, 2009. ISBN9780977140060.
Kent,William.Data and Reality: A Timeless Perspective on Perceiving andManagingInformationinOurImpreciseWorld.3rdEdition,TechnicsPublications,LLC,2012.ISBN9781935504214.
Reingruber,Michael.C.andWilliamW.Gregory.TheDataModelingHandbook:ABest-Practice Approach to BuildingQuality DataModels. JohnWiley& Sons, 1994. ISBN0471052906.
Silverston,Len.TheDataModelResourceBook,Volume1:ALibraryofUniversalDataModelsforAllEnterprises,2ndEdition,JohnWiley&Sons,2001.ISBN0471380237.
Silverston,Len.TheDataModelResourceBook,Volume2:ALibraryofDataModelsforSpecificIndustries,2ndEdition.JohnWiley&Sons,2001.ISBN0471353485.
Silverston,Len.TheDataModelResourceBook,Volume3:UniversalPatternsforDataModeling.JohnWiley&Sons,2009.ISBN9780470178454.
Simsion,GraemeC.andGrahamC.Witt.DataModelingEssentials,3rdEdition.MorganKaufmann,2005.ISBN0126445516.
Simsion, Graeme C. DataModeling Theory and Practice. Technics Publications, LLC,2007.ISBN9780977140015.
APPENDIXBAnswerstoExercises
Setting Appliedtoonlysubmodel Appliedtoentiremodel
Changingsubmodel’sbackgroundcolor x
Changinganentity’sname x
Changinganentity’sbackgroundcolor WillonlybeappliedtosubmodelunlessApplytoallsubmodelsischecked
Resizinganentity x
Creatinganentity x
Deletinganentity WillonlybeappliedtosubmodelunlessDeletefromModelischecked
Rearrangingentities x
Thissectioncontainsmyresponsestoanumberoftheexercises.
EXERCISE1.1:EducatingYourNeighborIfindtheanalogythatIusemostfrequentlyiscomparingthedatamodeltoablueprint.Mostnon-technicalfriends,family,andneighborsunderstandthisanalogy.“Justlikeyouneedablueprinttoensureasoundbuildingstructure,youneedadatamodeltoensureasoundapplication.”SometimesIalsoexplaintopeoplethatadatamodelisnothingmorethan a fancy spreadsheet that contains not just the spreadsheet columns, but also thebusinessrulesbindingthesecolumns.Ifboththeblueprintandspreadsheetanalogiesfail,Iquicklychangethesubjecttotheotherpersonandaskwhattheydo(andhopethattheyneveraskmeagain!).
EXERCISE5.1:ChangingSettingsinSubmodels
EXERCISE6.2:ClarifyingCustomerID
Therearethreetermswithinthisdefinitionthatrequireanexplanation:unique,identifier,andCustomer.
DocumentUniquenessProperties
Thetermuniqueisambiguousandcouldeasilybeinterpreteddifferentlybyreadersofthis
definition.Tomaintainclarityandcorrectness,thesequestionsshouldbeansweredwithinthedefinition:
Areidentifiervalueseverreused?
Whatisthescopeofuniqueness?
Howistheidentifiervalidated?
DocumenttheCharacteristicsoftheIdentifier
Wecandescribetheactualidentifierinmoredetailbyaddressingtheseareas:
Purpose.Forexample,perhapstheidentifierisneededbecausetherearemultiplesourcesystemsforcustomerdata,eachwiththeirownId.Toenableacommonsetofdatatobeheldaboutthem,thisidentifierneededtobecreatedtofacilitateintegrationandguaranteeuniquenessacrossallcustomers.Businessorsurrogatekey.Documentwhethertheidentifierismeaningfultothebusiness(i.e.,thebusinessornaturalkey)orwhetheritisameaninglessintegercounter(i.e.,thesurrogatekey).
Assignment.Documenthowanewcustomeridentifierisassigned.Thepartythatisresponsibleforcreatingnewidentifiersshouldalsobementioned.
DefinetheCustomer
A great way to define the customer in the definition for Customer ID is to have ahyperlinkbacktotheentityorconceptdefinitionofcustomer,suchasinaWiki.
EXERCISE7.1:ReadingaModel
Thefollowingstatementscanbemadeaboutthebusinessrules,basedontherolenamesspecifiedintherelationshipsinER/Studio.Therolenamesareshowninitalics.
EachEmployeemayprocessoneormanyTransactions.
EachTransactionmustbeprocessedbyoneEmployee.
EachTransactionmustbeeitheranOrder,aCredit,oraDebit.
EachOrderisaTransaction.
EachCreditisaTransaction.
EachDebitisaTransaction.
EachEmployeemaycontactoneormanyCustomers.
EachCustomermustbecontactedbyoneEmployee.
EachCustomermayplaceoneormanyOrders.
EachOrdermustbeplacedbyoneCustomer.
EachOrdermaycontainoneormanyOrderLines.
EachOrderLinemustbelongtooneOrder.
EachProductmayappearononeormanyOrderLines.
EachOrderLinemustreferenceoneProduct.
EachProductmaycontainoneormanyProducts.
EachProductmaybelongtoatmostoneotherProduct.
EXERCISE8.1:CreatingaConceptualDataModel
HereismysolutionusingIEnotation:
Andmysolutionusingdimensionalnotation:
APPENDIXCGlossary
Abstraction.Bringsflexibilitytoyourdatamodelsbyredefiningandcombiningsomeofthe attributes, entities, and relationshipswithin themodel intomore generic terms. Forexample,wemay abstractEmployee andConsumer into themore generic concept ofPerson.APersoncanplaymanyRoles,twoofwhichareEmployeeandConsumer.
Aggregate.Atablethatcontainstheresolutionofaone-to-onerelationship.
Alternatekey.Theoneormoreattributesthatuniquelyidentifyavalueinanentityandthatisnotchosentobetheuniqueidentifier.
Associative entity. An associative entity is an entity that resolves a many-to-manyrelationship.
Attribute.Alsoknownasa“dataelement,”anattributeisapropertyofimportancetothebusiness. Its values contribute to identifying, describing, or measuring instances of anentity. The attributeClaimNumber identifies each claim. The attribute Student LastName describes the last name of each student. The attribute Gross Sales Amountmeasuresthemonetaryvalueofatransaction.
Bridgetable.Atablethatresolvesamany-to-manyrelationshipfromthedimensiontothemeter. In other words, a given meter instance may need to refer to more than onedimension instance.Bridge tables can be shown as the typical resolution of amany-to-many on a logical but may need a different physical structure depending on reportingtools.
Candidate key. The one or many attributes that uniquely identify an entity instance.Candidatekeysareeitherprimaryoralternatekeys.
Cardinality. Defines the number of instances of each entity that can participate in arelationship. It is representedby the symbols that appearonboth endsof a relationshipline.
Classword.ThelastterminanattributenamesuchasAmount,Code,andName.Classwordsallowfortheassignmentofcommondomains.
Concept.Akeyideathatisbothbasicandcriticaltoyouraudience.“Basic”meansthistermisprobablymentionedmany timesaday inconversationswith thepeoplewhoaretheaudienceforthemodel,whichincludesthepeoplewhoneedtovalidatethemodelaswell as the peoplewhoneed to use themodel. “Critical”means the businesswould beverydifferentornon-existentwithoutthisconcept.
ConceptualDataModel(CDM).Asetofsymbolsandtextrepresentingthekeyconceptsand rules binding these key concepts for a specific business or application scope. TheCDMrepresentsthebusinessneed.
Conformeddimension.Builtwith theorganization inmind, insteadof just aparticularapplication, to support drill across queries and enterprise consistency. Conformeddimensionsdonotneedtobeidenticalwitheachother;theyjustneedtobefromthesamesuperset.Conformeddimensionsallowthenavigatortheabilitytoaskquestionsthatcrossmultiplemarts.
Datamodel. A set of symbols and text that precisely explains a business informationlandscape. A box with the word “Customer” within it represents the concept of a realCustomer, such as Bob, IBM, or Walmart, on a data model. A line represents arelationship between two concepts such as capturing that aCustomermay own one ormanyAccounts.
Datamodeler.A datamodeler is onewho confirms and documents data requirements.Thisroleperformsthedatamodelingprocess.
Datamodeling. The process of learning about the data; regardless of technology, thisprocessmustbeperformedforasuccessfulapplication.
Degenerate dimension. A dimension whose attribute(s) have been moved to the facttable.A degenerate dimension ismost commonwhen the original dimension containedonlyasingleattributesuchasatransactionidentifier.
Denormalization. The process of selectively violating normalization rules andreintroducingredundancyintothemodel.Thisextraredundancycanreducedataretrievaltimeandproduceamoreuser-friendlymodel.
Dependententity.Alsoknownasaweakentity,adependententityisanobjectofinterestto thebusiness thatdependsononeormanyotherentitiesfor itsexistence.Theentitiesthatadependententitydependsoncanbeindependententitiesorotherdependententities.Adependententityisdepictedasarectanglewithroundededges.
Dimension.Asubjectareawhosepurposeistoaddmeaningtothemeasures.Allofthedifferent ways of filtering, sorting, and summing measures make use of dimensions.Dimensionsareoften,butnotexclusively,hierarchies.
Domain.Thecompletesetofallpossiblevaluesthatanattributecanbeassigned.
Entity.A collection of information about something that the business deems importantandworthyofcapture.Anounornounphraseidentifiesaspecificentity.Itfitsintooneofseveralcategories:who,what,when,where,why,orhow.
Entity instance. The occurrences or values of a particular entity. The entityCustomermayhavemultiplecustomerinstanceswithnamesBob,Joe,Jane,andsoforth.TheentityAccount can have instances of Bob’s checking account, Bob’s savings account, Joe’sbrokerageaccount,andsoon.
Fact.Seemeasure.
Factlessfact.Afacttablethatdoesnotcontainanyfacts.Factlessfactscounteventsbysummingrelationshipoccurrencesbetweenthedimensions.
Field.Theconceptofaphysicalattribute(alsocalledacolumn).
Foreignkey.Anattribute thatprovides a link to another entity.A foreignkeyallowsadatabasemanagementsystemtonavigatefromoneentitytoanother.
Forward engineer. The process of building a new application by starting from theconceptualdatamodelandendingwithadatabase.
Grain.Thelowestlevelofdetailavailableinthemeteronadimensionaldatamodel.
GrainMatrix. A spreadsheet, which captures the levels of reporting for each fact ormeasurement. It is thespreadsheetviewofaninitialdesign,whichcouldresult inastarschema.
Hierarchy.Anarrangementofitems(objects,names,values,categories,etc.)inwhichtheitemsarerepresentedasbeing“above,”“below,”or“atthesamelevelas”oneanother.
Independententity.Alsoknownasakernelentity,anindependententityisanobjectofinteresttothebusinessthatdoesnotdependonanyotherentityforitsidentification.Eachoccurrenceofanindependententitycanbeidentifiedwithoutreferringtoanyotherentityonthemodel.Anindependententityisdepictedasarectangle.
Index.Apointertosomethingthatneedstoberetrieved.Theindexpointsdirectlytotheplaceonthediskwherethedataisstored,thusreducingretrievaltime.Indexesworkbestonattributeswhosevaluesarerequestedfrequentlybutrarelyupdated.
InversionEntry(IE).Anon-uniqueindex(alsoknownasasecondarykey).
Junkdimension.A dimension containing all the possible combinations of a small andsomewhatrelatedsetofindicatorsandcodes.
Key-value.ANoSQLdatabase that allows the application to store its data in only twocolumns(“key”and“value”)withmorecomplexinformationsometimesstoredwithinthe“value”columns.
LogicalDataModel(LDM).Thedetailedbusinesssolutiontoabusinessproblem.It ishowthemodelercapturesthebusinessrequirementswithoutcomplicatingthemodelwithimplementationconcernssuchassoftwareandhardware.
Measure.Anattributeinadimensionaldatamodel’smeterthathelpsansweroneormorebusinessquestions.
Metadata.Text,voice,orimagethatdescribeswhattheaudiencewantsorneedstoseeorexperience.Theaudiencecouldbeaperson,group,orsoftwareprogram.
Meter.Anentitycontainingarelatedsetofmeasures.Itisabucketofcommonmeasures.Asagroup,commonmeasuresaddressabusinessprocesssuchasProfitability,EmployeeSatisfaction,orSales.
Model.Asetofsymbolsandtextusedtomakeacomplexconcepteasiertograsp.
Naturalkey.Alsoknownasabusinesskey,anaturalkeyiswhatthebusinessseesastheuniqueidentifierforanentity.
Network.Amany-to-manyrelationshipbetweenentities(orbetweenentityinstances).
Normalization. The process of applying a set of rules with the goal of organizingsomething.Withrespecttoattributes,normalizationensuresthateveryattributeissinglevaluedandprovidesafactcompletelyandonlyaboutitsprimarykey.
NoSQL. NoSQL is a name for the category of databases built on non-relationaltechnology.NoSQL isnotagoodname forwhat it representsas it is lessabouthow toquerythedatabase(whichiswhereSQLcomesin)andmoreabouthowthedataisstored(whichiswhererelationalstructurescomesin).
Partition. A structure that divides or separates. Specific to the physical design,partitioning isused tobreaka table intorows,columns,orboth.Thereare twotypesofpartitioning: vertical and horizontal. Vertical partitioningmeans separating the columns(the attributes) into separate tables. Horizontal means separating rows (the entityinstances)intoseparatetables.
PhysicalDataModel(PDM).Representsthedetailedtechnicalsolution.ThePDMisthelogicaldatamodelmodified for a specific setof softwareorhardware.ThePDMoftengivesupperfection forpracticality, factoring in real concerns suchas speed, space, andsecurity.
Primarykey.Theoneormoreattributes thatuniquely identifyavalue inanentityandthatischosentobetheuniqueidentifier.
Program.A large, centrallyorganized initiative that containsmultipleprojects. It has astartdateand,ifsuccessful,noenddate.Programscanbeverycomplexandrequirelong-term modeling assignments. Examples include a data warehouse or a customerrelationshipmanagementsystem.
Project.Acomplete softwaredevelopmenteffort,oftendefinedbya setofdeliverableswith due dates. Examples include a sales data mart, broker trading application,reservationssystem,oranenhancementtoanexistingapplication.
Recursiverelationship.Arelationshipbetweeninstancesofthesameentity.Forinstance,oneorganizationcanreporttoanotherorganization.
RelationalDatabaseManagementSystem.RepresentsthetraditionalrelationaldatabaseinventedbyE.F.CoddatIBMin1970andfirstcommerciallyavailablein1979(whichwasOracle)[Wikipedia].
Relationalmodel.Captureshowthebusinessworksandcontainsbusinessrulessuchas“ACustomer must have at least oneAccount” or “AProduct must have a ProductShortName.”
Relationship.Rulesarecapturedonourdatamodelthroughrelationships.Arelationshipisdisplayedasalineconnectingtwoentities.
Reverseengineer.Theprocessofunderstandinganexistingapplicationbystartingwithitsdatabaseandworkingupthroughthemodelinglevelsuntilaconceptualdatamodelisbuilt.
Secondarykey.Oneormoreattributes(ifmorethanoneattribute,itiscalledacomposite
secondarykey)thatareaccessedfrequentlyandneedtoberetrievedquickly.Asecondarykeydoesnothavetobeunique,orstable,oralwayscontainavalue.
Snapshotmeasure.MonitortheimpactofeventscreatedfromabusinessprocesssuchasAccount Balance Amount,Ozone Layer Thickness, andAverage Survey QuestionScore.
SlowlyChangingDimension(SCD).A termforanyreferenceentitywhereweneed toconsider how tohandle data changes.There are four basicways tomanagehistory.AnSCDofType0meansweareonlyinterestedintheoriginalstate,anSCDofType1meansonly the most current state, an SCD of Type 2 means the most current along with allhistory,andanSCDofType3meansthemostcurrentandsomehistorywillbestored.
Snowflake. A physical dimensional modeling structure where each set of tables isimplementedseparately;verysimilarinstructuretothelogicaldimensionalmodel.
Spreadsheet.Arepresentationofapaperworksheetcontainingagriddefinedbyrowsandcolumns where each cell in the grid can contain text or numbers. The columns oftencontaindifferenttypesofinformation.
Stakeholder.Apersonwhohasaninterestinthesuccessfulcompletionofaproject.
Star schema. The most common physical dimensional data model structure. A starschema resultswheneach setof structures thatmakeupadimension is flattened intoasinglestructure.Thefact tableis inthecenterofthemodel,andeachofthedimensionsrelatetothefacttableatthelowestlevelofdetail.
Subtyping.Groupingtogether thecommonpropertiesofentitieswhileretainingwhat isuniquewithineachentity.
Summarization.A table that contains information at a higher level of granularity thanexistsinthebusiness.
Surrogate key. A primary key that substitutes for a natural key, which is what thebusinessseesastheuniqueidentifierforanentity.IthasnoembeddedintelligenceandisusedbyIT(andnotthebusiness)forintegrationorperformancereasons.
View.Avirtualtable.Itisadynamic“view”orwindowintooneormoretables(orotherviews)wheretheactualdataisstored.
APPENDIXDER/StudioCommandsQuickReference
MostFrequentlyUsedCommandsHerearethemostcommonkeyboardcommands:
PageUp:ScrollsuptheDataModelWindow.PageDown:ScrollsdowntheDataModelWindow.UpArrow:Scrollsuponeline.DownArrow:Scrollsdownoneline.RightArrow:Scrollsoveronepositiontotheright.LeftArrow:Scrollsoveronepositiontotheleft.<->:Decreaseszoomlevelbyonestep(firstneedtoclickonmodelwhitespace).<SHIFT+F8>:AllowsyoutofreezetheZoomwindowsothatyoucanpanaroundthediagramandstillmaintainfocusonaspecificdiagramobject.ThesamecommandunfreezestheZoomwindow.<CTRL+Home>:Scrollstotheupperlefthandpageofthemodel.
Herearethefunctionkeys:
<F1>:OpenstheonlineHelp.<F4>:OpenstheFindEntity/Viewdialog.<F7>:Activatesordeactivatesshadowing.<F8>:Opensorclosesazoomwindow.<F9>:Opensorclosestheoverviewwindow.
Herearethemostcommonshortcuts:
Double-click:Allowsyoutoedittheobjectyoudouble-clickedon<CTRL+A>:SelectsallentitiesintheDataModelWindow.<CTRL+C>:Copiestheselectedstructures.<CTRL+V>:Pasteswhathasbeencopiedintotheactivewindow.<CTRL+Z>:Restoresyourmodeltothelaststageofedit(theinvaluable“undo”command).<CTRL+Y>:Redoesthelastundocommand(the“redo”command).<Delete>:Removeswhatishighlightedfromthedatamodel.
ModelLevelCommands
Menu Toolbar Explorer ShortcutKey
Modeloptions Tools>Options… n/a n/a <ALT+T>,then<P>
Createmodel File>New Applicationtoolbar: n/a <CTRL+N>
or
<ALT+F>,then<N>
Savemodel File>Save
or
File>SaveAs
Applicationtoolbar: n/a <CTRL+S>
orforSave:
<ALT+F>,then<S>
orforSaveAs:
<ALT+F>,then<A>
Closemodel File>Close n/a n/a <ALT+F>,then<C>
Openmodel File>Open Applicationtoolbar: n/a <CTRL+O>
or
<ALT+F>,then<O>
GeneratePDM Model>GeneratePhysicalDataModel…
Applicationtoolbar: Right-clickonmodel,GeneratePhysicalDataModel…
<ALT+M>,then<G>
Changedatabaseplatform
Database>ChangeDatabasePlatform…
Applicationtoolbar: Right-clickonphysicaldatamodel,ChangeDatabasePlatform…
<ALT+B>,then<C>
Generatedatabase Database>GenerateDatabase…
Right-clickonphysicaldatamodel,GenerateDatabase…
<ALT+B>,then<G>
Createtitleblock Insert>TitleBlock DrawingShapestoolbar: n/a <ALT+I>,then<B>
Edittitleblock Edit>EditTitleBlock… n/a n/a <ALT+E>,then<E>
Deletetitleblock Edit>DeleteTitleBlock n/a n/a <DELETE>
or
<ALT+E>,then<D>
Importdatadictionary File>ImportDataDictionary
n/a n/a <ALT+F>,then<Y>
Createattachment n/a n/a Right-clicktheAttachmentsfolderandthenselectNewAttachmentType…
n/a
Createnewsource(repository)
n/a n/a Right-clickonOtherSourcesandthenselectNewSource…
n/a
Createnewsource n/a n/a Right-clickonOtherSourcesandthenselectImportNewSource…
n/a
Createdatamovementrule
n/a n/a Right-clicktheDataMovementRulesnodeandthenNewDataMovementRule
n/a
Createdataflow n/a n/a Right-clicktheDataFlowsnodeandthenselectCreateDataFlow
n/a
Createtransforma-tion Insert>Transforma-tionModelingtoolbar:
Right-clickondataflow,CreateTransformation
<ALT+I>,then<T>
Createdatastream Insert>DataStream
Modelingtoolbar:
n/a <ALT+I>,then<D>
Importdatamodel File>New…,thenImportModelFrom
or
File>ImportFile
Applicationtoolbar:n/a <ALT+F>,then<N>
or
<ALT+F>,then<M>
Exportdatamodel File>ExportFile n/a n/a <ALT+F>,then<F>
Exportimage File>ExportImage n/a n/a <ALT+F>,then<E>
Printmodel File>Print…Applicationtoolbar:
Right-clickonmodelorsubmodelfolder,PrintModel…
<ALT+F>,then<T>
or
<CTRL+P>
Generatereport Tools>GenerateReports… Applicationtoolbar:
Right-clickonmodel,GenerateReports…
<ALT+T>,then<R>
Createnamingstandardtemplate
Tools>NamingStandardsTemplateEditor…
n/a Right-clickonNamingStandardsTemplate,thenNewNamingStandardsTemplate…
n/a
InvokeNamingStandardsUtility
Model>NamingStandardsUtility… Applicationtoolbar:
Right-clickonmodelname,NamingStandardsUtility…
<ALT+M>,then<T>
InvokeCompareandMergeUtility
Model>CompareandMergeUtility… Applicationtoolbar:
Right-clickonsourcemodel(orsubmodel),CompareandMerge
<ALT+M>,then<M>
Utility…
InvokeModelValidation
Model>ValidateModel… Applicationtoolbar:
Right-clickonmodel,ValidateLogical[orPhysical]DataModel…
<ALT+M>,then<V>
DisplayWelcomePage View,followedbythetoolbarname
n/a n/a <ALT+V>,followedbytheletterfortheappropriatetoolbarname
Displaytoolbar View,followedbythetoolbarname
n/a n/a <ALT+V>,followedbytheletterfortheappropriatetoolbarname
Changecolor Format>Colors&Fonts… Diagramtoolbar:
n/a <ALT+O>,then<C>
Createtrigger n/a n/a Right-clickonthedatabase(e.g.Oracle)andselectNewTrigger…
n/a
Createreusableprocedure
n/a n/a Right-clickonthedatabase(e.g.Oracle)andselectNewProcedure…
n/a
CreateLibrary n/a n/a Right-clickonLibrariesandselectNewLibrary…
n/a
Menu Toolbar Explorer ShortcutKey
Createentity Insert>Entity Modelingtoolbar: Right-clickonEntities,NewEntity…
<ALT+I>,then<E>
Editentity Edit>EditEntity… n/a Right-clickonentity,Entities,EditEntity…
Or
Double-clickontheentity
<ALT+E>,then<E>
Changeentityname Edit>EditEntity(intheupperleftcorneryoucanrenametheentity)
n/a ModifyName <ALT+E>,then<E>(intheupperleftcorneryoucanrenametheentity)
Deleteentity Edit>DeleteEntity Diagramtoolbar: Right-clickonentity,DeleteEntity
<DELETE>
EntityandTableLevelCommands
or
<ALT+E>,then<D>
Resizeentity Format>ResizeEntity/View
n/a n/a <ALT+O>,then<R>
Copyentity Edit>Copy,thenEdit>Paste
Diagramtoolbar:
(copy),then(paste)
DragentitiestotheDataModelWindow
<CTRL+C>then<CTRL+V>
or
<ALT+E>,then<C>forcopy,<ALT+E>,then<P>forpaste
Findentity Edit>FindEntity/View…
Applicationtoolbar: n/a <F4>
or
<ALT+E>,then<F>
Findandreplaceentity Tools>UniversalNamingUtility
Applicationtoolbar: n/a <CTRL+F>
Edittable Clickontable,Edit>EditTable…
n/a Right-clickontable,EditTable…
Clickontable,<ALT+E>,then<E>
Rolluporrolldown Model>Denormaliza-tionMapping>RollupsorRolldowns
Modelingtoolbar: n/a <ALT+M>,then<Z>,theneither<R>forRollupsor<O>forRolldowns
Createview Insert>View Modelingtoolbar: Right-clickonViews,NewView…
<ALT+I>,then<V>
Changeview Clickonview,Edit>EditDatabaseView…
n/a Right-clickonview,Edit>EditDatabaseView…
Clickonview,<ALT+E>,then<E>
Createhorizontalpartition
Model>Denormaliza-tionMapping>HorizontalSplits…
Modelingtoolbar: Right-clickontable,Denormaliza-tionMapping>HorizontalSplits…
<ALT+M>,then<Z>,then<H>
Createverticalpartition
Clickontable,Model>Denormaliza-tionMapping>VerticalSplits…
Modelingtoolbar: Right-clickontable,Denormaliza-tionMapping>VerticalSplits…
Clickontable,<ALT+M>,then<Z>,then<V>
Changecolor Format>EntityColorandFontSettings
n/a Right-clickonentity,EntityColorandFontSettings
<ALT+O>,clickonEntityColorandFontSettings
SublevelCommands
Menu Toolbar Explorer ShortcutKey
Createsubmodel Model>CreateSubmodel…
Right-clickwheresubmodelshouldbeadded,CreateSubmodel…
<ALT+M>,then<C>
Editsubmodel Model>EditSubmodel…
n/a Right-clickonsubmodel,EditSubmodel…
<ALT+M>,then<E>
Deletesubmodel Model>DeleteSubmodel…
n/a Right-clickonsubmodeltodeleteandchooseDeleteSubmodel
<ALT+M>,then<D>
Menu Toolbar Explorer ShortcutKey
Createattribute Edit>EditEntity… n/a Right-clickonentity,NewAttribute
Or
Double-clickontheentity
<ALT+E>,then<E>
Editattribute Edit>EditEntity… n/a Right-clickonentity,EditEntity…
Or
Double-clickontheentity
<ALT+E>,then<E>
Deleteattribute Edit>DeleteAttribute Diagramtoolbar: Right-clickonattribute,DeleteAttribute
<DELETE>or<ALT+E>,then<D>
Copyattribute Edit>Copy,thenEdit>Paste
Diagramtoolbar:
(copy),then(paste)
DragattributestothedesiredentityintheDataModelWindow
<CTRL+C>then<CTRL+V>
or
<ALT+E>,then<C>forcopy,<ALT+E>,then<P>forpaste
Findattribute Tools>UniversalNamingUtility
Applicationtoolbar: n/a <CTRL+F>
Changedatatypes Tools>DatatypeMappingEditor
n/a n/a <ALT+T>,thenchooseDatatypeMappingEditor
Createdomain n/a n/a Right-clickonDomains(oronadomainfolder)thenchooseNew
n/a
AttributeandKeyCommands
Domain
Createuser-defineddatatype
n/a n/a Right-clicktheUserDatatypesnodeandthenselectNewUserDatatype…
n/a
Createreferencevalue n/a n/a Right-clicktheReferenceValuesnodeandthenselectNewReferenceValue…
n/a
Createindex Clickontable,Edit>EditTable…
n/a Right-clickontable,EditTable…
Clickontable,<ALT+E>,then<E>
Changecolor Format>EntityColorandFontSettings
n/a Right-clickonentity,EntityColorandFontSettings
<ALT+O>,clickonEntityColorandFontSettings
Createkey Edit>EditEntity… n/a Right-clickonentity,EditEntity…
Or
Double-clickontheentity
<ALT+E>,then<E>
Editkey Edit>EditEntity… n/a Right-clickonentity,EditEntity…
Or
Double-clickontheentity
<ALT+E>,then<E>
Menu Toolbar Explorer ShortcutKey
Createrelationship Insert>RelationshipModelingtoolbar:
Right-clickonRelationships,NewRelationship…
<ALT+I>,then<R>
Createsubtype Insert>SubtypeCluster>CompleteorIncomplete
Modelingtoolbar: n/a n/a
Createviewrelationship
Insert>Relationship>ViewRelationship Modelingtoolbar:
n/a <ALT+I>,then<R>,then<V>
Createcontainmentrelationship
Insert>Containmentrelationship Modelingtoolbar:
n/a n/a
Deleterelationship Edit>DeleteRelationship
n/a Right-clickonrelationship,Delete
<DELETE>
RelationshipCommands
Relationship or
<ALT+E>,then<D>
Displayrelationshipdescription
View>CursorPopupHelpOptions>DisplayRelationshipHelp
n/a n/a n/a
Findrelationship Insert>RelationshipNavigation Diagramtoolbar:
n/a <ALT+I>,then<G>
Changecolor n/a n/a Right-clickonrelationship,RelationshipColor
n/a
Menu Toolbar Explorer ShortcutKey
Runmacro n/a n/a Right-clickonmacro,RunMacro
Right-clickonmacro,then<U>
Createmacro Tools>BasicMacroEditor
n/a Right-clickonmacroormacrofolder,AddMacro…
Right-clickonmacroormacrofolder,then<A>
or
<ALT+T>,then<B>
Editmacro n/a Applicationtoolbar: Right-clickonmacro,EditMacro…
Right-clickonmacro,then<E>
or
<ALT+T>,then<B>
Deletemacro n/a n/a Right-clickonmacro,DeleteMacro
Right-clickonmacro,then<D>
Renamemacro n/a n/a Right-clickonmacro,RenameMacro
Right-clickonmacro,then<N>
MacroCommands
Index
Boldpagenumbersindicatewheretermisdefined1NF.Seefirstnormalform
2NF.Seesecondnormalform
3NF.Seethirdnormalform
4NF.Seefourthnormalform
5NF.Seefifthnormalform
80/20rule,15,16
abstraction,170–76,176
AdventureWorks,42,43
agile,2,5,19,65,283,289
alternatekey.Seekey,alternate
ambassador,16
applicationstability,171
attachment,232,235
creatinginER/Studio,234,235
attachmenttype
creatinginER/Studio,232
attribute,77,102
changingbackgroundcolorandfontinER/Studio,85conceptuallevel,77
copyinginER/Studio,86creatinginER/Studio,78,87
defininginER/Studio,84deletinginER/Studio,87
duplicate,120editinginER/Studio,83
findinginER/Studio,86logicallevel,78
movinginER/Studio,83physicallevel,78
AutoNamingStandards,20
axistechnique,151,152
BCNF.SeeBoyce/Coddnormalform
Boyce/Coddnormalform,162
businessglossary,20
CAERwinDataModeler,253,254,256,257,259,269
candidatekey.Seekey,candidate
cardinality,104,129
ChangeManagement,289,293
ChangeManagementCenter,19
chaos,163
classdiagram,15
CompareandMergeUtility,56,82,98,124,197,277,278,279,280,281,282,289,292,315
concept,133,155
concepttemplate,145
conceptualdatamodel(CDM),2,131,132,134–35,155
benefitsof,137
creatinginER/Studio,153,154dimensionaldatamodelexample,139
relationaldatamodelexample,138stepstocomplete,141
creativity,15
DataandReality,12
DataDictionary,221,235importingintoER/Studio,221
dataflowcreatinginER/Studio,247
datamodel,10–11,11,16changingbackgroundcolorandfontinER/Studio,44
closinginER/Studio,42creatinginER/Studio,38
openinginER/Studio,42usesfor,11–12,16
DataModelExplorer,28DataDictionarytab,28
DataLineagetab,28DataModeltab,28
Macrostab,28
DataModelWindow,29,248
datamodeler,110
datamodeling,15
datamovementrulecreatinginER/Studio,246
DatatypeMappingEditor,3,31,197,198,320
definition
addinginER/Studio,153exampleofimproving,96
importanceof,136reconciliationofcompeting,16
denormalization,198,217
applyinginER/Studio,202rolldown,200,203
rollup,200,205
dependententity.Seeentity,dependent
dimension,141,174degenerate,174
fixed,174multi-valued,174
ragged,174shrunken,175
dimensionaldatamodel,131,176CDMexample,139
LDMexample,159PDMexample,180
domain,99,102,224,235creatinginER/Studio,224,228
typesof,100usesof,101
entity,49,66
categories,49changingcolorandfontinER/Studio,62
changingnameinER/Studio,57collection,38,51,78,113,122
conceptuallevel,50copyinginER/Studio,62
creatinginER/Studio,52,65deletinginER/Studio,64
dependent,108editinginER/Studio,54
findinginER/Studio,63independent,108
logicallevel,51movinginER/Studio,57
physicallevel,51resizinginER/Studio,59
EntityEditor,55,78,80,83,84,97,98,99,194,250,251
entityinstance,50,66
ER/Studioaddingdefinition,153
changingcolorandfont,44,62,72,85,127changingentityname,57
changingsettingsinsubmodel,73
closingdatamodel,42
comparingmodelsandsubmodels,278–82copyingattribute,86
copyingentity,62creatingattachment,234,235
creatingattachmenttype,232creatingattribute,78,87
creatingCDM,153,154creatingdataflow,247
creatingdatamodel,38creatingdatamovementrule,246
creatingdomain,224,228creatingentity,52,65
creatingkey,96,99creatinglibrary,289
creatingmacro,284creatingnamingstandardtemplate,276
creatingPDM,180creatingprocedure,288
creatingrecursiverelationship,119creatingreferencevalue,230
creatingrelationship,116,128creatingsubmodel,68,73
creatingsubtype,118creatingtextblock,54
creatingtitleblock,40,74creatingtrigger,288
creatinguser-defineddatatype,229creatingview,207
definingattribute,84
definingsourcesystem,240deletingattribute,87
deletingentity,64deletingmacro,286
deletingrelationship,127deletingsubmodel,73
deletingtitleblock,41denormalizing,202
editingattribute,83editingentity,54
editingkey,98editingmacro,286
editingrelationship,122
editingsubmodel,72
editingtitleblock,40exporting,256
featuresof,17findingattribute,86
findingentity,63findingrelationship,127
findingview,63importing,253
importingdatadictionary,221indexing,210
installing,22landscapeof,27
movingattribute,83movingentity,57
movingrelationship,124movingsubmodel,72
openingdatamodel,42partitioning,213
printing,264–66renamingmacro,287
reporting,266–69resizingentity,59
runningmacro,283Top10favoritefeaturesof,21–22
ER/StudioBusinessArchitect,17
ER/StudioDataArchitect.SeeER/Studio
ER/StudioEnterpriseTeamEdition,25
ER/StudioRepository,18
ER/StudioSoftwareArchitect,18
eXtensibleMarkupLanguage,259
fifthnormalform,162
firstnormalform,162,164–66
flexibility.Seeapplicationstability
foreignkey.Seekey,foreign
fourthnormalform,162
functionkey,36,311
GeneratePhysicalModel,181,183,184,185
grainmatrix,149
Help,22
hierarchy,109
Hive,186,190,217
horizontalpartitioning.Seepartitioning,horizontal
How,50
IDEF1X.SeeIntegrationDefinitionforInformationModeling
IE.SeeInformationEngineering
impactanalysis,12
independententity.Seeentity,independent
index,210,217creatinginER/Studio,210
InformationEngineering,15,115,140
integration,94
IntegrationDefinitionforInformationModeling,15,115
inversionentry.Seekey,inversionentry
ISBN,88,89
JSON,193,194
Kent,William,12
key,88,102
alternate,92
candidate,88,102
creatinginER/Studio,96,99editinginER/Studio,98
foreign,95,102inversionentry,96
natural,94primary,92,161
surrogate,93,102
keyboardcommand,36,311
library,289
logicaldatamodel(LDM),2,131,132,157,176
dimensionaldatamodelexample,159relationaldatamodelexample,158
macro,283,293creatinginER/Studio,284
deletinginER/Studio,286editinginER/Studio,286
renaminginER/Studio,287runninginER/Studio,283
menuapplication,30
shortcut,31
MetaWizard,19
meter,141,172
model,10
ModelerExplorer,21
MongoDB,38,51,52,78,104,111,122,132,189,190,193,278
NamingStandardsTemplate,227,271,272,275,276,315
NamingStandardsUtility,227,271,272,274,276,315
naturalkey.Seekey,natural
nestedobject,122
network,109
normalization,160–70,167,176
Northwinddatamodel,222,223
object,3
ObjectRoleModeling,15
Options,38,43
Oracle,182,195,197,209,237,252
organizer,15
ORM.SeeObjectRoleModeling
OverviewWindow,29
partitioning,212,217
creatinginER/Studio,213
horizontal,212
vertical,212
physicaldatamodel(PDM),2,131,132,178,217
creatinginER/Studio,180dimensionaldatamodelexample,180
relationaldatamodelexample,179
precision,11
primarykey.Seekey,primary
procedure,288
ProductRegistration,23
recursiverelationship.Seealsorelationship,recursive
referencevalue,230,235creatinginER/Studio,230
relationaldatamodelCDMexample,138
LDMexample,158PDMexample,179
relationaldatamodel,131
relationship,103
changingbackgroundcolorandfontinER/Studio,127conceptuallevel,103
containment,104,111,112,122,322creatingarecursiverelationshipinER/Studio,119
creatinginER/Studio,116,128deletinginER/Studio,127
duplicate,119
editinginER/Studio,122findinginER/Studio,127
identifying,117logicallevel,104
many-to-many,118movinginER/Studio,124
non-identifyingmandatory,117non-identifyingoptional,117
one-to-one,117physicallevel,104
reading,104–7
recursive,109
RelationshipEditor,107,116,122,123
reusableprocedurelogic,287,293
reverseengineering,12
rule,129
lossof,171
SAPSybasePowerDesigner,253,269
SCD.SeeSlowlyChangingDimension
secondnormalform,162,167
Seeentity,independent,108
SlowlyChangingDimension,175
spreadsheet,13
starschema,201,202,217
StatusBar,37
showingandhiding,38
submodel,67,68,75
changingbackgroundcolorandfontinER/Studio,72changingsettingsinER/Studio,73
creatinginER/Studio,68,73deletinginER/Studio,73
editinginER/Studio,72movinginER/Studio,72
subtype,113creatinginER/Studio,118
subtyping,113–14,129
supertype,113
surrogatekey.Seekey,surrogate
TableEditor,172,194,195,217,238,250
TechnicsPublicationscasestudymodelingbookcoverexamplefor,14
overviewof,13
Teradata,195,197,209,237,252
textblock,54,66creatinginER/Studio,54
thirdnormalform,162,168–70
titleblock,45
creatinginER/Studio,40,74deletinginER/Studio,41
editinginER/Studio,40
toolbar
Application,32DrawingShapes,35
Layout&Alignment,34,57–59Modeling,34
trigger,287
UML.SeeUnifiedModelingLanguage
UnifiedModelingLanguage,11,15,18
UniversalNamingUtility,22,31,63,64,66,86,87,317,320
UniversalTableSpace,182
UserGuide,20,31,219
user-defineddatatype,228,235creatinginER/Studio,229
verticalpartitioning.Seepartitioning,vertical
view,205
creatinginER/Studio,207findinginER/Studio,63
ViewEditor,207,208
VIN,89
wayfinding,1,7,10,11,16
WelcomePage,20,24,28,316
What,49
When,49
Where,50
Who,49
Why,50
XML.SeeeXtensibleMarkupLanguage
ZoomWindow,29
Top Related