Go to the first, previous, next, last section, table of contents.


Filed predicates

Author(s): Francisco Bueno.

Version: 1.10#7 (2006/4/26, 19:22:13 CEST)

Version of last change: 1.10#3 (2004/8/4, 11:52:38 CEST)

This package allows using files as a " cache" for predicates defined by facts. This is useful for huge tables of facts that may push the memory limits of the system too far. Goals of a filed predicate are executed simply by reading from the corresponding file.

Anything in the DB file used for the predicate that is different from a fact for the corresponding predicate is ignored. Each call to a filed predicate forces opening the file, so the use of this package is subject to the limit on the number of open files that the system can support.

Dynamic modification of the filed predicates is also allowed during execution of the program. Thus filed predicates are regarded as dynamic, data predicates residing in a file. However, dynamic modifications to the predicates do not affect the file, unless the predicate is also declared persistent.

The package is compatible with persdb in the sense that a predicate can be made both filed and persistent. In this way, the predicate can be used in programs, but it will not be loaded (saving memory), can also be modified during execution, and modifications will persist in the file. Thus, the user interface to both packages is the same (so the DB file must be one for both filing and persistency).

Usage and interface (factsdb_rt)

Documentation on exports (factsdb_rt)

PREDICATE: asserta_fact/1:

Meta-predicate with arguments: asserta_fact(fact).

Usage: asserta_fact(Fact)

PREDICATE: assertz_fact/1:

Meta-predicate with arguments: assertz_fact(fact).

Usage: assertz_fact(Fact)

PREDICATE: call/1:

Meta-predicate with arguments: call(fact).

Usage: call(Fact)

PREDICATE: current_fact/1:

Meta-predicate with arguments: current_fact(fact).

Usage: current_fact(Fact)

PREDICATE: retract_fact/1:

Meta-predicate with arguments: retract_fact(fact).

Usage: retract_fact(Fact)

Documentation on multifiles (factsdb_rt)

PREDICATE: $factsdb$cached_goal/3:

$factsdb$cached_goal(Spec, Spec, Key)

Predicate Spec is filed within database Key. Programmers should not define this predicate directly in the program.

The predicate is multifile.

PREDICATE: persistent_dir/2:

See persdb.

The predicate is multifile.

The predicate is of type data.

PREDICATE: file_alias/2:

See symfnames. This predicate is used only if persistent_dir/2 fails.

The predicate is multifile.

The predicate is of type data.

Documentation on internals (factsdb_rt)

DECLARATION: facts/2:

Usage: :- facts(PredDesc, Keyword).

PREDICATE: keyword/1:

See persdbrt. The same conventions for location of DB files apply in both packages.

Known bugs and planned improvements (factsdb_rt)


Go to the first, previous, next, last section, table of contents.