Wiki source code of 13 Structure Mapping

Version 7.1 by Helena on 2025/05/15 15:48

Hide last authors
Helena 2.1 1 = 13 Structure Mapping =
2
3 == 13.1 Introduction ==
4
5 The purpose of SDMX structure mapping is to transform datasets from one dimensionality to another. In practice, this means that the input and output datasets conform to different Data Structure Definition.
6
7 Structure mapping does not alter the observation values and is not intended to perform any aggregations or calculations.
8
9 An input series maps to:
10
11 1. Exactly one output series; or
12 1. Multiple output series with different Series Keys, but the same observation values; or
13 1. Zero output series where no source rule matches the input Component values.
14
15 Typical use cases include:
16
17 * Transforming received data into a common internal structure;
18 * Transforming reported data into the data collector's preferred structure;
19 * Transforming unidimensional datasets^^[[^^43^^>>path:#sdfootnote43sym||name="sdfootnote43anc"]]^^ to multi-dimensional; and
20 * Transforming internal datasets with a complex structure to a simpler structure with fewer dimensions suitable for dissemination.
21
22 == 13.2 1-1 structure maps ==
23
24 1-1 (pronounced 'one to one') mappings support the simple use case where the value of a Component in the source structure is translated to a different value in the target, usually where different classification schemes are used for the same Concept.
25
26 In the example below, ISO 2-character country codes are mapped to their ISO 3character equivalent.
27
28 |Country|Alpha-2 code|Alpha-3 code
29 |Afghanistan|AF|AFG
30 |Albania|AL|ALB
31 |Algeria|DZ|DZA
32 |American Samoa|AS|ASM
33 |Andorra|AD|AND
34 |etc…||
35
36 Different source values can also map to the same target value, for example when deriving regions from country codes.
37
38 [[image:SDMX 3-0-0 SECTION 6 FINAL-1.0_en_59eee18f.gif||alt="Shape7" height="1" width="192"]]
39
40 |Source Component: REF_AREA|Target Component: REGION
41 |FR|EUR
42 |DE|EUR
43 |IT|EUR
44 |ES|EUR
45 |BE|EUR
46
47 == 13.3 N-n structure maps ==
48
49 N-n (pronounced 'N to N') mappings describe rules where a specified combination of values in multiple source Components map to specified values in one or more target Components. For example, when mapping a partial Series Key from a highly multidimensional cube (like Balance of Payments) to a single 'Indicator' Dimension in a target Data Structure.
50
51 Example:
52
53 |Rule|Source|Target
54 |1|(((
55 If
56
57 FREQUENCY=A; and ADJUSTMENT=N; and MATURITY=L.
58 )))|(((
59 Set
60
61 INDICATOR=A_N_L
62 )))
63 |2|(((
64 If
65
66 FREQUENCY=M; and ADJUSTMENT=S_A1; and MATURITY=TY12.
67 )))|(((
68 Set
69
70 INDICATOR=MON_SAX_12
71 )))
72
73 N-n rules can also set values for multiple source Components.
74
75 |Rule|Source|Target
76 |1|(((
77 If
78
79 FREQUENCY=A; and ADJUSTMENT=N; and MATURITY=L.
80 )))|(((
81 Set
82
83 INDICATOR=A_N_L, STATUS=QXR15,
84
85 NOTE="Unadjusted".
86 )))
87 |2|(((
88 If
89
90 FREQUENCY=M; and ADJUSTMENT=S_A1; and MATURITY=TY12.
91 )))|(((
92 Set
93
94 INDICATOR=MON_SAX_12,
95
96 STATUS=MPM12,
97
98 NOTE="Seasonally Adjusted"
99 )))
100
101 == 13.4 Ambiguous mapping rules ==
102
103 A structure map is ambiguous if the rules result in a dataset containing multiple series with the same Series Key.
104
105 A simple example mapping a source dataset with a single dimension to one with multiple dimensions is shown below:
106
107 |Source|Target|Output Series Key
108 |SERIES_CODE=XMAN_Z_21|(((
109 Dimensions
110
111 INDICATOR=XM
112
113 FREQ=A
114
115 ADJUSTMENT=N
116
117 Attributes
118
119 UNIT_MEASURE=_Z
120
121 COMP_ORG=21
122 )))|XM:A:N
123 |SERIES_CODE=XMAN_Z_34|(((
124 Dimensions
125
126 INDICATOR=XM
127
128 FREQ=A
129
130 ADJUSTMENT=N
131
132 Attributes
133
134 UNIT_MEASURE=_Z
135
136 COMP_ORG=34
137 )))|XM:A:N
138
139 The above behaviour can be okay if the series XMAN_Z_21 contains observations for different periods of time then the series XMAN_Z_34. If however both series contain observations for the same point in time, the output for this mapping will be two observations with the same series key, for the same period in time.
140
141 == 13.5 Representation maps ==
142
143 Representation Maps replace the SDMX 2.1 Codelist Maps and are used describe explicit mappings between source and target Component values.
144
145 The source and target of a Representation Map can reference any of the following:
146
147 1. Codelist
148 1. Free Text (restricted by type, e.g String, Integer, Boolean)
149 1. Valuelist
150
151 A Representation Map mapping ISO 2-character to ISO 3-character Codelists would take the following form:
152
153 |CL_ISO_ALPHA2|CL_ISO_ALPHA3
154 |AF|AFG
155 |AL|ALB
156 |DZ|DZA
157 |AS|ASM
158 |AD|AND
159 |etc…|
160
161 A Representation Map mapping free text country names to an ISO 2-character Codelist could be similarly described:
162
163 |Text|CL_ISO_ALPHA2
164 |"Germany"|DE
165 |"France"|FR
166 |"United Kingdom"|GB
167 |"Great Britain"|GB
168 |"Ireland"|IE
169 |"Eire"|IE
170 |etc…|
171
172 Valuelists, introduced in SDMX 3.0, are equivalent to Codelists but allow the maintenance of non-SDMX identifiers. Importantly, their IDs do not need to conform to IDType, but as a consequence are not Identifiable.
173
174 When used in Representation Maps, Valuelists allow Non-SDMX identifiers containing characters like £, $, % to be mapped to Code IDs, or Codes mapped to non-SDMX identifiers.
175
176 In common with Codelists, each item in a Valuelist has a multilingual name giving it a human-readable label and an optional description. For example:
177
178 |Value|Locale|Name
179 |$|en|United States Dollar
180 |%|En|Percentage
181 ||fr|Pourcentage
182
183 Other characteristics of Representation Maps:
184
185 * Support the mapping of multiple source Component values to multiple Target Component values as described in section 13.3 on n-to-n mappings; this covers also the case of mapping an Attribute with an array representation to map combinations of values to a single target value;
186 * Allow source or target mappings for an Item to be optional allowing rules such as 'A maps to nothing' or 'nothing maps to A'; and
187 * Support for mapping rules where regular expressions or substrings are used to match source Component values. Refer to section 13.6 for more on this topic.
188
189 == 13.6 Regular expression and substring rules ==
190
191 It is common for classifications to contain meanings within the identifier, for example the code Id 'XULADS' may refer to a particular seasonality because it starts with the letters XU.
192
193 With SDMX 2.1 each code that starts with XU had to be individually mapped to the same seasonality, and additional mappings added when new Codes were added to the Codelists. This led to many hundreds or thousands of mappings which can be more efficiently summarised in a single conceptual rule:
194
195 //If starts with 'XU' map to 'Y'//
196
197 These rules are described using either regular expressions, or substrings for simpler use cases.
198
199 === 13.6.1 Regular expressions ===
200
201 Regular expression mapping rules are defined in the Representation Map.
202
203 Below is an example set of regular expression rules for a particular component.
204
205 |Regex|Description|Output
206 |A|Rule match if input = 'A'|OUT_A
207 |^[A-G]|Rule match if the input starts with letters A to G|OUT_B
208 |A~|B|Rule match if input is either 'A' or 'B'|OUT_C
209
210 Like all mapping rules, the output is either a Code, a Value or free text depending on the representation of the Component in the target Data Structure Definition.
211
212 If the regular expression contains capture groups, these can be used in the definition of the output value, by specifying \//**n** //as an output value where //**n**// is the number of the capture group starting from 1. For example
213
214 |Regex|Target output|Example Input|Example Output
215 |(((
216 ([0-9]{4})[0-
217
218 9]([0-9]{1})
219 )))|\1-Q\2|200933|2009-Q3
220
221 As regular expression rules can be used as a general catch-all if nothing else matches, the ordering of the rules is important. Rules should be tested starting with the highest priority, moving down the list until a match is found.
222
223 The following example shows this:
224
225 |Priority|Regex|Description|Output
226 |1|A|Rule match if input = 'A'|OUT_A
227 |2|B|Rule match if input = 'B'|OUT_B
228 |3|[A-Z]|Any character A-Z|OUT_C
229
230 The input 'A' matches both the first and the last rule, but the first takes precedence having the higher priority. The output is OUT_A.
231
232 The input 'G' matches on the last rule which is used as a catch-all or default in this example.
233
234 === 13.6.2 Substrings ===
235
236 Substrings provide an alternative to regular expressions where the required section of an input value can be described using the number of the starting character, and the length of the substring in characters. The first character is at position 1.
237
238 For instance:
239
240 |Input String|Start|Length|Output
241 |ABC_DEF_XYZ|5|3|DEF
242 |XULADS|1|2|XU
243
244 Sub-strings can therefore be used for the conceptual rule //If starts with 'XU' map to Y// as shown in the following example:
245
246 |Start|Length|Source|Target
247 |1|2|XU|Y
248
249 == 13.7 Mapping non-SDMX time formats to SDMX formats ==
250
251 Structure mapping allows non-SDMX compliant time values in source datasets to be mapped to an SDMX compliant time format.
252
253 Two types of time input are defined:
254
255 a. **Pattern based dates** – a string which can be described using a notation like dd/mm/yyyy or is represented as the number of periods since a point in time, for example: 2010M001 (first month in 2010), or 2014D123 (123^^rd^^ day in 2014); and b. **Numerical based datetime** – a number specifying the elapsed periods since a fixed point in time, for example Unix Time is measured by the number of milliseconds since 1970.
256
257 The output of a time-based mapping is derived from the output Frequency, which is either explicitly stated in the mapping or defined as the value output by a specific Dimension or Attribute in the output mapping. If the output frequency is unknown or if the SDMX format is not desired, then additional rules can be provided to specify the output date format for the given frequency Id. The default rules are:
258
259 |Frequency|Format|Example
260 |A|YYYY|2010
261 |D|YYYY-MM-DD|2010-01-01
262 |I|YYYY-MM-DDThh:mm:ss|2010-01T20:22:00
263 |M|YYYY-MM|2010-01
264 |Q|YYYY-Qn|2010-Q1
265 |S|YYYY-Sn|2010-S1
266 |T|YYYY-Tn|2010-T1
267 |W|YYYY-Wn|YYYY-W53
268
269 In the case where the input frequency is lower than the output frequency, the mapping defaults to end of period, but can be explicitly set to start, end or mid-period.
270
271 There are two important points to note:
272
273 1. The output frequency determines the output date format, but the default output can be redefined using a Frequency Format mapping to force explicit rules on how the output time period is formatted.
274 1. To support the use case of changing frequency the structure map can optionally provide a start of year attribute, which defines the year start date in MM-DD format. For example: YearStart=04-01.
275
276 === 13.7.1 Pattern based dates ===
277
278 Date and time formats are specified by date and time pattern strings based on Java's Simple Date Format. Within date and time pattern strings, unquoted letters from 'A' to 'Z' and from 'a' to 'z' are interpreted as pattern letters representing the components of a date or time string. Text can be quoted using single quotes (') to avoid interpretation. "''" represents a single quote. All other characters are not interpreted; they're simply copied into the output string during formatting or matched against the input string during parsing.
279
280 Due to the fact that dates may differ per locale, an optional property, defining the locale of the pattern, is provided. This would assist processing of source dates, according to the given locale^^[[^^44^^>>path:#sdfootnote44sym||name="sdfootnote44anc"]]^^. An indicative list of examples is presented in the following table:
281
282 |English (en)|Australia (AU)|en-AU
283 |English (en)|Canada (CA)|en-CA
284 |English (en)|United Kingdom (GB)|en-GB
285 |English (en)|United States (US)|en-US
286 |Estonian (et)|Estonia (EE)|et-EE
287 |Finnish (fi)|Finland (FI)|fi-FI
288 |French (fr)|Belgium (BE)|fr-BE
289 |French (fr)|Canada (CA)|fr-CA
290 |French (fr)|France (FR)|fr-FR
291 |French (fr)|Luxembourg (LU)|fr-LU
292 |French (fr)|Switzerland (CH)|fr-CH
293 |German (de)|Austria (AT)|de-AT
294 |German (de)|Germany (DE)|de-DE
295
296 [[image:SDMX 3-0-0 SECTION 6 FINAL-1.0_en_59eee18f.gif||alt="Shape8" height="1" width="192"]]
297
298 |German (de)|Luxembourg (LU)|de-LU
299 |German (de)|Switzerland (CH)|de-CH
300 |Greek (el)|Cyprus (CY)|el-CY[[__(*)__>>url:https://www.oracle.com/java/technologies/javase/jdk8-jre8-suported-locales.html#cldrlocale]][[url:https://www.oracle.com/java/technologies/javase/jdk8-jre8-suported-locales.html#cldrlocale]]
301 |Greek (el)|Greece (GR)|el-GR
302 |Hebrew (iw)|Israel (IL)|iw-IL
303 |Hindi (hi)|India (IN)|hi-IN
304 |Hungarian (hu)|Hungary (HU)|hu-HU
305 |Icelandic (is)|Iceland (IS)|is-IS
306 |Indonesian (in)|Indonesia (ID)|in-ID[[__(*)__>>url:https://www.oracle.com/java/technologies/javase/jdk8-jre8-suported-locales.html#cldrlocale]][[url:https://www.oracle.com/java/technologies/javase/jdk8-jre8-suported-locales.html#cldrlocale]]
307 |Irish (ga)|Ireland (IE)|ga-IE[[__(*)__>>url:https://www.oracle.com/java/technologies/javase/jdk8-jre8-suported-locales.html#cldrlocale]][[url:https://www.oracle.com/java/technologies/javase/jdk8-jre8-suported-locales.html#cldrlocale]]
308 |Italian (it)|Italy (IT)|it-IT
309
310 Examples
311
312 22/06/1981 would be described as dd/MM/YYYY, with locale en-GB
313
314 2008-mars-12 would be described as YYYY-MMM-DD, with locale fr-FR
315
316 22 July 1981 would be described as dd MMMM YYYY, with locale en-US
317
318 22 Jul 1981 would be described as dd MMM YYYY
319
320 2010 D62 would be described as YYYYDnn (day 62 of the year 2010)
321
322 The following pattern letters are defined (all other characters from 'A' to 'Z' and from 'a' to 'z' are reserved):
323
324 |Letter|Date or Time Component|Presentation|Examples
325 |G|Era designator|[[Text>>url:https://docs.oracle.com/javase/7/docs/api/java/text/SimpleDateFormat.html#text]][[url:https://docs.oracle.com/javase/7/docs/api/java/text/SimpleDateFormat.html#text]]|AD
326 |yy|Year short (upper case is Year of Week^^[[^^45^^>>path:#sdfootnote45sym||name="sdfootnote45anc"]]^^)|[[Year>>url:https://docs.oracle.com/javase/7/docs/api/java/text/SimpleDateFormat.html#year]][[url:https://docs.oracle.com/javase/7/docs/api/java/text/SimpleDateFormat.html#year]]|96
327 |yyyy|Year Full (upper case is Year of Week)|Year|1996
328 |MM|Month number in year starting with 1|Month|07
329 |MMM|Month name short|Month|Jul
330 |MMMM|Month name full|Month|July
331 |ww|Week in year|[[Number>>url:https://docs.oracle.com/javase/7/docs/api/java/text/SimpleDateFormat.html#number]][[url:https://docs.oracle.com/javase/7/docs/api/java/text/SimpleDateFormat.html#number]]|27
332 |W|Week in month|[[Number>>url:https://docs.oracle.com/javase/7/docs/api/java/text/SimpleDateFormat.html#number]][[url:https://docs.oracle.com/javase/7/docs/api/java/text/SimpleDateFormat.html#number]]|2
333 |DD|Day in year|[[Number>>url:https://docs.oracle.com/javase/7/docs/api/java/text/SimpleDateFormat.html#number]][[url:https://docs.oracle.com/javase/7/docs/api/java/text/SimpleDateFormat.html#number]]|189
334 |dd|Day in month|[[Number>>url:https://docs.oracle.com/javase/7/docs/api/java/text/SimpleDateFormat.html#number]][[url:https://docs.oracle.com/javase/7/docs/api/java/text/SimpleDateFormat.html#number]]|10
335 |F|Day of week in month|[[Number>>url:https://docs.oracle.com/javase/7/docs/api/java/text/SimpleDateFormat.html#number]][[url:https://docs.oracle.com/javase/7/docs/api/java/text/SimpleDateFormat.html#number]]|2
336 |E|Day name in week|[[Text>>url:https://docs.oracle.com/javase/7/docs/api/java/text/SimpleDateFormat.html#text]][[url:https://docs.oracle.com/javase/7/docs/api/java/text/SimpleDateFormat.html#text]]|Tuesday; Tue
337
338 [[image:SDMX 3-0-0 SECTION 6 FINAL-1.0_en_59eee18f.gif||alt="Shape9" height="1" width="192"]]
339
340 |U|Day number of week (1 = Monday, ..., 7 = Sunday)|[[Number>>url:https://docs.oracle.com/javase/7/docs/api/java/text/SimpleDateFormat.html#number]][[url:https://docs.oracle.com/javase/7/docs/api/java/text/SimpleDateFormat.html#number]]|1
341 |HH|Hour in day (0-23)|[[Number>>url:https://docs.oracle.com/javase/7/docs/api/java/text/SimpleDateFormat.html#number]][[url:https://docs.oracle.com/javase/7/docs/api/java/text/SimpleDateFormat.html#number]]|0
342 |kk|Hour in day (1-24)|[[Number>>url:https://docs.oracle.com/javase/7/docs/api/java/text/SimpleDateFormat.html#number]][[url:https://docs.oracle.com/javase/7/docs/api/java/text/SimpleDateFormat.html#number]]|24
343 |KK|Hour in am/pm (0-11)|[[Number>>url:https://docs.oracle.com/javase/7/docs/api/java/text/SimpleDateFormat.html#number]][[url:https://docs.oracle.com/javase/7/docs/api/java/text/SimpleDateFormat.html#number]]|0
344 |hh|Hour in am/pm (1-12)|[[Number>>url:https://docs.oracle.com/javase/7/docs/api/java/text/SimpleDateFormat.html#number]][[url:https://docs.oracle.com/javase/7/docs/api/java/text/SimpleDateFormat.html#number]]|12
345 |mm|Minute in hour|[[Number>>url:https://docs.oracle.com/javase/7/docs/api/java/text/SimpleDateFormat.html#number]][[url:https://docs.oracle.com/javase/7/docs/api/java/text/SimpleDateFormat.html#number]]|30
346 |ss|Second in minute|[[Number>>url:https://docs.oracle.com/javase/7/docs/api/java/text/SimpleDateFormat.html#number]][[url:https://docs.oracle.com/javase/7/docs/api/java/text/SimpleDateFormat.html#number]]|55
347 |S|Millisecond|[[Number>>url:https://docs.oracle.com/javase/7/docs/api/java/text/SimpleDateFormat.html#number]][[url:https://docs.oracle.com/javase/7/docs/api/java/text/SimpleDateFormat.html#number]]|978
348 |n|Number of periods, used after a SDMX Frequency Identifier such as M, Q, D (month, quarter, day)|[[Number>>url:https://docs.oracle.com/javase/7/docs/api/java/text/SimpleDateFormat.html#number]][[url:https://docs.oracle.com/javase/7/docs/api/java/text/SimpleDateFormat.html#number]]|12
349
350 The model is illustrated below:
351
352 [[image:SDMX 3-0-0 SECTION 6 FINAL-1.0_en_295af259.jpg||height="265" width="477"]]
353
354 ==== Figure 24 showing the component map mapping the SOURCE_DATE Dimension to the TIME_PERIOD dimension with the additional information on the component map to describe the time format ====
355
356 [[image:SDMX 3-0-0 SECTION 6 FINAL-1.0_en_a3215c79.jpg||height="265" width="480"]]
357
358 ==== Figure 25 showing an input date format, whose output frequency is derived from the output value of the FREQ Dimension ====
359
360 === 13.7.2 Numerical based datetime ===
361
362 Where the source datetime input is purely numerical, the mapping rules are defined by the **Base** as a valid SDMX Time Period, and the **Period** which must take one of the following enumerated values:
363
364 * day
365 * second
366 * millisecond
367 * microsecond
368 * nanosecond
369
370 |Numerical datetime systems|Base|Period
371 |(((
372 Epoch Time (UNIX)
373
374 Milliseconds since 01 Jan 1970
375 )))|1970|millisecond
376 |(((
377 Windows System Time
378
379 Milliseconds since 01 Jan 1601
380 )))|1601|millisecond
381
382 The example above illustrates numerical based datetime mapping rules for two commonly used time standards.
383
384 The model is illustrated below:
385
386 [[image:SDMX 3-0-0 SECTION 6 FINAL-1.0_en_ab51b44a.jpg||height="113" width="485"]]
387
388 **Figure 26 showing the component map mapping the SOURCE_DATE Dimension to the**
389
390 ==== TIME_PERIOD Dimension with the additional information on the component map to describe the numerical datetime system in use ====
391
392 === 13.7.3 Mapping more complex time inputs ===
393
394 VTL should be used for more complex time inputs that cannot be interpreted using the pattern based on numerical methods.
395
396 == 13.8 Using TIME_PERIOD in mapping rules ==
397
398 The source TIME_PERIOD Dimension can be used in conjunction with other input Dimensions to create discrete mapping rules where the output is conditional on the time period value.
399
400 The main use case is setting the value of Observation Attributes in the target dataset.
401
402 |Rule|Source|Target
403 |1|(((
404 If
405
406 INDICATOR=XULADS; and TIME_PERIOD=2007.
407 )))|(((
408 Set
409
410 OBS_CONF=F
411 )))
412 |2|(((
413 If
414
415 INDICATOR=XULADS; and TIME_PERIOD=2008.
416 )))|(((
417 Set
418
419 OBS_CONF=F
420 )))
421 |3|(((
422 If
423
424 INDICATOR=XULADS; and TIME_PERIOD=2009.
425 )))|(((
426 Set
427
428 OBS_CONF=F
429 )))
430 |4|(((
431 If
432
433 INDICATOR=XULADS; and TIME_PERIOD=2010.
434 )))|(((
435 Set
436
437 OBS_CONF=**C**
438 )))
439
440 In the example above, OBS_CONF is an Observation Attribute.
441
442 == 13.9 Time span mapping rules using validity periods ==
443
444 Creating discrete mapping rules for each TIME_PERIOD is impractical where rules need to cover a specific span of time regardless of frequency, and for high-frequency data.
445
446 Instead, an optional validity period can be set for each mapping.
447
448 By specifying validity periods, the example from Section 13.8 can be re-written using two rules as follows:
449
450 |Rule|Source|Target
451 |1|(((
452 If
453
454 INDICATOR=XULADS.
455
456 Validity Period start period=2007 end period=2009
457 )))|(((
458 Set
459
460 OBS_CONF=F
461 )))
462 |2|(((
463 If
464
465 INDICATOR=XULADS.
466
467 Validity Period start period=2010
468 )))|(((
469 Set
470
471 OBS_CONF=F** **
472 )))
473
474 In Rule 1, start period resolves to the start of the 2007 period (2007-01-01T00:00:00), and the end period resolves to the very end of 2009 (2009-12-31T23:59:59). The rule will hold true regardless of the input data frequency. Any observations reporting data for the Indicator XULADS that fall into that time range will have an OBS_CONF value of F.
475
476 In Rule 2, no end period is specified so remains in effect from the start of the period (2010-01-01T00:00:00) until the end of time. Any observations reporting data for the Indicator XULADS that fall into that time range will have an OBS_CONF value of C.
477
478 == 13.10 Mapping examples ==
479
480 === 13.10.1 Many to one mapping (N-1) ===
481
482 |Source|Map To
483 |(((
484 **FREQ**="A"
485
486 ADJUSTMENT="N"
487
488 **REF_AREA**="PL"
489
490 **COUNTERPART_AREA**="W0"
491
492 REF_SECTOR="S1"
493
494 COUNTERPART_SECTOR="S1" ACCOUNTING_ENTRY="B"
495
496 STO="B5G"
497 )))|(((
498 FREQ="A"
499
500 REF_AREA="PL"
501
502 COUNTERPART_AREA="W0"
503
504 INDICATOR="IND_ABC"
505 )))
506
507 The bold Dimensions map from source to target verbatim. The mapping simply specifies:
508
509 FREQ => FREQ
510
511 REF_AREA=> REF_AREA
512
513 COUNTERPART_AREA=> COUNTERPART _AREA
514
515 No Representation Mapping is required. The source value simply copies across unmodified.
516
517 The remaining Dimensions all map to the Indicator Dimension. This is an example of many Dimensions mapping to one Dimension. In this case a Representation Mapping is required, and the mapping first describes the input 'partial key' and how this maps to the target indicator:
518
519 N:S1:S1:B:B5G => IND_ABC
520
521 Where the key sequence is based on the order specified in the mapping (i.e ADJUSTMENT, REF_SECTOR, etc will result in the first value N being taken from ADJUSTMENT as this was the first item in the source Dimension list.
522
523 **Note**: The key order is NOT based on the Dimension order of the DSD, as the mapping needs to be resilient to the DSD changing.
524
525 === 13.10.2 Mapping other data types to Code Id ===
526
527 In the case where the incoming data type is not a string and not a code identifier i.e. the source Dimension is of type Integer and the target is Codelist. This is supported by the RepresentationMap. The RepresentationMap source can reference a Codelist, Valuelist, or be free text, the free text can include regular expressions.
528
529 The following representation mapping can be used to explicitly map each age to an output code.
530
531 :
532
533 (((
534 |Source Input Free Text|Desired Output Code Id
535 |0|A
536 |1|A
537 |2|A
538 |3|B
539 |4|B
540 )))
541
542 If this mapping takes advantage of regular expressions it can be expressed in two 3464 rules:
543
544 [[image:SDMX 3-0-0 SECTION 6 FINAL-1.0_en_8c1afe2b.gif||alt="Shape10" height="1" width="302"]]
545
546 __Regular Expression __Desired Output
547
548 :
549
550 (((
551 |[0-2]|A
552 |[3-4]|B
553 )))
554
555 === 13.10.3 Observation Attributes for Time Period ===
556
557 This use case is where a specific observation for a specific time period has an attribute 3468 value.
558
559 :
560
561 (((
562 |Input INDICATOR|Input TIME_PERIOD|Output OBS_CONF
563 |XULADS|2008|C
564 |XULADS|2009|C
565 |XULADS|2010|C
566 )))
567
568 __Or using a validity period on the Representation Mapping__:
569
570 [[image:SDMX 3-0-0 SECTION 6 FINAL-1.0_en_6dbf7f.gif||alt="Shape11" height="36" width="555"]] Input INDICATOR Valid From/ Valid To Output OBS_CONF
571
572 XULADS 2008/2010 C
573
574 === 13.10.4 Time mapping ===
575
576 This use case is to create a time period from an input that does not respect SDMXTime Formats.
577
578 The Component Mapping from SYS_TIME to TIME_PERIOD specifies itself as a time mapping with the following details:
579
580 :
581
582 (((
583 |Source Value|Source Mapping|Target Frequency|Output
584 |18/07/1981|dd/MM/yyyy|A|1981
585 )))
586
587 When the target frequency is based on another target Dimension value, in this example __the value of the FREQ Dimension in the tar__get DSD.
588
589 [[image:SDMX 3-0-0 SECTION 6 FINAL-1.0_en_dbe68698.gif||alt="Shape12" height="1" width="273"]]
590
591 :
592 ::
593
594 (((
595 |Source Value|Source Mapping|Target Frequency Output Dimension
596
597 |18/07/1981 dd/MM/yyyy|FREQ||1981-07-18 (when FREQ=D)
598 |(% rowspan="2" %)(((
599 __When the source is a numerical form__at
600
601 Source Value Start Period Interv
602 )))|||
603 |al|(((
604 Target
605
606 FREQ
607 )))|Output
608 |(% colspan="2" %)1589808220 1970 millisecond|M|2020-05
609 )))
610
611 When the source frequency is lower than the target frequency additional information 3485 can be provided for resolve to start of period, end of period, or mid period, as shown 3486 in the following example:
612
613 Source Value Source Mapping Target Frequency Output
614
615 Dimension
616
617 [[image:SDMX 3-0-0 SECTION 6 FINAL-1.0_en_4ec4bb31.gif||alt="Shape13" height="173" width="555"]] 1981 yyyy D – End of Period 1981-12-31
618
619 When the start of year is April 1^^st^^ the Structure Map has YearStart=04-01:
620
621 Source Value Source Mapping Target Frequency Output
622
623 Dimension
624
625 1981 yyyy D – End of Period 1982-03-31