Amzi! Prolog Question (Image Save) 
Author Message
 Amzi! Prolog Question (Image Save)

Hey all.

I'm using Amzi! Prolog (free version) on Win95 and I'd like to
know if there is anything in Amzi! Prolog that allows one to
save the state of the listener and restore it?  I read about
save/1 in some Prolog systems that did this, but Amzi! doesn't
have it, and after reading the help files, I couldn't find anything
that would seem to be related to this.  Did I miss this or am I
truly out of luck?

Assuming the latter is true, then what would be the best way of
accomplishing the following:

        I'm currently working on a database program where
        "records" are "added" via assert/1, and "removed"
        via retract (with modifications being used via a combo
        of the two).  Now this technique appeals to me, but the
        problem is I need a way to save the state of my "database"
        otherwise when I quit the program, I'll lose my rules.

I know about write, but since I need to both add, remove, and modify
records, is there an easier way to go about it?  The ways I'm
envisioning doing it with write, are not pretty or elegant (at least
not as much as saving an image).

If worse comes to worse, and I'm really in a bind, is there a
PC Prolog that offers these features, and that's freely available?

Thanks,
Ahmed



Sun, 29 Aug 1999 03:00:00 GMT  
 Amzi! Prolog Question (Image Save)

Quote:

>I'm using Amzi! Prolog (free version) on Win95 and I'd like to
>know if there is anything in Amzi! Prolog that allows one to
>save the state of the listener and restore it?  I read about
>save/1 in some Prolog systems that did this, but Amzi! doesn't
>...
>If worse comes to worse, and I'm really in a bind, is there a
>PC Prolog that offers these features, and that's freely available?

As Amzi! does nothing else, lets advertise once :-)  Yes, SWI-Prolog
provides qsave_program/[1,2] to save the program (not the current
goal-stack).  Saved states are machine independent.  On a few platforms
there is a true `save/restore' that just continues execution.  That
was doable on most BSD derived Unix systems, but increasingly difficult
on modern Unix and other operating systems.

Personally, I think it is a better idea to write out your database using
write_canonical/1. All you need to know is what predicates form the
database. This nicely separates the data from the program.

qsave_program/[1,2] does little else: it just dumps all defined
clauses in a binary format that loads quickly, and saves most of the
remainder of the state (records, operator declarations, etc.) using
dedicated format or as directives.

qsave_program/[1,2] is basically meant to create ready-to-run
executables.

        Cheers --- Jan

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Jan Wielemaker                Author of SWI-Prolog and the XPCE GUI library
SWI, University of Amsterdam  http://www.swi.psy.uva.nl/usr/jan/SWI-Prolog.html



Sun, 29 Aug 1999 03:00:00 GMT  
 Amzi! Prolog Question (Image Save)

Quote:

>Hey all.
>I'm using Amzi! Prolog (free version) on Win95 and I'd like to
>know if there is anything in Amzi! Prolog that allows one to
>save the state of the listener and restore it?  I read about
>save/1 in some Prolog systems that did this, but Amzi! doesn't
>have it, and after reading the help files, I couldn't find anything
>that would seem to be related to this.  Did I miss this or am I
>truly out of luck?

You can implement your own save that is either general or just saves
specific predicates as follows:

save(FILENAME) :-
  tell(FILENAME),
  listing,
  told.

save(FILENAME, PREDICATE_LIST) :-
  tell(FILENAME),
  save_each(PREDICATE_LIST),
  told.

  save_each([]).
  save_each([PREDICATE|REST]) :-
    listing(PREDICATE),
    save_each(REST).

Regards,
Mary Kroening

-------------------------------------------------------------------------
|  Amzi! inc.                                   Intelligent Components  |
|  40 Samuel Prescott Drive                            and Logic-Bases  |
|  Stow, MA 01775    U.S.A.                    for C/C++, Java, Delphi, |
|  tel      +1 508 897 7332                   VB, Web Servers and more  |
|  fax      +1 508 897 2784                                       with  |

|  web      http://www.amzi.com                              and WebLS  |
-------------------------------------------------------------------------



Sun, 29 Aug 1999 03:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Amzi Prolog - Newbie Question

2. Amzi Prolog versus LPA Prolog.

3. Amzi-Prolog vs. Visual Prolog

4. Question: How to save the image of lisp?

5. image file name changed on image save

6. Searching Amzi Prolog with Smalltalk examples

7. Amzi Prolog - Warplan exame: extending it

8. Amzi Prolog for the Web

9. Amzi! Prolog

10. Random in Amzi Prolog

11. How Do I: Browser-Enable Amzi Prolog Program

12. Amzi Prolog and SQL Server

 

 
Powered by phpBB® Forum Software