logo       

Re: qlf files and prolog version: msg#01535

Subject: Re: qlf files and prolog version

On Dec 6, 2005, at 1:11 PM, Jan Wielemaker wrote:

Chris,

On Tuesday 06 December 2005 21:48, chris mungall wrote:
Whenever I upgrade my SWI-Prolog to a new version, I need to rebuild my
.qlf files. No surprises there - the documentation states this quite
clearly.

I would like a way to do this automatically, rather than rm-ing them
all every time I upgrade (I have a *lot* of data files kicking around
that get converted to prolog fact files)

Here is the predicate I use for loading a fact file into a module space
(adapted from the wordnet loader). Is there a way to extend this so
that the qlf file is regenerated if it can't be loaded? Unfortunately
catch/3 doesn't appear to work, I guess because failing to load a .qlf
is too serious an error?

No, actually the other way around. If you load a file without extension it will first tgry to load the .qlf file and failing that it will backup
and -after printing an error- load the .pl file.

Ideally, load_files(['somefile.qlf']) should produce an exception if the
version doesn't match. It doesn't because the code predates exception
handling and appearently there was never a good reason to change this.
I'll have a look.

There is an undocumented call

  '$qlf_info'(+File, -CurrentVersion, -FileVersion, -WordSize, -Files)

With mostly obvious meaning. WordSize is either 32 or 64. Files is a
list of files compiled into the QLF file, so you need to recompile if
one of the files is newer than the .qlf file or CurrentVersion >
FileVersion.

This fixes my problem, thanks!

I guess the ideal is something like

        load_files(Files, [cached(true)])

and make sure load_files/2 does all the things you want (create a .qlf
file if there is none or it is out of date or the wrong version, load
it otherwise).

That would be nice, but I'm happy with the $qlf_info/5 solution for now, provided it's stable

        --- Jan



------------
For further info, please visit http://www.swi-prolog.org/

To unsubscribe, send a plaintext mail with "unsubscribe prolog <e-mail>"
in its body to majordomo@xxxxxxxxxxxxxx




<Prev in Thread] Current Thread [Next in Thread>