public void Clear() { cell.Clear(); cell.Fill(new object[0]); key_index.Load(); foreach (var index in indexes) { index.Load(); } }
public void Clear() { dtriples.Clear(); otriples.Clear(); dtriples.Fill(new object[0]); otriples.Fill(new object[0]); dataCell.Clear(); dataCell.Fill(new object[0]); namespaceMaper.Clear(); }
public void Clear() { mapper.Clear(); otriples.Clear(); otriples.Fill(new object[0]); dtriples.Clear(); dtriples.Fill(new object[0]); literals.Clear(); literals.Fill(new object[0]); }
public void Clear() { Open(false); nc_cell.Clear(); nc_cell.Fill(new object[0]); Count = 0; codeByString.Clear(); stringByCode = new List <string>(); }
private void LoadXML(string xmldb_name) { cell_persons.Clear(); cell_persons.Fill(new object[0]); cell_photo_docs.Clear(); cell_photo_docs.Fill(new object[0]); cell_reflections.Clear(); cell_reflections.Fill(new object[0]); XElement db = XElement.Load(xmldb_name); foreach (XElement element in db.Elements()) { int id = Int32.Parse(element.Attribute("id").Value); if (element.Name == "person") { var name_el = element.Element("name"); string name = name_el == null ? "" : name_el.Value; var sex_el = element.Element("sex"); string sex = sex_el == null ? "" : sex_el.Value; var fd_el = element.Element("from-date"); string fd = fd_el == null ? "" : fd_el.Value; var td_el = element.Element("to-date"); string td = td_el == null ? "" : td_el.Value; var des_el = element.Element("description"); string des = des_el == null ? "" : des_el.Value; cell_persons.Root.AppendElement(new object[] { id, name, sex, fd, td, des }); } else if (element.Name == "photo-doc") { var name_el = element.Element("name"); string name = name_el == null ? "" : name_el.Value; var fd_el = element.Element("from-date"); string fd = fd_el == null ? "" : fd_el.Value; var des_el = element.Element("description"); string des = des_el == null ? "" : des_el.Value; cell_photo_docs.Root.AppendElement(new object[] { id, name, fd, des }); } else if (element.Name == "reflection") { var ground_el = element.Element("ground"); string ground = ground_el == null ? "" : ground_el.Value; if (element.Element("reflected") == null || element.Element("in-doc") == null) { continue; } int reflected = Int32.Parse(element.Element("reflected").Attribute("ref").Value); int in_doc = Int32.Parse(element.Element("in-doc").Attribute("ref").Value); cell_reflections.Root.AppendElement(new object[] { id, ground, reflected, in_doc }); } } cell_persons.Flush(); cell_photo_docs.Flush(); cell_reflections.Flush(); LoadIndexes(); }
public void Clear() { Open(false); nc_cell.Clear(); c_index.Clear(); md5_index.Clear(); nc_cell.Fill(new object[0]); c_index.Fill(new object[0]); md5_index.Fill(new object[0]); Count = 0; }
public void Load() { index_cell.Clear(); index_cell.Fill(new object[0]); foreach (var rec in table.Elements().Where(ent => (bool)ent.Field(0).Get() == false)) { long offset = rec.offset; index_cell.Root.AppendElement(offset); } index_cell.Flush(); if (index_cell.Root.Count() == 0) { return; // потому что следующая операция не пройдет } // Попробую сортировать index_cell специальным образом: значение (long) используется как offset ячейки и там прочитывается нулевое поле var ptr = table.Element(0); if (columnType.Vid == PTypeEnumeration.integer) { index_cell.Root.SortByKey <int>((object v) => { ptr.offset = (long)v; return((int)ptr.Field(i_field).Get()); }); } else if (columnType.Vid == PTypeEnumeration.longinteger) { index_cell.Root.SortByKey <long>((object v) => { ptr.offset = (long)v; return((long)ptr.Field(i_field).Get()); }); } else if (columnType.Vid == PTypeEnumeration.sstring) { index_cell.Root.SortByKey <string>((object v) => { ptr.offset = (long)v; return((string)ptr.Field(i_field).Get()); }); } else if (columnType.Vid == PTypeEnumeration.real) { index_cell.Root.SortByKey <double>((object v) => { ptr.offset = (long)v; return((double)ptr.Field(i_field).Get()); }); } else { throw new Exception("Wrong type of column for indexing"); } }
public void Clear() { Open(false); nc_cell.Clear(); c_index.Clear(); md5_index.Clear(); nc_cell.Fill(new object[0]); c_index.Fill(new object[0]); md5_index.Fill(new object[0]); Count = 0; offsetsByMd5Cache.Clear(); }
public static void Main1(string[] args) { System.Diagnostics.Stopwatch sw = new System.Diagnostics.Stopwatch(); PType tp_rec = new PTypeRecord( new NamedType("id", new PType(PTypeEnumeration.integer)), new NamedType("name", new PType(PTypeEnumeration.sstring)), new NamedType("age", new PType(PTypeEnumeration.integer))); PaCell cell = new PaCell(new PTypeSequence(tp_rec), path + "people.pac", false); PType tp_pair = new PTypeRecord( new NamedType("id", new PType(PTypeEnumeration.integer)), new NamedType("offset", new PType(PTypeEnumeration.longinteger))); PaCell cell_index = new PaCell(new PTypeSequence(tp_pair), path + "people_index.pac", false); int npersons = 1_000_000; Random rnd = new Random(); Console.WriteLine("Start Task04: Main1"); // Загрузка данных sw.Restart(); cell.Clear(); cell.Fill(new object[0]); cell_index.Clear(); cell_index.Fill(new object[0]); for (int i = 0; i < npersons; i++) { int code = npersons - i; long offset = cell.Root.AppendElement(new object[] { code, "=" + code + "=", rnd.Next(120) }); cell_index.Root.AppendElement(new object[] { code, offset }); } cell.Flush(); cell_index.Flush(); cell_index.Root.SortByKey <int>(pair => (int)((object[])pair)[0]); sw.Stop(); Console.WriteLine($"load {npersons} records. duration {sw.ElapsedMilliseconds}"); // Поиск int key = npersons * 2 / 3; int ntests = 10000; sw.Restart(); PaEntry entry = cell.Root.Element(0); for (int j = 0; j < ntests; j++) { key = rnd.Next(npersons); PaEntry en = cell_index.Root.BinarySearchFirst(ent => ((int)((object[])ent.Get())[0]).CompareTo(key)); object operson = entry.SetOffset((long)((object[])en.Get())[1]).Get(); //Console.WriteLine($"val={tp_rec.Interpret(operson)}"); } sw.Stop(); Console.WriteLine($"getByKey {ntests} times. duration {sw.ElapsedMilliseconds}"); }
public void TestSeqCell() { PType tp_seq = new PTypeSequence(new PType(PTypeEnumeration.integer)); PaCell cell_seq = new PaCell(tp_seq, new MemoryStream(), false); cell_seq.Clear(); cell_seq.Fill(new object[0]); cell_seq.Root.AppendElement(99); cell_seq.Root.AppendElement(98); cell_seq.Root.AppendElement(97); Assert.IsTrue(tp_seq.Interpret(cell_seq.Root.Get()) == "[99,98,97]"); }
public void Clear() { Open(false); nc_cell.Clear(); nc_cell.Fill(new object[0]); Count = 0; codeByString.Clear(); stringByCode = new string[0]; LiteralVid = new LiteralVidEnumeration?[0]; }
public void Clear() { Open(false); encodedCell.Clear(); c_index.Clear(); encodedCell.Fill(new object[0]); c_index.Fill(new object[0]); Count = 0; coding.Clear(); }
static void Main(string[] args) { Console.WriteLine("Start Task03_PolarDB"); string path = "../../Databases/"; PType tp = new PType(PTypeEnumeration.sstring); PaCell cell = new PaCell(tp, path + "test.pac", false); cell.Clear(); cell.Fill("Привет из ячейки базы данных!"); Console.WriteLine("Содержимое ячейки: {0}", cell.Root.Get()); PType tp_rec = new PTypeRecord( new NamedType("имя", new PType(PTypeEnumeration.sstring)), new NamedType("возраст", new PType(PTypeEnumeration.integer)), new NamedType("мужчина", new PType(PTypeEnumeration.boolean))); object rec_value = new object[] { "Пупкин", 22, true }; PaCell cell_rec = new PaCell(tp_rec, path + "test_rec.pac", false); cell_rec.Clear(); cell_rec.Fill(rec_value); object from_rec = cell_rec.Root.Get(); Console.WriteLine(tp_rec.Interpret(from_rec)); PType tp_seq = new PTypeSequence(tp_rec); object seq_value = new object[] { new object[] { "Иванов", 24, true }, new object[] { "Петрова", 18, false }, new object[] { "Пупкин", 22, true } }; PaCell cell_seq = new PaCell(tp_seq, path + "test_seq.pac", false); cell_seq.Clear(); cell_seq.Fill(seq_value); object from_seq = cell_seq.Root.Get(); Console.WriteLine(tp_seq.Interpret(from_seq)); cell_seq.Root.AppendElement(new object[] { "Сидоров", 23, true }); Console.WriteLine(tp_seq.Interpret(cell_seq.Root.Get())); long v0 = cell_seq.Root.Count(); var v1 = cell_seq.Root.Element(2).Field(0).Get(); var v2 = cell_seq.Root.Element(3).Field(1).Get(); Console.WriteLine($"{v0} {v1} {v2}"); cell_seq.Root.Element(1).Field(1).Set(19); cell_seq.Root.Element(1).Field(2).Set(true); Console.WriteLine(tp_seq.Interpret(cell_seq.Root.Get())); }
public void Build() { index_cell.Clear(); index_cell.Fill(new object[0]); if (Key1Producer == null) { throw new Exception("Err: Key1Producer not defined"); } if (Key2Producer == null) { throw new Exception("Err: Key2Producer not defined"); } Table.Scan((offset, o) => { var k1 = Key1Producer(o); var k2 = Key2Producer(o); int hk2 = Half2Producer(k2); index_cell.Root.AppendElement(new object[] { offset, k1, hk2 }); return(true); }); index_cell.Flush(); PaEntry entry = Table.Element(0); index_cell.Root.SortByKey <GroupElement>(ob => new GroupElement((int)((object[])ob)[1], (int)((object[])ob)[2], () => { long off = (long)((object[])ob)[0]; entry.offset = off; return(Key2Producer(entry.Get())); })); // BuildGroupsIndexSpecial: groups_index.Clear(); groups_index.Fill(new object[0]); int key1 = Int32.MinValue; int i = 0; // Теоретически, здесь есть проблема в том, что элементы могут выдаватьс не по индексу. foreach (object[] va in index_cell.Root.ElementValues()) { int k1 = (int)va[1]; if (k1 > key1) { groups_index.Root.AppendElement(i); key1 = k1; } i++; } groups_index.Flush(); //CreateGroupDictionary(); CreateDiscaleDictionary(); }
public void Load(int numb) { cell.Clear(); int portion = 200; cell.StartSerialFlow(); cell.S(); for (int i = 0; i < numb / portion; i++) { if (i % 1000 == 0) { Console.WriteLine("{0}%", (double)i * 100.0 / (double)numb * (double)portion); } for (int j = 0; j < portion; j++) { int value = i * portion + j; // rnd.Next(); cell.V(value); } } cell.Se(); cell.EndSerialFlow(); cell.Flush(); }
public void Load(IEnumerable <object[]> rec_flow) { acell.Clear(); acell.Fill(new object[0]); foreach (object[] rec in rec_flow) { acell.Root.AppendElement(new object[] { rec[0], rec[1], false }); } acell.Flush(); xcell.Clear(); xcell.Fill2(acell.Root.Get()); xcell.Flush(); xcell.Root.Sort((PxEntry entry) => (string)entry.Field(0).Get()); // Это надо привести в соответствие с типом ключа }
public static void LoadByGraphsBuffer(string filepath, PaCell otriples, PaCell dtriplets, RDFIntStoreAbstract rdfIntStore) { //Directory.Delete(path); //Directory.CreateDirectory(path); otriples.Clear(); otriples.Fill(new object[0]); dtriplets.Clear(); dtriplets.Fill(new object[0]); int i = 0; //Entity e = new Entity(); rdfIntStore.Clear(); foreach (var tripletGrpah in LoadGraphs(filepath, rdfIntStore)) { if (i % 100000 == 0) { Console.Write("w{0} ", i / 100000); } i += tripletGrpah.PredicateDataValuePairs.Count + tripletGrpah.PredicateObjValuePairs.Count; var subject = rdfIntStore.EntityCoding.GetCode(tripletGrpah.subject); foreach (var predicateObjValuePair in tripletGrpah.PredicateObjValuePairs) { otriples.Root.AppendElement(new object[] { subject, predicateObjValuePair.Key, rdfIntStore.EntityCoding.GetCode(predicateObjValuePair.Value) }); } foreach (var predicateDataValuePair in tripletGrpah.PredicateDataValuePairs) { dtriplets.Root.AppendElement(new object[] { subject, predicateDataValuePair.Key, predicateDataValuePair.Value.Offset }); } } otriples.Flush(); dtriplets.Flush(); rdfIntStore.NameSpaceStore.Flush(); rdfIntStore.LiteralStore.Flush(); }
public override void Clear() { doublesCell.Clear(); doublesCell.Fill(new object[0]); stringsCell.Clear(); stringsCell.Fill(new object[0]); typedObjectsCell.Clear(); typedObjectsCell.Fill(new object[0]); boolsCell.Clear(); boolsCell.Fill(new object[0]); stringsArhive.Clear(); StringsArchedCell.Clear(); StringsArchedCell.Fill(new object[0]); }
public static void LoadTriplets(string filepath, PaCell otriples, PaCell dtriplets, RDFIntStoreAbstract rdf) { //Directory.Delete(path); //Directory.CreateDirectory(path); otriples.Clear(); otriples.Fill(new object[0]); dtriplets.Clear(); dtriplets.Fill(new object[0]); int i = 0; //Entity e = new Entity(); rdf.Clear(); foreach (var triplet in LoadTriplets(filepath, rdf)) { if (i % 100000 == 0) { Console.Write("w{0} ", i / 100000); } i++; if (triplet is OTripleInt) { var oTripleInt = triplet as OTripleInt; otriples.Root.AppendElement(new object[] { oTripleInt.subject, oTripleInt.predicate, oTripleInt.obj }); } else { var dtr = triplet as DTripleInt; dtriplets.Root.AppendElement(new object[] { dtr.subject, dtr.predicate, dtr.data.Offset }); } } otriples.Flush(); dtriplets.Flush(); }
public void Build2() { index_cell.Clear(); index_cell.Fill(new object[0]); if (KeyProducer == null) { throw new Exception("Err: KeyProducer not defined"); } Table.Scan((offset, o) => { var key = KeyProducer(o); int hkey = (int)HalfProducer(key); index_cell.Root.AppendElement(new object[] { hkey, offset }); return(true); }); index_cell.Flush(); if (index_cell.Root.Count() == 0) { return; // потому что следующая операция не пройдет } var ptr = Table.Element(0); index_cell.Root.SortByKey <HalfPair>((object v) => { object[] vv = (object[])v; object half_key = vv[0]; long offset = (long)vv[1]; ptr.offset = offset; return(new HalfPair(offset, (int)half_key, this)); }); index_cell.Flush(); if (Scale != null) { Scale.Build(); } }
public void Clear() { Open(false); nc_cell.Clear(); c_index.Clear(); md5_index.Clear(); collisionsCell.Clear(); collisionsCell.Fill(new object[0]); nc_cell.Fill(new object[0]); c_index.Fill(new object[0]); md5_index.Fill(new object[0]); Count = 0; offsetByMd5.Clear(); collisionsByMD5.Clear(); }
public static void Main(string[] args) { string path = @"..\..\..\Databases\"; Console.WriteLine("Start test. Wait appoximately 10 sec. "); DateTime tt0 = DateTime.Now; // Тестовый тип данных PType tp_int = new PType(PTypeEnumeration.integer); PType tp_seq_int = new PTypeSequence(new PType(PTypeEnumeration.integer)); PType tp_seq_seq = new PTypeSequence(new PTypeSequence(new PType(PTypeEnumeration.integer))); // Тестирование буфера. Новый релиз 20130929 GenerateSerialTestFlow(10, new SerialBuffer(new SerialFlowReceiverConsole(tp_seq_seq), 0)); return; PaCell cell = new PaCell(tp_seq_seq, path + "serbuftest.pac", false); cell.Clear(); ISerialFlow input; input = cell; // Ввод без буфера GenerateSerialTestFlow(900000, input); Console.WriteLine("======Fill without buffer ok. duration=" + (DateTime.Now - tt0).Ticks / 10000L); tt0 = DateTime.Now; cell.Clear(); input = new SerialBuffer(cell, 4); // Ввод с буфером GenerateSerialTestFlow(900000, input); Console.WriteLine("======Fill with buffer ok. duration=" + (DateTime.Now - tt0).Ticks / 10000L); tt0 = DateTime.Now; cell.Close(); //System.IO.File.Delete(path + "serbuftest.pac"); }
public void Load(Func <PaEntry, object[][]> genPairs) { intern_cell.Clear(); intern_cell.Fill(new object[0]); foreach (PaEntry rec in table.Elements()) { object[][] pairs = genPairs(rec); foreach (object[] pair in pairs) { intern_cell.Root.AppendElement(new object[] { false, pair[0], pair[1] }); } } intern_cell.Flush(); key_index.Load(); }
public void Load(IEnumerable <XElement> element_flow) { cell_table.Clear(); cell_table.Fill(new object[0]); foreach (XElement element in element_flow) { var fd_el = element.Element(ONames.tag_fromdate); string id = element.Attribute(ONames.rdfabout).Value; string name = element.Element(ONames.tag_name).Value; string fd = fd_el == null ? "" : fd_el.Value; long off = cell_table.Root.AppendElement(new object[] { false, id, name, fd }); } cell_table.Flush(); }
private void RemoveColumns(PaCell otriples, PaCell otriples_op, PaCell dtriples_sp) { objPredicates.Clear(); objects.Clear(); inversePredicates.Clear(); inverses.Clear(); dataPredicates.Clear(); data.Clear(); objPredicates.Fill(new object[0]); objects.Fill(new object[0]); inversePredicates.Fill(new object[0]); inverses.Fill(new object[0]); dataPredicates.Fill(new object[0]); data.Fill(new object[0]); foreach (object[] elementValue in otriples_op.Root.ElementValues()) { inversePredicates.Root.AppendElement(elementValue[1]); inverses.Root.AppendElement(elementValue[0]); } foreach (object[] elementValue in otriples.Root.ElementValues()) { objPredicates.Root.AppendElement(elementValue[1]); objects.Root.AppendElement(elementValue[2]); } foreach (object[] elementValue in dtriples_sp.Root.ElementValues()) { dataPredicates.Root.AppendElement(elementValue[1]); data.Root.AppendElement(elementValue[2]); } objPredicates.Flush(); objects.Flush(); inversePredicates.Flush(); inverses.Flush(); dataPredicates.Flush(); data.Flush(); otriples.Close(); otriples_op.Close(); dtriples_sp.Close(); File.Delete(otriplets_op_filePath + "tmp"); File.Delete(otriples_filePath + "tmp"); File.Delete(dtriples_filePath + "tmp"); }
public void Load(IEnumerable <XElement> db_flow) { cell.Clear(); cell.Fill(new object[0]); foreach (XElement element in db_flow) { var fd_el = element.Element(ONames.tag_fromdate); string id = element.Attribute(ONames.rdfabout).Value; string name = element.Element(ONames.tag_name).Value; string fd = fd_el == null ? "" : fd_el.Value; cell.Root.AppendElement(new object[] { id, name, fd, false }); } cell.Flush(); Console.WriteLine("Число записей: " + cell.Root.Count()); }
public void Load(string[] rdf_files) { DateTime tt0 = DateTime.Now; // Закроем использование if (triplets != null) { triplets.Close(); triplets = null; } if (graph_x != null) { graph_x.Close(); graph_x = null; } // Создадим ячейки triplets = new PaCell(tp_triplets, path + "triplets.pac", false); triplets.Clear(); quads = new PaCell(tp_quads, path + "quads.pac", false); graph_a = new PaCell(tp_graph, path + "graph_a.pac", false); graph_x = new PxCell(tp_graph, path + "graph_x.pxc", false); graph_x.Clear(); n4 = new PaCell(tp_n4, path + "n4.pac", false); n4.Clear(); Console.WriteLine("cells initiated duration=" + (DateTime.Now - tt0).Ticks / 10000L); tt0 = DateTime.Now; TripletSerialInput(triplets, rdf_files); Console.WriteLine("After TripletSerialInput. duration=" + (DateTime.Now - tt0).Ticks / 10000L); tt0 = DateTime.Now; LoadQuadsAndSort(); Console.WriteLine("After LoadQuadsAndSort(). duration=" + (DateTime.Now - tt0).Ticks / 10000L); tt0 = DateTime.Now; FormingSerialGraph(new SerialBuffer(graph_a, 3)); Console.WriteLine("Forming serial graph ok. duration=" + (DateTime.Now - tt0).Ticks / 10000L); tt0 = DateTime.Now; // произвести объектное представление object g_value = graph_a.Root.Get().Value; graph_x.Fill2(g_value); Console.WriteLine("Forming fixed graph ok. duration=" + (DateTime.Now - tt0).Ticks / 10000L); tt0 = DateTime.Now; // ========= Завершение загрузки ========= // Закроем файлы и уничтожим ненужные triplets.Close(); quads.Close(); File.Delete(path + "quads.pac"); graph_a.Close(); File.Delete(path + "graph_a.pac"); graph_x.Close(); // Откроем для использования InitCells(); }
public void Load(Func <PaEntry, object[][]> genTriples) { intern_cell.Clear(); intern_cell.Fill(new object[0]); foreach (PaEntry rec in table.Elements()) { object[][] triples = genTriples(rec); foreach (object[] v3 in triples) { intern_cell.Root.AppendElement(new object[] { false, v3[0], v3[1], v3[2], v3[3] }); } } intern_cell.Flush(); key_index.Load(); key_index.AdditionalIndex(3); // дополнительный индекс - предикат //Проставим начала групп обратных ссылок и длину групп long inv_beg = Int64.MinValue, inv_count = Int64.MinValue; // offset начала серии в intern_cell и длина серии PaEntry tab_el_ent = table.Element(0); long key_offset = Int64.MaxValue; // будем фиксировать серию по совпадению оффсета с полем цели foreach (PaEntry ent in key_index.GetAll()) { object[] v5 = (object[])ent.Get(); long tab_pnt = (long)v5[4]; // указатель на таблицу if (tab_pnt != key_offset) { // заканчивается серия, начинается новая серия if (key_offset != Int64.MaxValue) { // надо закончить предыдущую серию tab_el_ent.offset = key_offset; tab_el_ent.Field(5).Set(inv_beg); tab_el_ent.Field(6).Set(inv_count); } // установим новую серию key_offset = tab_pnt; inv_beg = ent.offset; inv_count = 0; } inv_count++; } // закончим последнюю серию tab_el_ent.offset = key_offset; tab_el_ent.Field(5).Set(inv_beg); tab_el_ent.Field(6).Set(inv_count); }
public void Load(XElement db) { records.Clear(); records.Fill(new object[0]); triplets.Clear(); triplets.Fill(new object[0]); foreach (XElement el in db.Elements()) { var id_att = el.Attribute(ONames.rdfabout); if (id_att == null) { continue; } string type = el.Name.NamespaceName + el.Name.LocalName; object[] fields = el.Elements() .Where(sel => sel.Attribute(ONames.rdfresource) == null) .Select(sel => { var lang_att = sel.Attribute(ONames.xmllang); return(new object[] { sel.Name.NamespaceName + sel.Name.LocalName, sel.Value, lang_att == null? "" : lang_att.Value }); }).ToArray(); object[] direct = el.Elements() .Where(sel => sel.Attribute(ONames.rdfresource) != null) .Select(sel => { return(new object[] { sel.Name.NamespaceName + sel.Name.LocalName, sel.Attribute(ONames.rdfresource).Value }); }).ToArray(); records.Root.AppendElement(new object[] { false, id_att.Value, type, fields, direct }); foreach (XElement xprop in el.Elements().Where(xel => xel.Attribute(ONames.rdfresource) != null)) { string prop = xprop.Name.NamespaceName + xprop.Name.LocalName; string resource = xprop.Attribute(ONames.rdfresource).Value; triplets.Root.AppendElement(new object[] { false, id_att.Value, prop, resource }); } } records.Flush(); triplets.Flush(); }
//public void Load<Tkey>(Func<PaEntry, Tkey> keyProducer) public void Load() { // Маленький массв будет после загрузки пустым indexCellSmall.Clear(); indexCellSmall.Fill(new object[0]); indexCellSmall.Flush(); indexCell.Clear(); indexCell.Fill(new object[0]); foreach (var rec in table.Elements().Where(ent => !(bool)ent.Field(0).Get())) // загрузка всех элементов за исключением уничтоженных { var offset = rec.offset; indexCell.Root.AppendElement(offset); } indexCell.Flush(); if (indexCell.Root.Count() == 0) { return; // потому что следующая операция не пройдет } // Сортировать index_cell специальным образом: значение (long) используется как offset ячейки и там прочитывается нулевое поле indexCell.Root.Sort <FlexIndex <TKey> >(); }