Subject: Re: DATABASE EXTRACTION

From: Lionel Ains <[email-masked]>
Date: Thu, 13 Apr 2000 21:05:31 GMT+1

To get the next items that match your query, inside the 
database, you should force your search to fail, so that the 
Prolog engine tries to redo the query and find another 
match.

Here is an example on how to extract all people called 
John in your database:

Your search predicate should be similar to this:
extract_item(Name, Birthdate):-
  item(Name, Birthdate),
  format('The item (~w, ~w) matches~n', [Name, 
Birthdate]),
  fail.
extract_item(_, _).

If your database consists of the following facts:
item('John', '19700423').
item('John', '19860118').
item('Frank', '19690623').

Then the request:
?- extract_tiem('John', _).

Will output:
The item(John, 19700423) matches
The item(John, 19860118) matches

Yes
?-

I hope this will help you,

Lionel

_______________________________________________________
Vendez tout... aux enchères - http://www.caraplazza.com