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
The WhereRelation clause



 The WhereRelation contains a list of correlation patterns. A correlation pattern is a description of a vector drown by the correlation links of a given relationship (see datamodel) and starting from agiven record.

 The WhereRelation statement can contain multiple patterns. All of patterns are ANDed.

WhereRelation{ matchPattern { pattern1 }
              matchPattern { pattern2 }
              }

In the example given before, data having correlation links matching both patterns pattern1 and pattern2 are selected. There is no limitation in the number of patterns contained into the WhereRelation clause.

 A relation pattern must at least contain the relation name.

  • matchPattern {"Spectra2Src" }

The pattern shown here simply specifies : at least one link of the relationship Spectra2Src. Data correlated by the relationship Spectra2Src with at least one secondary record match this pattern.

The number of links can be refined with the Cardinality

  • matchPattern {"Spectra2Src"
                , Cardinality("=", 3, 0)
                }
  • The pattern shown above specifies : 3 links of the relationship Spectra2Src. Data correlated by the relationship Spectra2Src with 3 secondary records match this pattern. The Cardinality function must be unique in a pattern. The first parameter of the Cardinality function is the operator :
"=" equals to
"=" not equals to
"<" less than
">" greater than
"<=" less than or equal to
">=" greater than or equal to
"[]" Out of bounds
"][" In bounds

The second and the third parameters are the operands. The third operator is only used with "[]" and "][".

  • Relation links can be qualified with user defined numeric fields, the link qualifiers. Constrains on qualifiers are set by the functions Qualifier. The first parameter is the qualifier name and the others are similar with those of the Cardinality function. One pattern can contain several Qualifiers functions. They are ANDed
    • matchPattern {"Spectra2Src"
                  , Qualifier("likelihood", ">", 2000, 0)
                  , Qualifier("pixel_value", "[]", 1, 2)
                  }                              
  • A relation pattern can also include constrains on the collection attributes of the secondary object with the AssObjAttSaada function. It must be unique in a pattern. It contains an SQL like string similar to the WhereAttributeSaada clause.
    • matchPattern {"Spectra2Src"
                 , AssObjAttSaada("namesaada like 'LE%' ")
                 }                                  

The pattern shown above simply specifies : at least one link of the relationship Spectra2Src pointing to an object with a name begining with ’LE’. The second pattern below selects correlation vectors with 3 links of the relationship Spectra2Src pointing to objects with a name begining with ’LE’..

    • matchPattern {"Spectra2Src"
                 , Cardinality("=", 3, 0)
                 , AssObjAtt("namesaada like 'LE%' ")
                 }              
  • A pattern can also select the classes of the secondary objects :
    • matchPattern {"Spectra2Src"
                  , AssObjClass("Class1", "Class2")
                  }              

The pattern shown above simply specifies : at least one link of the relationship Spectra2Src pointing to an object of the class Class1 or Class2. Class names must be double quoted and coma separated. Saada classes can be displayed with the Database Map anchor on the top of any web pages :

  • If the pattern contains the AssObjClass function with only one specified class then the constraints on the class attributes can be set with the AssObjAttClass function :
    • matchPattern {"Spectra2Src"
                  , AssObjClass("Class1")
                  , AssObjAttClass("_BZERO > 32 and _ARCFILER like 'FOR%'")
                  }              

The function AssObjAttClass is very similar to WhereAttributeClass (see).

  • Correlation patterns can also uses UCDs as for WhereUCD. UCD based constraints in pattern are handled by the operator AssUCD.
    • matchPattern {"Spectra2Src"
                  , AssUCD( [src.redshift] > 2  [none])
                  }

 The table below summarizes all pattern components. Note that each component except Qualifier can figure only once in a pattern.

relation name Name of the relationship concerned by the pattern.
Cardinality("operator", arg1, args2) Constraint on the number of links.
Qualifier("qual.name", "operator", arg1, args2) Constraint on a relationship qualifier value. It can be used several times in a pattern.
AssObjAttSaada("SQL like where clause") Constraint on the collection attributes of the secondary objects of relationship.
AssObjClass("classname",...) List if accepted classes of the secondary objects of the relationship. Classe names must be in " ".
AssObjAttClass("SQL like where clause") Constraint on the class attributes of the secondary object of the relationship. Can can only be used in patterns containing an AssObjClass with one class.
AssUCD Constraint on counterpart attributes expressed with UCDs
last update 2007-03-03