This repository has been archived on 2026-03-24. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
TP-BDD2/datalog/ex2.dl
2022-06-05 15:43:00 +02:00

19 lines
921 B
Plaintext

A1(X) :- step(ID,_,"GARE CENTRALE",_), line(ID,_,X,_).
A2(X) :- step(_,_,"GARE CENTRALE",X).
A3(X) :- step(ID,DIR,"GARE CENTRALE",Z), step(ID,DIR,Z,X).
S(ID,DIR,X) :- step(ID,DIR,"GARE CENTRALE",X).
S(ID,DIR,X) :- S(ID,DIR,Z), step(ID,DIR,Z,X).
A4(X) :- S(_,_,X).
IDS(ID1,ID2) :- step(ID1,_,_,X), step(ID1,_,"AUMALE",_), step(ID2,_,X,_), step(ID2,_,"ESPLANADE",_).
A5(C) :- line(X,_,_,C), IDS(X,_).
A5(C) :- line(X,_,_,C), IDS(_,X).
A6(X) :- line(_,_,X,_), not A1(X).
SNS(ID,DIR,X,Y) :- step(ID,DIR,X,Z),step(ID,DIR,Z,Y), not Y = X.
SNS(ID,DIR,X,Y) :- SNS(ID,DIR,X,Z), step(ID,DIR,Z,Y), not Y = X.
A7(ID,X) :- SNS(ID,DIR,X,Y), step(ID,DIR,Y,X).
NotTermnial(X) :- step(ID,DIR,_,X),step(ID,DIR,X,_).
Junction(X) :- step(ID1,_,_,X), step(ID2,_,X,_), not ID1 = ID2.
A8(X) :- step(_,_,_,X), not NotTermnial(X), not Junction(X).
A9(C, S) :- step(L1,city,S,_), step(L2,city,S,_), line(L1,_,bus,C), line(L2,_,bus,C), not L1=L2.