TechTalk Genome v4.2

Intersection

set1 * set2
set1
An OQL expression evaluating to a Set<T> of scalar or persistent objects.
set2
An OQL expression evaluating to a Set<T> of scalar or persistent objects.

Return Value

A Set<T> containing elements contained in both set1 and set2.

Remarks

The intersection operator returns a Set<T> containing elements contained in both set1 and set2. The element type of the resulting set is the most specialised common type of the element type of set1 and set2 (the current implementation restricts set1 and set2 to having the same element type, hence the element type of the resulting Set<T> is identical to the element type of both source sets).

The query engine uses cross-filtering to conduct the resulting query. Both source sets must therefore have the same element type and apply the same projections (if any). The resulting query is then defined by the query

    [projection]extentof(T)[filter1 && filter2] 

where projection is the same projection applied to both sets, T is the element type of the source sets, filter1 is the filter criteria (if any) applied to set1 and filter2 is the filter criteria applied to set2. This method of conducting the resulting query is referred to as cross-filtering set1 with set2.

The query

    [Name]extentof(Person)[Age >= 19] * [Name]extentof(Person)[Age <= 49] 

translates to

    SELECT * FROM Animal LEFT JOIN Cage ON Animal.CageId = Cage.Id 

Quick Reference

OQL
extentof(Animal)[Age > 10] * extentof(Animal)[Cage.Size > 100]

C#
Set<Animal> animals =
myDB.Extent<Animal>()["Age > {0}", 10] *
myDB.Extent<Animal>()["Cage.Size > {0}", 100];

SQL
SELECT * FROM Animal LEFT JOIN Cage ON Animal.CageId = Cage.Id WHERE Age < 10 AND Cage.Size > 100

See Also

Set<T>.op_Multiply | Set<T>.Intersection | OqlReference.Chapter11