Did you know ... Search Documentation:
Pack dynworks -- prolog/bdb_wrapper.pl
PublicShow source

This module provides a simple, minimalistic approach to implementing persistence on the SWI-Prolog platform, by means of the Berkeley DB utility package. The target data is organized in DataSets. A DataSet is comprised of one or more TagSets, and a TagSet is a named collection of Prolog data.

Berkeley DB is an open-source software library intended to provide a high-performance embedded database for key/value data. The database storage is organized as a directory tree, starting with a root path specified with bdb_path/1.

Being an embedded database implies that the library provides access to files containing one or more database tables. These tables are always binary, mapping keys to values. The SWI-Prolog interface to Berkeley DB allows for fast storage of arbitrary Prolog terms, including cycles and constraints.

On Windows, the package Berkeley DB for Windows version 6.2.38 must have been installed. The installers db-6.2.28_86.msi (32 bits) and db-6.2.28_64.msi (64 bits) may be obtained directly at the Oracle Berkeley DB site.

Most Linux distributions already carry the Berkeley DB library by default. Additionally, on Linux environments SWI-Prolog requires that the package swi-prolog-bdb be installed.

The Linux db-util package is fully compatible with the database structure created by SWI-Prolog through Berkeley DB. For the db-util manpages, please refer to https://manpages.debian.org/jessie/db-util/index.html .

Please, refer to https://www.swi-prolog.org/pldoc/doc/_SWI_/library/bdb.pl for additional instructions on how to use Berkeley DB.

author
- GT Nunes
version
- 1.3.2
license
- BSD-3-Clause License
 bdb_base(+BasePath:atom) is det
bdb_base(-BasePath:atom) is semidet
Unify BasePath with the base path for Berkeley DB's persistence files.

BasePath Atom identifying the base path for Berkeley DB's persistence files

 bdb_store(+TagSet:atom, +DataSet:atom, +Data:data) is det
Persist Data to external storage.
Arguments:
TagSet- Atom identifying the tagset to store
DataSet- Atom identifying the dataset storage location fragment
Data- The data to store
 bdb_retrieve(+TagSet:atom, +DataSet:atom, -Data:data) is det
Retrieve Data from external storage.
Arguments:
TagSet- Atom identifying the tagset to store
DataSet- Atom identifying the dataset storage location fragment
Data- The data to retrieve
 bdb_erase(+DataSet:atom) is det
Remove all the data associated with DataSet from external storage.
Arguments:
DataSet- Atom identifying the dataset storage location fragment
 bdb_erase(+TagSet:atom, +DataSet:atom) is det
Erase the data associated with the TagSet within DataSet from external storage.
Arguments:
TagSet- Atom identifying the dataset to erase
DataSet- Atom identifying the dataset storage location fragment