This assignment concerns facts and rules that might be part of a larger(Prolog-style) database of an employee/employer information. We will requirethat the company organization is hierarchical (that is, there are no cyclesin the organization chart), but it need not be a tree (for example, someonemay be supervised by, say, two vice-presidents).due tonight at 11:30pmWe will use these types of data items: ssn - a 3 digit ID number (unique within each company). name(first,last) - the first and last name of an employee. title - a job title (president, vice_president, department_head, worker, etc.) company - a company name. date(month,year) - month is 1-12 and year is a four-digit year.
FACTS: The only type of facts are listed here.
empName(ssn, name(first, last)). current_job(ssn, title, company). supervisor(ssn, ssn). background(ssn, title, date(month, year), date{month, year), company).{start and ending dates}
RULES: You will write the following rules:
sameLastName(ssn, ssn, company). Are there two people at the same company with the same last name?
workTogether(ssn, ssn). Did these two people work together at the same company at the same time?
supervises(title, title). Does someone of first title supervise someone of second title?
above(ssn,ssn). Is first currently above second on the chain of command?
chainOfCommand(ssn, ssn, chain). chain is a list of last names from the second up to the first.
If someone is still employed then their ending date should be date(12,2050).
ASSIGNMENT: You will create three ASCII files.First create a file of facts to test your rules. The data should havetwo companies with at least 5 levels in the organization, and include a total ofat least 10 people; it should have enough complexity that every rule can befully tested (preferably in more than one way).
Second create a file with code for the 6 rules given above (plus any otherauxiliary rules you desire).
Third you will also create a file of queries that will explore the different type ofquestions that can be asked (see figures A.1 and A.2 in Appendix A).
Only use features of Prolog covered in the Appendix!GRADING: We will run your program on SWI Prolog. We will use a combinationof your queries and our own queries. We will also run it with our own file of facts.