Exemplo n.º 1
0
        //// Идея хорошая, но надо менять схему реализации
        //private GroupedEntities getable;
        //private Dictionary<int, object[]> geHash;

        public TripleStoreInt(string path)
        {
            this.path = path;
            InitTypes();
            otriples    = new PaCell(tp_otriple_seq, path + "otriples.pac", false);
            otriples_op = new PaCell(tp_otriple_seq, path + "otriples_op.pac", false);
            dtriples    = new PaCell(tp_dtriple_seq, path + "dtriples.pac", false);
            dtriples_sp = new PaCell(tp_dtriple_spf, path + "dtriples_spf.pac", false);

            scale = new ScaleCell(path);
            if (!otriples.IsEmpty)
            {
                OpenCreateIndexes();
            }
            ewt = new EntitiesWideTable(path, new DiapasonScanner <int>[]
            {
                new DiapasonScanner <int>(otriples, ent => (int)((object[])ent.Get())[0]),
                new DiapasonScanner <int>(otriples_op, ent => (int)((object[])ent.Get())[2]),
                new DiapasonScanner <int>(dtriples_sp, ent => (int)((object[])ent.Get())[0])
            });
            ewtHash = new EntitiesMemoryHashTable(ewt);
            ewtHash.Load();

            //getable = new GroupedEntities(path); // Это хорошая идея, но нужно менять схему реализации
            //getable.CheckGroupedEntities();
            //geHash = getable.GroupedEntitiesHash();
        }
Exemplo n.º 2
0
        private static void TestEWT(TripleStoreInt ts)
        {
            DateTime tt0 = DateTime.Now;
            EntitiesMemoryHashTable hashTable = new EntitiesMemoryHashTable(ts.ewt);

            hashTable.Load();
            // Проверка построенной ewt
            Console.WriteLine("n_entities={0}", ts.ewt.EWTable.Root.Count());
            bool notfirst     = false;
            int  code         = Int32.MinValue;
            long cnt_otriples = 0;

            foreach (object[] row in ts.ewt.EWTable.Root.ElementValues())
            {
                int cd = (int)row[0];
                // Проверка на возрастание значений кода
                if (notfirst && cd <= code)
                {
                    Console.WriteLine("ERROR!");
                }
                code     = cd;
                notfirst = true;
                // Проверка на то, что коды в диапазонах индексов совпадают с cd. Подсчитывается количество
                object[] odia   = (object[])row[1];
                long     start  = (long)odia[0];
                long     number = (long)odia[1];
                foreach (object[] tri in ts.otriples.Root.ElementValues(start, number))
                {
                    int c = (int)tri[0];
                    if (c != cd)
                    {
                        Console.WriteLine("ERROR2!");
                    }
                }
                cnt_otriples += number;
            }
            if (cnt_otriples != ts.otriples.Root.Count())
            {
                Console.WriteLine("ERROR3! cnt_triples={0} otriples.Root.Count()={1}", cnt_otriples, ts.otriples.Root.Count());
            }
            Console.WriteLine("Проверка ewt OK. duration=" + (DateTime.Now - tt0).Ticks / 10000L); tt0 = DateTime.Now;
        }