This is a classical Prolog application. Given the following graph of possible flights between eight US cities. (See Attached Screenshot) A) Build a prolog using the predicate directFlight/2 which encodes one city has direct flight to another city. B) Add to rule that checks if there is a route between two cities. Routes of length zero are allowed. Example queries: route(chicago, chicago). should return yes. route(chicago,la). should return yes. route(la,'San Fracisco'). should return no. C) Add a rule that checks if a route has two legs. Example queries: route_of_2_legs(chicago,la). should return yes route_of_2_legs(chicago,denver). should return no
Concepts in Designing Database
A database design is the process of data organization based on a database model. The process deals with identifying what data should be stored in a database and how data elements relate to each other.
Entity Relationship Diagram
Complex real-world applications call for large volumes of data. Therefore, it is necessary to build a great database to store data safely and coherently. The ER data model aids in the process of database design. It helps outline the structure of an organization’s database by understanding the real-world interactions of objects related to the data. For example, if a school is tasked to store student information, then analyzing the correlation between the students, subjects, and teachers would help identify how the data needs to be stored.
This is a classical Prolog application. Given the following graph of possible flights between eight US cities. (See Attached Screenshot)
A) Build a prolog using the predicate directFlight/2 which encodes one city has direct flight to another city.
B) Add to rule that checks if there is a route between two cities. Routes of length zero are allowed. Example queries:
route(chicago, chicago). should return yes.
route(chicago,la). should return yes. route(la,'San Fracisco'). should return no.
C) Add a rule that checks if a route has two legs. Example queries:
route_of_2_legs(chicago,la). should return yes
route_of_2_legs(chicago,denver). should return no
D) Add cost factor to directFlight, route, and route_of_2_legs so that the knowledge base can tell the cost associated with each flight. For example, route(chicago, X, Y). tells all the cities reachable from Chicago, and the cost(Y)to fly from Chicago to each city(X).
Trending now
This is a popular solution!
Step by step
Solved in 2 steps with 1 images