public override void RunCommand(CalledCommand calledCommand) { string pathDataDir; if (!GetPathOrDefault(calledCommand, out pathDataDir)) { FailCommand("Invalid parameter value: path."); } switch (calledCommand.Name) { case "load": { switch (calledCommand.MandatoryParametersValues[0]) { case "graph": Loader.LoadGraphFromInternet(pathDataDir); break; case "sales": Loader.LoadSalesFromInternet(pathDataDir); break; } break; } case "clean": { switch (calledCommand.MandatoryParametersValues[0]) { case "graph": Cleaner.CleanGraphData(pathDataDir); Cleaner.CleanKey(pathDataDir); break; case "sales": Cleaner.CleanSalesData(pathDataDir); break; } break; } case "filter": { switch (calledCommand.MandatoryParametersValues[0]) { case "graph_links": Linker.FilterLinks(pathDataDir); break; } break; } case "link": { switch (calledCommand.MandatoryParametersValues[0]) { case "graph": Linker.LinkGraphData(pathDataDir); break; case "sales": Linker.LinkGraphWithSales(pathDataDir); break; } break; } case "asm": { switch (calledCommand.MandatoryParametersValues[0]) { case "graph": Assembler.AssembleGraphData(pathDataDir); break; case "sales": Assembler.AssembleSalesData(pathDataDir); break; } break; } case "sample": { SetType trainingSetType = SamplingHelper.GetSetTypeOrDefault(calledCommand.MandatoryParametersValues[0]); int trainingSetSize; if (!IsValidSetSize(calledCommand.MandatoryParametersValues[1], out trainingSetSize)) { FailCommand("Invalid parameter value: training set size."); } SetType testingSetType = SamplingHelper.GetSetTypeOrDefault(calledCommand.MandatoryParametersValues[2]); int testingSetSize; if (!IsValidSetSize(calledCommand.MandatoryParametersValues[3], out testingSetSize)) { FailCommand("Invalid parameter value: testing set size."); } int testingDataAmount = 100; if (calledCommand.OptionalParametersValues.Count > 0) { if (!IsValidPercentage(calledCommand.OptionalParametersValues[0], out testingDataAmount)) { FailCommand("Invalid parameter value: testing set size."); } } DataSampler.CreateTrainingAndTestSets(pathDataDir, trainingSetType, testingSetType, trainingSetSize, testingSetSize, testingDataAmount); break; } case "test": { switch (calledCommand.MandatoryParametersValues[0]) { case "graph_linkage": TestManager.TestLinkageGraph(pathDataDir); break; case "graph_mapping": TestManager.TestMapping(pathDataDir); break; case "graph_id": TestManager.TestID(pathDataDir); break; } break; } case "stat": { switch (calledCommand.MandatoryParametersValues[0]) { case "graph": TestManager.GetStatisticsGraph(pathDataDir); break; case "connectivity": StatisticsCollector.GetConnectivityStatistics(pathDataDir); break; } break; } default: { FailCommand("Cannot recognize the input commands."); break; } } }