Пример #1
0
        public override List<ArtefactInfo> Generate_Artefact()
        {
            List<ArtefactInfo> RetVal;
            ArtefactInfo Artefact;
            SDMXObjectModel.Structure.DataStructureType DataStructure;
            DataTable DtSubgroupType;
            int ItemCounter = 0;

            RetVal = null;

            try
            {
                DataStructure = new SDMXObjectModel.Structure.DataStructureType(Constants.DSD.Id, this.AgencyId, Constants.DSD.Version, Constants.DSD.Name, Constants.DSD.Description, Constants.DefaultLanguage, null);
                DataStructure.Item = new DataStructureComponentsType();

                // Adding TIME_PERIOD Dimension
                ((DataStructureComponentsType)DataStructure.Item).DimensionList.Annotations = null;
                ((DataStructureComponentsType)DataStructure.Item).DimensionList.Items.Add(new TimeDimensionType());
                ((DataStructureComponentsType)DataStructure.Item).DimensionList.Items[ItemCounter].Annotations = null;
                ((DataStructureComponentsType)DataStructure.Item).DimensionList.Items[ItemCounter].ConceptIdentity = new SDMXObjectModel.Common.ConceptReferenceType();
                ((DataStructureComponentsType)DataStructure.Item).DimensionList.Items[ItemCounter].ConceptIdentity.Items.Add(new ConceptRefType(Constants.Concept.TIME_PERIOD.Id, this.AgencyId, Constants.ConceptScheme.DSD.Id, Constants.ConceptScheme.DSD.Version));

                ((DataStructureComponentsType)DataStructure.Item).DimensionList.Items[ItemCounter].LocalRepresentation = new TimeDimensionRepresentationType();
                ((TimeDimensionRepresentationType)((DataStructureComponentsType)DataStructure.Item).DimensionList.Items[ItemCounter].LocalRepresentation).Items.Add(new TimeTextFormatType());
                ((TimeTextFormatType)((TimeDimensionRepresentationType)((DataStructureComponentsType)DataStructure.Item).DimensionList.Items[ItemCounter].LocalRepresentation).Items[0]).textType = SDMXObjectModel.Common.DataType.ObservationalTimePeriod;

                // Adding AREA Dimension
                ItemCounter++;
                ((DataStructureComponentsType)DataStructure.Item).DimensionList.Items.Add(new DimensionType());
                ((DataStructureComponentsType)DataStructure.Item).DimensionList.Items[ItemCounter].Annotations = null;
                ((DataStructureComponentsType)DataStructure.Item).DimensionList.Items[ItemCounter].ConceptIdentity = new SDMXObjectModel.Common.ConceptReferenceType();
                ((DataStructureComponentsType)DataStructure.Item).DimensionList.Items[ItemCounter].ConceptIdentity.Items.Add(new ConceptRefType(Constants.Concept.AREA.Id, this.AgencyId, Constants.ConceptScheme.DSD.Id, Constants.ConceptScheme.DSD.Version));

                ((DataStructureComponentsType)DataStructure.Item).DimensionList.Items[ItemCounter].LocalRepresentation = new SimpleDataStructureRepresentationType();
                ((SimpleDataStructureRepresentationType)((DataStructureComponentsType)DataStructure.Item).DimensionList.Items[ItemCounter].LocalRepresentation).Items.Add(new CodelistReferenceType());
                ((CodelistReferenceType)((SimpleDataStructureRepresentationType)((DataStructureComponentsType)DataStructure.Item).DimensionList.Items[ItemCounter].LocalRepresentation).Items[0]).Items.Add(new CodelistRefType(Constants.CodeList.Area.Id, this.AgencyId, Constants.CodeList.Area.Version));

                // Adding INDICATOR Dimension
                ItemCounter++;
                ((DataStructureComponentsType)DataStructure.Item).DimensionList.Items.Add(new DimensionType());
                ((DataStructureComponentsType)DataStructure.Item).DimensionList.Items[ItemCounter].Annotations = null;
                ((DataStructureComponentsType)DataStructure.Item).DimensionList.Items[ItemCounter].ConceptIdentity = new SDMXObjectModel.Common.ConceptReferenceType();
                ((DataStructureComponentsType)DataStructure.Item).DimensionList.Items[ItemCounter].ConceptIdentity.Items.Add(new ConceptRefType(Constants.Concept.INDICATOR.Id, this.AgencyId, Constants.ConceptScheme.DSD.Id, Constants.ConceptScheme.DSD.Version));

                ((DataStructureComponentsType)DataStructure.Item).DimensionList.Items[ItemCounter].LocalRepresentation = new SimpleDataStructureRepresentationType();
                ((SimpleDataStructureRepresentationType)((DataStructureComponentsType)DataStructure.Item).DimensionList.Items[ItemCounter].LocalRepresentation).Items.Add(new CodelistReferenceType());
                ((CodelistReferenceType)((SimpleDataStructureRepresentationType)((DataStructureComponentsType)DataStructure.Item).DimensionList.Items[ItemCounter].LocalRepresentation).Items[0]).Items.Add(new CodelistRefType(Constants.CodeList.Indicator.Id, this.AgencyId, Constants.CodeList.Indicator.Version));

                // Adding UNIT Dimension
                ItemCounter++;
                ((DataStructureComponentsType)DataStructure.Item).DimensionList.Items.Add(new DimensionType());
                ((DataStructureComponentsType)DataStructure.Item).DimensionList.Items[ItemCounter].Annotations = null;
                ((DataStructureComponentsType)DataStructure.Item).DimensionList.Items[ItemCounter].ConceptIdentity = new SDMXObjectModel.Common.ConceptReferenceType();
                ((DataStructureComponentsType)DataStructure.Item).DimensionList.Items[ItemCounter].ConceptIdentity.Items.Add(new ConceptRefType(Constants.Concept.UNIT.Id, this.AgencyId, Constants.ConceptScheme.DSD.Id, Constants.ConceptScheme.DSD.Version));

                ((DataStructureComponentsType)DataStructure.Item).DimensionList.Items[ItemCounter].LocalRepresentation = new SimpleDataStructureRepresentationType();
                ((SimpleDataStructureRepresentationType)((DataStructureComponentsType)DataStructure.Item).DimensionList.Items[ItemCounter].LocalRepresentation).Items.Add(new CodelistReferenceType());
                ((CodelistReferenceType)((SimpleDataStructureRepresentationType)((DataStructureComponentsType)DataStructure.Item).DimensionList.Items[ItemCounter].LocalRepresentation).Items[0]).Items.Add(new CodelistRefType(Constants.CodeList.Unit.Id, this.AgencyId, Constants.CodeList.Unit.Version));

                // Adding SOURCE Dimension
                ItemCounter++;
                ((DataStructureComponentsType)DataStructure.Item).DimensionList.Items.Add(new DimensionType());
                ((DataStructureComponentsType)DataStructure.Item).DimensionList.Items[ItemCounter].Annotations = null;
                ((DataStructureComponentsType)DataStructure.Item).DimensionList.Items[ItemCounter].ConceptIdentity = new SDMXObjectModel.Common.ConceptReferenceType();
                ((DataStructureComponentsType)DataStructure.Item).DimensionList.Items[ItemCounter].ConceptIdentity.Items.Add(new ConceptRefType(Constants.Concept.SOURCE.Id, this.AgencyId, Constants.ConceptScheme.DSD.Id, Constants.ConceptScheme.DSD.Version));

                ((DataStructureComponentsType)DataStructure.Item).DimensionList.Items[ItemCounter].LocalRepresentation = new SimpleDataStructureRepresentationType();
                ((SimpleDataStructureRepresentationType)((DataStructureComponentsType)DataStructure.Item).DimensionList.Items[ItemCounter].LocalRepresentation).Items.Add(new SimpleComponentTextFormatType());
                ((SimpleComponentTextFormatType)((SimpleDataStructureRepresentationType)((DataStructureComponentsType)DataStructure.Item).DimensionList.Items[ItemCounter].LocalRepresentation).Items[0]).textType = SDMXObjectModel.Common.DataType.String;

                DtSubgroupType = this.DIConnection.ExecuteDataTable(this.DIQueries.SubgroupTypes.GetSubgroupTypes(FilterFieldType.None, string.Empty));
                foreach (DataRow DrSubgroupType in DtSubgroupType.Rows)
                {
                    // Adding Subgroups Dimension
                    ItemCounter++;
                    ((DataStructureComponentsType)DataStructure.Item).DimensionList.Items.Add(new DimensionType());
                    ((DataStructureComponentsType)DataStructure.Item).DimensionList.Items[ItemCounter].Annotations = null;
                    ((DataStructureComponentsType)DataStructure.Item).DimensionList.Items[ItemCounter].ConceptIdentity = new SDMXObjectModel.Common.ConceptReferenceType();
                    ((DataStructureComponentsType)DataStructure.Item).DimensionList.Items[ItemCounter].ConceptIdentity.Items.Add(new ConceptRefType(DrSubgroupType[SubgroupTypes.SubgroupTypeGID].ToString(), this.AgencyId, Constants.ConceptScheme.DSD.Id, Constants.ConceptScheme.DSD.Version));

                    ((DataStructureComponentsType)DataStructure.Item).DimensionList.Items[ItemCounter].LocalRepresentation = new SimpleDataStructureRepresentationType();
                    ((SimpleDataStructureRepresentationType)((DataStructureComponentsType)DataStructure.Item).DimensionList.Items[ItemCounter].LocalRepresentation).Items.Add(new CodelistReferenceType());
                    ((CodelistReferenceType)((SimpleDataStructureRepresentationType)((DataStructureComponentsType)DataStructure.Item).DimensionList.Items[ItemCounter].LocalRepresentation).Items[0]).Items.Add(new CodelistRefType(Constants.CodelistPrefix + DrSubgroupType[SubgroupTypes.SubgroupTypeGID].ToString(), this.AgencyId, Constants.CodeList.Subgroups.Version));
                }

                // Adding PERIODICITY Attribute
                ItemCounter = 0;
                ((DataStructureComponentsType)DataStructure.Item).AttributeList.Annotations = null;
                ((DataStructureComponentsType)DataStructure.Item).AttributeList.Items.Add(new AttributeType());
                ((AttributeType)((DataStructureComponentsType)DataStructure.Item).AttributeList.Items[ItemCounter]).Annotations = null;
                ((AttributeType)((DataStructureComponentsType)DataStructure.Item).AttributeList.Items[ItemCounter]).assignmentStatus = UsageStatusType.Mandatory;
                ((DataStructureComponentsType)DataStructure.Item).AttributeList.Items[ItemCounter].ConceptIdentity = new SDMXObjectModel.Common.ConceptReferenceType();
                ((DataStructureComponentsType)DataStructure.Item).AttributeList.Items[ItemCounter].ConceptIdentity.Items.Add(new ConceptRefType(Constants.Concept.PERIODICITY.Id, this.AgencyId, Constants.ConceptScheme.DSD.Id, Constants.ConceptScheme.DSD.Version));

                ((DataStructureComponentsType)DataStructure.Item).AttributeList.Items[ItemCounter].LocalRepresentation = new SimpleDataStructureRepresentationType();
                ((SimpleDataStructureRepresentationType)((DataStructureComponentsType)DataStructure.Item).AttributeList.Items[ItemCounter].LocalRepresentation).Items.Add(new SimpleComponentTextFormatType());
                ((SimpleComponentTextFormatType)((SimpleDataStructureRepresentationType)((DataStructureComponentsType)DataStructure.Item).AttributeList.Items[ItemCounter].LocalRepresentation).Items[0]).textType = SDMXObjectModel.Common.DataType.String;

                ((AttributeType)((DataStructureComponentsType)DataStructure.Item).AttributeList.Items[ItemCounter]).AttributeRelationship = new AttributeRelationshipType();
                ((AttributeType)((DataStructureComponentsType)DataStructure.Item).AttributeList.Items[ItemCounter]).AttributeRelationship.ItemsElementName = new AttributeRelationshipChoiceType[] { AttributeRelationshipChoiceType.PrimaryMeasure };
                ((AttributeType)((DataStructureComponentsType)DataStructure.Item).AttributeList.Items[ItemCounter]).AttributeRelationship.Items = new LocalPrimaryMeasureReferenceType[] { new LocalPrimaryMeasureReferenceType() };
                ((LocalPrimaryMeasureReferenceType)((AttributeType)((DataStructureComponentsType)DataStructure.Item).AttributeList.Items[ItemCounter]).AttributeRelationship.Items[0]).Items.Add(new LocalPrimaryMeasureRefType());
                ((LocalPrimaryMeasureRefType)((LocalPrimaryMeasureReferenceType)((AttributeType)((DataStructureComponentsType)DataStructure.Item).AttributeList.Items[ItemCounter]).AttributeRelationship.Items[0]).Items[0]).id = Constants.Concept.OBS_VALUE.Id;

                // Adding NATURE Attribute
                ItemCounter++;
                ((DataStructureComponentsType)DataStructure.Item).AttributeList.Items.Add(new AttributeType());
                ((AttributeType)((DataStructureComponentsType)DataStructure.Item).AttributeList.Items[ItemCounter]).Annotations = null;
                ((AttributeType)((DataStructureComponentsType)DataStructure.Item).AttributeList.Items[ItemCounter]).assignmentStatus = UsageStatusType.Conditional;
                ((DataStructureComponentsType)DataStructure.Item).AttributeList.Items[ItemCounter].ConceptIdentity = new SDMXObjectModel.Common.ConceptReferenceType();
                ((DataStructureComponentsType)DataStructure.Item).AttributeList.Items[ItemCounter].ConceptIdentity.Items.Add(new ConceptRefType(Constants.Concept.NATURE.Id, this.AgencyId, Constants.ConceptScheme.DSD.Id, Constants.ConceptScheme.DSD.Version));

                ((DataStructureComponentsType)DataStructure.Item).AttributeList.Items[ItemCounter].LocalRepresentation = new SimpleDataStructureRepresentationType();
                ((SimpleDataStructureRepresentationType)((DataStructureComponentsType)DataStructure.Item).AttributeList.Items[ItemCounter].LocalRepresentation).Items.Add(new SimpleComponentTextFormatType());
                ((SimpleComponentTextFormatType)((SimpleDataStructureRepresentationType)((DataStructureComponentsType)DataStructure.Item).AttributeList.Items[ItemCounter].LocalRepresentation).Items[0]).textType = SDMXObjectModel.Common.DataType.Decimal;

                ((AttributeType)((DataStructureComponentsType)DataStructure.Item).AttributeList.Items[ItemCounter]).AttributeRelationship = new AttributeRelationshipType();
                ((AttributeType)((DataStructureComponentsType)DataStructure.Item).AttributeList.Items[ItemCounter]).AttributeRelationship.ItemsElementName = new AttributeRelationshipChoiceType[] { AttributeRelationshipChoiceType.PrimaryMeasure };
                ((AttributeType)((DataStructureComponentsType)DataStructure.Item).AttributeList.Items[ItemCounter]).AttributeRelationship.Items = new LocalPrimaryMeasureReferenceType[] { new LocalPrimaryMeasureReferenceType() };
                ((LocalPrimaryMeasureReferenceType)((AttributeType)((DataStructureComponentsType)DataStructure.Item).AttributeList.Items[ItemCounter]).AttributeRelationship.Items[0]).Items.Add(new LocalPrimaryMeasureRefType());
                ((LocalPrimaryMeasureRefType)((LocalPrimaryMeasureReferenceType)((AttributeType)((DataStructureComponentsType)DataStructure.Item).AttributeList.Items[ItemCounter]).AttributeRelationship.Items[0]).Items[0]).id = Constants.Concept.OBS_VALUE.Id;

                // Adding DENOMINATOR Attribute
                ItemCounter++;
                ((DataStructureComponentsType)DataStructure.Item).AttributeList.Items.Add(new AttributeType());
                ((AttributeType)((DataStructureComponentsType)DataStructure.Item).AttributeList.Items[ItemCounter]).Annotations = null;
                ((AttributeType)((DataStructureComponentsType)DataStructure.Item).AttributeList.Items[ItemCounter]).assignmentStatus = UsageStatusType.Conditional;
                ((DataStructureComponentsType)DataStructure.Item).AttributeList.Items[ItemCounter].ConceptIdentity = new SDMXObjectModel.Common.ConceptReferenceType();
                ((DataStructureComponentsType)DataStructure.Item).AttributeList.Items[ItemCounter].ConceptIdentity.Items.Add(new ConceptRefType(Constants.Concept.DENOMINATOR.Id, this.AgencyId, Constants.ConceptScheme.DSD.Id, Constants.ConceptScheme.DSD.Version));

                ((DataStructureComponentsType)DataStructure.Item).AttributeList.Items[ItemCounter].LocalRepresentation = new SimpleDataStructureRepresentationType();
                ((SimpleDataStructureRepresentationType)((DataStructureComponentsType)DataStructure.Item).AttributeList.Items[ItemCounter].LocalRepresentation).Items.Add(new SimpleComponentTextFormatType());
                ((SimpleComponentTextFormatType)((SimpleDataStructureRepresentationType)((DataStructureComponentsType)DataStructure.Item).AttributeList.Items[ItemCounter].LocalRepresentation).Items[0]).textType = SDMXObjectModel.Common.DataType.Decimal;

                ((AttributeType)((DataStructureComponentsType)DataStructure.Item).AttributeList.Items[ItemCounter]).AttributeRelationship = new AttributeRelationshipType();
                ((AttributeType)((DataStructureComponentsType)DataStructure.Item).AttributeList.Items[ItemCounter]).AttributeRelationship.ItemsElementName = new AttributeRelationshipChoiceType[] { AttributeRelationshipChoiceType.PrimaryMeasure };
                ((AttributeType)((DataStructureComponentsType)DataStructure.Item).AttributeList.Items[ItemCounter]).AttributeRelationship.Items = new LocalPrimaryMeasureReferenceType[] { new LocalPrimaryMeasureReferenceType() };
                ((LocalPrimaryMeasureReferenceType)((AttributeType)((DataStructureComponentsType)DataStructure.Item).AttributeList.Items[ItemCounter]).AttributeRelationship.Items[0]).Items.Add(new LocalPrimaryMeasureRefType());
                ((LocalPrimaryMeasureRefType)((LocalPrimaryMeasureReferenceType)((AttributeType)((DataStructureComponentsType)DataStructure.Item).AttributeList.Items[ItemCounter]).AttributeRelationship.Items[0]).Items[0]).id = Constants.Concept.OBS_VALUE.Id;

                // Adding FOOTNOTES Attribute
                ItemCounter++;
                ((DataStructureComponentsType)DataStructure.Item).AttributeList.Items.Add(new AttributeType());
                ((AttributeType)((DataStructureComponentsType)DataStructure.Item).AttributeList.Items[ItemCounter]).Annotations = null;
                ((AttributeType)((DataStructureComponentsType)DataStructure.Item).AttributeList.Items[ItemCounter]).assignmentStatus = UsageStatusType.Conditional;
                ((DataStructureComponentsType)DataStructure.Item).AttributeList.Items[ItemCounter].ConceptIdentity = new SDMXObjectModel.Common.ConceptReferenceType();
                ((DataStructureComponentsType)DataStructure.Item).AttributeList.Items[ItemCounter].ConceptIdentity.Items.Add(new ConceptRefType(Constants.Concept.FOOTNOTES.Id, this.AgencyId, Constants.ConceptScheme.DSD.Id, Constants.ConceptScheme.DSD.Version));

                ((DataStructureComponentsType)DataStructure.Item).AttributeList.Items[ItemCounter].LocalRepresentation = new SimpleDataStructureRepresentationType();
                ((SimpleDataStructureRepresentationType)((DataStructureComponentsType)DataStructure.Item).AttributeList.Items[ItemCounter].LocalRepresentation).Items.Add(new SimpleComponentTextFormatType());
                ((SimpleComponentTextFormatType)((SimpleDataStructureRepresentationType)((DataStructureComponentsType)DataStructure.Item).AttributeList.Items[ItemCounter].LocalRepresentation).Items[0]).textType = SDMXObjectModel.Common.DataType.String;

                ((AttributeType)((DataStructureComponentsType)DataStructure.Item).AttributeList.Items[ItemCounter]).AttributeRelationship = new AttributeRelationshipType();
                ((AttributeType)((DataStructureComponentsType)DataStructure.Item).AttributeList.Items[ItemCounter]).AttributeRelationship.ItemsElementName = new AttributeRelationshipChoiceType[] { AttributeRelationshipChoiceType.PrimaryMeasure };
                ((AttributeType)((DataStructureComponentsType)DataStructure.Item).AttributeList.Items[ItemCounter]).AttributeRelationship.Items = new LocalPrimaryMeasureReferenceType[] { new LocalPrimaryMeasureReferenceType() };
                ((LocalPrimaryMeasureReferenceType)((AttributeType)((DataStructureComponentsType)DataStructure.Item).AttributeList.Items[ItemCounter]).AttributeRelationship.Items[0]).Items.Add(new LocalPrimaryMeasureRefType());
                ((LocalPrimaryMeasureRefType)((LocalPrimaryMeasureReferenceType)((AttributeType)((DataStructureComponentsType)DataStructure.Item).AttributeList.Items[ItemCounter]).AttributeRelationship.Items[0]).Items[0]).id = Constants.Concept.OBS_VALUE.Id;

                // Adding CONFIDENCE_INTERVAL_UPPER Attribute
                ItemCounter++;
                ((DataStructureComponentsType)DataStructure.Item).AttributeList.Items.Add(new AttributeType());
                ((AttributeType)((DataStructureComponentsType)DataStructure.Item).AttributeList.Items[ItemCounter]).Annotations = null;
                ((AttributeType)((DataStructureComponentsType)DataStructure.Item).AttributeList.Items[ItemCounter]).assignmentStatus = UsageStatusType.Conditional;
                ((DataStructureComponentsType)DataStructure.Item).AttributeList.Items[ItemCounter].ConceptIdentity = new SDMXObjectModel.Common.ConceptReferenceType();
                ((DataStructureComponentsType)DataStructure.Item).AttributeList.Items[ItemCounter].ConceptIdentity.Items.Add(new ConceptRefType(Constants.Concept.CONFIDENCE_INTERVAL_UPPER.Id, this.AgencyId, Constants.ConceptScheme.DSD.Id, Constants.ConceptScheme.DSD.Version));

                ((DataStructureComponentsType)DataStructure.Item).AttributeList.Items[ItemCounter].LocalRepresentation = new SimpleDataStructureRepresentationType();
                ((SimpleDataStructureRepresentationType)((DataStructureComponentsType)DataStructure.Item).AttributeList.Items[ItemCounter].LocalRepresentation).Items.Add(new SimpleComponentTextFormatType());
                ((SimpleComponentTextFormatType)((SimpleDataStructureRepresentationType)((DataStructureComponentsType)DataStructure.Item).AttributeList.Items[ItemCounter].LocalRepresentation).Items[0]).textType = SDMXObjectModel.Common.DataType.String;

                ((AttributeType)((DataStructureComponentsType)DataStructure.Item).AttributeList.Items[ItemCounter]).AttributeRelationship = new AttributeRelationshipType();
                ((AttributeType)((DataStructureComponentsType)DataStructure.Item).AttributeList.Items[ItemCounter]).AttributeRelationship.ItemsElementName = new AttributeRelationshipChoiceType[] { AttributeRelationshipChoiceType.PrimaryMeasure };
                ((AttributeType)((DataStructureComponentsType)DataStructure.Item).AttributeList.Items[ItemCounter]).AttributeRelationship.Items = new LocalPrimaryMeasureReferenceType[] { new LocalPrimaryMeasureReferenceType() };
                ((LocalPrimaryMeasureReferenceType)((AttributeType)((DataStructureComponentsType)DataStructure.Item).AttributeList.Items[ItemCounter]).AttributeRelationship.Items[0]).Items.Add(new LocalPrimaryMeasureRefType());
                ((LocalPrimaryMeasureRefType)((LocalPrimaryMeasureReferenceType)((AttributeType)((DataStructureComponentsType)DataStructure.Item).AttributeList.Items[ItemCounter]).AttributeRelationship.Items[0]).Items[0]).id = Constants.Concept.OBS_VALUE.Id;

                // Adding CONFIDENCE_INTERVAL_LOWER Attribute
                ItemCounter++;
                ((DataStructureComponentsType)DataStructure.Item).AttributeList.Items.Add(new AttributeType());
                ((AttributeType)((DataStructureComponentsType)DataStructure.Item).AttributeList.Items[ItemCounter]).Annotations = null;
                ((AttributeType)((DataStructureComponentsType)DataStructure.Item).AttributeList.Items[ItemCounter]).assignmentStatus = UsageStatusType.Conditional;
                ((DataStructureComponentsType)DataStructure.Item).AttributeList.Items[ItemCounter].ConceptIdentity = new SDMXObjectModel.Common.ConceptReferenceType();
                ((DataStructureComponentsType)DataStructure.Item).AttributeList.Items[ItemCounter].ConceptIdentity.Items.Add(new ConceptRefType(Constants.Concept.CONFIDENCE_INTERVAL_LOWER.Id, this.AgencyId, Constants.ConceptScheme.DSD.Id, Constants.ConceptScheme.DSD.Version));

                ((DataStructureComponentsType)DataStructure.Item).AttributeList.Items[ItemCounter].LocalRepresentation = new SimpleDataStructureRepresentationType();
                ((SimpleDataStructureRepresentationType)((DataStructureComponentsType)DataStructure.Item).AttributeList.Items[ItemCounter].LocalRepresentation).Items.Add(new SimpleComponentTextFormatType());
                ((SimpleComponentTextFormatType)((SimpleDataStructureRepresentationType)((DataStructureComponentsType)DataStructure.Item).AttributeList.Items[ItemCounter].LocalRepresentation).Items[0]).textType = SDMXObjectModel.Common.DataType.String;

                ((AttributeType)((DataStructureComponentsType)DataStructure.Item).AttributeList.Items[ItemCounter]).AttributeRelationship = new AttributeRelationshipType();
                ((AttributeType)((DataStructureComponentsType)DataStructure.Item).AttributeList.Items[ItemCounter]).AttributeRelationship.ItemsElementName = new AttributeRelationshipChoiceType[] { AttributeRelationshipChoiceType.PrimaryMeasure };
                ((AttributeType)((DataStructureComponentsType)DataStructure.Item).AttributeList.Items[ItemCounter]).AttributeRelationship.Items = new LocalPrimaryMeasureReferenceType[] { new LocalPrimaryMeasureReferenceType() };
                ((LocalPrimaryMeasureReferenceType)((AttributeType)((DataStructureComponentsType)DataStructure.Item).AttributeList.Items[ItemCounter]).AttributeRelationship.Items[0]).Items.Add(new LocalPrimaryMeasureRefType());
                ((LocalPrimaryMeasureRefType)((LocalPrimaryMeasureReferenceType)((AttributeType)((DataStructureComponentsType)DataStructure.Item).AttributeList.Items[ItemCounter]).AttributeRelationship.Items[0]).Items[0]).id = Constants.Concept.OBS_VALUE.Id;

                // Adding OBS_VAL Primary Measure
                ItemCounter = 0;
                ((DataStructureComponentsType)DataStructure.Item).MeasureList.Annotations = null;
                ((DataStructureComponentsType)DataStructure.Item).MeasureList.Items.Add(new PrimaryMeasureType());
                ((DataStructureComponentsType)DataStructure.Item).MeasureList.Items[ItemCounter].Annotations = null;
                ((DataStructureComponentsType)DataStructure.Item).MeasureList.Items[ItemCounter].ConceptIdentity = new SDMXObjectModel.Common.ConceptReferenceType();
                ((DataStructureComponentsType)DataStructure.Item).MeasureList.Items[ItemCounter].ConceptIdentity.Items.Add(new ConceptRefType(Constants.Concept.OBS_VALUE.Id, this.AgencyId, Constants.ConceptScheme.DSD.Id, Constants.ConceptScheme.DSD.Version));

                ((DataStructureComponentsType)DataStructure.Item).MeasureList.Items[ItemCounter].LocalRepresentation = new SimpleDataStructureRepresentationType();
                ((SimpleDataStructureRepresentationType)((DataStructureComponentsType)DataStructure.Item).MeasureList.Items[ItemCounter].LocalRepresentation).Items.Add(new SimpleComponentTextFormatType());
                ((SimpleComponentTextFormatType)((SimpleDataStructureRepresentationType)((DataStructureComponentsType)DataStructure.Item).MeasureList.Items[ItemCounter].LocalRepresentation).Items[0]).textType = SDMXObjectModel.Common.DataType.String;

                // Preparing Artefact and saving
                Artefact = this.Prepare_ArtefactInfo_From_DataStructure(DataStructure, Constants.DSD.FileName);
                this.Add_ArtefactInfo_To_List(ref RetVal, Artefact);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
            }

            return RetVal;
        }
        public StructuresType(ProvisionAgreementType provisionAgreement, ConstraintType constraint, ProcessType process, 
                              ReportingTaxonomyType reportingTaxonomoy, StructureSetType structureSet, DataStructureType dataStructure, 
                              MetadataStructureType metadataStructure, ConceptSchemeType conceptScheme, 
                              HierarchicalCodelistType hierarchicalCodelist, CodelistType codelist, CategorisationType categorisation, 
                              CategorySchemeType categoryScheme, MetadataflowType metadataFlow, DataflowType dataFlow, 
                              OrganisationSchemeType organisationScheme)
        {
            if (provisionAgreement != null)
            {
                this.provisionAgreementsField = new List<ProvisionAgreementType>();
                this.provisionAgreementsField.Add(provisionAgreement);
            }

            if (constraint != null)
            {
                this.constraintsField = new List<ConstraintType>();
                this.constraintsField.Add(constraint);
            }

            if (process != null)
            {
                this.processesField = new List<ProcessType>();
                this.processesField.Add(process);
            }

            if (reportingTaxonomoy != null)
            {
                this.reportingTaxonomiesField = new List<ReportingTaxonomyType>();
                this.reportingTaxonomiesField.Add(reportingTaxonomoy);
            }

            if (structureSet != null)
            {
                this.structureSetsField = new List<StructureSetType>();
                this.structureSetsField.Add(structureSet);
            }

            if (dataStructure != null)
            {
                this.dataStructuresField = new List<DataStructureType>();
                this.dataStructuresField.Add(dataStructure);
            }

            if (metadataStructure != null)
            {
                this.metadataStructuresField = new List<MetadataStructureType>();
                this.metadataStructuresField.Add(metadataStructure);
            }

            if (conceptScheme != null)
            {
                this.conceptsField = new List<ConceptSchemeType>();
                this.conceptsField.Add(conceptScheme);
            }

            if (hierarchicalCodelist != null)
            {
                this.hierarchicalCodelistsField = new List<HierarchicalCodelistType>();
                this.hierarchicalCodelistsField.Add(hierarchicalCodelist);
            }

            if (codelist != null)
            {
                this.codelistsField = new List<CodelistType>();
                this.codelistsField.Add(codelist);
            }

            if (categorisation != null)
            {
                this.categorisationsField = new List<CategorisationType>();
                this.categorisationsField.Add(categorisation);
            }

            if (categoryScheme != null)
            {
                this.categorySchemesField = new List<CategorySchemeType>();
                this.categorySchemesField.Add(categoryScheme);
            }

            if (metadataFlow != null)
            {
                this.metadataflowsField = new List<MetadataflowType>();
                this.metadataflowsField.Add(metadataFlow);
            }

            if (dataFlow != null)
            {
                this.dataflowsField = new List<DataflowType>();
                this.dataflowsField.Add(dataFlow);
            }

            if (organisationScheme != null)
            {
                this.organisationSchemesField = new List<OrganisationSchemeType>();
                this.organisationSchemesField.Add(organisationScheme);
            }
        }