internal void LoadPreloadnames() { // Фиксация важных кодов - Сейчас не должна использоваться. foreach (string s in preload_names) { nt.GetSetStr(s); } nt.Flush(); }
internal void PreloadFognames() { foreach (string s in preload_names) { nt.GetSetStr(s); } Code_rdftype = nt.GetSetStr("http://www.w3.org/1999/02/22-rdf-syntax-ns#type"); Code_fogname = nt.GetSetStr("http://fogid.net/o/name"); nt.Flush(); }
public TripleStoreInt32(Func <Stream> stream_gen, string tmp_dir_path) { // сначала таблица имен nt = new Nametable32(stream_gen); // Предзагрузка должна быть обеспечена даже для пустой таблицы имен PreloadFognames(); // Тип Object Variants PType tp_ov = new PTypeUnion( new NamedType("dummy", new PType(PTypeEnumeration.none)), new NamedType("iri", new PType(PTypeEnumeration.integer)), new NamedType("str", new PType(PTypeEnumeration.sstring)) //new NamedType("int", new PType(PTypeEnumeration.sstring)), //new NamedType("date", new PType(PTypeEnumeration.sstring)), //new NamedType("langstr", new PTypeRecord( // new NamedType("lang", new PType(PTypeEnumeration.sstring)), // new NamedType("str", new PType(PTypeEnumeration.sstring)))) ); PType tp_triple = new PTypeRecord( new NamedType("subj", new PType(PTypeEnumeration.integer)), new NamedType("pred", new PType(PTypeEnumeration.integer)), new NamedType("obj", tp_ov)); // Главная последовательность кодированных триплетов //table = new UniversalSequenceBase(tp_triple, stream_gen()); table = new BearingDeletable(tp_triple, stream_gen); // прямой ссылочный индекс s_index = new IndexKey32Comp(stream_gen, table, ob => true, ob => (int)((object[])ob)[0], null); // Обратный ссылочный индекс inv_index = new IndexKey32Comp(stream_gen, table, ob => (int)((object[])((object[])ob)[2])[0] == 1, obj => { object[] pair = (object[])((object[])obj)[2]; return((int)pair[1]); }, null); // Индекс по тексту объектов триплетов с предикатом http://fogid.net/o/name //int p_name = Int32.MinValue; Comparer <object> comp = Comparer <object> .Create(new Comparison <object>((object a, object b) => { return(string.Compare( (string)((object[])((object[])a)[2])[1], (string)((object[])((object[])b)[2])[1], StringComparison.OrdinalIgnoreCase)); })); int cod_name = nt.GetSetStr("http://fogid.net/o/name"); name_index = new IndexView(stream_gen, table, ob => (int)((object[])ob)[1] == cod_name, comp); comp_like = Comparer <object> .Create(new Comparison <object>((object a, object b) => { int len = ((string)((object[])((object[])b)[2])[1]).Length; return(string.Compare( (string)((object[])((object[])a)[2])[1], 0, (string)((object[])((object[])b)[2])[1], 0, len, StringComparison.OrdinalIgnoreCase)); })); table.Indexes = new IIndex[] { s_index, inv_index, name_index }; }