Wiki source code of 9 Structure Map

Version 2.1 by Helena on 2025/06/07 00:55

Hide last authors
Helena 1.1 1 === 9.1 Scope ===
2
3 A StructureMap allows mapping between Data Structures or Dataflows. It ultimately maps one DataStructureDefinition to another (source to target) although it can do this via the Dataflow or directly against the DataStructureDefinition.
4
5 The StructureMap defines how the //structure// of a source DataStructureDefinition relates to the //structure// of the target DataStructureDefinition. The term //structure //in this instance refers to the Dimensions and Attributes (collectively called Components). An example relationship is source REF_AREA Dimension maps to target COUNTRY Dimension. When converting data, systems should interpret this, as ‘data reported against REF_AREA in the source dataset, should be converted to data against COUNTRY in the target dataset’. StructureMaps can make use of the RepresentationMap to describe how the reported value map, if there is a mapping to be done on the value, for example source REF_AREA.US may map to COUNTRY.USA. In the case of mapping Dates, the EpochMap or DatePatternMap is used and maintained in the StructureMap that uses it.
6
7 ==== 9.1.1 Class Diagram – Relationship ====
8
9 [[image:1749246555607-988.jpeg]]
10
11 **Figure 37: Relationship Class diagram of the Structure Map**
12
13 ==== 9.1.2 Explanation of the Diagram ====
14
15 ===== 9.1.2.1 Narrative =====
16
17 The StructureMap is a //MaintainableArtefact//. The StructureMap can either map a source and target DataStructureDefinition or a source and target Dataflow, it cannot mix source and target types. The StructureMap contains zero or more ComponentMaps.
18
19 Each ComponentMap maps one or more //Component//s from the source DataStructureDefinition to one or more //Component//s in the target DataStructureDefinition[[^^~[1~]^^>>path:#_ftn1]]. In addition, the StructureMap contains zero or more FixedValueMaps. In this case, one or more //Component//s, from the source or target 1837 DataStructureDefinition, map to a fixed value.
20
21 The rules pertaining to how reported values map, are maintained in either a RepresentationMap, EpochMap, or DatePatternMap. A ComponentMap can only reference one of these mapping types to define how the reported values relate from source Dataset to the target Dataset. If a ComponentMap has more than 1 source or target, a RepresentationMap must be used to describe how the values map, as it is the only map which can define multiple source and target values in combination.
22
23 If the ComponentMap does not reference any map type to describe how the values map in a Dataset, then the values from the source Dataset are copied to the target Dataset verbatim, with no mapping rules being applied.
24
25 A RepresentationMap is a separate Maintainable structure. EpochMap and DatePatternMap are maintained in the same StructureMap and are referenced locally from the ComponentMap. EpochMap and DatePatternMap are maintained outside of the ComponentMap and can therefore be reused by multiple ComponentMaps.
26
27 ==== 9.1.3 Class Diagram – Epoch Mapping and Date Pattern Mapping ====
28
29 [[image:1749246555612-421.jpeg]]
30
31 **Figure 38: Relationship Class diagram of the EpochMap and DatePatternMap**
32
33 ===== 9.1.4 Explanation of the Diagram =====
34
35 ====== 9.1.4.1 Narrative ======
36
37 The EpochMap and DatePatternMap are both //IdentifiableArtefact//. An EpochMap and DatePatternMap both provide the ability to map source to target date formats. The EpochMap describes the source date as the number of epochs since a point in time, where the duration of each epoch is defined, e.g., number of milliseconds since 1970. The DatePatternMap describes the source date as a pattern for example MM-YYYY, accompanied by the appropriate locale.
38
39 Both mappings describe the target date as a frequency Identifier. The frequency identifier is given either a fixed value, e.g., ‘A’ or a reference to a Dimension or Attribute in the target DataStructureDefinition of the StructureMap, e.g. ‘FREQ’. In the latter case, the frequency id is derived at run time when the output series and observations are generated. Dates mapped using the frequency lookup can therefore be mapped using different frequencies depending on the series or observation being converted.
40
41 If the Frequency Identifier aligns with standard SDMX frequencies the output date format can be derived using standard SDMX date formatting (e.g., A=YYYY, Q=YYYY-Qn). If the SDMX standard formatting is not desired or if the frequency Id is not a standard SDMX frequency Code, the FrequencyFormatMapping can be used to describe the relationship between the frequency Id and the output date format, e.g., A01=YYYY.
42
43 ====== 9.1.4.2 Definitions ======
44
45 |**Class**|**Feature**|**Description**
46 |StructureMap|(((
47 Inherits from
48
49 //MaintainableArtefact//
50 )))|Links a source and target structure where there is a semantic equivalence between the source and the target structures.
51 | |+sourceStructure|Association to the source Data Structure.
52 | |+targetStructure|Association to the target Data Structure
53 | |+sourceStructureUsage|Association to the source Dataflow.
54 | |+targetStructureUsage|Association to the target Dataflow.
55 |ComponentMap|(((
56 Inherits from
57
58 //AnnotableArtefact//
59 )))|Links source and target Component(s) where there is a semantic equivalence between the source and the target Components.
60 | |+source|Association to zero or more source Components.
61 | |+target|Association to zero or more the target Components.
62 | |mappingRules|(((
63 Reference to either a
64
65 RepresentationMap, an
66
67 EpochMap or a DatePatternMap.
68 )))
69 |FixedValueMap|(((
70 Inherits from
71
72 //AnnotableArtefact//
73 )))|Links a Component (source or target) to a fixed value.
74 | |value|The value that a Component will be fixed in a fixed component map.
75 |//DateMap//|(((
76 Inherits from
77
78 //IdentifiableArtefact//
79 )))|
80 | |freqDimension|The Dimension or Attribute of the target Data Structure Definition which will hold the frequency information for date conversion. Mutually exclusive with targetFrequencyId.
81 | |yearStart|The date of the start of the year, enabling mapping from high frequency to lower frequency formats.
82 | |resolvePeriod|Which point in time to resolve to when mapping from low frequency to high frequency periods.
83 | |mappedFrequencies|A reference to a map of frequency id to date pattern for output.
84 |EpochMap|(((
85 Inherits from
86
87 //DateMap//
88 )))|
89 | |basePeriod|Epoch zero starts on this period.
90 | |targetFrequencyId|The frequency to convert the input date into. Mutually exclusive with freqDimension.
91 | |epochPeriod|Describes the period of time that each epoch represents.
92 |DatePatternMap|Inherits from //DateMap//|Described a source date based on a string pattern, and how it maps to the target date.
93 | |locale|The locale on which the input will be parsed according to the pattern.
94 |DateMapping| |
95 | |sourcePattern|Describes the source date using conventions for describing years, months, days, etc.
96 | |targetFrequencyId|The frequency to convert the input date into. Mutually exclusive with freqDimension.
97 |FrequencyFormatMap ping|(((
98 Inherits from
99
100 //IdentifiableArtefact//
101 )))|Describes the relationship between a frequency Id to the what the output date is formatted
102 | |frequencyId|The string used to describe the frequency
103 | |datePattern|The output date pattern for that frequency
104
105
106
107 ----
108
109 [[~[1~]>>path:#_ftnref1]] Source and target Data Structure Definition are either directly linked from the StructureMap or indirectly via the linked source and target Dataflow