There are three more issues here:
The first two items are covered by so-called the External Matching. The third one is covered by the Internal Matching.
The External Matching provides relationships between the Jelly View name, its parameters in terms of database, and the program. The Internal Matching provides relationships between predicates used by the program, and the relations. The inference engine becomes a data source for the database by the External Matching, and the database becomes a data source for the inference engine by the Internal Matching. The ERD from Figure 8.1 should be extended with the Matchings. The program part remains the same. The extended ERD is given in Figure 8.3.
The following description concerns External Matching section in Figure 8.3. Comparing Figure 8.1 with Figure 8.3, program is changed to table-predicate to indicate its purpose better. It establishes a relationship between the database and the inference engine. A name of the Jelly View is listed as table-predicate.table. In order to generate the data, an appropriate goal will be called which is a predicate name in table-predicate.predicate. The number of arguments of the Jelly View matches the arity of goal, which is (N). The column names and their data types are provided by tp-argument relation.
The following description concerns Internal Matching section in Figure 8.3. The Internal Matching provides access to the database from the inference engine. It maps database relations into Prolog predicates. The mapping is provided by predicate-table relation. If there is a need to access a relation, then its name is listed in predicate-table.table and a corresponding predicate name is listed as predicate-table.predicate. The inference engine gets access to the relation using the predicate name. The arity of the predicate is indicated as predicate-table.arity, which is also the number of columns in the relation.
The program is binded to the Jelly View by consist_of relationship. Each program has some number of internal matching mappings, which are provided by has relationship between table-predicate and predicate-table. In this way, clauses and predicate-to-table mappings can be reused in different programs. Two or more programs can share some of the clauses and some of the Internal Matching mappings.
The detailed course of action, when a user query is issued, is listed below.
Igor Wojnicki 2005-11-07