saada logo

Tutos and Links  
Getting started  
Doing More  
The Web Interface  
VO Publishing  
Tips & Troubelshooting  
Mailing List  
Saada Sites  
How to Contact us ?  
Next Step  
Old Releases  
Inside Saada  
Using UWS Logo

HOME ART > Tutorial > SaadaQL
SaadaQL in a Few Words

Your SaadaDB is designed to host heterogeneous data classified in collections and classes. Building queries with SQL in this context is not easy because it requires to use joins to select data in multiple tables. This complexity must be hidden by HTML forms but a lot of queries can not be setup with HTML forms. Saada proposes its own query langage (SaadaQL) based on the collections and on the classes defined by the operator. SaadaQL merges in an homogeneous syntax both SQL statements and SAADA specific statements. SaadaQL in not a mathematically complete language but indeed an idiom adpated to the GUI, human readable enough to be modified by hand.

The Saada query engine returns result set containing selected OIDs and values of all keywords constrained by the query.

  Syntax elements

  • SaadaQL keywords are case sensitive.
  • Logical blocs are delimited with {}.
  • Multi line queries are supported.
  • Strings delimitors are double quotes ("").

  Query Structure

The SQL "select from" is replaced with an OQL flavour "Select From In" which specifies collections and classes where data are queried. The SQL where statement is replaced with 5 clauses having each one its own significance. Where clauses are implicitely ANDed. The global structure of a SaadaQL query is figured below.

Select [type] From [Classes] In [Collections]
WherePosition  {...}
WhereAttributeClass {...}
WhereAttributeSaada {...}
WhereRelation  {...}
WhereUCD/Utype  {...}

 The "Select [type] From [Classes] In [Collections]" clause.

  • [type] : unique key giving the category of searched data. type can be : ENTRY, TABLE, SPECTRUM, IMAGE, MISC or FLATFILE.
  • [Classes] : List of classes of searched data. Can be a unique token, a wild card (*) or a comma separated list. Class can only be specified if the query cover one collection
  • [Collections] : List of collections where data will be searched. Can be a unique token, a wild card (*) or a comma separated list.
  • Examples
Select ENTRY From * In * queries entries of the whole database.
Select IMAGE From * In HST queries all images in the collection HST.
Select IMAGE From * In HST,NGST queries all images in both collections HST and NGST.
Select IMAGE From class1 In HST queries all images in the class class1 of the collection HST.
Select IMAGE From class1,class2 In HST queries all images in both classes class1 and class2 of the collection HST.
Select IMAGE From class1,class2 In HST,NGST returns an error because classes can be specified on multiple collections.
  • Query Coverage
[type] [collection] [class] -
collection1 * or class1, class2... or class1 Only one collection can be queried if classes are specified
* or coll1 or coll1,coll2... * Some or any collections can be queried if no classes are specified
FLATFILE * or coll1 or coll1,coll2... * There is no class for flatfiles

 The WherePosition clause

 The WhereAttributeSaada clause

 The WhereAttributeClass clause

 The WhereRelation clause

 The WhereUCD clause

 A complex Example

last update 2009-12-17