[mercury-users] How to make huge db in Mercury

Ondrej Bojar oboj7042 at ss1000.ms.mff.cuni.cz
Sat Apr 27 18:49:33 AEST 2002


Hi.

As far as I know, Mercury has to actually compile the database in your
program. (And there is a special technique of so-called "fact tables" just
for this purpose.) Naturally, you can compile in any number of database
files you wish, but you cannot load them later, when the program is
already compiled and linked.

If you need to load (and forget) data on runtime, you can use predicates
term_io__read_term/3 and term__try_term_to_type/2, to load the database in
a data structure (such as a list of facts). Later you can search this data
structure with simple predicates such as member/2 or anything else you
write.

I'd suggest you the second way, if you do not mind the time needed to load
the database each time.

O.

On Thu, 25 Apr 2002 czsergey at atlas.cz wrote:
> Hi,
> I have this problem:
> I have huge database in prolog (Mercury) in this format:
>
>   ...
>   pred1(data11,data21,data31).
>   pred2(data21,data22,data23).
>   ...
>   ...
>
> (it is in more than one file)
>
> and I want to make a Mercury program with some "queries" to db (predicates) with choosing the db-file(s).
> Can you help me? (Is it possible in Mercury ?)
> Thank you
> John
> --------------------------------------------------------------------------
> mercury-users mailing list
> post:  mercury-users at cs.mu.oz.au
> administrative address: owner-mercury-users at cs.mu.oz.au
> unsubscribe: Address: mercury-users-request at cs.mu.oz.au Message: unsubscribe
> subscribe:   Address: mercury-users-request at cs.mu.oz.au Message: subscribe
> --------------------------------------------------------------------------
>

--------------------------------------------------------------------------
mercury-users mailing list
post:  mercury-users at cs.mu.oz.au
administrative address: owner-mercury-users at cs.mu.oz.au
unsubscribe: Address: mercury-users-request at cs.mu.oz.au Message: unsubscribe
subscribe:   Address: mercury-users-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------



More information about the users mailing list