Sybase Business Intelligence Solutions - Database Management, Data Warehousing Software, Mobile Enterprise Applications and Messaging
Sybase Brand Color Bar
delete

Search for    in all of Sybase.com
view all search results right arrow
  blank
 
 
 
 
 
 
 
 
 
 
Support > Technical Documents > Document Types > Technote > Tapping the power of PowerDesigner 8.0 Extended At...  
RSS Feed
 
 
 

Tapping the Power of PowerDesigner 8.0 Extended Attributes

Contents

Overview

PowerDesigner 7.x and 8.0 supports a feature called Extended Attributes.  This feature allows you to extend the attributes which PowerDesigner maintains for any given object.  For example PowerDesigner does not have a field to capture whether a table is a Global Temporary Table in Adaptive Server Anywhere.  With an extended attribute, we can add a location to hold this piece of information to every table object and also adds a mechanism for accessing the values in this location when generating DDL so that the appropriate code can be created automatically.  This logic is very tightly integrated with PowerDesigner's Definition Files, which enables you to easily transport this functionality to all of your designers.  PowerDesigner 7.x only allows this functionality in Database and Object Language Definition Files,   which means you can only associate extended attributes with objects in Physical or Object models.  PowerDesigner 8.0 extends this functionality to Conceptual models and also adds the ability to create extended attributes for all model types which are not dependent on the target database or target source language.

PowerDesigner 7.5 support for Extended Attributes is contained in the Database Definition or the Object Language Definition.  PowerDesigner 8.0 introduces the concept of Extended Model Definitions, which allows the definition of extended attributes for all objects in Conceptual, Physical or Objects models. Because of all these options you are allowed to associate multiple definitions with any given model.  The instructions provided below will use a number of the possible methods for implementing Extended Attributes, but the instructions will also apply to the other alternatives.  In every definition file there can be an Extended Attributes section.  This section will contain Types and Objects.

Types are used for restricting what is allowed for entry into an Extended Attribute.  When Types are created they are assigned a name, comment and a list of allowed values.  Types are used by Extended Attributes by assigning them as the attributes Data Type.

Objects are the container to hold your extended attributes.  As you require extended attributes they are added to the appropriate objects within this section of the definition file.  In most cases this subfolder will be empty, and desired objects are added to them as needed.
 

How to implement extended attributes

Object Creation

First we need to get to the desired Definition file.  To access this capability:
Select Tools > Resources > Object Languages, DBMS, or Extended Model Definitions.  For Extended Model Definitions you must select the type of model this definition applies to.

This example will use a DBMS Definition file.
Select Tools > Resources > DBMS

Step 1:  Create a copy of the target you would like to change, just in case.  In most cases you want to extend the behavior of one of the supplied target databases.

  • In the List of DBMS's dialog, click the New button 
  • In the New DBMS dialog, Supply a Name which does not match any names currently in the list, in the example "Sybase AS Anywhere 7 Extended".
  • In the New DBMS dialog, Select your target from Copy From dropdown list.

 
  • The DBMS Properties dialog for your new database definition will be displayed.
  • Click OK and you will be prompted with a Save As dialog, here you will name your new database definition as a .XDB file.  These should be saved in the same directory as all the PowerDesigner supplied database definition or it will not show up in your list of target DBMS's.  Although it does not matter what you call this file, we recommend including the original name as part of the new name so you know of the correlation.  I named mine in the above example, syasa70ea.xdb.
  • Your newly created definition should appear in the list.


Step 2:  Define Extended Attributes.

  • In the List of DBMS's Dialog, Select the newly created definition and Click the Properties button 
  • The DBMS Properties Dialog is displayed. Expand the Extended Attributes section.  Note: if it does not exist, right-Click on the top level which should be your database name. Select Add Items...   In the Selection(DBMS Template) dialog, check Extended Attributes and click OK.
  •  Expand the Objects sub-folder.
    • If the object for which you want to create attributes is not listed
      • Right-Click on Objects and select Add Items...
      • In the Selection(DBMS Template::Extended Attributes::Objects) dialog, select the checkbox next to the object you want
      • Click OK
  • Right Click on the type of object you want to create attributes for
  • Select New > Extended Attribute.  This will create a new extended attribute with a default name such as New1.
  • Expand the type of object folder to find this newly created extended attribute and select it.  Your screen should look like the following example.

 
  • Assign a name to the extended attribute in the Name field.  The name entered will be displayed when entering values and can also be used as a variable when generating scripts.
  • Enter comments describing the purpose of the extended attribute
  • Assign the extended attribute a datatype based on the type of information you would like to store in it.  i.e. String
  • Assign a default value if desired
  • Click OK to accept your changes.
  • Click Close in the List of DBMS's, you should be prompted to save your database definition.
  • Once we change our target DBMS to our newly created definition our extended attribute should be accessible.
  • They are accessed via the properties dialog for each object, which should contain an Extended Attributes tab for object which have them defined.

 
 

Types

Types  are used for restricting values entered in an Extended Attribute to a fixed list.  In the following example there is a requirement to categorize each table into a predefined list of possible values.  To accomplish this an Extended Attribute Type was created to specify my predefined list, then an Extended Attribute was created for a Table.  Since this particular attribute is not related to any specific target database, an Extended Model Definition for a Physical Data Model is the most efficient location for this extended attribute and extended attribute type example.  Using this method I can apply this extended attribute to any model regardless of my target DBMS.

Select Tools > Resources > Extended Model Definitions > Physical Data Models

Step 1:  Create a new Extended Model Definition

  • In the List of Extended Model Definitions (PDM) dialog, click the New button
  • In the New Extended Model Definition dialog, Supply a Name which does not match any names currently in the list, in the example "System Physical Definitions".
  • In the New Extended Model Definition dialog, Select a definition to Copy From in dropdown list.  Unless you are altering an existing definition, select <Default template>

 
  • You are prompted with a Save As dialog, here you will assign a physical file name to your new definition as a .XEM file.  I created a new folder called ExtModel under PowerDesigner to hold my extended definitions and assigned it a name of SysPhysical.xem
  • The Extended Model Definitions Properties dialog for your new definition will be displayed.
  • Expand the Extended Attributes section.
  • It should contain a Type and Object section.


Step 2: Create the type

  • Right Click on the Type section
  • In the context menu select New > Extended Attribute Type.  This will create a new extended attribute type with a default name such as New1.  Note: New > Category will create a folder under type in order to logically group your types.
  • Expand the Type folder to find this newly created extended attribute type and select it.
  • Assign a name to the extended attribute type in the Name field.  This name will become a new variable type, used when defining extended attributes.
  • Enter comments describing the purpose of the extended attribute type.
  • Click the Add a Value button in the List of Values section
  • Enter the desired value
  • Repeat as needed,
  • Place a check next to the default selection from the list of values
The following screen shows the completed Extended Attribute Type definition, with Application being the desired default value.


 

Step 3: Create an Extended Attribute

Following the steps described in the Object section above I created a Table Extended Attribute called TableCategory
The following screen shows the completed Extended Attribute definition.  Notice that my Extended Attibute Type is now in my list of valid Data Types.

Step 4: Associate the Model Extended Definition with the current model.

Because we have choosen a Model Extended Definition to contain this example, we need a method of associating the definition with the current model.  In Contrast, if we had choosen a DBMS Definition, the association is automatic because we have choosen it as the target database.
 

  • Select Model > Extended Model Definitions
  • In the List of Extended Model Definitions, Click the Import Extended Model Definitions button 
  • Note: you also have the option here of creating model specific Extended Model Definitions.
  • In the Extended Model Definitions Selection dialog, you are presented with a list of all Extended Model Definitions for this type of model which have not already been associated with the current model.  Select System Physical Definition
  • You have an option of either sharing or copying the definition.  Sharing will use the definition previously saved in a .XEM file and any changes made to that definition will be incorporated into this model.  Copy will bring a copy of the definition into the model, this definition can then be customized for this specific model and will not affect the .XEM file.  Conversely, changes made in the .XEM definition will not be incorporated into this model.
The following screen shows the Extended Model Definition associated to the current model.

The following screen shows the Extended Attibute in use on the table Employee.  Notice that entry is restricted to the list of valid categories.  Also notice that I have separate tabs for each associated definition file.  Here I have a tab for my System Physical Definition and also my Sybase AS Anywhere 7 Extended definitions which come from the DBMS definition.


 

Accessing Extended Attributes

Now that we have defined extended attributes and types, what can be done with them.  As has already been shown, the values are maintained on the Extended Attributes tab of the property sheet for each object.  These values can be included on reports, via the extended attributes list item within every object in the Report Editor.  These values can affect the generation of script by incorporating these variables into your Create or Add syntax, also maintained in the DBMS Definition files.  If values for the extended attributes are contained in your DBMS, they can be reverse engineered via ODBC by modifying the SqlListQuery, SqlAttrQuery or SqlOptQuery, also maintained in the DBMS Definition files.  Reverse engineering via script files will occur because of the generation changes.  These values will always be accessed by using the %ExtendedAttributeName% format in the definition files.  Extended Attributes can be used as User Defined variables within the context of the object it is assigned to.  Documentation can be found in the Using the DBMS Definition File Reference Guide chapter in the Advanced User Documentation manual on how PowerDesigner uses variables.  Also reference the examples listed below for specific examples of how this is done.

Examples

Following is a list of examples with specific steps to include a specified behavior.  We will be adding additional examples.

 

Related Links

DOCUMENT ATTRIBUTES
Last Revised: Jun 11, 2001
Product: PowerDesigner
Hardware Platform: Windows x86
Technical Topics: Data Modeling
  
Business or Technical: Technical
Content Id: 1012851
Infotype: Technote
 
 
 

© Copyright 2014, Sybase Inc. - v 7.6 Home / Contact Us / Help / Jobs / Legal / Privacy / Code of Ethics