Configuring UML-to-XSD transformations

To specify the information that the transformation uses to generate the output that you expect, you use the New Transformation Configuration wizard and the transformation configuration editor, which guide you through the configuration.

About this task

A transformation configuration has .tc as a file name extension, and contains the information that the transformation uses to generate the output that you expect. A transformation configuration also contains information that is specific to a particular type of transformation. To edit an existing transformation configuration, in a view that shows the workspace resources, double-click a transformation configuration file, which opens the transformation configuration editor.

To simplify working with the transformation configuration file, save the configuration file in the project that contains the elements to transform.

Procedure

  1. Click File > New > Other > Transformations > Transformation Configuration.
  2. Specify the details of the configuration. In the New Transformation Configuration wizard, on the Specify a Configuration Name and Transformation page, complete the following steps:
    1. In the Name field, specify a name for the configuration.
    2. In the Configuration file destination field, specify the destination for the transformation configuration file. The destination is a relative path in your current workspace. You can specify a fully qualified project name or folder name. If you specify a folder in a project, you must prefix the folder name with a forward slash (/).
    3. From the Transformation list, expand Service Oriented Architecture Transformations, and select UML to XSD.
      Note: To display the transformations that are installed, but not enabled, click Show all transformations. A transformation must be bound to a capability to be displayed in this list.
  3. In the Protocol section, specify the modeling protocol, which is also called the design contract management protocol (DCMP). The value that you select determines whether to synchronize the source and target of the transformation.
    • If the source model is the primary engineering artifact, select Conceptual. Any changes to the source model are propagated to the target model.
    • If the target model is the primary engineering artifact, click Mixed. The transformation converts the source artifacts to visual representations that are directly connected to the target artifact. Select this option to work in the target domain instead of with the source model, or to retain the artifacts for analysis. The transformation output becomes the primary engineering artifact.
    • If the architecture that the source artifacts represent evolves independently from the target, select Reconciled. Selecting this option enables the reverse transformation, which you can use to compare the source and target, and to reconcile changes. You might also select this option if different teams implement, develop, or maintain the architecture.
      Note: When you select this option, additional properties become available in the "Reverse transformation" section of the Main page. For some transformations, additional options or pages become available in the transformation configuration editor. For information about configuring the reverse transformation, see the related link below.
  4. Click Next.
  5. Specify the source and target elements for the transformation. For a list of valid source and target elements, see the related concept topic for this transformation. On the Source and Target page, complete the following steps:
    1. In the Selected source pane, select the source element for the transformation to transform.
    2. In the Selected target pane, select the destination of the transformation output. To create a new destination for the output, click Create Target Container.
  6. Click Finish. The transformation configuration editor opens, and the contents of the configuration are displayed.
  7. Optional: To specify whether the output that a transformation generates replaces or merges with an existing model, on the Main page, select from the following merge options:
    Option Description
    Visual merge Displays user prompts and warning dialog boxes when models merge.
    Silent merge Suppresses prompts and dialog boxes when models merge.
    Do not merge: Overwrite files without a warning Overwrites all conflicting files automatically.
    Do not merge: Warn before overwriting any files Prompts you for confirmation before conflicting files are overwritten.
    Automatically add new elements to the target model Adds new elements without prompting you for confirmation. This option is enabled when the Visual merge option is selected.
    Save changes before validating files Requires you to save merged models before allowing file validation. This option is enabled when the Visual merge option is selected.
    Automatically validate saved changes Once a merged model has been saved, this option causes the Validate Merged Result Session window to open. This option is enabled when the Visual merge option is selected.
  8. Optional: To generate debugging information, on the Main page, select the Generate a debug log check box. The next time that you run the transformation, the log file is generated as an XML file in the folder that you specify in the transformation preferences. If you do not specify a location for the log files, the transformation generates the log file in the .metadata folder in your workspace.
    Tip: To set preferences for transformations, click Window > Preferences; then expand Modeling and click Transformations.

    The log file provides information about the source elements, the target elements, and the rules that the transformation applies to transform the source elements. If the transformation transforms many elements, you might experience decreased performance while the transformation generates the log file; therefore, you should only generate a log file for debugging purposes.

  9. Optional: To display the errors that occurred when the transformation ran, on the Main page, select the Open the Report dialog box when the transformation is complete check box. Selecting this check box displays only the generated errors. The same information is also written to the error log, which you can view by clicking Window > Show View > Error log.

    To display the warnings that occurred when the transformation ran, select the Show warnings in the Report dialog box check box.

  10. Optional: On the Output Options page, specify how the transformation generates output.
    • To specify that the transformation processes referenced elements and their schema, from the Data Type Processing list, select the corresponding option. For example, to generate only these xsd elements that are referred as types in the xsd elements of schema’s, select the Process only referenced data types option. By default, the transformation processes the schema’s only for the UML Packages that are used as a source for the transformation.
    • To specify that the transformation generates each class in a separate XSD file, select Create a separate file for each data type. The generated XSD files are in folders that have the same name as the packages that contain the class.
    • To specify that the UML-to-XSD transformation converts a nested class into an anonymous type when no explicit association exists between the nesting and nested classes, select Convert a nested class to an anonymous type implicitly.

      By default, the transformation converts a nested class into an anonymous type only if it has an association relationship with the nesting class. You can specify that the transformation converts all nested classes into anonymous types so that the generated XSD type corresponds to the elements that the nested classes contain.

    • To generate a schema in a folder with the top-level UML package name, a namespace resembling a real URL, and a conventional name for the Java™ package, select Reverse the first segment of the namespace.

      For example, if the top-level package name is com.xyz.test, the schema would be generated in a folder, com/xyz/test, with the namespace of http://test.xyz.com/ and a Java package name of com.xyz.test.

    • To specify that UML-to-XSD transformation do not generate a schema for packages that do not have the «schema» stereotype or schema keyword, clear the Generate an XSD schema for UML packages that do not have the «schema» stereotype applied check box.

      By default, the transformation generates a schema for each package and its contents that you select in the source model. The UML-to-XSD transformation also generates schemas for nested packages.

    • To specify that the UML-to-XSD transformation does not generate a schema for a class that has no stereotype or keyword, clear the Process UML Classes that do not have stereotypes applied check box.

      For example, you can choose not to generate a schema for the classes in your source model that are still under development. The transformation processes all classes by default.

    • To specify a target namespace and target namespace prefix for the schema that the UML-to-XSD transformation generates, type a namespace in the Target namespace field; then type a prefix in the Target namespace prefix field.

      The value of the target namespace can be a string, such as http://www.mycompany.com/PurchaseOrder. The value of the prefix can be a string, such as po. If you apply the «schema» stereotype of the XSD transformation profile to a package in the source model, you can also specify a value in the target namespace and target namespace prefix property of the stereotype. The target namespace and target namespace prefix values of the «schema» stereotype overwrite the target namespace properties that you specify in this task.

      To overwrite the target namespace and target namespace prefix for certain packages, you can apply the «schema» stereotype for these packages and specify a different value in the target namespace and target namespace prefix properties of the «schema» stereotype.

    • To generate output by using customized information such as namespace and resource location information, select the Customize the output according to the entries in the following table check box.

      If you disable this option, the transformation ignores the information in the table and uses only the information in the source model to generate output. Although the information in the table is refreshed, it is ignored by the transformation.

    • To specify the addition of prefixes and suffixes for the target namespaces of resources, select a resource in the table; then click Edit Namespace.
    • To specify the path for the generated schema file, click Edit Output Location.

      The location for the schema file can be any folder in the target container. The target container is specified on the Source and Target page. You can also specify a path under the target container to which to add new folders. New folders are created when the transformation is completed.

    • To specify prefixes and suffixes to add to the file names of resources, select a resource in the table; then click Edit File Name.
  11. Optional: Specify the transformation extensions to enable or disable.
    • On the Extensions page, select or clear the check boxes for the transformation extensions to enable or disable.

      To support XSD polymorphism and substitution groups, select the com.ibm.xtools.transform.uml2.xsd.globalElements check box.

  12. Click File > Save.

Results

The options are applied the next time that you run the transformation.

Feedback