コード例 #1
0
        public void TestImportPerformance25M()
        {
            const string fileName = "bsbm_25m.nt";

            if (!File.Exists(BrightstarDB.Configuration.StoreLocation + "\\import\\" + fileName))
            {
                Assert.Inconclusive("Cannot locate required test file at {0}. Test will not run.",
                                    BrightstarDB.Configuration.StoreLocation + "\\import\\" + fileName);
                return;
            }
            var storeId = Guid.NewGuid().ToString();

            _storeManager.CreateStore(BrightstarDB.Configuration.StoreLocation + "\\" + storeId);
            var timer       = new Stopwatch();
            var storeWorker = new StoreWorker(BrightstarDB.Configuration.StoreLocation, storeId);

            storeWorker.Start();
            timer.Start();
            var jobId = storeWorker.Import(fileName, Constants.DefaultGraphUri).ToString();
            JobExecutionStatus jobStatus = storeWorker.GetJobStatus(jobId);

            while (jobStatus.JobStatus == JobStatus.Pending || jobStatus.JobStatus == JobStatus.Started)
            {
                Thread.Sleep(100);
                jobStatus = storeWorker.GetJobStatus(jobId);
            }
            timer.Stop();
            Console.WriteLine("Time to import test file '" + fileName + "': " + timer.ElapsedMilliseconds);
        }
コード例 #2
0
        public void TestImportAndLookupPerformance()
        {
            if (!File.Exists(BrightstarDB.Configuration.StoreLocation + "\\import\\bsbm_5m.nt"))
            {
                Assert.Inconclusive("Cannot locate required test file at {0}. Test will not run.",
                                    BrightstarDB.Configuration.StoreLocation + "\\import\\bsbm_5m.nt");
                return;
            }
            var storeId = Guid.NewGuid().ToString();

            _storeManager.CreateStore(BrightstarDB.Configuration.StoreLocation + "\\" + storeId);
            var timer       = new Stopwatch();
            var storeWorker = new StoreWorker(BrightstarDB.Configuration.StoreLocation, storeId);

            storeWorker.Start();
            timer.Start();
            var jobId = storeWorker.Import("bsbm_5m.nt", Constants.DefaultGraphUri).ToString();
            JobExecutionStatus jobStatus = storeWorker.GetJobStatus(jobId.ToString());

            while (jobStatus.JobStatus == JobStatus.Pending || jobStatus.JobStatus == JobStatus.Started)
            {
                Thread.Sleep(100);
                jobStatus = storeWorker.GetJobStatus(jobId.ToString());
            }

            timer.Stop();
            Console.WriteLine("Time to import 5M triples test file: " + timer.ElapsedMilliseconds);

            var store     = _storeManager.OpenStore(BrightstarDB.Configuration.StoreLocation + "\\" + storeId);
            var validator = new TriplesValidator(store, BrightstarDB.Configuration.StoreLocation + "\\import\\bsbm_5m.nt");

            timer.Reset();
            timer.Start();
            validator.Run();
            timer.Stop();
            Console.WriteLine("Time to validate 5M triples test file:" + timer.ElapsedMilliseconds);
            if (validator.UnmatchedTriples.Any())
            {
                Assert.Fail("Validator failed to match {0} triples:\n",
                            validator.UnmatchedTriples.Count,
                            String.Join("\n", validator.UnmatchedTriples)
                            );
            }
        }