← setdiff operator page · set/setdiff/two/manual_ex_2

Manual example 2 🟢 all ok

pandas ✅ · DuckDB ✅

Tests:

setdiff ( DS_3, DS_4 ) on data sets with three identifiers, where DS_4 holds two of the three data points of DS_3.

Manual:

Set difference, Example 2, output verbatim: the resulting Dataset contains "all the data points Data Point dp1 of the operand ds1, such that there is no Data Point dp2 of ds2 having the same values for homonym Identifier Components".

Expected:

the page's one data point, (R, T, 2011) with the measure 12.

script.vtl ⇩

DS_r := setdiff ( DS_3, DS_4 );

input/DS_3.csv ⇩

Id_1Id_2Id_3Me_1
RM20117
RF201110
RT201112

input/DS_3.json ⇩

{
  "datasets": [
    {
      "name": "DS_3",
      "DataStructure": [
        {"name": "Id_1", "type": "String", "role": "Identifier", "nullable": false},
        {"name": "Id_2", "type": "String", "role": "Identifier", "nullable": false},
        {"name": "Id_3", "type": "String", "role": "Identifier", "nullable": false},
        {"name": "Me_1", "type": "Integer", "role": "Measure", "nullable": true}
      ]
    }
  ]
}

input/DS_4.csv ⇩

Id_1Id_2Id_3Me_1
RM20117
RF201110

input/DS_4.json ⇩

{
  "datasets": [
    {
      "name": "DS_4",
      "DataStructure": [
        {"name": "Id_1", "type": "String", "role": "Identifier", "nullable": false},
        {"name": "Id_2", "type": "String", "role": "Identifier", "nullable": false},
        {"name": "Id_3", "type": "String", "role": "Identifier", "nullable": false},
        {"name": "Me_1", "type": "Integer", "role": "Measure", "nullable": true}
      ]
    }
  ]
}

expected/DS_r.csv ⇩

Id_1Id_2Id_3Me_1
RT201112

expected/DS_r.json ⇩

{
  "datasets": [
    {
      "name": "DS_r",
      "DataStructure": [
        {"name": "Id_1", "type": "String", "role": "Identifier"},
        {"name": "Id_2", "type": "String", "role": "Identifier"},
        {"name": "Id_3", "type": "String", "role": "Identifier"},
        {"name": "Me_1", "type": "Integer", "role": "Measure"}
      ]
    }
  ]
}