bea.com | products | dev2dev | support | askBEA
 Download Docs   Site Map   Glossary 
Search

Building Queries and Data Views

 Previous Next Contents Index View as PDF  

Overview and Key Concepts

W3C XQuery, XML, and Liquid Data

XQuery Use in Liquid Data and Data View Builder

The Role of XML in Creating Global Business Solutions

Supported XML Schema Versions In Liquid Data

Learning More About the XQuery Language

Data View Builder Overview

Advantages of the Data View Builder

How the Data View Builder Works

Key Concepts of Query Building

Query Plans

Stored Queries

Ad Hoc Queries

Different Kinds of Data Sources

Relational Databases

XML Files

Web Services

Application Views

Data Views—Using the Result of a Query as a Data Source

Stored Procedures

Source and Target Schemas

Understanding Source Schemas

Understanding Target Schemas

Anatomy of a Query: Joins, Unions, Aggregates, and Functions

Joins

Unions

Aggregates

Functions

Query Parameters

Understanding XML Namespaces

XML Namespace Overview

Predefined Namespaces in XQuery

Other XML Namespace References

XML Namespaces in Liquid Data Queries

Namespace Declarations in XQuery Prolog

Namespaces in Target Schema Definitions

Data Sources that Require Namespace Declarations

Migrating Liquid Data 1.0 Queries

Next Steps

Starting the Builder and Touring the GUI

Starting the Data View Builder

Data View Builder GUI Tour

Design Tab

Overview Picture of Design Tab Components

1. Menu Bar for the Design Tab

2. Toolbar for the Design Tab

3. Builder Toolbar

4. Source Schemas

5. Target Schema

6. Conditions Tab

7. Mappings Tab

8. Sort By Tab

9. Status Bar

Optimize Tab

Overview Picture of Optimize Tab Components

1. Source Order Optimization

2. Join Pair Hints

Test Tab

Overview Picture of Test Tab Components

1. Menu Bar for the Test Tab

2. Toolbar for the Test Tab

3. Builder-Generated XQuery

4. Query Parameters: Submitted at Query Runtime

5. Query Results - Large Results

6. Run Query

7. Result of a Query

Working With Projects

To Make a Project Portable, Save Target Schema to Repository

Saving a Project is Not the Same as Saving a Query

Using Schemas Saved With Projects

Special Characters: Occurrence Indicators

Next Steps: Building and Testing Sample Queries

Designing Queries

Designing a Query

Building a Query

Opening the Source Schemas for the Data Sources You Want to Query

Adding a Target Schema

Editing a Target Schema

Mapping Source and Target Schemas

Mapping Node to Node

Example: Query Customers by State

Mapping Nodes to Functions

Supported Mapping Relationships

Removing Mappings

Setting Conditions

What are Functions?

Using Constants and Variables in Functions

Enabling and Disabling Conditions

Removing Conditions

Adding or Deleting Parameters in a Condition Statement

Showing or Hiding Data Types

Using Automatic Type Casting

Exceptions to Automatic Type Casting

Examples of Simple Queries

Example: Return Customers by Name

Build the Query

View the XQuery and Run the Query to Test it

Example: Query Customers by ID and Sort by State

Open the Data Sources and Add a Target Schema

Map Nodes from Source to Target Schema to Project Output

Join Two Sources

Specify the Order of the Result Using the Sort By Features

View the XQuery and Run the Query to Test it

Understanding Scope in Basic and Advanced Views

Where Does Scope Apply?

Basic View (Automatic Scope Settings)

Advanced View (Setting the Scope Manually)

When to Use Advanced View to Set Scope Manually

Task Flow Model for Advanced View Manual Scoping

Returning to Basic View

Saving Projects from Basic or Advanced View

Version Control

Scope Recursion Errors

Recommended Action

Understanding Query Design Patterns

Target Schema Design Guidelines and Query Examples

Design Guidelines

Examples of Effective Query Design

Source Replication

Why is source replication necessary?

When is source replication necessary?

When should you manually replicate sources?

Next Steps

Optimizing Queries

Factors in Query Performance

Using the Features on the Optimize Tab

Source Order Optimization

Example: Source Order Optimization

Optimization Hints for Joins

Choosing the Best Hint

Using Parameter Passing Hints (ppleft or ppright)

Using a Merge Hint

Testing Queries

Switching to the Test View

Using Query Parameters

Specifying Large Results for File Swapping

Running the Query

Viewing the Query Result

Saving a Query

Saving a Query to the Repository as a "Stored Query"

Naming Conventions for Stored Queries

Using Data Views

Enterprise and the Data View

Understanding Data Views

A Data View Use Case

Simple and Parameterized Data Views

Using Data Views as Data Sources

Creating a Data View

Creating and Saving the Query to the Liquid Data Repository

Configuring a Data View Data Source Description

Adding a Data View as a Data Source

Creating a Parameterized Data View

Data View Query Samples

Using Complex Parameter Types in Queries

Understanding Complex Parameter Types

A CPT Use Case

Understanding CPT Schema and Data

Sample CPT Schema

Sample XML Data Stream

Notes on Hand-Crafting CPT XQueries

Unique Namespace

XQuery of type element Declaration

Creating a Complex Parameter Type

Step 1. Create a CPT Schema

Step 2. Create Your Runtime Source

Step 3. Define Your CPT in the Administration Console

Step 4. Build Your Query

Step 5. Run your query

Complex Parameter Type Query Samples

Defining Stored Procedures

Defining Stored Procedures to Liquid Data

To Define Stored Procedures to Liquid Data

Stored Procedure Description File Schema

Basic Structure

Type Definitions

Function Definitions

Schema Definition File for Stored Procedure Description File

Element and Attribute Reference for Stored Procedure Description File

Supported Datatypes

Rules for Specifying Stored Procedure Description Files

Rules for Element and Attribute Names

Rules for Procedure Names Containing a Semi-Colon

Rules and Examples of <type> Declarations to Use in the <function> return_type Attribute

Example 1: Type Definition with No Return Value

Example 2: Type Definition with Simple Return Value

Example 3: Type Definition for Complex Row Set Type

Example 4: Type Definition with Complex Return Value

Example 5: Type Definition with Simple Return Value and Two Row Sets

Rules for the mode Attribute output_only <argument> Element

Rules for Transforming the Function Signature When Hand Writing an XQuery

Namespace Declaration

Function Transformation

Sample Stored Procedure Description Files

DB2 Simple input_only, output_only, and input_output Example

Oracle Cursor Output Parameter Example

DB2 Multiple Result Set Example

Oracle Cursor as return_value

Stored Procedure Support by Database

Oracle

Microsoft SQL Server

Sybase

IBM DB2

Informix

Using Stored Procedures in Queries

Define Stored Procedures to Liquid Data

Example: Defining and Using a Customer Orders Stored Procedure

Business Scenario

View a Demo

Step 1: Create the Stored Procedure in the Database

Step 2: Create the Stored Procedure Description File

Step 3: Specify the Stored Procedure Description File in the Liquid Data Console

Step 4: Open the Data View Builder to See Your Stored Procedures

Step 5: Use the Stored Procedure in a Query

Step 6: Run the Query

Query Cookbook

Example 1: Simple Joins

The Problem

The Solution

View a Demo

Ex 1: Step 1. Verify the Target Schema is Saved in Repository

Ex 1: Step 2. Open Source and Target Schemas

Ex 1: Step 3. Map Nodes from Source to Target Schema to Project the Output

Ex 1: Step 4. Create a Query Parameter for a Customer ID to be Provided at Query Runtime

Ex 1: Step 5. Assign the Query Parameter to a Source Node

Ex 1: Step 6. Join the Wireless and Broadband Customer IDs

Ex 1: Step 7. Set Optimization Hints

Ex 1: Step 8. View the XQuery and Run the Query to Test it

Ex. 1: Step 9. Verify the Result

Example 2: Aggregates

The Problem

The Solution

View a Demo

Ex 2: Step 1. Locate and Configure the "AllOrders" Data View

Ex 2: Step 2. Restart the Data View Builder and Find the New Data View

Ex 2: Step 3. Verify the Target Schema is Saved in the Repository

Ex 2: Step 4. Open the Data Sources and Target Schema

Ex 2: Step 5. Map Source Nodes to Target to Project the Output

Ex 2: Step 6. Create Two Query Parameters to be Provided at Query Runtime

Ex 2: Step 7. Assign the Query Parameters to Source Nodes

Ex 2: Step 8. Add the "count" Function

Ex 2: Step 9. Verify Mappings and Conditions

Ex 2: Step 10. View the XQuery and Run the Query to Test it

Ex 2: Step 11. Verify the Result

Example 3: Date and Time Duration

The Problem

The Solution

View a Demo

Ex 3: Step 1. Verify the Target Schema is Saved in Repository

Ex 3: Step 2. Open Source and Target Schemas

Ex 3: Step 3. Map Source to Target Nodes to Project the Output

Ex 3: Step 4. Create Joins

Ex 3: Step 5. Create Two Query Parameters for Customer ID and Date to be Provided at Query Runtime

Ex 3: Step 6. Set a Condition Using the Customer ID

Ex 3: Step 7. Set a Condition to Determine if Order Ship Date is Earlier or Equal to a Date Submitted at Query Runtime

Ex 3: Step 8. Set a Condition to Include Only "Open" Orders in the Result

Ex 3: Step 9. View the XQuery and Run the Query to Test it

Ex 3: Step 9. Verify the Result

Example 4: Union

The Problem

The Solution

View a Demo

Ex 4: Step 1. Verify the Target Schema is Saved in Repository

Ex 4: Step 2. Open Source and Target Schemas

Ex 4: Step 3. Clone the Orders Element of the Target Schema

Ex 4: Step 4. Create a Query Parameter for a Customer ID

Ex 4: Step 5. Assign a Query Parameters

Ex 4: Step 6. Define Source Relationships

Ex 4: Step 7. Project the Output to the Target Schema

Ex 4: Step 8. Add Optimization Hints

Ex 4: Step 9. View the XQuery and Run the Query to Test it

Ex 4: Step 10. Verify the Result

Example 5: Minus

The Problem

The Solution

View a Demo

Ex 5: Step 1. Verify the Target Schema is Saved in Repository

Ex 5: Step 2. Open Source and Target Schemas

Ex 5: Step 3. Find Broadband and Wireless Customers with the Same Customer  ID

Ex 5: Step 4. Find the Count of the Wireless Customers

Ex 5: Step 5. Set a Condition that Specifies the Output of "count" is Zero

Ex 5: Step 6. View the XQuery and Run the Query to Test it

Ex 5: Step 7. Verify the Result

Example 6: Complex Parameter Type (CPT)

The Problem

The Solution

View a Demo

Ex 6: Step 1. Verify the Availability of Schemas and Sample Data Stream

Ex 6: Step 2. Open the Target Schema and CO-CPTSAMPLE CPT

Ex: 6: Step 3. Create an orderLimit Query Parameter

Ex 6: Step 4. Save the Project

Ex 6: Step 5. Test Access to the Complex Parameter Source

Ex 6: Step 6: Determine the Total Amount of New Orders

Ex 6: Step 7. Create the Necessary Joins and Mappings to the Target Schema

Ex 6: Step 8. Determine the Amount of Currently Open Orders

Ex 6: Step 9: Determine the Total Amount of All Open and New Orders

Ex 6: Step 10: Test If Open Orders + New Orders Exceeds the Order Limit

Ex 6: Step 11: Determine If the Order is Accepted or Rejected

Ex 6: Step 12: View the XQuery

Ex 6: Step 13. Run the XQuery to Verify the Result

Functions Reference

About in Liquid Data XQuery Functions

Naming Conventions

Occurrence Indicators

Data Types

Date and Time Patterns

Accessor and Node Functions

xf:data

xf:local-name

Aggregate Functions

xf:avg

xf:count

xf:max

xf:min

xf:sum

Boolean Functions

xf:false

xf:not

xf:true

Cast Functions

cast as xs:boolean

cast as xs:byte

cast as xs:date

cast as xs:dateTime

cast as xs:decimal

cast as xs:double

cast as xs:float

cast as xs:int

cast as xs:integer

cast as xs:long

cast as xs:short

cast as xs:string

cast as xs:time

Comparison Operators

eq

ge

gt

le

lt

ne

Constructor Functions

xf:boolean-from-string

xf:byte

xf:decimal

xf:double

xf:float

xf:int

xf:integer

xf:long

xf:short

xf:string

Date and Time Functions

xf:add-days

xf:current-dateTime

xf:date

xfext:date-from-dateTime

xfext:date-from-string-with-format

xf:dateTime

xfext:dateTime-from-string-with-format

xf:get-hours-from-dateTime

xf:get-hours-from-time

xf:get-minutes-from-dateTime

xf:get-minutes-from-time

xf:get-seconds-from-dateTime

xf:get-seconds-from-time

xf:time

xfext:time-from-dateTime

xfext:time-from-string-with-format

Logical Operators

and

or

Numeric Operators

* (multiply)

+ (add)

- (subtract)

div

mod

Numeric Functions

xf:ceiling

xf:floor

xf:round

xfext:decimal-round

xfext:decimal-truncate

Other Functions

xfext:if-then-else

Sequence Functions

xf:distinct-values

xf:empty

xf:subsequence (format 1)

xf:subsequence (format 2)

String Functions

xf:compare

xf:concat

xf:contains

xf:ends-with

xf:lower-case

xf:starts-with

xf:string-length

xf:substring (format1)

xf:substring (format 2)

xf:substring-after

xf:substring-before

xf:upper-case

xfext:match

xfext:trim

Treat Functions

treat as xs:boolean

treat as xs:byte

treat as xs:date

treat as xs:dateTime

treat as xs:decimal

treat as xs:double

treat as xs:float

treat as xs:int

treat as xs:integer

treat as xs:long

treat as xs:short

treat as xs:string

treat as xs:time

Supported Data Types

Overview

JDBC Types

JDBC Names

Database-Specific Names

Oracle Names

Microsoft SQL Server Names

DB2 Names

Sybase Names

Informix Names

Type Casting Reference

Type Casting to a Numeric Target

Type Casting to a Non-Numeric Target

Type Casting Function Parameters

 

Back to Top Previous Next