Chapter 5: U2 Metadata Manager
Generated keys provide support for the list structures that exist in UniData and UniVerse tables.
Tutorial
Use the U2 Metadata Manager to create metadata files, first normal form (1NF) maps, and schemas.
Creating metadata files
Use MDM to create a metadata file that contains an accurate description of your data files.
About this task
The metadata file is later used to map your file to first normal form (1NF) to determine which synonyms to use in cases where multiple field aliases exist and to map field conversions and format specifications to the corresponding SQL data type.
Procedure
1. Open U2 MDM and navigate to the U2 Resource view.
2. Navigate to the UniData or UniVerse server to which the U2 MDM tool will connect. Right-click the name of the server, and click Connect.
3. Expand the
Accounts node, and then expand Database Files. Select the file that you want to work with from the U2 Resource view.
In this example, the Orders file is used.
4. Right-click the
Orders file and select U2 Metadata Manager → Create New U2 MDM File.
The Choose Dictionary Locations wizard starts.
5. Select the dictionary fields that you want to accurately represent each dictionary location in the selected file.
For this example, accept the default selections.
6. Click
Next.
Creating 1NF files
U2 files must be presented to JDBC or ODBC applications as a set of related first normal form (1NF) tables. To do this, you must create a 1NF map of your UniData or UniVerse data that will contain the
1NF tables.
Procedure
1. Select the fields and attributes that you want to include in your 1NF map. For this example, choose
Select All.
2.
Optional: (Available for UniData only). Select Automatically fix non-compliant table and
column names if you want the U2 MDM tool to generate ODBC-compliant names.
3.
Optional: Select Create schema to create a schema automatically when the wizard finishes.
4. Click Finish.
Both the metadata file and the 1NF map open in the U2 MDM editor.
210
Choosing virtual attributes
In the metadata pane, each single valued, multivalued, and multi-subvalued (UniData only) field is grouped together in a graphical representation of the locations that you made available to first normal form.
The 1NF pane displays the first normal form tables that you just created, along with the required primary key.
If the
Create Schema option was selected, then the schema tool will open behind the U2 MDM editor.
Tip: UniData only. In this example if the compliant name option is not selected, the @ID column name is not SQL-compliant and a warning symbol is displayed next to the column name. Select the white arrow next to the column name to expand the table properties, click in the
Column
Name text field, then enter
ID. The name of the column changes to ID. All multivalued and multisubvalued tables in the 1NF map reference this key field and now reflect the new column name.
Click the Save icon to save your changes.
Choosing virtual attributes
The virtual attributes defined in UniData or UniVerse can be included in the metadata file.
Procedure
Select the virtual fields to include in the metadata file, and click Next.
Note: Virtual fields must be valid for the schema processing and for JDBC and ODBC access to succeed.
Creating schemas
After you define the 1NF map for your file, you can generate a deployable 1NF schema that you use to access JDBC or ODBC applications.
Procedure
1. In the U2 Resource View, navigate to the Metadata Repository files, and select the file to work with.
2. Right-click the file name and select
U2 Metadata Manager → Schema Tools.
3. At the prompt, click Yes to generate a new schema.
The Schema Data viewer opens, and displays the 1NF schema information comprising the schema on the server.
Tip: If the Create Schema option was selected when you created the 1NF map, and there were no errors during schema creation, the schema tool opens as a tab to the left of the U2
MDM editor for the currently selected file.
211
Chapter 5: U2 Metadata Manager
Data type enforcement
The following options are only available on UniData.
(Optional) Changing the data type enforcement
UniData only. After the wizard closes, your metadata files and 1NF map are visible in the U2 MDM editor, in either the Metadata pane or the 1NF pane. At the bottom of the U2 MDM editor are three tabs: Graphic, Metadata, and 1NF.
Procedure
1. If the ORDERS file is not already open, from the U2 Resource view, right-click the ORDERS file and click
U2 Metadata Manager → Open U2 MDM Editor.
2. Select the Metadata tab from the bottom of the U2 MDM editor.
3. Locate the
ORD_DATE field. In the Enforced column, select true to enable data type enforcement on the file.
4. Click File → Save to save your changes.
(Optional) Enabling data type enforcement
UniData only. After you have defined your data type enforcement changes in the Metadata editor, you need to apply those changes.
Procedure
1. In the U2 Resource view, navigate to the Metadata Repository files.
2. Right-click the ORDERS file, and click
U2 Metadata Manager → Data Type Enforcement → Apply
Metadata Settings.
3. Click OK.
Enabling data type enforcement in the graphical editor
This topic applies only to UniData. While viewing the data in the graphical view, you can turn data type enforcement on or off.
Procedure
1. Open U2 MDM.
2. From the U2 Resource view, right-click the database file and select U2 Metadata Manager →
Open U2 MDM Editor.
3. From the U2 MDM editor, right-click a field name from the graphical view.
4. Select Show Metadata.
5. In the Enforced field, select True or False
▪ INTEGER (SMALLINT)
▪ NUMERIC (DECIMAL, FLOAT, REAL)
▪ DATE (D2, D4, and so forth)
▪ TIME
212
Enabling UniData data type enforcement in the metadata text editor
Example
The following example shows the DATE_OUT options are expanded, and the Enforced menu is shown.
Enabling UniData data type enforcement in the metadata text editor
UniData only. Data type enforcement can be turned on or off from within the metadata text editor.
Procedure
1. Open a file in the U2 MDM editor.
2. Select the
Metadata tab.
3. In the Enforced field, turn data type enforcement on or off by selecting True or False from the drop down menu.
Example
The following example shows the DATE_OUT options are expanded, and the Enforced menu is shown.
213