public override void Compute()
        {
            var datasetsLocations = ReadDatasetsLocations();

            TLDatasetsList listOfDatasets = new TLDatasetsList();

            foreach (DatasetLocation locations in datasetsLocations)
            {
                TLDataset dataset = new TLDataset(locations.DatasetName);

                string error;

                //do validation
                if (CoestDatasetImporterHelper.ValidatePath(locations.SourceArtifactsLocation, "Source Artifacts File", out error))
                {
                    dataset.SourceArtifacts = CoestDatasetImporterHelper.ImportArtifacts(locations.SourceArtifactsLocation, m_config.TrimElementValues);
                    Logger.Info(String.Format("Source artifacts imported from {0}.", locations.SourceArtifactsLocation));
                }
                else
                {
                    throw new ComponentException(error);
                }

                //do validation
                if (CoestDatasetImporterHelper.ValidatePath(locations.SourceArtifactsLocation, "Target Artifacts File", out error))
                {
                    dataset.TargetArtifacts = CoestDatasetImporterHelper.ImportArtifacts(locations.TargetArtifactsLocation, m_config.TrimElementValues);
                    Logger.Info(String.Format("Target artifacts imported from {0}.", locations.TargetArtifactsLocation));
                }
                else
                {
                    throw new ComponentException(error);
                }

                //do validation
                if (CoestDatasetImporterHelper.ValidatePath(locations.SourceArtifactsLocation, "Target Artifacts File", out error))
                {
                    dataset.AnswerSet = CoestDatasetImporterHelper.ImportAnswerSet(locations.AnswerSetLocation, dataset.SourceArtifacts, locations.SourceArtifactsLocation, dataset.TargetArtifacts, locations.TargetArtifactsLocation, Logger, m_config.TrimElementValues);
                    Logger.Info(String.Format("Answer set imported from {0}.", locations.AnswerSetLocation));
                }
                else
                {
                    throw new ComponentException(error);
                }

                listOfDatasets.Add(dataset);
            }

            Workspace.Store("listOfDatasets", listOfDatasets);
            Workspace.Store("numberOfDatasets", listOfDatasets.Count);
        }
Esempio n. 2
0
        public override void Compute()
        {
            string error;

            //do validation
            if (CoestDatasetImporterHelper.ValidatePath(m_config.FilePath, "Artifacts File", out error))
            {
                CoestDatasetImporterHelper.Logger = this.Logger;
                var artifacts = CoestDatasetImporterHelper.ImportArtifacts(m_config.FilePath, m_config.TrimElementValues);
                Workspace.Store("listOfArtifacts", artifacts);
                Logger.Info(String.Format("Collection of artifacts with id '{0}' imported from {1}.", artifacts.CollectionId, m_config.FilePath));
            }
            else
            {
                throw new ComponentException(error);
            }
        }