Service Registry 3 2005Q4 Developer's Guide

Using Declarative Queries: Example

For examples of the use of declarative queries, see JAXRQueryDeclarative.java and JAXRGetAllSchemes.java in the directory <INSTALL>/registry/samples/query-declarative/src. Both examples create and execute a SQL query. The query strings are defined in the JAXRExamples.properties file.

The SQL query string for JAXRQueryDeclarative is as follows (all on one line):


SELECT ro.* from RegistryObject ro, Name nm, Description d 
WHERE upper(nm.value) LIKE upper(’%free%’) AND upper(d.value) 
LIKE upper(’%free%’) AND (ro.id = nm.parent AND ro.id = d.parent)

This query finds all objects that have the string "free" in both the name and the description attributes.

The SQL query string for JAXRGetAllSchemes is as follows:


SELECT * FROM ClassScheme s order by s.id

This query finds all the classification schemes in the Registry.

ProcedureTo Run the JAXRQueryDeclarative Example

Steps
  1. Go to the directory <INSTALL>/registry/samples/query-declarative.

  2. To run the JAXRQueryDeclarative example, type the following command:


    asant get-free
    
  3. To run the JAXRGetAllSchemes example, type the following command:


    asant get-schemes