next up previous contents
Next: Output of the Wuthering Up: A Wuthering Heights database Previous: Wuthering heights database

Queries to Wuthering Heights database

Note that these queries are included in the same file as the database (if not, an extra `consult' instruction is required).

/****** Added by DG in answer to SP's questions *********/

%% MALE:
%%
%% male(X) :- not(female(X)).
%%
%% Note: If this is used, then `male' is defined twice, at the moment.


%% NOT:

not(X) :- call(X), !, fail.
not(_).


% LOOPS with outputs:

enumerate :-
  parent(X,Y),
  write(X), write(' is a parent of '), write(Y), write('.'), nl, fail.

enumerate :-
  female(X),
  write(X), write(' is a female.'), nl, fail.

enumerate :-
  male(X),
  write(X), write(' is a male.'), nl, fail.

enumerate :-
  son(X,Y),
  write(X), write(' is the son of '), write(Y), write('.'), nl, fail.

enumerate :-
  daughter(X,Y),
  write(X), write(' is the daughter of '), write(Y), write('.'), nl, fail.

enumerate :-
  father(X,Y),
  write(X), write(' is the father of '), write(Y), write('.'), nl, fail.

enumerate :-
  mother(X,Y),
  write(X), write(' is the mother of '), write(Y), write('.'), nl, fail.

enumerate :-
  husband(X,Y),
  write(X), write(' is the husband of '), write(Y), write('.'), nl, fail.

enumerate :-
  wife(X,Y),
  write(X), write(' is the wife of '), write(Y), write('.'), nl, fail.

enumerate :-
  home(X,Y),
  write(X), write(' is the home of '), write(Y), write('.'), nl, fail.

enumerate :-
  death(X,Y),
  write(X), write('''s death is ' ), write(Y), write('.'), nl, fail.



%%%%%%%%% START --- Try and work this one out :) DG %%%%%%%%%%%%%%%%%%%

:- not(enumerate), halt.

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%



Dafydd Gibbon
Fri Nov 28 02:24:58 MET 1997