aboutsummaryrefslogtreecommitdiffhomepage
path: root/lib/sisu/v4/db_columns.rb
diff options
context:
space:
mode:
authorRalph Amissah <ralph@amissah.com>2012-11-15 08:50:04 -0500
committerRalph Amissah <ralph@amissah.com>2012-11-15 08:50:04 -0500
commitb147bcd379f889e60fda61e48aac915eebc016b7 (patch)
treea90e0a9a1229e6b2d98446abac1c063b3c4ade55 /lib/sisu/v4/db_columns.rb
parentv4: sisupod, use common make instruction header for documents (diff)
v4: document headers, metadata rearranged, wide-ranging effect
Diffstat (limited to 'lib/sisu/v4/db_columns.rb')
-rw-r--r--lib/sisu/v4/db_columns.rb297
1 files changed, 128 insertions, 169 deletions
diff --git a/lib/sisu/v4/db_columns.rb b/lib/sisu/v4/db_columns.rb
index 4e9b9089..9fc24bf8 100644
--- a/lib/sisu/v4/db_columns.rb
+++ b/lib/sisu/v4/db_columns.rb
@@ -1363,20 +1363,64 @@ module SiSU_DbColumns
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
+ t=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
+ t=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:
- :coverage:
- :format:
- :identifier:
- :keywords:
- :relation:
:subject:
+ :keywords:
:type:
:loc:
:dewey:
- :pg:
- :isbn:
=end
def classify_topic_register
def name
@@ -1405,7 +1449,7 @@ module SiSU_DbColumns
'classify_subject'
end
def create_column
- "#{name} VARCHAR(#{Db[:col_classify_txt_short]}) NULL,"
+ "#{name} VARCHAR(#{Db[:col_txt_long]}) NULL,"
end
def column_comment
%{COMMENT ON COLUMN metadata_and_text.#{name}
@@ -1422,34 +1466,12 @@ module SiSU_DbColumns
end
self
end
- def classify_type #check
- def name
- 'classify_type'
- end
- def create_column
- "#{name} VARCHAR(#{Db[:col_classify_txt_short]}) NULL,"
- end
- def column_comment
- %{COMMENT ON COLUMN metadata_and_text.#{name}
- IS 'metadata classify document type [DC8]';}
- end
- def tuple
- t=if defined? @md.classify.type \
- and @md.classify.type=~/\S+/
- txt=@md.classify.type
- 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_classify_library]}) NULL,"
+ "#{name} VARCHAR(#{Db[:col_library]}) NULL,"
end
def column_comment
%{COMMENT ON COLUMN metadata_and_text.#{name}
@@ -1471,7 +1493,7 @@ module SiSU_DbColumns
'classify_dewey'
end
def create_column
- "#{name} VARCHAR(#{Db[:col_classify_library]}) NULL,"
+ "#{name} VARCHAR(#{Db[:col_library]}) NULL,"
end
def column_comment
%{COMMENT ON COLUMN metadata_and_text.#{name}
@@ -1488,65 +1510,21 @@ module SiSU_DbColumns
end
self
end
- def classify_oclc
- def name
- 'classify_oclc'
- end
- def create_column
- "#{name} VARCHAR(#{Db[:col_classify_library]}) NULL,"
- end
- def column_comment
- %{COMMENT ON COLUMN metadata_and_text.#{name}
- IS 'metadata classify document Online Computer Library Center number';}
- end
- def tuple
- t=if defined? @md.classify.oclc \
- and @md.classify.oclc=~/\S+/
- txt=@md.classify.oclc
- txt=special_character_escape(txt)
- ["#{name}, ","'#{txt}', "]
- else ['','']
- end
- end
- self
- end
- def classify_pg
- def name
- 'classify_pg'
- end
- def create_column
- "#{name} VARCHAR(#{Db[:col_classify_small]}) NULL,"
- end
- def column_comment
- %{COMMENT ON COLUMN metadata_and_text.#{name}
- IS 'metadata classify document project gutenberg (if any)';}
- end
- def tuple
- t=if defined? @md.classify.pg \
- and @md.classify.pg=~/\S+/
- txt=@md.classify.pg
- txt=special_character_escape(txt)
- ["#{name}, ","'#{txt}', "]
- else ['','']
- end
- end
- self
- end
- def classify_isbn
+ def classify_keywords
def name
- 'classify_isbn'
+ 'classify_keywords'
end
def create_column
- "#{name} VARCHAR(#{Db[:col_classify_small]}) NULL,"
+ "#{name} VARCHAR(#{Db[:col_txt_long]}) NULL,"
end
def column_comment
%{COMMENT ON COLUMN metadata_and_text.#{name}
- IS 'metadata classify document isbn (if any)';}
+ IS 'metadata classify document keywords';}
end
def tuple
- t=if defined? @md.classify.isbn \
- and @md.classify.isbn=~/\S+/
- txt=@md.classify.isbn
+ t=if defined? @md.classify.keywords \
+ and @md.classify.keywords=~/\S+/
+ txt=@md.classify.keywords
txt=special_character_escape(txt)
["#{name}, ","'#{txt}', "]
else ['','']
@@ -1554,21 +1532,36 @@ module SiSU_DbColumns
end
self
end
- def classify_format
+=begin
+#% notes
+@notes:
+ :abstract:
+ :description:
+ :comment:
+ :coverage:
+ :relation:
+ :format:
+ :history:
+ :prefix:
+ :prefix_a:
+ :prefix_b:
+ :suffix:
+=end
+ def notes_abstract
def name
- 'classify_format'
+ 'notes_abstract'
end
def create_column
- "#{name} VARCHAR(#{Db[:col_classify_txt_short]}) NULL,"
+ "#{name} TEXT NULL,"
end
def column_comment
%{COMMENT ON COLUMN metadata_and_text.#{name}
- IS 'metadata classify document format [DC9]';}
+ IS 'metadata document notes abstract';}
end
def tuple
- t=if defined? @md.classify.format \
- and @md.classify.format=~/\S+/
- txt=@md.classify.format
+ t=if defined? @md.notes.abstract \
+ and @md.notes.abstract=~/\S+/
+ txt=@md.notes.abstract
txt=special_character_escape(txt)
["#{name}, ","'#{txt}', "]
else ['','']
@@ -1576,21 +1569,21 @@ module SiSU_DbColumns
end
self
end
- def classify_identifier
+ def notes_description
def name
- 'classify_identifier'
+ 'notes_description'
end
def create_column
- "#{name} VARCHAR(#{Db[:col_classify_identify]}) NULL,"
+ "#{name} TEXT NULL,"
end
def column_comment
%{COMMENT ON COLUMN metadata_and_text.#{name}
- IS 'metadata classify document identifier [DC10]';}
+ IS 'metadata document notes description [DC4]';}
end
def tuple
- t=if defined? @md.classify.identifier \
- and @md.classify.identifier=~/\S+/
- txt=@md.classify.identifier
+ t=if defined? @md.notes.description \
+ and @md.notes.description=~/\S+/
+ txt=@md.notes.description
txt=special_character_escape(txt)
["#{name}, ","'#{txt}', "]
else ['','']
@@ -1598,21 +1591,21 @@ module SiSU_DbColumns
end
self
end
- def classify_relation
+ def notes_comment
def name
- 'classify_relation'
+ 'notes_comment'
end
def create_column
- "#{name} VARCHAR(#{Db[:col_classify_short]}) NULL,"
+ "#{name} TEXT NULL,"
end
def column_comment
%{COMMENT ON COLUMN metadata_and_text.#{name}
- IS 'metadata classify document relation [DC13]';}
+ IS 'metadata document notes comment';}
end
def tuple
- t=if defined? @md.classify.relation \
- and @md.classify.relation=~/\S+/
- txt=@md.classify.relation
+ t=if defined? @md.notes.comment \
+ and @md.notes.comment=~/\S+/
+ txt=@md.notes.comment
txt=special_character_escape(txt)
["#{name}, ","'#{txt}', "]
else ['','']
@@ -1620,12 +1613,12 @@ module SiSU_DbColumns
end
self
end
- def classify_coverage
+ def notes_coverage
def name
- 'classify_coverage'
+ 'notes_coverage'
end
def create_column
- "#{name} VARCHAR(#{Db[:col_classify_short]}) NULL,"
+ "#{name} VARCHAR(#{Db[:col_txt_short]}) NULL,"
end
def column_comment
%{COMMENT ON COLUMN metadata_and_text.#{name}
@@ -1642,55 +1635,21 @@ module SiSU_DbColumns
end
self
end
- def classify_keywords
- def name
- 'classify_keywords'
- end
- def create_column
- "#{name} VARCHAR(#{Db[:col_classify_txt_short]}) NULL,"
- end
- def column_comment
- %{COMMENT ON COLUMN metadata_and_text.#{name}
- IS 'metadata classify document keywords';}
- end
- def tuple
- t=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:
- :comment:
- :description:
- :history:
- :prefix:
- :prefix_a:
- :prefix_b:
- :suffix:
-=end
- def notes_abstract
+ def notes_relation
def name
- 'notes_abstract'
+ 'notes_relation'
end
def create_column
- "#{name} TEXT NULL,"
+ "#{name} VARCHAR(#{Db[:col_txt_short]}) NULL,"
end
def column_comment
%{COMMENT ON COLUMN metadata_and_text.#{name}
- IS 'metadata document notes abstract';}
+ IS 'metadata classify document relation [DC13]';}
end
def tuple
- t=if defined? @md.notes.abstract \
- and @md.notes.abstract=~/\S+/
- txt=@md.notes.abstract
+ t=if defined? @md.classify.relation \
+ and @md.classify.relation=~/\S+/
+ txt=@md.classify.relation
txt=special_character_escape(txt)
["#{name}, ","'#{txt}', "]
else ['','']
@@ -1698,21 +1657,21 @@ module SiSU_DbColumns
end
self
end
- def notes_comment
+ def notes_history #check, consider removal
def name
- 'notes_comment'
+ 'notes_history'
end
def create_column
- "#{name} TEXT NULL,"
+ "#{name} VARCHAR(#{Db[:col_txt_long]}) NULL,"
end
def column_comment
%{COMMENT ON COLUMN metadata_and_text.#{name}
- IS 'metadata document notes comment';}
+ IS 'metadata document notes history';}
end
def tuple
- t=if defined? @md.notes.comment \
- and @md.notes.comment=~/\S+/
- txt=@md.notes.comment
+ t=if defined? @md.notes.history \
+ and @md.notes.history=~/\S+/
+ txt=@md.notes.history
txt=special_character_escape(txt)
["#{name}, ","'#{txt}', "]
else ['','']
@@ -1720,21 +1679,21 @@ module SiSU_DbColumns
end
self
end
- def notes_description
+ def notes_type #check
def name
- 'notes_description'
+ 'notes_type'
end
def create_column
- "#{name} TEXT NULL,"
+ "#{name} VARCHAR(#{Db[:col_txt_long]}) NULL,"
end
def column_comment
%{COMMENT ON COLUMN metadata_and_text.#{name}
- IS 'metadata document notes description [DC4]';}
+ IS 'metadata notes document type [DC8]';}
end
def tuple
- t=if defined? @md.notes.description \
- and @md.notes.description=~/\S+/
- txt=@md.notes.description
+ t=if defined? @md.notes.type \
+ and @md.notes.type=~/\S+/
+ txt=@md.notes.type
txt=special_character_escape(txt)
["#{name}, ","'#{txt}', "]
else ['','']
@@ -1742,21 +1701,21 @@ module SiSU_DbColumns
end
self
end
- def notes_history #check, consider removal
+ def notes_format
def name
- 'notes_history'
+ 'notes_format'
end
def create_column
- "#{name} VARCHAR(#{Db[:col_classify_txt_short]}) NULL,"
+ "#{name} VARCHAR(#{Db[:col_txt_long]}) NULL,"
end
def column_comment
%{COMMENT ON COLUMN metadata_and_text.#{name}
- IS 'metadata document notes history';}
+ IS 'metadata classify document format [DC9]';}
end
def tuple
- t=if defined? @md.notes.history \
- and @md.notes.history=~/\S+/
- txt=@md.notes.history
+ t=if defined? @md.classify.format \
+ and @md.classify.format=~/\S+/
+ txt=@md.classify.format
txt=special_character_escape(txt)
["#{name}, ","'#{txt}', "]
else ['','']