Thank you Francisco, I hope you dont mind me writing back to all the users.
I have been working on the perl side for now, and have implemented a POSTGRES database table system for storing all the facts. It turns out that a DB is very comfortable to use.
Now prolog will be very interesting to use for the analysis and queries, because many of the queries to validate programs and analyse semantics are logical in nature.
Do you think that such a cacheing system is interesting even if there is a database? I mean, caching is also a way implement swapping, but if you have a datbase, who will be implementing the caching?
How hard will it be to create a DB access to an existing database, what are your experiences?
Mike
-----Original Message----- From: Francisco Bueno Carrillo [mailto:bueno(a)clip.dia.fi.upm.es] Sent: Donnerstag, 31. Januar 2002 15:56 To: michael.dupont(a)mciworldcom.de Subject: Re: Database and memory limitations
Michael,
I don't know if you have return to Prolog in your project of program meta information of c++ programs. When I first saw your message about memory limitations I implemented a small library that automatically allows to cache Prolog facts in files, so that only a limited amount of them reside in Prolog's memory at one time. I am sending you the code attached, in case you find it useful.
It is made up of three files: cache.pl cache_tr.pl cache_rt.pl You have to put them in a subdirectory "cache" of the library directory of your Ciao installation. Then you can use it as a package, so that you write in your program module:
:- use_package(cache).
and this enables the use of directives of the form:
:- cache(node/3,node_info_file,1000).
to specify that predicate node/3 is defined in file node_info_file by Prolog facts, of which there should be only up to 1000 in Prolog's memory at any given time.
Note that it only works if the predicate is defined only by facts. Note also that the upper bound on the number of "active" facts is related to each goal to the predicate, so you have to do some estimation: the bound x the number of goals active (i.e., which still have a possibility to be backtracked into) at any given time during execution should be lower than the total number of facts of the predicate. Otherwise, you will end up having more facts in memory than those that define the predicate itself, with the effect of overloading Prolog's memory instead of alleviating it!!
Please, also note that I have not thoroughly tested this package, so it is kind of in beta mode. Anyway, I hope you find it useful!
Francisco Bueno CLIP group - CS Dept. - FIM - UPM Campus de Montegancedo - 28660, Boadilla del Monte - Madrid Tel: +34 1 336 7441 Fax: +34 1 352 4819 Internet: bueno(a)fi.upm.es http://www.clip.dia.fi.upm.es/~bueno/
Dupont, Michael wrote:
Do you think that such a cacheing system is interesting even if there is a database? I mean, caching is also a way implement swapping, but if you have a datbase, who will be implementing the caching?
If you use a database, the caching would probably not be required: the database is acting as a cache itself. However, it depends on how you implement the database connection: if you query for all facts in the DB at once then you will have the same memory problems. But then you can avoid the memory problem by just querying for a limited number of facts each time. So, in a word, you would be implementing the caching within your connection to the DB.
How hard will it be to create a DB access to an existing database, what are your experiences?
We have a connection to MySql within Ciao. It is an adaptation for Ciao of the Prolog to SQL compiler written by Christoph Draxler, CIS Centre for Information and Speech Processing, Ludwig-Maximilians-University Munich. If it does not match your needs, you will probably not have many problems in adapting it.
Francisco Bueno CLIP group - CS Dept. - FIM - UPM Campus de Montegancedo - 28660, Boadilla del Monte - Madrid Tel: +34 1 336 7441 Fax: +34 1 352 4819 Internet: bueno(a)fi.upm.es http://www.clip.dia.fi.upm.es/~bueno/