/// <summary>
            /// Builds a data query from <paramref name="dataWhereType"/>
            /// </summary>
            /// <param name="dataWhereType">
            /// The data Where Type.
            /// </param>
            /// <param name="structureRetrievalManager">
            /// The structure Retrieval Manager.
            /// </param>
            /// <returns>
            /// The <see cref="IDataQuery"/>.
            /// </returns>
            public IDataQuery BuildDataQuery(
                DataWhereType dataWhereType, ISdmxObjectRetrievalManager structureRetrievalManager)
            {
                if (structureRetrievalManager == null)
                {
                    throw new ArgumentNullException("structureRetrievalManager");
                }

                this.ProcessDataWhere(dataWhereType);
                this.ProcessAnd(dataWhereType.And);

                IMaintainableRefObject flowRef = new MaintainableRefObjectImpl(
                    this._agencyId, this._dataflowId, this._version);
                IDataflowObject dataflow = structureRetrievalManager.GetMaintainableObject<IDataflowObject>(flowRef);
                if (dataflow == null)
                {
                    throw new SdmxNoResultsException("Dataflow not found: " + flowRef);
                }

                IMaintainableRefObject dsdRef = dataflow.DataStructureRef.MaintainableReference;
                IDataStructureObject dataStructureBean = structureRetrievalManager.GetMaintainableObject<IDataStructureObject>(dsdRef);
                if (dataStructureBean == null)
                {
                    throw new SdmxNoResultsException("Data Structure not found: " + dsdRef);
                }

                // TODO check if DSD is v2.0 compatible
                if (!dataStructureBean.IsCompatible(SdmxSchema.GetFromEnum(SdmxSchemaEnumType.VersionTwo)))
                {
                    throw new SdmxSemmanticException("DataStructure used for this dataflow is not SDMX v2.0 compatible.");
                }

                var convertedDataQuerySelectionGroups = ConvertConceptIdToComponentId(this._dataQuerySelectionGroups, dataStructureBean);

                // FUNC Data Provider
                return new DataQueryImpl(
                    dataStructureBean,
                    null,
                    null,
                    this._defaultLimit /* was null TODO */,
                    true,
                    null,
                    dataflow,
                    null,
                    convertedDataQuerySelectionGroups);
            }
            /// <summary>
            /// Process the <paramref name="dataWhereType"/>.
            /// </summary>
            /// <param name="dataWhereType">
            /// The data where type.
            /// </param>
            private void ProcessDataWhere(DataWhereType dataWhereType)
            {
                ISet<IDataQuerySelection> selections = new HashSet<IDataQuerySelection>();
                ISdmxDate dateFrom = null;
                ISdmxDate dateTo = null;

                this._dataflowId = dataWhereType.Dataflow;
                this._keyFamilyId = dataWhereType.KeyFamily;
                this._version = dataWhereType.Version;

                if (dataWhereType.Time != null)
                {
                    var t = new Time(dataWhereType.Time);
                    dateFrom = t.DateFrom;
                    dateTo = t.DateTo;
                }

                if (dataWhereType.Dimension != null)
                {
                    IDataQuerySelection newSelection = new DataQueryDimensionSelectionImpl(
                        dataWhereType.Dimension.id, dataWhereType.Dimension.TypedValue);

                    selections.Add(newSelection);
                }

                if (dataWhereType.Attribute != null)
                {
                    IDataQuerySelection newSelection0 = new DataQueryDimensionSelectionImpl(
                        dataWhereType.Attribute.id, dataWhereType.Attribute.TypedValue);

                    selections.Add(newSelection0);
                }

                this.ProcessOr(dataWhereType.Or, selections);
                this.AddGroupIfSelectionsExist(selections, dateFrom, dateTo);
            }
 /// <summary>
 /// Build data query from the specified <paramref name="dataWhereType"/>
 /// </summary>
 /// <param name="dataWhereType">
 /// The data where type.
 /// </param>
 /// <param name="structureRetrievalManager">
 /// The structure retrieval manager.
 /// </param>
 /// <param name="defaultLimit"> The default limit</param>
 /// <returns>
 /// The data query from the specified <paramref name="dataWhereType"/>
 /// </returns>
 public IDataQuery BuildDataQuery(
     DataWhereType dataWhereType, ISdmxObjectRetrievalManager structureRetrievalManager, int defaultLimit)
 {
     return new DataQueryProcessor(defaultLimit).BuildDataQuery(dataWhereType, structureRetrievalManager);
 }