本文整理汇总了C#中IDataStructureObject类的典型用法代码示例。如果您正苦于以下问题:C# IDataStructureObject类的具体用法?C# IDataStructureObject怎么用?C# IDataStructureObject使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IDataStructureObject类属于命名空间,在下文中一共展示了IDataStructureObject类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ValidateForCompact
/// <summary>
/// This method checks a dsd for compliance with producing Compact Data.
/// In detail, it checks that if a TimeDimension is present and at least
/// one dimension is frequency dimension. If there is none an error message
/// is returned to the caller
/// </summary>
/// <param name="dsd">
/// The <see cref="Estat.Sdmx.Model.Structure.KeyFamilyBean"/>of the DSD to be checked
/// </param>
/// <returns>
/// The error messages in case of invalid dsd or an empty string in case a valid dsd
/// </returns>
public static string ValidateForCompact(IDataStructureObject dsd)
{
string text = string.Empty;
bool isFrequency = false;
foreach (IDimension dimension in dsd.DimensionList.Dimensions)
{
if (dimension.FrequencyDimension)
{
isFrequency = true;
break;
}
}
if (dsd.TimeDimension == null)
{
// text= "Dsd does not have at least one Frequency dimension";
text = "DSD " + dsd.Id + " v" + dsd.Version
+ " does not have a Time Dimension. Only Cross-Sectional data may be requested.";
}
else if (!isFrequency)
{
// normally it should never reach here
text = "DSD " + dsd.Id + " v" + dsd.Version
+
" does not have a Frequency dimension. According SDMX v2.0: Any DSD which uses the Time dimension must also declare a frequency dimension.";
}
return text;
}
示例2: ValidateForCompact
/// <summary>
/// This method checks a DSD for compliance with producing Compact Data.
/// In detail, it checks that if a TimeDimension is present and at least
/// one dimension is frequency dimension. If there is none an error message
/// is returned to the caller
/// </summary>
/// <param name="keyFamily">
/// The <see cref="IDataStructureObject"/>of the DSD to be checked
/// </param>
/// <returns>
/// The error messages in case of invalid DSD or an empty string in case a valid DSD
/// </returns>
public static string ValidateForCompact(IDataStructureObject keyFamily)
{
string text = string.Empty;
bool isFrequency = false;
foreach (IDimension dimension in keyFamily.DimensionList.Dimensions)
{
if (dimension.FrequencyDimension)
{
isFrequency = true;
break;
}
}
if (keyFamily.TimeDimension == null)
{
text = string.Format(
CultureInfo.InvariantCulture, Resources.ErrorNoTimeDimensionFormat2, keyFamily.Id, keyFamily.Version);
}
else if (!isFrequency)
{
// normally it should never reach here
text = "DSD " + keyFamily.Id + " v" + keyFamily.Version
+ " does not have a Frequency dimension. According SDMX v2.0: Any DSD which uses the Time dimension must also declare a frequency dimension.";
}
return text;
}
示例3: DataParseMetadata
/// <summary>
/// Initializes a new instance of the <see cref="DataParseMetadata"/> class.
/// </summary>
/// <param name="sourceData">
/// The readable data location
/// </param>
/// <param name="outPutStream">
/// The output stream
/// </param>
/// <param name="outputSchemaVersion">
/// The output schema version
/// </param>
/// <param name="keyFamily">
/// The key family
/// </param>
public DataParseMetadata(IReadableDataLocation sourceData, Stream outPutStream, SdmxSchema outputSchemaVersion, IDataStructureObject keyFamily)
{
this._sourceData = sourceData;
this._outPutStream = outPutStream;
this._dataStructure = keyFamily;
this._outputSchemaVersion = outputSchemaVersion;
}
示例4: GetAttributeList
public List<Entity.Attribute> GetAttributeList(IDataStructureObject attObject, string localization)
{
List<Entity.Attribute> lAttribute = new List<Entity.Attribute>();
if (attObject.AttributeList == null)
return null;
foreach (IAttributeObject attribute in attObject.AttributeList.Attributes)
{
string TextFormat = String.Empty;
string CodeList = String.Empty;
if (attribute.Representation != null && attribute.Representation.Representation != null)
{
ICrossReference rep = attribute.Representation.Representation;
CodeList = rep.MaintainableId + ","+ rep.AgencyId +","+ rep.Version;
if (attribute.Representation.TextFormat != null)
TextFormat = attribute.Representation.TextFormat.TextType.EnumType.ToString();
}
lAttribute.Add(new Entity.Attribute(attribute.Id, attribute.ConceptRef.MaintainableId + "," + attribute.ConceptRef.AgencyId + "," + attribute.ConceptRef.Version + " - " + attribute.ConceptRef.FullId, CodeList, TextFormat, attribute.AssignmentStatus, attribute.AttachmentLevel.ToString()));
}
return lAttribute;
}
示例5: GetDataReaderEngine
/// <summary>
/// Obtains a DataReaderEngine that is capable of reading the data which is exposed via the ReadableDataLocation
/// </summary>
/// <param name="sourceData">The source data, giving access to an InputStream of the data.</param>
/// <param name="dsd">The Data Structure Definition, describes the data in terms of the dimensionality.</param>
/// <param name="dataflow">The dataflow (optional). Provides further information about the data.</param>
/// <returns>The <see cref="IDataReaderEngine"/>; otherwise null if the <paramref name="sourceData"/> cannot be read.</returns>
/// <exception cref="ArgumentNullException"><paramref name="sourceData"/> is null -or- <paramref name="dsd"/> is null</exception>
public IDataReaderEngine GetDataReaderEngine(IReadableDataLocation sourceData, IDataStructureObject dsd, IDataflowObject dataflow)
{
_log.Debug("Get DataReader Engine");
if (sourceData == null)
{
throw new ArgumentNullException("sourceData");
}
if (dsd == null)
{
throw new ArgumentNullException("dsd");
}
MessageEnumType messageType;
try
{
messageType = SdmxMessageUtil.GetMessageType(sourceData);
}
catch (Exception e)
{
_log.Error("While trying to get the message type.", e);
return null;
}
var dataFormat = this.GetDataFormat(sourceData, messageType);
if (dataFormat != null && dataFormat.SdmxDataFormat != null)
{
switch (dataFormat.SdmxDataFormat.BaseDataFormat.EnumType)
{
case BaseDataFormatEnumType.Compact:
return new CompactDataReaderEngine(sourceData, dataflow, dsd);
case BaseDataFormatEnumType.Generic:
return new GenericDataReaderEngine(sourceData, dataflow, dsd);
case BaseDataFormatEnumType.CrossSectional:
var crossDsd = dsd as ICrossSectionalDataStructureObject;
if (crossDsd == null)
{
throw new SdmxNotImplementedException("Not supported. Reading from CrossSectional Data for non cross-sectional dsd.");
}
return new CrossSectionalDataReaderEngine(sourceData, crossDsd, dataflow);
case BaseDataFormatEnumType.Edi:
if (this._ediParseManager != null)
{
return this._ediParseManager.ParseEdiMessage(sourceData).GetDataReader(dsd, dataflow);
}
break;
default:
_log.WarnFormat("SdmxDataReaderFactory encountered unsupported SDMX format: {0} ", dataFormat);
break;
}
}
return null;
}
示例6: GetGroupAttribtueConcepts
/// <summary>
/// Returns the concepts of all the dimensions and attributes that are not attached at the observation level.
/// </summary>
/// <param name="dataStructureObject">
/// The data structure object
/// </param>
/// <returns>
/// The concepts of all the dimensions and attributes that are not attached at the observation level.
/// </returns>
public static IList<string> GetGroupAttribtueConcepts(IDataStructureObject dataStructureObject)
{
IList<string> keyConcepts = new List<string>();
foreach (IAttributeObject currentBean in dataStructureObject.GroupAttributes)
{
keyConcepts.Add(currentBean.Id);
}
return keyConcepts;
}
示例7: ValidateForCrossSectional
/// <summary>
/// This method checks a DSD for compliance with producing Cross-Sectional Data.
/// In detail, it checks all Dimensions and all Attributes for having or not having
/// cross-sectional attachment group. If there are components with no attachment level,
/// it returns a list with them in the message.
/// </summary>
/// <param name="keyFamily">
/// The <see cref="IDataStructureObject"/>of the DSD to be checked
/// </param>
/// <returns>
/// The error messages in case of invalid DSD or an empty string in case a valid DSD
/// </returns>
public static string ValidateForCrossSectional(IDataStructureObject keyFamily)
{
var crossSectionalDataStructure = keyFamily as ICrossSectionalDataStructureObject;
if (crossSectionalDataStructure == null)
{
return "Not a cross-sectional DSD";
}
return string.Empty;
}
示例8: AttributeListCore
///////////////////////////////////////////////////////////////////////////////////////////////////
////////////BUILD FROM MUTABLE OBJECTS //////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////
#region Constructors and Destructors
/// <summary>
/// Initializes a new instance of the <see cref="AttributeListCore"/> class.
/// </summary>
/// <param name="itemMutableObject">
/// The sdmxObject.
/// </param>
/// <param name="parent">
/// The parent.
/// </param>
public AttributeListCore(IAttributeListMutableObject itemMutableObject, IDataStructureObject parent)
: base(itemMutableObject, parent)
{
this.attributes = new List<IAttributeObject>();
if (itemMutableObject.Attributes != null)
{
foreach (IAttributeMutableObject currentAttribute in itemMutableObject.Attributes)
{
this.attributes.Add(new AttributeObjectCore(currentAttribute, this));
}
}
}
示例9: GetDataReaderEngine
/// <summary>
/// Obtains a DataReaderEngine that is capable of reading the data which is exposed via the ReadableDataLocation
/// </summary>
/// <param name="sourceData">
/// SourceData - giving access to an InputStream of the data
/// </param>
/// <param name="dsd">
/// Describes the data in terms of the dimensionality
/// </param>
/// <param name="dataflowObject">
/// The data flow object (optional)
/// </param>
/// <returns>
/// The data reader engine
/// </returns>
/// throws SdmxNotImplementedException if ReadableDataLocation or DataStructureBean is null, also if additioanlInformation is not of the expected type
public IDataReaderEngine GetDataReaderEngine(IReadableDataLocation sourceData, IDataStructureObject dsd, IDataflowObject dataflowObject)
{
foreach (var currentFactory in this._engines)
{
IDataReaderEngine dre = currentFactory.GetDataReaderEngine(sourceData, dsd, dataflowObject);
if (dre != null)
{
return dre;
}
}
throw new SdmxNotImplementedException("Data format is either not supported, or has an invalid syntax");
}
示例10: Build
public IDataQuery Build(IDataStructureObject dsd, IDataflowObject dataflowObject)
{
IDataQuerySelection dataQuerySelection = new DataQueryDimensionSelectionImpl("FREQ", "M", "A");
IDataQuerySelectionGroup dataQuerySelectionGroup = new DataQuerySelectionGroupImpl(new HashSet<IDataQuerySelection> { dataQuerySelection }, new SdmxDateCore("2000-01"), new SdmxDateCore("2005-03"));
return new DataQueryImpl(
dataStructure: dsd,
lastUpdated: null,
dataQueryDetail: DataQueryDetail.GetFromEnum(DataQueryDetailEnumType.Full),
firstNObs: null,
lastNObs: null,
dataProviders: null,
dataflow: dataflowObject,
dimensionAtObservation: "TIME_PERIOD",
selectionGroup: new[] { dataQuerySelectionGroup });
}
示例11: DimensionListCore
///////////////////////////////////////////////////////////////////////////////////////////////////
////////////BUILD FROM MUTABLE OBJECTS //////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////
#region Constructors and Destructors
/// <summary>
/// Initializes a new instance of the <see cref="DimensionListCore"/> class.
/// </summary>
/// <param name="itemMutableObject">
/// The agencyScheme.
/// </param>
/// <param name="parent">
/// The parent.
/// </param>
public DimensionListCore(IDimensionListMutableObject itemMutableObject, IDataStructureObject parent)
: base(itemMutableObject, parent)
{
this.dimensions = new List<IDimension>();
if (itemMutableObject.Dimensions != null)
{
int pos = 1;
foreach (IDimensionMutableObject currentDimension in itemMutableObject.Dimensions)
{
this.dimensions.Add(new DimensionCore(currentDimension, pos, this));
pos++;
}
}
}
示例12: DataStructureObjectBaseCore
public DataStructureObjectBaseCore(IDataStructureObject dataStructure,
IList<IDimensionObjectBase> dimensions,
IList<IAttributeObjectBase> attributes,
IPrimaryMeasureObjectBase primaryMeasure) : base(dataStructure) {
this._groups = new List<IGroupObjectBase>();
this._conceptComponentMap = new Dictionary<String, IComponentObjectBase>();
this._conceptCodelistMap = new Dictionary<String, ICodelistObjectBase>();
this._referencedCodelists = new HashSet<ICodelistObjectBase>();
this.keyFamily = dataStructure;
this._dimensions = dimensions;
this._attributes = attributes;
this._primaryMeasure = primaryMeasure;
//Create Mapping of Concept Id To Dimension that refers to that concept
conceptDimensionMap = new Dictionary<String, IDimensionObjectBase>();
/* foreach */
foreach (IDimensionObjectBase currentDimension in dimensions) {
conceptDimensionMap.Add(currentDimension.Id, currentDimension);
_conceptComponentMap.Add(currentDimension.Id , currentDimension);
if (currentDimension.GetCodelist(true) != null) {
_conceptCodelistMap.Add(currentDimension.Id, currentDimension.GetCodelist(true));
_referencedCodelists.Add(currentDimension.GetCodelist(true));
}
}
if (attributes != null) {
/* foreach */
foreach (IAttributeObjectBase attributeObjectBase in attributes) {
_conceptComponentMap.Add(attributeObjectBase.Id , attributeObjectBase);
if (attributeObjectBase.GetCodelist(true) != null) {
_conceptCodelistMap.Add(attributeObjectBase.Id, attributeObjectBase.GetCodelist(true));
_referencedCodelists.Add(attributeObjectBase.GetCodelist(true));
}
}
}
if (primaryMeasure != null) {
_conceptComponentMap.Add(primaryMeasure.Id, primaryMeasure);
if (primaryMeasure.GetCodelist(true) != null) {
_conceptCodelistMap.Add(primaryMeasure.Id, primaryMeasure.GetCodelist(true));
_referencedCodelists.Add(primaryMeasure.GetCodelist(true));
}
}
/* foreach */
foreach (IGroup currentGroup in dataStructure.Groups) {
_groups.Add(new GroupObjectBaseCore(currentGroup, this));
}
}
示例13: WriteSampleData
public void WriteSampleData(IDataStructureObject dsd, IDataflowObject dataflow, IDataWriterEngine dwe) {
dwe.StartDataset(dataflow, dsd, null);
dwe.StartSeries();
dwe.WriteSeriesKeyValue("COUNTRY", "UK");
dwe.WriteSeriesKeyValue("INDICATOR", "E_P");
dwe.WriteObservation("2000", "18,22");
dwe.WriteObservation("2000-02", "17,63");
dwe.StartSeries();
dwe.WriteSeriesKeyValue("COUNTRY", "FR");
dwe.WriteSeriesKeyValue("INDICATOR", "E_P");
dwe.WriteObservation("2000", "22,22");
dwe.WriteObservation("2000-Q3", "15,63");
dwe.Close();
}
示例14: BuildConceptSchemeRequest
/// <summary>
/// Build concept scheme requests from the concept scheme references of the specified KeyFamilyBean object
/// </summary>
/// <param name="kf">
/// The KeyFamily to look for concept Scheme references
/// </param>
/// <returns>
/// A list of concept scheme requests
/// </returns>
public static IEnumerable<IStructureReference> BuildConceptSchemeRequest(IDataStructureObject kf)
{
var conceptSchemeSet = new Dictionary<string, object>();
var ret = new List<IStructureReference>();
var crossDsd = kf as ICrossSectionalDataStructureObject;
List<IComponent> components = new List<IComponent>();
components.AddRange(kf.GetDimensions());
components.AddRange(kf.Attributes);
if (kf.PrimaryMeasure != null)
{
components.Add(kf.PrimaryMeasure);
}
if (crossDsd != null)
{
components.AddRange(crossDsd.CrossSectionalMeasures);
}
ICollection<IComponent> comps = components;
foreach (IComponent comp in comps)
{
string key = Utils.MakeKey(comp.ConceptRef.MaintainableReference.MaintainableId, comp.ConceptRef.MaintainableReference.Version, comp.ConceptRef.MaintainableReference.AgencyId);
if (!conceptSchemeSet.ContainsKey(key))
{
// create concept ref
var conceptSchemeRef = new StructureReferenceImpl(SdmxStructureType.GetFromEnum(SdmxStructureEnumType.ConceptScheme))
{
MaintainableId = comp.ConceptRef.MaintainableReference.MaintainableId,
AgencyId = comp.ConceptRef.MaintainableReference.AgencyId,
Version = comp.ConceptRef.MaintainableReference.Version
};
// add it to request
ret.Add(conceptSchemeRef);
// added it to set of visited concept schemes
conceptSchemeSet.Add(key, null);
}
}
return ret;
}
示例15: writeSampleData
public void writeSampleData(IDataStructureObject dsd, IDataflowObject dataflow, IDataWriterEngine dwe){
//Step 1. Writing sample data.
//1) Start the dataset
dwe.StartDataset(dataflow, dsd, null);
//2) Start the dataset series
dwe.StartSeries();
//3) Write dimensions
dwe.WriteSeriesKeyValue("FREQ", "Q");
dwe.WriteSeriesKeyValue("REF_AREA","IT");
dwe.WriteSeriesKeyValue("ADJUSTMENT","W");
dwe.WriteSeriesKeyValue("STS_INDICATOR","E_P");
dwe.WriteSeriesKeyValue("STS_ACTIVITY","NS0020");
dwe.WriteSeriesKeyValue("STS_INSTITUTION","1");
dwe.WriteSeriesKeyValue("STS_BASE_YEAR","2000");
//4) Write Attribute at Series Level
dwe.WriteAttributeValue("TIME_FORMAT", "P3M");
//5) Write the observations
dwe.WriteObservation("2000-Q1", "18,22");
dwe.WriteObservation("2000-Q2", "17,63");
//6) Write Attribute at Observation Level
dwe.WriteAttributeValue("OBS_STATUS", "C");
//7) Repeat the steps from 2 to 6 to create another dataset series
dwe.StartSeries();
dwe.WriteSeriesKeyValue("FREQ", "M");
dwe.WriteSeriesKeyValue("REF_AREA", "SP");
dwe.WriteSeriesKeyValue("ADJUSTMENT", "N");
dwe.WriteSeriesKeyValue("STS_INDICATOR", "PROD");
dwe.WriteSeriesKeyValue("STS_ACTIVITY", "NS0030");
dwe.WriteSeriesKeyValue("STS_INSTITUTION", "1");
dwe.WriteSeriesKeyValue("STS_BASE_YEAR", "2001");
dwe.WriteAttributeValue("TIME_FORMAT", "P1M");
dwe.WriteObservation("2000-01", "18,22");
dwe.WriteObservation("2000-02", "17,63");
dwe.WriteAttributeValue("OBS_STATUS", "S");
//8) Close the dataset
dwe.Close();
}