TechTalk Genome v4.2

Filtering

set [[alias:] filter-clause]
set
An OQL expression returning a Set<T> of scalars or persistent objects.
alias
An identifier used to alias the candidate element of set. If alias is specified, the this keyword refers to the candidate element declared in any outer scope (the semantics of the this keyword are not altered when an explicit alias is used). If omitted, the this keyword can be used to refer to the candidate element of set.
filter-clause
An OQL implicit function executed on candidate elements of set, returning a boolean value. A value of true indicates that the current candidate element should participate in the resulting Set<T>; a value of false indicates that the current candidate element should be omitted from the resulting Set<T>. alias (if declared) can be used to refer to the candidate element of set. Identifiers declared in outer scopes of the expression can be freely used within filter-clause.

Return Value

A Set<T> containing those elements of set for which filter-clause evaluates to true. The element type of the resulting Set<T> is the same as the element type of set.

Remarks

The filter-clause expression is evaluated for each element of set. The order in which elements of set are evaluated is indeterministic. Elements for which filter-clause returns true will participate in the Set<T> returned by this operator.

alias (if present) can be used to refer to the candidate element of set; otherwise, the this keyword can be used.

OQL accords filtering a higher operator precedence than projection. Therefore, the query

    [projection]set[filter] 

is identical to

    [projection](set[filter]) 

Quick Reference

OQL
extentof(Animal)[Age > 1]

C#
Set<Animal> animals = myDB.Extent<Animal>()["Age > {0}", 1];

SQL
SELECT * FROM Animal WHERE Age > 1

See Also

Set<T>.Where | Implicit Functions | Projection | OqlReference.Chapter4