Intersection: interesect
Syntax
intersect ( dsList )
dsList ::= ds { , ds }*
Input parameters
dsList |
the list of Data Sets in the intersection |
Examples of valid syntaxes
intersect (ds2, ds3)
Semantics for scalar operations
This operator cannot be applied to scalar values.
Input parameters type
ds
dataset
Result type
result
dataset
Additional Constraints
All the Data Sets in dsList have the same Identifier, Measure and Attribute Components.
Behavior
The intersect operator implements the intersection of functions (i.e., Data Sets). The resulting Data Set has the same Identifier, Measure and Attribute Components of the operand Data Sets specified in the dsList, and contains the Data Points belonging to all the operand Data Sets.
The operand Data Sets can contain Data Points having the same values of the Identifiers. To avoid duplications of Data Points in the resulting Data Set, those Data Points are filtered by choosing the Data Point belonging to the leftmost operand Data Set. For instance, let’s assume that in intersect ( ds1, ds2 ) the operand ds1 contains a Data Point dp1 and the operand ds2 contains a Data Point dp2, such that dp1 has the same Identifiers values of dp2, then the resulting Data Set contains dp1 only.
The operator has the typical behaviour of the “Behaviour of the Set operators” (see the section “Typical behaviours of the ML Operators”).
The automatic Attribute propagation is not applied.
Examples
Given the operand datasets DS_1 and DS_2:
Input DS_1 (see structure)
Id_1 |
Id_2 |
Id_3 |
Id_4 |
Me_1 |
---|---|---|---|---|
2012 |
B |
Total |
Total |
1 |
2012 |
G |
Total |
Total |
2 |
2012 |
F |
Total |
Total |
3 |
Input DS_2 (see structure)
Id_1 |
Id_2 |
Id_3 |
Id_4 |
Me_1 |
---|---|---|---|---|
2011 |
B |
Total |
Total |
10 |
2012 |
G |
Total |
Total |
2 |
2012 |
M |
Total |
Total |
40 |
Example 1
DS_r := intersect(DS_1, DS_2);
results in (see structure):
Id_1 |
Id_2 |
Id_3 |
Id_4 |
Me_1 |
---|---|---|---|---|
2012 |
G |
Total |
Total |
2 |