Filed predicates (runtime)

Author(s): Francisco Bueno.

Runtime module for the factsdb package.

Usage and interface

Documentation on exports

Usage:asserta_fact(Fact)

Version of datafacts_rt:asserta_fact/1 for filed predicates. The current instance of Fact is interpreted as a fact and is added at the beginning of the definition of the corresponding predicate. Therefore, before all the facts filed in the DB file for the predicate. The predicate concerned must be declared as facts; if it is not, then datafacts_rt:asserta_fact/1 is used.

  • The following properties should hold at call time:
    (basic_props:cgoal/1)Fact is a term which represents a goal, i.e., an atom or a structure.
Meta-predicate with arguments: asserta_fact(fact).

Usage:assertz_fact(Fact)

Version of datafacts_rt:assertz_fact/1 for filed predicates. The current instance of Fact is interpreted as a fact and is added at the end of the definition of the corresponding predicate. Therefore, after all the facts filed in the DB file for the predicate. The predicate concerned must be declared as facts; if it is not, then datafacts_rt:assertz_fact/1 is used.

  • The following properties should hold at call time:
    (basic_props:cgoal/1)Fact is a term which represents a goal, i.e., an atom or a structure.
Meta-predicate with arguments: assertz_fact(fact).

PREDICATEcall/1

Usage:call(Fact)

Same as current_fact/1 if the predicate concerned is declared as facts. If it is not, an exception is raised.

  • The following properties should hold at call time:
    (basic_props:cgoal/1)Fact is a term which represents a goal, i.e., an atom or a structure.
Meta-predicate with arguments: call(fact).

Usage:current_fact(Fact)

Version of datafacts_rt:current_fact/1 for filed predicates. The current instance of Fact is interpreted as a fact and is unified with an actual fact in the current definition of the corresponding predicate. Therefore, with a fact previously asserted or filed in the DB file for the predicate, if it has not been retracted. The predicate concerned must be declared as facts; if it is not, then datafacts_rt:current_fact/1 is used.

  • The following properties should hold at call time:
    (basic_props:cgoal/1)Fact is a term which represents a goal, i.e., an atom or a structure.
Meta-predicate with arguments: current_fact(fact).

Usage:retract_fact(Fact)

Version of datafacts_rt:retract_fact/1 for filed predicates. The current instance of Fact is interpreted as a fact and is unified with an actual fact in the current definition of the corresponding predicate; such a fact is deleted from the predicate definition. This is true even for the facts filed in the DB file for the predicate; but these are NOT deleted from the file (unless the predicate is persistent). The predicate concerned must be declared as facts; if it is not, then datafacts_rt:retract_fact/1 is used.

  • The following properties should hold at call time:
    (basic_props:cgoal/1)Fact is a term which represents a goal, i.e., an atom or a structure.
Meta-predicate with arguments: retract_fact(fact).

Documentation on multifiles

See persdb. The predicate is multifile.
The predicate is of type data.

PREDICATEfile_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

DECLARATIONfacts/2

Usage::- facts(PredDesc,Keyword).

Declares the predicate PredDesc as filed. Keyword is the identifier of a location where the file DB for the predicate is kept. The location Keyword is described in the file_alias predicate, which must contain a fact in which the first argument unifies with Keyword.

PREDICATEkeyword/1
See persdb_rt. The same conventions for location of DB files apply in both packages.

Documentation on imports

This module has the following direct dependencies: