Changes for page 13 Structure Mapping

Last modified by Artur on 2025/09/10 11:19

From version 4.7
edited by Helena
on 2025/06/16 14:45
Change comment: There is no comment for this version
To version 4.5
edited by Helena
on 2025/06/16 14:41
Change comment: There is no comment for this version

Summary

Details

Page properties
Content
... ... @@ -189,37 +189,36 @@
189 189  
190 190  These rules are described using either regular expressions, or substrings for simpler use cases.
191 191  
192 -=== 13.6.1 Regular expressions ===
192 +=== 13.5.1 Regular expressions ===
193 193  
194 -Regular expression mapping rules are defined in the [[Representation>>doc:sdmx:Glossary.Representation.WebHome]] Map.
194 +Regular expression mapping rules are defined in the Representation Map.
195 195  
196 -Below is an example set of regular expression rules for a particular [[component>>doc:sdmx:Glossary.Component.WebHome]].
196 +Below is an example set of regular expression rules for a particular component.
197 197  
198 -(% style="width:664.294px" %)
199 -|(% style="width:141px" %)**Regex**|(% style="width:362px" %)**Description**|(% style="width:158px" %)**Output**
200 -|(% style="width:141px" %)A|(% style="width:362px" %)Rule match if input = 'A'|(% style="width:158px" %)OUT_A
201 -|(% style="width:141px" %)^[A-G]|(% style="width:362px" %)Rule match if the input starts with letters A to G|(% style="width:158px" %)OUT_B
202 -|(% style="width:141px" %)A~|B|(% style="width:362px" %)Rule match if input is either 'A' or 'B'|(% style="width:158px" %)OUT_C
198 +|Regex|Description|Output
199 +|A|Rule match if input = 'A'|OUT_A
200 +|^[A-G]|Rule match if the input starts with letters A to G|OUT_B
201 +|A~|B|Rule match if input is either 'A' or 'B'|OUT_C
203 203  
204 -Like all mapping rules, the output is either a [[Code>>doc:sdmx:Glossary.Code.WebHome]], a Value or free text depending on the [[representation>>doc:sdmx:Glossary.Representation.WebHome]] of the [[Component>>doc:sdmx:Glossary.Component.WebHome]] in the target [[Data Structure Definition>>doc:sdmx:Glossary.Data structure definition.WebHome]].
203 +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.
205 205  
206 206  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
207 207  
208 -(% style="width:700.294px" %)
209 -|(% style="width:203px" %)Regex|(% style="width:148px" %)Target output|(% style="width:157px" %)Example Input|(% style="width:189px" %)Example Output
210 -|(% style="width:203px" %)(((
211 -([0-9]{4})[0-9]([0-9]{1})
212 -)))|(% style="width:148px" %)\1-Q\2|(% style="width:157px" %)200933|(% style="width:189px" %)2009-Q3
207 +|Regex|Target output|Example Input|Example Output
208 +|(((
209 +([0-9]{4})[0-
213 213  
211 +9]([0-9]{1})
212 +)))|\1-Q\2|200933|2009-Q3
213 +
214 214  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.
215 215  
216 216  The following example shows this:
217 217  
218 -(% style="width:704.294px" %)
219 -|(% style="width:130px" %)Priority|(% style="width:125px" %)Regex|(% style="width:241px" %)Description|(% style="width:205px" %)Output
220 -|(% style="width:130px" %)1|(% style="width:125px" %)A|(% style="width:241px" %)Rule match if input = 'A'|(% style="width:205px" %)OUT_A
221 -|(% style="width:130px" %)2|(% style="width:125px" %)B|(% style="width:241px" %)Rule match if input = 'B'|(% style="width:205px" %)OUT_B
222 -|(% style="width:130px" %)3|(% style="width:125px" %)[A-Z]|(% style="width:241px" %)Any character A-Z|(% style="width:205px" %)OUT_C
218 +|Priority|Regex|Description|Output
219 +|1|A|Rule match if input = 'A'|OUT_A
220 +|2|B|Rule match if input = 'B'|OUT_B
221 +|3|[A-Z]|Any character A-Z|OUT_C
223 223  
224 224  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.
225 225  
... ... @@ -231,16 +231,14 @@
231 231  
232 232  For instance:
233 233  
234 -(% style="width:623.294px" %)
235 -|(% style="width:169px" %)Input String|(% style="width:147px" %)Start|(% style="width:133px" %)Length|(% style="width:171px" %)Output
236 -|(% style="width:169px" %)ABC_DEF_XYZ|(% style="width:147px" %)5|(% style="width:133px" %)3|(% style="width:171px" %)DEF
237 -|(% style="width:169px" %)XULADS|(% style="width:147px" %)1|(% style="width:133px" %)2|(% style="width:171px" %)XU
233 +|Input String|Start|Length|Output
234 +|ABC_DEF_XYZ|5|3|DEF
235 +|XULADS|1|2|XU
238 238  
239 239  Sub-strings can therefore be used for the conceptual rule //If starts with 'XU' map to Y// as shown in the following example:
240 240  
241 -(% style="width:628.294px" %)
242 -|(% style="width:163px" %)Start|(% style="width:158px" %)Length|(% style="width:128px" %)Source|(% style="width:176px" %)Target
243 -|(% style="width:163px" %)1|(% style="width:158px" %)2|(% style="width:128px" %)XU|(% style="width:176px" %)Y
239 +|Start|Length|Source|Target
240 +|1|2|XU|Y
244 244  
245 245  == 13.6 Mapping non-SDMX time formats to SDMX formats ==
246 246