|
65 | 65 | ; kb-df2db. |
66 | 66 | ; - Creating tables using "CREATE TABLE..." SQL statements and later import |
67 | 67 | ; your data. |
68 | | -; - In some cases in which you will buld a system that does not use data sets |
| 68 | +; - In some cases in which you will build a system that does not use data sets |
69 | 69 | ; to be processed in batch, you may use just the provided data tables. |
70 | 70 | ; |
71 | 71 | ; or both after using rkbCreate(...). The knowledge base will be created on |
|
95 | 95 | (a " ") |
96 | 96 | (c " ") |
97 | 97 | (d " ")) |
98 | | - |
99 | 98 | (if (> p_f3 0)(ptit " " 1 1 "Creating tables...")) |
100 | 99 | (kb-create-sde-facts p_dbms p_kb1) |
101 | 100 | (kb-create-sde-mem-facts p_dbms p_kb1) |
102 | 101 | (kb-create-sde-prg-rules p_dbms p_kb1) |
103 | 102 | (kb-create-sde-rules p_dbms p_kb1) |
104 | | - |
105 | 103 | (if (> p_f3 0)(ptit " " 1 1 "Inserting default facts...")) |
106 | 104 | (kb-insert-default-facts p_dbms p_kb1 tb1 tb2 co st p_f3) |
107 | | - |
108 | 105 | (if (> p_f3 0)(ptit " " 1 1 "Inserting primary rules...")) |
109 | 106 | (kb-insert-sde-rules p_dbms p_kb1 p_f3) |
110 | | - |
111 | 107 | (if (> p_f3 0)(ptit " " 1 1 "Inserting secondary rules...")) |
112 | | - (kb-insert-sde-prg-rules p_dbms p_kb1 p_f3) |
113 | | - |
114 | | - )) |
| 108 | + (kb-insert-sde-prg-rules p_dbms p_kb1 p_f3))) |
115 | 109 |
|
116 | 110 |
|
117 | 111 | ; kb-insert-sde-rules - Inserts a batch of rules into sde_rules; in order |
|
173 | 167 | (set! c "SELECT Value FROM sde_facts WHERE Item = `counter1` AND Value = ( SELECT Value FROM sde_facts WHERE Item = `load-order-prg24` );") |
174 | 168 | (set! a "UPDATE sde_facts SET Value = ( SELECT Value FROM sde_facts WHERE Item = `cur-ver-prg24` ) WHERE Item = `mode-prg-load`;") |
175 | 169 | (set! d "6- Load the current version of prg24 - batch program loader.") |
176 | | - (kb-insert-rules p_dbms p_kb1 tb co st c a d 1.0 p_f3) |
177 | | - |
178 | | - )) |
| 170 | + (kb-insert-rules p_dbms p_kb1 tb co st c a d 1.0 p_f3))) |
179 | 171 |
|
180 | 172 |
|
181 | 173 | ; kb-insert-sde-prg-rules - Inserts secondary rules into sde_prg_rules; in order |
|
231 | 223 | (set! a "DELETE FROM sde_rules WHERE Context LIKE `prg24.%`;") |
232 | 224 | (set! d "4- Delete prg24 once init-ok >= 2.") |
233 | 225 | (kb-insert-rules p_dbms p_kb1 tb co st c a d 1.0 p_f3) |
234 | | - |
235 | | - |
| 226 | + |
236 | 227 | ; prg1.0 performs several init chores. |
237 | 228 | (set! co "prg1.0") |
238 | 229 |
|
|
278 | 269 | (set! a "DELETE FROM sde_rules WHERE Context LIKE `prg1.%`;") |
279 | 270 | (set! d "6- Delete prg1.") |
280 | 271 | (kb-insert-rules p_dbms p_kb1 tb co st c a d 1.0 p_f3) |
281 | | - |
282 | 272 |
|
283 | 273 | ; prg2.0 is the batch purge program. It deletes from sde_rules annything |
284 | 274 | ; that doesn't belong to context prg0.% or itself, and after performing |
285 | 275 | ; those deletions, it deletes itself. This is required so that the |
286 | 276 | ; after deleting everything else can update the mode-prg-purge item. |
287 | 277 | (set! co "prg2.0") |
288 | 278 |
|
289 | | - ;Delete all programs that are not co if mode purge is on. ********************************************** |
| 279 | + ;Delete all programs that are not co if mode purge is on. ** |
290 | 280 | (set! c "SELECT Value FROM sde_facts WHERE Item = `mode-prg-purge` AND Value = 1;") |
291 | 281 | ;(set! a (strings-append (list "DELETE FROM sde_rules WHERE ( Context NOT LIKE `prg0.%` AND Context NOT LIKE `prg3.%` );") 0)) |
292 | 282 | (set! a "DELETE FROM sde_rules WHERE ( Context NOT LIKE `prg0.%` AND Context NOT LIKE `prg2.%` );") |
|
316 | 306 | (set! c "SELECT Value FROM sde_facts WHERE Item = `mode-prg-purge` AND Value >= 0;") |
317 | 307 | (set! a "DELETE FROM sde_rules WHERE Context LIKE `prg2.%`;") |
318 | 308 | (set! d "5- Delete prg2.") |
319 | | - (kb-insert-rules p_dbms p_kb1 tb co st c a d 1.0 p_f3) |
320 | | - |
321 | | - )) |
| 309 | + (kb-insert-rules p_dbms p_kb1 tb co st c a d 1.0 p_f3))) |
322 | 310 |
|
323 | 311 |
|
324 | 312 | ; kb-create-sde-facts - creates table sde_facts. |
|
448 | 436 |
|
449 | 437 | ; kb-create-sde-experiments - creates a table to hold experimental data as |
450 | 438 | ; a string that might later be passed to tables of the kb such as sde_facts. |
451 | | -; ; |
| 439 | +; |
452 | 440 | ; Arguments: |
453 | 441 | ; - p_dbms: database management system to be used. |
454 | 442 | ; - p_kb1: knowledge base name. |
|
599 | 587 | (kb-insert-facts p_dbms p_kb1 p_tb1 p_co p_st "load-order-prg24" 0.0 1.0 p_f3) |
600 | 588 | (kb-insert-facts p_dbms p_kb1 p_tb2 p_co p_st "load-order-prg24" 2.0 1.0 p_f3) |
601 | 589 | (kb-insert-facts p_dbms p_kb1 p_tb1 p_co p_st "last-exec-prg24" 0.0 1.0 p_f3) |
602 | | - (kb-insert-facts p_dbms p_kb1 p_tb2 p_co p_st "last-exec-prg24" 0.0 1.0 p_f3) |
603 | | - |
604 | | - ) |
| 590 | + (kb-insert-facts p_dbms p_kb1 p_tb2 p_co p_st "last-exec-prg24" 0.0 1.0 p_f3)) |
605 | 591 |
|
606 | 592 |
|
607 | 593 |
|
|
696 | 682 | ; 'getfromnetwork'. Interaction with the database should be direct from the |
697 | 683 | ; external module to the kb setting status to 'getfromnetwork'. On each |
698 | 684 | ; iteration, data passed to the kb using this status will be 'aligned' with the |
699 | | -; rest of the data by applying stauts 'applykbrules' to it. |
| 685 | +; rest of the data by applying status 'applykbrules' to it. |
700 | 686 | ; |
701 | 687 | ; Arguments: |
702 | 688 | ; - p_dbms: database management system to be used. |
|
831 | 817 | (dbi-close db-obj) |
832 | 818 | (write (dbi-get_row db-obj)) |
833 | 819 | (newline)))) |
834 | | - |
835 | | - |
836 | | - |
837 | | - |
838 | 820 |
|
839 | 821 |
|
0 commit comments