示例#1
0
        private static void RunBerlinsParameters(TripleStore ts)
        {
            Console.WriteLine("antrl parametered");
            int i         = 0;
            var fileInfos = new []
            {
                @"..\..\sparql data\queries\parameters\1.rq",
                @"..\..\sparql data\queries\parameters\2.rq",
                @"..\..\sparql data\queries\parameters\3.rq",
                @"..\..\sparql data\queries\parameters\4.rq",
                @"..\..\sparql data\queries\parameters\5.rq",
                @"..\..\sparql data\queries\parameters\6.rq",
                @"..\..\sparql data\queries\parameters\7.rq",
                @"..\..\sparql data\queries\parameters\8.rq",
                @"..\..\sparql data\queries\parameters\9.rq",
                @"..\..\sparql data\queries\parameters\10.rq",
                @"..\..\sparql data\queries\parameters\11.rq",
                @"..\..\sparql data\queries\parameters\12.rq",
            }
            .Select(s => new FileInfo(s))
            .ToArray();
            var paramvaluesFilePath = string.Format(@"..\..\sparql data\queries\parameters\param values for{0} m.txt", Millions);

            //using (StreamWriter streamQueryParameters = new StreamWriter(paramvaluesFilePath))
            //    for (int j = 0; j < 1000; j++)
            //        foreach (var file in fileInfos.Select(info => File.ReadAllText(info.FullName)))
            //            QueryWriteParameters(file, streamQueryParameters, ts);


            using (StreamReader streamQueryParameters = new StreamReader(paramvaluesFilePath))
            {
                for (int j = 0; j < 500; j++)
                {
                    fileInfos.Select(file => QueryReadParameters(File.ReadAllText(file.FullName),
                                                                 streamQueryParameters))
                    .Select(queryReadParameters => Parse(queryReadParameters).Run(ts))
                    .ToArray();
                }

                SubTestRun(ts, fileInfos, streamQueryParameters, 500);
            }
        }
示例#2
0
 public string Run(TripleStore ts)
 {
     if (AsqRun != null)
     {
         return(AsqRun(ts).ToString());
     }
     if (SelectRun != null)
     {
         return(string.Join(Environment.NewLine, SelectRun(ts).Select(spo => string.Join(", ", spo))));
     }
     if (DescribeRun != null)
     {
         return(string.Join(Environment.NewLine, DescribeRun(ts).Select(spo => string.Join(" ", spo))));
     }
     if (ConstructRun != null)
     {
         return(string.Join(Environment.NewLine, ConstructRun(ts).Select(spo => string.Join(" ", spo))));
     }
     throw new Exception();
 }
示例#3
0
        private static void SubTestRun(TripleStore ts, FileInfo[] fileInfos, StreamReader streamQueryParameters, int i1)
        {
            int i;

            long[]   results        = new long[12];
            double[] minimums       = Enumerable.Repeat(double.MaxValue, 12).ToArray();
            double[] maximums       = new double[12];
            double   maxMemoryUsage = 0;

            long[] totalparseMS = new long[12];
            long[] totalrun     = new long[12];
            for (int j = 0; j < i1; j++)
            {
                i = 0;

                foreach (var file in fileInfos)
                {
                    var readAllText = File.ReadAllText(file.FullName);
                    readAllText = QueryReadParameters(readAllText, streamQueryParameters);

                    var st = DateTime.Now;
                    var q  = Parse(readAllText);
                    totalparseMS[i] += (DateTime.Now - st).Ticks / 10000L;
                    var st1               = DateTime.Now;
                    var resultString      = q.Run(ts);
                    var totalMilliseconds = (DateTime.Now - st).Ticks / 10000L;
                    totalrun[i] += (DateTime.Now - st1).Ticks / 10000L;

                    var memoryUsage = GC.GetTotalMemory(false);
                    if (memoryUsage > maxMemoryUsage)
                    {
                        maxMemoryUsage = memoryUsage;
                    }
                    if (minimums[i] > totalMilliseconds)
                    {
                        minimums[i] = totalMilliseconds;
                    }
                    if (maximums[i] < totalMilliseconds)
                    {
                        maximums[i] = totalMilliseconds;
                    }
                    results[i++] += totalMilliseconds;
                    //  File.WriteAllText(Path.ChangeExtension(file.FullName, ".txt"), resultString);
                    //.Save(Path.ChangeExtension(file.FullName,".xml"));
                }
            }

            using (StreamWriter r = new StreamWriter(@"..\..\output.txt", true))
            {
                r.WriteLine("milions " + Millions);
                r.WriteLine("max memory usage " + maxMemoryUsage);
                r.WriteLine("average " + string.Join(", ", results.Select(l => l == 0 ? "inf" : (500 * 1000 / l).ToString())));
                r.WriteLine("minimums " + string.Join(", ", minimums));
                r.WriteLine("minimums " + string.Join(", ", minimums));
                r.WriteLine("maximums " + string.Join(", ", maximums));
                r.WriteLine("total parse " + string.Join(", ", totalparseMS));
                r.WriteLine("total run " + string.Join(", ", totalrun));
                r.WriteLine("EWT count" + EntitiesMemoryHashTable.count);
                r.WriteLine("EWT total search" + EntitiesMemoryHashTable.total);
                r.WriteLine("EWT max search" + EntitiesMemoryHashTable.max);
                r.WriteLine("EWT total range" + EntitiesMemoryHashTable.totalRange);
                r.WriteLine("EWT max range" + EntitiesMemoryHashTable.maxRange);
                r.WriteLine("EWT average search" + EntitiesMemoryHashTable.total / EntitiesMemoryHashTable.count);
                r.WriteLine("EWT average range" + EntitiesMemoryHashTable.totalRange / EntitiesMemoryHashTable.count);
            }
        }
示例#4
0
 public RPack(object[] row, TripleStore ts)
 {
     this.row = row;
     this.ts  = ts;
 }
示例#5
0
 private static IEnumerable <RPack> Repeat(object[] row, TripleStore ts)
 {
     yield return(new RPack(row, ts));
 }