The above-defined core language is no different from Prolog. To avoid unauthorized modification to coordination policies and for more efficiency, however, COCA deliberately separates the rule base and the database. We use a set of database operators rather than assert and retract in Prolog. Those Prolog predicates do not distinguish predicate definitions and database facts.
Definition 1588
We define database formulas as follows.
If T is a compound term, the following atomic formulas are
database formulas.
Keywords query, add, and delete are database operators.
Those operators are atomic, synchronized, and nonblocking. In our implementation, database facts are hashed by functor names. Mutual exclusion is enforced so that no two operators can work at the same time on compound terms with the same functor name.
We can extend this set to support blocking operations as well. For example, querysync and deletesync can be used to denote blocking database operations respectively. Although they are only for synchronization within the same cocavm, those operators have a close relationship to the tuple space operations in Linda[12]. querysync corresponds to rd, deletesync to in, query to rdp, delete to inp, and add to out.
The role of the database in COCA is two-fold. First, it provides an ephemeral memory (as opposed to persistent storage systems such as a relational database) for capturing and recording the state information regarding the ongoing collaboration, based on which many a coordination decision is made. Second, it implements a synchronization mechanism based on which concurrenct activities in each cocavm are coordinated.