Answered step by step
Verified Expert Solution
Link Copied!

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):

image text in transcribed

% 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

blur-text-image

Get Instant Access to Expert-Tailored 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

Recommended Textbook for

Spatial Databases A Tour

Authors: Shashi Shekhar, Sanjay Chawla

1st Edition

0130174807, 978-0130174802

More Books

Students also viewed these Databases questions

Question

The Helmholtz function of a substance has the form

Answered: 1 week ago