31.1 Basics
The idea is to get a behavior similar to assert/1
,
retract/1
and clause/2
, but the terms are stored on
files instead of in primary memory.
The differences compared with the Prolog database are:
- A database must be opened before any access and closed after the
last access. (There are special predicates for this:
db_open/[4,5]
and db_close/1
.)
- The functors and the indexing specifications of the terms to
be stored have to be given when the database is
created. (see The DB-Spec).
- The indexing is specified when the database is created. It is
possible to index on other parts of the term than just the
functor and first argument.
- Changes affect the database immediately.
- The database will store variables with blocked
goals as ordinary variables.
Some commercial databases can't store non-ground terms
or more than one instance of a term. This library module
can however store terms of either kind.