Express the query of Exercise 13.19 in Datalog.

What will be an ideal response?

First, we de?ne the transitive closure of DirectFlight:


Flight(?F,?T) :- DirectFlight(?F,?T).
Flight(?F,?T) :- DirectFlight(?F,?I), Flight(?I,?T).


Then we de?ne the required query:

FlightsWithTwoOrMoreStops(?F,?T) :-
DirectFlight(?F,?S1),
DirectFlight(?S1,?S2),
Flight(?S2,?T).

Computer Science & Information Technology

You might also like to view...

The __________ category of external devices are suitable for communicating with the computer user.

A) ?application ? B) ?machine readable C) ?communication ? D) ?human readable

Computer Science & Information Technology

A ________ is a Python data type that contains a sequence of characters.

Fill in the blank(s) with the appropriate word(s).

Computer Science & Information Technology