database( { sybase::mother( Child:varchar(100), Mother:varchar(100) ) from sybase_chpc use family1 user_name guest application_name 'ldl++' interface_filename '/usr/project/dedc/ldl++/system/demo/interfaces' password '' sybase::father( Child:varchar(100), Father:varchar(100) ) from sybase_chpc use family1 user_name guest application_name 'ldl++' interface_filename '/usr/project/dedc/ldl++/system/demo/interfaces' password '' sybase::orphan( Person:varchar(100) ) from sybase_chpc use family1 user_name guest application_name 'ldl++' interface_filename '/usr/project/dedc/ldl++/system/demo/interfaces' password '' sybase::french( Person:varchar(100) ) from sybase_chpc use family1 user_name guest application_name 'ldl++' interface_filename '/usr/project/dedc/ldl++/system/demo/interfaces' password '' } ). export add_sybase_father($X,$Y). export delete_sybase_father($X). export parent(Child, Parent). export parent($Child, Parent). export parent(Child, $Parent). export parent($Child, $Parent). export ancestor(Descendant, Ancestor). export ancestor($Descendant, Ancestor). export ancestor(Descendant, $Ancestor). export ancestor($Descendant, $Ancestor). export ancestor0(Descendant, Ancestor). export ancestor0($Descendant, Ancestor). export ancestor0(Descendant, $Ancestor). export ancestor0($Descendant, $Ancestor). export ancestor1(Descendant, Ancestor). export ancestor1($Descendant, Ancestor). export ancestor1(Descendant, $Ancestor). export ancestor1($Descendant, $Ancestor). export ancestor2(Descendant, Ancestor). export ancestor2($Descendant, Ancestor). export ancestor2(Descendant, $Ancestor). export ancestor2($Descendant, $Ancestor). export same_generation(X, Y). export same_generation($X, Y). export same_generation(X, $Y). export same_generation($X, $Y). export same_generation1(X, Y). export same_generation1($X, Y). export same_generation1(X, $Y). export same_generation1($X, $Y). export same_generation2(X, Y). export same_generation2($X, Y). export same_generation2(X, $Y). export same_generation2($X, $Y). export same_generation3(X, Y). export same_generation3($X, Y). export same_generation3(X, $Y). export same_generation3($X, $Y). export bbf(X). export bbf($X). export bbf0(X). export bbf0($X). % % parent(Child, Parent) % Parent is either the mother or the father of Child. % parent(Child, Father) <- father(Child, Father). parent(Child, Mother) <- mother(Child, Mother). % % ancestor(Descendant, Ancestor) % Descendant is the descendant (child, grandchild, etc.) of Ancestor. % % ancestor(Descendant, Ancestor) <- parent(Descendant, Ancestor). ancestor(Descendant, Ancestor) <- parent(Descendant, Parent), ancestor(Parent, Ancestor). ancestor0(Descendant, Ancestor) <- parent(Descendant, Ancestor). ancestor0(Descendant, Parent) <- ancestor0(Descendant, Ancestor), parent(Ancestor, Parent). ancestor1(Descendant, Ancestor) <- parent(Descendant, Ancestor). ancestor1(Descendant, Ancestor) <- ancestor1(Descendant, Ancestor0), ancestor1(Ancestor0, Ancestor). ancestor2(Descendant, Ancestor) <- parent(Descendant, Ancestor). ancestor2(Descendant, Ancestor) <- ancestor2(Ancestor0, Ancestor), ancestor2(Descendant, Ancestor0). % % same_generation(X, Y) % X and Y are members of the same generation. % same_generation(X, Y) <- parent(X, XParent), same_generation(XParent, YParent), parent(Y, YParent). same_generation(X, X) <- orphan(X). same_generation1(X, Y) <- same_generation1(XParent, YParent), parent(X, XParent), parent(Y, YParent). same_generation1(X, X) <- orphan(X). same_generation2(X, Y) <- parent(X, XParent), parent(Y, YParent), same_generation2(XParent, YParent). same_generation2(X, X) <- orphan(X). same_generation3(X, Y) <- parent(Y, YParent), same_generation3(XParent, YParent), parent(X, XParent). same_generation3(X, X) <- orphan(X). % % bbf(X) % X is a blue-blooded-frenchman. % bbf(X) <- french(X), orphan(X). bbf(X) <- bbf(Mother), mother(X, Mother), bbf(Father), father(X, Father). bbf0(X) <- french(X), orphan(X). bbf0(X) <- mother(X, Mother), bbf0(Mother), father(X, Father), bbf0(Father). add_sybase_father(X,Y) <- +father(X,Y). delete_sybase_father(X) <- -father(X,_).