Selecting Source and Target Types

In the following tasks, you select the source and target types from the Source or Target panes of the Configure XQuery Transformation Method - methodName dialog box. (Where methodName represents the current Transformation method.) Source types are the input data types for the data transformation—the data types that are transformed to the target data type.

This section contains the following tasks:

To Select the Source and Target Types

  1. Select or create a Transformation file.
  2. For instructions on creating a Transformation file see To Create a Transformation File From the Menu Bar.

    To select an existing Transformation file:

    1. In the Application tab, expand the folders that contain the Transformation file. (If the Application tab is not visible in WebLogic Workshop, choose View —> Application from the menu bar.)
    2. In the Application tab, double-click the Transformation file (ends in the .dtf extension).
  3. Select or create a method from a Transformation file.
  4. For instructions on creating a method in a Transformation file, see To Add a Transformation Method to Transformation File.

    To select an existing method, in the Design View of the Transformation file (ends in the .dtf extension), right-click the arrow representing the method, as shown in the following figure:

    image

  5. From the drop-down menu, select Configure XQuery Transformation Method.
  6. The Configure XQuery Transformation Method dialog box is displayed. In the Available Source Types pane of Configure XQuery Transformation Method dialog box, the list of available source types are displayed.

    Note: In order for schema representations to be available in the Available Source Types and Available Target Types pane, the XSD and MFL files which contain these schemas must be imported into a Schemas project folder and the current application must have completed building. To learn more, see Selecting Source and Target Types.

  7. Select the desired source type from the XML, Non-XML, and Java options.
  8. Specify an source type, by doing one of the following:
  9. To specify an XML, Non-XML, or Java primitives source type:

    1. In the Available Source Types pane, expand the schema and element folders, until you find the desired element.
    2. Select an source element.
    3. If desired, change the default name provided in the Name field. This field specifies the name the mapper uses to refer to this element.
    4. Click Add.

    To specify a Java class source type:

    1. The Java class for conversion must be available in the current project. To learn more about including a Java class in your project, see Using Existing Applications.
    2. In the Type field, of the Available Source Types pane, enter the full package name of the Java class. For example, for a class named Book in the package named org.library, enter: org.library.Book in the Type field.
    3. If desired, change the default name provided in the Name field. This field specifies the name the mapper uses to refer to this element.
    4. Click Add.
    5. To learn more, see Using Java Classes in Transformations.

    The elements and attributes that make up the selected element are displayed in the Selected Source Types pane.

    Note: Non-XML Types/Untyped/RawData is not supported as a source or target type for a Transformation method. RawData has no associated structure and therefore can not be transformed using the mapper. To learn more, see Create a New Instance of an MflObject From Untyped Raw Data Example.

  10. Repeat step 5 for an additional source types.
  11. Note: Multiple source types can be specified.

  12. Specify an target type, by doing one of the following:
  13. To specify an XML, Non-XML, or Java primitives target type:

    1. In the Available Target Types pane, expand the schema and element folders, until you find the desired element.
    2. Select an target element.
    3. Click Add.

    To specify a Java class target type:

    1. The Java class for conversion must be available in the current project. To learn more about including a Java class in your project, see Using Existing Applications.
    2. In the Type field, of the Available Target Types pane, enter the full package name of the Java class. For example, for a class named Book in the package named org.library, enter: org.library.Book in the Type field.
    3. Click Add.
    4. To learn more, see Using Java Classes in Transformations.

    The elements and attributes that make up the selected element are displayed in the Selected Target Types pane.

    Note: Only one target type can be specified.

  14. If desired, select the Schema Validate Parameters check box.
  15. If this check box is selected, during run time the source parameters are validated against their schema types before the transformation is executed. To learn more, see Schema Validating During Run Time.

    Note: The Schema Validate Parameters check box will only be enabled if all the parameters and the return type are typed XML or typed MFL types.

  16. If desired, select the Schema Validate Return check box.
  17. If selected, during run time the target parameter is validated against its schema type after the transformation is executed. To learn more, see Schema Validating During Run Time.

    Note: The Schema Validate Return check box will only be enabled if all the parameters and the return type are typed XML or typed MFL types.

  18. Click Create Transformation.
  19. Note: You do not have to select an source type but you must select an target type.

    An XQ file (ending in the .xq extension) is created to store the query and displayed in the Application tab. The query is written in the XQuery language. XQ files are associated with a particular DTF file and appear indented under the associated DTF file in the Application tab. To learn more, see The Association Between XQ and DTF Files.

To Change the Selected Source or Target Parameters

If links have been created between source and target types in the Design View of an XQ file, then XQuery code has been generated which refers to the source and target types.

If you change the source and target types of the query, the existing XQuery code remains unchanged and may be referencing the original source or target types which may be no longer valid for this query. The XQuery code in the query may now be invalid and may require some manual XQuery code clean up as described in the last step in the following task.

Note: You may be able to minimize the amount of clean-up required by using the same name for the source variable in both the original and new query. Instead of having different names for the original and new source variables, for example: oldOrderDoc/po-number and newOrderDoc/po-number, respectively, use the same name: orderDoc/po-number for both.

To change or add source parameters or change the target parameter:

  1. Select the Transformation file (ends in the .dtf extension) that contains that Transformation method:
    1. In the Application tab, expand the folders that contain the Transformation file. (If the Application tab is not visible in WebLogic Workshop, choose View —> Application from the menu bar.)
    2. In the Application tab, double-click the Transformation file (ends in the .dtf extension) that contains the Transformation method.
  2. Select the method from the Transformation file. In the Design View of the Transformation file, right-click the arrow representing the method.
  3. From the drop-down menu, select Reconfigure XQuery Transformation Method.
  4. The Configure XQuery Transformation Method dialog box is displayed.

  5. Remove and add elements in the Available Source Types and Available Target Types pane as desired.
  6. If desired, select the Schema Validate Parameters check box.
  7. If this check box is selected, during run time the source parameters are validated against their schema types before the transformation is executed. To learn more, see Schema Validating During Run Time.

    Note: The Schema Validate Parameters check box will only be enabled if all the parameters and the return type are typed XML or typed MFL types.

  8. If desired, select the Schema Validate Return check box.
  9. If selected, during run time the target parameter is validated against its schema type after the transformation is executed. To learn more, see Schema Validating During Run Time.

    Note: The Schema Validate Return check box will only be enabled if all the parameters and the return type are typed XML or typed MFL types.

  10. Click Edit Transformation.
  11. Clean up the XQuery code if required. If you changed the source and target types of the query, the existing XQuery code remains unchanged—the XQuery code is not regenerated and therefore any references in the XQuery code to the original source or target types remain in the query. These references may be invalid for this query depending on what source and target types were changed as described in the following guidelines:
  12. If you added an additional source type, no XQuery code clean up is required.
  13. If you remove an existing source type, the XQuery code that references the removed source type will be invalid and may need to be removed.
  14. If you change the existing source or target types, the XQuery code that references the changed source or target type may be invalid depending on differences between the old and new schemas and may need to be removed.
  15. To view the XQuery source code including any errors:

    1. In the Application tab, expand the folders that contain the XQ file. (If the Application tab is not visible in WebLogic Workshop, choose View —> Application from the menu bar.)
    2. In the Application tab, double-click the XQ file that contains XQuery code.
    3. Select the Source View tab.
    4. The XQuery code is displayed and the invalid XQuery code is underlined in red.

  16. Fix the errors reported in the Source View. To view a detailed description of an error, move the mouse over the error in the Source View.
  17. If desired, you can delete all the XQuery code in the Source View of the XQ file by removing all the XQuery source code after the namespace declaration(s) and recreating your links in the Design View.

Updating the Graphical Representation Displayed in the Source View of a XQ File

The following procedure describes how to force the mapper to display an updated graphical representation of an XQ file in the Design View, if you have manually changed the source or target parameters of a Transformation method in the Source View of the Transformation file. To update the graphical representation of the XQ file, complete the following steps:

  1. View the Transformation file that contains the query (stored in the XQ file) in the Design View:
    1. In the Application tab, expand the folders that contain the Transformation file. (If the Application tab is not visible in WebLogic Workshop, choose View —> Application from the menu bar.)
    2. In the Application tab, double-click the Transformation file (ends in the .xsd extension).
    3. Select the Design View tab.
  2. Select the desired Transformation method from a Transformation file:
    1. Right-click the arrow representing the method.
    2. From the drop-down menu, select Reconfigure XQuery Transformation Method.

    The Configure XQuery Transformation Method dialog box is displayed.

  3. Click Edit Transformation.
  4. The graphical representation of the object is displayed in the Design View of the XQ file.

Previous Document Next Document