Question: Question 5 [10] Consider the Prolog database and procedures given below distance (X,Y,D) - d(X,Y,D); d(Y,X,D). d(pta, bfn, 455) d(bfn,ct,990) a(bfn,pe, 680) a(jhb, kby, 470).

 Question 5 [10] Consider the Prolog database and procedures given below

Question 5 [10] Consider the Prolog database and procedures given below distance (X,Y,D) - d(X,Y,D); d(Y,X,D). d(pta, bfn, 455) d(bfn,ct,990) a(bfn,pe, 680) a(jhb, kby, 470). a(ct, kby,970) coastal(ct) coastal (pe) interior(X):- not(coastal(x)) (2) collecti(L) - bagof(x, distance(X,Y,D),L) collect2(L):- setof (X,D\distance (X,Y,D),L) (a) Give the value of L returned by the following query 7- collect1(L). (b) Give the value of L returned by the following query 7- collect2(L). (c) Give all the results of the following query ?- coastal(x), once (distance (X,Y,D)), interior (Y) (d) Give all the results of the following query: ?- coastal(x), not((distance (X,Y,D),coastal(Y))) (2) (3) (3) Question 5 [10] Consider the Prolog database and procedures given below distance (X,Y,D) - d(X,Y,D); d(Y,X,D). d(pta, bfn, 455) d(bfn,ct,990) a(bfn,pe, 680) a(jhb, kby, 470). a(ct, kby,970) coastal(ct) coastal (pe) interior(X):- not(coastal(x)) (2) collecti(L) - bagof(x, distance(X,Y,D),L) collect2(L):- setof (X,D\distance (X,Y,D),L) (a) Give the value of L returned by the following query 7- collect1(L). (b) Give the value of L returned by the following query 7- collect2(L). (c) Give all the results of the following query ?- coastal(x), once (distance (X,Y,D)), interior (Y) (d) Give all the results of the following query: ?- coastal(x), not((distance (X,Y,D),coastal(Y))) (2) (3) (3)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!