Building Queries and Data Views
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
Data views play a central role in the Liquid Data enterprise development model.
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:
For example, a view of an employee developed for an enterprise might include employee salary and address information from one data source; information about their health insurance from another data source; information from their company assets (computer, phone, etc.) might be included from a third data source.
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.
In Liquid Data a stored query and a target XML schema comprise a data view.
Figure 8-1 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.
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 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.
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.
The following sections explain the steps needed to turn a query into a data view data source:
Follow these steps to create and save a query to the Liquid Data repository:
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.
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:
See Managing the Liquid Data Server Repository in the Liquid Data Administration Guide for additional details.
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).
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.
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.Figure 8-2 Creating a Parameterized Query in the Data View Builder
CUST_ID
and using the pulldown Type menu. Assign it a type string of xs:string
.cust_id
to the CUSTOMER_ID field of the CUSTOMER table in the PB_BB data source (also shown in Figure 8-2).Note: Values are case-sensitive.
The Data View Builder will display an XML report containing information on the orders made by this particular customer.
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.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
See "Creating Data Views from Stored Queries" in the Liquid Data Administration Guide for information on how to generate data views from stored queries.
File -> Connect
. When you click on Data Views, your newly created data view should appear.Figure 8-4 Data View on the Liquid Data Desktop
Set Selected Source as Target Schema
command. (
The generated schema is shown in Figure 8-5.)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
CUSTOMER_3
and drag it into the data view input CUST_ID
(see Figure 8-5).You could have provided an input parameter from a built-in XQuery function, custom function, an input from a web service, or another source.
Figure 8-6 XQuery and Generated XML Report
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.
![]() ![]() |
![]() |
![]() |