next up previous contents
Next: JSOC pipeline architecture Up: Table schemas and SQL Previous: Global tables   Contents

Series specific tables

We now continue with the example from Section 2.5. Below is shown the SQL code that will be executed by parsing the JSD of Example 1:


/* Register series info in the global table. */
insert into MDC_MASTER_SERIES_TABLE values
  ('testclass1', 'Rasmus Munk Larsen', 'rmunk', now(), "This series is for testing only.", 10, 1, 127, 'permanent');

/* Register keywords in the global table. */
insert into MDC_MASTER_KEYWORD_TABLE values
  ('testclass1','keywd0', 0, 'newest', 'link', NULL, NULL, NULL, NULL, NULL); 
insert into MDC_MASTER_KEYWORD_TABLE values
  ('testclass1','keywd1', 1, NULL, 'char', 1, '%d', 'unit1','comment1', 0); 
insert into MDC_MASTER_KEYWORD_TABLE values
  ('testclass1','keywd2', 2, NULL, 'int', 4, '%d', 'unit2','comment2', 1); 
insert into MDC_MASTER_KEYWORD_TABLE values
  ('testclass1','keywd3', 3, NULL, 'float', 4, '%f', 'unit3','comment3', 0); 
insert into MDC_MASTER_KEYWORD_TABLE values
  ('testclass1','keywd4', 4, NULL, 'double', 8, '%lf', 'unit4','comment4', 0); 
insert into MDC_MASTER_KEYWORD_TABLE values
  ('testclass1','keywd5', 5, NULL, 'datetime', 22, '%-s', 'unit5','comment5', 0); 
insert into MDC_MASTER_KEYWORD_TABLE values
  ('testclass1','keywd6', 6, NULL, 'timestamp', 22, '%-s', 'unit6','comment6', 0); 
insert into MDC_MASTER_KEYWORD_TABLE values
  ('testclass1','keywd7', 7, NULL, 'string', 4, '%-s', 'unit7','comment7', 0);

/* Register links in the global table. */
insert into MDC_MASTER_LINK_TABLE values
   ('testclass1','link0', 0, 'testclass0', 'static', '', '', ''); 
insert into MDC_MASTER_LINK_TABLE values
   ('testclass1','newest', 1, 'testclass0', 'query', 'time=(select max(time) from testclass0)', 'creation', '');

/* Register data segments in the global table. */
insert into MDC_MASTER_DATA_TABLE values
   ('testclass1','x-axis', 0, 'float', 1, '100', 'm', 'fitz');
insert into MDC_MASTER_DATA_TABLE values
   ('testclass1','y-axis', 1, 'float', 1, '200', 'm', 'fitz');
insert into MDC_MASTER_DATA_TABLE values
   ('testclass1','x-axis', 2, 'float', 1, '50', 'm', 'fitz');
insert into MDC_MASTER_DATA_TABLE values
   ('testclass1','pressure', 3, 'float', 3, '100, 200, 50', 'kg/(s^2*m)', 'fitz');
insert into MDC_MASTER_DATA_TABLE values
   ('testclass1','velocity', 4, 'float', 4, '100, 200, 50, 3', 'm/s', 'fitz');

/* Create the main table to hold per-record information. */
create table testclass1
(
  recnum        integer not null, /* Record number */
  ver           integer not null, /* Record version */
  link0_recnum  integer,
  link0_ver     integer,
  newest_recnum integer,
  newest_ver    integer,
  keywd1        "char"                  default '\0',
  keywd2        integer                 default 0,
  keywd3        real                    default 0.0,
  keywd4        double precision        default 0.0,
  keywd5        varchar(22)             default '1970-01-01 00:00:00',
  keywd6        varchar(22)             default '19700101000000',
  keywd7        text                    default '',
  storage_index integer not null unique, /* Index of the record in the main storage table 
                                            holding information about where the data 
                                            files are stored. */
  primary key(recnum,ver) 
);
/* Create indexes explicitly requested in the series specification. */
create index keywd1_idx on testclass1(kewwd1);

/* Create an atomic counter for creating new record numbers for this series. */
create sequence testclass1_seq;

/* Insert default values as record with (recnum,ver) = (0,0). */
insert into testclass1 values
  (0,0,0,0,0,0,'\0', 0, 0.0, 0.0, '1970-01-01 00:00:00','19700101000000', '');



Philip Scherrer 2006-06-17