← membership operator page · general/membership/identifier/manual_ex_5

Manual example 5 🟢 all ok

pandas ✅ · DuckDB ✅

Tests:

DS_2#Id_1 on a dataset whose At_1 is viral: the new measure, and At_1 kept.

Manual:

Membership, Example 5, output verbatim: "viral Attributes of ds are maintained in the result as viral". The manual's ds_2.json names its dataset DS_1, a slip: the example loads it as DS_2, the name that the page and the script give it.

Expected:

Id_1, Id_2, the measure int_var with the values of Id_1, and the viral At_1.

Team decision:

#1257: as the comments on sdmx-twg/vtl#731 propose, a viral Attribute needs a propagation rule only where its values are combined, until the VTL Task Force discusses it.

script.vtl ⇩

DS_r := DS_2#Id_1;

input/DS_2.csv ⇩

Id_1Id_2Me_1Me_2At_1
1A15
1B210P
2A312

input/DS_2.json ⇩

{
  "datasets": [
    {
      "name": "DS_2",
      "DataStructure": [
        {"name": "Id_1", "type": "Integer", "role": "Identifier", "nullable": false},
        {"name": "Id_2", "type": "String", "role": "Identifier", "nullable": false},
        {"name": "Me_1", "type": "Integer", "role": "Measure", "nullable": true},
        {"name": "Me_2", "type": "Integer", "role": "Measure", "nullable": true},
        {"name": "At_1", "type": "String", "role": "ViralAttribute", "nullable": true}
      ]
    }
  ]
}

expected/DS_r.csv ⇩

Id_1Id_2int_varAt_1
1A1
1B1P
2A2

expected/DS_r.json ⇩

{
  "datasets": [
    {
      "name": "DS_r",
      "DataStructure": [
        {"name": "Id_1", "type": "Integer", "role": "Identifier"},
        {"name": "Id_2", "type": "String", "role": "Identifier"},
        {"name": "int_var", "type": "Integer", "role": "Measure"},
        {"name": "At_1", "type": "String", "role": "ViralAttribute"}
      ]
    }
  ]
}