Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

The following in Prolog The purpose of this assignment is to implement a database for students in classes. The supplied knowledge basel have facts about

The following in Prolog

image text in transcribed

The purpose of this assignment is to implement a database for students in classes. The supplied knowledge basel have facts about students, courses, classrooms, and class times. Your task is to implement some predicates to get information from the database. classtime(1000,10) classtime(1200, 12) classtime (3400,11) classtime(3350, 12) classtime (2350,11) where (1000, dobbs102) where (1200,dobbs118) where (3400,wentw216). where (3350,wentw118) where (2350,wentw216) enroll (mary,1200). enroll (john, 3400) enroll (mary,3350) enroll(john,1000) enroll (jim,1000) 2.2 Predicates Define the following predicates by writing a rule or rules for them. The examples and results are using the facts given above. You will have to write some new facts to test your predicates correctly and completely 2.2.1 schedule/3 The schedule predicate should take the arguments of (student, classroom, time). With this predicate, we can form queries such as ?-schedule (mary, P, T). and get results: P dobbs 118 T- 12; P = wentwi 18 T-12; This predicate can also query a classroom's usage with something like?- schedule (s, wentw216, T). This will show all the students in a classroom and the times that they are there. 2.2.2 usage/2 The usage predicate should take the arguments of (classroom, time) and gives all the times that a classroom is in use. For example, ?- usage (dobbs102, T). would result in: T10; . The query usage (X, 12) should return all of the classrooms that are in use at 12 2.2.3 roomconflict/2 A conflict exists if two different courses are using the same classroom at the same time. ?-roomconflict (X, 3350). should return false. The query roomconflict (X,Y). should return all room conflicts in the database. The two arguments are course numbers. 2.2.4 meet/2 This predicate will decide if two students (given as the two arguments) can meet each other, according to their schedules. There are two ways that two students can meet: either they can meet by being enrolled in the same course, or they can have different classes in the same classrooms at adjacent times (off by an hour) For this predicate, you only need to return true for one ordering of the query. For example, meet (mary, john). might be true, or meet (john, mary). might be true. Assume that all classes start and stop exactly on the hour The purpose of this assignment is to implement a database for students in classes. The supplied knowledge basel have facts about students, courses, classrooms, and class times. Your task is to implement some predicates to get information from the database. classtime(1000,10) classtime(1200, 12) classtime (3400,11) classtime(3350, 12) classtime (2350,11) where (1000, dobbs102) where (1200,dobbs118) where (3400,wentw216). where (3350,wentw118) where (2350,wentw216) enroll (mary,1200). enroll (john, 3400) enroll (mary,3350) enroll(john,1000) enroll (jim,1000) 2.2 Predicates Define the following predicates by writing a rule or rules for them. The examples and results are using the facts given above. You will have to write some new facts to test your predicates correctly and completely 2.2.1 schedule/3 The schedule predicate should take the arguments of (student, classroom, time). With this predicate, we can form queries such as ?-schedule (mary, P, T). and get results: P dobbs 118 T- 12; P = wentwi 18 T-12; This predicate can also query a classroom's usage with something like?- schedule (s, wentw216, T). This will show all the students in a classroom and the times that they are there. 2.2.2 usage/2 The usage predicate should take the arguments of (classroom, time) and gives all the times that a classroom is in use. For example, ?- usage (dobbs102, T). would result in: T10; . The query usage (X, 12) should return all of the classrooms that are in use at 12 2.2.3 roomconflict/2 A conflict exists if two different courses are using the same classroom at the same time. ?-roomconflict (X, 3350). should return false. The query roomconflict (X,Y). should return all room conflicts in the database. The two arguments are course numbers. 2.2.4 meet/2 This predicate will decide if two students (given as the two arguments) can meet each other, according to their schedules. There are two ways that two students can meet: either they can meet by being enrolled in the same course, or they can have different classes in the same classrooms at adjacent times (off by an hour) For this predicate, you only need to return true for one ordering of the query. For example, meet (mary, john). might be true, or meet (john, mary). might be true. Assume that all classes start and stop exactly on the hour

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Put Your Data To Work 52 Tips And Techniques For Effectively Managing Your Database

Authors: Wes Trochlil

1st Edition

0880343079, 978-0880343077

Students also viewed these Databases questions

Question

1.what is the significance of Taxonomy ?

Answered: 1 week ago

Question

What are the advantages and disadvantages of leasing ?

Answered: 1 week ago

Question

Name is needed for identifying organisms ?

Answered: 1 week ago

Question

2. What type of team would you recommend?

Answered: 1 week ago