Reusing Attribute Definitions Using Domains

From ER/Studio Data Architect
Jump to: navigation, search

Go Up to Working with the Data Dictionary

Domains are very useful for creating entity attributes or table columns commonly used in your models. Creating a domain allows you to define the object once and then use it repeatedly by applying the domain to the entity attributes and table columns.

Domains are reusable attribute templates that promote consistent domain definitions. You construct domains as you would attributes, specifying a name, datatype properties, null status, default values and validation rules. After creating domains, you can re-use them in your data model by applying them to attributes and table columns. By defining a domain, you also gain the power of propagating changes to the underlying domain definition to all attributes and table columns that reference it.

One important method for enforcing business rules is to define and to apply domain restrictions. Domain integrity refers to the rules governing what values an attribute can take. By restricting and validating an attribute's values, you can implement important business rules such as ensuring that a checking account maintains a positive balance, or preventing the entry of invalid phone numbers.

ER/Studio Data Architect lets you organize your domains using domain folders. Domain folders let you create and manage your Data Dictionary Domains. You can:

  • classify domains in unique groups by creating different domain folders
  • create nodes within nodes
  • move existing domains into a domain folder
  • create new domains within the folder

Domains can be dragged and dropped into a table or entity to create a column or attribute, or can drag one domain onto another domain to create a subdomain by moving the selected domain beneath the target domain. Domains can also be copied and pasted onto another domain to create a copy of the selected domain as a subdomain or the target domain. Note that changes to the copied domain are not inherited by the pasted subdomain.

Domains can have nested subdomains or child domains that initially duplicate most of the attributes of the parent domain, but can have divergent behaviors once created. A Domain Override option in the Add Domain or Edit Domain functions creates inheritance and overrides the domain system without losing the valuable relationship with the attributes/columns (binding information).

Notepad blue icon 2.pngNote: When you delete a domain folder, all domains and folders within that folder are also deleted. All bindings to any columns and attributes are unbound.

Create a Domain Folder

  1. On the Data Dictionary tab, right-click the Domains node, and then click New Domain Folder.
  2. Type a name for the domain, and then click OK.

Create and Edit a Domain or Subdomain

  • To create a domain at the root of the Domains node: On the Data Dictionary tab, right-click the Domains node, and then click New Domain.
  • To create a domain within a domain folder: On the Data Dictionary tab, expand the Domains node, right-click the node of a domain folder, and then click New Domain.
  • To create a subdomain (a domain within a domain folder): On the Data Dictionary tab, navigate to the domain folder where you want to create the subdomain, right-click the domain folder, and then click New Domain.
  1. Define the domain as required, and then click OK to complete the editor.
  2. Once created, you can edit the domain by double-clicking its object on the Data Dictionary tab to launch the editor.
  • Receive Parent Modifications. (For subdomains). This option lets you synchronize changes made to the attributes of a parent domain with a those of the child domain. Selecting this option automatically synchronizes parent and child attributes, except those specified on the Reference Values, Naming Standards, Attachment Binding, and Binding Information tabs. Not selecting this option creates a child domain that is initially identical to the parent domain, except that the child domain is created without any attachment bindings. Subsequent changes to the parent domain will not be inherited by the subdomain. Any changes you make to the subdomain will override the values inherited from the parent domain. Henceforth, the child can only inherit attributes from the parent if these attributes were not previously specified for the child.
  • Synchronize Domain and Attribute/Column Names. This option allows you to synchronize the content in the Domain Name, Attribute Name, and Column Name fields. If you entered names in the attribute and/or column name fields that are different than the domain name, selecting this option overrides your entries.
  • Apply nullability to all bound columns? This option becomes available when you select a datatype that can have nulls but you choose to disallow nulls by clicking No in the Allow Nulls area of the Datatype tab. Selecting this check box has no impact if there are no bound columns.

The following tabs help you complete the Domain Editor options:

Datatype tab

  • Allow Nulls? This option becomes available when you select a datatype that can have nulls.
  • Identity Property. This area becomes available if the identity property is supported by the database platform of a model in the diagram, and the datatype selected, such as TINYINIT, supports this property. Only columns with a number-related data type can be set as Identity Columns.

Default tab

  • Default Binding. If a default value is not already bound to the domain (Data Dictionary > Defaults > Edit Default Definition > Binding Information), you can enter a Declarative Default value or choose another default from the Default Binding list. The declarative default appears in the SQL produced when you select Generate Database from the physical model.
  • Declarative Default. Specifies the default domain value when a value is not explicitly specified during an insert. You can apply DEFAULT definitions to any columns except those defined as timestamp, or those with the IDENTITY property. You can assign to a DEFAULT only a constant value such as a character string, a system function such as SYSTEM_USER(), a NULL, or a constraint name.

Rule/Constraint tab

Add, modify, or delete a constraint. Check constraints are used to ensure the validity of data in a database and to provide data integrity. For more information, see Enforcing Data Integrity Using Check Constraints.

Reference Values tab

Reference Values are attributes that define allowed data. They represent look-up table columns or code-value ranges or a rule or constraint applied to columns. For more information, see Defining Valid Attribute Data Using Reference Values.

Naming Standards tab

Controls user and object permissions to modify the affected item. When a Naming Standards Template is bound to an object, then that template is used instead of the Naming Standards Template selected in the Naming Standards Utility or the Generate Physical Model utility. This allows you to apply different naming standards to different objects when portions of a model require different versions of a standard. For example, some objects already exist in the database and you do not want to apply a newer naming standard to them. For more information, see Enforcing Naming Standards Using Naming Standards Templates.

Glossary tab

Displays a table consisting of all business terms related to the associated Domain. Columns include Term Name, Glossary (parent glossary of the term), and Description.

Available options include:

  • Add Term. Launches the Business Term Selector dialog box, allowing users to relate/unrelate terms from the Object.
  • Remove Term. Unrelates the selected term from the Object.
  • Refresh Term. Starts caching of the terms in the background with the status displayed next to the button.

Definition tab

Enter or edit a definition for the domain. If the target database supports it, ER/Studio Data Architect adds this definition as a domain comment when generating SQL code.

Note tab

The notes added here are included as part of the HTML report when you generate a report for the model. You can format the notes using standard HTML tags.

Override Controls tab

Controls what can or cannot be overridden on columns bound to this domain.

  • General Overrides. The allow/disallow options disable the "override" indicator on the bound attributes/columns if set to Disallow. When you modify the domain override controls and set one or more of the general override options to Disallow, ER/Studio Data Architect (and the RepoServer for Enterprise Data Dictionaries) removes all existing overrides for that particular property.
  • Name Synchronization. Never Sync completely detaches the domain name from the bound attributes/columns. This avoids inadvertent changes when the attribute or column names are bound to the same domain, and attribute/column name in the domain editor is changed. Changes to the names in the domain do not affect the names of attributes/columns that are bound to the domain. Partial Sync allows changes to the attribute/column name in the domain editor to update the name of any bound attributes or columns that have the old name, i.e. where the name is not overridden. For example, if you create two entities with an attribute from the domain, one with the default name and one with an overridden attribute name, and then modify the attribute name in the Domain editor and select Partial Sync, then the domain change modifies the attribute name in the entity where the name is not overridden, but does not change the attribute name in the entity where the name was overridden. If the names do not match, then the changes are not propagated.

Notepad blue icon 2.pngNote: The Name Synchronization controls do not apply when switching bound domains. Those controls only apply when editing a bound domain.

  • Attachment Synchronization. Keeps attachments in the domain in sync with the bound column. Any attachments added to a domain propagate to the attributes/columns. Always Migrate always migrates new attachments on the domain to the columns. You can still add other attachments directly to the columns.

Attachment Bindings tab

Bind an external piece of information, or attachment to the domain. You can also remove an attachment from an object, override an attachment binding's default value, or change the position of a bound attachment.

To override the value of the attachment you have moved to the Selected Attachments grid, double-click the Value of the target attachment. ER/Studio Data Architect opens the Value Override Editor or a list, depending on the attachment datatype. Attachments are created in the Attachments folder of the Data Dictionary and must be applied to the domain before they appear on this tab. For more information, see Attaching External Documents to the Data Model.

Binding Information tab

Select the object classes and/or specific objects to which you want to bind this attachment. You can override this setting using the Attribute or Column tab of the entity or table editor, respectively.

See Also