public override void Compute()
        {
            TLArtifactsCollection sourceArtifacts = (TLArtifactsCollection)Workspace.Load("sourceArtifacts");
            TLArtifactsCollection targetArtifacts = (TLArtifactsCollection)Workspace.Load("targetArtifacts");

            if (sourceArtifacts == null)
            {
                throw new ArgumentException("Source artifacts cannot be null.");
            }

            if (targetArtifacts == null)
            {
                throw new ArgumentException("Target artifacts cannot be null.");
            }

            string error;

            //do validation
            if (CoestDatasetImporterHelper.ValidatePath(m_config.FilePath, "Answer Set File", out error))
            {
                var answerMatrix = CoestDatasetImporterHelper.ImportAnswerSet(m_config.FilePath, sourceArtifacts, targetArtifacts, Logger, m_config.TrimElementValues);
                Workspace.Store("answerMatrix", answerMatrix);
                Logger.Trace(String.Format("Answer matrix imported from {0}.", m_config.FilePath));
            }
            else
            {
                throw new ArgumentException(error);
            }
        }
        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);
        }
Exemplo n.º 3
0
        public override void Compute()
        {
            string error;

            //do validation
            if (CoestDatasetImporterHelper.ValidatePath(m_config.FilePath, "Answer Set File", out error))
            {
                var answerMatrix = CoestDatasetImporterHelper.ImportAnswerSet(m_config.FilePath, Logger, m_config.TrimElementValues);
                Workspace.Store("answerMatrix", answerMatrix);
                Logger.Trace(String.Format("Answer matrix imported from {0}.", m_config.FilePath));
            }
            else
            {
                throw new ArgumentException(error);
            }
        }