Skip navigation.
Downloads | Product Documentation | Support

Administration Guide

# Configuring Stored Queries

This chapter describes how to configure stored queries in Liquid Data. It contains the following sections:

- Stored Queries in Liquid Data
- Stored Query Configuration Tasks

- To Configure (Deploy) a Stored Query
- To Create a Data View from a Stored Query
- To Create a Web Service from a Stored Query
- To Delete a Stored Query Configuration

You can also create, test, and deploy stored queries directly from the Data View Builder. For instructions on how to deploy a stored query from the Data View Builder, see Deploying a Query in Building Queries and Data Views.

# Stored Queries in Liquid Data

A stored query in Liquid Data is a file in the Liquid Data repository that contains the XQuery text to submit a query to the Liquid Data server. Stored queries are stored in the following location:

>     LDRepository/stored_queries

where `LDRepository` is the root-level directory of the Liquid Data repository. The location of the Liquid Data repository is specified in the General tab of the Liquid Data Administration Console.

You can deploy a stored query either from the Liquid Data Administration Console or from the Data View Builder. For details on using the Data View Builder to deploy stored queries, see Building Queries and Data Views. For details on deploying a stored query from the Liquid Data Administration Console, see Stored Query Configuration Tasks.

This section describes stored queries and includes the following subsections:

- Stored Queries Tab of Liquid Data Administration Console
- Available for Liquid Data Control or EJB API
- Stored Query Configuration Field Descriptions

## Stored Queries Tab of Liquid Data Administration Console

You use the Stored Query tab of the Liquid Data Administration Console to configure stored queries. The Stored Query tab displays all of the queries stored in the repository and allows you to configure the following for each query:

- A schema file for the query
- Generate a Web Service from the stored query (schema file required)
- Generate a Data View from the stored query (schema file required)
- Specify a security policy for the stored query (security must be enabled)
- Delete the stored query definition

If the `stored_queries` directory of the repository has subdirectories, any queries in a subdirectory is displayed in the stored query tab with a dot (`.`) between each subdirectory and the query name. For example, if you have the following file in your Liquid Data repository:

>     LDRepository/stored_queries/rtl/electronics/orders.xq

The entry in the Stored Query tab appears as follows:

>     rtl.electronics.orders.xq

If you configure a security policy on stored queries that resides in subdirectories of the `stored_queries` repository folder, they inherit any security policy that is configured from the folder(s) in which they reside. Stored queries do not inherit security policy from a security resource group. In the previous example, the stored query `orders.xq` inherits security policy from the `rtl` repository folder and from the `electronics` repository folder. For details on configuring a security policy on a repository folder, see Configuring Secure Access to Items in the Server Repository and Assigning Security Policies to Liquid Data Objects.

Note: Because you can generate Web Services from stored queries, stored queries must have names that conform to the XML Schema specification. For example, the names must begin with an alphabetic character (letter)—not a number, and they must not have any special characters such as hyphens. For more information, see Naming Conventions for Stored Queries and the W3C XML Schema document at http://www.w3.org/XML/Schema.

## Available for Liquid Data Control or EJB API

You can access stored queries programmatically with the Liquid Data EJB API. If you are using the Liquid Data Control in WebLogic Workshop, the queries must have a schema file associated with them. The Liquid Data Control requires the schema file because it generates an `XMLBean` Java classes corresponding to the schema definitions. The `XMLBean` compiler requires the schema for the file. The generated `XMLBean` Java classes allow an interface to the data, which makes it easier to display data from a Liquid Data query in an application.

## Stored Query Configuration Field Descriptions

The following table describes the fields in the Configure Stored Query screen of the Liquid Data Administration Console.

Table 16-1 Stored Query Configuration Fields

Field | Description
--- | ---
Name | The name of the stored query saved in the repository. The name includes any subdirectories with a dot (.) between the directory hierarchies. For an example of the dot notation, see Stored Queries in Liquid Data.
Schema | Identifies the name of the schema file associated with the query. You can find the `.xsd` file in the LDrepository`/schema` folder. Either enter the schema file name or click Browse Repository to browse the schema folder.
Namespace URI | Identifies the full target namespace of the Stored Query schema file. Example: `urn:schemas-bea-com:myQuery` Note: If a namespace is provided, the schema root element name must also be supplied. If it is not provided, Liquid Data determines the namespace from the schema file.
Schema Root Element Name | Identifies a unique root element in the schema file. Many schemas only have one root. In cases where there are more than one root, only sub-elements of the identified root will be part of the schema used in the stored query. You must specify the root element if there is more than one root element to ensure that Liquid Data uses the correct element for the schema. Note: If the schema root element name is entered, a namespace must also be provided.

# Stored Query Configuration Tasks

This section includes procedures for the following tasks related to stored queries:

- To Configure (Deploy) a Stored Query
- To Create a Data View from a Stored Query
- To Create a Web Service from a Stored Query
- To Delete a Stored Query Configuration

Note: You can also create, test, and deploy stored queries directly from the Data View Builder. For instructions on how to deploy a stored query from the Data View Builder, see Deploying a Query in Building Queries and Data Views.

## To Configure (Deploy) a Stored Query

Perform the following steps to configure a stored query in Liquid Data.

1. Create a query and save it in the `stored_queries` folder of the Liquid Data repository. For details about the Liquid Data repository, see Managing the Liquid Data Server Repository.
2. Start the Administration Console (for details, see Starting the Administration Console).
3. In the left pane of the Administration Console, expand the node for your domain and click the Liquid Data node.
4. In the right pane, navigate to the Stored Query tab.

A table containing links to all of the query files in the `stored_queries` folder of the Liquid Data repository appears.

5. Click the link corresponding to the query you want to configure.

Figure 16-2 Edit Stored Query Screen

6. Enter a schema file and (optionally) a Namespace URI and a Schema Root Element. For a description of the fields, see Stored Query Configuration Field Descriptions.
7. Click Apply to save your configuration changes.

## To Create a Data View from a Stored Query

Perform the following steps to use the Administration Console to create a Data View from a stored query.

Note: You can create and deploy a Data View directly from the Data View Builder instead of going to the Administration Console. For details, see Building Queries and Data Views.

1. Start the Administration Console (for details, see Starting the Administration Console).
2. In the left pane of the Administration Console, expand the node for your domain and click the Liquid Data node.
3. In the right pane, navigate to the Stored Query tab.
4. The stored query must have a schema configured (and, optionally, a namespace and root element node) before you can create a data view from it. For details on adding a schema file to the stored query configuration, see To Configure (Deploy) a Stored Query.
5. Find the entry for your stored query and click the Create Data View link.
6. Enter a name for the Data View on the Configure a Data View Data Source screen and click Create.

## To Create a Web Service from a Stored Query

Perform the following steps to create a Web Service from a stored query:

1. Start the Administration Console (for details, see Starting the Administration Console).
2. In the left pane of the Administration Console, expand the node for your domain and click the Liquid Data node.
3. In the right pane, navigate to the Stored Query tab.
4. The stored query must have a schema configured (and, optionally, a namespace and root element node) before you can create a web service from it. For details on adding a schema file to the stored query configuration, see To Configure (Deploy) a Stored Query.
5. Find the entry for your stored query and click the Generate Web Service link. A screen similar to the following appears when the web service generation is complete.

Figure 16-3 Successful Web Service Generation

## To Delete a Stored Query Configuration

When you delete the stored query definition (by clicking the trash can icon), the Administration Console deletes the association between the stored query file and the schema definition. If you have created a Data View and a Web Service from the query, those objects are not deleted when you click the trash can. To delete those objects, you must go to the Data View and Web Services tabs of the Liquid Data Administration Console.

Perform the following steps to delete a stored query configuration:

1. Start the Administration Console (for details, see Starting the Administration Console).
2. In the left pane of the Administration Console, expand the node for your domain and click the Liquid Data node.
3. In the right pane, navigate to the Stored Query tab.
4. Find the entry for your stored query and click the trash can icon.

The definition for the stored query is deleted, but the stored query file remains in the repository. If you click the link for the stored query, the Configure Stored Query screen appears and you can reconfigure it.