Answered step by step
Verified Expert Solution
Question
1 Approved Answer
[PROLOG] Find the query to obtain the following answer using the findall predicate in a) to d) and the setof predicate in e): % Database
[PROLOG]
Find the query to obtain the following answer using the findall predicate in a) to d) and the setof predicate in e):
% Database for the above question
city(ottawa,ontario). city(toronto,ontario). city(kingston,ontario). city(gatineau,quebec). city(montreal,quebec). company(shopify,ottawa). company(rossvideo,ottawa). company(dium,gatineau). company(uber,toronto). company(deepmind,montreal). company(google,toronto). person(annie,gatineau). person(paul,gatineau). person(suzy,gatineau). person(robert,gatineau). person(tom,ottawa). person(tim,kingston). person(joe,montreal). person(jane,ottawa). person(marie,ottawa). person(jack,toronto). person(simon,toronto). employee(annie,dium). employee(tom,shopify). employee(jane,shopify). employee(marie,shopify). employee(joe,deepmind). employee(jack,google). employee(simon,google). employee(suzy,shopify). employee(paul,rossvideo). employee(marie,rossvideo). employee(simon,uber).
findall predicate: http://www.swi-prolog.org/pldoc/doc_for?object=findall/3
a) Obtain a list of persons who work in a city other than the one where they live: b) Obtain a list of Ontario companies c) Obtain the list of unemployed persons: d) Obtain the list of people working in Ottawa: e) The previous list contains twice the name of Marie, why? Show how one can use setof to L= [suzy, paul]. L = [shopify, rossvideo, uber, google]. L = [robert, tin]. L = [tom, jane, marie, suzy, paul, marie]. eliminate this problem. L = [jane, marie, paul, suzy, tom]. a) Obtain a list of persons who work in a city other than the one where they live: b) Obtain a list of Ontario companies c) Obtain the list of unemployed persons: d) Obtain the list of people working in Ottawa: e) The previous list contains twice the name of Marie, why? Show how one can use setof to L= [suzy, paul]. L = [shopify, rossvideo, uber, google]. L = [robert, tin]. L = [tom, jane, marie, suzy, paul, marie]. eliminate this problem. L = [jane, marie, paul, suzy, tom]Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started