public static QueryResult ExecuteQuery(Query query, ScenarioDescription scenarioDescription)
 {
     return pageSwitcher.ExecuteQuery(query, scenarioDescription);
 }
 public Task<QueryResult> ExecuteQueryAsync(Query query)
 {
     throw new System.NotImplementedException();
 }
        public QueryResult ExecuteQuery(Query query, ScenarioDescription scenarioDescription)
        {
            QueryResultsContainer queryResultsContainer = new QueryResultsContainer(query.questionType);

            //tree initialization
            Tree tree = new Tree(TInf);
            //add first level
            int numberOfImpossibleLeaf = 0;
            tree.AddFirstLevel(worldDescription, scenarioDescription, out numberOfImpossibleLeaf);

            queryResultsContainer.AddMany(QueryResult.False, numberOfImpossibleLeaf);

            if (tree.LastLevel.Count > 0 && CheckIfLeafIsPossible(tree.LastLevel[0], scenarioDescription))
            {
                QueryResult result = query.CheckCondition(tree.LastLevel[0]);
                if (result == QueryResult.True || result == QueryResult.False)
                {
                    queryResultsContainer.AddMany(result);
                }
            }

            //generate next level if query can't answer yet
            while (!queryResultsContainer.CanQuickAnswer() && tree.LastLevel.Count > 0)
            {
                int childsCount = tree.LastLevel.Count;
                for (int i = 0; i < childsCount; ++i)
                {
                    Vertex leaf = tree.LastLevel[i];
                    if (!CheckIfLeafIsPossible(leaf, scenarioDescription))
                    {
                        tree.DeleteChild(i);
                        queryResultsContainer.AddMany(QueryResult.False);
                        if (queryResultsContainer.CanQuickAnswer())
                        {
                            break;
                        }
                    }
                    else
                    {
                        tree.DeleteChild(i);
                        List<Vertex> nextLevel = leaf.GenerateChildsForLeaf(worldDescription, scenarioDescription, TInf);

                        foreach (var child in nextLevel)
                        {
                            if (!CheckIfLeafIsPossible(child, scenarioDescription))
                            {
                                queryResultsContainer.AddMany(QueryResult.False);
                                if (queryResultsContainer.CanQuickAnswer())
                                {
                                    break;
                                }
                            }
                            QueryResult result = query.CheckCondition(child);
                            if (result == QueryResult.True || result == QueryResult.False)
                            {
                                queryResultsContainer.AddMany(result);
                            }
                            else
                            {
                                tree.Add(child);
                            }
                        }
                    }
                }
            }

            return queryResultsContainer.CollectResults();
        }
 public QueryResult ExecuteQuery(Query query, ScenarioDescription scenarioDescription)
 {
     return _reasoning.ExecuteQuery(query, scenarioDescription);
 }