bea.com | products | dev2dev | support | askBEA

Download Docs | Site Map | Glossary
Search

Building Queries and Data Views

Using Data Views as Data Sources

The result of a query can be referred to as a data view. You can use the result of a query as a data source in BEA Liquid Data for WebLogicTM. The query result will change as your data changes. In this way, you can build on the queries you design to create "views on data views" for an up-to-date picture of continually changing information.

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

The following sections explain what a data view is and describe how to use the result of a query as 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 data view.

- Understanding the Relationship Between a Query and a Data View

- When To Use Data Views as Data Sources

- How to Reuse a Data View as a Data Source

- Create the Query and Save it to the Liquid Data Repository

- Configure a Data View Data Source Description for the Query

- Re-start the Data View Builder and Verify the New Data View Source Shows Up

- Data View Query Example

Understanding the Relationship Between a Query and a Data View

A data view is the view into the data provided by the result of a particular query with which the data view is associated. As such, the data view (query result) is dynamic—it will continue to reshape itself based on any changes that occur in the data it is querying.

You can use the result of a query as a data source in Liquid Data. The result can change as your data changes. In this way, you can build on the queries you design to create "views on data views" for a dynamic picture that can respond to fluid information.

You can even further refine the query by creating a "views on a views" or subqueries to zoom in and get a more and more focused view of the information.

Notes:

- For this release, only two levels of data views are supported. For example, if you have a stored query (s1), you can create a data view (v1) out of it. Using v1 as a base view, another view (v2) can be created. However view v2 can not be used as part of a new view—that is, this version of Liquid Data does not support a view v3 that uses v2.

- Liquid Data does not support the use of a parameterized view as a base view.

When To Use Data Views as Data Sources

A data view based on a query constructed in the Data View Builder retains all the tools you used to construct its associated query, including the source and target schemas representations of the data, data source conditions such as joins and unions, and source-to-target mappings.

From the Data View Builder, you can access any data view as a data source for other data views. You can treat the data view just as you would any other data source in the Data View Builder. By using data views as data sources, you can retrieve only the information you need, in the format that you need it, for easier and faster reporting.

For example, suppose you want to create a variety of sales reports from a point-of-sale system that keeps detailed information about every sales transaction in a relational database. In the Data View Builder, you can create a data view that summarizes sales by store and product. After configuring the data view in the Administration Console, you can go back into the Data View Builder, select this data view as a data source, and then create data views that display sales by store, sales by product, and so on.

How to Reuse a Data View as a Data Source

The following sections explain the steps you need to follow to re-use a data view as a data source:

- Create the Query and Save it to the Liquid Data Repository

- Configure a Data View Data Source Description for the Query

- Re-start the Data View Builder and Verify the New Data View Source Shows Up

Create the Query and Save it to the Liquid Data Repository

In the Data View Builder do the following:

1. Construct the query in the Design view as described in Designing Queries.

2. Test the query in the Test Query view as described in Testing Queries.

3. Save the query to the Liquid Data repository as a stored query as described in Saving a Query to the Repository as a "Stored Query" in Testing Queries.

Configure a Data View Data Source Description for the Query

In the WebLogic Server Administration console, configure a data view source description for the query as described in Configuring Access to Data Views in the Liquid Data Administration Guide.

Note: Before you can configure a query as a data view data source in the Administration Console, the query must be saved as a file in the Liquid Data server repository data_views folder. If you have already saved the query as a stored query (as described in the previous section), then you can use the Liquid Data Repository tab on the Administration Console to navigate the stored_queries folder, and choose "Data View Data Source" for the query you want to configure. 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 file name. See Managing the Liquid Data Server Repository in the Liquid Data Administration Guide for more information.

Re-start the Data View Builder and Verify the New Data View Source Shows Up

Re-start Data View Builder and click the Data View button on the Builder toolbar. (For instructions about starting the Data View Builder, see Overview and Key Concepts.)

The query shows up as a data view on the Data Views panel in the Builder toolbar in Design View. The new data view appears with the logical name provided in the WebLogic Server Administration Console at configuration time.

Data View Query Example

The Data View Query Sample shows how to create a data view, configure it as a data source, and then use that data source in other data views.

If you have installed the Liquid Data samples, the instructions for setting up and using this Data View sample are provided in the Data View Query Sample readme file. The Samples files are located in the same directory with the readme file at:

>     BEA_Home/WL_HOME/liquiddata/samples/buildQuery/view/readme.htm

(See the Samples page in the online documentation for more information on available query samples.)