Esempio n. 1
0
        /// <summary>
        /// Инициирование базы данных
        /// </summary>
        /// <param name="connectionstring">префикс варианта базы данных ts:, после этого - директория для оператиыной БД</param>
        private void Init(string connectionstring)
        {
            if (connectionstring != null && connectionstring.StartsWith("trs:"))
            {
                dbfolder = connectionstring.Substring(4);
            }

            if (File.Exists(dbfolder + "0.bin"))
            {
                _firsTime = false;
            }

            Stream GenStream() =>
            new FileStream(dbfolder + (fileNo++) + ".bin", FileMode.OpenOrCreate, FileAccess.ReadWrite);

            Store = new TripleRecordStore(GenStream, dbfolder, new[]
            {
                "http://www.w3.org/1999/02/22-rdf-syntax-ns#type", "http://fogid.net/o/delete",
                "http://fogid.net/o/name", "http://fogid.net/o/age", "http://fogid.net/o/person",
                "http://fogid.net/o/photo-doc", "http://fogid.net/o/reflection", "http://fogid.net/o/reflected",
                "http://fogid.net/o/in-doc"
            });


            if (!_firsTime)
            {
                Store.DynaBuild();
            }
            Store.Flush();
        }