public DataStoreFrame LoadDataStore(string dsName) { List <Vertex> vList = null; List <Edge> eList = null; List <VisulizationConfig> vcList = null; List <NLUIntentRule> iList = null; List <EntityData> enList = null; List <EntityAttributeData> eaList = null; (vList, eList, vcList, iList, enList, eaList) = this.dataAccessor.Load(dsName); if (vcList == null || vList == null || eList == null) { log.Here().Warning("No KG Data loaded from persistence"); return(null); } DataPersistanceKGParser kgParser = new DataPersistanceKGParser(); KnowledgeGraphDataFrame kgDF = kgParser.ParseKG(vList, eList); KGConfigFrame kgConfigFrame = kgParser.ParseKGConfig(vcList); log.Information("Knowledge Graph is parsed."); Console.WriteLine("Knowledge Graph is parsed."); NLUDataFrame nluDF = null; if (iList == null || enList == null) { log.Here().Warning("No NLU Data loaded from persistence"); } else { DataPersistanceNLUParser nluParser = new DataPersistanceNLUParser(); nluDF = nluParser.Parse(iList, enList, eaList); log.Information("NLU materials is parsed."); Console.WriteLine("NLU materials is parsed."); } DataStoreFrame dsFrame = new DataStoreFrame(dsName, kgDF, kgConfigFrame, nluDF); return(dsFrame); }
public void Load(string dsName) { KnowledgeGraphStore.GetInstance().Clean(); NLUStore.GetInstance().Clean(); this.currentDataStoreName = dsName; (this.vList, this.eList, this.vcList, this.iList, this.enList, this.eaList) = this.dataAccessor.Load(dsName); if (this.vcList == null || this.vList == null || this.eList == null) { throw new Exception("Cannot load KG data from persistance."); } DataPersistanceKGParser kgParser = new DataPersistanceKGParser(this.vList, this.eList, this.vcList); kgParser.ParseKG(); log.Information("Knowledge Graph is parsed."); Console.WriteLine("Knowledge Graph is parsed."); if (this.iList == null || this.enList == null) { log.Here().Warning("No NLU Data loaded from persistence"); } else { DataPersistanceNLUParser nluParser = new DataPersistanceNLUParser(this.iList, this.enList, this.eaList); nluParser.Parse(); List <Vertex> roots = KnowledgeGraphStore.GetInstance().GetAllVertexes(); nluParser.ParseScenarioSettings(this.settings, roots); log.Information("NLU materials is parsed."); Console.WriteLine("NLU materials is parsed."); } }
// 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); } }