Question: [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):
![[PROLOG] Find the query to obtain the following answer using the](https://s3.amazonaws.com/si.experts.images/answers/2024/09/66d898de99e29_94266d898de189ba.jpg)
% 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
Get step-by-step solutions from verified subject matter experts
