public TripleStore32(Func <Stream> stream_gen, string tmp_dir) { // Тип 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))); 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()); var spo_comparer = Comparer <object> .Create(new Comparison <object>((object a, object b) => { object[] aa = (object[])a; object[] bb = (object[])b; int cmp = ((int)aa[0]).CompareTo((int)bb[0]); return(cmp); })); keyFunc = tri => (int)((object[])tri)[0]; index_spo = new UniversalSequenceCompKey32(stream_gen(), keyFunc, spo_comparer, table); indexTest = new IndexViewImmutable(stream_gen, table, Comparer <object> .Create(new Comparison <object>((object a, object b) => { object[] aa = (object[])a; object[] bb = (object[])b; int cmp = ((int)aa[0]).CompareTo((int)bb[0]); return(cmp); })), tmp_dir, 20_000_000 ); }
public TripleStore_mag(Stream tab_stream, Stream spo_stream, Comparer <object> comp) { this.spo_comparer = comp; 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, tab_stream); spo_comparer = Comparer <object> .Create(new Comparison <object>((object a, object b) => { object[] aa = (object[])a; object[] bb = (object[])b; int cmp = ((int)aa[0]).CompareTo((int)bb[0]); return(cmp); })); keyFunc = tri => (int)((object[])tri)[0]; index_spo = new UniversalSequenceCompKey32(spo_stream, keyFunc, spo_comparer, table); }