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

Building Queries and Data Views

 Previous Next Contents Index View as PDF  

Creating a Complex Parameter Type

This section describes the steps needed to create and run 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

Step 1. Create a CPT Schema

Create a schema that models the runtime source. See the Sample CPT Schema for a small schema example.

Note: In some design situations you may first create a CPT schema and then develop a model for the runtime source. The important point is that there is a tightly coupled relationship between the schema and the runtime data that it models. Both must work together and, once working, the structure of the documents cannot be changed independently.

Step 2. Create Your Runtime Source

Create an instance of your runtime source. The runtime source needs to be in XML.

Step 3. Define Your CPT in the Administration Console

Using the Liquid Data Administration Console, define a complex parameter type. for a detailed procedure, see Configuring Access to Complex Parameter Types in the Administration Guide.

Figure 7-1 Creating a Complex Parameter Type in the Administration Console


 

A valid CPT definition includes an alias identifier and a schema. It is also a good programming practice to provide both a namespace URI and a schema root element name to uniquely identify your CPT.

Step 4. Build Your Query

Create your query either using the Data View Builder or by hand. See Key Concepts of Query Building for information on designing queries in Liquid Data.

Step 5. Run your query

Once you have created a CPT schema, have a data sample available, and have defined the CPT in the Administration Console, you are ready to use a complex parameter type in a query.

Note: Complex parameter types are not type aware and are always of the type xs:string in Liquid Data. You need to cast each element appropriately.

The Liquid Data DB-CPT sample cptSample.qpr uses a CPT to supply a promotion plan name for a given state. The sample is installed in the following directory:

BEA_HOME/weblogic700/liquidata/samples/buildQuery/db-cpt

When the query runs details of one or more matching promotion plans names are retrieved from a database.

Figure  7-2 shows the DB-CPT project. Notice that there are two complex parameter types available for use. CPTSAMPLE is the complex parameter type used in the query.

Figure 7-2 DB-CPT Project (CPTSAMPLE.QPR) with Complex Parameter Types Displayed


 


 

To test your query the name of an XML data file that is modeled on the CPT schema must be entered in the Data View Builder (see Figure  7-3). For Liquid Data sample XML click on the Value field to open the Liquid Data file browser to the LDRepository/XML_files directory.

Figure 7-3 DB-CPT Project in Test Mode


 


 

Figure  7-4 shows the DB-CPT (CPTSAMPLE.QPR) project when the query is run.

Figure 7-4 DB-CPT Project (CPTSAMPLE.QPR) in Run Mode


 

When you are satisfied with your ability to run your query using runtime data source, the query can be invoked through an EJB API. For details on invoking queries programmatically and the Liquid Data API see:

There is also a Liquid Data EJB API sample in:

BEA_HOME/weblogic700/liquidata/samples/ejbAPI

 

Back to Top Previous Next