Please note: this project is inactive since early 2006

 
4.5.5 Negating, Con- or disjoining qualifiers

Now that we've seen all possible operators, we'll see that it is possible to conjoin, disjoin, or negate them. For example:

    objects=ec.fetch('Writer', qualifier='lastName like "H*" AND age >= 80')
will give you the author whose lastName begins with the capitalized letter 'H' and who are older than 80.

Likewise,

    objects=ec.fetch('Writer', qualifier='age<50 OR lastName like "????"')
will give you the Writer objects who are less than 50 years old, or whose last name has exactly 4 letters.

Last, operator 'NOT' negates the expression, so

  objects=ec.fetch('Writer', qualifier='NOT(age<50 OR lastName like "????")')
will fetch the Writer objects who are older than 50 and whose lase name is not exactly 4 letter long.

Note: Operators 'AND', 'OR', 'NOT', 'IN' and 'NOT IN' can be written upper-case or lower-case, while operators 'like', ilike and 'caseInsensitiveLike' should be written as-is (exact typo.)

Warning: The precedence of the operators is not very clear -it depends on a parser (spark: cf. spark home page) which I do not fully understand, I must admit. Moreover, it might be subject to changes.

For example: NOT age<50 OR age>200 is in fact equivalent to NOT(age<50 OR age>200).

Hence, in general, you are strongly encouraged to enclose the expressions in brackets so that the precedence of operators does not intervene at all.

Comments are welcome: Sebastien Bigaret / Modeling Home Page
Hosted by:SourceForge.net Logo