Filed predicates (runtime)

Author(s): Francisco Bueno.

Runtime module for the factsdb package.

Usage and interface

Documentation on exports

PREDICATE

Usage:asserta_fact(Fact)

Version of data_facts: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 data_facts:asserta_fact/1 is used.

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

PREDICATE

Usage:assertz_fact(Fact)

Version of data_facts: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 data_facts:assertz_fact/1 is used.

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

PREDICATE

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:callable/1)Fact is a term which represents a goal, i.e., an atom or a structure.
Meta-predicate with arguments: call(fact).

PREDICATE

Usage:current_fact(Fact)

Version of data_facts: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 data_facts:current_fact/1 is used.

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

PREDICATE

Usage:retract_fact(Fact)

Version of data_facts: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 data_facts:retract_fact/1 is used.

  • The following properties should hold at call time:
    (basic_props:callable/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

PREDICATE
$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
See persdb. The predicate is multifile.
The predicate is of type data.

PREDICATE
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

DECLARATION

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.

  • The following properties should hold upon exit:
    (basic_props:predname/1)PredDesc is a Name/Arity structure denoting a predicate name:
    predname(P/A) :-
            atm(P),
            nnegint(A).
    

    (persdbcache:keyword/1)Keyword is an atom corresponding to a directory identifier.

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