Index: openacs-4/packages/imsld/sql/postgresql/imsld-level-b-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/imsld/sql/postgresql/imsld-level-b-create.sql,v diff -u -r1.5 -r1.6 --- openacs-4/packages/imsld/sql/postgresql/imsld-level-b-create.sql 20 Jun 2006 19:20:38 -0000 1.5 +++ openacs-4/packages/imsld/sql/postgresql/imsld-level-b-create.sql 21 Jun 2006 10:43:08 -0000 1.6 @@ -164,136 +164,23 @@ alter table imsld_services drop constraint imsld_serv_type_ck; alter table imsld_services add constraint imsld_serv_type_ck check (service_type in ('send-mail','conference','monitor')); -create table imsld_expressions ( - expression_id integer - constraint imsld_exp_fk + + +create table imsld_conditions ( + condition_id integer + constraint imsld_cond_fk references cr_revisions on delete cascade - constraint imsld_exp_pk - primary key, - imsld_id integer - constraint imsld_exp_imsld_fk - references cr_items --imsld_imslds + constraint imsld_cond_pk + primary key, + method_id integer + constraint imsld_cond_method_fk + references cr_items --imsld_methods not null, - xml_piece text + condition_xml text ); -create index imsld_exp_imsldid_idx on imsld_expressions(imsld_id); +create index imsld_cond_methodid_idx on imsld_conditions(method_id); -comment on table imsld_expressions is ' -This table is used to store the expressions (boolean and arithmetic ones) specified in the imsmanifest document. -The piece of xml is stored instead of doing it in a specific datamodel for the expressions, because this way is more clearer. -The expression is parsed and evaluated when the imsmanifest is uploaded and each time a user access the unit of learning.'; - - - - ---create table imsld_conditions ( --- condition_id integer --- constraint imsld_cond_fk --- references cr_revisions --- on delete cascade --- constraint imsld_cond_pk --- primary key, --- method_id integer --- constraint imsld_cond_method_fk --- references cr_items --imsld_methods --- not null, --- if_id integer --- constraint imsld_cond_if_fk --- references cr_items, --imsld_expressions --- then_id integer --- constraint imsld_cond_then_fk --- references cr_items, --imsld_then_model --- else_id integer --- constraint imsld_cond_else_fk --- references cr_items --imsld_else_model ---); - ---create index imsld_cond_methodid_idx on imsld_conditions(method_id); ---create index imsld_cond_ifid_idx on imsld_conditions(if_id); ---create index imsld_cond_thenid_idx on imsld_conditions(then_id); ---create index imsld_cond_elseid_idx on imsld_conditions(else_id); - ---comment on table imsld_conditions is ' ---All conditions are pre-conditions and must be evaluated: - when entering the run of a unit of learning (new session); - every time when the value of a property has been changed.'; - ---create table imsld_expressions ( --- expression_id integer --- constraint imsld_exp_fk --- references cr_revisions --- on delete cascade --- constraint imsld_exp_pk --- primary key, --- type varchar(25) --- check (type in ('is','is-not','is-member-of','and','or','sum','substract','multiply','divide','greather-than','less-than','users-in-role','no-value','time-uol-started','daytime-activity-started','current-datetime','complete','not')) --- not null, --- role_id integer --- constraint imsld_exp_role_fk --- references cr_items, --imsld_roles --- calculate_id integer --- constraint imsld_exp_calc_fk --- references cr_items, --imsld_properties_values --- exp_one_id integer --- constraint imsld_exp_one_fk --- references cr_items, --imsld_expressions --- exp_two_id integer --- constraint imsld_exp_two_fk --- references cr_items, --imsld_expressions --- property_id integer --- constraint imsld_exp_prop_fk --- references cr_items, --imsld_properties --- ref_type varchar(20) --- check (ref_type in ('uri','la-ref','sa-ref','as-ref','rp-ref','act-ref','play-ref','uol-ref')), --- ref_id integer --- constraint imsld_exp_ref_fk --- references cr_items --cr_items (activities, acts, plays, imslds) ---); - ---create index imsld_exp_role_idx on imsld_expressions(role_id); ---create index imsld_exp_calc_idx on imsld_expressions(calculate_id); ---create index imsld_exp_eone_idx on imsld_expressions(exp_one_id); ---create index imsld_exp_etwo_idx on imsld_expressions(exp_two_id); ---create index imsld_exp_prop_idx on imsld_expressions(property_id); ---create index imsld_exp_ref_idx on imsld_expressions(ref_id); - ---comment on table imsld_expressions is ' ---Expressions that has to be evaluated sometime in the run of the UoL, returning a value. This expressions are referenced from the if fields in the conditions table and from the calculate fields of the when-condition-true and change-property-value tables.'; - ---comment on column imsld_expressions.type is ' ---Type of the expression. Depending of the expression type, some fields are used and others aren''nt. To avoid data redundance all the expression types are stored in this table.'; - ---comment on column imsld_expressions.ref_type is ' ---The complete expression type may reference a uri, learning activity, support activity, activity structure, role part, act, play or unit of learning. The respective id is stored in the ref_id field.'; - ---create table imsld_then_model ( --- then_model_id integer --- constraint imsld_then_fk --- references cr_revisions --- on delete cascade --- constraint imsld_then_pk --- primary key, --- type varchar(20) --- check (type in ('show','hide','change-prop-value')) --- not null, --- ref_type varchar(20) --- check (type in ('class','item-ref','env-ref','la-ref','sa-ref','sa-ref','as-ref','uol-ref')), --- ref_id integer --- constraint imsld_then_ref_fk --- references cr_items, --cr_items (class, item, environment, activities, unit of learning) --- with_control_p char(1) --- check (with_control_p in ('t','f')) --- default 'f', --- change_prop_val_id integer --- constraint imsld_then_cpv_fk --- references cr_items --imsld_properties_values ---); - ---create index imsld_then_ref_idx on imsld_then_model(ref_id); ---create index imsld_then_cpropv_idx on imsld_then_model(change_prop_val_id); - ---comment on table imsld_then_model is ' ---Then model used as the ''body'' of the then and else elements of the if statement (conditions table). ---This then model consists in three types: show, hide (elements refered by ref_id and ref_type -- to know what table are we refering to) or change property value, with the respective reference to the property and value to be changed.'; - - +comment on table imsld_conditions is ' +All conditions are pre-conditions and must be evaluated: - when entering the run of a unit of learning (new session); - every time when the value of a property has been changed.';