saada logo

 
  SAADA OVERVIEW
Home  
News  
Tutos and Links  
Download  
  Tutorial
Getting started  
Doing More  
SaadaQL  
The Web Interface  
VO Publishing  
Tips & Troubelshooting  
  COMMUNITY
Mailing List  
Saada Sites  
How to Contact us ?  
  DEVELOPER CORNER
Contributors  
Next Step  
Old Releases  
Inside Saada  
Using UWS  

 

SourceForge.net Logo


HOME ART > DEVELOPER CORNER > Old Releases > Saada 1.4.2 > TUTORIAL > Using your SaadaDB > 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 with because that requires to use joins (terme technique) 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 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.




SaadaQL doesn’t return data but just OIDs of selected records. The content of the record must then be searched by the API.

  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  {...}

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

  • [type] : unique key giving the category of searched data. type can be : ENTRY, TABLE, SPECTRUM, IMAGE or PLOT.
  • [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 ranged on ne 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.

 The WherePosition clause

 The WhereAttributeSaada clause

 The WhereAttributeClass clause

 The WhereRelation clause

 The WhereUCD clause

 A complex Example

last update 2007-03-03