bea.com | products | dev2dev | support | askBEA

Download Docs | Site Map | Glossary
Search

Building Queries and Data Views

Saving a Query

From the Test tab, you can save a query by choosing File—>Save Query from the menus or by clicking on the Save Query button on the toolbar.

You can save the query to a file on a local folder or other location on the network, or you can save the query to the Liquid Data server Repository in the stored_queries folder as described in the following section.

Note: Query files must be saved with a .xq extension. If you do not specify an extension, the Data View Builder automatically appends the .xq extension to the filename when the query file is saved.

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

If the query is saved into the stored_queries folder in the Liquid Data server Repository, it becomes a stored query in Liquid Data. There is a performance benefit to using stored queries in Liquid Data in that the query plan is automatically cached in Liquid Data and you have the option to configure caching on the query result as well. For more information about using stored queries, see Stored Queries in Overview and Key Concepts.

To create a stored query do the following:

1. On the Test tab, choose File—>Save Query from the menus. (The File—>Save Query menu option is available only from the Test view.)

   This brings up a file browser.

2. Use the file browser to navigate to the Repository.

3. The stored_queries folder is the only Liquid Data server repository directory available from the Data View Builder. This is the appropriate location in the repository in which to save a query.

4. Enter a name for the query in the File name field on the file browser and click Save. The query is saved to the stored_queries folder in the server repository with the appropriate .xq extension which identifies it as a stored query in Liquid Data.

You can reload a stored query using the Data View Build File : Open Query command. You may need to navigate to the directory containing your stored queries.

Once a stored query has been loaded, it can be run. See Running the Query for details.

Naming Conventions for Stored Queries

- Stored queries need .xq extension—Queries saved to the Liquid Data stored_queries folder in the Liquid Data server repository must have a .xq extension which identifies it as a stored query in Liquid Data. If you save the query via the Data View Builder, the .xq extension is automatically appended.

- Names of queries to be generated as Web services must follow W3C XML tag naming conventions—If you want to use Liquid Data to generate a Web service from a query, the query name must adhere to the same naming conventions as an XML tag since the query name is converted to an XML tag in the Web service generation process.

- The most salient of these XML naming conventions is that the query name (which will be converted to an XML tag name) must be alphanumeric and must begin with an alphabetic character (letter)—not a number. No special characters (such as an underscore) are allowed in the name. For example, myquery.xq and my12query.xq are both query names that will work with Web services generation, whereas 12query.xq will not work as a generated Web service.

- For a complete description of naming conventions for schema tags see described in the W3C XML Schema document at http://www.w3.org/XML/Schema.

(For information on how to generate a Web service from a stored query, see Generating and Publishing Web Services in the Liquid Data Administration Guide.)