Friday, March 7, 2008

TEC Record Predicates

We have listed some of the most common/useful built-in record database
manipulation predicates. There are a few more for dealing with lists,
stacks, and queues stored within the record database but you will find that they are not used much.

Storing Terms in the Recorded Database
record:

record(+KEY,?TERM)
record(+KEY1,+KEY2,?TERM)
Stores TERM under the given KEY(S)
Keys must be atomic strings or numbers
Structures or lists have their elements and arguments converted into
unmatched variables

record/2 stores TERM under KEY,0
Fails if a value is already stored under the given KEY(S)


rerecord:
rerecord(+KEY,?TERM)
rerecord(+KEY1,+KEY2,?TERM)
Same as record but will overwrite existing values

Retrieving Terms From the Recorded Database
recorded(+KEY,?TERM)
recorded(+KEY1,+KEY2,?TERM)
If TERM is a variable, TERM is matched with the term stored under the specified KEY(S)
If TERM is instantiated, the call will fail if TERM can not be matched with the term stored under the specified KEY(S)

Erasing Values From the Recorded Database
erase(+KEY)
erase(+KEY1,+KEY2)
erase_all(+KEY)
erase_all
Deletes the term stored under KEY(S)
Always succeeds


Retrieving and Testing Recorded Database Keys
current_key(?KEY)
current_key(?KEY1, ?KEY2)
Succeeds if KEY(S) can matched with valid key values
Backtracks to find multiple solutions if arguments are not ground

is_a_key(?KEY)
is_a_key(?KEY1,?KEY2)

No comments: