Beispiel #1
0
        public override IDataStructure GetDatasetStructure(string datasetName)
        {
            string @namespace;

            this.SplitDatasetName(datasetName, out @namespace, out datasetName);

            if (@namespace != this.Namespace)
            {
                return(null);
            }

            ISet <IMaintainableObject> maintainable = this.GetMaintainableObjects();

            DataStructureObjectCore datastructure = (DataStructureObjectCore)maintainable.SingleOrDefault(m => m.StructureType.StructureType == "Data Structure Definition" && m.Id == datasetName);

            if (datastructure == null)
            {
                return(null);
            }

            DataStructure dataStructure = new DataStructure();

            foreach (IDimension dimension in datastructure.DimensionList.Dimensions)
            {
                BasicDataType type = dimension.Representation?.TextFormat != null?this.mappingSDMX(dimension.Representation.TextFormat.TextType.EnumType) : BasicDataType.String;

                dataStructure.Identifiers.Add(new StructureComponent(type, dimension.Id, ComponentType.Identifier));
            }

            IPrimaryMeasure primaryMeasure = datastructure.PrimaryMeasure;
            BasicDataType   measureType    = primaryMeasure.Representation?.TextFormat != null?this.mappingSDMX(primaryMeasure.Representation.TextFormat.TextType.EnumType) : BasicDataType.Number;

            dataStructure.Measures.Add(new StructureComponent(measureType, primaryMeasure.Id, ComponentType.Measure));

            foreach (IAttributeObject attribute in datastructure.AttributeList.Attributes)
            {
                BasicDataType type = attribute.Representation?.TextFormat != null?this.mappingSDMX(attribute.Representation.TextFormat.TextType.EnumType) : BasicDataType.String;

                dataStructure.ViralAttributes.Add(new StructureComponent(type, attribute.Id, ComponentType.ViralAttribute));
            }

            return(dataStructure);
        }
 /// <summary>
 /// Builds an object of type <see cref="IDataStructureMutableObject"/> from the specified <paramref name="buildFrom"/>
 /// </summary>
 /// <param name="buildFrom">
 /// An <see cref="ICrossSectionalDataStructureMutableObject"/> object to build the output object from
 /// </param>
 /// <returns>
 /// Object of type <see cref="IDataStructureMutableObject"/>
 /// </returns>
 public IDataStructureMutableObject Build(ICrossSectionalDataStructureMutableObject buildFrom)
 {
     var imutableDsd = new DataStructureObjectCore(buildFrom);
     return new DataStructureMutableCore(imutableDsd);
 }