public void BuildIndexes() { // _ng.coding_table.Save(); // _ng.coding_table.FreeMemory(); System.Diagnostics.Stopwatch sw = new System.Diagnostics.Stopwatch(); if (!table.TableCell.Root.Elements().Any()) { Console.WriteLine("table empty!"); return; } sw.Start(); NodeGenerator.Build(); sw.Stop(); Console.WriteLine("Load data and nametable ok. Duration={0}", sw.ElapsedMilliseconds); sw.Restart(); //ng.Build(); ps_index.Build(); sw.Stop(); Console.WriteLine("ps_index.Build() ok. Duration={0}", sw.ElapsedMilliseconds); sw.Restart(); po_index.Build(); sw.Stop(); Console.WriteLine("po_index Build index ok. Duration={0}", sw.ElapsedMilliseconds); sw.Restart(); Start(); }
public void Build(IEnumerable <Tuple <int, string, string> > tripleFlow) { table.Clear(); table.Fill(new object[0]); File.Delete(predicatemappingPath); int portionConter = 0; object[] buffer = new object[portion]; ps_index.index_arr.FillInit(); po_index.index_arr.FillInit(); TableRow[] tableRows; foreach (var triple in tripleFlow) { if (portionConter == portion) { tableRows = table.Add(buffer).ToArray(); ps_index.index_arr.FillPortion(tableRows); po_index.index_arr.FillPortion(tableRows); Array.Clear(buffer, 0, portion); portionConter = 0; } int pCode; if (!predicatemapping.TryGetValue(triple.Item2, out pCode)) { predicatemapping.Add(triple.Item2, pCode = predicatemapping.Count); } buffer[portionConter] = new object[] { triple.Item1, pCode, triple.Item3 }; portionConter++; } tableRows = table.Add(buffer).ToArray(); ps_index.index_arr.FillPortion(tableRows); po_index.index_arr.FillPortion(tableRows); table.TableCell.Flush(); ps_index.index_arr.FillFinish(); po_index.index_arr.FillFinish(); ps_index.Build(); po_index.Build(); using (StreamWriter file = new StreamWriter(predicatemappingPath)) foreach (var i in predicatemapping) { file.WriteLine(i.Key); } po_index.CreateDiscaleDictionary(); ps_index.CreateDiscaleDictionary(); }
public CascadingTest() { var uniqPath = Path+DateTime.Now.ToString(CultureInfo.InvariantCulture).Replace(":"," ")+DateTime.Now.Millisecond+"/";// Directory.CreateDirectory(uniqPath); Directory.CreateDirectory(uniqPath); tableView = new TableView(uniqPath + "table", TpTableElement); index = new IndexCascadingDynamic<string>(uniqPath + "cascading index", tableView, row => (int) ((object[])((object[])row)[1])[0], row => (string)((object[])((object[])row)[1])[1], i => i.GetHashModifiedBernstein()); tableView.Fill( Enumerable.Range(0, NumberOfRecords).SelectMany(i => Enumerable.Range(0, NumberOfRecords).Select(j => (object) (new object[] {i, j.ToString()})))); index.Build(); index.CreateDiscaleDictionary(); }