aboutsummaryrefslogtreecommitdiffhomepage
path: root/lib/sisu/develop/db_columns.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/sisu/develop/db_columns.rb')
-rw-r--r--lib/sisu/develop/db_columns.rb1997
1 files changed, 0 insertions, 1997 deletions
diff --git a/lib/sisu/develop/db_columns.rb b/lib/sisu/develop/db_columns.rb
deleted file mode 100644
index 478a1127..00000000
--- a/lib/sisu/develop/db_columns.rb
+++ /dev/null
@@ -1,1997 +0,0 @@
-# encoding: utf-8
-=begin
-
-* Name: SiSU
-
-** Description: documents, structuring, processing, publishing, search
-*** modules shared by the different db types, dbi, postgresql, sqlite
-
-** Author: Ralph Amissah
- <ralph@amissah.com>
- <ralph.amissah@gmail.com>
-
-** Copyright: (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
- 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015 Ralph Amissah,
- All Rights Reserved.
-
-** License: GPL 3 or later:
-
- SiSU, a framework for document structuring, publishing and search
-
- Copyright (C) Ralph Amissah
-
- This program is free software: you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by the Free
- Software Foundation, either version 3 of the License, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- more details.
-
- You should have received a copy of the GNU General Public License along with
- this program. If not, see <http://www.gnu.org/licenses/>.
-
- If you have Internet connection, the latest version of the GPL should be
- available at these locations:
- <http://www.fsf.org/licensing/licenses/gpl.html>
- <http://www.gnu.org/licenses/gpl.html>
-
- <http://www.sisudoc.org/sisu/en/manifest/gpl.fsf.html>
-
-** SiSU uses:
- * Standard SiSU markup syntax,
- * Standard SiSU meta-markup syntax, and the
- * Standard SiSU object citation numbering and system
-
-** Hompages:
- <http://www.jus.uio.no/sisu>
- <http://www.sisudoc.org>
-
-** Git
- <http://git.sisudoc.org/gitweb/?p=code/sisu.git;a=summary>
- <http://git.sisudoc.org/gitweb/?p=code/sisu.git;a=blob;f=lib/sisu/develop/db_columns.rb;hb=HEAD>
-
-=end
-module SiSU_DbColumns
- require_relative 'se' # se.rb
- require_relative 'db_sqltxt' # db_sqltxt.rb
- class Columns < SiSU_DbText::Prepare
- 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
-#% structures
- #def column_define
- # def varchar(name,size)
- # "#{name} VARCHAR(#{size}) NULL,"
- # end
- #end
-=begin
-#% title
-@title:
- :subtitle:
- :short:
- :edition:
- :language:
- :note:
-=end
- 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
- end
- class ColumnSize
- def document_clean # restriction not necessary
- 60000
- end
- def document_body
- 16000
- end
- def document_seg
- 120
- end
- def document_seg_full
- 120
- end
- def endnote_clean # restriction not necessary
- 60000
- end
- def endnote_body
- 16000
- end
- end
-end
-__END__