CSc 8710 Deductive Databases and Logic Programming
Fall 1999
Programming Assignment #3
October 18, 1999 (Monday)
Consider the following Prolog query:
trip(L,S,E) :- leg(L,S,E). trip(L,S,E) :- leg(L,S,I), trip(L,I,E). trip(L,S,E) :- interchange(I,L,M), trip(L,S,I), trip(M,I,E). query(X) :- trip(blue,suwanee,X).where the base predicates are defined as follows:
leg(ne,doraville,chamblee). leg(ne,chamblee,doraville). leg(ne,chamblee,brookhaven). leg(ne,brookhaven,chamblee). leg(ne,brookhaven,lenox). leg(ne,lenox,brookhaven). leg(n,medical-center,dunwoody). leg(n,dunwoody,medical-center).
interchange(lindbergh,n,ne). interchange(lindbergh,ne,n). interchange(fivepoints,n,e). interchange(fivepoints,e,n). interchange(fivepoints,ne,e). interchange(fivepoints,e,ne).Write a program in Pro*C or Pro*C++ or Java (using JDBC or SQLJ database access) to answer the query. You should prompt the user for the two constants in the query (line and station values).