I have a database in Prolog like this:
connection(a,b,bus)
connection(b,c,metro)
connection(b,d,taxi)
connection(d,e,bus)
What I want is the rules I need to apply so I can ask the question: "transport(a,c)" and it answers: "bus" and "metro"
Is that possible to define 1 or 2 rules so that the query "transport(a,c)" works ?
you should see the database like:
connection(Departure,Arrive,Transport).
so that... connection(D,A,T).
then the rules are:
connection(D,A,T):- traject(D,A,T).
connection(D,A,T):- traject(D,X,T1), traject(X,A,T2).
where...traject(Departure, X, Transport1)
and traject(X, Arrival, Transport2)
and the query should be something like:
transport(a,c,T1).
and
transport(a,c,T2).
and then the answer should come:
T1 = bus
T2 = metro