%%  CHAPITRE 5

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%
%%      Pr\'edicats ensemblistes

boisson(toto, the).
boisson(toto, lait).
boisson(toto, biere).
boisson(koko, lait).
boisson(koko, the).
boisson(koko, vin).
boisson(jojo, the).
boisson(jojo, vin).
boisson(pierre, lait).

boisson(toto, the, chaud).
boisson(toto, lait, chaud).
boisson(toto, biere, fraiche).
boisson(toto, vin, froid).
boisson(koko, lait, froid).
boisson(koko, lait, froid).
boisson(koko, the, chaud).
boisson(koko, vin, chaud).
boisson(jojo, the, chaud).
boisson(jojo, vin, chambre).
boisson(pierre, lait, froid).

nom(toto).
nom(koko).
nom(jojo).
nom(toto).


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
%  Graphe - successeur (suc), meme niveau (mNiv),
%  descendants des sommets du m\^eme niveau (col)
%  descendants des descendants des sommets du m\^eme niveau (cocol)
%  predecesseur Imm\'ediat (predI), predecesseur (pred)
%  predecesseur imm\'ediat de predI (predi2)


gr(a,b).
gr(a,g).
gr(b,e).
gr(b,c).
gr(g,e).
gr(g,h).
gr(e,f).
gr(f,c).
gr(f,h).
gr(c,d).
gr(h,d).

%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%

%%  CHAPITRE 6   Bases de Donn\'ees


/*  BdD enseignant   */

enseignantPere(titi,toto,lola).
enseignantPere(koko,lolo,lina).
enseignantMere(titi,toto,lola).
enseignantMere(tintin,tino,lory).

/*  BdD  Pere-Mere   */

pere(toto,titi).
pere(toto,koko).
pere(koko,tintin).
pere(tintin,tino).
pere(tino,tony).
mere(lola,titi).
mere(lola, koko).
mere(alma, tintin).

/*  BdD parent, fille, gar\ccon  */

parent(X) :- pere(X,_);mere(X,_).

fille(titi).
garcon(toto).
garcon(koko).
garcon(tino).
garcon(tino).



/*  Base de donn\'ees voitures  */

voiture(123, fiat, toto, marron).
voiture(321, volvo, tata, rouge).
voiture(111, mazerati, cathy, blanche).
voiture(222, renault, loulou, rouge).
voiture(314, citroen, alma, verte).


/*  Base de donn\'ees identit\'e des personnes  */

personne(jojo, m, 16, toto, cathy).
personne(toto, m, 45, loulou, louloute).
personne(cathy, f, 40, koko, tata).
personne(anne, f, 14, toto, cathy).
personne(lolo, m, 30, koko,tata).
personne(louloute, f, 38, olive, alma).
personne(alma, f, 65, momo, mimi).


/*  Base de donn\'ees virtuelle  */

bddVirt(voiture,Nu,numero,Nu) :- voiture(Nu,_,_,_).
bddVirt(voiture,Nu,marque,Ma) :- voiture(Nu,Ma,_,_).
bddVirt(voiture,Nu,proprietaire,Pr) :- voiture(Nu,_,Pr,_).
bddVirt(voiture,Nu,couleur,Co) :- voiture(Nu,_,_,Co).

bddVirt(personne,Nom,nom,Nom) :- personne(Nom,_,_,_,_).
bddVirt(personne,Nom,sexe,Se) :- personne(Nom,Se,_,_,_).
bddVirt(personne,Nom,age,Ag) :- personne(Nom,_,Ag,_,_).
bddVirt(personne,Nom,pere,Pe) :- personne(Nom,_,_,Pe,_).
bddVirt(personne,Nom,mere,Me) :- personne(Nom,_,_,_,Me).

/*  BdD relationnelles   */

produit(100, bille,  100, verte).
produit(200, poupee,  50, rouge).
produit(300, voiture, 70, jaune).
produit(400, carte,  350, bleue).

vente(1, dupont,  100, 30, 080399).
vente(2, martin,  200, 10, 070199).
vente(3, charles, 100, 50, 010100).
vente(4, charles, 300, 50, 010100).
vente(5, jojo,    500, 20, 060207).

achat(1, fournier, 100, 70, 010399).
achat(2, fournier, 200,100, 010399).
achat(3, dubois,   100, 50, 010999).
achat(4, dubois,   300, 50, 010999).
achat(5, toto,     500, 10, 060207).

