From lains@caramail.com  Thu Apr 13 21:17:46 2000
Received: from mail.caramail.com (mail.caramail.com [195.68.99.70])
	by swi.psy.uva.nl (8.9.3/8.9.3) with ESMTP id VAA05829
	for <prolog@swi.psy.uva.nl>; Thu, 13 Apr 2000 21:17:46 +0200 (MET DST)
Received: from caramail.com (filesrv2.caramail.com [195.68.99.57])
	by mail.caramail.com (8.8.8/8.8.8) with SMTP id VAA28155;
	Thu, 13 Apr 2000 21:21:15 +0100 (WET DST)
Posted-Date: Thu, 13 Apr 2000 21:21:15 +0100 (WET DST)
From: Lionel Ains <lains@caramail.com>
To: "Politini, Cohen" <CPolitini@colonial.com.au>
CC: prolog@swi.psy.uva.nl
Message-ID: <955645100000957@caramail.com>
X-Mailer: Caramail - www.caramail.com
X-Originating-IP: [194.202.131.4]
Mime-Version: 1.0
Subject: Re: DATABASE EXTRACTION
Date: Thu, 13 Apr 2000 21:05:31 GMT+1
Content-Type: multipart/mixed; boundary="=_NextPart_Caramail_000957955645100_ID"

This message is in MIME format. Since your mail reader does not understand
this format, some or all of this message may not be legible.

--=_NextPart_Caramail_000957955645100_ID
Content-Type: text/plain; charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

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=e8res - http://www.caraplazza.com


--=_NextPart_Caramail_000957955645100_ID--

