private void OutputSchemaList_SelectionChanged(object sender, SelectionChangedEventArgs e) { // Populate type-list with possible tables. Type-list filling is provided by a Space function (not all types are possible because of cycles and maybe other constraints) OutputTables.Clear(); if (SelectedOutputSchema != null) { // Rules/constraints: // - Generating columns (returning tuples) cannot target a primitive type // - Import/export is always generating column so cannot target a primitive type // - Can we have generating column cycles? // - Can we have import/export cycles? // Add primitive tables var primitiveTables = SelectedOutputSchema.SubTables.Where(x => x != SelectedOutputSchema.Root).ToList(); primitiveTables.ForEach(x => OutputTables.Add(x)); // Add non-primitive tables (only possible/meainingful) List <DcTable> outputTables; if (SelectedOutputSchema == Table.Schema) // Intra-schema link { outputTables = MappingModel.GetPossibleGreaterSets(Table); } else // Import-export link - all tables { outputTables = SelectedOutputSchema.Root.SubTables; } outputTables.ForEach(x => OutputTables.Add(x)); } }
public PathMappingBox(DcColumn column) { this.okCommand = new DelegateCommand(this.OkCommand_Executed, this.OkCommand_CanExecute); InitializeComponent(); if (column.Input.Columns.Contains(column)) { IsNew = false; } else { IsNew = true; } Column = column; DcTable sourceTable = column.Input; DcTable targetTable = column.Output; // Name NewColumnName = Column.Name; // Compute possible target tables TargetTables = new ObservableCollection <DcTable>(MappingModel.GetPossibleGreaterSets(sourceTable)); // TODO: Suggest the best target type if (targetTable == null) { // Compare the quality of gest mappings from the the source set to possible target sets DcTable bestTargetTable = TargetTables.Count > 0 ? TargetTables[0] : null; double bestSimilarity = 0.0; /* * foreach (ComTable set in targetTables) * { * ComColumn dim2 = set.CreateDefaultLesserDimension(dim.Name, dim.Input); * * List<Mapping> mappings = m.MapDim(new DimPath(dim), new DimPath(dim2)); * if (mappings[0].Similarity > bestSimilarity) { bestTargetTable = set; bestSimilarity = mappings[0].Similarity; } * m.Mappings.Clear(); * } */ targetTable = bestTargetTable; } targetTables.SelectedItem = targetTable; // In edit mode (for existing column), we do not allow for changing the type if (!IsNew) { targetTables.IsEnabled = false; } MappingModel = new MappingModel(sourceTable, targetTable); if (!IsNew) { MappingModel.Mapping = Column.Definition.Mapping; } RefreshAll(); }
private void removeMatchButton_Click(object sender, RoutedEventArgs e) { MappingModel.RemoveMatch(); // Redraw both trees. Use property name like "CanMatch" or String.Empty for all properties (but it does not work because selection is also updated) MappingModel.SourceTree.NotifyAllOnPropertyChanged("CanMatch"); MappingModel.TargetTree.NotifyAllOnPropertyChanged("CanMatch"); MappingModel.SourceTree.NotifyAllOnPropertyChanged("IsMatched"); MappingModel.TargetTree.NotifyAllOnPropertyChanged("IsMatched"); }
private void TargetSchemaList_SelectionChanged(object sender, SelectionChangedEventArgs e) { TargetTables.Clear(); if (SelectedTargetSchema != null) { List <DcTable> targetTables; if (SelectedTargetSchema == Column.Input.Schema) // Intra-schema link { targetTables = MappingModel.GetPossibleGreaterSets(Column.Input); } else // Import-export link { targetTables = SelectedTargetSchema.Root.SubTables; } targetTables.ForEach(x => TargetTables.Add(x)); } FillEntriesTypes(); RefreshAll(); }
private void recommendButton_Click(object sender, RoutedEventArgs e) { MappingModel.SelectBestTarget(); targetTree.Select(MappingModel.TargetTree.SelectedNode); }
public AggregationBox(DcColumn column, DcColumn measureColumn) { this.okCommand = new DelegateCommand(this.OkCommand_Executed, this.OkCommand_CanExecute); InitializeComponent(); if (column.Input.Columns.Contains(column)) { IsNew = false; } else { IsNew = true; } Column = column; SourceTable = column.Input; newColumnName.Text = Column.Name; // Initialize all possible fact tables (lesser tables) FactTables = MappingModel.GetPossibleLesserSets(SourceTable); if (!IsNew) { FactTable = Column.Definition.FactTable; } else { if (FactTables.Count == 1) { FactTable = FactTables[0]; } } // By setting a fact table here we trigger item selection event where two controls will be filled: grouping paths and measure paths. // Use additional parameter for selecting desired measure if (IsNew && measureColumn != null) { // Find at least one fact table that has a measure path to this measure column foreach (DcTable table in FactTables) { var pathEnum = new PathEnumerator( table, measureColumn.Output, DimensionType.IDENTITY_ENTITY ); var paths = pathEnum.ToList(); if (paths.Count() == 0) { continue; } FactTable = table; // Here the list of measure paths has to be filled automatically MeasurePath = paths[0]; } } // Initialize aggregation functions AggregationFunctions = new List <string>(new string[] { "COUNT", "SUM", "MUL" }); if (!IsNew) { AggregationFunction = Column.Definition.Updater; } else { AggregationFunction = "SUM"; } RefreshAll(); }
} // Another tree public MatchTree(MappingModel model) : base() { MappingModel = model; }