Skip to content

Commit

Permalink
Merge pull request #6 from PESchoenberg/develop
Browse files Browse the repository at this point in the history
Added sde-experiments table creation.
  • Loading branch information
PESchoenberg authored Feb 22, 2019
2 parents 20bdef5 + 694d126 commit 3e109ee
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 2 deletions.
8 changes: 7 additions & 1 deletion examples/example3.scm
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,11 @@
(define f3 1)


; Creation
; Creation of the kb
(kb-create dbms kb1 f3)

; Creation of tables not included in the basic kb.
(kb-create-sde-experiments dbms kb1)

;Insert fact.
(set! it "counter2")
Expand Down Expand Up @@ -158,6 +160,10 @@
(define tb4 "sde_mem_rules")


; We would need this to gather data.
(define tb5 "sde_experiments")


; Standard context value to indicate that a rule always resides on sde_rules
; and not sde_meme_rules.
(define co "prg0.1")
Expand Down
24 changes: 23 additions & 1 deletion gexsys0.scm
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
kb-create-sde-mem-facts
kb-create-sde-prg-rules
kb-create-sde-rules
kb-create-sde-experiments
kb-query
kb-insert-facts
kb-insert-default-facts
Expand Down Expand Up @@ -443,7 +444,28 @@
Prob REAL CONSTRAINT prob_def_val DEFAULT (1) CONSTRAINT prob_bet_0_1 CHECK (Prob >= 0 AND Prob <= 1) );
")
(dbi-close db-obj)))



; kb-create-sde-experiments - creates a table to hold experimental data as
; a string that might later be passed to tables of the kb such as sde_facts.
; ;
; Arguments:
; - p_dbms: database management system to be used.
; - p_kb1: knowledge base name.
;
(define (kb-create-sde-experiments p_dbms p_kb1)
(let ((db-obj (dbi-open p_dbms p_kb1)))
(dbi-query db-obj "DROP TABLE IF EXISTS sde_experiments;")
(dbi-query db-obj "CREATE TABLE sde_experiments (
Id INTEGER PRIMARY KEY ASC ON CONFLICT ROLLBACK AUTOINCREMENT UNIQUE ON CONFLICT ROLLBACK,
Context TEXT DEFAULT main,
Status TEXT DEFAULT enabled,
Results TEXT (1024) DEFAULT na,
Comments TEXT (256) DEFAULT na,
Timestamp DATETIME DEFAULT (CURRENT_TIMESTAMP) );
")
(dbi-close db-obj)))


; kb-query - Performs a single SQL query on closed knowledge base. Use dbi-query
; directly if the database has been opened.
Expand Down

0 comments on commit 3e109ee

Please sign in to comment.