Class: SiSU_DbCreate::Create

Inherits:
SiSU_DbColumns::Columns show all
Defined in:
lib/sisu/db_create.rb

Direct Known Subclasses

SiSU_DbDBI::Create

Constant Summary collapse

@@dl =
nil

Instance Method Summary collapse

Methods inherited from SiSU_DbColumns::Columns

#classify_dewey, #classify_keywords, #classify_loc, #classify_subject, #classify_topic_register, #column, #column_comment, #create_column, #creator_audio, #creator_author, #creator_author_honorific, #creator_author_nationality, #creator_contributor, #creator_digitized_by, #creator_editor, #creator_illustrator, #creator_photographer, #creator_prepared_by, #creator_translator, #creator_video, #date_added_to_site, #date_available, #date_created, #date_generated, #date_issued, #date_modified, #date_original_publication, #date_published, #date_translated, #date_valid, #fulltext, #identifier_isbn, #identifier_oclc, #language_document, #language_document_char, #language_original, #language_original_char, #links, #name, #notes_abstract, #notes_comment, #notes_coverage, #notes_description, #notes_format, #notes_history, #notes_prefix, #notes_prefix_a, #notes_prefix_b, #notes_relation, #notes_suffix, #notes_type, #original_institution, #original_language, #original_language_char, #original_nationality, #original_publisher, #original_source, #publisher, #rights_all, #rights_copyright_audio, #rights_copyright_digitization, #rights_copyright_illustrations, #rights_copyright_photographs, #rights_copyright_preparation, #rights_copyright_text, #rights_copyright_translation, #rights_copyright_video, #rights_license, #src_filename, #src_filesize, #src_fingerprint, #src_txt, #src_word_count, #title, #title_edition, #title_language, #title_language_char, #title_main, #title_note, #title_short, #title_sub, #tuple

Methods inherited from SiSU_DbText::Prepare

#clean_document_objects_body, #clean_searchable_text_from_document_objects, #clean_searchable_text_from_document_source, #special_character_escape, #strip_markup, #unique_words

Constructor Details

#initialize(opt, conn, file, sql_type = :pg) ⇒ Create

Returns a new instance of Create.



62
63
64
65
66
67
68
69
# File 'lib/sisu/db_create.rb', line 62

def initialize(opt,conn,file,sql_type=:pg)
  @opt,@conn,@file,@sql_type=opt,conn,file,sql_type
  @cX=SiSU_Screen::Ansi.new(@opt.act[:color_state][:set]).cX
  @comment=(@sql_type==:pg) \
  ? (SiSU_DbCreate::Comment.new(@conn,@sql_type))
  : nil
  @@dl ||=SiSU_Env::InfoEnv.new.digest.length
end

Instance Method Details

#availableObject



70
71
72
73
74
75
76
77
# File 'lib/sisu/db_create.rb', line 70

def available
  DBI.available_drivers.each do |driver|
    puts "Driver: #{driver}"
    DBI.data_sources(driver).each do |dsn|
      puts "\tDatasource: #{dsn}"
    end
  end
end

#conn_exec(sql) ⇒ Object



105
106
107
108
109
110
111
# File 'lib/sisu/db_create.rb', line 105

def conn_exec(sql)
  if @sql_type==:pg
    conn_exec_pg(sql)
  elsif @sql_type==:sqlite
    conn_exec_sqlite(sql)
  end
end

#conn_exec_pg(sql) ⇒ Object



112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
# File 'lib/sisu/db_create.rb', line 112

def conn_exec_pg(sql)
  begin
    @conn.exec_params(sql)
  rescue
    if @conn.is_a?(NilClass)
      errmsg="No pg connection (check pg dependencies)"
      if @opt.act[:no_stop][:set]==:on
        SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).
          error("#{errmsg}, proceeding without pg output (as requested)")
      else
        SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).
          error("#{errmsg}, STOPPING")
        exit
      end
    end
  end
end

#conn_exec_sqlite(sql) ⇒ Object



129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
# File 'lib/sisu/db_create.rb', line 129

def conn_exec_sqlite(sql)
  begin
    @conn.execute(sql)
  rescue
    if @conn.is_a?(NilClass)
      errmsg="No sqlite3 connection (check sqlite3 dependencies)"
      if @opt.act[:no_stop][:set]==:on
        SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).
          error("#{errmsg}, proceeding without sqlite output (as requested)")
      else
        SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).
          error("#{errmsg}, STOPPING")
        exit
      end
    end
  end
end

#create_dbObject



78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
# File 'lib/sisu/db_create.rb', line 78

def create_db
  @env=SiSU_Env::InfoEnv.new(@opt.fns)
  tell=(@sql_type==:sqlite) \
  ? SiSU_Screen::Ansi.new(
      @opt.act[:color_state][:set],
      'Create SQLite db tables in:',
      %{"#{@file}"}
    )
  : SiSU_Screen::Ansi.new(
      @opt.act[:color_state][:set],
      'Create pgSQL db tables in:',
      %{"#{Db[:name_prefix]}#{@env.path.base_markup_dir_stub}"}
    )
  if (@opt.act[:verbose][:set]==:on \
  || @opt.act[:verbose_plus][:set]==:on \
  || @opt.act[:maintenance][:set]==:on)
    tell.dark_grey_title_hi
  end
  SiSU_Env::SystemCall.new.create_pg_db(@env.path.base_markup_dir_stub) if @sql_type==:pg #watch use of path.base_markup_dir_stub instead of stub
end

#create_tableObject



104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
# File 'lib/sisu/db_create.rb', line 104

def create_table
  def conn_exec(sql)
    if @sql_type==:pg
      conn_exec_pg(sql)
    elsif @sql_type==:sqlite
      conn_exec_sqlite(sql)
    end
  end
  def conn_exec_pg(sql)
    begin
      @conn.exec_params(sql)
    rescue
      if @conn.is_a?(NilClass)
        errmsg="No pg connection (check pg dependencies)"
        if @opt.act[:no_stop][:set]==:on
          SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).
            error("#{errmsg}, proceeding without pg output (as requested)")
        else
          SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).
            error("#{errmsg}, STOPPING")
          exit
        end
      end
    end
  end
  def conn_exec_sqlite(sql)
    begin
      @conn.execute(sql)
    rescue
      if @conn.is_a?(NilClass)
        errmsg="No sqlite3 connection (check sqlite3 dependencies)"
        if @opt.act[:no_stop][:set]==:on
          SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).
            error("#{errmsg}, proceeding without sqlite output (as requested)")
        else
          SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).
            error("#{errmsg}, STOPPING")
          exit
        end
      end
    end
  end
  def 
    if (@opt.act[:verbose_plus][:set]==:on \
    or @opt.act[:maintenance][:set]==:on)
      print %{
      currently using sisu_dbi module
      to be populated from document files
      create tables metadata_and_text
      data import through ruby transfer
      }
    end
    =%{
      CREATE TABLE metadata_and_text (
        tid                  BIGINT PRIMARY KEY,
        /* title */
        #{column.title.create_column}
        #{column.title_main.create_column}
        #{column.title_sub.create_column}
        #{column.title_short.create_column}
        #{column.title_edition.create_column}
        #{column.title_note.create_column}
        #{column.title_language.create_column}
        #{column.title_language_char.create_column}
        /* creator */
        #{column.creator_author.create_column}
        #{column.creator_author_honorific.create_column}
        #{column.creator_author_nationality.create_column}
        #{column.creator_editor.create_column}
        #{column.creator_contributor.create_column}
        #{column.creator_illustrator.create_column}
        #{column.creator_photographer.create_column}
        #{column.creator_translator.create_column}
        #{column.creator_prepared_by.create_column}
        #{column.creator_digitized_by.create_column}
        #{column.creator_audio.create_column}
        #{column.creator_video.create_column}
        /* language */
        #{column.language_document.create_column}
        #{column.language_document_char.create_column}
        #{column.language_original.create_column}
        #{column.language_original_char.create_column}
        /* date */
        #{column.date_added_to_site.create_column}
        #{column.date_available.create_column}
        #{column.date_created.create_column}
        #{column.date_issued.create_column}
        #{column.date_modified.create_column}
        #{column.date_published.create_column}
        #{column.date_valid.create_column}
        #{column.date_translated.create_column}
        #{column.date_original_publication.create_column}
        #{column.date_generated.create_column}
        /* publisher */
        #{column.publisher.create_column}
        /* original */
        #{column.original_publisher.create_column}
        #{column.original_language.create_column}
        #{column.original_language_char.create_column}
        #{column.original_source.create_column}
        #{column.original_institution.create_column}
        #{column.original_nationality.create_column}
        /* rights */
        #{column.rights_all.create_column}
        #{column.rights_copyright_text.create_column}
        #{column.rights_copyright_translation.create_column}
        #{column.rights_copyright_illustrations.create_column}
        #{column.rights_copyright_photographs.create_column}
        #{column.rights_copyright_preparation.create_column}
        #{column.rights_copyright_digitization.create_column}
        #{column.rights_copyright_audio.create_column}
        #{column.rights_copyright_video.create_column}
        #{column.rights_license.create_column}
        /* classify */
        #{column.classify_topic_register.create_column}
        #{column.classify_subject.create_column}
        #{column.classify_loc.create_column}
        #{column.classify_dewey.create_column}
        #{column.classify_keywords.create_column}
        /* identifier */
        #{column.identifier_oclc.create_column}
        #{column.identifier_isbn.create_column}
        /* notes */
        #{column.notes_abstract.create_column}
        #{column.notes_description.create_column}
        #{column.notes_comment.create_column}
        #{column.notes_history.create_column}
        #{column.notes_coverage.create_column}
        #{column.notes_relation.create_column}
        /* column.notes_source.create_column */
        #{column.notes_type.create_column}
        #{column.notes_format.create_column}
        #{column.notes_prefix.create_column}
        #{column.notes_prefix_a.create_column}
        #{column.notes_prefix_b.create_column}
        #{column.notes_suffix.create_column}
        /* src */
        #{column.src_filename.create_column}
        #{column.src_fingerprint.create_column}
        #{column.src_filesize.create_column}
        #{column.src_word_count.create_column}
        #{column.src_txt.create_column}
        /* misc */
        #{column.fulltext.create_column}
        #{column.links.create_column.gsub(/,$/,'')}
/*          subj                 VARCHAR(64) NULL, */
/*          contact              VARCHAR(100) NULL, */
/*          information          VARCHAR(100) NULL, */
/*          types                CHAR(1) NULL, */
/*          writing_focus_nationality VARCHAR(100) NULL, */
      );
    }
    conn_exec()
    @comment.psql. if @comment
  end
  def doc_objects                                                 # create doc_objects base
    if (@opt.act[:verbose_plus][:set]==:on \
    or @opt.act[:maintenance][:set]==:on)
      print %{
      to be populated from documents files
      create tables doc_objects
      data import through ruby transfer
      }
    end
    create_doc_objects=%{
      CREATE TABLE doc_objects (
        lid             BIGINT PRIMARY KEY,
        metadata_tid    BIGINT REFERENCES metadata_and_text,
        ocn             SMALLINT,
        ocnd            VARCHAR(6),
        ocns            VARCHAR(6),
        clean           TEXT NULL,
        body            TEXT NULL,
        book_idx        TEXT NULL,
        seg             VARCHAR(256) NULL,
        lev_an          VARCHAR(1),
        lev             SMALLINT NULL,
        lev0            SMALLINT,
        lev1            SMALLINT,
        lev2            SMALLINT,
        lev3            SMALLINT,
        lev4            SMALLINT,
        lev5            SMALLINT,
        lev6            SMALLINT,
        lev7            SMALLINT,
        en_a            SMALLINT NULL,
        en_z            SMALLINT NULL,
        en_a_asterisk   SMALLINT NULL,
        en_z_asterisk   SMALLINT NULL,
        en_a_plus       SMALLINT NULL,
        en_z_plus       SMALLINT NULL,
        t_of            VARCHAR(16),
        t_is            VARCHAR(16),
        node            VARCHAR(16) NULL,
        parent          VARCHAR(16) NULL,
        digest_clean    CHAR(#{@@dl}),
        digest_all      CHAR(#{@@dl}),
        types           CHAR(1) NULL
      );
    }
    conn_exec(create_doc_objects)
    @comment.psql.doc_objects if @comment
  end
  def endnotes
    if (@opt.act[:verbose_plus][:set]==:on \
    or @opt.act[:maintenance][:set]==:on)
      print %{
      to be populated from document files
      create tables endnotes
      data import through ruby transfer
      }
    end
    create_endnotes=%{
      CREATE TABLE endnotes (
        nid             BIGINT PRIMARY KEY,
        document_lid    BIGINT REFERENCES doc_objects,
        nr              SMALLINT,
        clean           TEXT NULL,
        body            TEXT NULL,
        ocn             SMALLINT,
        ocnd            VARCHAR(6),
        ocns            VARCHAR(6),
        digest_clean    CHAR(#{@@dl}),
        metadata_tid    BIGINT REFERENCES metadata_and_text
      );
    }
    conn_exec(create_endnotes)
    @comment.psql.endnotes if @comment
  end
  def endnotes_asterisk
    if (@opt.act[:verbose_plus][:set]==:on \
    or @opt.act[:maintenance][:set]==:on)
      print %{
      to be populated from document files
      create tables endnotes_asterisk
      data import through ruby transfer
      }
    end
    create_endnotes_asterisk=%{
      CREATE TABLE endnotes_asterisk (
        nid             BIGINT PRIMARY KEY,
        document_lid    BIGINT REFERENCES doc_objects,
        nr              SMALLINT,
        clean           TEXT NULL,
        body            TEXT NULL,
        ocn             SMALLINT,
        ocnd            VARCHAR(6),
        ocns            VARCHAR(6),
        digest_clean    CHAR(#{@@dl}),
        metadata_tid    BIGINT REFERENCES metadata_and_text
      );
    }
    conn_exec(create_endnotes_asterisk)
    @comment.psql.endnotes_asterisk if @comment
  end
  def endnotes_plus
    if (@opt.act[:verbose_plus][:set]==:on \
    or @opt.act[:maintenance][:set]==:on)
      print %{
      to be populated from document files
      create tables endnotes_plus
      data import through ruby transfer
      }
    end
    create_endnotes_plus=%{
      CREATE TABLE endnotes_plus (
        nid             BIGINT PRIMARY KEY,
        document_lid    BIGINT REFERENCES doc_objects,
        nr              SMALLINT,
        clean           TEXT NULL,
        body            TEXT NULL,
        ocn             SMALLINT,
        ocnd            VARCHAR(6),
        ocns            VARCHAR(6),
        digest_clean    CHAR(#{@@dl}),
        metadata_tid    BIGINT REFERENCES metadata_and_text
      );
    }
    conn_exec(create_endnotes_plus)
    @comment.psql.endnotes_plus if @comment
  end
  def urls                                                       # create doc_objects file links mapping
    if (@opt.act[:verbose_plus][:set]==:on \
    or @opt.act[:maintenance][:set]==:on)
      print %{
      currently using sisu_dbi module
      to be populated from doc_objects files
      create tables urls
      data import through ruby transfer
      }
    end
    create_urls=%{
      CREATE TABLE urls (
        metadata_tid    BIGINT REFERENCES metadata_and_text,
        plaintext       varchar(512),
        html_toc        varchar(512),
        html_doc        varchar(512),
        xhtml           varchar(512),
        xml_sax         varchar(512),
        xml_dom         varchar(512),
        odf             varchar(512),
        pdf_p           varchar(512),
        pdf_l           varchar(512),
        concordance     varchar(512),
        latex_p         varchar(512),
        latex_l         varchar(512),
        digest          varchar(512),
        manifest        varchar(512),
        markup          varchar(512),
        sisupod         varchar(512)
      );
    }
    conn_exec(create_urls)
    @comment.psql.urls if @comment
  end
  self
end

#doc_objectsObject

create doc_objects base



259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
# File 'lib/sisu/db_create.rb', line 259

def doc_objects                                                 # create doc_objects base
  if (@opt.act[:verbose_plus][:set]==:on \
  or @opt.act[:maintenance][:set]==:on)
    print %{
    to be populated from documents files
    create tables doc_objects
    data import through ruby transfer
    }
  end
  create_doc_objects=%{
    CREATE TABLE doc_objects (
      lid             BIGINT PRIMARY KEY,
      metadata_tid    BIGINT REFERENCES metadata_and_text,
      ocn             SMALLINT,
      ocnd            VARCHAR(6),
      ocns            VARCHAR(6),
      clean           TEXT NULL,
      body            TEXT NULL,
      book_idx        TEXT NULL,
      seg             VARCHAR(256) NULL,
      lev_an          VARCHAR(1),
      lev             SMALLINT NULL,
      lev0            SMALLINT,
      lev1            SMALLINT,
      lev2            SMALLINT,
      lev3            SMALLINT,
      lev4            SMALLINT,
      lev5            SMALLINT,
      lev6            SMALLINT,
      lev7            SMALLINT,
      en_a            SMALLINT NULL,
      en_z            SMALLINT NULL,
      en_a_asterisk   SMALLINT NULL,
      en_z_asterisk   SMALLINT NULL,
      en_a_plus       SMALLINT NULL,
      en_z_plus       SMALLINT NULL,
      t_of            VARCHAR(16),
      t_is            VARCHAR(16),
      node            VARCHAR(16) NULL,
      parent          VARCHAR(16) NULL,
      digest_clean    CHAR(#{@@dl}),
      digest_all      CHAR(#{@@dl}),
      types           CHAR(1) NULL
    );
  }
  conn_exec(create_doc_objects)
  @comment.psql.doc_objects if @comment
end

#endnotesObject



307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
# File 'lib/sisu/db_create.rb', line 307

def endnotes
  if (@opt.act[:verbose_plus][:set]==:on \
  or @opt.act[:maintenance][:set]==:on)
    print %{
    to be populated from document files
    create tables endnotes
    data import through ruby transfer
    }
  end
  create_endnotes=%{
    CREATE TABLE endnotes (
      nid             BIGINT PRIMARY KEY,
      document_lid    BIGINT REFERENCES doc_objects,
      nr              SMALLINT,
      clean           TEXT NULL,
      body            TEXT NULL,
      ocn             SMALLINT,
      ocnd            VARCHAR(6),
      ocns            VARCHAR(6),
      digest_clean    CHAR(#{@@dl}),
      metadata_tid    BIGINT REFERENCES metadata_and_text
    );
  }
  conn_exec(create_endnotes)
  @comment.psql.endnotes if @comment
end

#endnotes_asteriskObject



333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
# File 'lib/sisu/db_create.rb', line 333

def endnotes_asterisk
  if (@opt.act[:verbose_plus][:set]==:on \
  or @opt.act[:maintenance][:set]==:on)
    print %{
    to be populated from document files
    create tables endnotes_asterisk
    data import through ruby transfer
    }
  end
  create_endnotes_asterisk=%{
    CREATE TABLE endnotes_asterisk (
      nid             BIGINT PRIMARY KEY,
      document_lid    BIGINT REFERENCES doc_objects,
      nr              SMALLINT,
      clean           TEXT NULL,
      body            TEXT NULL,
      ocn             SMALLINT,
      ocnd            VARCHAR(6),
      ocns            VARCHAR(6),
      digest_clean    CHAR(#{@@dl}),
      metadata_tid    BIGINT REFERENCES metadata_and_text
    );
  }
  conn_exec(create_endnotes_asterisk)
  @comment.psql.endnotes_asterisk if @comment
end

#endnotes_plusObject



359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
# File 'lib/sisu/db_create.rb', line 359

def endnotes_plus
  if (@opt.act[:verbose_plus][:set]==:on \
  or @opt.act[:maintenance][:set]==:on)
    print %{
    to be populated from document files
    create tables endnotes_plus
    data import through ruby transfer
    }
  end
  create_endnotes_plus=%{
    CREATE TABLE endnotes_plus (
      nid             BIGINT PRIMARY KEY,
      document_lid    BIGINT REFERENCES doc_objects,
      nr              SMALLINT,
      clean           TEXT NULL,
      body            TEXT NULL,
      ocn             SMALLINT,
      ocnd            VARCHAR(6),
      ocns            VARCHAR(6),
      digest_clean    CHAR(#{@@dl}),
      metadata_tid    BIGINT REFERENCES metadata_and_text
    );
  }
  conn_exec(create_endnotes_plus)
  @comment.psql.endnotes_plus if @comment
end

#metadata_and_textObject



146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
# File 'lib/sisu/db_create.rb', line 146

def 
  if (@opt.act[:verbose_plus][:set]==:on \
  or @opt.act[:maintenance][:set]==:on)
    print %{
    currently using sisu_dbi module
    to be populated from document files
    create tables metadata_and_text
    data import through ruby transfer
    }
  end
  =%{
    CREATE TABLE metadata_and_text (
      tid                  BIGINT PRIMARY KEY,
      /* title */
      #{column.title.create_column}
      #{column.title_main.create_column}
      #{column.title_sub.create_column}
      #{column.title_short.create_column}
      #{column.title_edition.create_column}
      #{column.title_note.create_column}
      #{column.title_language.create_column}
      #{column.title_language_char.create_column}
      /* creator */
      #{column.creator_author.create_column}
      #{column.creator_author_honorific.create_column}
      #{column.creator_author_nationality.create_column}
      #{column.creator_editor.create_column}
      #{column.creator_contributor.create_column}
      #{column.creator_illustrator.create_column}
      #{column.creator_photographer.create_column}
      #{column.creator_translator.create_column}
      #{column.creator_prepared_by.create_column}
      #{column.creator_digitized_by.create_column}
      #{column.creator_audio.create_column}
      #{column.creator_video.create_column}
      /* language */
      #{column.language_document.create_column}
      #{column.language_document_char.create_column}
      #{column.language_original.create_column}
      #{column.language_original_char.create_column}
      /* date */
      #{column.date_added_to_site.create_column}
      #{column.date_available.create_column}
      #{column.date_created.create_column}
      #{column.date_issued.create_column}
      #{column.date_modified.create_column}
      #{column.date_published.create_column}
      #{column.date_valid.create_column}
      #{column.date_translated.create_column}
      #{column.date_original_publication.create_column}
      #{column.date_generated.create_column}
      /* publisher */
      #{column.publisher.create_column}
      /* original */
      #{column.original_publisher.create_column}
      #{column.original_language.create_column}
      #{column.original_language_char.create_column}
      #{column.original_source.create_column}
      #{column.original_institution.create_column}
      #{column.original_nationality.create_column}
      /* rights */
      #{column.rights_all.create_column}
      #{column.rights_copyright_text.create_column}
      #{column.rights_copyright_translation.create_column}
      #{column.rights_copyright_illustrations.create_column}
      #{column.rights_copyright_photographs.create_column}
      #{column.rights_copyright_preparation.create_column}
      #{column.rights_copyright_digitization.create_column}
      #{column.rights_copyright_audio.create_column}
      #{column.rights_copyright_video.create_column}
      #{column.rights_license.create_column}
      /* classify */
      #{column.classify_topic_register.create_column}
      #{column.classify_subject.create_column}
      #{column.classify_loc.create_column}
      #{column.classify_dewey.create_column}
      #{column.classify_keywords.create_column}
      /* identifier */
      #{column.identifier_oclc.create_column}
      #{column.identifier_isbn.create_column}
      /* notes */
      #{column.notes_abstract.create_column}
      #{column.notes_description.create_column}
      #{column.notes_comment.create_column}
      #{column.notes_history.create_column}
      #{column.notes_coverage.create_column}
      #{column.notes_relation.create_column}
      /* column.notes_source.create_column */
      #{column.notes_type.create_column}
      #{column.notes_format.create_column}
      #{column.notes_prefix.create_column}
      #{column.notes_prefix_a.create_column}
      #{column.notes_prefix_b.create_column}
      #{column.notes_suffix.create_column}
      /* src */
      #{column.src_filename.create_column}
      #{column.src_fingerprint.create_column}
      #{column.src_filesize.create_column}
      #{column.src_word_count.create_column}
      #{column.src_txt.create_column}
      /* misc */
      #{column.fulltext.create_column}
      #{column.links.create_column.gsub(/,$/,'')}
/*          subj                 VARCHAR(64) NULL, */
/*          contact              VARCHAR(100) NULL, */
/*          information          VARCHAR(100) NULL, */
/*          types                CHAR(1) NULL, */
/*          writing_focus_nationality VARCHAR(100) NULL, */
    );
  }
  conn_exec()
  @comment.psql. if @comment
end

#output_dir?Boolean

Returns:

  • (Boolean)


98
99
100
101
102
103
# File 'lib/sisu/db_create.rb', line 98

def output_dir?
  dir=SiSU_Env::InfoEnv.new('')
  if @opt.act[:sqlite][:set]==:on
    dir.path.webserv_stub_ensure
  end
end

#urlsObject

create doc_objects file links mapping



385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
# File 'lib/sisu/db_create.rb', line 385

def urls                                                       # create doc_objects file links mapping
  if (@opt.act[:verbose_plus][:set]==:on \
  or @opt.act[:maintenance][:set]==:on)
    print %{
    currently using sisu_dbi module
    to be populated from doc_objects files
    create tables urls
    data import through ruby transfer
    }
  end
  create_urls=%{
    CREATE TABLE urls (
      metadata_tid    BIGINT REFERENCES metadata_and_text,
      plaintext       varchar(512),
      html_toc        varchar(512),
      html_doc        varchar(512),
      xhtml           varchar(512),
      xml_sax         varchar(512),
      xml_dom         varchar(512),
      odf             varchar(512),
      pdf_p           varchar(512),
      pdf_l           varchar(512),
      concordance     varchar(512),
      latex_p         varchar(512),
      latex_l         varchar(512),
      digest          varchar(512),
      manifest        varchar(512),
      markup          varchar(512),
      sisupod         varchar(512)
    );
  }
  conn_exec(create_urls)
  @comment.psql.urls if @comment
end