Maintaining Components: keep
Syntax
op [ keep comp {, comp }* ]
Input parameters
op |
the operand |
comp |
a Component to keep |
Examples of valid syntaxes
- ::
DS_1 [ keep Me_2, Me_3 ]
Semantics for scalar operations
This operator cannot be applied to scalar values.
Input parameters type
op
dataset
comp
name<component>
Result type
result
dataset
Additional Constraints
All the Components comp must belong to the input Data Set op.
The Components comp cannot be Identifiers in op.
Behaviour
The operator takes as input a Data Set (op) and some Component names of such a Data Set (comp). These Components can be Measures or Attributes of op but not Identifiers. The operator maintains the specified Components, drops all the other dependent Components of the Data Set (Measures and Attributes) and maintains the independent Components (Identifiers) unchanged. This operation corresponds to a projection in the usual relational join semantics (specifying which columns will be projected in among Measures and Attributes).
Examples
Given the Data Set DS_1:
Input DS_1 (see structure)
Id_1 |
Id_2 |
Id_3 |
Me_1 |
Me_2 |
At_1 |
---|---|---|---|---|---|
2010 |
A |
XX |
20 |
36 |
E |
2010 |
A |
YY |
4 |
9 |
F |
2010 |
B |
XX |
9 |
10 |
F |
Example 1
DS_r := DS_1 [ keep Me_1 ];
results in (see structure):
Id_1 |
Id_2 |
Id_3 |
Me_1 |
---|---|---|---|
2010 |
A |
XX |
20 |
2010 |
A |
YY |
4 |
2010 |
B |
XX |
9 |