You can use the Union option of the Constraints tab to combine sets of data of the same type into larger sets of data, as shown in the following figure.
Figure : Combining Sets of the Same Data
In this union, repeating elements of the same type are combined into a larger set but in the preceding join example in Merging the Contents of Repeating Elements, the contents of repeating elements are merged.
This section describes how to create a transformation which combines two sets of repeating elements using the Union option. This section shows how to combine the example XML data shown in the preceding figure.
To Combine Sets of Data of the Same Type
For this example, import the file: PO.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\union
Note: The PO.xsd file used in this example is identical to the PO.xsd file used in Combining Data From Different Schemas. If you have already imported the PO.xsd file for the Combining Data From Different Schemas example, you do not need to import it again.
For this example, import the file: Order.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\union directory.
Importing schemas files triggers a build of the current Schemas project folder. Wait until the current Schemas folder is built before proceeding to the next step. (The representations of the schemas will not be available in Available Source Types and Available Target 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 Source Types pane.
For this example, add the PO.xsd/purchase-order element twice.
The elements and attributes that make up the selected element are displayed in the Selected Target Type pane.
The Design View of the XQ file is displayed.
For this example, link the $purchase_orderDoc/line-items/line-item repeating element in the Source pane to the order/items/item repeating element in the Target pane.
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_orderDoc1/line-items/line-item repeating element in the Source pane to the order/items/item repeating element in the Target pane.
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:
At this point, in the Constraint Type pane of the Constraints tab, the Repeatability/Join option is selected.
Keep the last link selected for the next step.
In the Source pane, select each of the subelements of the repeating element and drag them to the analogous subelement of the repeating element in the Target pane.
For this example, link the nodes shown in the following table:
Solid blue lines linking the two subelements are displayed. These solid lines represents a data link—a link that converts the value of the source node directly to the value of the target node The solid line representation for a data link is shown in the following figure.
Since the two structural links have the union constraint applied to them, a set of implied data links between the second set of subelements are generated as shown in the following figure.
The solid gray lines represents implied links.
For this example, in the Source Data pane, select the $purchase_orderDoc node and import the file: InputPO1.xml. In the Source Data pane, select the $purchase_orderDoc1 node and import the file: InputPO2.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\union\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\union\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, a graphical representation of the target data is displayed.
Note: The nodes are being joined in the union and not the data in the nodes. For example, if you are merging repeating elements in which the value of the part-no element is equal to 1, both part-no elements appear in the target data as shown in the following figure.
The query returns both repeating elements because it determines the repeating nodes are unique, even if the values of the part-no element are both equal to 1.
![]() |
![]() |