next up previous contents
Next: 6.5 Relational functions that Up: 6 Creating New Relations Previous: 6.3 Unary relational operations

6.4 Low level relational operations

This section describes two low level relational operations that are used to implement many of the above operations. The use of these low level functions is discouraged in cases where some combination of the higher level operations can be used instead.

These operations take as arguments mappings which specify for each input and output variable in the input relation(s), the input, output or existentially quantified variable in the resultant relation that they correspond to. For example specifies all occurrences of the input variable will be replaced by the output variable in the resultant relation.

void MapRel1(Relation &r, Mapping &map, Combine_Type ctype, int n_inp, int n_out)
Works with both relations and sets (see discussion below for sets).

Relation MapAndCombineRel2(Relation &r, Relation &r, Mapping &map1, Mapping &map2,
Combine_Type Op, int n_inp, int n_out)

Works with both relations and sets (see discussion below for sets).

MapRel1 and MapAndCombineRel2 can also take as arguments and produce as results sets. To do so, the specified mappings must refer to Set_Vars rather than Input_Vars and Output_Vars. It is important not to mix Set_Vars with Input_Vars or Output_Vars in the same object.

Mappings are declared using a constructor that takes two integer arguments that represent the input and output arities of the input relation. Mappings are specified using the member function void set_map(Var_Type in_type, int i, Var_Type out_type, int j) . For example the example above would be specified by map.set_map(Input_Var,1,Output_Var,3) .



omega@cs.umd.edu

Web Accessibility