How to clean the previous data 
Author Message
 How to clean the previous data

Dear friends:

I am really a new hand about PROLOG. Could you give me some advice about my
problems.

I use 'assert' to insert some data into database, but when I start another
running on program, I find the previous data still in the database which I
really do not want them, even though I exit current program and reopen it
again. I know I can put some 'retract' at the beginning of the program and
clean the old data from database, but I have used a lots 'assert', so I have
to put a lots 'retract' in the program, it is really too awkful. I wonder some
experts on PROLOG can give an effect way to deal with this problem apart from
'retract'.

Thanks a lot in advance for your help.

Mr. Y Yang (Ph.D Student)
Bioengineering Unit
University of Strathclyde
UK



Mon, 20 Jul 1998 03:00:00 GMT  
 How to clean the previous data

Quote:
>Dear friends:
>I am really a new hand about PROLOG. Could you give me some advice about my
>problems.
>I use 'assert' to insert some data into database, but when I start another
>running on program, I find the previous data still in the database which I
>really do not want them, even though I exit current program and reopen it
>again. I know I can put some 'retract' at the beginning of the program and
>clean the old data from database, but I have used a lots 'assert', so I have
>to put a lots 'retract' in the program, it is really too awkful. I wonder some
>experts on PROLOG can give an effect way to deal with this problem apart from
>'retract'.

While you can solve the problem doing a series of 'retracts', I am wondering
which is the way to erase a previous loaded rule from your memory.
For instance you could consult a file with some rules that you want to erase
while using another database. Someone around with a quick solution?
Thanks

Alessio Lomuscio,
PhD Student, University of Birmingham.



Tue, 21 Jul 1998 03:00:00 GMT  
 How to clean the previous data


Quote:
>While you can solve the problem doing a series of 'retracts', I am wondering
>which is the way to erase a previous loaded rule from your memory.
>For instance you could consult a file with some rules that you want to erase
>while using another database. Someone around with a quick solution?
>Thanks

        If you're trying to just clear the interpreter's memory, one way is to
issue the "abort" command. That works for me in cprolog.

Roger Wistar



Wed, 22 Jul 1998 03:00:00 GMT  
 How to clean the previous data

: Dear friends:

: I am really a new hand about PROLOG. Could you give me some advice about my
: problems.

: I use 'assert' to insert some data into database, but when I start another
: running on program, I find the previous data still in the database which I
: really do not want them, even though I exit current program and reopen it
: again. I know I can put some 'retract' at the beginning of the program and
: clean the old data from database, but I have used a lots 'assert', so I have
: to put a lots 'retract' in the program, it is really too awkful. I wonder some
: experts on PROLOG can give an effect way to deal with this problem apart from
: 'retract'.

: Thanks a lot in advance for your help.

Hi,
        There are no doubt many solutions to this problem. The easiest is
to use abolish(Pred/Arity) - using retract may also run you into problems
if you leave choice-points after the last computation (ie untried branches)
as the logical-update-view of the database may restore certain parts of the
database to how they were when you first entered the predicate.
        Most good Prologs will garbage collect the rest of the data at
little penalty - certainly less than restarting the interpreter.
        IF/Prolog certainly supports this and other ISO predicates (and
Edinburgh syntax) and is available on all UNIX, MS-Windows etc

Cheers

Andrew

Prolog Hotline Support,

marketing: Annette Kolb
technical: Dr. Andrew R. Verden,                   IF Computer GmbH,

Tel:    +49 89 7936 0037                           D-82065 Baierbrunn,
Fax:    +49 89 7936 0039                           Germany.

World Wide Web:  http://www.biz.isar.de/ifcomputer/



Fri, 24 Jul 1998 03:00:00 GMT  
 How to clean the previous data

<snip>

Quote:
>I use 'assert' to insert some data into database, but when I start another
>running on program, I find the previous data still in the database which I
>really do not want them, even though I exit current program and reopen it
>again.

The simplest solution to your problem may be to use retractall/1. See your
reference manual for details.

Rgds

John Fletcher



Fri, 24 Jul 1998 03:00:00 GMT  
 
 [ 5 post ] 

 Relevant Pages 

1. Can I read previous test data into Labview?

2. Data files II (Disregard previous message from e.lim@auckland.ac.nz

3. error reading data: OMMIT Previous post ()

4. data types ML/Clean

5. Python and GDBM with 8bit clean data

6. [Clean]:trouble installing clean on linux

7. clean, non-clean functions

8. My previous

9. Correction of my previous posting.

10. Handle of previous (non-dolphin) Window

11. Contents of previous patches?

12. Previous Bankruptcies or Foreclosures OK

 

 
Powered by phpBB® Forum Software