This repository has been archived on 2023-08-20. You can view files and clone it, but cannot push or open issues or pull requests.
yap-6.3/packages/CLPBN/examples/City/schema.yap
Vitor Santos Costa 21050891ee city example.
2011-07-02 09:49:12 +01:00

60 lines
1.4 KiB
Prolog

/* base file for school database. Supposed to be called from school_*.yap */
conservative_city(City, Cons) :-
cons_table(City, ConsDist),
{ Cons = cons(City) with p([y,n], ConsDist) }.
gender(X, Gender) :-
gender_table(City, GenderDist),
{ Gender = gender(City) with p([m,f], GenderDist) }.
hair_color(X, Color) :-
lives(X, City),
conservative_city(City, Cons),
gender(X, Gender),
color_table(X,ColorTable),
{ Color = color(X) with
p([t,f], ColorTable,[Gender,Cons]) }.
car_color(X, Color) :-
hair_color(City, HColor),
ccolor_table(X,CColorTable),
{ Color = ccolor(X) with
p([t,f], CColorTable,[HColor]) }.
height(X, Height) :-
gender(X, Gender),
height_table(X,HeightTable),
{ Height = height(X) with
p([t,f], HeightTable,[Gender]) }.
shoe_size(X, Shoesize) :-
height(X, Height),
shoe_size_table(X,ShoesizeTable),
{ Shoesize = shoe_size(X) with
p([t,f], ShoesizeTable,[Height]) }.
guilty(X, Guilt) :-
guilt_table(X, GuiltDist),
{ Guilt = guilt(X) with p([y,n], GuiltDist) }.
descn(X, Descn) :-
car_color(X, Car),
hair_color(X, Hair),
height(X, Height),
guilty(X, Guilt),
descn_table(X, DescTable),
{ Descn = descn(X) with
p([t,f], DescTable,[Car,Hair,Height,Guilt]) }.
witness(City, Witness) :-
descn(joe, DescnJ),
descn(1, Descn1),
wit_table(WitTable),
{ Witness = wit(City) with
p([t,f], WitTable,[DescnJ, Descn1]) }.