internal static void ModuleTesting() { var externalDatabase = RestaurantAgent.CreateRestaurantDatabase(); var module = new ExternalDatabaseProviderModule("restaurant", externalDatabase); var database = new EvaluatedDatabase(); database.Container .Pattern("luxury") .WhatItSpecifies("pricerange") .HowToEvaluate("expensive") ; database.StartQueryLog(); module.AttachTo(database); var result = database.Query(SemanticItem.AnswerQuery(Question.HowToDo, Constraints.WithInput("set restaurant specifier luxury"))); //var result = database.Query(SemanticItem.AnswerQuery(Question.IsItTrue, Constraints.WithInput("restaurant database has 1 result"))); var actionId = result.FirstOrDefault().Answer; var action = database.GetNativeAction(actionId); action(result.FirstOrDefault()); var log = database.FinishLog(); Log.Questions(log.GetQuestions()); Log.Result(result); Log.Dump(database); }
private bool executeCall(SemanticItem command) { var nativeAction = Db.GetNativeAction(command.Answer); if (nativeAction == null) { return(false); } return(nativeAction(command)); }