Building Queries and Data Views
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
This chapter provides a graphical interface reference for the Data View Builder, including menus and other visual components used in accessing data sources, target XML schemas, query parameters, constants, XQuery functions and other features that are used in designing, optimizing, testing, and deploying a Builder-generated query and saving any resulting projects.
The following topics are covered:
Note: The Liquid Data Getting Started guide contains detailed instructions on starting and using the Data View Builder to create a sample query and then use that query in a WebLogic Workshop application.
To start the Data View Builder, follow these basic steps.
t3://localhost:7001
The Data View Builder work area and tools appear, as shown in Figure 2-1.
Figure 2-1 Starting Data View Builder
The Data View Builder consists of three main views or modes that you can get to by clicking on the associated tabs. Each tab represents a phase in the process of designing and testing a query. Generally, you will use the Design and Test tabs to design and run the query, respectively. Some queries benefit from optimization, available on the Optimize tab.
The Design tab is where you construct the query by working with source and target schemas to specify conditions and source-to-target mappings. The following sections describe the features available on the Design tab.
The following figure and accompanying numerically-coded sections describe the components on the Design tab.
Note: Menus, horizontal shortcut toolbar and status bar are also covered in detail in this section. Although most menu options and shortcuts are available in all modes, others are mode specific and described in the appropriate section.
The menus provide File, Schema, View, and Window menus as detailed inTable 2-3.
Provides project-related actions (creating a new project, saving a project, and so on) along with an Exit option that closes the Data View Builder application. (For more information, see Working With Liquid Data Projects.)
|
|
Provides standard edit features. Availability of these commands is based on previous actions you may have takes and what item is selected. For example, if you highlight an element in a target schema and select Delete, the highlighted element will be deleted. |
|
As an alternative to using the Design mode tabs the View menu provides a means for you to navigate to the following UI views:
To help with screen real estate and workspace, the View menu provides toggles to show or hide various windows, tools, and tabs in the Design view. You can show or hide the following:
|
|
For a description of the other options in the Query menu (Compile Query, Run Query, or Stop Query Execution) that are relevant only for running/testing a query, see Table 2-3. |
|
The Window menu provides various options for window management such as next, previous, close, and close all. Source schema windows that you open are listed in the Window menu. |
|
The toolbar, located directly below the menus, provides shortcuts to a subset of commonly used actions that are also available from the menus.
The Builder Toolbar includes two subtabs:
The Sources tab on the Builder Toolbar contains the data sources configured on the Liquid Data Server to which you are connected. Note that a data source type only shows up as a button on the Builder Toolbar if it has been configured in the Liquid Data Server to which you are connecting. Potentially available data sources include:
Note: For a detailed introduction to Liquid Data data sources, see Data Sources. See also Schemas and Namespaces in Liquid Data, for details on using data source schemas in constructing queries.
Figure 2-5 Builder Toolbar: Sources Tab
The Toolbox tab on the Builder Toolbar provides the following tools you can use in constructing and tailoring your query:
Figure 2-6 Builder Toolbar: Toolbox Tab
XQuery Functions are built-in code modules that return a value when they run. The XQuery Functions panel provides a library of standard W3C functions compliant with the W3C XQuery 1.0 and XPath 2.0 Functions and Operators specification. (See Figure 2-6, Builder Toolbar: Toolbox Tab, on page 2-13 for an example of the Functions panel.)
In the Data View Builder, Functions are displayed in the Builder Toolbar on the Toolbox tab XQuery Functions panel by category names such as Aggregate Functions, Boolean Functions, Cast Functions, and so on. To view all the functions in a category or group, expand the group element. For details on using XQuery functions see Using XQuery Functions.
The functions editor provides the ability to create functions using drag-and-drop and to view existing functions in your project.
You can open the Functions Editor to view or modify an existing function by selecting a condition in a particular row and then clicking the edit button.
Figure 2-8 Button to Access the Functions Editor
For details see Using the Function Editor.
If you have custom functions configured through the Liquid Data node of the WebLogic Administration Console, these will appear in the Custom Functions section of the Data View Builder toolbar. For details on creating queries by using custom functions, see Using Custom Functions in the Application Developer's Guide.
You can use the Constants panel to create function parameters with constant values.
Figure 2-9 Setting Constants Dialog Box
For details see Creating and Using Constants.
You can create named query parameters and associate them with a data type. For details see Creating and Using Query Parameters.
If you have complex parameter types configured through the WebLogic Administration Console, these will appear in the Data View Builder on the Toolbar Functions tree under Complex Parameter Types. For more information, see Using Complex Parameter Types in Queries and Configuring Access to Complex Parameter Types in the Administration Guide.
The Components panel shows the structure of the current project in Design View. All elements of the query except the target schema appear in this view of the project, including any data source schemas you are using or functions that you map with parameters.
If a particular component schema is unavailable when a project is re-opened, the schema will still be listed, but it will be flagged as unavailable (off-line) and a red mark will appear over the schema name.
Figure 2-10 Builder Toolbar: Toolbox Tab: Components
Any component that appears in this panel can be minimized on the Liquid Data desktop by double- clicking the appropriate node. Click again and the component reappears on the desktop.
You can hide the Builder Toolbar using a checkbox located under View —-> Toolbars.
Source schema windows show XML schema representations of the structure of the data in the selected data source. Source schemas are used in creating conditions and mappings to a target XML schema. You can have as many data source schemas open on the Liquid Data desktop as needed.
Figure 2-11 Sample Source Schemas
The Target Schema window shows the XML schema representation for the structure of the target data (query result). For additional information see Source and Target Schemas.
You can also choose the menu item File —> Set Selected Source Schema as Target Schema to add a source schema selected on the Builder Toolbar as the target schema.
The Target Schema can be hidden using a checkbox in View —> Panels.
The Conditions area lists underlying query conditions that can inspect or change. Whenever you do a drag-and-drop operation that changes query conditions, the Conditions tab is automatically updated and displayed.
The Conditions tab includes the following features:
The Conditions section displays conditions for source data. As you build up the query by creating drag-and-drop source-to-source element relationships among data source schemas, the implied condition statements are recorded and reflected as equality joins (eq) under the Conditions.
Figure 2-14 Conditions Tab in Basic View
For details on using the query Conditions section in basic and Advanced View mode see Managing Target Schema Properties on page 5-26.
The Mappings tab shows source-to-target mappings that will define the structure of the query result. As you drag-and-drop source elements onto target elements among the schema windows, the Mappings tab records these relationships, which build up the shape the data will take in the query result. For example, dragging and dropping FIRST_NAME and LAST_NAME elements from CUSTOMER in a source schema to the associated CUSTOMER elements in the target schema specifies that in the query result customers will be identified with first and last names as defined.
A checkbox below the list of query conditions allows you to optionally show or hide the full path to the mapping elements.
Whenever you do a drag-and-drop operation that causes an update to Mappings, the Mappings tab is automatically displayed.
The Conditions Tab can be hidden using a checkbox in View —> Panels.
Target schema elements associated with complex elements with the repeatable attribute set can be sorted in ascending or descending order. In addition, the order that elements are sorted can be easily changed. See Sorting Query Results for details.
The Status Bar is a horizontal bar at the bottom of the Data View Builder that provides status information about current actions and processes. The Status Bar can optionally be hidden using a checkbox in View —> Panels.
Use the Optimize tab to add clarifying hints to improve query performance.
For detailed information on how to optimize a query by ordering source schemas, see Analyzing and Optimizing Queries.
The Test tab is where you view the generated XQuery from the query elements you developed on the Design and Optimize tabs. From this view, you can provide different parameters to the query before you run it.The following sections (numerically keyed to Figure 2-1, Data View Builder Test Mode, on page 2-24) describe the graphical features available on the Test tab:
The following figure and accompanying sections describe the components on the Test tab. (Click the tab to access it.)
Figure 2-1 Data View Builder Test Mode
Many of the File menu commands available in Test mode, including: For a complete description of File menu items, including the above, see Menu Bar for the Design Tab. |
|
Provides standard edit features. For a complete description of File menu items, including the above, see Menu Bar for the Design Tab. |
|
As an alternative to using the tabs the View menu lets you navigate to the following UI views. For a complete description of View menu items, including the above, see Menu Bar for the Design Tab. |
|
Provides the following options related to running a query:
Note: If Liquid Data security is enabled, you must log into the Data View Builder as a user who is a member of either the LDConsoleUsers or LDAdministrators group. If the user is not a member of one of these groups, attempts to deploy a query will fail with a security error.
|
|
The Window menu provides various options for window management such as next, previous, close, and close all. As you open source schema windows they are listed in the Window menu so that you choose an open schema from the menu to navigate to it. |
|
Provides links to online documentation for the Data View Builder. |
The toolbar, located directly below the menus, provides shortcuts to commonly used actions also available from the menus in addition to Undo and Redo commands.
Figure 2-19 Test Tab Toolbar Icons
The query you developed on the Design and Optimize tabs is shown in XQuery language in the "Query" window on the upper left panel on the Test tab.
Figure 2-20 Builder-Generated XQuery Shown in Query Window
You can use the Query Parameters panel (located below the Query area) to change variable values to a query each time you run it. The list of variables depends on the number of variables you defined as Query Parameters (see Creating and Using Query Parameters).
Figure 2-21 Query Parameters Settings on Test Tab
Note: Complex Parameter Type data sources are also identified in the Query Parameter Settings area. For more information, see Using Complex Parameter Types in Queries and Configuring Access to Complex Parameter Types in the Administration Guide.
If you anticipate a large set of data coming back when the query is run, click Large Results (an X in the box indicates this feature is on). The default is off (no X).
When this option is on, Liquid Data uses swap files to temporarily store results on disk in order to prevent an out-of-memory errors.
Figure 2-22 Specifying Large Results
To run a query, click the Run Query button on the toolbar in the upper left of the Test tab. (You can also choose the Run Query option from the Query menu.)
The query is run against your data sources and the result is displayed in the Results panel in XML format.
You can stop a running query before it has completed by clicking the Stop Query Execution button in the Toolbar. (Alternatively choose the Stop Query option from the Query menu.)
Figure 2-24 Stop Query Execution Button
Query results are reported in several forms. By default, results appear in structure XML.You can also view the query plan and statistics on the query once it has been run. For details see Running, Saving, and Deploying Queries.
It is a good practice to save your project file frequently since it will allow you to immediately restore your query and the schemas and other relationships that were defined to create it.
To save a project choose File —> Save Project or File —> Save Project As or click the "Save the project" toolbar button. Data View Builder projects are saved with a .qpr
filename extension. (For a complete description of options available for handling projects, see 1. Menu Bar for the Design Tab.
.qpr
file that includes the conditions and mappings for source and target schemas used in a particular query. However, saving a project does not make the query in that project available as a stored query. For more information on stored queries see Using the stored_queries Folder.When you save a project, the schema definitions of all source and target schemas that you mapped in the project are saved. When you reopen the project, Data View Builder first looks for the schema definitions in the Liquid Data repository.
If a schema definition is unavailable, the schema definition saved in the project file is used. Data View Builder adds the schema to the list of available resources, but flags it as offline by putting a red mark over the schema name. A warning is also generated in the WebLogic Administration Console log that queries using this schema will not run.
Offline resources are available only to the previously associated project.
In order for your project to be portable you should save your target schema to the Liquid Data Server repository on the server where the project will be used.
If you have not already done so, consider working through the steps in Getting Started, which takes you through the basic tasks of configuring some data sources and using the Data View Builder to design a query using an Order Query sample. (For more information about Liquid Data samples, see the Samples introduction page.) Working through the sample in Getting Started is a good, hands-on way to get familiar with working with schema representations of data sources and using the basic query-building tools, task flow, and workspaces in the Data View Builder.
If you are ready to get started on building some other basic queries see Liquid Data by Example. It provides examples of queries of using more advanced features and functions such as creating unions, using date and time functions, using aggregate functions, using hints to optimize queries, and using data views in queries.
![]() ![]() |
![]() |
![]() |