Wiki source code of 10 Constraints

Version 1.10 by Helena on 2025/06/16 12:19

Hide last authors
Helena 1.1 1 {{box title="**Contents**"}}
2 {{toc/}}
3 {{/box}}
4
Helena 1.2 5 == 10.1 Introduction ==
Helena 1.1 6
7 Constraints are used as a way to restrict what data can be reported, or to report what data exists in a given context.  There are three types of Constraint, which serve different purposes
8
9 * Availability Constraint
10 * Dimension Constraint
11 * Reporting Constraints
12
13 An Availability Constraint defines the data that exists in the context of a data query.
14
15 They form part of the response message from the Availability REST API. Availability Constraints are dynamically generated by a system based on the data that exists and the query context.  Availability Constraints are therefore not Identifiable structures (they have no URN).
16
17 A Dimension Constraint is a property of a Dataflow, they are used to fix the Dimensions that they use in the Data Structure Definition which they use. Dimension Constraints enable Data Structure Definitions to evolve over time by having new Dimensions added, without having to undergo a major version change. 
18
19 A Reporting Constraint is used to define the set of allowed and/or disallowed values that can be reported in a data or metadata set.
20
Helena 1.2 21 == 10.2 Availability Constraint ==
Helena 1.1 22
23 An Availability Constraint is not a maintained structure, instead it is generated dynamically as a response to the availability REST API. The purpose of the Availability Constraint is to define the distinct set of values that have data over 1 or more Dimensions.  Unlike a Data and Metadata Constraint, which can attach to multiple Constrainable structures (of the same type), an Availability Constraint can only attach to only one structure.  The attachment defines the context of the response (data exists for components in the context of).  The subset of Constrainable structures the Availability Constraint can attach to are:
24
25 * Data Structure Definition
26 * Dataflow
27 * Provision Agreement
28
Helena 1.2 29 == 10.3 Dimension Constraint ==
30
Helena 1.1 31 A Dimension Constraint is a property of a Dataflow; its purpose is to explicitly list the Dimensions from the corresponding DSD that are being used by the Dataflow. 
32
Helena 1.2 33 Dimension Constraints were introduced in SDMX 3.1 and are not required for most Dataflows where the dataset must always contain the full complement of Dimensions as defined by the corresponding DSD. However, for some complex data collections, which may span long periods and where the full complement of required Dimensions are not necessarily known at design time, the DSD is subject to increasing its Dimensionality over time.  In this scenario it is possible to define the DSD as an evolving structure, this property tells the user that the DSD can have new Dimensions added without having to undergo a major version change; a DSD at version 1.0.0 for example would be able to add a new Dimension and move to version 1.1.0; a change that would not ordinarily be allowed.  A minor version change on the addition of a new Dimension is only possible if the DSD defines itself as an evolving structure.   This is a new property of the DSD introduced in version 3.1 to satisfy this use case.  The evolving structure  property is either true or false, defaulting to false if not specified.  Setting the evolving structure property to true requires a major version change, and therefore can only be introduced on an x.0.0 release (e.g. 1.0.0).  The evolving structure property can be set to false to indicate that there will be no additional Dimensions added to the Data Structure under the same major version number; setting the evolving structure property to false does not require require a major version change on the Data Structure.   
Helena 1.1 34
35 When a Dataflow references a DSD, late binding on the minor release, and the DSD has the evolving structure property set to true, then the Dataflow must contain a Dimension Constraint to protect its Dimensionality from changing over time without a version change. 
36
37 The Dimension Constraint provides the explicit list of Dimensions that the Dataflow uses from the DSD that it references.  This enables the DSD to evolve over time without breaking the compatibility of datasets against the Dataflow. 
38
Helena 1.2 39 __**Rules for a Dimension Constraint**__
Helena 1.1 40
41 * A Dataflow must contain a Dimension Constraint if the DSD which it uses states that it is an evolving structure and the Dataflow is late binding on the minor release (latest minor release of a given major version, e.g. 1.0+.0)
42 * The Dimension Constraint can only include Dimensions from the DSD that is referenced by the Dataflow.
43 * A Dimension Constraint can only be changed if the Dataflow undergoes a major version change
44 * Datasets reported against the Dataflow must only contain reported values for the Dimensions specified in the Dimension Constraint. 
45 * When exporting data for the Dataflow, the dataset should only include the Dimensions specified by the Dimension Constraint.
46 * When exporting data for the DSD the dataset must contain the full set of Dimensions as specified by the DSD. The tilde ‘~~’ character is used to represent a value which is not present due to the Dimension not being included in the corresponding Dataflow.
47
Helena 1.2 48 __**Example Datasets with Evolving Structures**__
Helena 1.1 49
Helena 1.2 50 A dataset is built against a Data Structure Definition.  The dataset contains data for two Dataflows.  Dataflows ‘DF_POP’ uses a Dimension Constraint which fixes its Dimensions to  FREQ and REF_AREA.  Dataflow ‘DF_POP_SA’ does not reference a Dimension Constraint, and as such includes all Dimensions as specified by the DSD.  
Helena 1.1 51
52 The resulting dataset contains values ‘~~’ for both the SEX and AGE Dimension for the series related to DF_POP.
53
Helena 1.2 54 (% style="width:758.294px" %)
55 |(% style="width:119px" %)**Dataflow**|(% colspan="7" style="width:635px" %)**FREQ REF_AREA SEX AGE OBS_VALUE TIME_PERIOD UNIT**
56 |(% style="width:119px" %)**DF_POP**|(% style="width:55px" %)A|(% style="width:103px" %)UK|(% style="width:79px" %)~~|(% style="width:92px" %)~~|(% style="width:93px" %)65|(% style="width:111px" %)2022|(% style="width:101px" %)6
57 |(% style="width:119px" %)**DF_POP**|(% style="width:55px" %)A|(% style="width:103px" %)FR|(% style="width:79px" %)~~|(% style="width:92px" %)~~|(% style="width:93px" %)50|(% style="width:111px" %)2022|(% style="width:101px" %)6
58 |(% style="width:119px" %)**DF_POP_SA**|(% style="width:55px" %)A|(% style="width:103px" %)UK|(% style="width:79px" %)M|(% style="width:92px" %)1|(% style="width:93px" %)1.2|(% style="width:111px" %)2022|(% style="width:101px" %)6
Helena 1.1 59
Helena 1.3 60 == 10.4 Reporting Constraints ==
Helena 1.1 61
62 A Reporting Constraint is a Maintainable Artefact which restricts the values that can be reported in a dataset or metadata set based on one or more inclusion or exclusion rules. 
63
64 A reporting constraint is one of the following concrete types:
65
66 * Data Constraint
67 * Metadata Constraint
68
Helena 1.3 69 === 10.4.1 Data Constraint ===
Helena 1.2 70
Helena 1.1 71 A Data Constraint is used to add additional restrictions to the allowable values reported in a dataset.  Data Constraints can be applied to the follow structures which are collectively known as Constrainable structures:
72
73 * Data Structure Definition
74 * Dataflow
75 * Provision Agreement
76 * Data Provider
77
78 **Note** regardless of the Constrainable structure, the restricted values relate to  the allowable content for the Component of the DSD to which the constrained object relates. 
79
Helena 1.3 80 === 10.4.2 Metadata Constraint ===
Helena 1.1 81
82 A Metadata Constraint is used to add additional restrictions to the allowable values reported in a metadataset.  Metadata Constraints can be applied to the follow structures which are collectively known as Constrainable structures:
83
84 * Metadata Structure Definition
85 * Metadataflow
86 * Metadata Provision Agreement
87 * Metadata Provider
88
89 **Note** regardless of the Constrainable structure,  the restricted values relate to  the allowable content for the Component of the MSD to which the constrained object relates. 
90
Helena 1.3 91 === 10.4.3 Scope of a Constraint ===
Helena 1.1 92
93 A Constraint is used specify the content of a data or metadata source in terms of the component values or the keys.
94
95 In terms of data the components are:
96
97 * Dimension
98 * Time Dimension
99 * Data Attribute
100 * Measure
101 * Metadata Attribute
102 * DataKeySets: the keys are the content of the KeyDescriptor – i.e., the series keys composed, for each key, by a value for each Dimension.
103
104 In terms of reference metadata the components are:
105
106 * Metadata Attribute
107
108 For a Constraint based on a DSD the Constraint can reference one or more of:
109
110 * Data Structure Definition
111 * Dataflow
112 * Provision Agreement
113 * Data Provider
114
115 For a Constraint based on an MSD the Constraint can reference one or more of:
116
117 * Metadata Structure Definition
118 * Metadataflow
119 * Metadata Provision Agreement
120 * Metadata Provider
121 * Metadata Set
122
123 Furthermore, there can be more than one Constraint specified for a specific object e.g., more than one Constraint for a specific DSD.
124
125 In view of the flexibility of constraints attachment, clear rules on their usage are required. These are elaborated below.
126
Helena 1.3 127 === 10.4.4 Multiple Constraints ===
Helena 1.1 128
129 There can be many Constraints for any Constrainable Artefact (e.g., DSD), subject to the following restrictions:
130
Helena 1.3 131 ==== 10.4.4.1 Cube Region ====
Helena 1.1 132
133 A Constraint can contain multiple Member Selections (e.g., Dimensions).
134
135 * A specific Member Selection (e.g., Dimension FREQ) can only be contained in one Cube Region for any one attached object (e.g., a specific DSD or specific Dataflow).
136 * Component values within a Member Selection may define a validity period. Otherwise, the value is valid for the whole validity of the Cube Region.
137 * For partial reference resolution purposes (as per the SDMX REST API), the latest non-draft Constraint must be considered.
138 * A Member Selection may include wildcarding of values (using character ‘%’ to represent zero or more occurrences of any character), as well as cascading through hierarchic structures (e.g., parents in Codelist), or localised values (e.g., text for English only). Lack of locale means any language may match. Cascading values are mutual exclusive to localised values, as the former refer to coded values, while the latter refer to uncoded values.
139 * Any values included in a Member Selection for Components with an array data type (i.e., Measures, Attributes or Metadata Attributes), will be applied as single values and will not be assessed combined with other values to match all possible array values. For example, including the Code ‘A’ for an Attribute will allow any instance of the Attribute that includes ‘A’, like [‘A’, ‘B’] or [‘A’, ‘C’, ‘D’]. Similarly, if Code ‘A’ was excluded, all those arrays of values would also be excluded.
140
Helena 1.2 141 ==== 10.4.4.2 Key Set ====
Helena 1.1 142
143 Key Sets will be processed in the order they appear in the Constraint and wildcards can be used (e.g., any key position not reference explicitly is deemed to be "all values").
144
145 As the Key Sets can be "included" or "excluded" it is recommended that Key Sets with wildcards are declared before KeySets with specific series keys. This will minimize the risk that keys are inadvertently included or excluded.
146
147 In addition, Attribute, Measure and Metadata Attribute constraints may accompany KeySets, in order to specify the allowed values per Key. Those are expressed following the rules for Cube Regions, as explained above.
148
149 Finally, a validity period may be specified per Key.
150
Helena 1.2 151 === 10.4.4 Versioning ===
Helena 1.1 152
153 When Data and Metadata Constraints are versioned, the latest version of the Constraint is used to generate the reporting restriction rules; all previous versions are for historical information only.
154
155 If restrictions are applicable to certain periods in time, the validFrom and validTo properties can be set on the specific values. This allows Constraints to evolve over time, increasing their version number as they do so, whilst being able to maintain a complete set of reporting restrictions for current and past datasets.
156
157 Example:
158
159 Data Constraint 1.0.0
160
Helena 1.4 161 (% style="width:573.294px" %)
162 |(% style="width:108px" %)Component|(% style="width:127px" %)Valid Value|(% style="width:150px" %)Valid from|(% style="width:185px" %)Valid to
163 |(% rowspan="3" style="width:108px" %)COUNTRY|(% style="width:127px" %)UK|(% style="width:150px" %) |(% style="width:185px" %)
164 |(% style="width:127px" %)FR|(% style="width:150px" %) |(% style="width:185px" %)
165 |(% style="width:127px" %)DE|(% style="width:150px" %) |(% style="width:185px" %)
Helena 1.1 166
167 Data Constraint 1.1.0
168
Helena 1.4 169 (% style="width:576.294px" %)
170 |(% style="width:110px" %)Component|(% style="width:129px" %)Valid Value|(% style="width:145px" %)Valid from|(% style="width:189px" %)Valid to
171 |(% rowspan="3" style="width:110px" %)COUNTRY|(% style="width:129px" %)UK|(% style="width:145px" %) |(% style="width:189px" %)
172 |(% style="width:129px" %)FR|(% style="width:145px" %) |(% style="width:189px" %)2012
173 |(% style="width:129px" %)DE|(% style="width:145px" %) |(% style="width:189px" %)
Helena 1.1 174
175 When both versions of the Data Constraint are in a system, an observation value reported against COUNTRY FR for time period 2013 would be deemed invalid as the 1.1.0 rule would be applied.
176
Helena 1.2 177 === 10.4.6 Inheritance ===
Helena 1.1 178
Helena 1.2 179 ==== 10.4.6.1 Attachment levels of a Constraint ====
Helena 1.1 180
181 There are three levels of constraint attachment for which these inheritance rules apply:
182
Helena 1.4 183 * DSD/MSD – top level
184 ** Dataflow/Metadataflow – second level
185 *** Provision Agreement – third level
Helena 1.1 186
187 It is not necessary for a Constraint to be attached to a higher level artefact. e.g., it is valid to have a Constraint for a Provision Agreement where there are no constraints attached the relevant Dataflow or DSD.
188
Helena 1.2 189 ==== 10.4.6.2 Cascade rules for processing Constraints ====
Helena 1.1 190
191 The processing of the constraints on either Dataflow/Metadataflow or Provision Agreement must take into account the constraints declared at higher levels. The rules for the lower-level constraints (attached to Dataflow/ Metadataflow and Provision Agreement) are detailed below.
192
193 Note that there can be a situation where a constraint is specified at a lower level before a constraint is specified at a higher level. Therefore, it is possible that a higher-level constraint makes a lower-level constraint invalid. SDMX makes no rules on how such a conflict should be handled when processing the constraint for attachment. However, the cascade rules on evaluating constraints for usage are clear – the higher-level constraint takes precedence in any conflicts that result in a less restrictive specification at the lower level.
194
Helena 1.2 195 ==== 10.4.6.3 Cube Region ====
Helena 1.1 196
197 It is not necessary to have a Constraint on the higher-level artefact (e.g., DSD referenced by the Dataflow), but if there is such a Constraint at the higher level(s) then:
198
199 * The lower-level Constraint cannot be less restrictive than the Constraint specified for the same Member Selection (e.g. Dimension) at the next higher level, which constrains that Member Selection. For example, if the Dimension FREQ is constrained to A, Q in a DSD, then the Constraint at the Dataflow or Provision Agreement cannot be A, Q, M or even just M – it can only further constrain A, Q.
200 * The Constraint at the lower level for any one Member Selection further constrains the content for the same Member Selection at the higher level(s).
201 * Any Member Selection, which is not referenced in a Constraint, is deemed to be constrained according to the Constraint specified at the next higher level which constraints that Member Selection.
202 * If there is a conflict when resolving the Constraint in terms of a lower-level Constraint being less restrictive than a higher-level Constraint, then the Constraint at the higher-level is used.
203
204 Note that it is possible for a Constraint at a higher level to constrain, say, four Dimensions in a single Constraint, and a Constraint at a lower level to constrain the same four in two, three, or four Constraints.
205
Helena 1.2 206 ==== 10.4.6.4 Key Set ====
Helena 1.1 207
208 It is not necessary to have a Constraint on the higher-level artefact (e.g., DSD referenced by the Dataflow), but if there is such a Constraint at the higher level(s) then:
209
210 * The lower-level Constraint cannot be less restrictive than the Constraint specified at the higher level.
211 * The Constraint at the lower level for any one Member Selection further constrains the keys specified at the higher level(s).
212 * Any Member Selection, which is not referenced in a Constraint, is deemed to be constrained according to the Constraint specified at the next higher level which constraints that Member Selection.
213 * If there is a conflict when resolving the keys in the Constraint at two levels, in terms of a lower-level constraint being less restrictive than a higher-level Constraint, then the offending keys specified at the lower level are not deemed part of the Constraint.
214
215 Note that a Key in a Key Set can have wildcarded Components. For instance, the Constraint may simply constrain the Dimension FREQ to "A", and all keys where the FREQ="A" are therefore valid.
216
217 The following logic explains how the inheritance mechanism works. Note that this is conceptual logic and actual systems may differ in the way this is implemented.
218
Helena 1.5 219 1. Determine all possible keys that are valid at the higher level.
220 1. These keys are deemed to be inherited by the lower-level constrained object, subject to the Constraints specified at the lower level.
221 1. Determine all possible keys that are possible using the Constraints specified at the lower level.
222 1. At the lower level inherit all keys that match with the higher-level Constraint.
223 1. If there are keys in the lower-level Constraint that are not inherited then the key is invalid (i.e., it is less restrictive).
Helena 1.1 224
Helena 1.5 225 === 10.4.7 Constraints Examples ===
226
Helena 1.2 227 ==== 10.4.7.1 Data Constraint and Cascading ====
Helena 1.1 228
Helena 1.2 229 The following scenario is used.
230
Helena 1.1 231 A DSD contains the following Dimensions:
232
233 * GEO – Geography
234 * SEX – Sex
235 * AGE – Age
236 * CAS – Current Activity Status
237
238 In the DSD, common code lists are used and the requirement is to restrict these at various levels to specify the actual code that are valid for the object to which the Constraint is attached.
239
Helena 1.6 240 [[image:1750065279010-260.png]]
Helena 1.1 241
242 **Figure 20: Example Scenario for Constraints **Constraints are declared as follows:
243
Helena 1.6 244 [[image:1750065319060-899.png]]
Helena 1.1 245
246 **Figure 21: Example Constraints**
247
248 Notes:
249
250 AGE is constrained for the DSD and is further restricted for the Dataflow CENSUS_CUBE1.
251
252 * The same Constraint applies to both Provision Agreements.
253
254 The cascade rules elaborated above result as follows:
255
256 DSD
257
258 * Constrained by eliminating code 001 from the code list for the AGE Dimension.
259
260 Dataflow CENSUS_CUBE1
261
262 * Constrained by restricting the code list for the AGE Dimension to codes 002 and 003 (note that this is a more restrictive constraint than that declared for the DSD which specifies all codes except code 001).
263 ** Restricts the CAS codes to 003 and 004.
264
265 Dataflow CENSUS_CUBE2
266
267 * Restricts the code list for the CAS Dimension to codes TOT and NAP.
268 ** Inherits the AGE constraint applied at the level of the DSD.
269
270 Provision Agreement CENSUS_CUBE1_IT
271
272 * Restricts the codes for the GEO Dimension to IT and its children.
273 ** Inherits the constraints from Dataflow CENSUS_CUBE1 for the AGE and CAS Dimensions.
274
275 Provision Agreement CENSUS_CUBE2_IT
276
277 * Restricts the codes for the GEO Dimension to IT and its children.
278 ** Inherits the constraints from Dataflow CENSUS_CUBE2 for the CAS Dimension.
279 ** Inherits the AGE constraint applied at the level of the DSD.
280
281 The Constraints are defined as follows:
282
283 DSD Constraint
284
Helena 1.8 285 [[image:1750065367824-357.png]]
Helena 1.7 286
Helena 1.1 287 Dataflow Constraints
288
Helena 1.8 289 [[image:1750065392163-400.png]]
Helena 1.7 290
Helena 1.1 291 Provision Agreement Constraint
292
Helena 1.8 293 [[image:1750065461589-995.png]]
Helena 1.7 294
Helena 1.1 295 **10.4.7.2 Combination of Constraints**
296
297 The possible combination of constraining terms are explained in this section, following a few examples.
298
299 Let’s assume a DSD with the following Components:
300
Helena 1.10 301 (% style="width:459.294px" %)
302 |(% style="width:204px" %)(% style="color:#3498db" %)Dimension|(% style="width:252px" %)(% style="color:#3498db" %)FREQ
303 |(% style="width:204px" %)(% style="color:#3498db" %)Dimension|(% style="width:252px" %)(% style="color:#3498db" %)JD_TYPE
304 |(% style="width:204px" %)(% style="color:#3498db" %)Dimension|(% style="width:252px" %)(% style="color:#3498db" %)JD_CATEGORY
305 |(% style="width:204px" %)(% style="color:#3498db" %)Dimension|(% style="width:252px" %)(% style="color:#3498db" %)VIS_CTY
306 |(% style="width:204px" %)(% style="color:#2980b9" %)TimeDimension|(% style="width:252px" %)(% style="color:#2980b9" %)TIME_PERIOD
307 |(% style="width:204px" %)(% style="color:#16a085" %)Attribute|(% style="width:252px" %)(% style="color:#16a085" %)OBS_STATUS
308 |(% style="width:204px" %)(% style="color:#16a085" %)Attribute|(% style="width:252px" %)(% style="color:#16a085" %)UNIT
309 |(% style="width:204px" %)(% style="color:#16a085" %)Attribute|(% style="width:252px" %)(% style="color:#16a085" %)COMMENT
310 |(% style="width:204px" %)(% style="color:#f39c12" %)MetadataAttribute|(% style="width:252px" %)(% style="color:#f39c12" %)CONTACT
311 |(% style="width:204px" %)(% style="color:#e74c3c" %)Measure|(% style="width:252px" %)(% style="color:#e74c3c" %)MULTISELECT
312 |(% style="width:204px" %)(% style="color:#e74c3c" %)Measure|(% style="width:252px" %)(% style="color:#e74c3c" %)CHOICE
Helena 1.1 313
314 On the above, let’s assume the following use cases with their constraining requirements:
315
316 **Use Case 1: A Constraint on allowed values for some Dimensions**
317
318 R1: Allow monthly and quarterly data
319
320 R2: Allow Mexico for vis-à-vis country
321
322 This is expressed with the following CubeRegion:
323
324 |FREQ|M, Q
325 |VIS_CTY|MX
326
327 **Use Case 2: A Constraint on allowed combinations for some Dimensions**
328
329 R1: Allow monthly data for Germany
330
331 R2: Allow quarterly data for Mexico
332
333 This is expressed with the following DataKeySet:
334
335 |Key1|FREQ|M
336 | |VIS_CTY|DE
337 |(% rowspan="2" %)Key2|FREQ|Q
338 |VIS_CTY|MX
339
340 **Use Case 3: A Constraint on allowed values for some Dimensions combined with allowed values for some Attributes** R1: Allow monthly and quarterly data
341
342 R2: Allow Mexico for vis-à-vis country
343
344 R3: Allow present for status
345
346 This may be expressed with the following CubeRegion:
347
348 |FREQ|M, Q
349 |VIS_CTY|MX
350 |OBS_STATUS|A
351
352 **Use Case 4: A Constraint on allowed combinations for some Dimensions combined with specific Attribute values**
353
354 R1: Allow monthly data, for Germany, with unit euro
355
356 R2: Allow quarterly data, for Mexico, with unit usd
357
358 This may be expressed with the following DataKeySet:
359
360 |(% rowspan="3" %)Key1|FREQ|M
361 |VIS_CTY|DE
362 |UNIT|EUR
363 |(% rowspan="3" %)Key2|FREQ|Q
364 |VIS_CTY|MX
365 |UNIT|USD
366
367 **Use Case 5: A Constraint on allowed values for some Dimensions together with some combination of Dimension values**
368
369 R1: For annually and quarterly data, for Mexico and Germany, only A status is allowed
370
371 R2: For monthly data, for Mexico and Germany, only F status is allowed
372
373 Considering the above examples, the following CubeRegions would be created:
374
375 |(% rowspan="3" %)CubeRegion1|FREQ|Q, A
376 |VIS_CTY|MX, DE
377 |OBS_STATUS|A
378 |(% rowspan="3" %)CubeRegion2|FREQ|M
379 |VIS_CTY|MX, DE
380 |OBS_STATUS|F
381
382 The problem with this approach is that according to the business rule for Constraints, only one should be specified per Component. Thus, if a software would perform some conflict resolution would end up with empty sets for FREQ and OBS_STATUS (as they do not share any values).
383
384 Nevertheless, there is a much easier approach to that; this is the cascading mechanism of Constraints (as shown in 10.4.7.1). Hence, these rules would be expressed into two levels of Constraints, e.g., DSD and Dataflows:
385
386 DSD CubeRegion:
387
388 |FREQ|M, Q, A
389 |VIS_CTY|MX, DE
390 |OBS_STATUS|A, F
391
392 Dataflow1 CubeRegion:
393
394 |FREQ|Q, A
395 |VIS_CTY|MX, DE
396 |OBS_STATUS|F
397
398 Dataflow2 CubeRegion:
399
400 |FREQ|M
401 |VIS_CTY|MX, DE
402 |OBS_STATUS|A
403
404 **Use case 6: A Constraint on allowed values for some Dimensions combined with allowed values for Measures**
405
406 R1: Allow monthly data, for Germany, with unit euro, and measure choice is  'A' R2: Allow quarterly data, for Mexico, with unit usd, and measure choice is  'B'
407
408 This may be expressed with the following DataKeySet:
409
410 |(% rowspan="4" %)Key1|FREQ|M
411 |VIS_CTY|DE
412 |UNIT|EUR
413 |CHOICE|A
414 |(% rowspan="4" %)Key2|FREQ|Q
415 |VIS_CTY|MX
416 |UNIT|USD
417 |CHOICE|B
418
419 **Use Case 7: A Constraint with wildcards for Codes and removePrefix property** For this example, we assume that the VIS_CTY representation has been prefixed with prefix ‘AREA_’. In this Constraint, we need to remove the prefix.
420
421 R1: Allow monthly and quarterly data
422
423 R2: Allow vis-à-vis countries that start with M
424
425 R3: Remove the prefix ‘AREA_’
426
427 This may be expressed with the following CubeRegion:
428
429 |FREQ|M, Q
430 |VIS_CTY (removePrefix=’AREA_’)|M%
431
432 **Use Case 8: A Constraint with multilingual support on Attributes**
433
434 R1: Allow monthly and quarterly data
435
436 R2: Allow Mexico for vis-à-vis country
437
438 R3: Allow a comment, in English, which includes the term adjusted for status
439
440 This may be expressed with the following CubeRegion:
441
442 |FREQ|M, Q
443 |VIS_CTY|MX
444 |COMMENT (lang=’en’)|%adjusted%
445
446 **Use Case 9: A Constraint on allowed values for Dimensions combined with allowed** values for Metadata Attributes R1: Allow monthly and quarterly data
447
448 R2: Allow Mexico for vis-à-vis country
449
450 R3: Allow John Doe for contact
451
452 This may be expressed with the following CubeRegion:
453
454 |FREQ|M, Q
455 |VIS_CTY|MX
456 |CONTACT|John Doe