Question: A database can be represented in Prolog as a set of facts. For example, a database about families can be represented so that each family
A database can be represented in Prolog as a set of facts. For example, a database about families can be represented so that each family is described by one clause. As the number of children varies from family to family the children are represented by a list that can accommodate any number of items. Each person is in turn, represented by a structure of four components:
name, surname, date of birth, job. The job information is unemployed or it contains the name of the organization and the salary.
For instance:
family
persontom fox, datemay, worksbbc
person ann, fox, datemay, unemployed
personpat fox, datemay,unemployed
personjim fox, dateSmay, unemployed
Write queries to find the following from the family database:
a names of families without children;
b all employed children;
c names of families with employed wives and unemployed husbands;
d all the children whose parents differ in age by at least years.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
