Step 2: Building the Transformation

In this step, you create a transformation that contains the mapping of different source (input) types to a single target (output) type. Specifically, this tutorial provides the steps for transforming a Java primitive and two sets of XML data (valid to two different schemas) to a single set of XML data valid to a third schema, as shown in the following figure.

image

The RequestQuote business process takes as input a set of widget IDs and returns the price and availability of these widget IDs.

The source parameters to the myJoin Transformation method include the following:

The myJoin Transformation method takes these source parameters and invokes a query which merges the price, availability, and tax rate information into one piece of XML data valid to the XML Schema in the Quote.xsd file.

The tasks in this step include:

To Create MyTutorialJoin.dtf

In this task, you create a Transformation file called MyTutorialJoin.dtf. In addition, you create a Transformation method in the Transformation file. During run time, the business process will call this method to invoke the transformation.

  1. In the Application tab, right-click the requestquote folder and from the drop-down menu, select New —> Transformation File.
  2. The New File dialog box is displayed.
  3. In the File name field, enter MyTutorialJoin.dtf.
  4. In the New File dialog box, click Create.
  5. In the Design View, a graphical representation of the MyTutorialJoin Transformation file appears, as shown in the following figure.

    image

To Add a Transformation method to MyTutorialJoin

  1. In the Design View, right-click in the box representing the MyTutorialJoin Transformation file. (The box shown in the preceding figure.)
  2. From the drop-down menu, select Add Transformation method.
  3. A Transformation method is created in the MyTutorialJoin Transformation file.

  4. Enter myJoin as the method name.
  5. Right-click the arrow representing the myJoin method, as shown in the following figure.
  6. image

  7. From the drop-down menu, select Configure XQuery Transformation Method.
  8. The Configure XQuery Transformation Method - myJoin dialog box is displayed.

    The Configure XQuery Transformation Method - myJoin dialog box contains the following two panes:

To Select the Source Types

In this task, you select the source types for the transformation in the Configure XQuery Transformation Method - myJoin dialog box. Source types are the input data types for the transformation—the data types that are transformed to the target data type.

  1. In the Available Source Types pane of the Configure XQuery Transformation Method - myJoin dialog box, the application XSD files: PriceQuote.xsd, AvailQuote.xsd, Quote.xsd, and QuoteRequest.xsd are displayed, as shown in following figure.
  2. image

    Note: If these files are not listed, you probably have not loaded the Tutorial: Process Application. For instructions on loading this application, see To Load The Tutorial Process Application.

  3. In the Available Source Types pane, expand PriceQuote.xsd folder, then select the priceQuote element, as shown in the following figure.
  4. image

  5. Click Add.
  6. The elements and attributes that make up the priceQuote element are displayed in the Selected Source Types pane.

  7. In the Available Source Types pane, expand AvailQuote.xsd folder, then select the availQuote element.
  8. image

  9. Click Add.
  10. The elements and attributes that make up the availQuote element are displayed in the Selected Source Types pane.

  11. In the Available Source Types pane, select the Java option.
  12. The available Java Types are displayed in the Available Source Types pane.

  13. In the Available Source Types pane, select the float node, as shown in the following figure.
  14. In the Name field of the Available Source Types pane, change the name of the Java source variable from floatVar to taxRate as shown in the following figure.
  15. image

    Note: The taxRate mapper variable created in the presiding step is different from the taxRate business process variable of the RequestQuote business process. The variables created in the mapper are used in transformations and not in business processes.

  16. Click Add.

To Select the Target Type

In this task, you select a target type for the transformation in the Configure XQuery Transformation Method -myJoin dialog box.

  1. In the Available Target Types pane of the Configure XQuery Transformation Method - myJoin dialog box, the PriceQuote.xsd, AvailQuote.xsd, Quote.xsd, and QuoteRequest.xsd files are listed.
  2. In the Available Target Types pane, expand Quote.xsd folder, then select the quote element, as shown in the following figure.
  3. image

  4. Click Add.
  5. The elements and attributes that make up the quote element are displayed in the Selected Target Types pane.

  6. Click Create Transformation.
  7. The file: myJoin.xq is created and displayed in the Design View.

    The myJoin Transformation method is added to the MyTutorialJoin Transformation file. The myJoin method contains the three source parameters selected in the previous steps.

    In the Application tab, representations of the MyTutorialJoin.dtf and myJoin.xq files are displayed as shown in the following figure.

    image

    Note: In the Application tab, the myJoin.xq appears indented under the MyTutorialJoin.dtf. These files are associated and contain references to each other. To learn more, see The Association Between XQ and DTF Files.

  8. Save the MyTutorialJoin.dtf file. Right-click the MyTutorialJoin.dtf file, then in the drop-down menu, select Save.

Previous Document Next Document