class SiSU_DbColumns::Columns

Public Class Methods

new(md=nil) click to toggle source
# File lib/sisu/db_columns.rb, line 59
def initialize(md=nil)
  @md=md
  @db=SiSU_Env::InfoDb.new #watch
  @lang ||=SiSU_i18n::Languages.new
  if defined? md.opt.act \
  and ((md.opt.act[:psql_import][:set]==:on \
  || md.opt.act[:psql_update][:set]==:on) \
  or (md.opt.act[:sqlite_import][:set]==:on \
  || md.opt.act[:sqlite_update][:set]==:on)) \
  and FileTest.exist?(md.fns)
    txt_arr=IO.readlines(md.fns,'')
    src=txt_arr.join("\n")
    if @db.share_source?
      @sisutxt=special_character_escape(src)
    else @sisutxt=''
    end
    @fulltext=clean_searchable_text_from_document_objects(txt_arr)
   else @sisutxt,@fulltext='',''
  end
end

Public Instance Methods

classify_dewey() click to toggle source
# File lib/sisu/db_columns.rb, line 1483
def classify_dewey
  def name
    'classify_dewey'
  end
  def create_column
    "#{name}                VARCHAR(#{Db[:col_library]}) NULL,"
  end
  def column_comment
    %{COMMENT ON COLUMN metadata_and_text.#{name}
     IS 'metadata classify document Dewey';}
  end
  def tuple
    if defined? @md.classify.dewey \
    and @md.classify.dewey=~/\S+/
      txt=@md.classify.dewey
      txt=special_character_escape(txt)
      ["#{name}, ","'#{txt}', "]
    else ['','']
    end
  end
  self
end
classify_keywords() click to toggle source
# File lib/sisu/db_columns.rb, line 1505
def classify_keywords
  def name
    'classify_keywords'
  end
  def create_column
    "#{name}                VARCHAR(#{Db[:col_txt_long]}) NULL,"
  end
  def column_comment
    %{COMMENT ON COLUMN metadata_and_text.#{name}
     IS 'metadata classify document keywords';}
  end
  def tuple
    if defined? @md.classify.keywords \
    and @md.classify.keywords=~/\S+/
      txt=@md.classify.keywords
      txt=special_character_escape(txt)
      ["#{name}, ","'#{txt}', "]
    else ['','']
    end
  end
  self
end
classify_loc() click to toggle source
# File lib/sisu/db_columns.rb, line 1461
def classify_loc
  def name
    'classify_loc'
  end
  def create_column
    "#{name}                VARCHAR(#{Db[:col_library]}) NULL,"
  end
  def column_comment
    %{COMMENT ON COLUMN metadata_and_text.#{name}
     IS 'metadata classify document Library of Congress';}
  end
  def tuple
    if defined? @md.classify.loc \
    and @md.classify.loc=~/\S+/
      txt=@md.classify.loc
      txt=special_character_escape(txt)
      ["#{name}, ","'#{txt}', "]
    else ['','']
    end
  end
  self
end
classify_subject() click to toggle source
# File lib/sisu/db_columns.rb, line 1439
def classify_subject
  def name
    'classify_subject'
  end
  def create_column
    "#{name}                VARCHAR(#{Db[:col_txt_long]}) NULL,"
  end
  def column_comment
    %{COMMENT ON COLUMN metadata_and_text.#{name}
     IS 'metadata classify document subject matter [DC3]';}
  end
  def tuple
    if defined? @md.classify.subject \
    and @md.classify.subject=~/\S+/
      txt=@md.classify.subject
      txt=special_character_escape(txt)
      ["#{name}, ","'#{txt}', "]
    else ['','']
    end
  end
  self
end
classify_topic_register() click to toggle source

% classify @classify:

:topic_register: 
:subject: 
:keywords: 
:type: 
:loc: 
:dewey:
# File lib/sisu/db_columns.rb, line 1417
def classify_topic_register
  def name
    'classify_topic_register'
  end
  def create_column
    "#{name}                VARCHAR(#{Db[:col_info_note]}) NULL,"
  end
  def column_comment
    %{COMMENT ON COLUMN metadata_and_text.#{name}
     IS 'metadata classify document topic register (semi-structured document subject information)';}
  end
  def tuple
    if defined? @md.classify.topic_register \
    and @md.classify.topic_register=~/\S+/
      txt=@md.classify.topic_register
      txt=special_character_escape(txt)
      ["#{name}, ","'#{txt}', "]
    else ['','']
    end
  end
  self
end
column() click to toggle source

% structures def column_define # def varchar(name,size) # “#{name} VARCHAR(#{size}) NULL,” # end end % title @title:

:subtitle: 
:short: 
:edition: 
:language: 
:note:
# File lib/sisu/db_columns.rb, line 94
    def column
      def title                          # DublinCore 1 - title
        def name
          'title'
        end
        def create_column
          "#{name}                VARCHAR(#{Db[:col_title]}) NOT NULL,"
        end
        def column_comment
          %{COMMENT ON COLUMN metadata_and_text.#{name}
            IS 'metadata full document title [DC1]';}
        end
        def tuple
          if defined? @md.title.full \
          and @md.title.full=~/\S+/
            txt=@md.title.full
            txt=special_character_escape(txt)
            ["#{name}, ","'#{txt}', "]
          else ['','']
          end
        end
        self
      end
      def title_main
        def name
          'title_main'
        end
        def create_column
          "#{name}                VARCHAR(#{Db[:col_title_part]}) NOT NULL,"
        end
        def column_comment
          %{COMMENT ON COLUMN metadata_and_text.#{name}
            IS 'metadata main document title';}
        end
        def tuple
          if defined? @md.title.main \
          and @md.title.main=~/\S+/
            txt=@md.title.main
            txt=special_character_escape(txt)
            ["#{name}, ","'#{txt}', "]
          else ['','']
          end
        end
        self
      end
      def title_sub
        def name
          'title_sub'
        end
        def create_column
          "#{name}                VARCHAR(#{Db[:col_title_part]}) NULL,"
        end
        def column_comment
          %{COMMENT ON COLUMN metadata_and_text.#{name}
            IS 'metadata document subtitle';}
        end
        def tuple
          if defined? @md.title.sub \
          and @md.title.sub=~/\S+/
            txt=@md.title.sub
            txt=special_character_escape(txt)
            ["#{name}, ","'#{txt}', "]
          else ['','']
          end
        end
        self
      end
      def title_short
        def name
          'title_short'
        end
        def create_column
          "#{name}                VARCHAR(#{Db[:col_title_part]}) NULL,"
        end
        def column_comment
          %{COMMENT ON COLUMN metadata_and_text.#{name}
            IS 'metadata document short title if any';}
        end
        def tuple
          if defined? @md.title.short \
          and @md.title.short=~/\S+/
            txt=@md.title.short
            txt=special_character_escape(txt)
            ["#{name}, ","'#{txt}', "]
          else ['','']
          end
        end
        self
      end
      def title_edition
        def name
          'title_edition'
        end
        def create_column
          "#{name}                VARCHAR(#{Db[:col_title_edition]}) NULL,"
        end
        def column_comment
          %{COMMENT ON COLUMN metadata_and_text.#{name}
            IS 'metadata document edition (version)';}
        end
        def tuple
          if defined? @md.title.edition \
          and @md.title.edition=~/\S+/
            txt=@md.title.edition
            txt=special_character_escape(txt)
            ["#{name}, ","'#{txt}', "]
          else ['','']
          end
        end
        self
      end
      def title_note
        def name
          'title_note'
        end
        def create_column
          "#{name}                VARCHAR(#{Db[:col_info_note]}) NULL,"
        end
        def column_comment
          %{COMMENT ON COLUMN metadata_and_text.#{name}
            IS 'metadata document notes associated with title';}
        end
        def tuple
          if defined? @md.title.note \
          and @md.title.note=~/\S+/
            txt=@md.title.note
            txt=special_character_escape(txt)
            ["#{name}, ","'#{txt}', "]
          else ['','']
          end
        end
        self
      end
      def title_language
        def name
          'title_language'
        end
        def create_column
          "#{name}                VARCHAR(#{Db[:col_language]}) NULL,"
        end
        def column_comment
          %{COMMENT ON COLUMN metadata_and_text.#{name}
            IS 'metadata document language [DC12]';}
        end
        def tuple
          if @lang.list[@md.opt.lng][:n]
            txt=@lang.list[@md.opt.lng][:n]
            txt=special_character_escape(txt)
            ["#{name}, ","'#{txt}', "]
          else ['','']
          end
        end
        self
      end
      def title_language_char            # consider
        def name
          'title_language_char'
        end
        def create_column
          "#{name}                VARCHAR(#{Db[:col_language_char]}) NULL,"
        end
        def column_comment
          %{COMMENT ON COLUMN metadata_and_text.#{name}
            IS 'metadata document language iso code';}
        end
        def tuple
          if defined? @md.opt.lng \
          and @md.opt.lng=~/\S+/
            txt=@md.opt.lng
            txt=special_character_escape(txt)
            ["#{name}, ","'#{txt}', "]
          else ['','']
          end
        end
        self
      end
=begin
#% creator
@creator:
 :author:
 :editor:
 :contributor:
 :illustrator:
 :photographer:
 :translator:
 :prepared_by:
 :digitized_by:
 :audio:
 :video:
=end
      def creator_author                 # DublinCore 2 - creator/author (author)
        def name
          'creator_author'
        end
        def create_column
          "#{name}                VARCHAR(#{Db[:col_name]}) NULL,"
        end
        def column_comment
          %{COMMENT ON COLUMN metadata_and_text.#{name}
           IS 'metadata document author (creator) [DC2]';}
        end
        def tuple
          if defined? @md.creator.author_detail \
          and @md.creator.author_detail.is_a?(Array) \
          and @md.creator.author_detail.length > 0
            txt=''
            @md.creator.author_detail.each do |h|
              txt=txt + %{#{h[:the]}, #{h[:others]}; }
            end
            txt=txt.gsub(/[;, ]+\s*$/,'')
            txt=special_character_escape(txt)
            ["#{name}, ","'#{txt}', "]
          else ['','']
          end
        end
        self
      end
      def creator_author_honorific       # consider
        def name
          'creator_author_hon'
        end
        def create_column
          "#{name}                VARCHAR(#{Db[:col_creator_misc_short]}) NULL,"
        end
        def column_comment
          %{COMMENT ON COLUMN metadata_and_text.#{name}
           IS 'metadata document author honorific (title e.g, Ms. Dr. Prof.)';}
        end
        def tuple
          if defined? @md.creator.author_hon \
          and @md.creator.author_hon=~/\S+/
            txt=@md.creator.author_hon
            txt=special_character_escape(txt)
            ["#{name}, ","'#{txt}', "]
          else ['','']
          end
        end
        self
      end
      def creator_author_nationality     # consider
        def name
          'creator_author_nationality'
        end
        def create_column
          "#{name}                VARCHAR(#{Db[:col_creator_misc_short]}) NULL,"
        end
        def column_comment
          %{COMMENT ON COLUMN metadata_and_text.#{name}
           IS 'metadata nationality of document author (creator)';}
        end
        def tuple
          if defined? @md.creator.author_nationality_detail \
          and @md.creator.author_nationality=~/\S+/
            txt=@md.creator.author_nationality_detail
            txt=special_character_escape(txt)
            ["#{name}, ","'#{txt}', "]
          else ['','']
          end
        end
        self
      end
      def creator_editor
        def name
          'creator_editor'
        end
        def create_column
          "#{name}                VARCHAR(#{Db[:col_name]}) NULL,"
        end
        def column_comment
          %{COMMENT ON COLUMN metadata_and_text.#{name}
           IS 'metadata document editor name(s)';}
        end
        def tuple
          if defined? @md.creator.editor_detail \
          and @md.creator.editor_detail.is_a?(Array) \
          and @md.creator.editor_detail.length > 0
            txt=''
            @md.creator.editor_detail.each do |h|
              txt=txt + %{#{h[:the]}, #{h[:others]}; }
            end
            txt=txt.gsub(/[;, ]+\s*$/,'')
            txt=special_character_escape(txt)
            ["#{name}, ","'#{txt}', "]
          else ['','']
          end
        end
        self
      end
      def creator_contributor            # DublinCore 6 - contributor
        def name
          'creator_contributor'
        end
        def create_column
          "#{name}                VARCHAR(#{Db[:col_name]}) NULL,"
        end
        def column_comment
          %{COMMENT ON COLUMN metadata_and_text.#{name}
           IS 'metadata document contributor name(s) [DC6]';}
        end
        def tuple
          if defined? @md.creator.contributor_detail \
          and @md.creator.contributor_detail.is_a?(Array) \
          and @md.creator.contributor_detail.length > 0
            txt=''
            @md.creator.contributor_detail.each do |h|
              txt=txt + %{#{h[:the]}, #{h[:others]}; }
            end
            txt=txt.gsub(/[;, ]+\s*$/,'')
            txt=special_character_escape(txt)
            ["#{name}, ","'#{txt}', "]
          else ['','']
          end
        end
        self
      end
      def creator_illustrator
        def name
          'creator_illustrator'
        end
        def create_column
          "#{name}                VARCHAR(#{Db[:col_name]}) NULL,"
        end
        def column_comment
          %{COMMENT ON COLUMN metadata_and_text.#{name}
           IS 'metadata document illustrator name(s)';}
        end
        def tuple
          if defined? @md.creator.illustrator_detail \
          and @md.creator.illustrator_detail.is_a?(Array) \
          and @md.creator.illustrator_detail.length > 0
            txt=''
            @md.creator.illustrator_detail.each do |h|
              txt=txt + %{#{h[:the]}, #{h[:others]}; }
            end
            txt=txt.gsub(/[;, ]+\s*$/,'')
            txt=special_character_escape(txt)
            ["#{name}, ","'#{txt}', "]
          else ['','']
          end
        end
        self
      end
      def creator_photographer
        def name
          'creator_photographer'
        end
        def create_column
          "#{name}                VARCHAR(#{Db[:col_name]}) NULL,"
        end
        def column_comment
          %{COMMENT ON COLUMN metadata_and_text.#{name}
           IS 'metadata document photographer name(s)';}
        end
        def tuple
          if defined? @md.creator.photographer_detail \
          and @md.creator.photographer_detail.is_a?(Array) \
          and @md.creator.photographer_detail.length > 0
            txt=''
            @md.creator.photographer_detail.each do |h|
              txt=txt + %{#{h[:the]}, #{h[:others]}; }
            end
            txt=txt.gsub(/[;, ]+\s*$/,'')
            txt=special_character_escape(txt)
            ["#{name}, ","'#{txt}', "]
          else ['','']
          end
        end
        self
      end
      def creator_translator
        def name
          'creator_translator'
        end
        def create_column
          "#{name}                VARCHAR(#{Db[:col_name]}) NULL,"
        end
        def column_comment
          %{COMMENT ON COLUMN metadata_and_text.#{name}
           IS 'metadata document translator name(s)';}
        end
        def tuple
          if defined? @md.creator.translator_detail \
          and @md.creator.translator_detail.is_a?(Array) \
          and @md.creator.translator_detail.length > 0
            txt=''
            @md.creator.translator_detail.each do |h|
              txt=txt + %{#{h[:the]}, #{h[:others]}; }
            end
            txt=txt.gsub(/[;, ]+\s*$/,'')
            txt=special_character_escape(txt)
            ["#{name}, ","'#{txt}', "]
          else ['','']
          end
        end
        self
      end
      def creator_prepared_by
        def name
          'creator_prepared_by'
        end
        def create_column
          "#{name}                VARCHAR(#{Db[:col_name]}) NULL,"
        end
        def column_comment
          %{COMMENT ON COLUMN metadata_and_text.#{name}
           IS 'metadata document prepared by name(s)';}
        end
        def tuple
          if defined? @md.creator.prepared_by_detail \
          and @md.creator.prepared_by_detail.is_a?(Array) \
          and @md.creator.prepared_by_detail.length > 0
            txt=''
            @md.creator.prepared_by_detail.each do |h|
              txt=txt + %{#{h[:the]}, #{h[:others]}; }
            end
            txt=txt.gsub(/[;, ]+\s*$/,'')
            txt=special_character_escape(txt)
            ["#{name}, ","'#{txt}', "]
          else ['','']
          end
        end
        self
      end
      def creator_digitized_by
        def name
          'creator_digitized_by'
        end
        def create_column
          "#{name}                VARCHAR(#{Db[:col_name]}) NULL,"
        end
        def column_comment
          %{COMMENT ON COLUMN metadata_and_text.#{name}
           IS 'metadata document digitized by name(s)';}
        end
        def tuple
          if defined? @md.creator.digitized_by_detail \
          and @md.creator.digitized_by_detail.is_a?(Array) \
          and @md.creator.digitized_by_detail.length > 0
            txt=''
            @md.creator.digitized_by_detail.each do |h|
              txt=txt + %{#{h[:the]}, #{h[:others]}; }
            end
            txt=txt.gsub(/[;, ]+\s*$/,'')
            txt=special_character_escape(txt)
            ["#{name}, ","'#{txt}', "]
          else ['','']
          end
        end
        self
      end
      def creator_audio
        def name
          'creator_audio'
        end
        def create_column
          "#{name}                VARCHAR(#{Db[:col_name]}) NULL,"
        end
        def column_comment
          %{COMMENT ON COLUMN metadata_and_text.#{name}
           IS 'metadata document audio by name(s)';}
        end
        def tuple
          if defined? @md.creator.audio_detail \
          and @md.creator.audio_detail.is_a?(Array) \
          and @md.creator.audio_detail.length > 0
            txt=''
            @md.creator.audio_detail.each do |h|
              txt=txt + %{#{h[:the]}, #{h[:others]}; }
            end
            txt=txt.gsub(/[;, ]+\s*$/,'')
            txt=special_character_escape(txt)
            ["#{name}, ","'#{txt}', "]
          else ['','']
          end
        end
        self
      end
      def creator_video
        def name
          'creator_video'
        end
        def create_column
          "#{name}                VARCHAR(#{Db[:col_name]}) NULL,"
        end
        def column_comment
          %{COMMENT ON COLUMN metadata_and_text.#{name}
           IS 'metadata document video by name(s)';}
        end
        def tuple
          if defined? @md.creator.video_detail \
          and @md.creator.video_detail.is_a?(Array) \
          and @md.creator.video_detail.length > 0
            txt=''
            @md.creator.video_detail.each do |h|
              txt=txt + %{#{h[:the]}, #{h[:others]}; }
            end
            txt=txt.gsub(/[;, ]+\s*$/,'')
            txt=special_character_escape(txt)
            ["#{name}, ","'#{txt}', "]
          else ['','']
          end
        end
        self
      end
=begin
#% language
#taken from other fields
@title:
 :language:
@original:
 :language:
#not available -->
#@language:
# :document:
# :original:
=end
      def language_document
        def name
          'language_document'
        end
        def create_column
          "#{name}                VARCHAR(#{Db[:col_language]}) NULL,"
        end
        def column_comment
          %{COMMENT ON COLUMN metadata_and_text.#{name}
           IS 'metadata document language';}
        end
        def tuple
          if @lang.list[@md.opt.lng][:n]
            txt=@lang.list[@md.opt.lng][:n]
            txt=special_character_escape(txt)
            ["#{name}, ","'#{txt}', "]
          else ['','']
          end
        end
        self
      end
      def language_document_char
        def name
          'language_document_char'
        end
        def create_column
          "#{name}                VARCHAR(#{Db[:col_language_char]}) NOT NULL,"
        end
        def column_comment
          %{COMMENT ON COLUMN metadata_and_text.#{name}
           IS 'metadata document language';}
        end
        def tuple
          #modify check, is now required, SiSUv3d_
          if defined? @md.opt.lng \
          and @md.opt.lng=~/\S+/
            txt=@md.opt.lng
            txt=special_character_escape(txt)
            ["#{name}, ","'#{txt}', "]
          else ['','']
          end
        end
        self
      end
      def language_original
        def name
          'language_original'
        end
        def create_column
          "#{name}                VARCHAR(#{Db[:col_language]}) NULL,"
        end
        def column_comment
          %{COMMENT ON COLUMN metadata_and_text.#{name}
           IS 'metadata original document/text language';}
        end
        def tuple
          if defined? @md.language.original \
          and @md.language.original=~/\S+/
            txt=@md.language.original
            txt=special_character_escape(txt)
            ["#{name}, ","'#{txt}', "]
          else ['','']
          end
        end
        self
      end
      def language_original_char
        def name
          'language_original_char'
        end
        def create_column
          "#{name}                VARCHAR(#{Db[:col_language_char]}) NULL,"
        end
        def column_comment
          %{COMMENT ON COLUMN metadata_and_text.#{name}
           IS 'metadata document language';}
        end
        def tuple
          if defined? @md.language.original_char \
          and @md.language.original_char=~/\S+/
            txt=@md.language.original_char
            txt=special_character_escape(txt)
            ["#{name}, ","'#{txt}', "]
          else ['','']
          end
        end
        self
      end
=begin
#% date
@date:
 :added_to_site:
 :available:
 :created:
 :issued:
 :modified:
 :published:
 :valid:
 :translated:
 :original_publication:
=end
      def date_added_to_site
        def name
          'date_added_to_site'
        end
        def create_column
          "#{name}                VARCHAR(#{Db[:col_date_text]}) NULL,"
          #"#{name}                DATE,"
        end
        def column_comment
          %{COMMENT ON COLUMN metadata_and_text.#{name}
           IS 'metadata date added to site';}
        end
        def tuple
          if defined? @md.date.added_to_site \
          and @md.date.added_to_site=~/\S+/
            txt=@md.date.added_to_site
            txt=special_character_escape(txt)
            ["#{name}, ","'#{txt}', "]
          else ['','']
          end
        end
        self
      end
      def date_available
        def name
          'date_available'
        end
        def create_column
          "#{name}                VARCHAR(#{Db[:col_date_text]}) NULL,"
        end
        def column_comment
          %{COMMENT ON COLUMN metadata_and_text.#{name}
           IS 'metadata date added to site [DC]';}
        end
        def tuple
          if defined? @md.date.available \
          and @md.date.available=~/\S+/
            txt=@md.date.available
            txt=special_character_escape(txt)
            ["#{name}, ","'#{txt}', "]
          else ['','']
          end
        end
        self
      end
      def date_created
        def name
          'date_created'
        end
        def create_column
          "#{name}                VARCHAR(#{Db[:col_date_text]}) NULL,"
        end
        def column_comment
          %{COMMENT ON COLUMN metadata_and_text.#{name}
           IS 'metadata date created [DC]';}
        end
        def tuple
          if defined? @md.date.created \
          and @md.date.created=~/\S+/
            txt=@md.date.created
            txt=special_character_escape(txt)
            ["#{name}, ","'#{txt}', "]
          else ['','']
          end
        end
        self
      end
      def date_issued
        def name
          'date_issued'
        end
        def create_column
          "#{name}                VARCHAR(#{Db[:col_date_text]}) NULL,"
        end
        def column_comment
          %{COMMENT ON COLUMN metadata_and_text.#{name}
           IS 'metadata date issued [DC]';}
        end
        def tuple
          if defined? @md.date.issued \
          and @md.date.issued=~/\S+/
            txt=@md.date.issued
            txt=special_character_escape(txt)
            ["#{name}, ","'#{txt}', "]
          else ['','']
          end
        end
        self
      end
      def date_modified
        def name
          'date_modified'
        end
        def create_column
          "#{name}                VARCHAR(#{Db[:col_date_text]}) NULL,"
        end
        def column_comment
          %{COMMENT ON COLUMN metadata_and_text.#{name}
           IS 'metadata date modified [DC]';}
        end
        def tuple
          if defined? @md.date.modified \
          and @md.date.modified=~/\S+/
            txt=@md.date.modified
            txt=special_character_escape(txt)
            ["#{name}, ","'#{txt}', "]
          else ['','']
          end
        end
        self
      end
      def date_published
        def name
          'date_published'
        end
        def create_column
          "#{name}                VARCHAR(#{Db[:col_date_text]}) NULL,"
        end
        def column_comment
          %{COMMENT ON COLUMN metadata_and_text.#{name}
           IS 'metadata date published [DC7]';}
        end
        def tuple
          if defined? @md.date.published \
          and @md.date.published=~/\S+/
            txt=@md.date.published
            txt=special_character_escape(txt)
            ["#{name}, ","'#{txt}', "]
          else ['','']
          end
        end
        self
      end
      def date_valid
        def name
          'date_valid'
        end
        def create_column
          "#{name}                VARCHAR(#{Db[:col_date_text]}) NULL,"
        end
        def column_comment
          %{COMMENT ON COLUMN metadata_and_text.#{name}
           IS 'metadata date valid [DC]';}
        end
        def tuple
          if defined? @md.date.valid \
          and @md.date.valid=~/\S+/
            txt=@md.date.valid
            txt=special_character_escape(txt)
            ["#{name}, ","'#{txt}', "]
          else ['','']
          end
        end
        self
      end
      def date_translated
        def name
          'date_translated'
        end
        def create_column
          "#{name}                VARCHAR(#{Db[:col_date_text]}) NULL,"
        end
        def column_comment
          %{COMMENT ON COLUMN metadata_and_text.#{name}
           IS 'metadata date translated';}
        end
        def tuple
          if defined? @md.date.translated \
          and @md.date.translated=~/\S+/
            txt=@md.date.translated
            txt=special_character_escape(txt)
            ["#{name}, ","'#{txt}', "]
          else ['','']
          end
        end
        self
      end
      def date_original_publication
        def name
          'date_original_publication'
        end
        def create_column
          "#{name}                VARCHAR(#{Db[:col_date_text]}) NULL,"
        end
        def column_comment
          %{COMMENT ON COLUMN metadata_and_text.#{name}
           IS 'metadata date of original publication';}
        end
        def tuple
          if defined? @md.date.original_publication \
          and @md.date.original_publication=~/\S+/
            txt=@md.date.original_publication
            txt=special_character_escape(txt)
            ["#{name}, ","'#{txt}', "]
          else ['','']
          end
        end
        self
      end
      def date_generated
        def name
          'date_generated'
        end
        def create_column              #choose other representation of time
          "#{name}                VARCHAR(30) NULL,"
          #"#{name}                VARCHAR(10) NULL,"
        end
        def column_comment
          %{COMMENT ON COLUMN metadata_and_text.#{name}
           IS 'metadata date of sisu generation of document, automatically populated';}
        end
        def tuple                      #choose other representation of time
          if defined? @md.generated \
          and @md.generated.to_s=~/\S+/
            txt=@md.generated.to_s
            txt=special_character_escape(txt)
            ["#{name}, ","'#{txt}', "]
          else ['','']
          end
        end
        self
      end
=begin
#% publisher
@publisher:
=end
      def publisher
        def name
          'publisher'
        end
        def create_column
          "#{name}                VARCHAR(#{Db[:col_name]}) NULL,"
        end
        def column_comment
          %{COMMENT ON COLUMN metadata_and_text.#{name}
           IS 'metadata document publisher [DC5]';}
        end
        def tuple
          if defined? @md.publisher \
          and @md.publisher=~/\S+/
            txt=@md.publisher
            txt=special_character_escape(txt)
            ["#{name}, ","'#{txt}', "]
          else ['','']
          end
        end
        self
      end
##% current
#    def current_publisher
#      def name
#        'current_publisher'
#      end
#      def size
#        10
#      end
#      def create_column
#        "#{name}                VARCHAR(#{current_publisher.size}) NULL,"
#      end
#      def tuple
#        t=if defined? @md.current.publisher \
#        and @md.current.publisher=~/\S+/
#          txt=@md.current.publisher
#          txt=special_character_escape(txt)
#          "'#{txt}', "
#        end
#      end
#      self
#    end
=begin
#% original
@original:
 :publisher:
 #:date:                                #repeated under date
 :language:
 :institution:
 :nationality:
 :source:
=end
      def original_publisher
        def name
          'original_publisher'
        end
        def create_column
          "#{name}                VARCHAR(#{Db[:col_name]}) NULL,"
        end
        def column_comment
          %{COMMENT ON COLUMN metadata_and_text.#{name}
           IS 'metadata document original publisher [DC5]';}
        end
        def tuple
          if defined? @md.original.publisher \
          and @md.original.publisher=~/\S+/
            txt=@md.original.publisher
            txt=special_character_escape(txt)
            ["#{name}, ","'#{txt}', "]
          else ['','']
          end
        end
        self
      end
      def original_language
        def name
          'original_language'
        end
        def create_column
          "#{name}                VARCHAR(#{Db[:col_language]}) NULL,"
        end
        def column_comment
          %{COMMENT ON COLUMN metadata_and_text.#{name}
           IS 'metadata document original language';}
        end
        def tuple
          if defined? @md.original.language \
          and @md.original.language=~/\S+/
            txt=@md.original.language
            txt=special_character_escape(txt)
            ["#{name}, ","'#{txt}', "]
          else ['','']
          end
        end
        self
      end
      def original_language_char         # consider
        def name
          'original_language_char'
        end
        def create_column
          "#{name}                VARCHAR(#{Db[:col_language_char]}) NULL,"
        end
        def column_comment
          %{COMMENT ON COLUMN metadata_and_text.#{name}
           IS 'metadata document original language iso character';}
        end
        def tuple
          if defined? @md.original.language_char \
          and @md.original.language_char=~/\S+/
            txt=@md.original.language_char
            txt=special_character_escape(txt)
            ["#{name}, ","'#{txt}', "]
          else ['','']
          end
        end
        self
      end
      def original_source
        def name
          'original_source'
        end
        def create_column
          "#{name}                VARCHAR(#{Db[:col_name]}) NULL,"
        end
        def column_comment
          %{COMMENT ON COLUMN metadata_and_text.#{name}
           IS 'metadata document original source [DC11]';}
        end
        def tuple
          if defined? @md.original.source \
          and @md.original.source=~/\S+/
            txt=@md.original.source
            txt=special_character_escape(txt)
            ["#{name}, ","'#{txt}', "]
          else ['','']
          end
        end
        self
      end
      def original_institution
        def name
          'original_institution'
        end
        def create_column
          "#{name}                VARCHAR(#{Db[:col_name]}) NULL,"
        end
        def column_comment
          %{COMMENT ON COLUMN metadata_and_text.#{name}
           IS 'metadata document original institution';}
        end
        def tuple
          if defined? @md.original.institution \
          and @md.original.institution=~/\S+/
            txt=@md.original.institution
            txt=special_character_escape(txt)
            ["#{name}, ","'#{txt}', "]
          else ['','']
          end
        end
        self
      end
      def original_nationality
        def name
          'original_nationality'
        end
        def create_column
          "#{name}                VARCHAR(#{Db[:col_language]}) NULL,"
        end
        def column_comment
          %{COMMENT ON COLUMN metadata_and_text.#{name}
           IS 'metadata document original nationality';}
        end
        def tuple
          if defined? @md.original.nationality \
          and @md.original.nationality=~/\S+/
            txt=@md.original.nationality
            txt=special_character_escape(txt)
            ["#{name}, ","'#{txt}', "]
          else ['','']
          end
        end
        self
      end
=begin
#% rights
@rights:
 #:copyright:                          #mapped to :text: used where no other copyrights and included in :all:
 :text:
 :translation:
 :illustrations:
 :photographs:
 :preparation:
 :digitization:
 :audio:
 :video:
 :license:
 :all:
=end
      def rights_all
        def name
          'rights'
        end
        def create_column
          "#{name}                VARCHAR(#{Db[:col_info_note]}) NULL,"
        end
        def column_comment
          %{COMMENT ON COLUMN metadata_and_text.#{name}
           IS 'metadata rights associated with document (composite) [DC15]';}
        end
        def tuple
          if defined? @md.rights.all \
          and @md.rights.all=~/\S+/
            txt=@md.rights.all
            txt=special_character_escape(txt)
            ["#{name}, ","'#{txt}', "]
          else ['','']
          end
        end
        self
      end
      def rights_copyright_text
        def name
          'rights_copyright_text'
        end
        def create_column
          "#{name}                VARCHAR(#{Db[:col_info_note]}) NULL,"
        end
        def column_comment
          %{COMMENT ON COLUMN metadata_and_text.#{name}
           IS 'metadata copyright associated for document text';}
        end
        def tuple
          if defined? @md.rights.copyright_text \
          and @md.rights.copyright_text=~/\S+/
            txt=@md.rights.copyright_text
            txt=special_character_escape(txt)
            ["#{name}, ","'#{txt}', "]
          else ['','']
          end
        end
        self
      end
      def rights_copyright_translation
        def name
          'rights_copyright_translation'
        end
        def create_column
          "#{name}                VARCHAR(#{Db[:col_info_note]}) NULL,"
        end
        def column_comment
          %{COMMENT ON COLUMN metadata_and_text.#{name}
           IS 'metadata copyright associated for document text translation (if any)';}
        end
        def tuple
          if defined? @md.rights.copyright_translation \
          and @md.rights.copyright_translation=~/\S+/
            txt=@md.rights.copyright_translation
            txt=special_character_escape(txt)
            ["#{name}, ","'#{txt}', "]
          else ['','']
          end
        end
        self
      end
      def rights_copyright_illustrations
        def name
          'rights_copyright_illustrations'
        end
        def create_column
          "#{name}                VARCHAR(#{Db[:col_info_note]}) NULL,"
        end
        def column_comment
          %{COMMENT ON COLUMN metadata_and_text.#{name}
           IS 'metadata copyright associated for document text illustrations (if any)';}
        end
        def tuple
          if defined? @md.rights.copyright_illustrations \
          and @md.rights.copyright_illustrations=~/\S+/
            txt=@md.rights.copyright_illustrations
            txt=special_character_escape(txt)
            ["#{name}, ","'#{txt}', "]
          else ['','']
          end
        end
        self
      end
      def rights_copyright_photographs
        def name
          'rights_copyright_photographs'
        end
        def create_column
          "#{name}                VARCHAR(#{Db[:col_info_note]}) NULL,"
        end
        def column_comment
          %{COMMENT ON COLUMN metadata_and_text.#{name}
           IS 'metadata copyright associated for document text photographs (if any)';}
        end
        def tuple
          if defined? @md.rights.copyright_photographs \
          and @md.rights.copyright_photographs=~/\S+/
            txt=@md.rights.copyright_photographs
            txt=special_character_escape(txt)
            ["#{name}, ","'#{txt}', "]
          else ['','']
          end
        end
        self
      end
      def rights_copyright_preparation
        def name
          'rights_copyright_preparation'
        end
        def create_column
          "#{name}                VARCHAR(#{Db[:col_info_note]}) NULL,"
        end
        def column_comment
          %{COMMENT ON COLUMN metadata_and_text.#{name}
           IS 'metadata copyright associated for document text preparation (if any)';}
        end
        def tuple
          if defined? @md.rights.copyright_preparation \
          and @md.rights.copyright_preparation=~/\S+/
            txt=@md.rights.copyright_preparation
            txt=special_character_escape(txt)
            ["#{name}, ","'#{txt}', "]
          else ['','']
          end
        end
        self
      end
      def rights_copyright_digitization
        def name
          'rights_copyright_digitization'
        end
        def create_column
          "#{name}                VARCHAR(#{Db[:col_info_note]}) NULL,"
        end
        def column_comment
          %{COMMENT ON COLUMN metadata_and_text.#{name}
           IS 'metadata copyright associated for document text digitization (if any)';}
        end
        def tuple
          if defined? @md.rights.copyright_digitization \
          and @md.rights.copyright_digitization=~/\S+/
            txt=@md.rights.copyright_digitization
            txt=special_character_escape(txt)
            ["#{name}, ","'#{txt}', "]
          else ['','']
          end
        end
        self
      end
      def rights_copyright_audio
        def name
          'rights_copyright_audio'
        end
        def create_column
          "#{name}                VARCHAR(#{Db[:col_info_note]}) NULL,"
        end
        def column_comment
          %{COMMENT ON COLUMN metadata_and_text.#{name}
           IS 'metadata copyright associated for document text audio (if any)';}
        end
        def tuple
          if defined? @md.rights.copyright_audio \
          and @md.rights.copyright_audio=~/\S+/
            txt=@md.rights.copyright_audio
            txt=special_character_escape(txt)
            ["#{name}, ","'#{txt}', "]
          else ['','']
          end
        end
        self
      end
      def rights_copyright_video
        def name
          'rights_copyright_video'
        end
        def create_column
          "#{name}                VARCHAR(#{Db[:col_info_note]}) NULL,"
        end
        def column_comment
          %{COMMENT ON COLUMN metadata_and_text.#{name}
           IS 'metadata copyright associated for document text video (if any)';}
        end
        def tuple
          if defined? @md.rights.copyright_video \
          and @md.rights.copyright_video=~/\S+/
            txt=@md.rights.copyright_video
            txt=special_character_escape(txt)
            ["#{name}, ","'#{txt}', "]
          else ['','']
          end
        end
        self
      end
      def rights_license
        def name
          'rights_license'
        end
        def create_column
          "#{name}                VARCHAR(#{Db[:col_info_note]}) NULL,"
        end
        def column_comment
          %{COMMENT ON COLUMN metadata_and_text.#{name}
           IS 'metadata license granted for use of document if any)';}
        end
        def tuple
          if defined? @md.rights.license \
          and @md.rights.license=~/\S+/
            txt=@md.rights.license
            txt=special_character_escape(txt)
            ["#{name}, ","'#{txt}', "]
          else ['','']
          end
        end
        self
      end
=begin
#% identifier
@identifier:
 :oclc:
 :isbn:
=end
      def identifier_oclc
        def name
          'identifier_oclc'
        end
        def create_column
          "#{name}                VARCHAR(#{Db[:col_library]}) NULL,"
        end
        def column_comment
          %{COMMENT ON COLUMN metadata_and_text.#{name}
           IS 'metadata identifier document Online Computer Library Center number';}
        end
        def tuple
          if defined? @md.identifier.oclc \
          and @md.identifier.oclc=~/\S+/
            txt=@md.identifier.oclc
            txt=special_character_escape(txt)
            ["#{name}, ","'#{txt}', "]
          else ['','']
          end
        end
        self
      end
      def identifier_isbn
        def name
          'identifier_isbn'
        end
        def create_column
          "#{name}                VARCHAR(#{Db[:col_small]}) NULL,"
        end
        def column_comment
          %{COMMENT ON COLUMN metadata_and_text.#{name}
           IS 'metadata identifier document isbn (if any)';}
        end
        def tuple
          if defined? @md.identifier.isbn \
          and @md.identifier.isbn=~/\S+/
            txt=@md.identifier.isbn
            txt=special_character_escape(txt)
            ["#{name}, ","'#{txt}', "]
          else ['','']
          end
        end
        self
      end
=begin
#% classify
@classify:
 :topic_register:
 :subject:
 :keywords:
 :type:
 :loc:
 :dewey:
=end
      def classify_topic_register
        def name
          'classify_topic_register'
        end
        def create_column
          "#{name}                VARCHAR(#{Db[:col_info_note]}) NULL,"
        end
        def column_comment
          %{COMMENT ON COLUMN metadata_and_text.#{name}
           IS 'metadata classify document topic register (semi-structured document subject information)';}
        end
        def tuple
          if defined? @md.classify.topic_register \
          and @md.classify.topic_register=~/\S+/
            txt=@md.classify.topic_register
            txt=special_character_escape(txt)
            ["#{name}, ","'#{txt}', "]
          else ['','']
          end
        end
        self
      end
      def classify_subject
        def name
          'classify_subject'
        end
        def create_column
          "#{name}                VARCHAR(#{Db[:col_txt_long]}) NULL,"
        end
        def column_comment
          %{COMMENT ON COLUMN metadata_and_text.#{name}
           IS 'metadata classify document subject matter [DC3]';}
        end
        def tuple
          if defined? @md.classify.subject \
          and @md.classify.subject=~/\S+/
            txt=@md.classify.subject
            txt=special_character_escape(txt)
            ["#{name}, ","'#{txt}', "]
          else ['','']
          end
        end
        self
      end
      def classify_loc
        def name
          'classify_loc'
        end
        def create_column
          "#{name}                VARCHAR(#{Db[:col_library]}) NULL,"
        end
        def column_comment
          %{COMMENT ON COLUMN metadata_and_text.#{name}
           IS 'metadata classify document Library of Congress';}
        end
        def tuple
          if defined? @md.classify.loc \
          and @md.classify.loc=~/\S+/
            txt=@md.classify.loc
            txt=special_character_escape(txt)
            ["#{name}, ","'#{txt}', "]
          else ['','']
          end
        end
        self
      end
      def classify_dewey
        def name
          'classify_dewey'
        end
        def create_column
          "#{name}                VARCHAR(#{Db[:col_library]}) NULL,"
        end
        def column_comment
          %{COMMENT ON COLUMN metadata_and_text.#{name}
           IS 'metadata classify document Dewey';}
        end
        def tuple
          if defined? @md.classify.dewey \
          and @md.classify.dewey=~/\S+/
            txt=@md.classify.dewey
            txt=special_character_escape(txt)
            ["#{name}, ","'#{txt}', "]
          else ['','']
          end
        end
        self
      end
      def classify_keywords
        def name
          'classify_keywords'
        end
        def create_column
          "#{name}                VARCHAR(#{Db[:col_txt_long]}) NULL,"
        end
        def column_comment
          %{COMMENT ON COLUMN metadata_and_text.#{name}
           IS 'metadata classify document keywords';}
        end
        def tuple
          if defined? @md.classify.keywords \
          and @md.classify.keywords=~/\S+/
            txt=@md.classify.keywords
            txt=special_character_escape(txt)
            ["#{name}, ","'#{txt}', "]
          else ['','']
          end
        end
        self
      end
=begin
#% notes
@notes:
 :abstract:
 :description:
 :comment:
 :coverage:
 :relation:
 :format:
 :history:
 :prefix:
 :prefix_a:
 :prefix_b:
 :suffix:
=end
      def notes_abstract
        def name
          'notes_abstract'
        end
        def create_column
          "#{name}                     TEXT NULL,"
        end
        def column_comment
          %{COMMENT ON COLUMN metadata_and_text.#{name}
           IS 'metadata document notes abstract';}
        end
        def tuple
          if defined? @md.notes.abstract \
          and @md.notes.abstract=~/\S+/
            txt=@md.notes.abstract
            txt=special_character_escape(txt)
            ["#{name}, ","'#{txt}', "]
          else ['','']
          end
        end
        self
      end
      def notes_description
        def name
          'notes_description'
        end
        def create_column
          "#{name}                    TEXT NULL,"
        end
        def column_comment
          %{COMMENT ON COLUMN metadata_and_text.#{name}
           IS 'metadata document notes description [DC4]';}
        end
        def tuple
          if defined? @md.notes.description \
          and @md.notes.description=~/\S+/
            txt=@md.notes.description
            txt=special_character_escape(txt)
            ["#{name}, ","'#{txt}', "]
          else ['','']
          end
        end
        self
      end
      def notes_comment
        def name
          'notes_comment'
        end
        def create_column
          "#{name}                       TEXT NULL,"
        end
        def column_comment
          %{COMMENT ON COLUMN metadata_and_text.#{name}
           IS 'metadata document notes comment';}
        end
        def tuple
          if defined? @md.notes.comment \
          and @md.notes.comment=~/\S+/
            txt=@md.notes.comment
            txt=special_character_escape(txt)
            ["#{name}, ","'#{txt}', "]
          else ['','']
          end
        end
        self
      end
      def notes_coverage
        def name
          'notes_coverage'
        end
        def create_column
          "#{name}                VARCHAR(#{Db[:col_txt_short]}) NULL,"
        end
        def column_comment
          %{COMMENT ON COLUMN metadata_and_text.#{name}
           IS 'metadata classify document coverage [DC14]';}
        end
        def tuple
          if defined? @md.classify.coverage \
          and @md.classify.coverage=~/\S+/
            txt=@md.classify.coverage
            txt=special_character_escape(txt)
            ["#{name}, ","'#{txt}', "]
          else ['','']
          end
        end
        self
      end
      def notes_relation
        def name
          'notes_relation'
        end
        def create_column
          "#{name}                VARCHAR(#{Db[:col_txt_short]}) NULL,"
        end
        def column_comment
          %{COMMENT ON COLUMN metadata_and_text.#{name}
           IS 'metadata classify document relation [DC13]';}
        end
        def tuple
          if defined? @md.classify.relation \
          and @md.classify.relation=~/\S+/
            txt=@md.classify.relation
            txt=special_character_escape(txt)
            ["#{name}, ","'#{txt}', "]
          else ['','']
          end
        end
        self
      end
      def notes_history   #check, consider removal
        def name
          'notes_history'
        end
        def create_column
          "#{name}                VARCHAR(#{Db[:col_txt_long]}) NULL,"
        end
        def column_comment
          %{COMMENT ON COLUMN metadata_and_text.#{name}
           IS 'metadata document notes history';}
        end
        def tuple
          if defined? @md.notes.history \
          and @md.notes.history=~/\S+/
            txt=@md.notes.history
            txt=special_character_escape(txt)
            ["#{name}, ","'#{txt}', "]
          else ['','']
          end
        end
        self
      end
      def notes_type #check
        def name
          'notes_type'
        end
        def create_column
          "#{name}                VARCHAR(#{Db[:col_txt_long]}) NULL,"
        end
        def column_comment
          %{COMMENT ON COLUMN metadata_and_text.#{name}
           IS 'metadata notes document type [DC8]';}
        end
        def tuple
          if defined? @md.notes.type \
          and @md.notes.type=~/\S+/
            txt=@md.notes.type
            txt=special_character_escape(txt)
            ["#{name}, ","'#{txt}', "]
          else ['','']
          end
        end
        self
      end
      def notes_format
        def name
          'notes_format'
        end
        def create_column
          "#{name}                VARCHAR(#{Db[:col_txt_long]}) NULL,"
        end
        def column_comment
          %{COMMENT ON COLUMN metadata_and_text.#{name}
           IS 'metadata classify document format [DC9]';}
        end
        def tuple
          if defined? @md.classify.format \
          and @md.classify.format=~/\S+/
            txt=@md.classify.format
            txt=special_character_escape(txt)
            ["#{name}, ","'#{txt}', "]
          else ['','']
          end
        end
        self
      end
      def notes_prefix
        def name
          'notes_prefix'
        end
        def create_column
          "#{name}                TEXT NULL,"
        end
        def column_comment
          %{COMMENT ON COLUMN metadata_and_text.#{name}
           IS 'metadata document notes prefix';}
        end
        def tuple
          if defined? @md.notes.prefix \
          and @md.notes.prefix=~/\S+/
            txt=@md.notes.prefix
            txt=special_character_escape(txt)
            ["#{name}, ","'#{txt}', "]
          else ['','']
          end
        end
        self
      end
      def notes_prefix_a
        def name
          'notes_prefix_a'
        end
        def create_column
          "#{name}                TEXT NULL,"
        end
        def column_comment
          %{COMMENT ON COLUMN metadata_and_text.#{name}
           IS 'metadata document notes prefix_a';}
        end
        def tuple
          if defined? @md.notes.prefix_a \
          and @md.notes.prefix_a=~/\S+/
            txt=@md.notes.prefix_a
            txt=special_character_escape(txt)
            ["#{name}, ","'#{txt}', "]
          else ['','']
          end
        end
        self
      end
      def notes_prefix_b
        def name
          'notes_prefix_b'
        end
        def create_column
          "#{name}                TEXT NULL,"
        end
        def column_comment
          %{COMMENT ON COLUMN metadata_and_text.#{name}
           IS 'metadata document notes prefix_b';}
        end
        def tuple
          if defined? @md.notes.prefix_b \
          and @md.notes.prefix_b=~/\S+/
            txt=@md.notes.prefix_b
            txt=special_character_escape(txt)
            ["#{name}, ","'#{txt}', "]
          else ['','']
          end
        end
        self
      end
      def notes_suffix
        def name
          'notes_suffix'
        end
        def create_column                # keep text
          "#{name}                TEXT NULL,"
        end
        def column_comment
          %{COMMENT ON COLUMN metadata_and_text.#{name}
           IS 'metadata document notes suffix';}
        end
        def tuple
          if defined? @md.notes.suffix \
          and @md.notes.suffix=~/\S+/
            txt=@md.notes.suffix
            txt=special_character_escape(txt)
            ["#{name}, ","'#{txt}', "]
          else ['','']
          end
        end
        self
      end
=begin
#% src
=end
      def src_filename
        def name
          'src_filename'
        end
        def create_column
          "#{name}                VARCHAR(#{Db[:col_filename]}) NOT NULL,"
        end
        def column_comment
          %{COMMENT ON COLUMN metadata_and_text.#{name}
           IS 'sisu markup source text filename';}
        end
        def tuple
          if defined? @md.fns \
          and @md.fns=~/\S+/
            txt=@md.fns
            txt=special_character_escape(txt)
            ["#{name}, ","'#{txt}', "]
          else ['','']
          end
        end
        self
      end
      def src_fingerprint
        def name
          'src_fingerprint' #hash/digest, sha512, sha256 or md5
        end
        def create_column
          "#{name}                VARCHAR(#{Db[:col_digest]}) NULL,"
          #"#{name}                TEXT NULL,"
        end
        def column_comment
          %{COMMENT ON COLUMN metadata_and_text.#{name}
            IS 'sisu markup source text fingerprint, hash digest sha512, sha256 or md5';}
        end
        def tuple
          if defined? @md.dgst \
          and @md.dgst.is_a?(Array) \
          and @md.dgst[1]=~/\S+/
            txt=@md.dgst[1]
            ["#{name}, ","'#{txt}', "]
          else ['','']
          end
        end
        self
      end
      def src_filesize
        def name
          'src_filesize'
        end
        def create_column
          "#{name}                VARCHAR(#{Db[:col_filesize]}) NULL,"
        end
        def column_comment
          %{COMMENT ON COLUMN metadata_and_text.#{name}
            IS 'sisu markup source text file size';}
        end
        def tuple
         if defined? @md.filesize \
         and @md.filesize=~/\S+/
           txt=@md.filesize
           txt=special_character_escape(txt)
           ["#{name}, ","'#{txt}', "]
         else ['','']
         end
        end
        self
      end
      def src_word_count
        def name
          'src_word_count'
        end
        def create_column
          "#{name}                TEXT NULL,"
        end
        def column_comment
          %{COMMENT ON COLUMN metadata_and_text.#{name}
            IS 'sisu markup source text word count';}
        end
        def tuple
          if defined? @md.wc_words \
          and @md.wc_words=~/\S+/
            txt=@md.wc_words
            txt=special_character_escape(txt)
            ["#{name}, ","'#{txt}', "]
          else ['','']
          end
        end
        self
      end
      def src_txt                      # consider naming sisusrc
        def name
          'src_text'
        end
        def create_column
          "#{name}                TEXT NULL,"
        end
        def column_comment
          %{COMMENT ON COLUMN metadata_and_text.#{name}
           IS 'sisu markup source text (if shared)';}
        end
        def tuple
          if ((@md.opt.act[:psql_import][:set]==:on \
          || @md.opt.act[:psql_update][:set]==:on) \
          or (@md.opt.act[:sqlite_import][:set]==:on \
          || @md.opt.act[:sqlite_update][:set]==:on)) \
          and FileTest.exist?(@md.fns)
            ["#{name}, ","'#{@sisutxt}', "]
          else ['','']
          end
        end
        self
      end
=begin
#% misc
@links:
=end
      def fulltext
        def name
          'fulltext'
        end
        def create_column
          "#{name}                TEXT NULL,"
        end
        def column_comment
          %{COMMENT ON COLUMN metadata_and_text.#{name}
            IS 'document full text clean, searchable';}
        end
        def tuple
          if ((@md.opt.act[:psql_import][:set]==:on \
          || @md.opt.act[:psql_update][:set]==:on) \
          or (@md.opt.act[:sqlite_import][:set]==:on \
          || @md.opt.act[:sqlite_update][:set]==:on)) \
          and  FileTest.exist?(@md.fns)
            ["#{name}, ","'#{@fulltext}', "]
          else ['','']
          end
        end
        self
      end
      def links
        def name
          'links'
        end
        def create_column
          "#{name}                TEXT NULL,"
          #"#{name}                 VARCHAR(#{links.size}) NULL,"
        end
        def column_comment
          %{COMMENT ON COLUMN metadata_and_text.#{name}
           IS 'metadata document links';}
        end
        def tuple
          if defined? @md.links \
          and @md.links=~/\S+/
            txt=@md.links
            txt=special_character_escape(txt)
            ["#{name}, ","'#{txt}', "]
          else ['','']
          end
        end
        self
      end
      self
    end
column_comment() click to toggle source
# File lib/sisu/db_columns.rb, line 102
def column_comment
  %{COMMENT ON COLUMN metadata_and_text.#{name}
    IS 'metadata full document title [DC1]';}
end
create_column() click to toggle source
# File lib/sisu/db_columns.rb, line 99
def create_column
  "#{name}                VARCHAR(#{Db[:col_title]}) NOT NULL,"
end
creator_audio() click to toggle source
# File lib/sisu/db_columns.rb, line 544
def creator_audio
  def name
    'creator_audio'
  end
  def create_column
    "#{name}                VARCHAR(#{Db[:col_name]}) NULL,"
  end
  def column_comment
    %{COMMENT ON COLUMN metadata_and_text.#{name}
     IS 'metadata document audio by name(s)';}
  end
  def tuple
    if defined? @md.creator.audio_detail \
    and @md.creator.audio_detail.is_a?(Array) \
    and @md.creator.audio_detail.length > 0
      txt=''
      @md.creator.audio_detail.each do |h|
        txt=txt + %{#{h[:the]}, #{h[:others]}; }
      end
      txt=txt.gsub(/[;, ]+\s*$/,'')
      txt=special_character_escape(txt)
      ["#{name}, ","'#{txt}', "]
    else ['','']
    end
  end
  self
end
creator_author() click to toggle source

% creator @creator:

:author: 
:editor: 
:contributor: 
:illustrator: 
:photographer: 
:translator: 
:prepared_by: 
:digitized_by: 
:audio: 
:video:
# File lib/sisu/db_columns.rb, line 284
def creator_author                 # DublinCore 2 - creator/author (author)
  def name
    'creator_author'
  end
  def create_column
    "#{name}                VARCHAR(#{Db[:col_name]}) NULL,"
  end
  def column_comment
    %{COMMENT ON COLUMN metadata_and_text.#{name}
     IS 'metadata document author (creator) [DC2]';}
  end
  def tuple
    if defined? @md.creator.author_detail \
    and @md.creator.author_detail.is_a?(Array) \
    and @md.creator.author_detail.length > 0
      txt=''
      @md.creator.author_detail.each do |h|
        txt=txt + %{#{h[:the]}, #{h[:others]}; }
      end
      txt=txt.gsub(/[;, ]+\s*$/,'')
      txt=special_character_escape(txt)
      ["#{name}, ","'#{txt}', "]
    else ['','']
    end
  end
  self
end
creator_author_honorific() click to toggle source
# File lib/sisu/db_columns.rb, line 311
def creator_author_honorific       # consider
  def name
    'creator_author_hon'
  end
  def create_column
    "#{name}                VARCHAR(#{Db[:col_creator_misc_short]}) NULL,"
  end
  def column_comment
    %{COMMENT ON COLUMN metadata_and_text.#{name}
     IS 'metadata document author honorific (title e.g, Ms. Dr. Prof.)';}
  end
  def tuple
    if defined? @md.creator.author_hon \
    and @md.creator.author_hon=~/\S+/
      txt=@md.creator.author_hon
      txt=special_character_escape(txt)
      ["#{name}, ","'#{txt}', "]
    else ['','']
    end
  end
  self
end
creator_author_nationality() click to toggle source
# File lib/sisu/db_columns.rb, line 333
def creator_author_nationality     # consider
  def name
    'creator_author_nationality'
  end
  def create_column
    "#{name}                VARCHAR(#{Db[:col_creator_misc_short]}) NULL,"
  end
  def column_comment
    %{COMMENT ON COLUMN metadata_and_text.#{name}
     IS 'metadata nationality of document author (creator)';}
  end
  def tuple
    if defined? @md.creator.author_nationality_detail \
    and @md.creator.author_nationality=~/\S+/
      txt=@md.creator.author_nationality_detail
      txt=special_character_escape(txt)
      ["#{name}, ","'#{txt}', "]
    else ['','']
    end
  end
  self
end
creator_contributor() click to toggle source
# File lib/sisu/db_columns.rb, line 382
def creator_contributor            # DublinCore 6 - contributor
  def name
    'creator_contributor'
  end
  def create_column
    "#{name}                VARCHAR(#{Db[:col_name]}) NULL,"
  end
  def column_comment
    %{COMMENT ON COLUMN metadata_and_text.#{name}
     IS 'metadata document contributor name(s) [DC6]';}
  end
  def tuple
    if defined? @md.creator.contributor_detail \
    and @md.creator.contributor_detail.is_a?(Array) \
    and @md.creator.contributor_detail.length > 0
      txt=''
      @md.creator.contributor_detail.each do |h|
        txt=txt + %{#{h[:the]}, #{h[:others]}; }
      end
      txt=txt.gsub(/[;, ]+\s*$/,'')
      txt=special_character_escape(txt)
      ["#{name}, ","'#{txt}', "]
    else ['','']
    end
  end
  self
end
creator_digitized_by() click to toggle source
# File lib/sisu/db_columns.rb, line 517
def creator_digitized_by
  def name
    'creator_digitized_by'
  end
  def create_column
    "#{name}                VARCHAR(#{Db[:col_name]}) NULL,"
  end
  def column_comment
    %{COMMENT ON COLUMN metadata_and_text.#{name}
     IS 'metadata document digitized by name(s)';}
  end
  def tuple
    if defined? @md.creator.digitized_by_detail \
    and @md.creator.digitized_by_detail.is_a?(Array) \
    and @md.creator.digitized_by_detail.length > 0
      txt=''
      @md.creator.digitized_by_detail.each do |h|
        txt=txt + %{#{h[:the]}, #{h[:others]}; }
      end
      txt=txt.gsub(/[;, ]+\s*$/,'')
      txt=special_character_escape(txt)
      ["#{name}, ","'#{txt}', "]
    else ['','']
    end
  end
  self
end
creator_editor() click to toggle source
# File lib/sisu/db_columns.rb, line 355
def creator_editor
  def name
    'creator_editor'
  end
  def create_column
    "#{name}                VARCHAR(#{Db[:col_name]}) NULL,"
  end
  def column_comment
    %{COMMENT ON COLUMN metadata_and_text.#{name}
     IS 'metadata document editor name(s)';}
  end
  def tuple
    if defined? @md.creator.editor_detail \
    and @md.creator.editor_detail.is_a?(Array) \
    and @md.creator.editor_detail.length > 0
      txt=''
      @md.creator.editor_detail.each do |h|
        txt=txt + %{#{h[:the]}, #{h[:others]}; }
      end
      txt=txt.gsub(/[;, ]+\s*$/,'')
      txt=special_character_escape(txt)
      ["#{name}, ","'#{txt}', "]
    else ['','']
    end
  end
  self
end
creator_illustrator() click to toggle source
# File lib/sisu/db_columns.rb, line 409
def creator_illustrator
  def name
    'creator_illustrator'
  end
  def create_column
    "#{name}                VARCHAR(#{Db[:col_name]}) NULL,"
  end
  def column_comment
    %{COMMENT ON COLUMN metadata_and_text.#{name}
     IS 'metadata document illustrator name(s)';}
  end
  def tuple
    if defined? @md.creator.illustrator_detail \
    and @md.creator.illustrator_detail.is_a?(Array) \
    and @md.creator.illustrator_detail.length > 0
      txt=''
      @md.creator.illustrator_detail.each do |h|
        txt=txt + %{#{h[:the]}, #{h[:others]}; }
      end
      txt=txt.gsub(/[;, ]+\s*$/,'')
      txt=special_character_escape(txt)
      ["#{name}, ","'#{txt}', "]
    else ['','']
    end
  end
  self
end
creator_photographer() click to toggle source
# File lib/sisu/db_columns.rb, line 436
def creator_photographer
  def name
    'creator_photographer'
  end
  def create_column
    "#{name}                VARCHAR(#{Db[:col_name]}) NULL,"
  end
  def column_comment
    %{COMMENT ON COLUMN metadata_and_text.#{name}
     IS 'metadata document photographer name(s)';}
  end
  def tuple
    if defined? @md.creator.photographer_detail \
    and @md.creator.photographer_detail.is_a?(Array) \
    and @md.creator.photographer_detail.length > 0
      txt=''
      @md.creator.photographer_detail.each do |h|
        txt=txt + %{#{h[:the]}, #{h[:others]}; }
      end
      txt=txt.gsub(/[;, ]+\s*$/,'')
      txt=special_character_escape(txt)
      ["#{name}, ","'#{txt}', "]
    else ['','']
    end
  end
  self
end
creator_prepared_by() click to toggle source
# File lib/sisu/db_columns.rb, line 490
def creator_prepared_by
  def name
    'creator_prepared_by'
  end
  def create_column
    "#{name}                VARCHAR(#{Db[:col_name]}) NULL,"
  end
  def column_comment
    %{COMMENT ON COLUMN metadata_and_text.#{name}
     IS 'metadata document prepared by name(s)';}
  end
  def tuple
    if defined? @md.creator.prepared_by_detail \
    and @md.creator.prepared_by_detail.is_a?(Array) \
    and @md.creator.prepared_by_detail.length > 0
      txt=''
      @md.creator.prepared_by_detail.each do |h|
        txt=txt + %{#{h[:the]}, #{h[:others]}; }
      end
      txt=txt.gsub(/[;, ]+\s*$/,'')
      txt=special_character_escape(txt)
      ["#{name}, ","'#{txt}', "]
    else ['','']
    end
  end
  self
end
creator_translator() click to toggle source
# File lib/sisu/db_columns.rb, line 463
def creator_translator
  def name
    'creator_translator'
  end
  def create_column
    "#{name}                VARCHAR(#{Db[:col_name]}) NULL,"
  end
  def column_comment
    %{COMMENT ON COLUMN metadata_and_text.#{name}
     IS 'metadata document translator name(s)';}
  end
  def tuple
    if defined? @md.creator.translator_detail \
    and @md.creator.translator_detail.is_a?(Array) \
    and @md.creator.translator_detail.length > 0
      txt=''
      @md.creator.translator_detail.each do |h|
        txt=txt + %{#{h[:the]}, #{h[:others]}; }
      end
      txt=txt.gsub(/[;, ]+\s*$/,'')
      txt=special_character_escape(txt)
      ["#{name}, ","'#{txt}', "]
    else ['','']
    end
  end
  self
end
creator_video() click to toggle source
# File lib/sisu/db_columns.rb, line 571
def creator_video
  def name
    'creator_video'
  end
  def create_column
    "#{name}                VARCHAR(#{Db[:col_name]}) NULL,"
  end
  def column_comment
    %{COMMENT ON COLUMN metadata_and_text.#{name}
     IS 'metadata document video by name(s)';}
  end
  def tuple
    if defined? @md.creator.video_detail \
    and @md.creator.video_detail.is_a?(Array) \
    and @md.creator.video_detail.length > 0
      txt=''
      @md.creator.video_detail.each do |h|
        txt=txt + %{#{h[:the]}, #{h[:others]}; }
      end
      txt=txt.gsub(/[;, ]+\s*$/,'')
      txt=special_character_escape(txt)
      ["#{name}, ","'#{txt}', "]
    else ['','']
    end
  end
  self
end
date_added_to_site() click to toggle source

% date @date:

:added_to_site: 
:available: 
:created: 
:issued: 
:modified: 
:published: 
:valid: 
:translated: 
:original_publication:
# File lib/sisu/db_columns.rb, line 711
def date_added_to_site
  def name
    'date_added_to_site'
  end
  def create_column
    "#{name}                VARCHAR(#{Db[:col_date_text]}) NULL,"
    #"#{name}                DATE,"
  end
  def column_comment
    %{COMMENT ON COLUMN metadata_and_text.#{name}
     IS 'metadata date added to site';}
  end
  def tuple
    if defined? @md.date.added_to_site \
    and @md.date.added_to_site=~/\S+/
      txt=@md.date.added_to_site
      txt=special_character_escape(txt)
      ["#{name}, ","'#{txt}', "]
    else ['','']
    end
  end
  self
end
date_available() click to toggle source
# File lib/sisu/db_columns.rb, line 734
def date_available
  def name
    'date_available'
  end
  def create_column
    "#{name}                VARCHAR(#{Db[:col_date_text]}) NULL,"
  end
  def column_comment
    %{COMMENT ON COLUMN metadata_and_text.#{name}
     IS 'metadata date added to site [DC]';}
  end
  def tuple
    if defined? @md.date.available \
    and @md.date.available=~/\S+/
      txt=@md.date.available
      txt=special_character_escape(txt)
      ["#{name}, ","'#{txt}', "]
    else ['','']
    end
  end
  self
end
date_created() click to toggle source
# File lib/sisu/db_columns.rb, line 756
def date_created
  def name
    'date_created'
  end
  def create_column
    "#{name}                VARCHAR(#{Db[:col_date_text]}) NULL,"
  end
  def column_comment
    %{COMMENT ON COLUMN metadata_and_text.#{name}
     IS 'metadata date created [DC]';}
  end
  def tuple
    if defined? @md.date.created \
    and @md.date.created=~/\S+/
      txt=@md.date.created
      txt=special_character_escape(txt)
      ["#{name}, ","'#{txt}', "]
    else ['','']
    end
  end
  self
end
date_generated() click to toggle source
# File lib/sisu/db_columns.rb, line 910
def date_generated
  def name
    'date_generated'
  end
  def create_column              #choose other representation of time
    "#{name}                VARCHAR(30) NULL,"
    #"#{name}                VARCHAR(10) NULL,"
  end
  def column_comment
    %{COMMENT ON COLUMN metadata_and_text.#{name}
     IS 'metadata date of sisu generation of document, automatically populated';}
  end
  def tuple                      #choose other representation of time
    if defined? @md.generated \
    and @md.generated.to_s=~/\S+/
      txt=@md.generated.to_s
      txt=special_character_escape(txt)
      ["#{name}, ","'#{txt}', "]
    else ['','']
    end
  end
  self
end
date_issued() click to toggle source
# File lib/sisu/db_columns.rb, line 778
def date_issued
  def name
    'date_issued'
  end
  def create_column
    "#{name}                VARCHAR(#{Db[:col_date_text]}) NULL,"
  end
  def column_comment
    %{COMMENT ON COLUMN metadata_and_text.#{name}
     IS 'metadata date issued [DC]';}
  end
  def tuple
    if defined? @md.date.issued \
    and @md.date.issued=~/\S+/
      txt=@md.date.issued
      txt=special_character_escape(txt)
      ["#{name}, ","'#{txt}', "]
    else ['','']
    end
  end
  self
end
date_modified() click to toggle source
# File lib/sisu/db_columns.rb, line 800
def date_modified
  def name
    'date_modified'
  end
  def create_column
    "#{name}                VARCHAR(#{Db[:col_date_text]}) NULL,"
  end
  def column_comment
    %{COMMENT ON COLUMN metadata_and_text.#{name}
     IS 'metadata date modified [DC]';}
  end
  def tuple
    if defined? @md.date.modified \
    and @md.date.modified=~/\S+/
      txt=@md.date.modified
      txt=special_character_escape(txt)
      ["#{name}, ","'#{txt}', "]
    else ['','']
    end
  end
  self
end
date_original_publication() click to toggle source
# File lib/sisu/db_columns.rb, line 888
def date_original_publication
  def name
    'date_original_publication'
  end
  def create_column
    "#{name}                VARCHAR(#{Db[:col_date_text]}) NULL,"
  end
  def column_comment
    %{COMMENT ON COLUMN metadata_and_text.#{name}
     IS 'metadata date of original publication';}
  end
  def tuple
    if defined? @md.date.original_publication \
    and @md.date.original_publication=~/\S+/
      txt=@md.date.original_publication
      txt=special_character_escape(txt)
      ["#{name}, ","'#{txt}', "]
    else ['','']
    end
  end
  self
end
date_published() click to toggle source
# File lib/sisu/db_columns.rb, line 822
def date_published
  def name
    'date_published'
  end
  def create_column
    "#{name}                VARCHAR(#{Db[:col_date_text]}) NULL,"
  end
  def column_comment
    %{COMMENT ON COLUMN metadata_and_text.#{name}
     IS 'metadata date published [DC7]';}
  end
  def tuple
    if defined? @md.date.published \
    and @md.date.published=~/\S+/
      txt=@md.date.published
      txt=special_character_escape(txt)
      ["#{name}, ","'#{txt}', "]
    else ['','']
    end
  end
  self
end
date_translated() click to toggle source
# File lib/sisu/db_columns.rb, line 866
def date_translated
  def name
    'date_translated'
  end
  def create_column
    "#{name}                VARCHAR(#{Db[:col_date_text]}) NULL,"
  end
  def column_comment
    %{COMMENT ON COLUMN metadata_and_text.#{name}
     IS 'metadata date translated';}
  end
  def tuple
    if defined? @md.date.translated \
    and @md.date.translated=~/\S+/
      txt=@md.date.translated
      txt=special_character_escape(txt)
      ["#{name}, ","'#{txt}', "]
    else ['','']
    end
  end
  self
end
date_valid() click to toggle source
# File lib/sisu/db_columns.rb, line 844
def date_valid
  def name
    'date_valid'
  end
  def create_column
    "#{name}                VARCHAR(#{Db[:col_date_text]}) NULL,"
  end
  def column_comment
    %{COMMENT ON COLUMN metadata_and_text.#{name}
     IS 'metadata date valid [DC]';}
  end
  def tuple
    if defined? @md.date.valid \
    and @md.date.valid=~/\S+/
      txt=@md.date.valid
      txt=special_character_escape(txt)
      ["#{name}, ","'#{txt}', "]
    else ['','']
    end
  end
  self
end
fulltext() click to toggle source

% misc @links:

# File lib/sisu/db_columns.rb, line 1925
def fulltext
  def name
    'fulltext'
  end
  def create_column
    "#{name}                TEXT NULL,"
  end
  def column_comment
    %{COMMENT ON COLUMN metadata_and_text.#{name}
      IS 'document full text clean, searchable';}
  end
  def tuple
    if ((@md.opt.act[:psql_import][:set]==:on \
    || @md.opt.act[:psql_update][:set]==:on) \
    or (@md.opt.act[:sqlite_import][:set]==:on \
    || @md.opt.act[:sqlite_update][:set]==:on)) \
    and  FileTest.exist?(@md.fns)
      ["#{name}, ","'#{@fulltext}', "]
    else ['','']
    end
  end
  self
end
identifier_isbn() click to toggle source
# File lib/sisu/db_columns.rb, line 1385
def identifier_isbn
  def name
    'identifier_isbn'
  end
  def create_column
    "#{name}                VARCHAR(#{Db[:col_small]}) NULL,"
  end
  def column_comment
    %{COMMENT ON COLUMN metadata_and_text.#{name}
     IS 'metadata identifier document isbn (if any)';}
  end
  def tuple
    if defined? @md.identifier.isbn \
    and @md.identifier.isbn=~/\S+/
      txt=@md.identifier.isbn
      txt=special_character_escape(txt)
      ["#{name}, ","'#{txt}', "]
    else ['','']
    end
  end
  self
end
identifier_oclc() click to toggle source

% identifier @identifier:

:oclc: 
:isbn:
# File lib/sisu/db_columns.rb, line 1363
def identifier_oclc
  def name
    'identifier_oclc'
  end
  def create_column
    "#{name}                VARCHAR(#{Db[:col_library]}) NULL,"
  end
  def column_comment
    %{COMMENT ON COLUMN metadata_and_text.#{name}
     IS 'metadata identifier document Online Computer Library Center number';}
  end
  def tuple
    if defined? @md.identifier.oclc \
    and @md.identifier.oclc=~/\S+/
      txt=@md.identifier.oclc
      txt=special_character_escape(txt)
      ["#{name}, ","'#{txt}', "]
    else ['','']
    end
  end
  self
end
language_document() click to toggle source

% language taken from other fields @title:

:language:

@original:

:language:

not available –> #@language: # :document: # :original:

# File lib/sisu/db_columns.rb, line 610
def language_document
  def name
    'language_document'
  end
  def create_column
    "#{name}                VARCHAR(#{Db[:col_language]}) NULL,"
  end
  def column_comment
    %{COMMENT ON COLUMN metadata_and_text.#{name}
     IS 'metadata document language';}
  end
  def tuple
    if @lang.list[@md.opt.lng][:n]
      txt=@lang.list[@md.opt.lng][:n]
      txt=special_character_escape(txt)
      ["#{name}, ","'#{txt}', "]
    else ['','']
    end
  end
  self
end
language_document_char() click to toggle source
# File lib/sisu/db_columns.rb, line 631
def language_document_char
  def name
    'language_document_char'
  end
  def create_column
    "#{name}                VARCHAR(#{Db[:col_language_char]}) NOT NULL,"
  end
  def column_comment
    %{COMMENT ON COLUMN metadata_and_text.#{name}
     IS 'metadata document language';}
  end
  def tuple
    #modify check, is now required, SiSUv3d_
    if defined? @md.opt.lng \
    and @md.opt.lng=~/\S+/
      txt=@md.opt.lng
      txt=special_character_escape(txt)
      ["#{name}, ","'#{txt}', "]
    else ['','']
    end
  end
  self
end
language_original() click to toggle source
# File lib/sisu/db_columns.rb, line 654
def language_original
  def name
    'language_original'
  end
  def create_column
    "#{name}                VARCHAR(#{Db[:col_language]}) NULL,"
  end
  def column_comment
    %{COMMENT ON COLUMN metadata_and_text.#{name}
     IS 'metadata original document/text language';}
  end
  def tuple
    if defined? @md.language.original \
    and @md.language.original=~/\S+/
      txt=@md.language.original
      txt=special_character_escape(txt)
      ["#{name}, ","'#{txt}', "]
    else ['','']
    end
  end
  self
end
language_original_char() click to toggle source
# File lib/sisu/db_columns.rb, line 676
def language_original_char
  def name
    'language_original_char'
  end
  def create_column
    "#{name}                VARCHAR(#{Db[:col_language_char]}) NULL,"
  end
  def column_comment
    %{COMMENT ON COLUMN metadata_and_text.#{name}
     IS 'metadata document language';}
  end
  def tuple
    if defined? @md.language.original_char \
    and @md.language.original_char=~/\S+/
      txt=@md.language.original_char
      txt=special_character_escape(txt)
      ["#{name}, ","'#{txt}', "]
    else ['','']
    end
  end
  self
end
name() click to toggle source
# File lib/sisu/db_columns.rb, line 96
def name
  'title'
end
notes_abstract() click to toggle source

% notes @notes:

:abstract: 
:description: 
:comment: 
:coverage: 
:relation: 
:format: 
:history: 
:prefix: 
:prefix_a: 
:prefix_b: 
:suffix:
# File lib/sisu/db_columns.rb, line 1542
def notes_abstract
  def name
    'notes_abstract'
  end
  def create_column
    "#{name}                     TEXT NULL,"
  end
  def column_comment
    %{COMMENT ON COLUMN metadata_and_text.#{name}
     IS 'metadata document notes abstract';}
  end
  def tuple
    if defined? @md.notes.abstract \
    and @md.notes.abstract=~/\S+/
      txt=@md.notes.abstract
      txt=special_character_escape(txt)
      ["#{name}, ","'#{txt}', "]
    else ['','']
    end
  end
  self
end
notes_comment() click to toggle source
# File lib/sisu/db_columns.rb, line 1586
def notes_comment
  def name
    'notes_comment'
  end
  def create_column
    "#{name}                       TEXT NULL,"
  end
  def column_comment
    %{COMMENT ON COLUMN metadata_and_text.#{name}
     IS 'metadata document notes comment';}
  end
  def tuple
    if defined? @md.notes.comment \
    and @md.notes.comment=~/\S+/
      txt=@md.notes.comment
      txt=special_character_escape(txt)
      ["#{name}, ","'#{txt}', "]
    else ['','']
    end
  end
  self
end
notes_coverage() click to toggle source
# File lib/sisu/db_columns.rb, line 1608
def notes_coverage
  def name
    'notes_coverage'
  end
  def create_column
    "#{name}                VARCHAR(#{Db[:col_txt_short]}) NULL,"
  end
  def column_comment
    %{COMMENT ON COLUMN metadata_and_text.#{name}
     IS 'metadata classify document coverage [DC14]';}
  end
  def tuple
    if defined? @md.classify.coverage \
    and @md.classify.coverage=~/\S+/
      txt=@md.classify.coverage
      txt=special_character_escape(txt)
      ["#{name}, ","'#{txt}', "]
    else ['','']
    end
  end
  self
end
notes_description() click to toggle source
# File lib/sisu/db_columns.rb, line 1564
def notes_description
  def name
    'notes_description'
  end
  def create_column
    "#{name}                    TEXT NULL,"
  end
  def column_comment
    %{COMMENT ON COLUMN metadata_and_text.#{name}
     IS 'metadata document notes description [DC4]';}
  end
  def tuple
    if defined? @md.notes.description \
    and @md.notes.description=~/\S+/
      txt=@md.notes.description
      txt=special_character_escape(txt)
      ["#{name}, ","'#{txt}', "]
    else ['','']
    end
  end
  self
end
notes_format() click to toggle source
# File lib/sisu/db_columns.rb, line 1696
def notes_format
  def name
    'notes_format'
  end
  def create_column
    "#{name}                VARCHAR(#{Db[:col_txt_long]}) NULL,"
  end
  def column_comment
    %{COMMENT ON COLUMN metadata_and_text.#{name}
     IS 'metadata classify document format [DC9]';}
  end
  def tuple
    if defined? @md.classify.format \
    and @md.classify.format=~/\S+/
      txt=@md.classify.format
      txt=special_character_escape(txt)
      ["#{name}, ","'#{txt}', "]
    else ['','']
    end
  end
  self
end
notes_history() click to toggle source
# File lib/sisu/db_columns.rb, line 1652
def notes_history   #check, consider removal
  def name
    'notes_history'
  end
  def create_column
    "#{name}                VARCHAR(#{Db[:col_txt_long]}) NULL,"
  end
  def column_comment
    %{COMMENT ON COLUMN metadata_and_text.#{name}
     IS 'metadata document notes history';}
  end
  def tuple
    if defined? @md.notes.history \
    and @md.notes.history=~/\S+/
      txt=@md.notes.history
      txt=special_character_escape(txt)
      ["#{name}, ","'#{txt}', "]
    else ['','']
    end
  end
  self
end
notes_prefix() click to toggle source
# File lib/sisu/db_columns.rb, line 1718
def notes_prefix
  def name
    'notes_prefix'
  end
  def create_column
    "#{name}                TEXT NULL,"
  end
  def column_comment
    %{COMMENT ON COLUMN metadata_and_text.#{name}
     IS 'metadata document notes prefix';}
  end
  def tuple
    if defined? @md.notes.prefix \
    and @md.notes.prefix=~/\S+/
      txt=@md.notes.prefix
      txt=special_character_escape(txt)
      ["#{name}, ","'#{txt}', "]
    else ['','']
    end
  end
  self
end
notes_prefix_a() click to toggle source
# File lib/sisu/db_columns.rb, line 1740
def notes_prefix_a
  def name
    'notes_prefix_a'
  end
  def create_column
    "#{name}                TEXT NULL,"
  end
  def column_comment
    %{COMMENT ON COLUMN metadata_and_text.#{name}
     IS 'metadata document notes prefix_a';}
  end
  def tuple
    if defined? @md.notes.prefix_a \
    and @md.notes.prefix_a=~/\S+/
      txt=@md.notes.prefix_a
      txt=special_character_escape(txt)
      ["#{name}, ","'#{txt}', "]
    else ['','']
    end
  end
  self
end
notes_prefix_b() click to toggle source
# File lib/sisu/db_columns.rb, line 1762
def notes_prefix_b
  def name
    'notes_prefix_b'
  end
  def create_column
    "#{name}                TEXT NULL,"
  end
  def column_comment
    %{COMMENT ON COLUMN metadata_and_text.#{name}
     IS 'metadata document notes prefix_b';}
  end
  def tuple
    if defined? @md.notes.prefix_b \
    and @md.notes.prefix_b=~/\S+/
      txt=@md.notes.prefix_b
      txt=special_character_escape(txt)
      ["#{name}, ","'#{txt}', "]
    else ['','']
    end
  end
  self
end
notes_relation() click to toggle source
# File lib/sisu/db_columns.rb, line 1630
def notes_relation
  def name
    'notes_relation'
  end
  def create_column
    "#{name}                VARCHAR(#{Db[:col_txt_short]}) NULL,"
  end
  def column_comment
    %{COMMENT ON COLUMN metadata_and_text.#{name}
     IS 'metadata classify document relation [DC13]';}
  end
  def tuple
    if defined? @md.classify.relation \
    and @md.classify.relation=~/\S+/
      txt=@md.classify.relation
      txt=special_character_escape(txt)
      ["#{name}, ","'#{txt}', "]
    else ['','']
    end
  end
  self
end
notes_suffix() click to toggle source
# File lib/sisu/db_columns.rb, line 1784
def notes_suffix
  def name
    'notes_suffix'
  end
  def create_column                # keep text
    "#{name}                TEXT NULL,"
  end
  def column_comment
    %{COMMENT ON COLUMN metadata_and_text.#{name}
     IS 'metadata document notes suffix';}
  end
  def tuple
    if defined? @md.notes.suffix \
    and @md.notes.suffix=~/\S+/
      txt=@md.notes.suffix
      txt=special_character_escape(txt)
      ["#{name}, ","'#{txt}', "]
    else ['','']
    end
  end
  self
end
notes_type() click to toggle source
# File lib/sisu/db_columns.rb, line 1674
def notes_type #check
  def name
    'notes_type'
  end
  def create_column
    "#{name}                VARCHAR(#{Db[:col_txt_long]}) NULL,"
  end
  def column_comment
    %{COMMENT ON COLUMN metadata_and_text.#{name}
     IS 'metadata notes document type [DC8]';}
  end
  def tuple
    if defined? @md.notes.type \
    and @md.notes.type=~/\S+/
      txt=@md.notes.type
      txt=special_character_escape(txt)
      ["#{name}, ","'#{txt}', "]
    else ['','']
    end
  end
  self
end
original_institution() click to toggle source
# File lib/sisu/db_columns.rb, line 1078
def original_institution
  def name
    'original_institution'
  end
  def create_column
    "#{name}                VARCHAR(#{Db[:col_name]}) NULL,"
  end
  def column_comment
    %{COMMENT ON COLUMN metadata_and_text.#{name}
     IS 'metadata document original institution';}
  end
  def tuple
    if defined? @md.original.institution \
    and @md.original.institution=~/\S+/
      txt=@md.original.institution
      txt=special_character_escape(txt)
      ["#{name}, ","'#{txt}', "]
    else ['','']
    end
  end
  self
end
original_language() click to toggle source
# File lib/sisu/db_columns.rb, line 1012
def original_language
  def name
    'original_language'
  end
  def create_column
    "#{name}                VARCHAR(#{Db[:col_language]}) NULL,"
  end
  def column_comment
    %{COMMENT ON COLUMN metadata_and_text.#{name}
     IS 'metadata document original language';}
  end
  def tuple
    if defined? @md.original.language \
    and @md.original.language=~/\S+/
      txt=@md.original.language
      txt=special_character_escape(txt)
      ["#{name}, ","'#{txt}', "]
    else ['','']
    end
  end
  self
end
original_language_char() click to toggle source
# File lib/sisu/db_columns.rb, line 1034
def original_language_char         # consider
  def name
    'original_language_char'
  end
  def create_column
    "#{name}                VARCHAR(#{Db[:col_language_char]}) NULL,"
  end
  def column_comment
    %{COMMENT ON COLUMN metadata_and_text.#{name}
     IS 'metadata document original language iso character';}
  end
  def tuple
    if defined? @md.original.language_char \
    and @md.original.language_char=~/\S+/
      txt=@md.original.language_char
      txt=special_character_escape(txt)
      ["#{name}, ","'#{txt}', "]
    else ['','']
    end
  end
  self
end
original_nationality() click to toggle source
# File lib/sisu/db_columns.rb, line 1100
def original_nationality
  def name
    'original_nationality'
  end
  def create_column
    "#{name}                VARCHAR(#{Db[:col_language]}) NULL,"
  end
  def column_comment
    %{COMMENT ON COLUMN metadata_and_text.#{name}
     IS 'metadata document original nationality';}
  end
  def tuple
    if defined? @md.original.nationality \
    and @md.original.nationality=~/\S+/
      txt=@md.original.nationality
      txt=special_character_escape(txt)
      ["#{name}, ","'#{txt}', "]
    else ['','']
    end
  end
  self
end
original_publisher() click to toggle source

##% current # def current_publisher # def name # 'current_publisher' # end # def size # 10 # end # def create_column # “#{name} VARCHAR(#{current_publisher.size}) NULL,” # end # def tuple # t=if defined? @md.current.publisher \ # and @md.current.publisher=~/S+/ # txt=@md.current.publisher # txt=special_character_escape(txt) # “'#{txt}', ” # end # end # self # end % original @original:

:publisher: 
#:date: #repeated under date
:language: 
:institution: 
:nationality: 
:source:
# File lib/sisu/db_columns.rb, line 990
def original_publisher
  def name
    'original_publisher'
  end
  def create_column
    "#{name}                VARCHAR(#{Db[:col_name]}) NULL,"
  end
  def column_comment
    %{COMMENT ON COLUMN metadata_and_text.#{name}
     IS 'metadata document original publisher [DC5]';}
  end
  def tuple
    if defined? @md.original.publisher \
    and @md.original.publisher=~/\S+/
      txt=@md.original.publisher
      txt=special_character_escape(txt)
      ["#{name}, ","'#{txt}', "]
    else ['','']
    end
  end
  self
end
original_source() click to toggle source
# File lib/sisu/db_columns.rb, line 1056
def original_source
  def name
    'original_source'
  end
  def create_column
    "#{name}                VARCHAR(#{Db[:col_name]}) NULL,"
  end
  def column_comment
    %{COMMENT ON COLUMN metadata_and_text.#{name}
     IS 'metadata document original source [DC11]';}
  end
  def tuple
    if defined? @md.original.source \
    and @md.original.source=~/\S+/
      txt=@md.original.source
      txt=special_character_escape(txt)
      ["#{name}, ","'#{txt}', "]
    else ['','']
    end
  end
  self
end
publisher() click to toggle source

% publisher @publisher:

# File lib/sisu/db_columns.rb, line 937
def publisher
  def name
    'publisher'
  end
  def create_column
    "#{name}                VARCHAR(#{Db[:col_name]}) NULL,"
  end
  def column_comment
    %{COMMENT ON COLUMN metadata_and_text.#{name}
     IS 'metadata document publisher [DC5]';}
  end
  def tuple
    if defined? @md.publisher \
    and @md.publisher=~/\S+/
      txt=@md.publisher
      txt=special_character_escape(txt)
      ["#{name}, ","'#{txt}', "]
    else ['','']
    end
  end
  self
end
rights_all() click to toggle source

% rights @rights:

#:copyright: #mapped to :text: used where no other copyrights and included in :all:
:text: 
:translation: 
:illustrations: 
:photographs: 
:preparation: 
:digitization: 
:audio: 
:video: 
:license: 
:all:
# File lib/sisu/db_columns.rb, line 1137
def rights_all
  def name
    'rights'
  end
  def create_column
    "#{name}                VARCHAR(#{Db[:col_info_note]}) NULL,"
  end
  def column_comment
    %{COMMENT ON COLUMN metadata_and_text.#{name}
     IS 'metadata rights associated with document (composite) [DC15]';}
  end
  def tuple
    if defined? @md.rights.all \
    and @md.rights.all=~/\S+/
      txt=@md.rights.all
      txt=special_character_escape(txt)
      ["#{name}, ","'#{txt}', "]
    else ['','']
    end
  end
  self
end
rights_license() click to toggle source
# File lib/sisu/db_columns.rb, line 1335
def rights_license
  def name
    'rights_license'
  end
  def create_column
    "#{name}                VARCHAR(#{Db[:col_info_note]}) NULL,"
  end
  def column_comment
    %{COMMENT ON COLUMN metadata_and_text.#{name}
     IS 'metadata license granted for use of document if any)';}
  end
  def tuple
    if defined? @md.rights.license \
    and @md.rights.license=~/\S+/
      txt=@md.rights.license
      txt=special_character_escape(txt)
      ["#{name}, ","'#{txt}', "]
    else ['','']
    end
  end
  self
end
src_filename() click to toggle source

% src

# File lib/sisu/db_columns.rb, line 1809
def src_filename
  def name
    'src_filename'
  end
  def create_column
    "#{name}                VARCHAR(#{Db[:col_filename]}) NOT NULL,"
  end
  def column_comment
    %{COMMENT ON COLUMN metadata_and_text.#{name}
     IS 'sisu markup source text filename';}
  end
  def tuple
    if defined? @md.fns \
    and @md.fns=~/\S+/
      txt=@md.fns
      txt=special_character_escape(txt)
      ["#{name}, ","'#{txt}', "]
    else ['','']
    end
  end
  self
end
src_filesize() click to toggle source
# File lib/sisu/db_columns.rb, line 1854
def src_filesize
  def name
    'src_filesize'
  end
  def create_column
    "#{name}                VARCHAR(#{Db[:col_filesize]}) NULL,"
  end
  def column_comment
    %{COMMENT ON COLUMN metadata_and_text.#{name}
      IS 'sisu markup source text file size';}
  end
  def tuple
   if defined? @md.filesize \
   and @md.filesize=~/\S+/
     txt=@md.filesize
     txt=special_character_escape(txt)
     ["#{name}, ","'#{txt}', "]
   else ['','']
   end
  end
  self
end
src_fingerprint() click to toggle source
# File lib/sisu/db_columns.rb, line 1831
def src_fingerprint
  def name
    'src_fingerprint' #hash/digest, sha512, sha256 or md5
  end
  def create_column
    "#{name}                VARCHAR(#{Db[:col_digest]}) NULL,"
    #"#{name}                TEXT NULL,"
  end
  def column_comment
    %{COMMENT ON COLUMN metadata_and_text.#{name}
      IS 'sisu markup source text fingerprint, hash digest sha512, sha256 or md5';}
  end
  def tuple
    if defined? @md.dgst \
    and @md.dgst.is_a?(Array) \
    and @md.dgst[1]=~/\S+/
      txt=@md.dgst[1]
      ["#{name}, ","'#{txt}', "]
    else ['','']
    end
  end
  self
end
src_txt() click to toggle source
# File lib/sisu/db_columns.rb, line 1898
def src_txt                      # consider naming sisusrc
  def name
    'src_text'
  end
  def create_column
    "#{name}                TEXT NULL,"
  end
  def column_comment
    %{COMMENT ON COLUMN metadata_and_text.#{name}
     IS 'sisu markup source text (if shared)';}
  end
  def tuple
    if ((@md.opt.act[:psql_import][:set]==:on \
    || @md.opt.act[:psql_update][:set]==:on) \
    or (@md.opt.act[:sqlite_import][:set]==:on \
    || @md.opt.act[:sqlite_update][:set]==:on)) \
    and FileTest.exist?(@md.fns)
      ["#{name}, ","'#{@sisutxt}', "]
    else ['','']
    end
  end
  self
end
src_word_count() click to toggle source
# File lib/sisu/db_columns.rb, line 1876
def src_word_count
  def name
    'src_word_count'
  end
  def create_column
    "#{name}                TEXT NULL,"
  end
  def column_comment
    %{COMMENT ON COLUMN metadata_and_text.#{name}
      IS 'sisu markup source text word count';}
  end
  def tuple
    if defined? @md.wc_words \
    and @md.wc_words=~/\S+/
      txt=@md.wc_words
      txt=special_character_escape(txt)
      ["#{name}, ","'#{txt}', "]
    else ['','']
    end
  end
  self
end
title() click to toggle source
# File lib/sisu/db_columns.rb, line 95
def title                          # DublinCore 1 - title
  def name
    'title'
  end
  def create_column
    "#{name}                VARCHAR(#{Db[:col_title]}) NOT NULL,"
  end
  def column_comment
    %{COMMENT ON COLUMN metadata_and_text.#{name}
      IS 'metadata full document title [DC1]';}
  end
  def tuple
    if defined? @md.title.full \
    and @md.title.full=~/\S+/
      txt=@md.title.full
      txt=special_character_escape(txt)
      ["#{name}, ","'#{txt}', "]
    else ['','']
    end
  end
  self
end
title_edition() click to toggle source
# File lib/sisu/db_columns.rb, line 183
def title_edition
  def name
    'title_edition'
  end
  def create_column
    "#{name}                VARCHAR(#{Db[:col_title_edition]}) NULL,"
  end
  def column_comment
    %{COMMENT ON COLUMN metadata_and_text.#{name}
      IS 'metadata document edition (version)';}
  end
  def tuple
    if defined? @md.title.edition \
    and @md.title.edition=~/\S+/
      txt=@md.title.edition
      txt=special_character_escape(txt)
      ["#{name}, ","'#{txt}', "]
    else ['','']
    end
  end
  self
end
title_language() click to toggle source
# File lib/sisu/db_columns.rb, line 227
def title_language
  def name
    'title_language'
  end
  def create_column
    "#{name}                VARCHAR(#{Db[:col_language]}) NULL,"
  end
  def column_comment
    %{COMMENT ON COLUMN metadata_and_text.#{name}
      IS 'metadata document language [DC12]';}
  end
  def tuple
    if @lang.list[@md.opt.lng][:n]
      txt=@lang.list[@md.opt.lng][:n]
      txt=special_character_escape(txt)
      ["#{name}, ","'#{txt}', "]
    else ['','']
    end
  end
  self
end
title_language_char() click to toggle source
# File lib/sisu/db_columns.rb, line 248
def title_language_char            # consider
  def name
    'title_language_char'
  end
  def create_column
    "#{name}                VARCHAR(#{Db[:col_language_char]}) NULL,"
  end
  def column_comment
    %{COMMENT ON COLUMN metadata_and_text.#{name}
      IS 'metadata document language iso code';}
  end
  def tuple
    if defined? @md.opt.lng \
    and @md.opt.lng=~/\S+/
      txt=@md.opt.lng
      txt=special_character_escape(txt)
      ["#{name}, ","'#{txt}', "]
    else ['','']
    end
  end
  self
end
title_main() click to toggle source
# File lib/sisu/db_columns.rb, line 117
def title_main
  def name
    'title_main'
  end
  def create_column
    "#{name}                VARCHAR(#{Db[:col_title_part]}) NOT NULL,"
  end
  def column_comment
    %{COMMENT ON COLUMN metadata_and_text.#{name}
      IS 'metadata main document title';}
  end
  def tuple
    if defined? @md.title.main \
    and @md.title.main=~/\S+/
      txt=@md.title.main
      txt=special_character_escape(txt)
      ["#{name}, ","'#{txt}', "]
    else ['','']
    end
  end
  self
end
title_note() click to toggle source
# File lib/sisu/db_columns.rb, line 205
def title_note
  def name
    'title_note'
  end
  def create_column
    "#{name}                VARCHAR(#{Db[:col_info_note]}) NULL,"
  end
  def column_comment
    %{COMMENT ON COLUMN metadata_and_text.#{name}
      IS 'metadata document notes associated with title';}
  end
  def tuple
    if defined? @md.title.note \
    and @md.title.note=~/\S+/
      txt=@md.title.note
      txt=special_character_escape(txt)
      ["#{name}, ","'#{txt}', "]
    else ['','']
    end
  end
  self
end
title_short() click to toggle source
# File lib/sisu/db_columns.rb, line 161
def title_short
  def name
    'title_short'
  end
  def create_column
    "#{name}                VARCHAR(#{Db[:col_title_part]}) NULL,"
  end
  def column_comment
    %{COMMENT ON COLUMN metadata_and_text.#{name}
      IS 'metadata document short title if any';}
  end
  def tuple
    if defined? @md.title.short \
    and @md.title.short=~/\S+/
      txt=@md.title.short
      txt=special_character_escape(txt)
      ["#{name}, ","'#{txt}', "]
    else ['','']
    end
  end
  self
end
title_sub() click to toggle source
# File lib/sisu/db_columns.rb, line 139
def title_sub
  def name
    'title_sub'
  end
  def create_column
    "#{name}                VARCHAR(#{Db[:col_title_part]}) NULL,"
  end
  def column_comment
    %{COMMENT ON COLUMN metadata_and_text.#{name}
      IS 'metadata document subtitle';}
  end
  def tuple
    if defined? @md.title.sub \
    and @md.title.sub=~/\S+/
      txt=@md.title.sub
      txt=special_character_escape(txt)
      ["#{name}, ","'#{txt}', "]
    else ['','']
    end
  end
  self
end
tuple() click to toggle source
# File lib/sisu/db_columns.rb, line 106
def tuple
  if defined? @md.title.full \
  and @md.title.full=~/\S+/
    txt=@md.title.full
    txt=special_character_escape(txt)
    ["#{name}, ","'#{txt}', "]
  else ['','']
  end
end