Using the Sun Data Mashup Engine

Configuring Data Mashup Projects Using Joins

After creating a virtual database, Data Mashup project, and EDM collaboration, you are ready to bring all your diverse data into a common staging area and create a federated view of the data. This topic provides the necessary steps for you to create data joins using the data stored in the staging tables.

Perform the following steps to create and configure a join:

ProcedureTo Add the Tables to the EDM Collaboration

Before You Begin

Before creating a join, you must have a virtual database, Data Mashup project, the NetBeans IDE must be running, and you must be connected to the virtual database.

  1. If necessary, connect to the virtual database.

    1. In the NetBeans IDE, click the Services tab and expand Databases.

    2. Right-click the database you want to start and select Connect.

      In this procedure, start VirtualMashupDB.

  2. In the NetBeans IDE Project window, expand the Data Mashup project.

  3. Under Collaborations, double-click the EDM collaboration (demoDMfile.edm for this exercise).

    The file opens in the EDM Editor canvas.

  4. Right-click in the EDM Editor canvas and select Add Table.

  5. In the Select Source Table window, select the virtual database you created earlier (VirtualMashupDB).

    The tables in the database appear under Schema.

  6. Highlight the SUPPLIER_ADDRESS and COMPANY_DATA tables and click Select.

  7. Click OK.

    The window closes and the tables, along with Runtime Input, appear on the canvas. You are now ready to create the join.

ProcedureTo Create the Join

This step will merge the SUPPLIER_ADDRESS and COMPANY_DATA into one table.

  1. From the Table Operators palette, drag the Join operator onto the canvas.

  2. In the Create New Join View window, click All to move both tables to the Selected Tables list.

    Both tables appear in the Preview area and are linked to the join.

  3. To edit the type of join, click in the field at the top of the join table and select one of the following options:

    Inner

    Returns only the records in the selected tables that match. For this exercise, use this option.

    Left Outer

    Returns all records in the left table regardless if there are any matches with the right table. When there are no matches, the field is NULL.

    Right Outer

    Returns all records in the right table regardless if there are any matches with the left table. When there are no matches, the field is NULL.

    Full Outer

    Returns the all records from the left and right tables in the merged table. All fields that do not match are NULL.

  4. Click OK.

    The root join is added to the canvas and is linked to the two tables. You can now create join conditions for the tables.

ProcedureTo Create a Join Condition

Once you create a join, so you can edit it as necessary by creating join conditions.

  1. Open the EDM collaboration file in the EDM Editor.

  2. Right-click the Root Join table on the canvas and then click Edit Join Condition.

    The Edit Join Condition window, also called the Condition Builder, appears.

  3. Drag a column from the first table onto the empty canvas on the right.

    For this exercise, drag VENDOR from the CUSTOMER_DATA table.

  4. Drag and drop a comparison, string, or another operator onto the canvas to the right of the column name.

    For this exercise, use the equal (=) sign.


    Tip –

    To add an operator, click the appropriate icon on the toolbar. When the drop-down menu appears, click the icon you want to use and drag it onto the canvas.


  5. Drag a column from the second table onto the canvas to the right of the operator.

    For this exercise, drag the VENDOR column from the SUPPLIER_ADDRESS table.

  6. Click OK.

    The Edit Join Condition window closes.

  7. Click Save All.

    You are now ready to build the Data Mashup project.

ProcedureTo Complete the Data Mashup Project

Once the Data Mashup project is configured and saved, you need to build the project in order to create the WSDL document. This document is automatically generated based on the configuration of the collaboration.

  1. To complete the project, right-click the project name and select Build Project.

    A WSDL document named ProjectName_CollaborationName_engine.wsdl is created under the Collaboration node . In this exercise, the file is named DemoDMProject_demoDMfile_engine.wsdl.

Next Steps

You are now ready to create and deploy a composite application in the Sun GlassFish Enterprise Server. For instructions on how to perform this task, see Creating and Deploying a Composite Application for a Data Mashup Project.