Building Queries and Data Views
The Liquid Data Data View Builder is a major component in an end-to-end query development and testing system. The Data View Builder is ideal for trying out and refining queries in relationship to target XML schemas, or more usually referred to as target schemas, that provide additional, needed instructions as to how the results of your query should be represented.
The Data View Builder is a GUI-based tool for designing and generating target schemas and XQueries (in W3C XQuery syntax). You can then run the queries against multiple diverse data sources to retrieve and consolidate data. The Data View Builder provides a graphical, drag-and-drop mapping approach to query design and construction. You can use it to free yourself from having to manage the intricacies of query languages such as SQL while allowing you to give full attention to:
The Data View Builder lets you create queries using an intuitive, drag-and-drop mapping strategy. The XML schema representations and mappings of source and target data are packaged and saved as a project. Using Liquid Data projects you can retrieve the full picture of the query, complete with source schemas and target mappings. Queries can also be stored as data views that can be treated as data sources themselves in Liquid Data and re-used.
Once a data source has been configured in Liquid Data using the Liquid Data node of the WebLogic Administration Console (see the Liquid Data Administration Guide), it becomes available to the Data View Builder. The structure of the data stored in relational databases, Web services, application views, data views, delimited files, and XML files themselves are all represented as XML schemas.
To build up your query you simply drag and drop elements and attributes among XML schema representations of data sources to create joins, unions, and so on. The default source condition is a join. It uses a built-in equality [
eq] function; more complex XQuery functions are also available.
You can also map elements from source schemas to a target schema to shape the structure of the query. Target schemas can be created "on the fly" from existing data source representations or created externally. Optimization hints can be added to queries to improve query performance.
Queries can be automatically generated at any point in the development process. When you run the query the underlying data sources are accessed and the results appear in tree-view or XML. The query can also be deployed for use in BEA WebLogic Workshop web applications, among other technologies.
See Data Sources, for a complete survey.
Liquid Data queries require identified data sources. Each data source requires an associated schema. For relational databases, the schema is automatically created based on the metadata available through the database JDBC driver. For XML files, Views, Complex Parameter Types, Stored Procedures, or Web Services, you specify the schema when you define the data source to Liquid Data.
For more information on source and target schemas in Liquid Data, see Source and Target Schemas.
For example, you could specify first and last names of all customers in two data sources — BroadBand and Wireless — and they use a join to limit the output (query result described by the target schema) to the subset of those customers with matching customer IDs in both source schemas.
Union operations enable you to combine data from multiple sources into a single set of results described by the structure of the target schema. Even though the content of the source schemas can be the same, or different, you can use a union type query to consolidate elements in source schemas into a tailored view of the data. For example, you could construct a query that reports all customer orders from multiple sources into a single result. This is a very typical use of Liquid Data target schemas.
You can create queries in Liquid Data that aggregate query results, providing summary information on a set of data. Typical aggregate functions are average [
count, maximum [
max], minimum [
sum. You can use aggregate operations to perform various business calculations such as finding the total number of customers, calculating purchases by a single customer, calculating the average salary of workers, and so on.
All conditions are set through functions. The default function for a simple equality function [
eq[. If you drag and drop one data source element onto another you have created a simple join using the equals function with two parameters (the two data source elements) which gets expressed as
value2 in the Data View Builder-generated XQuery.
For information on W3C standard functions supported by Liquid Data, see Functions Reference in the XQuery Reference Guide.
You can also create and use custom functions. See Configuring Access to Custom Functions in the Liquid Data Administration Guide.
Caching of query results for stored queries is configurable through the Liquid Data node of the WebLogic Administration Console (see Configuring the Query Results Cache in the Liquid Data Administration Guide). Using this feature, you can specify whether or not to cache query results for stored queries.
This book does assume some familiarity with the purpose and operation of the Liquid Data graphical query development tool called Data View Builder. You can familiarize yourself with this tool in several ways: