public override QueryBenchmark RunBenchmark()
        {
            var benchmark = new QueryBenchmark();
            var variables = QueryGraph.Edges.Select(x => x.Value).Where(x => !x.IsConstant).Select(x => x.name).ToArray();

            benchmark.GraphQuery    = QueryGraph.Nodes.First().Value.ToSparql(QueryGraph, variables).ToString().FixQuery();
            benchmark.GraphString   = QueryGraph.ToString();
            benchmark.GraphHashCode = QueryGraph.GetHashCode();
            benchmark.BenchmarkType = "Local";

            // Begin timing
            var stopwatch = new Stopwatch();

            stopwatch.Start();

            //Query
            queryGraphResults.GetGraphQueryResults(QueryGraph, QueryGraph.EntitiesIndexPath, QueryGraph.PropertiesIndexPath, false, false);

            // Write result
            stopwatch.Stop();
            benchmark.ElapsedTime = stopwatch.Elapsed;

            //Set Results
            foreach (var edge in QueryGraph.Edges.Select(x => x.Value))
            {
                benchmark.ResultsDictionary.Add(edge.name, edge.Results.Select(x => x.Id).ToArray());
            }

            return(benchmark);
        }
示例#2
0
        public override QueryBenchmark RunBenchmark()
        {
            var benchmark = new QueryBenchmark();
            var variables = QueryGraph.Edges.Select(x => x.Value).Where(x => !x.IsConstant).Select(x => x.name).ToArray();

            benchmark.GraphQuery    = QueryGraph.Nodes.First().Value.ToSparql(QueryGraph, variables).ToString().FixQuery();
            benchmark.GraphString   = QueryGraph.ToString();
            benchmark.GraphHashCode = QueryGraph.GetHashCode();
            benchmark.BenchmarkType = "Endpoint";

            // Begin timing
            var stopwatch = new Stopwatch();

            stopwatch.Start();

            //Query
            GraphApiQueries.QueryTimeoutMs = 50000; //50 secs
            var results = GraphApiQueries.RunQuery(benchmark.GraphQuery);

            // Write result
            stopwatch.Stop();
            benchmark.ElapsedTime = stopwatch.Elapsed;

            //Set Results
            if (results != null)
            {
                benchmark.ResultsDictionary = GetEndpointResults(results);
            }

            return(benchmark);
        }