public void TestSimpleJoinQuery()
        {
            var sparqlQuery =
                @"PREFIX bsbm: <http://www4.wiwiss.fu-berlin.de/bizer/bsbm/v01/vocabulary/> 
                    SELECT ?review WHERE { 
                        ?review bsbm:reviewFor ?product . 
                        ?product bsbm:productFeature <http://www4.wiwiss.fu-berlin.de/bizer/bsbm/v01/instances/ProductFeature2330> .
                    } LIMIT 3";
            // Warm-up
            var client = BrightstarService.GetClient("type=embedded;storesDirectory=stores");

            for (int i = 0; i < 5; i++)
            {
                client.ExecuteQuery("SparqlPerformance", sparqlQuery);
            }

            // Profile
            var profiler = new BrightstarProfiler("SimpleJoinQuery");

            for (int i = 0; i < 100; i++)
            {
                using (profiler.Step("ExecuteQuery"))
                {
                    client.ExecuteQuery("SparqlPerformance", sparqlQuery);
                }
            }

            Console.WriteLine(profiler.GetLogString());
        }
示例#2
0
        public void TestSimpleJoinQuery()
        {
            var sparqlQuery =
                    @"PREFIX bsbm: <http://www4.wiwiss.fu-berlin.de/bizer/bsbm/v01/vocabulary/> 
                    SELECT ?review WHERE { 
                        ?review bsbm:reviewFor ?product . 
                        ?product bsbm:productFeature <http://www4.wiwiss.fu-berlin.de/bizer/bsbm/v01/instances/ProductFeature2330> .
                    } LIMIT 3";
            // Warm-up
            var client = BrightstarService.GetClient("type=embedded;storesDirectory=stores");
            for (int i = 0; i < 5; i++)
            {
                client.ExecuteQuery("SparqlPerformance", sparqlQuery);
            }

            // Profile
            var profiler = new BrightstarProfiler("SimpleJoinQuery");
            for (int i = 0; i < 1000; i++)
            {
                using (profiler.Step("ExecuteQuery"))
                {
                    client.ExecuteQuery("SparqlPerformance", sparqlQuery);
                }
            }

            Console.WriteLine(profiler.GetLogString());
        }
示例#3
0
        public override void Run()
        {
            try
            {
                Logging.LogInfo("Import job being run on file " + _contentFileName);
                StoreWorker.TransactionLog.LogStartTransaction(this);

                var parser = GetParser(_contentFileName);
                var storeDirectory = StoreWorker.WriteStore.DirectoryPath;
                var filePath = Path.Combine(storeDirectory,
                                            ".." + Path.DirectorySeparatorChar + "import" + Path.DirectorySeparatorChar +
                                            _contentFileName);
                var profiler = new BrightstarProfiler("Import " + _contentFileName); // TODO : Conditionally create this if profiling is enabled
                Logging.LogDebug("Import file path calculated as '{0}'", filePath);
                if (!File.Exists(filePath))
                {
                    ErrorMessage = String.Format("Cannot find file {0} in import directory", _contentFileName);
                    throw new FileNotFoundException(ErrorMessage);
                }
                using (_fileStream = new FileStream(filePath, FileMode.Open, FileAccess.Read))
                {
                    _importTripleSink = new StoreTripleSink(StoreWorker.WriteStore, JobId,
                                                            Configuration.TransactionFlushTripleCount,
                                                            profiler:profiler);
                    parser.Parse(_fileStream, this, _graphUri);
                }
                StoreWorker.WriteStore.Commit(JobId, profiler);
                StoreWorker.InvalidateReadStore();

                Logging.LogInfo("Import job completed successfully for " + _contentFileName);
                if (profiler != null)
                {
                    Logging.LogInfo(profiler.GetLogString());
                }
                StoreWorker.TransactionLog.LogEndSuccessfulTransaction(this);
            }
            catch (RdfParserException parserException)
            {
                ErrorMessage = parserException.Message;
                ExceptionDetail = new ExceptionDetail(parserException);
                Logging.LogInfo("Parser error processing import job on file " + _contentFileName + ". " + parserException.Message);
                throw;
            }
            catch (Exception ex)
            {
                ErrorMessage = "Error importing file " + _contentFileName + ". " + ex.Message;
                StoreWorker.TransactionLog.LogEndFailedTransaction(this);
                Logging.LogInfo("Error processing import job on file " + _contentFileName + ". Error Message: " + ex.Message + " Stack trace: " + ex.StackTrace);
                throw;
            }
        }
示例#4
0
        public override void Run()
        {
            try
            {
                Logging.LogInfo("Import job being run on file " + _contentFileName);
                StoreWorker.TransactionLog.LogStartTransaction(this);

                var parser         = GetParser(_contentFileName);
                var storeDirectory = StoreWorker.WriteStore.DirectoryPath;
                var filePath       = Path.Combine(storeDirectory,
                                                  ".." + Path.DirectorySeparatorChar + "import" + Path.DirectorySeparatorChar +
                                                  _contentFileName);
                var profiler = new BrightstarProfiler("Import " + _contentFileName); // TODO : Conditionally create this if profiling is enabled
                Logging.LogDebug("Import file path calculated as '{0}'", filePath);
                if (!File.Exists(filePath))
                {
                    ErrorMessage = String.Format("Cannot find file {0} in import directory", _contentFileName);
                    throw new FileNotFoundException(ErrorMessage);
                }
                using (_fileStream = new FileStream(filePath, FileMode.Open, FileAccess.Read))
                {
                    _importTripleSink = new StoreTripleSink(StoreWorker.WriteStore, JobId,
                                                            Configuration.TransactionFlushTripleCount,
                                                            profiler: profiler);
                    parser.Parse(_fileStream, this, _graphUri);
                }
                StoreWorker.WriteStore.Commit(JobId, profiler);
                StoreWorker.InvalidateReadStore();

                Logging.LogInfo("Import job completed successfully for " + _contentFileName);
                if (profiler != null)
                {
                    Logging.LogInfo(profiler.GetLogString());
                }
                StoreWorker.TransactionLog.LogEndSuccessfulTransaction(this);
            }
            catch (RdfParserException parserException)
            {
                ErrorMessage    = parserException.Message;
                ExceptionDetail = new ExceptionDetail(parserException);
                Logging.LogInfo("Parser error processing import job on file " + _contentFileName + ". " + parserException.Message);
                throw;
            }
            catch (Exception ex)
            {
                ErrorMessage = "Error importing file " + _contentFileName + ". " + ex.Message;
                StoreWorker.TransactionLog.LogEndFailedTransaction(this);
                Logging.LogInfo("Error processing import job on file " + _contentFileName + ". Error Message: " + ex.Message + " Stack trace: " + ex.StackTrace);
                throw;
            }
        }