next up previous
Next: Aggressive Auto-completion Up: Auto-completion and Auto-update Mechanism Previous: Composite Predicates


Algorithm for Auto-completion and Auto-update

The compiler uses composite predicates to flag the primitive predicates which are constituents of this composite predicate. These flagged predicates are ignored in the while-loop given below. The algorithm outlined below iterates over a list of predicates P as shown below:


AUTO-COMPLETE(P)
1. let repository $ \leftarrow$ COLLECT-KNOWN-VALUES
2. if VERIFY-CHECK-CODES(P)$ \neq$ FALSE
3. while CHANGE(repository)= TRUE do
4. foreach $ p_i$ do
5. if CHECK-MODE-CHECK-CODE($ p_i$) $ \neq$ FALSE
6. foreach $ rule_j$ of $ p_i$ do
7. if CHECK-MODE-GUARD($ guard_j$)$ \neq$ FALSE
8. if EVALUATE-GUARD($ guard_j$)$ \neq$ FALSE
9. if CHECK-MODE-RULE($ rule_j$) $ \neq$ FALSE
10. TRIGGER-RULE($ rule_j$)
11. if VERIFY-CHECK-CODES(P) $ \neq$ FALSE
12. then UPDATE(repository) (with rule trigger field)
13. break(from loop in line 6)
14. else RETRACT(repository)
15. return
16. return
17. end-while

The algorithm keeps track of known form fields by means of a repository. The repository is initialised (line 1) and all check-codes are verified before the start of the while-loop (line 2). The loop starts with a list of predicates P(line 4). For any predicate $ p_i$, if any of the check-code mode fields are not known, then it becomes a candidate for rule triggers (line 5). All rules of that predicate are then checked for rule triggers(line 6). If the guard for a rule ($ rule_j$) is not empty2, then the guard mode is checked for the existence of field values that are required to evaluate the guard (line 7). If the mode is satisfied then the guard is evaluated (line 8). If a guard is satisfied (evaluates to true) then a check is made on the rule mode (line 9). If all the fields of a rule mode are known, a rule is triggered (line 10). All the check-codes are run to ensure that check-codes are satisfied (line 11). If the check-codes are not satisfied the value is retracted (line 14) otherwise it is added to the repository (line 12). The next predicate is then chosen for rule trigger (line 13). The while-loop (line 3-17) terminates if in the last iteration there was no rule trigger (line 3). If field formats are specified, then they are taken into account (line 2,10). In line 2, all field values are checked against their specified field formats whereas in line 10, the deduced field value is checked for its conformance to the specified field format.

The algorithm for auto-update is similar except for the fact that when a user updates an existing value all the deduced values are removed from the repository and new values are then computed by the algorithm given above. If metainfo is specified then it is taken into account at this stage.


next up previous
Next: Aggressive Auto-completion Up: Auto-completion and Auto-update Mechanism Previous: Composite Predicates
Sunil Kothari 2006-04-29