示例#1
0
        private static void RunAllLUBMByOne()
        {
            var Store = new StoreCascadingInt("../../../Databases/int based/");

            if (false)
            {
                Store.Clear();
                foreach (
                    var owlFile in
                    new DirectoryInfo(@"C:\Users\Admin\Source\Repos\RDF-Store-Polar-DB-Lab\Testing\examples\lubm")
                    .GetFiles("*.owl"))
                {
                    Store.AddFromXml(XElement.Load(owlFile.FullName));
                }
            }
            else
            {
                Console.WriteLine(Store.table.Elements().Count());
                //   Store.ActivateCache();
                Store.Start();
            }
            for (int i = 0; i < 14; i++)
            {
                SparqlTesting.OneLUMB(Store, i + 1, 100);
            }
        }
示例#2
0
        static void Main(string[] args)
        {
            Stopwatch timer;
            Store     store = new Store("../../../Databases/");

            timer = new Stopwatch();
            timer.Start();
            store.ReloadFrom(10 * 1000 * 1000, @"C:\deployed\10M.ttl");
            timer.Stop();
            Console.WriteLine(timer.Elapsed.TotalSeconds);
            store.ActivateCache();

            foreach (var tripleOvStruct in store.GetTriplesWithTextObject(new OV_string("prayers")))
            {
                Console.WriteLine(tripleOvStruct.Subject.ToString());
                Console.WriteLine(tripleOvStruct.Predicate.ToString());
                Console.WriteLine(tripleOvStruct.Object.ToString());
                Console.WriteLine();
            }

            SparqlTesting.OneBerlinParametrized(store, 6, 100);
        }
示例#3
0
        public static void OneLUMB(IStore store, int i, int count)
        {
            SparqlQueryParser.Parse(store, sq5);
            store.Warmup();
            {
                var    file = new FileInfo(string.Format(@"..\..\..\Testing\examples\lubm\q ({0}).rq", i));
                var    q = File.ReadAllText(file.FullName);
                double min = int.MaxValue, max = -1, average = 0;
                double averageParse = 0;
                double averageCLS   = 0;
                double averageRun   = 0;
                for (int j = 0; j < count; j++)
                {
                    Stopwatch timer = new Stopwatch();
                    timer.Restart();
                    var sparqlQuery = SparqlQueryParser.Parse(store, q);
                    timer.Stop();

                    double time1 = SparqlTesting.GetTimeWthLast2Digits(timer);
                    averageParse += (double)((int)(100 * time1 / count)) / 100;

                    timer.Restart();
                    var sparqlResultSet = sparqlQuery.Run();
                    timer.Stop();

                    double time2 = SparqlTesting.GetTimeWthLast2Digits(timer);
                    averageCLS += (double)((int)(100 * time2 / count)) / 100;

                    timer.Restart();
                    sparqlResultSet.Results.ToArray();
                    timer.Stop();

                    double time3 = SparqlTesting.GetTimeWthLast2Digits(timer);
                    averageRun += (double)((int)(100 * time3 / count)) / 100;

                    var time = time1 + time2 + time3;
                    average += (double)((int)(100 * time)) / 100;


                    if (time > max)
                    {
                        max = time;
                    }
                    if (min > time)
                    {
                        min = time;
                    }

                    File.WriteAllText(@"..\..\..\Testing\examples\lubm\q ({0}).json", sparqlResultSet.ToJson());
                }
                using (StreamWriter r = new StreamWriter(@"..\..\output.txt", true))
                {
                    r.WriteLine(DateTimeOffset.Now);
                    r.WriteLine("q " + i);
                    r.WriteLine("average " + average / count);
                    r.WriteLine("qps " + ((double)((int)(100000 * count / average)) / 100));
                    r.WriteLine("min " + min);
                    r.WriteLine("max " + max);
                    r.WriteLine("memory usage (bytes)" + GC.GetTotalMemory(false));
                    r.WriteLine("parse (ms)" + averageParse);
                    r.WriteLine("create linq stack " + averageCLS);
                    r.WriteLine("run " + averageRun);
                }
            }
        }
示例#4
0
        public static void OneBerlinParametrized(IStore store, int i, int count)
        {
            SparqlQueryParser.Parse(store, sq5);
            store.Warmup();
            using (StreamReader streamQueryParameters = new StreamReader(string.Format(
                                                                             @"..\..\..\Testing\examples\bsbm\queries\parameters\param values for{0}m {1} query.txt", 1, i)))
            {
                var file =
                    new FileInfo(string.Format(@"..\..\..\Testing\examples\bsbm\queries\parameters\{0}.rq", i));
                var    parametred = File.ReadAllText(file.FullName);
                double min = int.MaxValue, max = -1, average = 0;
                double averageParse = 0;
                double averageCLS   = 0;
                double averageRun   = 0;
                for (int j = 0; j < count; j++)
                {
                    var consted = BSBmParams.QueryReadNewParameters(parametred, streamQueryParameters);


                    Stopwatch timer = new Stopwatch();
                    timer.Restart();
                    var sparqlQuery = SparqlQueryParser.Parse(store, consted);
                    timer.Stop();

                    double time1 = SparqlTesting.GetTimeWthLast2Digits(timer);
                    averageParse += (double)((int)(100 * time1 / count)) / 100;

                    timer.Restart();
                    var sparqlResultSet = sparqlQuery.Run();
                    timer.Stop();

                    double time2 = SparqlTesting.GetTimeWthLast2Digits(timer);
                    averageCLS += (double)((int)(100 * time2 / count)) / 100;

                    timer.Restart();
                    sparqlResultSet.Results.ToArray();
                    timer.Stop();

                    double time3 = SparqlTesting.GetTimeWthLast2Digits(timer);
                    averageRun += (double)((int)(100 * time3 / count)) / 100;

                    var time = time1 + time2 + time3;
                    average += (double)((int)(100 * time)) / 100;


                    if (time > max)
                    {
                        max = time;
                    }
                    if (min > time)
                    {
                        min = time;
                    }
                }
                using (StreamWriter r = new StreamWriter(@"..\..\output.txt", true))
                {
                    r.WriteLine(DateTimeOffset.Now);
                    r.WriteLine("q " + i);
                    r.WriteLine("average " + average / count);
                    r.WriteLine("qps " + ((double)((int)(100000 * count / average)) / 100));
                    r.WriteLine("min " + min);
                    r.WriteLine("max " + max);
                    r.WriteLine("memory usage (bytes)" + GC.GetTotalMemory(false));
                    r.WriteLine("parse (ms)" + averageParse);
                    r.WriteLine("create linq stack " + averageCLS);
                    r.WriteLine("run " + averageRun);
                }
            }
        }