|
Query by Example
|
|
|
Query by Example (cont.) Constraints are also used in CCUBE queries to manipulate, as well as express Boolean conditions on, CST objects. To illustrate, assume that the database stores all_desks of type set(DESK*), i.e., a set of references to object of the class DESK. Consider the following CCUBE query which retrieves all desks that would intersect the room area (3 <= u <= 4 && 8 <= v <= 10), if centered at (6,4) and rotated 30 degrees counter-clockwise relatively to to the room's axes. For each retrieved desk, the query also gives the resulting desk's extent in the room's coordinates. SELECT pair(dsk, ((u,v) | dsk_glob)
) In the WHERE clause, SAT is a satisfiability test of the area constraint 3 <= u <= 4 && 8 <= v <= 10 conjuncted with dsk_glob, which finds whether dsk in the room's coordinates intersects the area defined by the constraint (3 <= u <= 4 && 8 <= v <= 10). In the SELECT clause, (u,v) | dsk_glob is the projection of dsk_glob on the room's axes u,v.
|
|
presentation created by Victor E. Segal |