Toad World® Forums

Naming Conventions


#1

I’d like to take this logical model:


facility category

facility category identifier
1:1
|
|
|
0:M

facility

facility identifier

and create the following relational model:


t_fac_cat

fac_cat_id
1:1
|
|
|
0:M

t_fac

fac_id
fac_cat_id <NN,FK>

I’ve created the logical model and used ‘Simple Model Conversion’ to convert to Oracle 10g.

I then applied the following naming convention to the physical model:

General: Everything checked.
Naming Convention Rules:
‘entities’ prefix ‘t_’ case ‘lowercase’
‘attributes’ prefix none case ‘lowercase’
Glossary Character Replacement: =_ (i.e., =)
Glossary Word Replacement:
facility=fac
category=cat
identifier=id

and get:


t_facility_category

facility_category_identifier
1:1
|
|
|
0:M

t_fac

facility_identifier
facility_category_identifier <NN,FK>

The ‘t_’ prefix worked. The space replacement with underscores worked. Entity ‘facility’ was abbreviated to ‘fac’. However, none of the other abbreviations were applied. It appears the space->underscore replacement occurs first and prevents the matching of the rest of the abbreviations. If that is what is happening, is there another way to get the naming I want?

Brian


#2

You are absolutely right. The space->underscore replacement occurs first and prevents the matching of the rest of the abbreviations. We are planning to change this behaviour in the next release (CR #69743) .

Workarround is either to add all words into the glossary (e.g. facility category = fac_cat ), that could be a lot of words or not to replace the space character with the underscore character in the naming convention rules and to run later a simple macro that would replace the space character with the underscore character.

Thank you for your remark.

David


#3

David,

That’s good news that this issue is being addressed.

Thanks for your help.

Brian


#4

David suggested:

“… or not to replace the space character with the underscore character in the naming convention rules and to run later a simple macro that would replace the space character with the underscore character.”

This works pretty well. Here’s the macro I created (i.e., hacked together from two existing macros) to replace spaces with underscores:

function RenameEntityAndAttributes(Entity, Log)
{
var EntityOldName, EntityNewName, Attribute, a, AttributeOldName, AttributeNewName;
EntityOldName = Entity.Name;
EntityNewName = EntityOldName.replace(/ /g,""); //renaming entity
Entity.Name = EntityNewName;
if (EntityOldName!=EntityNewName)
Log.Information(“Entity '”+EntityOldName+"’ was renamed to ‘"+EntityNewName+"’");
for (a=0; a<Entity.Attributes.Count; a++)
{
Attribute = Entity.Attributes.GetObject(a);
AttributeOldName = Attribute.Name;
AttributeNewName = AttributeOldName.replace(/ /g,"
"); //renaming attribute
Attribute.Name = AttributeNewName;
if (AttributeOldName!=AttributeNewName)
Log.Information("- Attribute ‘"+AttributeOldName+"’ was renamed to ‘"+AttributeNewName+"’");
}
}

function Main(){
var App = System.GetInterface(“Application”);
var Model = App.ActiveModel;
var WS = App.ActiveWorkSpace;
var Log = System.CreateObject(“Log”);
if(Model==null) return;

var i, Obj, origName;
var Counter = 0;
Model.Lock();

for(i=0; i<Model.AllObjects.Count;i++)
{
Obj = Model.AllObjects.GetObject(i);
if (Obj.ObjectType==2502)
{
RenameEntityAndAttributes(Obj.ParentBase, Log);
}
}

Model.UnLock();

System.ShowMessageDialog(1000,‘ReplaceSpacesFromEntitiesAndAttributesNamesDialog’,‘Renaming complete. Details are displayed in the Log area.’,3,4);
System.RefreshModel(Model);
}

Brian


#5

I am trying convert logical to physical and in logical i have a attribute name
Column Load Date
I did simple conversion and applied Naming standards in which I set up glossary for load date
Load Date = _LD
But when i apply it is simply ignoring spaces and follwing is the result
ColumnLoadDate
I am trying to get Column_LD