#! /bin/env tclsh
package require {ycl sugar}
namespace import [yclprefix]::sugar::pconst
proc table_entity {} {
return [subst -novariables {
CREATE TABLE [ENTITY] (
id integer primary key AUTOINCREMENT NOT NULL
, entity text UNIQUE
)
}]
}
proc table_fact {} {
return [subst -novariables {
CREATE TABLE [FACT] (
id integer primary key AUTOINCREMENT NOT NULL
, entity text
, predicate text
, value text
, type text
)
}]
}
proc entity {} {
set query [subst -novariables {
select * FROM [ENTITY] WHERE entity=:entity
}]
}
pconst ENTITY entity
pconst FACT fact