In this version of SDMX the Constraints is a Maintainable Artefact can be associated to one or more of:
Note that regardless of the artifact to which the Constraint is associated, it is constraining the contents of code lists in the DSD to which the constrained object is related. This does not apply, of course, to a Data Provider as the Data Provider can be associated, via the Provision Agreement, to many DSDs. Hence the reason for the restriction on the type of Constraint that can be attached to a Data Provider.
The Constraint can be of one of two types:
The attachable constraint is used to define “cube slices” which identify sub sets of data in terms of series keys or dimension values. The purpose of this is to enable metadata to be attached to the constraint, and thereby to the cube slices defined in the Constraint. The metadata can be attached via the “reference metadata” mechanism – MSD and Metadata Set – or via a Group in the DSD. Below is snippet of the schema for a DSD that shows the constructs that enable the Constraint to referenced from a Group in a DSD.

Figure 9: Extract from the SDMX-ML Schema showing reference to Attachment Constraint
For the Content Constraint specific “inheritance” rules apply and these are detailed below.
A Content Constraint is used specify the content of a data or metadata source in terms of the component values or the keys.
In terms of data the components are:
And the keys are the content of the KeyDescriptor – i.e. the series keys composed, for each key, by a value for each Dimension and Measure Dimension
In terms of reference metadata the components are:
The “key” is therefore the combination of the Target Objects that are defined for the Metadata Target.
For a Constraint based on a DSD the Content Constraint can reference one or more of:
For a Constraint based on an MSD the Content Constraint can reference one or more of:
Furthermore, there can be more than one Content Constraint specified for a specific object e.g. more than one Constraint for a specific DSD.
In view of the flexibility of constraints attachment, clear rules on their usage are required. These are elaborated below.
There can be many Content Constraint for any Constrainable Artefact (e.g. DSD), subject to the following restrictions:
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”). 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.
There are three levels of constraint attachment for which these inheritance rules apply:
Note that these rules do not apply to the Simple Datasoucre or Queryable Datasource: the Content Constraint(s) attached to these artefacts are resolved for this artefact only and do not take into account Constraint attached to other artefacts (e.g. Provision Agreement. Dataflow, DSD).
It is not necessary for a Content Constraint to be attached to higher level artifact. e.g. it is valid to have a Content Constraint for a Provision Agreement where there are no constraints attached the relevant dataflow or DSD.
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.
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.
Note that it is possible for a Content Constraint at a higher level to constrain, say, four Dimensions in a single constraint, and a Content Constraint at a lower level to constrain the same four in two, three, or four Content Constraint.
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.
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.
The following scenario is used.
DSD
This contains the following Dimensions:
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 Content Constraint is attached.

Figure 10: Example Scenario for Constraints
Constraints are declared as follows:

Figure 11: Example Content Constraints
Notes:
The cascade rules elaborated above result as follows:
DSD
1. Constrained by eliminating code 001 from the code list for the AGE Dimension.
Dataflow CENSUS_CUBE1
Dataflow CENSUS_CUBE2
Provision Agreements CENSUS_CUBE1_IT
Provision Agreements CENSUS_CUBE2_IT
The constraints are defined as follows:
DSD Constraint

Dataflow Constraints


Provision Agreement Constraint
