public string BuildRestDataQuery(IDataQuery query)
 {
     IDataQueryFormat<string> dataQueryFormat = new RestQueryFormat();
     IDataQueryFactory dataQueryFactory = new DataQueryFactory();
     IDataQueryBuilderManager dataQueryBuilderManager = new DataQueryBuilderManager(dataQueryFactory);
     string restDataRequest = dataQueryBuilderManager.BuildDataQuery(query, dataQueryFormat);
     return restDataRequest;
 }
        /// <summary>
        /// Sends the SDMX Query Request
        /// </summary>
        /// <param name="query">
        /// The query
        /// </param>
        /// <param name="tempFileName">
        /// The output stream
        /// </param>
        private void SendSdmxQuery(IDataQuery query, string tempFileName)
        {
            IDataQueryFormat<string> structureQueryFormat= new RestQueryFormat();
            IDataQueryFactory dataQueryFactory = new DataQueryFactory();
            IDataQueryBuilderManager dataQueryBuilderManager = new DataQueryBuilderManager(dataQueryFactory);
            string request = dataQueryBuilderManager.BuildDataQuery(query, structureQueryFormat);

            this.SendRequest(request, tempFileName, RequestType.Data);
        }
        public void TestDataQueryWriterV20(string file, string dataflowFile, string dsdFile)
        {
            var retrievalManager = this.GetSdmxObjectRetrievalManager(dataflowFile, dsdFile);
            using (var fileReadableDataLocation = new FileReadableDataLocation(file))
            {
                IList<IDataQuery> dataQuery = this.dataQueryParseManager.BuildDataQuery(fileReadableDataLocation, retrievalManager);
                Assert.IsNotEmpty(dataQuery);
                IDataQueryFactory factory = new DataQueryFactory();
                IDataQueryBuilder<XDocument> builder = factory.GetDataQueryBuilder(new QueryMessageV2Format());

                foreach (var query in dataQuery)
                {
                  XDocument xQuery = builder.BuildDataQuery(query);
                  Assert.IsNotNull(xQuery);
                }
                

            }
        }
        public void TestRestQueryFormat(string dsd, string dataflow, string query)
        {

            IStructureParsingManager parsingManager = new StructureParsingManager();
            ISdmxObjects objects = new SdmxObjectsImpl();
            using (IReadableDataLocation location = new FileReadableDataLocation(dsd))
            {
                objects.Merge(parsingManager.ParseStructures(location).GetStructureObjects(false));
            }

            using (IReadableDataLocation location = new FileReadableDataLocation(dataflow))
            {
                objects.Merge(parsingManager.ParseStructures(location).GetStructureObjects(false));
            }

            ISdmxObjectRetrievalManager retrievalManager = new InMemoryRetrievalManager(objects);
            IList<IDataQuery> buildDataQuery;
            IDataQueryParseManager parseManager = new DataQueryParseManager(SdmxSchemaEnumType.VersionTwo);
            using (IReadableDataLocation readable = new FileReadableDataLocation(query))
            {
                // call BuildDataQuery to process the query.xml and get a list of IDataQuery
                buildDataQuery = parseManager.BuildDataQuery(readable, retrievalManager);
            }
            IDataQueryFormat<string> structureQueryFormat = new RestQueryFormat();
            IDataQueryFactory dataQueryFactory = new DataQueryFactory();
            foreach (var dataQuery in buildDataQuery)
            {
                IDataQueryBuilderManager dataQueryBuilderManager = new DataQueryBuilderManager(dataQueryFactory);
                string request = dataQueryBuilderManager.BuildDataQuery(dataQuery, structureQueryFormat);
                Assert.IsNotNull(request);
            }

        }