Wiki source code of 12 Constraints

Version 6.1 by Helena on 2025/05/15 09:59

Hide last authors
Helena 2.1 1 = 12 Constraints =
2
3 == 12.1 Scope ==
4
5 The scope of this section is to describe the support in the metamodel for specifying both the access to and the content of a data source. The information may be stored in a resource such as a registry for use by applications wishing to locate data and metadata which are available via the Internet. The //Constraint// is also used to specify a subset of a Codelist which may be used as a partial Codelist, relevant in the context of the artefact to which the //Constraint// is attached e.g., DataStructureDefinition, Dataflow, ProvisionAgreement, MetadataStructureDefinition, Metadataflow, MetadataProvisionAgreement.
6
7 Note that in this metamodel the term data source refers to both data and metadata sources, and data provider refers to both data and metadata providers.
8
9 A data source may be a simple file of data or metadata (in SDMX-ML, JSON or other format), or a database or metadata repository. A data source may contain data for many data or metadata flows (called Dataflow, and Metadataflow in the model), and the mechanisms described in this section allow an organisation to specify precisely the scope of the content of the data source where this data source is registered (SimpleDataSource, //QueryDataSource//).
10
11 The Dataflow and Metadataflow, themselves may be specified as containing only a subset of all the possible keys that could be derived from a DataStructureDefinition or MetadataStructureDefinition. Respectively, further subsets may be defined within a ProvisionAgreement and MetadataProvisionAgreement.
12
13 These specifications are called //Constraint// in this model.
14
15 == 12.2 Inheritance ==
16
17 === 12.2.1 Class Diagram of Constrainable Artefacts - Inheritance ===
18
19 [[image:SDMX 3-0-0 SECTION 2 FINAL-1.0 (1)_en_e601fbfd.jpg||height="230" width="622"]]
20
21 **Figure 41: Inheritance class diagram of constrainable and provisioning artefacts**
22
23 === 12.2.2 Explanation of the Diagram ===
24
25 ==== 12.2.2.1 Narrative ====
26
27 Any artefact that inherits from the //ConstrainableArtefact// interface can have constraints defined. The artefacts that can have constraint metadata attached are:
28
29 Dataflow
30
31 ProvisionAgreement
32
33 DataProvider – this is restricted to release calendar
34
35 DataStructureDefinition
36
37 Metadataflow
38
39 MetaDataProvider – this is restricted to release calendar
40
41 MetadataProvisionAgreement
42
43 MetadataSetMetadataStructureDefinition
44
45 SimpleDataSource – this is a registered data source where the registration references the actual Data Set or Metadata Set
46
47 //QueryDataSource//
48
49 Note that, because the //Constraint// can specify a subset of the component values implied by a specific //Structure// (such as a specific DataStructureDefinition or specific MetadataStructureDefinition), the //ConstrainableArtefact//s must be associated with a specific //Structure//. Therefore, whilst the //Constraint// itself may not be linked directly to a DataStructureDefinition or MetadataStructureDefinition, the artefact that it is constraining will be linked to a DataStructureDefinition or MetadataStructureDefinition. As a DataProvider or a MetadataProvider does not link to any one specific DSD or MSD the type of information that can be contained in a Constraint linked to a DataProvider/MetadataProvider is restricted to ReleaseCalendar.
50
51 == 12.3 Constraints ==
52
53 === 12.3.1 Relationship Class Diagram – high level view ===
54
55 [[image:SDMX 3-0-0 SECTION 2 FINAL-1.0 (1)_en_24db726f.jpg||height="332" width="610"]]
56
57 **Figure 42: Relationship class diagram showing constraint metadata**
58
59 === 12.3.2 Explanation of the Diagram ===
60
61 ==== 12.3.2.1 Narrative ====
62
63 The constraint mechanism allows specific constraints to be attached to a //ConstrainableArtefact//. With the exception of ReleaseCalendar these constraints specify a subset of the total set of values or keys that may be present in any of the //ConstrainableArtefacts//.
64
65 For instance, a DataStructureDefinition specifies, for each Dimension, the list of allowable code values. However, a specific Dataflow that uses the
66
67 DataStructureDefinition may contain only a subset of the possible range of keys that is theoretically possible from the DataStructureDefinition definition (the total range of possibilities is sometimes called the Cartesian product of the dimension values). In addition to this, a DataProvider that is capable of supplying data according to the Dataflow has a ProvisionAgreement, and the DataProvider may also wish to supply constraint information which may further constrain the range of possibilities in order to describe the data that the provider can supply. It may also be useful to describe the content of a data source in terms of the KeySets or CubeRegions contained within it.
68
69 A //ConstrainableArtefact// can have two types of //Constraint//s:
70
71 1. DataConstraint – is used as a mechanism to specify, either the available set of keys (DataKeySet), or set of component values (CubeRegion) in a //DataSource// such as a Simpledatasource or a database (//QueryDatasource//), or the allowable keys that can be constructed from a DataStructureDefinition. Multiple such DataConstraints may be present for a //ConstrainableArtefact//. For instance, there may be a DataConstraint that specifies the values allowed for the //ConstrainableArtefact //(role is allowableContent) which can be used for validation or for constructing a partial code list for one Dimension, while another provides the validation for another Dimension within the same DSD.
72 1. MetadataConstraint – is used as a mechanism to specify a set of component values (MetadatTargetRegion) in a //DataSource// such as a MetadataSet or a database (//QueryDatasource//). Multiple such MetadataConstraints may be present for a //ConstrainableArtefact//. For instance, there may be a MetadataConstraint that specifies the values allowed for the //ConstrainableArtefact //(role is allowableContent) which can be used for validation or for constructing a partial code list, whilst another MetadataConstraint can specify the actual content of a metadata source (role is actualContent).
73
74 In addition to DataKeySet and/or CubeRegion/MetadataTargetRegion a Constraint can have a ReleaseCalendar specifying when data or metadata are released for publication or reporting.
75
76 Note also that another possible type of a DataConstraint is available; that is a
77
78 DataConstraint with the role of actualContent where it describes the data that an SDMX Web Service contains. This type of DataConstraint is not maintained in a Registry and is always a response to the data availability SDMX REST API. Thus, its identification is autogenerated by the service responding to a data availability request.
79
80 === 12.3.3 Relationship Class Diagram – Detail ===
81
82 [[image:SDMX 3-0-0 SECTION 2 FINAL-1.0 (1)_en_d166f6ab.jpg||height="708" width="619"]]
83
84 **Figure 43: Constraints – Key Set, Cube Region and Metadata Target Region**
85
86 ==== 12.3.3.1 Explanation of the Diagram ====
87
88 A //Constraint// is a //MaintainableArtefact//.
89
90 A DataConstraint has a choice of two ways of specifying value subsets:
91
92 1. As a set of keys that can be present in the //DataSet// (DataKeySet). Each DataKey specifies a number of ComponentValues each of which reference a //Component// (e.g., Dimension, DataAttribute). Each ComponentValue is a value that may be present for a //Component// of a structure when contained in a //DataSet//. In addition, each DataKeySet may also include MemberSelections for AttributeComponents or Measures.
93 1. As a set of CubeRegions each of which defines a “slice” of the total structure (MemberSelection) in terms of one or more MemberValues that may be present for a //Component// of a structure when contained in a //DataSet//.
94
95 The difference between (1) and (2) above is that in (1) a complete key is defined whereas in (2) above the “slice” defines a list of possible values for each of the// Component//s but does not specify specific key combinations. In addition, in (1) the association between //Component// and DataKeyValue is constrained to the components that comprise the key, whereas in (2) it can contain other component types (such as AttributeComponents or Measures). By adding MemberSelections to the DataKeySets of (1), AttributeComponents and Measures are constrained for the related DataKeys.
96
97 A MetadataConstraint has only one way of specifying value subsets:
98
99 ~1. As a set of MetadataTargetRegions each of which defines a “slice” of the total structure (MemberSelection) in terms of one or more MemberValues that may be present for a //Component// of a structure when contained in a MetadataSet.
100
101 In both CubeRegion and MetadataTargetRegion, the value in ComponentValue.value and MemberValue.value must be consistent with the //Representation// declared for the //Component// in the DataStructureDefinition (Dimension or DataAttribute) or MetadataStructureDefinition (MetadataAttribute). Note that in all cases the "operator" on the value is deemed to be "equals", unless the wildcard character is used '%'. In the latter case the "operation" is a partial matching, where the percentage character ('%') may match zero or more characters. Furthermore, it is possible in a MemberValue to specify that child values (e.g., child codes) are included in the Constraint by means of the cascadeValues attribute. The latter may take the following values:
102
103 * "true": all children are included,
104 * "false" (default), or
105 * "[[image:SDMX 3-0-0 SECTION 2 FINAL-1.0 (1)_en_7f83d17f.gif||alt="Shape31" height="55" width="97"]] excludeRoot", where all children are included, and the root Code is excluded (i.e. the referenced Code).
106
107 It is possible to define for the DataKeySet, DataKey, CubeRegion, MetadataTargetRegion and MemberSelection whether the set is included (isIncluded = "true", default) or excluded (isIncluded = "false") from the Constraint definition. This attribute is useful if, for example, only a small sub-set of the possible values are not included in the set, then this smaller sub-set can be defined and excluded from the constraint. Note that if the child construct is “included” and the parent construct is “excluded” then the child construct is included in the list of constructs that are “excluded”.
108
109 In any MemberSelection that the corresponding //Component// was using Codelist with extensions, it is possible to remove the prefix that has been used, in order to refer to the original Codes. This is achieved via property removePrefix, which defaults to “false”.
110
111 In DataKeys and MemberValues it is possible, via the validFrom and validTo properties, to set a validity period for which the selected key or value is constrained.
112
113 ==== 12.3.3.2 Definitions ====
114
115 |**Class**|**Feature**|**Description**
116 |//ConstrainableArt efact//|(((
117 Abstract Class Sub classes are:
118
119 Dataflow
120
121 DataProvider
122
123 DataStructureDefinition
124
125 Metadataflow
126
127 MetadataProvisionAgreem
128
129 ent
130
131 MetadataSet
132
133 MetadataStructureDefini tion
134
135 ProvisionAgreement
136
137 //QueryDatasource//
138
139 SimpleDatasource
140 )))|An artefact that can have Constraints specified.
141 ||content|Associates the metadata that constrains the content to be found in a data or metadata source linked to the Constrainable Artefact.
142 |//Constraint//|(((
143 Inherits from
144
145 //MaintainableArtefact//
146
147 Abstract class Sub classes are:
148
149 DataConstraint
150
151 MetadataConstraint
152 )))|Specifies a subset of the definition of the allowable or actual content of a data or metadata source that can be derived from the Structure that defines code lists and other valid content.
153 ||+dataContentKeys|(((
154 Association to a subset of Data
155
156 Key Sets (i.e., value combinations) that can be derived from the definition of the structure to which the Constrainable Artefact is linked.
157 )))
158 ||+dataContentRegion|(((
159 Association to a subset of component values that can be derived from the Data Structure
160
161 Definition to which the Constrainable Artefact is linked.
162 )))
163 ||+metadataContentRegion|Association to a subset of component values that can be derived from the Metadata Structure Definition to which the Constrainable Artefact is linked.
164 ||role|Association to the role that the Constraint plays
165 |DataConstraint|(((
166 Inherits from
167
168 //Constraint//
169 )))|Defines a Constraint in terms of the content that can be found in data sources linked to the Constrainable Artefact to which this constraint is associated.
170 |ConstraintRoleTy pe||Specifies the way the type of content of a Constraint in terms of its purpose.
171 ||allowableContent|The Constraint contains a specification of the valid subset of the Component values or keys.
172 ||actualContent|The Constraint contains a specification of the actual content of a data or metadata source in terms of the Component values or keys in the source.
173 |MetadataConstrai nt|(((
174 Inherits from
175
176 //Constraint//
177 )))|Defines a Constraint in terms of the content that can be found in metadata sources linked to the Constrainable Artefact to which this constraint is associated.
178 |DataKeySet||A set of data keys.
179 ||isIncluded|Indicates whether the Data Key Set is included in the constraint definition or excluded from the constraint definition.
180 ||+keys|Association to the Data Keys in the set.
181 ||+member|Association to the selection of a value subset for Attributes and Measures.
182 |DataKey||The values of a key in a data set.
183 ||isIncluded|Indicates whether the Data Key is included in the constraint definition or excluded from the constraint definition.
184 ||+keyValue|(((
185 Associates the Component
186
187 Values that comprise the key.
188 )))
189 ||validFrom|Date from which the Data Key is valid.
190 ||validTo|Date from which the Data Key is superseded.
191 |ComponentValue||The identification and value of a Component of the key (e.g., Dimension)
192 ||value|The value of Component
193 ||+valueFor|Association to the Component (e.g., Dimension) in the Structure to which the Constrainable Artefact is linked.
194 |TimeDimensionVal ue||The value of the Time Dimension component.
195 ||timeValue|The value of the time period.
196 ||operator|(((
197 Indicates whether the specified value represents and exact time or time period, or whether the value should be handled as a range.
198
199 A value of greaterThan or greaterThanOrEqual indicates that the value is the beginning of a range (exclusive or inclusive, respectively).
200
201 A value of lessThan or lessThanOrEqual indicates that the value is the end or a range (exclusive or inclusive, respectively).
202
203 In the absence of the opposite bound being specified for the range, this bound is to be treated as infinite (e.g., any time period after the beginning of the provided time period for greaterThanOrEqual)
204 )))
205 |CubeRegion||A set of Components and their values that defines a subset or “slice” of the total range of possible content of a data structure to which the Constrainable Artefact is linked.
206 ||isIncluded|Indicates whether the Cube Region is included in the constraint definition or excluded from the constraint definition.
207 ||+member|Associates the set of Components that define the subset of values.
208 |MetadataTargetRe gion||A set of Components and their values that defines a subset or “slice” of the total range of possible content of a metadata structure to which the Constrainable Artefact is linked.
209 ||isIncluded|Indicates whether the Metadata Target Region is included in the constraint definition or excluded from the constraint definition.
210 ||+member|Associates the set of Components that define the subset of values.
211 |MemberSelection||A set of permissible values for one component of the axis.
212 ||isIncluded|Indicates whether the Member Selection is included in the constraint definition or excluded from the constraint definition.
213 ||removePrefix|Indicates whether the Codes should keep or not the prefix, as defined in the extension of Codelist.
214 ||+valuesFor|Association to the Component in the Structure to which the Constrainable Artefact is linked, which defines the valid Representation for the Member Values.
215 |//SelectionValue//|(((
216 Abstract class. Sub classes are:
217
218 MemberValue
219
220 //TimeRangeValue//
221
222 LocalisedMemberValue
223 )))|A collection of values for the Member Selections that, combined with other Member Selections, comprise the value content of the Cube Region.
224 ||validFrom|Date from which the Selection Value is valid.
225 ||validTo|Date from which the Selection Value is superseded.
226 |MemberValue|(((
227 Inherits from
228
229 //SelectionValue//
230 )))|A single value of the set of values for the Member Selection.
231 ||value|A value of the member.
232 ||cascadeValues|Indicates that the child nodes of the member are included in the Member Selection (e.g., child codes)
233 |LocalisedMemberV alue|(((
234 Inherits from
235
236 //SelectionValue//
237 )))|A single localised value of the set of values for a Member Selection.
238 ||value|A value of the member.
239 ||locale|The locale that the values must adhere to in the dataset.
240 |//TimeRangeValue//|(((
241 Inherits from
242
243 //SelectionValue//
244
245 Abstract Class Concrete Classes:
246
247 BeforePeriod
248
249 AfterPeriod
250
251 RangePeriod
252 )))|A time value or values that specifies the date or dates for which the constrained selection is valid.
253 |BeforePeriod|(((
254 Inherits from
255
256 //TimeRangeValue//
257 )))|The period before which the constrained selection is valid.
258 ||isInclusive|Indication of whether the date is inclusive in the period.
259 ||period|The time period which acts as the latest possible reported period
260 |AfterPeriod|(((
261 Inherits from
262
263 //TimeRangeValue//
264 )))|The period after which the constrained selection is valid.
265 ||isInclusive|Indication of whether the date is inclusive in the period.
266 ||period|The time period which acts as the earliest possible reported period
267 |RangePeriod||The start and end periods in a date range.
268 ||+start|Association to the Start Period.
269 ||+end|Association to the End Period.
270 |StartPeriod|(((
271 Inherits from
272
273 //TimeRangeValue//
274 )))|The period from which the constrained selection is valid.
275 ||isInclusive|Indication of whether the date is inclusive in the period.
276 ||period|The time period which acts as the start of the range
277 |EndPeriod|(((
278 Inherits from
279
280 //TimeRangeValue//
281 )))|The period to which the constrained selection is valid.
282 ||isInclusive|Indication of whether the date is inclusive in the period.
283 ||period|The time period which acts as the end of the range
284 |ReleaseCalendar||The schedule of publication or reporting of the data or metadata
285 ||periodicity|The time period between the releases of the data or metadata
286 ||offset|Interval between January 1^^st^^ and the first release of the data
287 ||tolerance|Period after which the data or metadata may be deemed late.
288
289
290
291