Example #1
0
        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);
        }
Example #2
0
        internal void AttachTo(EvaluatedDatabase database)
        {
            Initialize();

            database.RegisterContainer(Container);
        }