This section describes how to use the Repeatability/Join option of the mapper functionality to combine data. This section contains the following topics:
You can use the Repeatability/Join option of the mapper functionality to combine the contents of two different schemas, as shown in the following figure:
Figure : Combining Data From Different Schemas
In this case, the customer information is merged with the line-items repeating element to form one combined XML document.
This section describes how to create a transformation which combines the data from two different XML Schemas using the Repeatability/Join option. This section shows how to combine the example XML data shown in the preceding figure.
To Combine Data From Different Schemas
For this example, import the files: CustInfo.xsd and PO.xsd files. If you installed WebLogic Platform in the c:\bea directory, import these files from the c:\bea\weblogic81\workshop\help\doc\en\integration\reffiles\transform\dataDiffSchemas directory.
For this example, import the file: POCustInfo.xsd. If you installed WebLogic Platform in the c:\bea directory, import this file from the c:\bea\weblogic81\workshop\help\doc\en\integration\reffiles\transform\dataDiffSchemas directory.
Importing schemas files triggers a build of the current Schemas project folder. Wait until the current Schemas project folder is built before proceeding to the next step. (The representations of the schemas will not be available in Available Input Types and Available Output Type panes until build is complete.)
To select an existing method, in the Design View of the Transformation file:
The elements and attributes that make up the selected element are displayed in the Selected Input Types pane.
For this example, select and add the CustInfo.xsd/customer and PO.xsd/purchase-order nodes.
For this example, expand the POCustInfo.xsd schema folder.
For this example, select the POCustInfo.xsd/purchase-order element.
The elements and attributes that make up the selected element are displayed in the Selected Output Types pane.
The Design View of the XQ file is displayed.
For this example, link the $_purchase_orderDoc/line-items/line-item repeating element to the purchase-order/line-items/line-item repeating element.
A dashed line linking the two repeating elements is displayed. The dashed line with short dashes represents a structural link—a link between two parent structures that does not map data directly. The dashed-line representation for a structural link is shown in the following figure:
To learn more about links, see Link Representations.
For this example, link the $_purchase_orderDoc/line-items/line-item/part-no element to the purchase-order/line-items/line-item/part-no element. In addition, link the $_purchase_orderDoc/line-items/line-item/quantity element to the purchase-order/line-items/line-item/quantity element.
A dashed line linking the two sub-elements is displayed. The dashed line with long dashes represents a data structural link—a data link that also links two structures. The dashed-line representation for a data structural link is shown in the following figure:
To learn more about links, see Link Representations.
In the Source Schema pane, select a source node drag it to the target node in the Target Schema pane.
For this example, select the $_customerDoc node and drag it to the $_purchase-order/customer node. A structural link between the two nodes is created.
For this example, the $_customerDoc/customer-id node and drag it to the $_purchase-order/customer/customer-id node. A data structural link between the two nodes is created.
For this example, the $_customerDoc/customer-name node and drag it to the $_purchase-order/customer/customer-name node. A data structural link between the two nodes is created.
For this example, the $_customerDoc/customer-address node and drag it to the $_purchase-order/customer/customer-address node. A data structural link between the two nodes is created.
For this example, the map between the source and target elements is shown in the following figure:
For this example, in the Source Data pane, select the $_purchase_orderDoc node and import the file: InputPO.xml. In the Source Data pane, select the $_customerDoc node and import the file: InputCust.xml. If you installed WebLogic Platform in the c:\bea directory, import these files from the c:\bea\weblogic81\workshop\help\doc\en\integration\reffiles\transform\dataDiffSchemas\XML directory.
Note: You can cut and past directory paths into the Name field of the Open File to Test pane to jump to directory locations. If you installed WebLogic Platform in the c:\bea directory, you can jump to the directory that contains the XML files for this example, by pasting the following directory path into the Name field: c:\bea\weblogic81\workshop\help\doc\en\integration\reffiles\transform\dataDiffSchemas\XML and then pressing enter.
If not currently running, the WebLogic Server for the current application will be started. In order for a query to run, the WebLogic Server for the current application must be running.
In the Result Data pane, after the query is run a graphical representation of the output data is displayed.
You can use the Repeatability/Join option of the mapper functionality to merge the contents of repeating elements, as shown in the following figure:
Figure : Merging the Contents of Repeating Elements
The join, shown in the preceding figure, merges the price and availability from the two input documents to one output document called Quote.xml. Specifically, the price (element: price) and widget Id (element: widgetId) for the widgets is supplied by the PriceQuote.xml document and the number of widgets available (element: requestedQuanity) is supplied by the AvailQuote.xml document. The widgetId and requestedQuanity elements are part of the availRequest repeating element and price element is part of the priceRequest repeating element. These subelements to repeating elements are merged into subelements of the quoteResponse repeating element.
For this example, a complete merge of the two sets of elements resulting in four elements as shown in Figure: Merging the Contents of Repeating Elements is not desired. Instead a conditional constraint is needed that will return the merged element only if the condition is true. To learn more, see Example: Creating a Conditional Constraint Using the Constraints Tab.
For a step-by-step walk through of using the mapping functionality to create a join with a conditional constraint, see Tutorial: Building Your First Data Transformation. Specifically, the join is created in Step 4: Mapping a Repeating Element (Join) in the Tutorial: Building Your First Data Transformation.
![]() |
![]() |