Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support of attribute relationship #81

Closed
charphi opened this issue May 3, 2021 · 2 comments
Closed

Add support of attribute relationship #81

charphi opened this issue May 3, 2021 · 2 comments
Labels
API enhancement New feature or request PROVIDER
Milestone

Comments

@charphi
Copy link
Member

charphi commented May 3, 2021

Attributes can be attached at different level such as observation-level, time series-level and sibling-level.
(see example at https://sdw.ecb.europa.eu/datastructure.do?datasetinstanceid=120)
Currently, sdmx-dl cannot distringuish these levels.

@charphi charphi added the enhancement New feature or request label May 3, 2021
@charphi charphi added this to the 3.0.0-beta.3 milestone May 3, 2021
@charphi charphi modified the milestones: 3.0.0-beta.3, 3.0.0-beta.4 Sep 13, 2021
@charphi charphi removed this from the 3.0.0-beta.4 milestone Oct 21, 2021
@charphi
Copy link
Member Author

charphi commented May 25, 2022

In SDMX glossary v2.1, this feature is named Attribute Relationship (Attachment level in v2.0).

Definition: Specification of the type of artefact to which a data attribute can be attached in a Data Set.
Context: A part of the specification of Attribute in a Data Structure Definition denotes to which part of the data the Attribute can relate in a Data Set. This can be the entire Data Set, specific grouping of the Dimensions, or an Observation.
This is a version 2.1 construct. In version 2.0 this was known as the "attachment level".

DataStructure schema v2.0:

<xs:simpleType name="AttachmentLevelType">
	<xs:restriction base="xs:NMTOKEN">
		<xs:enumeration value="DataSet">
			<xs:annotation>
				<xs:documentation>Data set level</xs:documentation>
			</xs:annotation>
		</xs:enumeration>
		<xs:enumeration value="Group">
			<xs:annotation>
				<xs:documentation>Group level</xs:documentation>
			</xs:annotation>
		</xs:enumeration>
		<xs:enumeration value="Series">
			<xs:annotation>
				<xs:documentation>Series level</xs:documentation>
			</xs:annotation>
		</xs:enumeration>
		<xs:enumeration value="Observation">
			<xs:annotation>
				<xs:documentation>Observation level</xs:documentation>
			</xs:annotation>
		</xs:enumeration>
	</xs:restriction>
</xs:simpleType>

DataStructure schema v2.1:

<xs:complexType name="AttributeRelationshipType">
	<xs:annotation>
		<xs:documentation>AttributeRelationshipType defines the structure for stating the relationship between an attribute and other data structure definition components.</xs:documentation>
	</xs:annotation>
	<xs:choice>
		<xs:element name="None" type="common:EmptyType">
			<xs:annotation>
				<xs:documentation>This means that value of the attribute will not vary with any of the other key family components. This will always be treated as a data set level attribute.</xs:documentation>
			</xs:annotation>
		</xs:element>
		<xs:sequence>
			<xs:element name="Dimension" type="common:LocalDimensionReferenceType" maxOccurs="unbounded">
				<xs:annotation>
					<xs:documentation>This is used to reference dimensions in the data structure definition on which the value of this attribute depends. An attribute using this relationship can be either a group, series (or section), or observation level attribute. The attachment level of the attribute will be determined by the data format and which dimensions are referenced.</xs:documentation>
				</xs:annotation>
			</xs:element>
			<xs:element name="AttachmentGroup" type="common:LocalGroupKeyDescriptorReferenceType" minOccurs="0" maxOccurs="unbounded">
				<xs:annotation>
					<xs:documentation>This is used to specify that the attribute should always be attached to the groups referenced here. Note that if one of the referenced dimensions is the time dimension, the groups referenced here will be ignored.</xs:documentation>
				</xs:annotation>
			</xs:element>
		</xs:sequence>
		<xs:element name="Group" type="common:LocalGroupKeyDescriptorReferenceType">
			<xs:annotation>
				<xs:documentation>This is used as a convenience to referencing all of the dimension defined by the referenced group. The attribute will also be attached to this group.</xs:documentation>
			</xs:annotation>
		</xs:element>
		<xs:element name="PrimaryMeasure" type="common:LocalPrimaryMeasureReferenceType">
			<xs:annotation>
				<xs:documentation>This is used to specify that the value of the attribute is dependent upon the observed value. An attribute with this relationship will always be treated as an observation level attribute.</xs:documentation>
			</xs:annotation>
		</xs:element>
	</xs:choice>
</xs:complexType>

DataStructure schema v3.0:

<xs:complexType name="AttributeRelationshipType">
	<xs:annotation>
		<xs:documentation>AttributeRelationshipType defines the structure for stating the relationship between an attribute and other data structure definition components.</xs:documentation>
	</xs:annotation>
	<xs:choice>
		<xs:element name="Dataflow" type="common:EmptyType">
			<xs:annotation>
				<xs:documentation>This means that the value of the attribute varies per dataflow. It is the data modeller's responsibility to design or use non-overlapping dataflows that do not have observations in common, otherwise the integrity of dataflow-specific attribute values is not assured by the model, e.g. when querying those data through its DSD.</xs:documentation>
			</xs:annotation>
		</xs:element>
		<xs:sequence>
			<xs:element name="Dimension" type="OptionalLocalDimensionReferenceType" maxOccurs="unbounded">
				<xs:annotation>
					<xs:documentation>This is used to reference dimensions in the data structure definition on which the value of this attribute depends. An attribute using this relationship can be either a group, series (or section), or observation level attribute. The attachment level of the attribute will be determined by the data format and which dimensions are referenced.</xs:documentation>
				</xs:annotation>
			</xs:element>
		</xs:sequence>
		<xs:element name="Group" type="common:IDType">
			<xs:annotation>
				<xs:documentation>This is used as a convenience to referencing all of the dimension defined by the referenced group. The attribute will also be attached to this group.</xs:documentation>
			</xs:annotation>
		</xs:element>
		<xs:element name="Observation" type="common:EmptyType">
			<xs:annotation>
				<xs:documentation>This is used to specify that the value of the attribute is dependent upon the observed value. An attribute with this relationship will always be treated as an observation level attribute.</xs:documentation>
			</xs:annotation>
		</xs:element>
	</xs:choice>
</xs:complexType>

@charphi charphi changed the title Add support of attribute scopes (levels) Add support of attribute relationship May 25, 2022
@charphi charphi added this to the 3.0.0-beta.7 milestone May 30, 2022
@charphi
Copy link
Member Author

charphi commented May 30, 2022

Done in cdff460

@charphi charphi closed this as completed May 30, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
API enhancement New feature or request PROVIDER
Projects
None yet
Development

No branches or pull requests

1 participant