Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Assume we have the following knowledge base in a Prolog program: building(engineering, ev). building(business, mb). building(library, lb). building(classes, h). building(hr,fg). department(electrical, engineering). department(civil, engineering). department(finance,

image text in transcribed

Assume we have the following knowledge base in a Prolog program: building(engineering, ev). building(business, mb). building(library, lb). building(classes, h). building(hr,fg). department(electrical, engineering). department(civil, engineering). department(finance, business). department(ibm-exams, lb). status(engineering, accredited). faculty(smith, electrical). faculty(walsh, electrical). faculty(smith, computer). facultyjones, civil). faculty(james, civil). faculty(davis, civil). faculty(X, Y):- department(Z, Y), faculty(X, Z). building(X, Y):- department(X, Z), building(Z, Y). status(X, Z) :- department(X, Y), status(Y,Z). faculty(X) :- faculty(X, ). Determine the type of each of the following queries (groundon-ground), and explain what will Prolog respond for each of these queries (write all the steps of unifications and resolutions for each query)? ? building(library, lb). ? status(finance, A). ? department(civil, Bussiness). ? faculty X, civil). ? faculty(smith, X). ? department(X, Y). ? faculty(X, civil), department(civil, Y). ? faculty(Smith). ? building, X). ? status(X, accredited), building(X, Y). ? status(_, X), building(X, Y). ? faculty(X), faculty(X, Y), department(Y, _). ? faculty(X), faculty(X, Y), !, department(Y,Z). ? faculty(X), !, faculty(X, _). ? department(X, _), 1+ faculty(, X). % note there is a cut (!) here % note there is a cut (!) here Assume we have the following knowledge base in a Prolog program: building(engineering, ev). building(business, mb). building(library, lb). building(classes, h). building(hr,fg). department(electrical, engineering). department(civil, engineering). department(finance, business). department(ibm-exams, lb). status(engineering, accredited). faculty(smith, electrical). faculty(walsh, electrical). faculty(smith, computer). facultyjones, civil). faculty(james, civil). faculty(davis, civil). faculty(X, Y):- department(Z, Y), faculty(X, Z). building(X, Y):- department(X, Z), building(Z, Y). status(X, Z) :- department(X, Y), status(Y,Z). faculty(X) :- faculty(X, ). Determine the type of each of the following queries (groundon-ground), and explain what will Prolog respond for each of these queries (write all the steps of unifications and resolutions for each query)? ? building(library, lb). ? status(finance, A). ? department(civil, Bussiness). ? faculty X, civil). ? faculty(smith, X). ? department(X, Y). ? faculty(X, civil), department(civil, Y). ? faculty(Smith). ? building, X). ? status(X, accredited), building(X, Y). ? status(_, X), building(X, Y). ? faculty(X), faculty(X, Y), department(Y, _). ? faculty(X), faculty(X, Y), !, department(Y,Z). ? faculty(X), !, faculty(X, _). ? department(X, _), 1+ faculty(, X). % note there is a cut (!) here % note there is a cut (!) here

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered 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

Students also viewed these Databases questions