Importing XML Through the GUIs - Teradata Meta Data Services

Teradata Meta Data Services User Guide

Product
Teradata Meta Data Services
Release Number
15.00
Language
English (United States)
Last Update
2018-09-27
Product Category
Teradata Tools and Utilities

Importing XML Through the GUIs

To use one of the MDS GUIs to import XML, the user needs to start MetaBrowse or MetaManager, and from the Tools > Import > XML menu item select an XML file from the file-open dialog. Prior to the 12.0 release, this action would send the XML file directly to the MetaXML utility, which requires XML in MetaXML schema format. Now, the implementation will first check the name of the root node in the XML. If the root node is “METAXML”, the XML in this file is supposed to already be in MetaXML schema format, and so it is sent to MetaXML as usual.

However, if the root node is not “METAXML”, the implementation will look to see if there is an XSLT file available to translate the source XML into MetaXML XML. It does this by checking the metatools_cfg.xml file in the %METAHOME% tools directory. This file contains a <Bridge> element, as a child of the <Import><XML> elements, for each bridge supported. Currently there is just the one for CWM/XMI Bridge.

Each <Bridge> element has a “rootnode” attribute. This attribute contains the name of the XML root node for the source XML file, that is, the one to be transformed. For the CWM/XMI Bridge it is “XMI”. So, the implementation reads the metatools_cfg.xml file, looking for a <Bridge> “rootnode” attribute which matches the root node of the XML it is trying to import. If it finds a match, it will then get the rest of the information for this bridge from the child <Bridge>elements: namely, the XSLT file name, found in the <XSLTFile> child element; the metamodel name, found in the <AIMName> child element; and the XML file for the metamodel, found in the < AIMXMLFile> child element.

If it does not find a root node to match the source XML, it will display an error message saying that the XML is not in MetaXML scheme format, and that there is no translation file available.

But if a match of the root node is made, the implementation will next look for the presence of the necessary metamodel in the MDS repository. For CWM/XMI XML, this is the CWM_Metamodel. If it is not already in the repository, the implementation will display a message saying so, and asking the user for permission to create it. If the user OKs this, it will import the XML of the <AIMXMLFile>. For the CWM/XMI XML, this is “CWM_Metamodel.xml”. It expects this file to also be in the tools directory.

If the metamodel is present, the implementation will apply the XSLT identified in the <XSLTFile> element to the source XML. For the CWM/XLI XML, this is the “CWM_MetaXML.xslt” file, which it again expects to find in the tools directory.

If the XSLT has been properly worked out, the result will be the original XML transformed into MetaXML schema XML. The implementation will then save this in a file in the same directory as the source XML, with a “t_” prepended to its name.

Finally, the implementation will launch the MetaXML utility to import the transformed XML into the MDS repository.

Batch XML Transformation Through the VBScript File

A batch process can be used for importing a tool’s XML instead of the GUI method. After the CWM/XMI XML has been exported from a tool, there is a simple two-step process that can be used to transform and import it into the MDS repository. It involves using an MDS provided VBScript file to transform a tool’s XML, and the MetaXML utility to do the import.

This VBScript file is called “bridge.vbs” and is located in the MDS installation directory in the tools folder. This script needs the name of the source XML file (exported from the tool) and the name of the XSLT file to do the transformation. To transform a CWM/XMI XML, use the CWM_MetaXML.xslt file also found in the tools folder.

If successful, it will produce a transformed XML file with the same name as the source file but with a “t_” prepended to it. This XML is now in MetaXML schema format, and it so is ready to be imported by the MetaXML utility into the MDS repository.

Note: The CWM_Metamodel must already be installed in the repository as this batch procedure will assume it is there.

See the “Purpose” section in the bridge.vbs file for more details – it can be viewed in any text editor.