Skip navigation.

Building Queries and Data Views

  Previous Next vertical dots separating previous/next from contents/index/pdf Contents Index View as PDF   Get Adobe Reader

Using Data Views

Data views play a central role in the Liquid Data enterprise development model.

 


The Enterprise and the Data View

In Liquid Data, data views are central to solving the data integration problem one time (as opposed to once per query) and providing a basis for simpler application development work on top of that integrated view. In this model:

In this model a data view provides an appropriate architectural view of corporate data that is available for specialized queries and sharable throughout the enterprise.

 


Understanding Data Views

In Liquid Data a stored query and a target XML schema comprise a data view.

Figure 8-1 Components of a Data View

Components of a Data View


 

To create a data view from a query:

To create a virtual data source in this way, you must first create a query and save it to the Liquid Data server repository, then configure a data view data source description for the query in the WebLogic Administration Console. It is recommended that you create the query and save it to the repository using the Data View Builder, but it is also possible to use hand-coded queries in generally the same way.

The following sections explain what a data view is and how to use a data view data source with the assumption that you are using the Data View Builder to construct the query. Also included is a clarification of the relationship between a query and a a data view.

Functionally, a data view extends the power of a stored query through its association with a target schema that describes the data. This combination allows a data view to be identified in the Data View Builder as a data source for additional queries.

The following sections describe in detail how to create Liquid Data data views and use such views as data sources. Also included is a discussion of the relationship between a query and a data view.

A Data View Use Case

eWorld Co, a company that through multiple mergers and acquisitions has 50,000 employees, also has multiple payroll systems. Using Liquid Data, information in each of these systems can be accessed. The company also has two relational databases from separate vendors for tracking incentive bonuses. Human Resources very frequently gets questions about when such bonus payments will show up in affected employee's paychecks.

The benefits of this approach are significant:

Simple and Parameterized Data Views

The difference between a simple and a parameterized data view is that a parameterized data view has one or more input parameters. Specifically views that centrally contain functional sources such as an application view, web service, custom function, or stored procedure often require an input parameter.

Using Data Views as Data Sources

From the Data View Builder, you access a data view as you would any other data source. There is no limit to the number of data views that can be used in creating a new query, although currently there may be performance implications to nesting data views. A data view can reference on another data view.

 


Creating a Data View

The following sections explain the steps needed to turn a query into a data view data source:

Creating and Saving the Query to the Liquid Data Repository

Follow these steps to create and save a query to the Liquid Data repository:

  1. Construct the query in the Design view as described in Building Queries.
  2. Test the query in the Test Query view as described in Running, Saving, and Deploying Queries.
  3. Save the query to the Liquid Data repository as a stored query as described in Steps to Save a Query to the Repository in Running, Saving, and Deploying Queries.

Note: When you are creating a data view, it is important that the query and its target schema be in conformance. In the current release this means that all required elements in a target schema must be mapped if the query is to be turned into a view. See Source and Target Schemas and subsequent discussions for details.

Alternatively you can load queries and target schemas into the Liquid Data repository directly using the Liquid Data node of the WebLogic Administration Console. See Uploading Files to the Server Repository for details.

Configuring a Data View Data Source Description

In the WebLogic Administration Console, configure a data view for the query as described in Configuring Access to Data Views in the Liquid Data Administration Guide. Then follow these steps:

  1. In the Liquid Data node of the WebLogic Administration Console click the Repository tab.
  2. Double-click on the Stored Queries folder.
  3. Find the stored query you want to use and inspect the Data Source Configuration column.
  4. If Create Data View is available, click on that link to create you data view. (If a data view already exists based on the stored query, you will see Data View Created.)
  5. This links you into the Data View configuration tab, automatically copies the stored query to the data_views folder for you, and assigns an xv extension to the name you select for your data view.

See Managing the Liquid Data Server Repository in the Liquid Data Administration Guide for additional details.

Adding a Data View as a Data Source

After you have created the data view, reconnect to the Liquid Data server using the File -> Connect menu command. Your new data view should appear under Data Views when the Sources tab in Design mode is selected (see Figure 8-4).

 


Creating a Parameterized Data View

You can use the following simple example to create a stored query and then turn it into a parameterized data view that retrieves customer order information based on a unique customer ID.

Note: To follow along with the creation of this example data view, you should have the Liquid Data sample server installed and running and be familiar with the sample. If not, please see the Liquid Data Getting Started guide.

  1. Open the Data View Builder, drag the relational database source pb-bb onto the Liquid Data desktop. Set your target schema to customerOrders.xsd. Map elements to your target schema as shown in Figure 8-2.
  2. Figure 8-2 Creating a Parameterized Query in the Data View Builder

    Creating a Parameterized Query in the Data View Builder


     
  3. From the Liquid Data Toolbox tab, choose Query Parameter. Create a single query parameter, CUST_ID and using the pulldown Type menu. Assign it a type string of xs:string.
  4. Drag cust_id to the CUSTOMER_ID field of the CUSTOMER table in the PB_BB data source (also shown in Figure 8-2).
  5. Drag CUSTOMER_ID in the Customer table to CUSTOMER_ID in the Customer Order table to create a join.
  6. In Test mode supply CUSTOMER_1 as a value for CUST_ID and run the query.
  7. Note: Values are case-sensitive.

    The Data View Builder will display an XML report containing information on the orders made by this particular customer.

  8. Using the File -> Save Query menu command in the Data View Builder, save your query under the name param_dv to the Repository folder. It will automatically be placed in the ld_repository\stored_query folder and the extension .xq appended.

  9.  
  10. Now you can use the Liquid Data node of the WebLogic Administration Console to create your data view from your newly saved query.
    1. Start the WebLogic Administration Console.
    2. Click the Liquid Data node.
    3. Select the Repository tab.
    4. Go to stored_queries.
    5. Choose the query param-dv.xq
    6. Select the Data View Data Source option.
    7. Enter information as shown in Figure 8-3.
    8. Click Create.

    Your new data view should appear in the Liquid Data node of the WebLogic Administration Console list of available data views.

    Figure 8-3 Creating the Data View in the Administration Console

    Creating the Data View in the Administration Console


     

    See "Creating Data Views from Stored Queries" in the Liquid Data Administration Guide for information on how to generate data views from stored queries.

  11. Return to the Data View Builder. Select File -> Connect. When you click on Data Views, your newly created data view should appear.
  12. Figure 8-4 Data View on the Liquid Data Desktop

    Data View on the Liquid Data Desktop


     


     
  13. Drag the data view onto the Liquid Data desktop as you would any other data source (Figure 8-4).
  14. Add a valid target schema. In this case, you can use the File menu Set Selected Source as Target Schema command. (The generated schema is shown in Figure 8-5.)
  15. You may see a message asking if it is OK to close the existing target schema since that will remove all its mappings in the Data View Builder. Click Yes.

    Figure 8-5 Setting Input and Associating Columns With Target Schema

    Setting Input and Associating Columns With Target Schema


     


     
  16. Using the Data View Builder toolbox create a string constant called CUSTOMER_3 and drag it into the data view input CUST_ID (see Figure 8-5).
  17. You could have provided an input parameter from a built-in XQuery function, custom function, an input from a web service, or another source.

  18. Map all the elements in your target schema.
  19. Test, then run your new query.
  20. Figure 8-6 XQuery and Generated XML Report

    XQuery and Generated XML Report


     

 


Data View Query Samples

Two additional Data View Query samples are installed with the Liquid Data samples. These samples show how to create a data view, configure it as a data source, and then use that data source in other data views.

Instructions for running the samples are provided in readme files located at:

Also see the Liquid Data Samples page for more information on other available query samples.

 

Skip navigation bar  Back to Top Previous Next