本文整理汇总了C#中IDataflowObject类的典型用法代码示例。如果您正苦于以下问题:C# IDataflowObject类的具体用法?C# IDataflowObject怎么用?C# IDataflowObject使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
IDataflowObject类属于命名空间,在下文中一共展示了IDataflowObject类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: 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;
}
示例2: Log
/// <summary>
/// Logs the specified dataflow identifier.
/// </summary>
/// <param name="dataflow">The dataflow identifier.</param>
/// <exception cref="ArgumentNullException"><paramref name="dataflow"/> is <see langword="null" />.</exception>
public void Log(IDataflowObject dataflow)
{
if (dataflow == null)
{
throw new ArgumentNullException("dataflow");
}
_log.InfoFormat("{0}{1}{2}", dataflow.Id, this._separator, this._dataFormat);
}
示例3: DataflowObjectBaseCore
public DataflowObjectBaseCore(IDataflowObject dataflow,
IDataStructureObjectBase keyFamily0) : base(dataflow) {
if (keyFamily0 == null) {
throw new ValidationException(
"DataflowObjectBaseCore requires IKeyFamilyObjectBase");
}
this._keyFamily = keyFamily0;
this._dataflow = dataflow;
//TODO Build KeyFamily Ref once the uniqueness constraints have been implemented on the schemas
}
示例4: 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");
}
示例5: UpdateReferences
/// <summary>
/// The update references.
/// </summary>
/// <param name="maintianable">
/// The maintianable.
/// </param>
/// <param name="updateReferences">
/// The update references.
/// </param>
/// <param name="newVersionNumber">
/// The new version number.
/// </param>
/// <returns>
/// The <see cref="IDataflowObject"/>.
/// </returns>
public IDataflowObject UpdateReferences(IDataflowObject maintianable, IDictionary<IStructureReference, IStructureReference> updateReferences, string newVersionNumber)
{
IDataflowMutableObject df = maintianable.MutableInstance;
df.Version = newVersionNumber;
IStructureReference newTarget = updateReferences[df.DataStructureRef];
if (newTarget != null)
{
df.DataStructureRef = newTarget;
}
return df.ImmutableInstance;
}
示例6: 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 });
}
示例7: 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();
}
示例8: 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();
}
示例9: GetDefaultLayout
public static LayoutObj GetDefaultLayout(IDataflowObject df, IDataStructureObject kf)
{
LayoutObj lay = FindInConfigFile(df, kf);
if (lay != null)
return lay;
lay = new LayoutObj();
foreach (var item in kf.DimensionList.Dimensions)
{
if (item.TimeDimension)
lay.axis_y.Add(item.Id);
else if (item.FrequencyDimension)
lay.axis_z.Add(item.Id);
else
lay.axis_x.Add(item.Id);
}
return lay;
}
示例10: StartDataset
public void StartDataset(string dsdName, IDataflowObject dataflow, IDataStructureObject dsd, IDatasetHeader header, params IAnnotation[] annotations)
{
string appPath = System.Web.HttpRuntime.AppDomainAppPath;
string giorno = System.Web.HttpContext.Current.Timestamp.Day.ToString();
string ora = System.Web.HttpContext.Current.Timestamp.Hour.ToString();
string min = System.Web.HttpContext.Current.Timestamp.Minute.ToString();
string secondi = System.Web.HttpContext.Current.Timestamp.Second.ToString();
string ms = System.Web.HttpContext.Current.Timestamp.Millisecond.ToString();
string namedir = giorno + ora + min + secondi + ms;
dirPath = appPath + namedir;
DirectoryInfo MyRoot = new DirectoryInfo(@appPath);
MyRoot.CreateSubdirectory(namedir);
IList<IDimension> dimensions = dsd.GetDimensions(SdmxStructureEnumType.Dimension);
string[] ordinamento1 = new string[dimensions.Count];
string[] ordinamento2 = new string[dsd.Components.Count];
ordine = new string[dimensions.Count];
ordineser = new string[dimensions.Count];
int indord = 0;
string valoredati = "";
IList<IDimension> dimensions1 = dsd.GetDimensions(SdmxStructureEnumType.Dimension);
foreach (IDimension dim in dimensions1)
{
_CsvZipDataWriter.WriteValue(dim.Id + "_code,");
valoredati += dim.Id + "_code,";
ordine[indord] = dim.Id;
indord++;
}
valoredati += "VALUE,date";
string newLinedati = string.Format("{0}{1}", valoredati, Environment.NewLine);
csvdati.Append(newLinedati);
}
示例11: VerifyNames
public List<DsplStructure.Languages> VerifyNames(IDataflowObject dataflow)
{
var Languages = new List<DsplStructure.Languages>();
var Lang = new DsplStructure.Languages();
bool exists = new bool();
foreach (var item in dataflow.Names)
{
foreach (var lang in Languages)
{
if (lang.lang == item.Locale)
{
exists = true;
}
}
if (!exists)
{
Lang.lang = item.Locale;
Languages.Add(Lang);
}
}
return Languages;
}
示例12: StartDataset
/// <summary>
/// Starts a dataset with the data conforming to the DSD
/// </summary>
/// <param name="dataflow">Optional. The dataflow can be provided to give extra information about the dataset.</param>
/// <param name="dsd">The <see cref="IDataStructureObject" /> for which the dataset will be created</param>
/// <param name="header">The <see cref="IHeader" /> of the dataset</param>
/// <param name="annotations">Any additional annotations that are attached to the dataset, can be null if no annotations exist</param>
/// <exception cref="System.ArgumentNullException">if the <paramref name="dsd" /> is null</exception>
public override void StartDataset(IDataflowObject dataflow, IDataStructureObject dsd, IDatasetHeader header, params IAnnotation[] annotations)
{
base.StartDataset(dataflow, dsd, header, annotations);
this._primaryMeasureConcept = this.GetComponentId(dsd.PrimaryMeasure);
this._compactNs = this.TargetSchema.EnumType != SdmxSchemaEnumType.VersionTwoPointOne
? this.Namespaces.DataSetStructureSpecific
: NamespacePrefixPair.Empty;
this._obsConcept = this.IsTwoPointOne
? this.DimensionAtObservation
: ConceptRefUtil.GetConceptId(this.KeyFamily.TimeDimension.ConceptRef);
if (this.IsTwoPointOne)
{
this.WriteAnnotations(ElementNameTable.AnnotationType, annotations);
}
else
{
this._datasetAnnotations = annotations;
}
}
示例13: KeyableImpl
/// <summary>
/// Initializes a new instance of the <see cref="KeyableImpl" /> class.
/// </summary>
/// <param name="dataflowObject">The dataflow object.</param>
/// <param name="dataStructureObject">The data structure object.</param>
/// <param name="key">The key .</param>
/// <param name="attributes">The attributes .</param>
/// <param name="groupName">The group name .</param>
/// <param name="timeFormat">The time format .</param>
/// <param name="annotations">The annotations.</param>
/// <exception cref="System.ArgumentException">Data Structure can not be null</exception>
public KeyableImpl(IDataflowObject dataflowObject,
IDataStructureObject dataStructureObject,
IList<IKeyValue> key, IList<IKeyValue> attributes, string groupName, TimeFormat timeFormat
,params IAnnotation[] annotations)
{
this._dataStructure = dataStructureObject;
this._dataflow = dataflowObject;
this._attributes = new List<IKeyValue>();
this._key = new List<IKeyValue>();
this._attributeMap = new Dictionary<string, IKeyValue>();
this._keyMap = new Dictionary<string, string>();
this._annotations = new List<IAnnotation>();
this._isTimeSeries = true;
if (_dataStructure == null)
{
throw new ArgumentException("Data Structure can not be null");
}
this._series = string.IsNullOrWhiteSpace(groupName);
if (attributes != null)
{
this._attributes = new List<IKeyValue>(attributes);
foreach (IKeyValue currentKv in attributes)
{
this._attributeMap.Add(currentKv.Concept, currentKv);
}
}
if (key != null)
{
this._key = new List<IKeyValue>(key);
foreach (IKeyValue currentKv4 in key)
{
this._keyMap.Add(currentKv4.Concept, currentKv4.Code);
}
}
if(annotations != null)
{
foreach(IAnnotation currentAnnotation in annotations)
{
this._annotations.Add(currentAnnotation);
}
}
this._groupName = groupName;
this._timeFormat = timeFormat;
}
示例14: AbstractSdmxDataReaderEngine
/// <summary>
/// Initializes a new instance of the <see cref="AbstractSdmxDataReaderEngine"/> class.
/// </summary>
/// <param name="dataLocation">
/// The data Location.
/// </param>
/// <param name="objectRetrieval">
/// The SDMX Object Retrieval. giving the ability to retrieve DSDs for the datasets this
/// reader engine is reading. This can be null if there is only one relevant DSD - in which case the
/// <paramref name="defaultDsd"/> should be provided.
/// </param>
/// <param name="defaultDataflow">
/// The default Dataflow. (Optional)
/// </param>
/// <param name="defaultDsd">
/// The default DSD. The default DSD to use if the <paramref name="objectRetrieval"/> is null, or
/// if the bean retrieval does not return the DSD for the given dataset.
/// </param>
/// <exception cref="System.ArgumentException">
/// AbstractDataReaderEngine expects either a ISdmxObjectRetrievalManager or a
/// IDataStructureObject to be able to interpret the structures
/// </exception>
protected AbstractSdmxDataReaderEngine(IReadableDataLocation dataLocation, ISdmxObjectRetrievalManager objectRetrieval, IDataflowObject defaultDataflow, IDataStructureObject defaultDsd)
: base(dataLocation, objectRetrieval, defaultDataflow, defaultDsd)
{
this._isTwoPointOne = SdmxMessageUtil.GetSchemaVersion(dataLocation) == SdmxSchemaEnumType.VersionTwoPointOne;
}
示例15: CompactDataReaderEngine
/// <summary>
/// Initializes a new instance of the <see cref="CompactDataReaderEngine"/> class.
/// </summary>
/// <param name="dataLocation">
/// The data Location.
/// </param>
/// <param name="defaultDataflow">
/// The default Dataflow. (Optional)
/// </param>
/// <param name="defaultDsd">
/// The default DSD. The default DSD to use if the
/// <paramref>
/// <name>objectRetrieval</name>
/// </paramref>
/// is null, or
/// if the bean retrieval does not return the DSD for the given dataset.
/// </param>
/// <exception cref="System.ArgumentException">
/// AbstractDataReaderEngine expects either a ISdmxObjectRetrievalManager or a
/// IDataStructureObject to be able to interpret the structures
/// </exception>
public CompactDataReaderEngine(IReadableDataLocation dataLocation, IDataflowObject defaultDataflow, IDataStructureObject defaultDsd)
: this(dataLocation, null, defaultDataflow, defaultDsd)
{
}