// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, Microsoft.AspNetCore.Hosting.IHostingEnvironment env, ILoggerFactory loggerFactory, ILogger <Startup> _log) { if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); } else { app.UseExceptionHandler("/Error"); // The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts. app.UseHsts(); } app.UseCors(builder => { builder.AllowAnyMethod() .AllowAnyHeader() .AllowAnyOrigin(); }); app.UseHttpsRedirection(); app.UseSession(); app.UseMvcWithDefaultRoute(); loggerFactory.AddSerilog(); Serilog.ILogger log = Log.Logger.ForContext <Startup>().Here(); try { KGDataAccessor.initInstance(Configuration); log.Information("MongoDB is initialized."); } catch (Exception e) { log.Error("Exception in MongoDB initializing.\n" + e.Message); } try { KGDataAccessor accessor = KGDataAccessor.GetInstance(); List <Vertex> vList = accessor.GetVertexCollection(); List <Edge> eList = accessor.GetEdgeCollection(); List <VisulizationConfig> vcList = accessor.GetVisulizationConfigs(); DataPersistanceKGParser kgParser = new DataPersistanceKGParser(vList, eList, vcList); kgParser.ParseKG(); log.Information("Knowledge Graph is parsed."); Console.WriteLine("Knowledge Graph is parsed."); } catch (Exception e) { log.Error("Exception in KnowledgeGraph parsing.\n" + e.Message); Console.WriteLine("[Error]" + e.Message); } }
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory, ILogger <Startup> _log) { if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); } else { app.UseExceptionHandler("/Error"); // The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts. app.UseHsts(); } app.UseCors(builder => { builder.AllowAnyMethod() .AllowAnyHeader() .AllowAnyOrigin(); }); app.UseHttpsRedirection(); app.UseSession(); app.UseMvcWithDefaultRoute(); loggerFactory.AddSerilog(); Serilog.ILogger log = Log.Logger.ForContext <Startup>().Here(); try { KGDataAccessor.initInstance(Configuration); log.Information("KG Data is initialized."); } catch (Exception e) { log.Error("Exception in KG Data initializing.\n" + e.Message); } try { KGDataAccessor accessor = KGDataAccessor.GetInstance(); List <Vertex> vList = accessor.GetVertexCollection(); List <Edge> eList = accessor.GetEdgeCollection(); List <VisulizationConfig> vcList = accessor.GetVisulizationConfigs(); DataPersistanceKGParser kgParser = new DataPersistanceKGParser(vList, eList, vcList); kgParser.ParseKG(); log.Information("Knowledge Graph is parsed."); Console.WriteLine("Knowledge Graph is parsed."); } catch (Exception e) { log.Error("Exception in KnowledgeGraph parsing.\n" + e.Message); Console.WriteLine("[Error]" + e.Message); } try { NLUDataAccessor.initInstance(Configuration); log.Information("NLU Data is initialized."); } catch (Exception e) { log.Error("Exception in NLU Data initializing.\n" + e.Message); } try { List <ScenarioSetting> settings = Configuration.GetSection("Scenarios").Get <List <ScenarioSetting> >(); NLUDataAccessor accessor = NLUDataAccessor.GetInstance(); DataPersistanceNLUParser nluParser = new DataPersistanceNLUParser(accessor.GetIntentCollection(), accessor.GetEntityCollection(), accessor.GetEntityAttributeCollection()); nluParser.Parse(); List <Vertex> roots = KnowledgeGraphStore.GetInstance().GetAllVertexes(); nluParser.ParseScenarioSettings(settings, roots); log.Information("NLU materials is parsed."); Console.WriteLine("NLU materials is parsed."); } catch (Exception e) { log.Error("Exception in NLU materials parsing.\n" + e.Message); } try { ContextAccessController.initInstance(Configuration); log.Information("Context Data is initialized."); } catch (Exception e) { log.Error("Exception in Context Data initializing.\n" + e.Message); } }