Difference between revisions of "3rd:QDBM"

From wiki.visual-prolog.com

(copied from forum)
 
m (Links)
 
(2 intermediate revisions by 2 users not shown)
Line 1: Line 1:
For the management of key->values in Visual Prolog, you may use factsDB, chainDB or some sql based solution. Each solution has benefits and drawbacks. For some reasons, I had to find another solution.
Written by Gildas Menier.
 
For the management of key->values in Visual Prolog, you may use factsDB, chainDB or some sql based solution. Each solution has benefits and drawbacks.  


Mikio Hirabayashi has built a very nice API called 'QDBM'.  
Mikio Hirabayashi has built a very nice API called 'QDBM'.  


http://qdbm.sourceforge.net/
http://fallabs.com/qdbm/
 
see also http://qdbm.sourceforge.net/benchmark.pdf


QDBM is well known in the Unix world, but has been ported to Win32. Practically, it is a disk-based Hashtable + Binary tree + inverted list package. QDBM offers many solutions called 'depot', 'curia', 'villa', 'odeum' and is well worth a look if you want to manage large amount of data.  
QDBM is well known in the Unix world, but has been ported to Win32. Practically, it is a disk-based Hashtable + Binary tree + inverted list package. QDBM offers many solutions called 'depot', 'curia', 'villa', 'odeum' and is well worth a look if you want to manage large amount of data.  
Line 15: Line 15:
Using a collection of instances of the visual prolog class 'depot', you can manage a very large hashtable on disk.  
Using a collection of instances of the visual prolog class 'depot', you can manage a very large hashtable on disk.  


I do not provide a full documentation since the real documentation can be found on the above web site. Only the port of depot is functional in this lib.  
Only the port of depot is functional in this lib.  


I tried to simplify the use of this lib as much as possible, and tried not to get too far away from the original API syntax:  
The provided set of predicates stays relatively close to the original API syntax:  


<vip>NewDepot = depot::new("dtest"), % create a depot db
<vip>NewDepot = depot::new("dtest"), % create a depot db
Line 34: Line 34:
More predicates are provided. Please, have a look on the documentation of QDBM/depot and on the depot.pro file.  
More predicates are provided. Please, have a look on the documentation of QDBM/depot and on the depot.pro file.  


The project doesn't include a copy of qdbm (because of the allowed posting size); I encourage you to download the most up-to-date version on the site above. It is provided under the GNU Lesser GPL.  
The project doesn't include a copy of qdbm (because of the allowed posting size); you should download the most up-to-date version on the site above. It is provided under the GNU Lesser GPL.  
Just copy the three following files into your exe directory:
Just copy the three following files into your exe directory:



Latest revision as of 00:12, 3 June 2013

Written by Gildas Menier.

For the management of key->values in Visual Prolog, you may use factsDB, chainDB or some sql based solution. Each solution has benefits and drawbacks.

Mikio Hirabayashi has built a very nice API called 'QDBM'.

http://fallabs.com/qdbm/

QDBM is well known in the Unix world, but has been ported to Win32. Practically, it is a disk-based Hashtable + Binary tree + inverted list package. QDBM offers many solutions called 'depot', 'curia', 'villa', 'odeum' and is well worth a look if you want to manage large amount of data.

In the enclosed project, you'll find a small 'depot' wrapper for Visual Prolog.

The example creates 1.000.000 (key, values) and then ask for 1.000.000 keys at random. All the key/values are stored on disk in a single file.

Using a collection of instances of the visual prolog class 'depot', you can manage a very large hashtable on disk.

Only the port of depot is functional in this lib.

The provided set of predicates stays relatively close to the original API syntax:

NewDepot = depot::new("dtest"), % create a depot db
NewDepot:dbopen("create"), % open it (create mode)
NewDepot:dbput_string(Key, Value), % put a key,value
NewDepot:dbclose(), % close the file

and you can access the db as follows:


ReadDepot = depot::new("dtest"), % 
ReadDepot:dbopen("read"), % open it in read mode
Value = ReadDepot:dbget_string(Key), % tries to find the value for a key, fails if no value
ReadDepot:dbclose(), %

More predicates are provided. Please, have a look on the documentation of QDBM/depot and on the depot.pro file.

The project doesn't include a copy of qdbm (because of the allowed posting size); you should download the most up-to-date version on the site above. It is provided under the GNU Lesser GPL. Just copy the three following files into your exe directory:

  • libiconv-2.dll
  • mgwz.dll
  • qdbm.dll

you will find the package there:

http://qdbm.sourceforge.net/win/

Example project/download in Discussion forum: (how to) deal with large amounts of (key,value)