예제 #1
0
        public static void Main()
        {
            Console.WriteLine("Start P01_PlatformPreperties");
            System.Diagnostics.Stopwatch sw = new System.Diagnostics.Stopwatch();
            string     path    = ProjectDirectory.GetProjectDirectory();
            TextWriter res     = new StreamWriter(new FileStream(path + "res.txt", FileMode.Append, FileAccess.Write));
            XElement   xcnf    = XElement.Load(path + "tests.xml");
            XElement   xcommon = XElement.Load(path + "../common.xml");

            xcommon.Add(xcnf);
            Random rnd = new Random();


            foreach (XElement xprobe in xcnf.Elements())
            {
                ProbeFrame probe = new ProbeFrame(xprobe.AncestorsAndSelf().Attributes());
                // измеряются задачи: FlowIO, DirectRand
                if (probe.sol == "Arr")
                {
                    // Загрузка
                    sw.Restart();
                    int    siz = (int)probe.siz;
                    long[] arr = Enumerable.Range(0, siz)
                                 //.Select(i => (long)(siz-i-1))
                                 //.Select(i => (long)(i))
                                 .Select(i => (long)rnd.Next(siz + siz))
                                 .ToArray();
                    sw.Stop();
                    probe.lod = sw.ElapsedMilliseconds;
                    Console.WriteLine("Загрузка OK");

                    // Сортировка
                    sw.Restart();
                    Array.Sort(arr);
                    sw.Stop();
                    probe.ndx = sw.ElapsedMilliseconds;

                    Console.WriteLine("Сортировка OK {0} ms siz={1}", sw.ElapsedMilliseconds, arr.Length);

                    long ssum = 0;
                    sw.Restart();
                    for (long ii = 0; ii < probe.siz; ii++)
                    {
                        ssum += arr[ii];
                    }
                    sw.Stop();
                    probe.scn = sw.ElapsedMilliseconds;
                    probe.sum = ssum;

                    Console.WriteLine("Сканирование OK");

                    ssum = 0;
                    rnd  = new Random(777777777);
                    int[] indexes = Enumerable.Range(0, probe.nte)
                                    .Select(i => rnd.Next((int)probe.siz - 1))
                                    .ToArray();
                    sw.Restart();
                    for (long ii = 0; ii < probe.nte; ii++)
                    {
                        ssum += arr[indexes[ii]];
                    }
                    sw.Stop();
                    probe.tim = sw.ElapsedMilliseconds - probe.scn * probe.nte / probe.siz;
                    probe.sum = ssum;

                    Console.WriteLine("Доступ OK");

                    res.WriteLine(probe.ToCSV());
                }
                else if (probe.sol == "MStream")
                {
                    Console.WriteLine("=== MStream");
                    Stream       stream = new MemoryStream();
                    BinaryWriter bw     = new BinaryWriter(stream);
                    BinaryReader br     = new BinaryReader(stream);
                    // Загрузка
                    sw.Restart();
                    int siz = (int)probe.siz;
                    for (int i = 0; i < siz; i++)
                    {
                        bw.Write((long)i);
                    }
                    sw.Stop();
                    probe.lod = sw.ElapsedMilliseconds;
                    Console.WriteLine("Загрузка OK");
                    // Сканирование
                    long ssum = 0;
                    sw.Restart();
                    stream.Position = 0L;
                    for (long ii = 0; ii < probe.siz; ii++)
                    {
                        ssum += br.ReadInt64();
                    }
                    sw.Stop();
                    probe.scn = sw.ElapsedMilliseconds;
                    probe.sum = ssum;
                    Console.WriteLine("Сканирование OK");
                    // Доступ
                    ssum = 0;
                    rnd  = new Random(777777777);
                    int[] indexes = Enumerable.Range(0, probe.nte)
                                    .Select(i => rnd.Next((int)probe.siz - 1))
                                    .ToArray();
                    sw.Restart();
                    for (long ii = 0; ii < probe.nte; ii++)
                    {
                        long off = indexes[ii] * sizeof(long);
                        stream.Position = off;
                        ssum           += br.ReadInt64();
                    }
                    sw.Stop();
                    probe.tim = sw.ElapsedMilliseconds;
                    probe.sum = ssum;

                    Console.WriteLine("Доступ OK");

                    res.WriteLine(probe.ToCSV());
                }
                else if (probe.sol == "File")
                {
                    Console.WriteLine("=== File");
                    Stream       stream = new FileStream(path + "../Databases/doublearr.bin", FileMode.Create, FileAccess.ReadWrite);
                    BinaryWriter bw     = new BinaryWriter(stream);
                    BinaryReader br     = new BinaryReader(stream);
                    // Загрузка
                    sw.Restart();
                    int siz = (int)probe.siz;
                    for (int i = 0; i < siz; i++)
                    {
                        bw.Write((long)i);
                        if ((i + 1) % 1000000 == 0)
                        {
                            Console.Write("" + (i + 1) / 1000000 + "m ");
                        }
                    }
                    Console.WriteLine();
                    stream.Flush();
                    sw.Stop();
                    probe.lod = sw.ElapsedMilliseconds;
                    Console.WriteLine("Загрузка OK");
                    // Сканирование
                    long ssum = 0;
                    sw.Restart();
                    stream.Position = 0L;
                    for (long ii = 0; ii < probe.siz; ii++)
                    {
                        ssum += br.ReadInt64();
                    }
                    sw.Stop();
                    probe.scn = sw.ElapsedMilliseconds;
                    probe.sum = ssum;
                    Console.WriteLine("Сканирование OK");
                    // Доступ
                    ssum = 0;
                    rnd  = new Random(777777777);
                    long[] indexes = Enumerable.Range(0, probe.nte)
                                     .Select(i => (long)rnd.Next((int)probe.siz - 1))
                                     .ToArray();
                    sw.Restart();
                    for (long ii = 0; ii < probe.nte; ii++)
                    {
                        long off = indexes[ii] * (long)sizeof(long);
                        stream.Position = off;
                        ssum           += br.ReadInt64();
                    }
                    sw.Stop();
                    probe.tim = sw.ElapsedMilliseconds;
                    probe.sum = ssum;

                    Console.WriteLine("Доступ OK");

                    res.WriteLine(probe.ToCSV());
                }
                else if (probe.sol == "ColdScanFile")
                {
                    Console.WriteLine("=== ColdScanFile (запускается после формировани файла и перезагрузки)");
                    Stream       stream = new FileStream(path + "../Databases/doublearr.bin", FileMode.Open, FileAccess.Read);
                    BinaryReader br     = new BinaryReader(stream);
                    // Сканирование
                    long ssum = 0;
                    sw.Restart();
                    stream.Position = 0L;
                    for (long ii = 0; ii < probe.siz; ii++)
                    {
                        ssum += br.ReadInt64();
                    }
                    sw.Stop();
                    probe.scn = sw.ElapsedMilliseconds;
                    probe.sum = ssum;
                    Console.WriteLine("Сканирование OK");

                    res.WriteLine(probe.ToCSV());
                }
                else if (probe.sol == "ColdRandFile")
                {
                    Console.WriteLine("=== ColdRandFile (запускается после формировани файла и перезагрузки)");
                    Stream       stream = new FileStream(path + "../Databases/doublearr.bin", FileMode.Open, FileAccess.Read);
                    BinaryReader br     = new BinaryReader(stream);
                    //
                    long ssum = 0;
                    // Доступ
                    ssum = 0;
                    rnd  = new Random(777777777);
                    int[] indexes = Enumerable.Range(0, probe.nte)
                                    .Select(i => rnd.Next((int)probe.siz - 1))
                                    .ToArray();
                    sw.Restart();
                    for (long ii = 0; ii < probe.nte; ii++)
                    {
                        long off = indexes[ii] * sizeof(long);
                        stream.Position = off;
                        ssum           += br.ReadInt64();
                    }
                    sw.Stop();
                    probe.tim = sw.ElapsedMilliseconds;
                    probe.sum = ssum;

                    Console.WriteLine("Доступ OK");

                    res.WriteLine(probe.ToCSV());
                }
            }
            res.Close();
        }
예제 #2
0
파일: Program.cs 프로젝트: agmarchuk/SDII
        public static void Main()
        {
            Console.WriteLine("Start P06_Virtuoso");
            string     path    = ProjectDirectory.GetProjectDirectory();
            TextWriter res     = new StreamWriter(new FileStream(path + "res.txt", FileMode.Append, FileAccess.Write));
            XElement   xcnf    = XElement.Load(path + "tests.xml");
            XElement   xcommon = XElement.Load(path + "../common.xml");

            xcommon.Add(xcnf);

            Random rnd;

            System.Diagnostics.Stopwatch sw = new System.Diagnostics.Stopwatch();

            AdapterVirtuosoSimple engine = new AdapterVirtuosoSimple("HOST=localhost:1550;UID=dba;PWD=dba;Charset=UTF-8;Connection Timeout=500", "g");

            foreach (XElement xprobe in xcnf.Elements())
            {
                ProbeFrame probe    = new ProbeFrame(xprobe.AncestorsAndSelf().Attributes());
                int        npersons = (int)probe.siz;
                if (probe.sol == "virtuoso_load")
                {
                    engine.PrepareToLoad();
                    Polar.Data.Phototeka generator = new Polar.Data.Phototeka(npersons, 777777);
                    sw.Restart();
                    engine.Load(generator.Generate1of3());
                    engine.Load(generator.Generate2of3());
                    engine.Load(generator.Generate3of3());
                    sw.Stop();
                    Console.WriteLine("Load ok. Duration={0}", sw.ElapsedMilliseconds); // 10000: 14.9 сек.
                    probe.ndx = sw.ElapsedMilliseconds;
                    res.WriteLine(probe.ToCSV());
                }
                else if (probe.sol == "virtuoso_SelectById")
                {
                    rnd = new Random(777777777);
                    long sum = 0;
                    sw.Restart();
                    //var rcommand = engine.RunStart();
                    for (int i = 0; i < probe.nte; i++)
                    {
                        string sid = "person" + rnd.Next(0, (int)probe.siz - 1);
                        var    v   = engine.Query("sparql select * { <" + sid + "> ?p ?o }")
                                     .First(po => po[0].ToString() == "age")
                                     .ToArray();
                        //    .First(po => (string)po[0] == "age");
                        string s = v[1].ToString();
                        sum += Int32.Parse(s);
                    }
                    //engine.RunStop(rcommand);
                    sw.Stop();
                    probe.tim = sw.ElapsedMilliseconds;
                    probe.sum = sum;
                    Console.WriteLine("SelectById ok. Duration={0}", sw.ElapsedMilliseconds); // 7
                    res.WriteLine(probe.ToCSV());
                }
                else if (probe.sol == "virtuoso_SearchByName")
                {
                    rnd = new Random(777777777);
                    sw.Restart();
                    long sum = 0;
                    for (int i = 0; i < probe.nte; i++)
                    {
                        var    intId      = rnd.Next(0, (int)probe.siz - 1);
                        string namePrefix = "Pupkin" + intId / 10;
                        //sum += (int)engine.Query(string.Format("sparql select ?s {{ ?s <name> ?o . Filter(strStarts(str(?o), \"{0}\")) }}", namePrefix)).Count();
                        var enumerable = engine.Query(string.Format("sparql select ?s {{ ?s <name> ?o . Filter(strStarts(str(?o), \"{0}\")) }}", namePrefix));
                        //foreach (var objectse in enumerable)
                        //{
                        //    foreach (var o in objectse)
                        //    {
                        //        Console.WriteLine(o);
                        //    }
                        //    Console.WriteLine();
                        //}
                        sum += (int)enumerable.Count();
                    }
                    sw.Stop();
                    probe.tim = sw.ElapsedMilliseconds;
                    probe.sum = sum;
                    Console.WriteLine("SearchByName ok. Duration={0}", sw.ElapsedMilliseconds); // 7
                    res.WriteLine(probe.ToCSV());
                }
                else if (probe.sol == "virtuoso_GetRelationByPerson")
                {
                    rnd = new Random(777777777);
                    sw.Restart();
                    long sum = 0;
                    for (int i = 0; i < probe.nte; i++)
                    {
                        string persId = "person" + rnd.Next(0, (int)probe.siz - 1);
                        sum += engine.Query(
                            "sparql select ?phname {?refl <reflected> <" + persId + "> . ?refl <in_doc> ?ph . ?ph <name> ?phname}")
                               //"sparql select ?refl {?refl <reflected> <"+persId+"> . }")
                               .Count();
                    }
                    sw.Stop();
                    probe.tim = sw.ElapsedMilliseconds;
                    probe.sum = sum;
                    Console.WriteLine("GetRelationByPerson ok. Duration={0}", sw.ElapsedMilliseconds); // 7
                    res.WriteLine(probe.ToCSV());
                }
                else if (probe.sol == "unused")
                {
                }
            }
            res.Close();
        }
예제 #3
0
        public static void Main()
        {
            Console.WriteLine("Start TestGenerator");
            string path = ProjectDirectory.GetProjectDirectory();

            System.Diagnostics.Stopwatch sw = new System.Diagnostics.Stopwatch();
            TextWriter res     = new StreamWriter(new FileStream(path + "res.txt", FileMode.Append, FileAccess.Write));
            XElement   xcnf    = XElement.Load(path + "tests.xml");
            XElement   xcommon = XElement.Load(path + "../common.xml");

            xcommon.Add(xcnf);
            Random rnd;

            //MySQL db = new MySQL("server=localhost;uid=root;port=3306;password=fetnaggi;");
            //SQLite db = new SQLite("Data Source=" + path + "../databases/test.db3");
            SQLdatabase db = new SQLdatabase(@"Data Source=(LocalDB)\v11.0;AttachDbFilename=D:\Users\Marchuk\Documents\TestPhototeka.mdf;Integrated Security=True;Connect Timeout=30");

            string dbname = db.GetType().Name;

            foreach (XElement xprobe in xcnf.Elements())
            {
                ProbeFrame probe    = new ProbeFrame(xprobe.AncestorsAndSelf().Attributes());
                int        npersons = (int)probe.siz;
                if (probe.sol == dbname + "_load")
                {
                    db.PrepareToLoad();
                    sw.Restart();
                    Polar.Data.Phototeka generator = new Polar.Data.Phototeka(npersons, 777777);
                    db.LoadElementFlow(generator.Generate1of3());
                    db.LoadElementFlow(generator.Generate2of3());
                    db.LoadElementFlow(generator.Generate3of3());
                    sw.Stop();
                    probe.lod = sw.ElapsedMilliseconds;

                    sw.Restart();
                    db.MakeIndexes();
                    sw.Stop();
                    probe.ndx = sw.ElapsedMilliseconds;
                    Console.WriteLine("Load ok."); // 10000: 14.9 сек.
                    res.WriteLine(probe.ToCSV());
                }
                else if (probe.sol == dbname + "_SelectById")
                {
                    rnd = new Random(777777777);
                    sw.Restart();
                    long sum = 0;
                    for (int i = 0; i < probe.nte; i++)
                    {
                        int id = rnd.Next(0, (int)probe.siz - 1);
                        sum += (int)(db.GetById(id, "person")[2]);
                    }
                    sw.Stop();
                    probe.tim = sw.ElapsedMilliseconds;
                    probe.sum = sum;
                    Console.WriteLine("SelectById ok. Duration={0}", sw.ElapsedMilliseconds); // 7
                    res.WriteLine(probe.ToCSV());
                }
                else if (probe.sol == dbname + "_SearchByName")
                {
                    rnd = new Random(777777777);
                    sw.Restart();
                    long sum = 0;
                    for (int i = 0; i < probe.nte; i++)
                    {
                        int id = rnd.Next(0, (int)probe.siz - 1);
                        sum += db.SearchByName("Pupkin" + id / 10, "person").Count();
                    }
                    sw.Stop();
                    probe.tim = sw.ElapsedMilliseconds;
                    probe.sum = sum;
                    Console.WriteLine("SearchByName ok. Duration={0}", sw.ElapsedMilliseconds); // 7
                    res.WriteLine(probe.ToCSV());
                }
                else if (probe.sol == dbname + "_GetRelationByPerson")
                {
                    rnd = new Random(777777777);
                    sw.Restart();
                    long sum = 0;
                    for (int i = 0; i < probe.nte; i++)
                    {
                        int id = rnd.Next(0, (int)probe.siz - 1);
                        sum += db.GetPhotosOfPersonUsingRelation(id).Count();
                    }
                    sw.Stop();
                    probe.tim = sw.ElapsedMilliseconds;
                    probe.sum = sum;
                    Console.WriteLine("GetRelationByPerson ok. Duration={0}", sw.ElapsedMilliseconds); // 7
                    res.WriteLine(probe.ToCSV());
                }
                else if (probe.sol == "unused")
                {
                }
            }
            res.Close();
        }
예제 #4
0
        static void Main(string[] args)
        {
            string path = ProjectDirectory.GetProjectDirectory();

            if (!Directory.Exists(path + "../Databases/name table universal"))
            {
                Directory.CreateDirectory(path + "../Databases/name table universal");
            }
            NameTableUniversal nameTable = new NameTableUniversal(path + "../Databases/name table universal");

            Console.WriteLine("Start P14_Universal_NameTable");
            System.Diagnostics.Stopwatch sw = new System.Diagnostics.Stopwatch();

            TextWriter res     = new StreamWriter(new FileStream(path + "res.txt", FileMode.Append, FileAccess.Write));
            XElement   xcnf    = XElement.Load(path + "tests.xml");
            XElement   xcommon = XElement.Load(path + "../common.xml");

            xcommon.Add(xcnf);
            Random rnd;

            int[] testingcodes = null;

            foreach (XElement xprobe in xcnf.Elements())
            {
                ProbeFrame probe = new ProbeFrame(xprobe.AncestorsAndSelf().Attributes());

                if (probe.sol == "LoadAll")
                {
                    // Загрузка
                    sw.Restart();
                    int siz = (int)probe.siz;
                    nameTable.Expand(siz, Enumerable.Range(0, siz).Select(i => i.ToString()));
                    nameTable.BuildIndexes();
                    nameTable.BuildScale();
                    sw.Stop();
                    probe.lod = sw.ElapsedMilliseconds;
                    res.WriteLine(probe.ToCSV());
                    Console.WriteLine("Загрузка OK");
                }
                else if (probe.sol == "TestCompositions")
                {
                    int siz = (int)probe.siz;
                    foreach (var key in nameTable.Keys.Take(siz))
                    {
                        if (key == nameTable.GetString(nameTable.GetCode(key)))
                        {
                            continue;
                        }
                        throw new Exception(key + " code:" + nameTable.GetCode(key) + " key:" + nameTable.GetString(nameTable.GetCode(key)));
                    }
                    foreach (var code in nameTable.Codes.Take(siz))
                    {
                        if (code == nameTable.GetCode(nameTable.GetString(code)))
                        {
                            continue;
                        }
                        throw new Exception(code + " key:" + nameTable.GetString(code) + " code:" + nameTable.GetCode(nameTable.GetString(code)));
                    }
                    res.WriteLine(probe.ToCSV());
                    Console.WriteLine("TestCompositions OK");
                }
                else if (probe.sol == "Code2StringTime")
                {
                    rnd = new Random(777777777);
                    int nte = (int)probe.nte;

                    // выберем nte случайных кодов из таблицы имён
                    if (testingcodes == null)
                    {
                        testingcodes =
                            Enumerable.Range(0, nte)
                            .Select(i => rnd.Next((int)nameTable.Count - 1))
                            //.Select(i => str2Int.Values.ElementAt(i))
                            .ToArray();
                    }
                    sw.Restart();
                    long sum = 0L;

                    foreach (var code in testingcodes)
                    {
                        sum += nameTable.GetString(code).Length;
                    }

                    sw.Stop();
                    probe.sum = sum;
                    probe.tim = sw.ElapsedMilliseconds;
                    probe.tsk = "int2str";
                    res.WriteLine(probe.ToCSV());
                    Console.WriteLine("Code2StringTime OK");
                }
                else if (probe.sol == "String2CodeTime")
                {
                    int nte = (int)probe.nte;
                    rnd = new Random(777777776);
                    // выберем nte случайных строк из таблицы имён
                    if (testingcodes == null)
                    {
                        testingcodes =
                            Enumerable.Range(0, nte)
                            .Select(i => rnd.Next((int)nameTable.Count - 1))
                            //.Select(i => str2Int.Values.ElementAt(i))
                            .ToArray();
                    }
                    string[] keys =
                        testingcodes
                        .Select(i => i.ToString())
                        .ToArray();
                    long sum = 0L;
                    sw.Restart();
                    foreach (var key in keys)
                    {
                        sum += nameTable.GetCode(key);
                    }
                    sw.Stop();
                    probe.sum = sum;
                    probe.tsk = "str2int";
                    probe.tim = sw.ElapsedMilliseconds;
                    res.WriteLine(probe.ToCSV());
                    Console.WriteLine("String2CodeTime OK");
                }
            }
            res.Close();
        }
예제 #5
0
파일: Program.cs 프로젝트: agmarchuk/SDII
        static void Main(string[] args)
        {
            Console.WriteLine("Start P11_PlatformPreperties2");
            System.Diagnostics.Stopwatch sw = new System.Diagnostics.Stopwatch();
            string     path    = ProjectDirectory.GetProjectDirectory();
            TextWriter res     = new StreamWriter(new FileStream(path + "res.txt", FileMode.Append, FileAccess.Write));
            XElement   xcnf    = XElement.Load(path + "tests.xml");
            XElement   xcommon = XElement.Load(path + "../common.xml");

            xcommon.Add(xcnf);
            Random rnd;
            Dictionary <string, int> str2Int = new Dictionary <string, int>();
            List <string>            int2Str = new List <string>();

            int[] testingcodes = null;
            foreach (XElement xprobe in xcnf.Elements())
            {
                ProbeFrame probe = new ProbeFrame(xprobe.AncestorsAndSelf().Attributes());

                if (probe.sol == "LoadAll")
                {
                    // Загрузка
                    sw.Restart();
                    int siz = (int)probe.siz;
                    for (int i = 0; i < siz; i++)
                    {
                        string s = i.ToString();
                        str2Int.Add(s, i);
                        int2Str.Add(s.ToString());
                    }
                    sw.Stop();
                    probe.lod = sw.ElapsedMilliseconds;
                    res.WriteLine(probe.ToCSV());
                    Console.WriteLine("Загрузка OK");
                }
                else if (probe.sol == "TestCompositions")
                {
                    int nte = (int)probe.nte;
                    foreach (var key in str2Int.Keys.Take(nte))
                    {
                        if (key == int2Str[str2Int[key]])
                        {
                            continue;
                        }
                        throw new Exception(key + " " + str2Int[key] + " " + int2Str[str2Int[key]]);
                    }
                    foreach (var code in str2Int.Values.Take(nte))
                    {
                        if (code == str2Int[int2Str[code]])
                        {
                            continue;
                        }
                        throw new Exception(code + " " + int2Str[code] + " " + str2Int[int2Str[code]]);
                    }
                    res.WriteLine(probe.ToCSV());
                    Console.WriteLine("TestCompositions OK");
                }
                else if (probe.sol == "GetStringTime")
                {
                    rnd = new Random(777777777);
                    int nte = (int)probe.nte;

                    // выберем nte случайных кодов из таблицы имён
                    if (testingcodes == null)
                    {
                        testingcodes =
                            Enumerable.Range(0, nte)
                            .Select(i => rnd.Next(str2Int.Values.Count - 1))
                            //.Select(i => str2Int.Values.ElementAt(i))
                            .ToArray();
                    }
                    long sum = 0L;
                    sw.Restart();
                    foreach (int key in testingcodes)
                    {
                        string s = int2Str[key];
                        sum += s.Length;
                    }
                    //sum += testingcodes.Select(k => int2Str[k].Length).Aggregate((sm, v) => sm + v);
                    sw.Stop();
                    probe.sum = sum;
                    probe.tim = sw.ElapsedMilliseconds;
                    probe.tsk = "int2str";
                    res.WriteLine(probe.ToCSV());
                    Console.WriteLine("GetStringTime OK");
                }
                else if (probe.sol == "GetCodeTime")
                {
                    int nte = (int)probe.nte;
                    rnd = new Random(777777777);
                    // выберем nte случайных строк из таблицы имён
                    if (testingcodes == null || nte != testingcodes.Length)
                    {
                        testingcodes =
                            Enumerable.Range(0, nte)
                            .Select(i => rnd.Next(str2Int.Values.Count - 1))
                            //.Select(i => str2Int.Values.ElementAt(i))
                            .ToArray();
                    }
                    string[] keys =
                        testingcodes
                        .Select(i => i.ToString())
                        .ToArray();
                    long sum = 0L;
                    sw.Restart();
                    foreach (string key in keys)
                    {
                        sum += str2Int[key];
                    }
                    sw.Stop();
                    probe.sum = sum;
                    probe.tsk = "str2int";
                    probe.tim = sw.ElapsedMilliseconds;
                    res.WriteLine(probe.ToCSV());
                    Console.WriteLine("GetCodeTime OK");
                }
            }
            res.Close();
        }
예제 #6
0
파일: Program.cs 프로젝트: agmarchuk/SDII
        static void Main(string[] args)
        {
            string path = ProjectDirectory.GetProjectDirectory();

            Console.WriteLine(path);
            if (!Directory.Exists(path + "../Databases/name table universal"))
            {
                Directory.CreateDirectory(path + "../Databases/name table universal");
            }
            NametableLinearBuffered nameTable = new NametableLinearBuffered(path + "../Databases/name table universal");

            Console.WriteLine("Start P15_LinearBuffered_NameTable");
            System.Diagnostics.Stopwatch sw = new System.Diagnostics.Stopwatch();

            TextWriter res     = new StreamWriter(new FileStream(path + "res.txt", FileMode.Append, FileAccess.Write));
            XElement   xcnf    = XElement.Load(path + "tests.xml");
            XElement   xcommon = XElement.Load(path + "../common.xml");

            xcommon.Add(xcnf);
            Random rnd;

            foreach (XElement xprobe in xcnf.Elements())
            {
                ProbeFrame probe = new ProbeFrame(xprobe.AncestorsAndSelf().Attributes());

                if (probe.sol == "LoadAll")
                {
                    // Загрузка
                    sw.Restart();
                    int siz = (int)probe.siz;
                    nameTable.Expand(siz, Enumerable.Range(0, siz).Select(i => i.ToString()));
                    sw.Stop();
                    probe.lod = sw.ElapsedMilliseconds;
                    res.WriteLine(probe.ToCSV());
                    Console.WriteLine("Загрузка OK");
                }
                else if (probe.sol == "TestCompositions")
                {
                    int siz = (int)probe.siz;
                    foreach (var key in nameTable.Keys.Take(siz))
                    {
                        if (key == nameTable.GetString(nameTable.GetCode(key)))
                        {
                            continue;
                        }
                        throw new Exception(key + " code:" + nameTable.GetCode(key) + " key:" +
                                            nameTable.GetString(nameTable.GetCode(key)));
                    }
                    foreach (var code in nameTable.Codes.Take(siz))
                    {
                        if (code == nameTable.GetCode(nameTable.GetString(code)))
                        {
                            continue;
                        }
                        throw new Exception(code + " key:" + nameTable.GetString(code) + " code:" +
                                            nameTable.GetCode(nameTable.GetString(code)));
                    }
                    res.WriteLine(probe.ToCSV());
                    Console.WriteLine("TestCompositions OK");
                }
                else if (probe.sol == "String2CodeTime")
                {
                    rnd = new Random(777777776);
                    int nte = (int)probe.nte;

                    // выберем nte случайных кодов из таблицы имён
                    int[] codes =
                        Enumerable.Range(0, nte)
                        .Select(i => rnd.Next((int)nameTable.Count))
                        //.Select(i => nameTable.Codes.ElementAt(i))
                        .ToArray();
                    sw.Restart();
                    long sum = 0L;

                    foreach (var code in codes)
                    {
                        sum += nameTable.GetString(code).Length;
                    }

                    sw.Stop();
                    probe.sum = sum;
                    probe.tim = sw.ElapsedMilliseconds;
                    probe.tsk = "int2str";
                    res.WriteLine(probe.ToCSV());
                    Console.WriteLine("String2CodeTime OK");
                }
                else if (probe.sol == "Code2StringTime")
                {
                    int nte = (int)probe.nte;
                    rnd = new Random(777777777);
                    // выберем nte случайных строк из таблицы имён
                    var testingcodes =
                        Enumerable.Range(0, nte)
                        .Select(i => rnd.Next((int)nameTable.Count - 1))
                        //.Select(i => str2Int.Values.ElementAt(i))
                        .ToArray();
                    long sum = 0L;
                    sw.Restart();
                    foreach (var code in testingcodes)
                    {
                        sum += nameTable.GetString(code).Length;
                    }
                    sw.Stop();
                    probe.sum = sum;
                    probe.tsk = "str2int";
                    probe.tim = sw.ElapsedMilliseconds;
                    res.WriteLine(probe.ToCSV());
                    Console.WriteLine("Code2StringTime OK");
                }
                else if (probe.sol == "InseartPortion")
                {
                    int nte           = (int)probe.nte;
                    int existingCount = Math.Min(nte / 2, (int)nameTable.Count);

                    string[] newKeys =
                        Enumerable.Range((int)nameTable.Count - existingCount, nte)
                        .Select(i => i.ToString())
                        .ToArray();


                    long sum = 0L;
                    sw.Restart();
                    var portionCoded = nameTable.InsertPortion(newKeys);
                    Console.WriteLine(nameTable.GetCode("1000001"));
                    Console.WriteLine(nameTable.GetString(1000001));
                    sw.Stop();
                    if (portionCoded.Keys.Distinct().Count() < nte)
                    {
                        throw new Exception("portion count " + portionCoded.Keys.Distinct().Count());
                    }
                    if (portionCoded.Values.Distinct().Count() < nte)
                    {
                        throw new Exception("portion count" + portionCoded.Values.Distinct().Count());
                    }
                    foreach (var newKey in newKeys.Where(newKey => newKey != nameTable.GetString(nameTable.GetCode(newKey))))
                    {
                        throw new Exception("key " + newKey + " code " + nameTable.GetCode(newKey) + " getkey " + nameTable.GetString(nameTable.GetCode(newKey)));
                    }
                    foreach (var newKey in newKeys.Where(newKey => portionCoded[newKey] != nameTable.GetCode(newKey)))
                    {
                        throw new Exception("key " + newKey + " code " + nameTable.GetCode(newKey) + " getkey " + nameTable.GetString(nameTable.GetCode(newKey)));
                    }
                    foreach (var newKey in portionCoded.Keys.Where(newKey => newKey != nameTable.GetString(nameTable.GetCode(newKey))))
                    {
                        throw new Exception("key " + newKey + " code " + nameTable.GetCode(newKey) + " getkey " + nameTable.GetString(nameTable.GetCode(newKey)));
                    }
                    foreach (var newKey in portionCoded.Values.Where(newcode => newcode != nameTable.GetCode(nameTable.GetString(newcode))))
                    {
                        throw new Exception("code " + newKey + " key " + nameTable.GetString(newKey) + " getcode " + nameTable.GetCode(nameTable.GetString(newKey)));
                    }
                    sum       = nameTable.Count;
                    probe.sum = sum;
                    probe.tsk = "InseartPortion";
                    probe.tim = sw.ElapsedMilliseconds;
                    res.WriteLine(probe.ToCSV());
                    Console.WriteLine("InseartPortion OK");
                }
            }
            res.Close();
        }
예제 #7
0
        private static void Main(string[] args)
        {
            string path = ProjectDirectory.GetProjectDirectory();

            if (!Directory.Exists(path + "../Databases/simple triple store"))
            {
                Directory.CreateDirectory(path + "../Databases/simple triple store");
            }
            Console.WriteLine("Start TestGenerator");
            TextWriter res     = new StreamWriter(new FileStream(path + "res.txt", FileMode.Append, FileAccess.Write));
            XElement   xcnf    = XElement.Load(path + "tests.xml");
            XElement   xcommon = XElement.Load(path + "../common.xml");

            xcommon.Add(xcnf);
            Random rnd;

            System.Diagnostics.Stopwatch sw = new System.Diagnostics.Stopwatch();

            SimpleTripleStore.SimpleTripleStore simpleTripleStore =
                new SimpleTripleStore.SimpleTripleStore(path + "../Databases/simple triple store/",
                                                        1000 * 1000);
            foreach (XElement xprobe in xcnf.Elements())
            {
                ProbeFrame probe    = new ProbeFrame(xprobe.AncestorsAndSelf().Attributes());
                int        npersons = (int)probe.siz;
                if (probe.sol == "simpleTripleStore_load")
                {
                    // Directory.Delete(path + "../Databases/simple triple store", true);
                    sw.Restart();
                    Polar.Data.Phototeka generator = new Polar.Data.Phototeka(npersons, 777777);
                    simpleTripleStore.Build(generator.GenerateRDF());
                    sw.Stop();
                    Console.WriteLine("Load ok. Duration={0}", sw.ElapsedMilliseconds); // 10000: 14.9 сек.
                    probe.ndx = sw.ElapsedMilliseconds;
                    res.WriteLine(probe.ToCSV());
                }
                else if (probe.sol == "simpleTripleStore_SelectById")
                {
                    rnd = new Random(777777777);
                    sw.Restart();
                    long sum = 0;
                    for (int i = 0; i < probe.nte; i++)
                    {
                        int id = rnd.Next(0, (int)probe.siz - 1);
                        sum += Convert.ToInt32(simpleTripleStore.GetDirects(id).FirstOrDefault(tuple => tuple.Item1 == "age").Item2);
                    }
                    sw.Stop();
                    probe.tim = sw.ElapsedMilliseconds;
                    probe.sum = sum;
                    Console.WriteLine("SelectById ok. Duration={0}", sw.ElapsedMilliseconds); // 7
                    res.WriteLine(probe.ToCSV());
                }
                else if (probe.sol == "simpleTripleStore_SearchByName")
                {
                    rnd = new Random(777777777);
                    sw.Restart();

                    WordIndex index = new WordIndex();

                    for (int i = 0; i < probe.siz; i++)
                    {
                        var w = simpleTripleStore.GetObject(i, "name").First();
                        index.Insert(w, i);
                    }
                    Console.WriteLine("build words trigrams index " + sw.ElapsedMilliseconds);
                    Console.WriteLine("RAM used {0} mb.", GC.GetTotalMemory(false) / 1024 / 1024);
                    sw.Restart();
                    long sum = 0, sum2 = 0;
                    for (int i = 0; i < probe.nte; i++)
                    {
                        int    id         = rnd.Next(0, (int)probe.siz - 1);
                        string namePrefix = "Pupkin" + id / 10;
                        sum += (int)index.FindBySubWord(namePrefix).Count();
                    }
                    Console.WriteLine(sum);
                    Console.WriteLine(sum2);
                    sw.Stop();
                    probe.tim = sw.ElapsedMilliseconds;
                    probe.sum = sum;
                    Console.WriteLine("SearchByName ok. Duration={0}", sw.ElapsedMilliseconds); // 7
                    res.WriteLine(probe.ToCSV());
                }
                else if (probe.sol == "simpleTripleStore_GetRelationByPerson")
                {
                    rnd = new Random(777777777);
                    sw.Restart();
                    long sum = 0;
                    for (int i = 0; i < probe.nte; i++)
                    {
                        int persId = rnd.Next(0, (int)probe.siz - 1);
                        sum += simpleTripleStore.GetSubjects("reflected", persId.ToString())
                               .Select(refid => simpleTripleStore.GetObject(refid, "in_doc").First())
                               .Select(int.Parse)
                               .Select(photoId => simpleTripleStore.GetDirects(photoId))
                               .Count();
                    }
                    sw.Stop();
                    probe.tim = sw.ElapsedMilliseconds;
                    probe.sum = sum;
                    Console.WriteLine("GetRelationByPerson ok. Duration={0}", sw.ElapsedMilliseconds); // 7
                    res.WriteLine(probe.ToCSV());
                }
                else if (probe.sol == "unused")
                {
                }
            }
            res.Close();
        }
예제 #8
0
        public static void Main()
        {
            Console.WriteLine("Start P05_Phototeka3TabsInt");
            string path = ProjectDirectory.GetProjectDirectory();

            if (!Directory.Exists(path + "../Databases/P05_Phototeka3TabsInt"))
            {
                Directory.CreateDirectory(path + "../Databases/P05_Phototeka3TabsInt");
            }
            TextWriter res     = new StreamWriter(new FileStream(path + "res.txt", FileMode.Append, FileAccess.Write));
            XElement   xcnf    = XElement.Load(path + "tests.xml");
            XElement   xcommon = XElement.Load(path + "../common.xml");

            xcommon.Add(xcnf);
            Random rnd = new Random(777777777);

            System.Diagnostics.Stopwatch sw = new System.Diagnostics.Stopwatch();
            string dbpath = path + "../Databases/P05_Phototeka3TabsInt/";

            Stan3TabsInt tabs = new Stan3TabsInt(dbpath);

            foreach (XElement xprobe in xcnf.Elements())
            {
                ProbeFrame probe    = new ProbeFrame(xprobe.AncestorsAndSelf().Attributes());
                int        npersons = (int)probe.siz;
                if (probe.sol == "Stan3TabsInt_load")
                {
                    sw.Restart();
                    Polar.Data.Phototeka generator = new Polar.Data.Phototeka(npersons, 777777);


                    //var n = generator.Generate1of3().Count();
                    //tabs.Build(
                    //    generator.Generate1of3());
                    tabs.Clear();
                    var query_p = generator.Generate1of3();
                    tabs.BuildPersons(query_p);
                    var query_ph = generator.Generate2of3();
                    tabs.BuildPhoto_docs(query_ph);
                    var query_r = generator.Generate3of3();
                    tabs.BuildReflections(query_r);
                    sw.Stop();
                    probe.lod = sw.ElapsedMilliseconds;
                    Console.WriteLine("Load ok. Duration={0}", sw.ElapsedMilliseconds); // 10000: 14.9 сек.
                    sw.Restart();
                    tabs.BuildIndexes();
                    sw.Stop();
                    probe.ndx = sw.ElapsedMilliseconds;
                    Console.WriteLine("BuildIndexes ok. Duration={0}", sw.ElapsedMilliseconds); // 10000: 14.9 сек.
                    res.WriteLine(probe.ToCSV());
                }
                else if (probe.sol == "Stan3TabsInt_SelectById")
                {
                    rnd = new Random(777777777);
                    sw.Restart();
                    long sum = 0;
                    for (int i = 0; i < probe.nte; i++)
                    {
                        int id = rnd.Next(0, (int)probe.siz - 1);
                        var p  = tabs.GetPersonByCode(id);
                        sum += (int)p[2];
                    }
                    sw.Stop();
                    probe.tim = sw.ElapsedMilliseconds;
                    probe.sum = sum;
                    Console.WriteLine("SelectById ok. Duration={0}", sw.ElapsedMilliseconds); // 46 (1000)
                    res.WriteLine(probe.ToCSV());
                }
                else if (probe.sol == "Stan3TabsInt_SearchByName")
                {
                    rnd = new Random(777777777);
                    sw.Restart();
                    long sum = 0;
                    for (int i = 0; i < probe.nte; i++)
                    {
                        int    id         = rnd.Next(0, (int)probe.siz - 1);
                        string namePrefix = "Pupkin" + id / 10;

                        var ob = tabs.GetPersonsByName(namePrefix).ToArray();
                        sum += ob.Length;
                        sum  = sum + 1 - 1;
                        //sum += (int)simpleTripleStore.GetSubjects("a", "person").Select(personId => simpleTripleStore.GetObject(personId, "name").FirstOrDefault()).Count(name => name.StartsWith(namePrefix));
                    }
                    sw.Stop();
                    probe.tim = sw.ElapsedMilliseconds;
                    probe.sum = sum;
                    Console.WriteLine("SearchByName ok. Duration={0}", sw.ElapsedMilliseconds); // 7
                    res.WriteLine(probe.ToCSV());
                }
                else if (probe.sol == "Stan3TabsInt_GetRelationByPerson")
                {
                    rnd = new Random(777777777);
                    sw.Restart();
                    long sum = 0;
                    for (int i = 0; i < probe.nte; i++)
                    {
                        int id = rnd.Next(0, (int)probe.siz - 1);
                        //var qu = tabs.GetReflectionsByReflected(id);
                        sum += tabs.GetReflectionsByReflected(id).Count();
                    }
                    sw.Stop();
                    probe.tim = sw.ElapsedMilliseconds;
                    probe.sum = sum;
                    Console.WriteLine("GetRelationByPerson ok. Duration={0}", sw.ElapsedMilliseconds); // 7
                    res.WriteLine(probe.ToCSV());
                }
                else if (probe.sol == "unused")
                {
                    int  cnt    = 0;
                    bool toload = false;
                    toload = true;
                    if (toload)
                    {
                        sw.Restart();
                        Phototeka generator = new Phototeka(npersons, 2378459);
                        tabs.Build(
                            generator.Generate1of3()
                            .Concat(generator.Generate2of3()
                                    .Concat(generator.Generate3of3())));

                        sw.Stop();
                        Console.WriteLine("Load ok. duration={0}", sw.ElapsedMilliseconds);
                    }

                    sw.Restart();
                    for (int i = 0; i < 10000; i++)
                    {
                        int      code = rnd.Next(npersons - 1);
                        object[] v    = tabs.GetPersonByCode(code);
                    }
                    sw.Stop();
                    Console.WriteLine("10000 persons ok. duration={0}", sw.ElapsedMilliseconds);

                    sw.Restart();
                    for (int i = 0; i < 10000; i++)
                    {
                        int      code = rnd.Next(2 * npersons - 1);
                        object[] v    = tabs.GetPhoto_docByCode(code);
                        if (i == 200)
                        {
                            Console.WriteLine("photo_doc record: {0} {1}", v[0], v[1]);
                        }
                    }
                    sw.Stop();
                    Console.WriteLine("10000 photo_docs ok. duration={0}", sw.ElapsedMilliseconds);

                    sw.Restart();
                    for (int i = 0; i < 10000; i++)
                    {
                        int code = rnd.Next(2 * npersons - 1);
                        cnt = tabs.GetReflectionsByReflected(code).Count();
                    }
                    sw.Stop();
                    Console.WriteLine("10000 portraits ok. duration={0}", sw.ElapsedMilliseconds);
                }
            }
            res.Close();
        }
예제 #9
0
파일: Program.cs 프로젝트: agmarchuk/SDII
        public static void Main()
        {
            Console.WriteLine("Start P13_NametableTry");
            string path  = ProjectDirectory.GetProjectDirectory();
            string dpath = path + "../Databases/p13nametabletry";

            if (!Directory.Exists(dpath))
            {
                Directory.CreateDirectory(dpath);
            }
            System.Diagnostics.Stopwatch sw = new System.Diagnostics.Stopwatch();

            TextWriter res     = new StreamWriter(new FileStream(path + "res.txt", FileMode.Append, FileAccess.Write));
            XElement   xcnf    = XElement.Load(path + "tests.xml");
            XElement   xcommon = XElement.Load(path + "../common.xml");

            xcommon.Add(xcnf);
            Random rnd;

            int[] testingcodes = null;

            NametableTry nametable = new NametableTry(dpath + "/");

            //Stan3TabsInt tabs = new Stan3TabsInt(dpath + "/");


            foreach (XElement xprobe in xcnf.Elements())
            {
                ProbeFrame probe = new ProbeFrame(xprobe.AncestorsAndSelf().Attributes());

                if (probe.sol == "LoadAll")
                {
                    // Загрузка
                    int siz = (int)probe.siz;

                    nametable.Clear();
                    sw.Restart();
                    nametable.BuildTable(
                        Enumerable.Range(0, siz).Select(i =>
                                                        new XElement("pair",
                                                                     new XAttribute("id", i),
                                                                     new XElement("name", i.ToString()))));
                    sw.Stop();
                    probe.lod = sw.ElapsedMilliseconds;
                    sw.Restart();
                    nametable.BuildIndexes();
                    sw.Stop();
                    probe.ndx = sw.ElapsedMilliseconds;

                    res.WriteLine(probe.ToCSV());
                    Console.WriteLine("Загрузка OK");
                }
                else if (probe.sol == "Code2String")
                {
                    rnd = new Random(777777777);
                    int nte = (int)probe.nte;

                    // выберем nte случайных кодов из таблицы имён
                    if (testingcodes == null)
                    {
                        testingcodes =
                            Enumerable.Range(0, nte)
                            .Select(i => rnd.Next((int)probe.siz - 1))
                            .ToArray();
                    }
                    nametable.Warmup();
                    sw.Restart();
                    long sum = 0L;
                    //nametable.Clear();
                    foreach (var code in testingcodes)
                    {
                        sum += nametable.GetNameByCode(code).Length;
                    }

                    sw.Stop();
                    probe.sum = sum;
                    probe.tim = sw.ElapsedMilliseconds;
                    probe.tsk = "int2str";
                    res.WriteLine(probe.ToCSV());
                    Console.WriteLine("Code2String OK");
                }
                else if (probe.sol == "String2Code")
                {
                    int nte = (int)probe.nte;
                    //rnd = new Random(777777777);
                    rnd = new Random(111111111);
                    // выберем nte случайных строк из таблицы имён
                    if (testingcodes == null)
                    {
                        testingcodes =
                            Enumerable.Range(0, nte)
                            .Select(i => rnd.Next((int)probe.siz - 1))
                            //.Select(i => str2Int.Values.ElementAt(i))
                            .ToArray();
                    }
                    string[] keys =
                        testingcodes
                        .Select(i => i.ToString())
                        .ToArray();
                    nametable.Warmup();
                    long sum = 0L;
                    sw.Restart();
                    int cnt = 0;
                    foreach (var key in keys)
                    {
                        int code = nametable.GetPersonsByName(key);
                        sum += code;
                        cnt++;
                    }
                    sw.Stop();
                    probe.sum = sum;
                    probe.tsk = "str2int";
                    probe.tim = sw.ElapsedMilliseconds;
                    res.WriteLine(probe.ToCSV());
                    Console.WriteLine("String2Code OK cnt={0}", cnt);
                }
            }
            res.Close();
        }
예제 #10
0
파일: Program.cs 프로젝트: agmarchuk/SDII
        static void Main(string[] args)
        {
            string path = ProjectDirectory.GetProjectDirectory();
            Console.WriteLine("Start TestGenerator");
            TextWriter res = new StreamWriter(new FileStream(path + "res.txt", FileMode.Append, FileAccess.Write));
            XElement xcnf = XElement.Load(path + "tests.xml");
            XElement xcommon = XElement.Load(path + "../common.xml");
            xcommon.Add(xcnf);
            Random rnd;
            System.Diagnostics.Stopwatch sw = new System.Diagnostics.Stopwatch();

            AdapterVirtuoso engine = new AdapterVirtuoso("HOST=localhost:1550;UID=dba;PWD=dba;Charset=UTF-8;Connection Timeout=500", "g");

            foreach (XElement xprobe in xcnf.Elements())
            {
                ProbeFrame probe = new ProbeFrame(xprobe.AncestorsAndSelf().Attributes());
                int npersons = (int)probe.siz;
                if (probe.sol == "virtuoso7_load")
                {
                    sw.Restart();
                    Reload(engine, npersons);
                    sw.Stop();
                    Console.WriteLine("Load ok. Duration={0}", sw.ElapsedMilliseconds); // 10000: 14.9 сек.
                    probe.ndx = sw.ElapsedMilliseconds;
                    res.WriteLine(probe.ToCSV());
                }
                else if (probe.sol == "virtuoso7_SelectById")
                {
                    rnd = new Random(777777777);
                    long sum = 0;
                    sw.Restart();

                    for (int i = 0; i < probe.nte; i++)
                    {
                        string sid = "person"+ rnd.Next(0, (int)probe.siz - 1);
                        var v = engine.Query("sparql select * { <" + sid + "> ?p ?o }");
                        sum +=(int) v.First(paramValues => paramValues[0].ToString() == "age")[1];
                    }
                    sw.Stop();
                    probe.tim = sw.ElapsedMilliseconds;
                    probe.sum = sum;
                    Console.WriteLine("SelectById ok. Duration={0}", sw.ElapsedMilliseconds); // 7
                    res.WriteLine(probe.ToCSV());
                }
                else if (probe.sol == "virtuoso7_SearchByName")
                {
                    Console.WriteLine((string)engine.Query("sparql select Count(?p) { ?p a <person>}").First()[0].ToString());
                    Console.WriteLine((string)engine.Query("sparql select Count(?p) { ?p a <photo_doc>}").First()[0].ToString());
                    Console.WriteLine((string)engine.Query("sparql select Count(?p) { ?p a <reflection>}").First()[0].ToString());
                    rnd = new Random(777777777);
                    sw.Restart();
                    long sum = 0;
                    for (int i = 0; i < probe.nte; i++)
                    {
                        var intId = rnd.Next(0, (int)probe.siz - 1);
                        string namePrefix = "Pupkin" + intId / 10;
                        //sum += (int)engine.Query(string.Format("sparql select ?s {{ ?s <name> ?o . Filter(strStarts(str(?o), \"{0}\")) }}", namePrefix)).Count();
                        var enumerable = engine.Query(string.Format("sparql select ?s {{ ?s <name> ?o . Filter(strStarts(str(?o), \"{0}\")) }}", namePrefix));
                        //foreach (var objectse in enumerable)
                        //{
                        //    foreach (var o in objectse)
                        //    {
                        //        if (o is SqlRdfBox)
                        //            string oname = (string)engine.Query("sparql select ?name { <" + o + "> <name> ?name}").First()[0].ToString();
                        //        if (!o.ToString().StartsWith(namePrefix))
                        //            Console.WriteLine("ERROR!");
                        //    }
                        //}
                        sum += (int)enumerable.Count();
                   }
                    sw.Stop();
                    probe.tim = sw.ElapsedMilliseconds;
                    probe.sum = sum;
                    Console.WriteLine("SearchByName ok. Duration={0}", sw.ElapsedMilliseconds); // 7
                    res.WriteLine(probe.ToCSV());
                }
                else if (probe.sol == "virtuoso7_GetRelationByPerson")
                {
                    rnd = new Random(777777777);
                    sw.Restart();
                    long sum = 0;
                    for (int i = 0; i < probe.nte; i++)
                    {
                        string persId = "person"+ rnd.Next(0, (int)probe.siz - 1);
                        sum += engine.Query(string.Format("sparql select ?phname {{?refl <reflected> <{0}> . ?refl <in_doc> ?ph . ?ph <name> ?phname}}", persId))
                            .Count();
                    }
                    sw.Stop();
                    probe.tim = sw.ElapsedMilliseconds;
                    probe.sum = sum;
                    Console.WriteLine("GetRelationByPerson ok. Duration={0}", sw.ElapsedMilliseconds); // 7
                    res.WriteLine(probe.ToCSV());
                }
                else if (probe.sol == "unused")
                {
                }
            }
            res.Close();
        }