Example #1
0
        public MainWindow()
        {
            InitializeComponent();
            dbContext = new Database1Entities();
            updatePrologFile();
            var prolog = new PrologEngine(persistentCommandHistory: false);

            prolog.Consult("courses.pl");

            /*// 'socrates' is human.
             * prolog.ConsultFromString("human(socrates).");
             * // human is bound to die.
             * prolog.ConsultFromString("mortal(X) :- human(X).");*/

            // Question: Shall 'socrates' die?
            //var solution = prolog.GetFirstSolution(query: "prereq(ece462,ZZZ).");
            //SolutionSet solution2 = prolog.GetAllSolutions("courses.pl", "prereq(ece561,ZZZ).");
            //Console.WriteLine(solution2[0]); // = "True" (Yes!)
            //Console.WriteLine(string.Join(",", solution2));

            /* var contacts = (from c in dbContext.courses select c).ToList(); //read data
             * foreach (course myc in contacts) {
             *   List<string> mylist = prereqOf(myc.course_code);
             *   for (int i = 0; i < mylist.Count; i++) {
             *       string temp = mylist[i];
             *       var result = dbContext.courses.First(x => x.course_code == temp);
             *       var records = dbContext.Set<prereq>();
             *       prereq abb = new prereq {
             *           course_code = myc.course_code,
             *           prerequisite_code = result.course_code
             *       };
             *       records.Add(abb);
             *       dbContext.SaveChanges();
             *   }
             * }*/
            //Console.WriteLine(solution.Solved); // = "True" (Yes!)
        }
Example #2
0
 public StudentAdvise()
 {
     InitializeComponent();
     dbContext = new Database1Entities();
 }