Скачиваний:
94
Добавлен:
30.04.2013
Размер:
1.19 Mб
Скачать

The Erwin Insider™

& BPwin Insider

Tips, Tricks and Articles

of Interest to ERwin & BPwin Users

Contributions by ERwin & BPwin Users from Around the

World

Edited and Compiled by Ben Ettlinger

Volume 1 Number 2

September 2000

© 2000 Computer Associates International, Inc. (CA). All trademarks, trade names, service marks, and logos

1

referenced herein belong to their respective companies.

 

Table of Contents

 

Editor's Note.................................................................................................................................................................

4

Erwin Tips & Tricks ...................................................................................................................................................

5

Binding SQL Server 7.0 Default Objects ...........................................................................................................

5

Dealing with Model Mart Models That Take a Long Time to Open or Save ..............................................

5

Thesaurus & Dictionary.........................................................................................................................................

5

Domains....................................................................................................................................................................

6

Error Messages ........................................................................................................................................................

6

Mass Import of Definitions ...................................................................................................................................

6

Mass Changes to Attribute Names.......................................................................................................................

9

Printing Tips ..........................................................................................................................................................

10

Headers & Footers ................................................................................................................................................

10

Physical Role Names............................................................................................................................................

11

Resolving a Quirk in Relationship Names .......................................................................................................

11

Oracle 8i Connections / SQL*Net ....................................................................................................................

11

DB2 Index Defaults..............................................................................................................................................

12

User Defined Data Types in SQL SERVER ....................................................................................................

13

Magnificent Macros..................................................................................................................................................

14

Migrate Umlauts from a Logical Model to a Physical Model.......................................................................

14

Macro for Domains...............................................................................................................................................

14

Modeling Issues .........................................................................................................................................................

15

International Addresses........................................................................................................................................

15

Are You Ready for OR? ...........................................................................................................................................

16

Vendors Be Normal...................................................................................................................................................

30

© 2000 Computer Associates International, Inc. (CA). All trademarks, trade names, service marks, and logos

2

referenced herein belong to their respective companies.

 

© 2000 New York Enterprise Modeling User Group c/o Ben Ettlinger

10 Overlook Terrace

New York, NY 10033-2268

Ben.ettlinger@nypa.gov

© 2000 Computer Associates International, Inc. (CA). All trademarks, trade names, service marks, and logos

3

referenced herein belong to their respective companies.

 

Editor's Note

Considering our shoestring budget, and limited resources, the publication of the first issue of The Erwin & Bpwin Insider was a great success. The issue enjoyed wide circulation among Erwin users and was sent electronically around the World. The President of the Japan Erwin Users Group, our good friend Satoshi Matsumoto has orchestrated the translation of the entire issue into Japanese, hence making the Insider available to thousands of users in Japan. Exact circulation numbers are difficult to estimate in the world of electronic distribution, as the first issue as been forwarded many times over, via e-mail.

Although this is only the second issue we hope it will be the last….at least the last issue that deals with Erwin 3.5.2 as the current version. As we go to hard copy and electronic print the beta Erwin 4.0 beta program should be in full swing. I sincerely hope that the next issue will present, among other things, an introduction to 4.0 and a whole load of tips and tricks for the new 4.0 features. In order to do it, we really need help from you, the Erwin user. Sharing your expertise in the Insider will benefit all Erwin users, including yourself.

Based on the success of the first issue, and the feedback we received from users and CA, we felt we could widen The Erwin Insiders scope a little bit. In addition to the popular Tips and Tricks, and modeling issues, in this issue you will find two articles that go beyond just a discussion of Erwin 3.5.2. In "Are You Ready for OR" we take a look at the object relational scene, where indications are pointing the market is headed and which direction we think Erwin should go for version 4.

The final article lets off a bit of steam at software vendors for the apparent lack of respect for logical data modeling.

Ben Ettlinger

Editor

Data Administrator

New York Power Authority

President, NYEMUG

New York Enterprise Modeling User Group

ben.ettlinger@nypa.gov

© 2000 Computer Associates International, Inc. (CA). All trademarks, trade names, service marks, and logos

4

referenced herein belong to their respective companies.

 

Erwin Tips & Tricks

Binding SQL Server 7.0 Default Objects

Michael Levine Guelph, Ontario Canada

ERwin 3.5.2 SP2 exports default objects to SQL Server 7.0 quite properly. But it fails to bind the default objects to columns in SQL database. The cause of the problem is incorrect syntax in applying sp_bindefault procedure: ERwin does not enclose the name of the default in quotation marks as needed.

To walk around this problem you can manually enter necessary single quotation marks. Preferably you can use default constraints instead of default objects. You can specify the use of default constraints in ERwin menu Server|Default/Initial|Generate As box – just choose DEFAULT instead of sp_bindefault.

Constraints work OK.

Dealing with Model Mart Models That Take a Long Time to Open or Save

Seen on the Web Board - Terence J. Fitzpatrick, CA

1.) If the users only need to look at "some" of the metadata, show them how to use the Subject Area Editor (in ModelMart) and the Report Browser. The Subject Area Editor allows the user to select just a few entities to open from MM, and you can create them without opening the whole model first. The Report Browser can access metadata from models that aren't even open.

2.) Except in rare cases, nobody should be opening a model and working online with it all day. Open the model (or a piece of it) from MM, then use File/Save As(from ERwin's menu -- NOT MM's) to save an ER1 file to a local drive. Work on THAT

model. When ready to save back to MM, reconnect and use Save To Modelmart. MM's "snapshot" makes it easy.

Remember, all, that ModelMart stores every speck of metadata from the ERwin model into a relational database. "Opening" a model, means reading rows from the 75 table MM database and interpreting them back into a diagrammatic form which ERwin can then display.

Thesaurus & Dictionary

Ben Ettlinger, New York Power Authority

Can't wait for a spell checker, dictionary or thesaurus in Erwin? You can down load a free dictionary tool that works in Erwin or, as the vendor claims, with any other Windows desktop application. Once you down load and run the setup, all you have to do is highlight the word and click cntl L. In a split second the tool opens www.dictionary.com with the dictionary entry for the highlighted word. Cntl M will open an option menu with a choice to go to dictionary.com, thesaurus.com, a web search, or a link to amazon.com (nothing is really 100% free). Go to www.cleverkeys.com for

the download.

© 2000 Computer Associates International, Inc. (CA). All trademarks, trade names, service marks, and logos

5

referenced herein belong to their respective companies.

 

Domains

Seen on the Erwin WebBoard by Whit Owens, CA

One of the things I am seeing a lot of is a misuse of domains. ERwin Domains should be built as 'generic attributes/columns. If your organization uses Class Words then these are very good candidates for domains. Ideally, a domain should support several occurrences of the attribute. Name, Last name, First Name, Address, Area Code, Start Date...are all good possibilities. Depending on your naming standards, creative use of ERwin Macros in the 'name inherited by attribute' line of the domain editor can be very useful, a Macro of <%Lower(%OwnerEntity %AttDomain)> would create a lower case attribute using the entity name plus the domain name. Any property given an attribute or column can be given to a domain and these domains can now be dragged from the Independent Attribute Browser to an entity to create attributes with all the properties given the domain. It now becomes easier to use the standard than to create something from scratch.

Error Messages

Seen on the Erwin WebBoard by Linda Jeney

Invalid object name 'pbcattbl'

This error occurs because of a default setting. "From the Client menu, select Target Client and then Select 'None.' You currently have it set to PowerBuilder (the default, don't ask me why - OK, it's because PB is the first in a set of radio buttons, but that is a really stupid reason) and although this doesn't cause problems when forward engineering, it does cause problems when generating as the export phase of a complete compare."

Mass Import of Definitions

Submitted by Karen Lopez, List Mistress for the Erwin Web Board www.infoadvisors.com

A little background, first. While many of the data model objects had definitions, a few entities and attributes did not. Rather than install a copy of ERwin on a business person's machine, train him, and have that model tied up for a few days, we decided to let them write draft definitions separately, then merge them in later.

- Generate a report of Entity Name, Entity Definition, Table Name, Attribute Names, Column Name, Attribute Definitions.

* IMPORTANT *

Include only owned attributes so that each attribute appears once (unless there are manually duplicated attributes, of course.) Also, you may want to ensure that all objects are not marked logical only.

- Export this report to a spreadsheet. I chose Excel, but any DDE capable of saving as an ascii file will work.

© 2000 Computer Associates International, Inc. (CA). All trademarks, trade names, service marks, and logos

6

referenced herein belong to their respective companies.

 

- Provide this spreadsheet to the person working on the definitions. Instruct him not to change any of the object names, no matter what problem he sees. Instruct them not to use any quotes, special characters, or apostrophes anywhere. This is difficult to do, I know, but as you know these can make it impossible to do an import.

-Review definitions and reach agreement on any issues. Use Search and replace to remove any quotes, apostrophes, or special characters.

-In the original model, generate and save a script for generating a database. Use only those options necessary to create the tables and columns.

-In the final spreadsheet file, insert a new column that will be used to construct an SQL statement for reverse engineering.

-Use a concatenation function to form part of an SQL statement. This should use the Table Name and Column name.

For instance, In Excel, the function looked something like this (for a UDB table)

CONCATENATE("COMMENT ON COLUMN ", B1, ".", C1, " IS '", D1, "';")

Where B1 is the column for Table Name, C1 is the column for Column Name and D1 is the column for the definition. Copy this formula down the new column in the

spreadsheet. Copy this column to a new spreadsheet, converting the formula to hard values when asked.

-Export the new spreadsheet in ASCII format.

-Using the script generated from the model, manually cut and past the definitions for one table where it goes in the script file.

For instance, using the Movies.ER1 file that comes with ERwin, the CUSTOMER table would look like:

CREATE TABLE CUSTOMER ( customer_number INTEGER NOT NULL, customer_first_nam CHAR(15) NOT NULL, customer_last_name CHAR(15) NOT NULL,

customer_address_1 VARCHAR(180) NOT NULL, customer_address_2 VARCHAR(180), customer_city CHAR(18),

customer_state CHAR(2), customer_zip CHAR(10), customer_phone INTEGER, customer_credit_ca INTEGER, customer_credit_ca TIMESTAMP, customer_status_co CHAR(1)

);

COMMENT ON COLUMN CUSTOMER.customer_number IS 'An identifier for a customer assigned at the first time a person rents a video.';

© 2000 Computer Associates International, Inc. (CA). All trademarks, trade names, service marks, and logos

7

referenced herein belong to their respective companies.

 

CREATE TABLE EMPLOYEE ( employee_number INTEGER NOT NULL, store_number INTEGER NOT NULL, employee_first_nam INTEGER NOT NULL, employee_last_name CHAR(15) NOT NULL, employee_address_1 VARCHAR(20), employee_address_2 CHAR(20), employee_city VARCHAR(20), employee_state CHAR(2) NOT NULL, employee_zip INTEGER,

employee_phone INTEGER, employee_ssn INTEGER, hire_date TIMESTAMP, salary NUMERIC NOT NULL,

supervisor INTEGER NOT NULL );

... and so on.

-save the modified script file.

-Open *a copy of* the original model in the Main subject area, set the display to physical, then do a complete compare (if you want to compare each definition with the original one as I did) or just use Alter Database if you are going to automatically replace all definitions.

-If all goes well (meaning that you removed all special characters and nobody changed the column names, you will have a new ER1 file with updated definitions.

I could have automated this much more, but I only had about 100 definitions to deal with. I would have spent more time if I had more or believed I would be doing this more than one time.

Some Comments:

-Because this technique uses database functions to do the import, it will only work on those objects that are not marked Logical Only.

-If the model is in development, the best time to write definitions is when the objects are being created. As much as we all hate doing the definitions, it's much more painful to do them afterwards, in batch.

-Good definitions are very important for others to understand the model. Don't assume that just because you have good names that the true meaning will be understood.

-When writing definitions, keep in mind that you are not writing a definition of the word used as the name of the object. You should be writing about the concept being modeled. For instance, there may be a definition of the word -customer- in the dictionary, but that may not be exactly what you mean by the entity your put in the model.

© 2000 Computer Associates International, Inc. (CA). All trademarks, trade names, service marks, and logos

8

referenced herein belong to their respective companies.

 

- Don't strictly use those grade 2 definition rules you learned in school. It is silly to read a definition of -Order Datethat goes something like:

"A named division of time that a request for goods was submitted by a being, natural or conceptual, to an organization."

when it will be less confusing and much better understood if you write

"The date that a product order was received at MyCompany, Inc."

Yes, it breaks those rules of using part of the defined term in the definition, but the second definition is much clearer on what the modeler meant when he created that attribute. 1

Mass Changes to Attribute Names

Submitted by Karen Lopez, List Mistress for the Erwin Web Board www.infoadvisors.com

-Export the ERwin model to an ERX file.

-Open the ERX file in Wordpad

-Find the section on Domain Properties

-Cut out and paste this section into its own Wordpad file. Save this as Attributes.txt

-Open Attributes.txt in Excel, which will ask you some questions about format. Choose comma delimited.

-In Excel, Create a new column in this worksheet.

-Populate the column with a function that changes the attribute name for all the rows that have CD_ANM as the property type. Use the SUBSTITUTE function to substitute a space for an underscore. Simply copy the rows that have a different property type.

-Copy that column

-Paste Special it (values) where the name column is

-Save the worksheet as a text file.

-Open the text file in Wordpad

-copy the text

-replace the old section in the _original_ ERX file with the new text.

Entity Names

- Same as above, except you can change all the names in the Entity section.

When you have replaced the two sections, you can import the new ERX file into ERwin

1 Editor's Note : CA Tech Support has advised as follows: "CA Tech has an Excel sheet that contains the instructions and the macro preset to convert the Table/Column Name/Comments in the correct format which can be imported into ERwin.

Note: Since, not all databases support Comments, so that field/option may not be available for all databases. One can change the Target Server to Oracle (which does support Comments) but make sure that while changing the target server when it prompts for data conversion. check "NO"!!! Changing the target server to and from can potentially harm the internal data mapping and can corrupt the diagram." We will attempt to procure that document and include it in our next edition.

© 2000 Computer Associates International, Inc. (CA). All trademarks, trade names, service marks, and logos

9

referenced herein belong to their respective companies.

 

There are a couple of gotchas (how excel treats quotes and how it treats commas in DECIMAL(9,9) fields), but I'm sure you can figure it out.

The process isn't as daunting as it looks. If you know Excel well, it should only take you 30 minutes to figure it out.

Printing Tips

Submitted by Karen Lopez, List Mistress for the Erwin Web Board www.infoadvisors.com

You can save yourself a whole lotta laying out, printing, and publishing time if you set up every Subject Area with two standard Displays: one named Logical and one named Physical.

By having to separate Displays for logical and physical views you will not have to spend hours re-laying out diagrams when you switch between the two displays. This will also allow you to easily select the proper displays when using WebPublisher.

Also, you can include the display macro word in the subject area headers so that each diagram is self-describing at print time. If you have the header set up as:

%File% -- %Display% / %SubjectArea%

your header will look like

DataModelFileName -- Logical / Vendor Maintenance

...just about all you need to know about the diagram you have printed. Add page numbers and timestamp to the footer and you are set.

Headers & Footers

Submitted by: Karen Lopez, List Mistress for the Erwin Web Board www.infoadvisors.com

If you have changing information that would normally appear in a diagram header or footer, but you are frustrated by the time it takes to go to each Subject Area and change the header or footer, you might want to try the trick below.

Some background, first. I'm working on a standard data model that has release versioning numbers much like software (1.2, 2.1, 2.2 RFC1, etc.). I used to include this information in the page footers but every time there was a release I had to update those footers and headers in each of 50+ Subject Areas. With the trick below, now I only have to update it once.

1.Go to the Main Subject Area

2.Insert a text block with your base information (in my case, Version x.x, Copyright 2000 Mycompany, Inc.).

© 2000 Computer Associates International, Inc. (CA). All trademarks, trade names, service marks, and logos

10

referenced herein belong to their respective companies.