From b147bcd379f889e60fda61e48aac915eebc016b7 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Thu, 15 Nov 2012 08:50:04 -0500 Subject: v4: document headers, metadata rearranged, wide-ranging effect --- lib/sisu/v4/cgi_sql_common.rb | 21 +-- lib/sisu/v4/constants.rb | 11 +- lib/sisu/v4/db_columns.rb | 297 +++++++++++++++-------------------- lib/sisu/v4/db_create.rb | 32 ++-- lib/sisu/v4/db_load_tuple.rb | 30 ++-- lib/sisu/v4/manifest.rb | 329 ++++++++++++++++++++------------------- lib/sisu/v4/param.rb | 109 ++++++++----- lib/sisu/v4/po4a.rb | 27 ++-- lib/sisu/v4/qrcode.rb | 112 ++++++------- lib/sisu/v4/shared_metadata.rb | 113 +++++++------- lib/sisu/v4/shared_xml.rb | 88 +++++------ lib/sisu/v4/texinfo_format.rb | 46 +++--- lib/sisu/v4/xml_format.rb | 44 +++--- lib/sisu/v4/xml_md_oai_pmh_dc.rb | 83 +++++----- 14 files changed, 665 insertions(+), 677 deletions(-) (limited to 'lib') diff --git a/lib/sisu/v4/cgi_sql_common.rb b/lib/sisu/v4/cgi_sql_common.rb index 18e1ab1e..eb766a4c 100644 --- a/lib/sisu/v4/cgi_sql_common.rb +++ b/lib/sisu/v4/cgi_sql_common.rb @@ -345,11 +345,6 @@ module SiSU_CGI_SQL search[:text] << st[:search] search[:endnotes] << st[:search] end - st=DBI_SearchString.new('metadata_and_text.classify_keywords',search_for.keywords,q['key'],cse).string - if st[:flag] - search[:text] << st[:search] - search[:endnotes] << st[:search] - end st=DBI_SearchString.new('metadata_and_text.title',search_for.title,q['ti'],cse).string if st[:flag] search[:text] << st[:search] @@ -370,6 +365,11 @@ module SiSU_CGI_SQL search[:text] << st[:search] search[:endnotes] << st[:search] end + st=DBI_SearchString.new('metadata_and_text.classify_keywords',search_for.keywords,q['key'],cse).string + if st[:flag] + search[:text] << st[:search] + search[:endnotes] << st[:search] + end st=DBI_SearchString.new('metadata_and_text.notes_description',search_for.description,q['dsc'],cse).string if st[:flag] search[:text] << st[:search] @@ -395,12 +395,7 @@ module SiSU_CGI_SQL search[:text] << st[:search] search[:endnotes] << st[:search] end - st=DBI_SearchString.new('metadata_and_text.classify_type',search_for.type,q['ty'],cse).string - if st[:flag] - search[:text] << st[:search] - search[:endnotes] << st[:search] - end - st=DBI_SearchString.new('metadata_and_text.classify_identifier',search_for.identifier,q['id'],cse).string + st=DBI_SearchString.new('metadata_and_text.notes_type',search_for.type,q['ty'],cse).string if st[:flag] search[:text] << st[:search] search[:endnotes] << st[:search] @@ -415,12 +410,12 @@ module SiSU_CGI_SQL search[:text] << st[:search] search[:endnotes] << st[:search] end - st=DBI_SearchString.new('metadata_and_text.classify_relation',search_for.relation,q['rel'],cse).string + st=DBI_SearchString.new('metadata_and_text.notes_relation',search_for.relation,q['rel'],cse).string if st[:flag] search[:text] << st[:search] search[:endnotes] << st[:search] end - st=DBI_SearchString.new('metadata_and_text.classify_coverage',search_for.coverage,q['cov'],cse).string + st=DBI_SearchString.new('metadata_and_text.notes_coverage',search_for.coverage,q['cov'],cse).string if st[:flag] search[:text] << st[:search] search[:endnotes] << st[:search] diff --git a/lib/sisu/v4/constants.rb b/lib/sisu/v4/constants.rb index 24ec53a0..af5c13a4 100644 --- a/lib/sisu/v4/constants.rb +++ b/lib/sisu/v4/constants.rb @@ -213,12 +213,11 @@ Db={ col_language: 100, col_language_char: 6, col_date_text: 10, - col_classify_txt_long: 600, - col_classify_txt_short: 600, - col_classify_short: 200, - col_classify_identify: 256, - col_classify_library: 30, - col_classify_small: 16, + col_txt_long: 600, + col_txt_short: 200, + col_identify_hash: 256, + col_library: 30, + col_small: 16, col_filename: 256, col_digest: 64, col_filesize: 10, 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 ['',''] diff --git a/lib/sisu/v4/db_create.rb b/lib/sisu/v4/db_create.rb index 64bf5763..784f37b1 100644 --- a/lib/sisu/v4/db_create.rb +++ b/lib/sisu/v4/db_create.rb @@ -163,22 +163,22 @@ module SiSU_DbCreate /* classify */ #{column.classify_topic_register.create_column} #{column.classify_subject.create_column} - #{column.classify_type.create_column} #{column.classify_loc.create_column} #{column.classify_dewey.create_column} - #{column.classify_oclc.create_column} - #{column.classify_pg.create_column} - #{column.classify_isbn.create_column} - #{column.classify_format.create_column} - #{column.classify_identifier.create_column} - #{column.classify_relation.create_column} - #{column.classify_coverage.create_column} #{column.classify_keywords.create_column} + /* identifier */ + #{column.identifier_oclc.create_column} + #{column.identifier_isbn.create_column} /* notes */ #{column.notes_abstract.create_column} - #{column.notes_comment.create_column} #{column.notes_description.create_column} + #{column.notes_comment.create_column} #{column.notes_history.create_column} + #{column.notes_coverage.create_column} + #{column.notes_relation.create_column} + /* column.notes_source.create_column */ + #{column.notes_type.create_column} + #{column.notes_format.create_column} #{column.notes_prefix.create_column} #{column.notes_prefix_a.create_column} #{column.notes_prefix_b.create_column} @@ -421,21 +421,19 @@ module SiSU_DbCreate %{#{column.rights_license.column_comment}}, %{#{column.classify_topic_register.column_comment}}, %{#{column.classify_subject.column_comment}}, - %{#{column.classify_type.column_comment}}, %{#{column.classify_loc.column_comment}}, %{#{column.classify_dewey.column_comment}}, - %{#{column.classify_oclc.column_comment}}, - %{#{column.classify_pg.column_comment}}, - %{#{column.classify_isbn.column_comment}}, - %{#{column.classify_format.column_comment}}, - %{#{column.classify_identifier.column_comment}}, - %{#{column.classify_relation.column_comment}}, - %{#{column.classify_coverage.column_comment}}, %{#{column.classify_keywords.column_comment}}, + %{#{column.identifier_oclc.column_comment}}, + %{#{column.identifier_isbn.column_comment}}, %{#{column.notes_abstract.column_comment}}, %{#{column.notes_comment.column_comment}}, %{#{column.notes_description.column_comment}}, %{#{column.notes_history.column_comment}}, + %{#{column.notes_coverage.column_comment}}, + %{#{column.notes_relation.column_comment}}, + %{#{column.notes_type.column_comment}}, + %{#{column.notes_format.column_comment}}, %{#{column.notes_prefix.column_comment}}, %{#{column.notes_prefix_a.column_comment}}, %{#{column.notes_prefix_b.column_comment}}, diff --git a/lib/sisu/v4/db_load_tuple.rb b/lib/sisu/v4/db_load_tuple.rb index 78fa987a..3df7ca3e 100644 --- a/lib/sisu/v4/db_load_tuple.rb +++ b/lib/sisu/v4/db_load_tuple.rb @@ -173,21 +173,19 @@ module SiSU_DbTuple #{@tp.column.rights_license.tuple[0]} #{@tp.column.classify_topic_register.tuple[0]} #{@tp.column.classify_subject.tuple[0]} -#{@tp.column.classify_type.tuple[0]} #{@tp.column.classify_loc.tuple[0]} #{@tp.column.classify_dewey.tuple[0]} -#{@tp.column.classify_oclc.tuple[0]} -#{@tp.column.classify_pg.tuple[0]} -#{@tp.column.classify_isbn.tuple[0]} -#{@tp.column.classify_format.tuple[0]} -#{@tp.column.classify_identifier.tuple[0]} -#{@tp.column.classify_relation.tuple[0]} -#{@tp.column.classify_coverage.tuple[0]} #{@tp.column.classify_keywords.tuple[0]} +#{@tp.column.identifier_oclc.tuple[0]} +#{@tp.column.identifier_isbn.tuple[0]} #{@tp.column.notes_abstract.tuple[0]} -#{@tp.column.notes_comment.tuple[0]} #{@tp.column.notes_description.tuple[0]} +#{@tp.column.notes_comment.tuple[0]} #{@tp.column.notes_history.tuple[0]} +#{@tp.column.notes_format.tuple[0]} +#{@tp.column.notes_relation.tuple[0]} +#{@tp.column.notes_coverage.tuple[0]} +#{@tp.column.notes_type.tuple[0]} #{@tp.column.notes_prefix.tuple[0]} #{@tp.column.notes_prefix_a.tuple[0]} #{@tp.column.notes_prefix_b.tuple[0]} @@ -255,21 +253,19 @@ tid) #{@tp.column.rights_license.tuple[1]} #{@tp.column.classify_topic_register.tuple[1]} #{@tp.column.classify_subject.tuple[1]} -#{@tp.column.classify_type.tuple[1]} #{@tp.column.classify_loc.tuple[1]} #{@tp.column.classify_dewey.tuple[1]} -#{@tp.column.classify_oclc.tuple[1]} -#{@tp.column.classify_pg.tuple[1]} -#{@tp.column.classify_isbn.tuple[1]} -#{@tp.column.classify_format.tuple[1]} -#{@tp.column.classify_identifier.tuple[1]} -#{@tp.column.classify_relation.tuple[1]} -#{@tp.column.classify_coverage.tuple[1]} #{@tp.column.classify_keywords.tuple[1]} +#{@tp.column.identifier_oclc.tuple[1]} +#{@tp.column.identifier_isbn.tuple[1]} #{@tp.column.notes_abstract.tuple[1]} #{@tp.column.notes_comment.tuple[1]} #{@tp.column.notes_description.tuple[1]} #{@tp.column.notes_history.tuple[1]} +#{@tp.column.notes_format.tuple[1]} +#{@tp.column.notes_relation.tuple[1]} +#{@tp.column.notes_coverage.tuple[1]} +#{@tp.column.notes_type.tuple[1]} #{@tp.column.notes_prefix.tuple[1]} #{@tp.column.notes_prefix_a.tuple[1]} #{@tp.column.notes_prefix_b.tuple[1]} diff --git a/lib/sisu/v4/manifest.rb b/lib/sisu/v4/manifest.rb index 6f751a24..9c4fceb9 100644 --- a/lib/sisu/v4/manifest.rb +++ b/lib/sisu/v4/manifest.rb @@ -507,77 +507,58 @@ WOK end end def metadata_tests - if defined? @md.title.full \ - and @md.title.full=~/\S+/ - id,info=@translate.full_title,@md.title.full - metadata(id,info) - end - if defined? @md.creator.author \ - and @md.creator.author=~/\S+/ - id,info=@translate.author,@md.creator.author - metadata(id,info) - end - if defined? @md.creator.editor \ - and @md.creator.editor=~/\S+/ - id,info=@translate.editor,@md.creator.editor - metadata(id,info) - end - if defined? @md.creator.contributor \ - and @md.creator.contributor=~/\S+/ - id,info=@translate.contributor,@md.creator.contributor - metadata(id,info) - end - if defined? @md.creator.translator \ - and @md.creator.translator=~/\S+/ - id,info=@translate.translator,@md.creator.translator - metadata(id,info) - end - if defined? @md.creator.illustrator \ - and @md.creator.illustrator=~/\S+/ - id,info=@translate.illustrator,@md.creator.illustrator - metadata(id,info) - end - if defined? @md.publisher \ - and @md.publisher=~/\S+/ #dc - id,info=@translate.publisher,@md.publisher - metadata(id,info) - end - if defined? @md.creator.prepared_by \ - and @md.creator.prepared_by=~/\S+/ - id,info=@translate.prepared_by,@md.creator.prepared_by - metadata(id,info) - end - if defined? @md.creator.digitized_by \ - and @md.creator.digitized_by=~/\S+/ - id,info=@translate.digitized_by,@md.creator.digitized_by - metadata(id,info) - end - if defined? @md.classify.subject \ - and @md.classify.subject=~/\S+/ - id,info=@translate.subject,@md.classify.subject - metadata(id,info) - end - if defined? @md.notes.description \ - and @md.notes.description=~/\S+/ - id,info=@translate.description,@md.notes.description - metadata(id,info) - end - if defined? @md.notes.abstract \ - and @md.notes.abstract=~/\S+/ - id,info=@translate.abstract,@md.notes.abstract - metadata(id,info) + if defined? @md.title #% + if defined? @md.title.full \ + and @md.title.full=~/\S+/ + id,info=@translate.full_title,@md.title.full + metadata(id,info) + end end - if defined? @md.type \ - and @md.type=~/\S+/ #dc - id,info=@translate.type,@md.type - metadata(id,info) + if defined? @md.creator #% + if defined? @md.creator.author \ + and @md.creator.author=~/\S+/ + id,info=@translate.author,@md.creator.author + metadata(id,info) + end + if defined? @md.creator.editor \ + and @md.creator.editor=~/\S+/ + id,info=@translate.editor,@md.creator.editor + metadata(id,info) + end + if defined? @md.creator.contributor \ + and @md.creator.contributor=~/\S+/ + id,info=@translate.contributor,@md.creator.contributor + metadata(id,info) + end + if defined? @md.creator.translator \ + and @md.creator.translator=~/\S+/ + id,info=@translate.translator,@md.creator.translator + metadata(id,info) + end + if defined? @md.creator.illustrator \ + and @md.creator.illustrator=~/\S+/ + id,info=@translate.illustrator,@md.creator.illustrator + metadata(id,info) + end + if defined? @md.creator.prepared_by \ + and @md.creator.prepared_by=~/\S+/ + id,info=@translate.prepared_by,@md.creator.prepared_by + metadata(id,info) + end + if defined? @md.creator.digitized_by \ + and @md.creator.digitized_by=~/\S+/ + id,info=@translate.digitized_by,@md.creator.digitized_by + metadata(id,info) + end end - if defined? @md.rights.all \ - and @md.rights.all=~/\S+/ #dc - id,info=@translate.rights,@md.rights.all - metadata(id,info) + if defined? @md.rights + if defined? @md.rights.all \ + and @md.rights.all=~/\S+/ #dc + id,info=@translate.rights,@md.rights.all + metadata(id,info) + end end - if defined? @md.date.published + if defined? @md.date #% if defined? @md.date.published \ and @md.date.published=~/\S+/ #dc id,info=@translate.date,@md.date.published @@ -609,108 +590,136 @@ WOK metadata(id,info) end end - if defined? @md.title.language \ - and @md.title.language=~/\S+/ - id,info=@translate.language,@md.title.language - metadata(id,info) - end - if defined? @md.original.language \ - and @md.original.language=~/\S+/ - id,info=@translate.language_original,@md.original.language - metadata(id,info) - end - if defined? @md.classify.format \ - and @md.classify.format=~/\S+/ - id,info=@transate.format,@md.classify.format - metadata(id,info) - end - if defined? @md.classify.identifier \ - and @md.classify.identifier=~/\S+/ - id,info=@translate.identifier,@md.classify.identifier - metadata(id,info) - end - if defined? @md.original.source \ - and @md.original.source=~/\S+/ - id,info=@translate.source,@md.original.source - metadata(id,info) - end - if defined? @md.classify.relation \ - and @md.classify.relation=~/\S+/ - id,info=@translate.relation,@md.classify.relation - metadata(id,info) - end - if defined? @md.classify.coverage \ - and @md.classify.coverage=~/\S+/ - id,info=@translate.coverage,@md.classify.coverage - metadata(id,info) - end - if defined? @md.classify.keywords \ - and @md.classify.keywords=~/\S+/ - id,info=@translate.keywords,@md.classify.keywords - metadata(id,info) - end - if defined? @md.notes.comment \ - and @md.notes.comment=~/\S+/ - id,info=@translate.comments,@md.notes.comment - metadata(id,info) - end - if defined? @md.classify.loc \ - and @md.classify.loc=~/\S+/ - id,info=@translate.cls_loc,@md.classify.loc - metadata(id,info) - end - if defined? @md.classify.dewey \ - and @md.classify.dewey=~/\S+/ - id,info=@translate.cls_dewey,@md.classify.dewey - metadata(id,info) - end - if defined? @md.classify.oclc \ - and @md.classify.oclc=~/\S+/ - id,info=@translate.cls_oclc,@md.classify.oclc - @manifest[:html] << %{

#{id}:

\n} - @manifest[:html] << %{

#{info}

\n} - @manifest[:html] << %{\n} - end - if defined? @md.classify.pg \ - and @md.classify.pg=~/\S+/ - id,info=@translate.cls_gutenberg,@md.classify.pg - metadata(id,info) - end - if defined? @md.classify.isbn \ - and @md.classify.isbn=~/\S+/ - id,info=@translate.cls_isbn,@md.classify.isbn + if defined? @md.publisher \ + and @md.publisher=~/\S+/ #dc + id,info=@translate.publisher,@md.publisher metadata(id,info) end - if defined? @md.notes.prefix_a \ - and @md.notes.prefix_a=~/\S+/ - id,info=@translate.prefix_a,@md.notes.prefix_a - metadata(id,info) + if defined? @md.notes #% + if defined? @md.notes.description \ + and @md.notes.description=~/\S+/ + id,info=@translate.description,@md.notes.description + metadata(id,info) + end + if defined? @md.notes.abstract \ + and @md.notes.abstract=~/\S+/ + id,info=@translate.abstract,@md.notes.abstract + metadata(id,info) + end + if defined? @md.notes.comment \ + and @md.notes.comment=~/\S+/ + id,info=@translate.comments,@md.notes.comment + metadata(id,info) + end + if defined? @md.notes.prefix_a \ + and @md.notes.prefix_a=~/\S+/ + id,info=@translate.prefix_a,@md.notes.prefix_a + metadata(id,info) + end + if defined? @md.notes.prefix_b \ + and @md.notes.prefix_b=~/\S+/ + id,info=@translate.prefix_b,@md.notes.prefix_b + metadata(id,info) + end end - if defined? @md.notes.prefix_b \ - and @md.notes.prefix_b=~/\S+/ - id,info=@translate.prefix_b,@md.notes.prefix_b - metadata(id,info) + if defined? @md.title #% + if defined? @md.title.language \ + and @md.title.language=~/\S+/ + id,info=@translate.language,@md.title.language + metadata(id,info) + end + if defined? @md.original.language \ + and @md.original.language=~/\S+/ + id,info=@translate.language_original,@md.original.language + metadata(id,info) + end end - if defined? @md.topic_register_array \ - and @md.topic_register_array.length > 0 - @manifest[:html] << %{

#{@translate.topic_register}:

\n} - @md.topic_register_array.each do |t| - t.each_with_index do |st,i| - if st.is_a?(Array) - st.each do |v| - if v.is_a?(Array) - v.each do |w,i| - @manifest[:html] << %{

#{w}

\n} + if defined? @md.classify #% + if defined? @md.topic_register_array \ + and @md.topic_register_array.length > 0 + @manifest[:html] << %{

#{@translate.topic_register}:

\n} + @md.topic_register_array.each do |t| + t.each_with_index do |st,i| + if st.is_a?(Array) + st.each do |v| + if v.is_a?(Array) + v.each do |w,i| + @manifest[:html] << %{

#{w}

\n} + end + else + @manifest[:html] << %{

#{v}

\n} end - else - @manifest[:html] << %{

#{v}

\n} end + else @manifest[:html] << %{

#{st}

\n} end - else @manifest[:html] << %{

#{st}

\n} end end + @manifest[:html] << %{\n} + end + if defined? @md.classify.subject \ + and @md.classify.subject=~/\S+/ + id,info=@translate.subject,@md.classify.subject + metadata(id,info) + end + if defined? @md.classify.keywords \ + and @md.classify.keywords=~/\S+/ + id,info=@translate.keywords,@md.classify.keywords + metadata(id,info) + end + if defined? @md.classify.loc \ + and @md.classify.loc=~/\S+/ + id,info=@translate.cls_loc,@md.classify.loc + metadata(id,info) + end + if defined? @md.classify.dewey \ + and @md.classify.dewey=~/\S+/ + id,info=@translate.cls_dewey,@md.classify.dewey + metadata(id,info) + end + if defined? @md.notes.coverage \ + and @md.notes.coverage=~/\S+/ + id,info=@translate.coverage,@md.notes.coverage + metadata(id,info) + end + if defined? @md.notes.relation \ + and @md.notes.relation=~/\S+/ + id,info=@translate.relation,@md.notes.relation + metadata(id,info) end - @manifest[:html] << %{\n} + if defined? @md.notes.type \ + and @md.notes.type=~/\S+/ #dc + id,info=@translate.type,@md.notes.type + metadata(id,info) + end + if defined? @md.notes.format \ + and @md.notes.format=~/\S+/ + id,info=@transate.format,@md.notes.format + metadata(id,info) + end + end + if defined? @md.identifier #% + if defined? @md.identifier.oclc \ + and @md.identifier.oclc=~/\S+/ + id,info=@translate.cls_oclc,@md.identifier.oclc + @manifest[:html] << %{

#{id}:

\n} + @manifest[:html] << %{

#{info}

\n} + @manifest[:html] << %{\n} + end + if defined? @md.identifier.pg \ + and @md.identifier.pg=~/\S+/ + id,info=@translate.cls_gutenberg,@md.identifier.pg + metadata(id,info) + end + if defined? @md.identifier.isbn \ + and @md.identifier.isbn=~/\S+/ + id,info=@translate.cls_isbn,@md.identifier.isbn + metadata(id,info) + end + end + if defined? @md.original.source \ + and @md.original.source=~/\S+/ + id,info=@translate.source,@md.original.source + metadata(id,info) end if @md.fns id,info=@translate.sourcefile,@md.fns diff --git a/lib/sisu/v4/param.rb b/lib/sisu/v4/param.rb index e3742967..40f9b983 100644 --- a/lib/sisu/v4/param.rb +++ b/lib/sisu/v4/param.rb @@ -607,62 +607,52 @@ module SiSU_Param end self end - def classify - a=@s.split(/(\n%\s.+?$|[ ]*)(?:\n[ ]*(?=:)|\Z)/m) + def identifier + a=@s.split(/\n%\s.+?$|[ ]*\n[ ]*/m) @h=build_hash(a) - def coverage - s=@h['coverage'] - l,n=Db[:col_classify_short],'classify.coverage' + def oclc + s=@h['oclc'] + l,n=Db[:col_library],'identifier.oclc' validate_length(s,l,n) end - def relation - s=@h['relation'] - l,n=Db[:col_classify_short],'classify.short' + def isbn + s=@h['isbn'] + l,n=Db[:col_small],'identifier.isbn' validate_length(s,l,n) end - def subject - s=@h['subject'] - l,n=Db[:col_classify_txt_short],'classify.subject' + def pg + s=@h['pg'] + l,n=Db[:col_small],'identifier.pg' validate_length(s,l,n) end + self + end + def classify + a=@s.split(/(\n%\s.+?$|[ ]*)(?:\n[ ]*(?=:)|\Z)/m) + @h=build_hash(a) def topic_register s=@h['topic_register'] l,n=Db[:col_info_note],'classify.topic_register' validate_length(s,l,n) end - def type - s=@h['type'] - l,n=Db[:col_classify_txt_short],'classify.type' + def subject + s=@h['subject'] + l,n=Db[:col_txt_long],'classify.subject' validate_length(s,l,n) end - def identifier - s=@h['identifier'] - l,n=Db[:col_classify_identify],'classify.identifier' + def keywords + s=@h['keywords'] + l,n=Db[:col_txt_long],'classify.keywords' validate_length(s,l,n) end def loc s=@h['loc'] - l,n=Db[:col_classify_library],'classify.loc' + l,n=Db[:col_library],'classify.loc' validate_length(s,l,n) end def dewey s=@h['dewey'] - l,n=Db[:col_classify_library],'classify.dewey' - validate_length(s,l,n) - end - def oclc - s=@h['oclc'] - l,n=Db[:col_classify_library],'classify.oclc' - validate_length(s,l,n) - end - def pg - s=@h['pg'] - l,n=Db[:col_classify_small],'classify.pg' - validate_length(s,l,n) - end - def isbn - s=@h['isbn'] - l,n=Db[:col_classify_small],'classify.isbn' + l,n=Db[:col_library],'classify.dewey' validate_length(s,l,n) end self @@ -780,17 +770,50 @@ module SiSU_Param def notes a=@s.split(/\n%\s.+?$|[ ]*\n[ ]*/m) @h=build_hash(a) + def description + s=@h['description'] + l,n=Db[:col_info_note],'notes.description' + validate_length(s,l,n) + end def abstract - @h['abstract'] + s=@h['abstract'] + l,n=Db[:col_info_note],'notes.abstract' + validate_length(s,l,n) end def comment - @h['comment'] + s=@h['comment'] + l,n=Db[:col_info_note],'notes.comment' + validate_length(s,l,n) end - def description - @h['description'] + def coverage + s=@h['coverage'] + l,n=Db[:col_info_note],'notes.coverage' + validate_length(s,l,n) + end + def relation + s=@h['relation'] + l,n=Db[:col_info_note],'notes.relation' + validate_length(s,l,n) + end + def source + s=@h['source'] + l,n=Db[:col_txt_long],'notes.source' + validate_length(s,l,n) end def history - @h['history'] + s=@h['history'] + l,n=Db[:col_txt_long],'notes.history' + validate_length(s,l,n) + end + def type + s=@h['type'] + l,n=Db[:col_txt_long],'notes.relation' + validate_length(s,l,n) + end + def format + s=@h['format'] + l,n=Db[:col_txt_short],'notes.format' + validate_length(s,l,n) end def prefix @h['prefix'] @@ -1005,6 +1028,8 @@ module SiSU_Param @rights=SiSU_Param::Parameters::Md.new($1.strip,@opt,@env).rights when /^@classify:(.+)/m; classify=$1 #% * header metadata - classify @classify=SiSU_Param::Parameters::Md.new($1.strip,@opt,@env).classify + when /^@identifier:(.+)/m; identify=$1 #% * header metadata - identifier + @identifier=SiSU_Param::Parameters::Md.new($1.strip,@opt,@env).identifier when /^@original:(.+)/m #% * header metadata - original (document) @original=SiSU_Param::Parameters::Md.new($1.strip,@opt,@env).original @source=@original.source @@ -1321,7 +1346,11 @@ module SiSU_Param # end if @flv @lang=@lang.uniq @fn=SiSU_Env::EnvCall.new(@fns).lang(fn_set_lang[:c]) - @identifier="#{@env.url.root}/#{@fnb}/#{@fn[:toc]}" #DC note constructed dc identifier + #if @identifier.is_a?(Array) + # @identifier[:sisupod]=sisupod_hash_value + #else @identifier={ sisupod: sisupod_hash_value } + #end + #"#{@env.url.root}/#{@fnb}/#{@fn[:toc]}" #DC note constructed dc identifier if @en[:note] > 0 \ and @en[:sum] > 0 if @en[:sum] > 0 diff --git a/lib/sisu/v4/po4a.rb b/lib/sisu/v4/po4a.rb index 0cda6475..8404ae39 100644 --- a/lib/sisu/v4/po4a.rb +++ b/lib/sisu/v4/po4a.rb @@ -289,15 +289,14 @@ GSUB "#: en/#{@md.fns}:#{SiSU_Po4aUtils::PotNumber.new.num}", 'msgid ""', meta_src.metadata_tags.classify.head, - meta_src.metadata_tags.classify.relation, meta_src.metadata_tags.classify.subject, meta_src.metadata_tags.classify.topic_register, - meta_src.metadata_tags.classify.type, - meta_src.metadata_tags.classify.identifier, meta_src.metadata_tags.classify.loc, meta_src.metadata_tags.classify.dewey, - meta_src.metadata_tags.classify.oclc, - meta_src.metadata_tags.classify.isbn, + meta_src.metadata_tags.notes.relation, + meta_src.metadata_tags.notes.type, + meta_src.metadata_tags.identifier.oclc, + meta_src.metadata_tags.identifier.isbn, 'msgstr ""', ] w << [ @@ -418,26 +417,24 @@ GSUB "#: en/#{@md.fns}:#{SiSU_Po4aUtils::PotNumber.new.num}", 'msgid ""', meta_src.metadata_tags.classify.head, - meta_src.metadata_tags.classify.relation, meta_src.metadata_tags.classify.subject, meta_src.metadata_tags.classify.topic_register, - meta_src.metadata_tags.classify.type, - meta_src.metadata_tags.classify.identifier, meta_src.metadata_tags.classify.loc, meta_src.metadata_tags.classify.dewey, - meta_src.metadata_tags.classify.oclc, - meta_src.metadata_tags.classify.isbn, + meta_src.metadata_tags.notes.relation, + meta_src.metadata_tags.notes.type, + meta_src.metadata_tags.identifier.oclc, + meta_src.metadata_tags.identifier.isbn, 'msgstr ""', meta_trn.metadata_tags.classify.head, - meta_trn.metadata_tags.classify.relation, meta_trn.metadata_tags.classify.subject, meta_trn.metadata_tags.classify.topic_register, - meta_trn.metadata_tags.classify.type, - meta_trn.metadata_tags.classify.identifier, meta_trn.metadata_tags.classify.loc, meta_trn.metadata_tags.classify.dewey, - meta_trn.metadata_tags.classify.oclc, - meta_trn.metadata_tags.classify.isbn, + meta_trn.metadata_tags.notes.relation, + meta_trn.metadata_tags.notes.type, + meta_trn.metadata_tags.identifier.oclc, + meta_trn.metadata_tags.identifier.isbn, ] w << [ "#. #{@po4a_identify_type} - metadata: date", diff --git a/lib/sisu/v4/qrcode.rb b/lib/sisu/v4/qrcode.rb index 2db0cf62..13a69ec6 100644 --- a/lib/sisu/v4/qrcode.rb +++ b/lib/sisu/v4/qrcode.rb @@ -524,26 +524,6 @@ WOK id,info=@translate.digitized_by,@md.creator.digitized_by metadata(id,info) end - if defined? @md.classify.subject \ - and @md.classify.subject=~/\S+/ - id,info=@translate.subject,@md.classify.subject - metadata(id,info) - end - if defined? @md.notes.description \ - and @md.notes.description=~/\S+/ - id,info=@translate.description,@md.notes.description - metadata(id,info) - end - if defined? @md.notes.abstract \ - and @md.notes.abstract=~/\S+/ - id,info=@translate.abstract,@md.notes.abstract - metadata(id,info) - end - if defined? @md.type \ - and @md.type=~/\S+/ #dc - id,info=@translate.type,@md.type - metadata(id,info) - end if defined? @md.rights.all \ and @md.rights.all=~/\S+/ #dc id,info=@translate.rights,@md.rights.all @@ -592,34 +572,34 @@ WOK id,info=@translate.language_original,@md.original.language metadata(id,info) end - if defined? @md.classify.format \ - and @md.classify.format=~/\S+/ - id,info=@transate.format,@md.classify.format + if defined? @md.classify.subject \ + and @md.classify.subject=~/\S+/ + id,info=@translate.subject,@md.classify.subject metadata(id,info) end - if defined? @md.classify.identifier \ - and @md.classify.identifier=~/\S+/ - id,info=@translate.identifier,@md.classify.identifier + if defined? @md.classify.keywords \ + and @md.classify.keywords=~/\S+/ + id,info=@translate.keywords,@md.classify.keywords metadata(id,info) end - if defined? @md.original.source \ - and @md.original.source=~/\S+/ - id,info=@translate.source,@md.original.source + if defined? @md.classify.loc \ + and @md.classify.loc=~/\S+/ + id,info=@translate.cls_loc,@md.classify.loc metadata(id,info) end - if defined? @md.classify.relation \ - and @md.classify.relation=~/\S+/ - id,info=@translate.relation,@md.classify.relation + if defined? @md.classify.dewey \ + and @md.classify.dewey=~/\S+/ + id,info=@translate.cls_dewey,@md.classify.dewey metadata(id,info) end - if defined? @md.classify.coverage \ - and @md.classify.coverage=~/\S+/ - id,info=@translate.coverage,@md.classify.coverage + if defined? @md.notes.description \ + and @md.notes.description=~/\S+/ + id,info=@translate.description,@md.notes.description metadata(id,info) end - if defined? @md.classify.keywords \ - and @md.classify.keywords=~/\S+/ - id,info=@translate.keywords,@md.classify.keywords + if defined? @md.notes.abstract \ + and @md.notes.abstract=~/\S+/ + id,info=@translate.abstract,@md.notes.abstract metadata(id,info) end if defined? @md.notes.comment \ @@ -627,30 +607,34 @@ WOK id,info=@translate.comments,@md.notes.comment metadata(id,info) end - if defined? @md.classify.loc \ - and @md.classify.loc=~/\S+/ - id,info=@translate.cls_loc,@md.classify.loc + if defined? @md.notes.coverage \ + and @md.notes.coverage=~/\S+/ + id,info=@translate.coverage,@md.notes.coverage metadata(id,info) end - if defined? @md.classify.dewey \ - and @md.classify.dewey=~/\S+/ - id,info=@translate.cls_dewey,@md.classify.dewey + if defined? @md.notes.relation \ + and @md.notes.relation=~/\S+/ + id,info=@translate.relation,@md.notes.relation metadata(id,info) end - if defined? @md.classify.oclc \ - and @md.classify.oclc=~/\S+/ - id,info=@translate.cls_oclc,@md.classify.oclc - @manifest[:txt] << %{#{id}:\n} - @manifest[:txt] << %{#{info}\n} - end - if defined? @md.classify.pg \ - and @md.classify.pg=~/\S+/ - id,info=@translate.cls_gutenberg,@md.classify.pg + #if defined? @md.notes.source \ + #and @md.notes.source=~/\S+/ + # id,info=@translate.source,@md.notes.source + # metadata(id,info) + #end + #if defined? @md.notes.history \ + #and @md.notes.history=~/\S+/ + # id,info=@translate.history,@md.notes.history + # metadata(id,info) + #end + if defined? @md.notes.type \ + and @md.notes.type=~/\S+/ #dc + id,info=@translate.type,@md.type metadata(id,info) end - if defined? @md.classify.isbn \ - and @md.classify.isbn=~/\S+/ - id,info=@translate.cls_isbn,@md.classify.isbn + if defined? @md.notes.format \ + and @md.notes.format=~/\S+/ + id,info=@transate.format,@md.notes.format metadata(id,info) end if defined? @md.notes.prefix_a \ @@ -663,6 +647,22 @@ WOK id,info=@translate.prefix_b,@md.notes.prefix_b metadata(id,info) end + if defined? @md.original.source \ + and @md.original.source=~/\S+/ + id,info=@translate.source,@md.original.source + metadata(id,info) + end + if defined? @md.identifier.oclc \ + and @md.identifier.oclc=~/\S+/ + id,info=@translate.cls_oclc,@md.identifier.oclc + @manifest[:txt] << %{#{id}:\n} + @manifest[:txt] << %{#{info}\n} + end + if defined? @md.identifier.isbn \ + and @md.identifier.isbn=~/\S+/ + id,info=@translate.cls_isbn,@md.identifier.isbn + metadata(id,info) + end if defined? @md.topic_register_array \ and @md.topic_register_array.length > 0 @manifest[:txt] << %{#{@translate.topic_register}:\n} diff --git a/lib/sisu/v4/shared_metadata.rb b/lib/sisu/v4/shared_metadata.rb index 32555776..74d76c1e 100644 --- a/lib/sisu/v4/shared_metadata.rb +++ b/lib/sisu/v4/shared_metadata.rb @@ -104,6 +104,11 @@ module SiSU_Metadata @tag,@inf,@class=tr.digitized_by,@md.creator.digitized_by,'ext' meta << self.meta_para end + if defined? @md.creator.contributor \ + and @md.creator.contributor=~/\S+/ + @tag,@inf,@class=tr.contributor,@md.creator.contributor,'dc' #6 + meta << self.meta_para + end if defined? @md.rights.all \ and @md.rights.all=~/\S+/ @tag,@inf,@class=tr.rights,@md.rights.all,'dc' #15 @@ -114,24 +119,24 @@ module SiSU_Metadata @tag,@inf,@class=tr.subject,@md.classify.subject,'dc' #3 meta << self.meta_para end - if defined? @md.notes.description \ - and @md.notes.description=~/\S+/ - @tag,@inf,@class=tr.description,@md.notes.description,'dc' #4 + if defined? @md.classify.keywords \ + and @md.classify.keywords=~/\S+/ + @tag,@inf,@class=tr.keywords,@md.classify.keywords,'ext' meta << self.meta_para end - if defined? @md.publisher \ - and @md.publisher=~/\S+/ - @tag,@inf,@class=tr.publisher,@md.publisher,'dc' #5 + if defined? @md.classify.loc \ + and @md.classify.loc=~/\S+/ + @tag,@inf,@class=tr.cls_loc,@md.classify.loc,'id' meta << self.meta_para end - if defined? @md.creator.contributor \ - and @md.creator.contributor=~/\S+/ - @tag,@inf,@class=tr.contributor,@md.creator.contributor,'dc' #6 + if defined? @md.classify.dewey \ + and @md.classify.dewey=~/\S+/ + @tag,@inf,@class=tr.cls_dewey,@md.classify.dewey,'id' meta << self.meta_para end - if defined? @md.notes.abstract \ - and @md.notes.abstract=~/\S+/ - @tag,@inf,@class=tr.abstract,@md.notes.abstract,'ext' + if defined? @md.publisher \ + and @md.publisher=~/\S+/ + @tag,@inf,@class=tr.publisher,@md.publisher,'dc' #5 meta << self.meta_para end if defined? @md.date.created \ @@ -164,29 +169,24 @@ module SiSU_Metadata @tag,@inf,@class=tr.date,@md.date.published,'dc' #7 meta << self.meta_para end - if defined? @md.type \ - and @md.date=~/\S+/ - @tag,@inf,@class=tr.type,@md.type,'dc' #8 - meta << self.meta_para - end - if defined? @md.classify.loc \ - and @md.classify.loc=~/\S+/ - @tag,@inf,@class=tr.cls_loc,@md.classify.loc,'id' + if defined? @md.identifier.isbn \ + and @md.identifier.isbn=~/\S+/ + @tag,@inf,@class=tr.cls_isbn,@md.identifier.isbn,'id' meta << self.meta_para end - if defined? @md.classify.dewey \ - and @md.classify.dewey=~/\S+/ - @tag,@inf,@class=tr.cls_dewey,@md.classify.dewey,'id' + if defined? @md.identifier.oclc \ + and @md.identifier.oclc=~/\S+/ + @tag,@inf,@class=tr.cls_oclc,@md.identifier.oclc,'id' meta << self.meta_para end - if defined? @md.classify.pg \ - and @md.classify.pg=~/\S+/ - @tag,@inf,@class=tr.cls_gutenberg,@md.classify.pg,'id' + if defined? @md.notes.description \ + and @md.notes.description=~/\S+/ + @tag,@inf,@class=tr.description,@md.notes.description,'dc' #4 meta << self.meta_para end - if defined? @md.classify.isbn \ - and @md.classify.isbn=~/\S+/ - @tag,@inf,@class=tr.cls_isbn,@md.classify.isbn,'id' + if defined? @md.notes.abstract \ + and @md.notes.abstract=~/\S+/ + @tag,@inf,@class=tr.abstract,@md.notes.abstract,'ext' meta << self.meta_para end if defined? @md.notes.comment \ @@ -194,6 +194,36 @@ module SiSU_Metadata @tag,@inf,@class=tr.comments,@md.notes.comment,'ext' meta << self.meta_para end + if defined? @md.notes.coverage \ + and @md.notes.coverage=~/\S+/ + @tag,@inf,@class=tr.coverage,@md.notes.coverage,'dc' #14 + meta << self.meta_para + end + if defined? @md.notes.relation \ + and @md.notes.relation=~/\S+/ + @tag,@inf,@class=tr.relation,@md.notes.relation,'dc' #13 + meta << self.meta_para + end + #if defined? @md.notes.source \ + #and @md.notes.source=~/\S+/ + # @tag,@inf,@class=tr.source,@md.notes.source,'dc' #11 + # meta << self.meta_para + #end + if defined? @md.notes.history \ + and @md.notes.history=~/\S+/ + @tag,@inf,@class=tr.type,@md.notes.history,'dc' #8 + meta << self.meta_para + end + if defined? @md.notes.type \ + and @md.notes.type=~/\S+/ + @tag,@inf,@class=tr.type,@md.notes.type,'dc' #8 + meta << self.meta_para + end + if defined? @md.notes.format \ + and @md.notes.format=~/\S+/ + @tag,@inf,@class=tr.format,@md.notes.format,'dc' #9 + meta << self.meta_para + end if defined? @md.notes.prefix_a \ and @md.notes.prefix_a=~/\S+/ @tag,@inf,@class=tr.prefix_a,@md.notes.prefix_a,'inf' @@ -204,11 +234,6 @@ module SiSU_Metadata @tag,@inf,@class=tr.prefix_b,@md.notes.prefix_b,'inf' meta << self.meta_para end - if defined? @md.classify.identifier \ - and @md.classify.identifier=~/\S+/ - @tag,@inf,@class=tr.identifier,@md.classify.identifier,'dc' #10 - meta << self.meta_para - end if defined? @md.original.source \ and @md.original.source=~/\S+/ @tag,@inf,@class=tr.source,@md.original.source,'dc' #11 @@ -224,26 +249,6 @@ module SiSU_Metadata @tag,@inf,@class=tr.language_original,@md.original.language,'ext' meta << self.meta_para end - if defined? @md.classify.format \ - and @md.classify.format=~/\S+/ - @tag,@inf,@class=tr.format,@md.classify.format,'dc' #9 - meta << self.meta_para - end - if defined? @md.classify.relation \ - and @md.classify.relation=~/\S+/ - @tag,@inf,@class=tr.relation,@md.classify.relation,'dc' #13 - meta << self.meta_para - end - if defined? @md.classify.coverage \ - and @md.classify.coverage=~/\S+/ - @tag,@inf,@class=tr.coverage,@md.classify.coverage,'dc' #14 - meta << self.meta_para - end - if defined? @md.classify.keywords \ - and @md.classify.keywords=~/\S+/ - @tag,@inf,@class=tr.keywords,@md.classify.keywords,'ext' - meta << self.meta_para - end if @display_heading @tag,@inf=%{Version Information},'' meta << self.meta_para diff --git a/lib/sisu/v4/shared_xml.rb b/lib/sisu/v4/shared_xml.rb index 2886ae37..ba95c805 100644 --- a/lib/sisu/v4/shared_xml.rb +++ b/lib/sisu/v4/shared_xml.rb @@ -538,18 +538,6 @@ module SiSU_XML_Tags #Format content=meta_content_clean(@md.creator.author) @author=%{ \n} end - if defined? @md.classify.subject \ - and @md.classify.subject=~/\S+/ # DublinCore 3 - subject (us library of congress, eric or udc, or schema???) - @rdf_subject=%{ dc.subject="#{@md.classify.subject}"\n} - content=meta_content_clean(@md.classify.subject) - @subject=%{ \n} - end - if defined? @md.notes.description \ - and @md.notes.description=~/\S+/ # DublinCore 4 - description - @rdf_description=%{ dc.description="#{@md.notes.description}"\n} - content=meta_content_clean(@md.notes.description) - @description=%{ \n} - end if defined? @md.publisher \ and @md.publisher # DublinCore 5 - publisher (current copy published by) @rdf_publisher=%{ dc.publisher="#{@md.publisher}"\n} @@ -592,24 +580,54 @@ module SiSU_XML_Tags #Format @rdf_date_modified=%{ dc.date.modified="#{@md.date.modified}"\n} @date_modified=%{ \n} end - if defined? @md.type \ - and @md.type # DublinCore 8 - type (genre eg. report, convention etc) - @rdf_type=%{ dc.type="#{@md.type}"\n} - content=meta_content_clean(@md.type) + if defined? @md.rights.all \ + and @md.rights.all # DublinCore 15 - rights + @rdf_rights=%{ dc.rights="#{@md.rights.all}"\n} + content=meta_content_clean(@md.rights.all) + @rights=%{ \n} + end + if defined? @md.classify.subject \ + and @md.classify.subject=~/\S+/ # DublinCore 3 - subject (us library of congress, eric or udc, or schema???) + @rdf_subject=%{ dc.subject="#{@md.classify.subject}"\n} + content=meta_content_clean(@md.classify.subject) + @subject=%{ \n} + end + if defined? @md.notes.description \ + and @md.notes.description=~/\S+/ # DublinCore 4 - description + @rdf_description=%{ dc.description="#{@md.notes.description}"\n} + content=meta_content_clean(@md.notes.description) + @description=%{ \n} + end + if defined? @md.notes.coverage \ + and @md.notes.coverage=~/\S+/ # DublinCore 14 - coverage + @rdf_coverage=%{ dc.coverage="#{@md.notes.coverage}"\n} + content=meta_content_clean(@md.notes.coverage) + @coverage=%{ \n} + end + if defined? @md.notes.relation \ + and @md.notes.relation=~/\S+/ # DublinCore 13 - relation + @rdf_relation=%{ dc.relation="#{@md.notes.relation}"\n} + content=meta_content_clean(@md.notes.relation) + @relation=%{ \n} + end + if defined? @md.notes.type \ + and @md.notes.type # DublinCore 8 - type (genre eg. report, convention etc) + @rdf_type=%{ dc.type="#{@md.notes.type}"\n} + content=meta_content_clean(@md.notes.type) @type=%{ \n} end - if defined? @md.classify.format \ - and @md.classify.format=~/\S+/ # DublinCore 9 - format (use your mime type) - @rdf_format=%{ dc.format="#{@md.classify.format}"\n} - content=meta_content_clean(@md.classify.format) + if defined? @md.notes.format \ + and @md.notes.format=~/\S+/ # DublinCore 9 - format (use your mime type) + @rdf_format=%{ dc.format="#{@md.notes.format}"\n} + content=meta_content_clean(@md.notes.format) @format=%{ \n} end - if defined? @md.classify.identifier \ - and @md.classify.identifier=~/\S+/ # DublinCore 10 - identifier (your identifier, could use urn which is free) - @rdf_identifier=%{ dc.identifier="#{@md.classify.identifier}"\n} - content=meta_content_clean(@md.classify.identifier) - @identifier=%{ \n} - end + #if defined? @md.identifier.sisupod \ + #and @md.identifier.sisupod=~/\S+/ # DublinCore 10 - identifier (your identifier, could use urn which is free) + # @rdf_identifier=%{ dc.identifier="#{@md.identifier.sisupod}"\n} + # content=meta_content_clean(@md.identifier.sisupod) + # @identifier=%{ \n} + #end if defined? @md.original.source \ and @md.original.source=~/\S+/ # DublinCore 11 - source (document source) @rdf_source=%{ dc.source="#{@md.original.source}"\n} @@ -626,24 +644,6 @@ module SiSU_XML_Tags #Format @rdf_language_original=%{ dc.language="#{@md.original.language}"\n} @language_original=%{ \n} end - if defined? @md.classify.relation \ - and @md.classify.relation=~/\S+/ # DublinCore 13 - relation - @rdf_relation=%{ dc.relation="#{@md.classify.relation}"\n} - content=meta_content_clean(@md.classify.relation) - @relation=%{ \n} - end - if defined? @md.classify.coverage \ - and @md.classify.coverage=~/\S+/ # DublinCore 14 - coverage - @rdf_coverage=%{ dc.coverage="#{@md.classify.coverage}"\n} - content=meta_content_clean(@md.classify.coverage) - @coverage=%{ \n} - end - if defined? @md.rights.all \ - and @md.rights.all # DublinCore 15 - rights - @rdf_rights=%{ dc.rights="#{@md.rights.all}"\n} - content=meta_content_clean(@md.rights.all) - @rights=%{ \n} - end content=meta_content_clean(@md.keywords) @keywords=%{ \n} if @md.keywords @vz=SiSU_Viz::Defaults.new diff --git a/lib/sisu/v4/texinfo_format.rb b/lib/sisu/v4/texinfo_format.rb index 09c54575..0c6b99f2 100644 --- a/lib/sisu/v4/texinfo_format.rb +++ b/lib/sisu/v4/texinfo_format.rb @@ -171,14 +171,6 @@ WOK and @md.creator.author=~/\S+/ author=spec_char(@md.creator.author) end - if defined? @md.classify.subject \ - and @md.classify.subject=~/\S+/ - subject=spec_char(@md.classify.subject) - end - if defined? @md.notes.description \ - and @md.notes.description=~/\S+/ - description=spec_char(@md.description) - end if defined? @md.publisher \ and @md.publisher=~/\S+/ publisher=spec_char(@md.publisher) @@ -211,15 +203,31 @@ WOK and @md.date.modified=~/\S+/ date_modified=spec_char(@md.date.modified) end - type=spec_char(@md.type) if @md.type #dc - if defined? @md.classify.format \ - and @md.classify.format=~/\S+/ - format=spec_char(@md.classify.format) + if defined? @md.classify.subject \ + and @md.classify.subject=~/\S+/ + subject=spec_char(@md.classify.subject) + end + if defined? @md.notes.description \ + and @md.notes.description=~/\S+/ + description=spec_char(@md.description) end - if defined? @md.classify.identifier \ - and @md.classify.identifier=~/\S+/ - identifier=spec_char(@md.classify.identifier) + if defined? @md.notes.coverage \ + and @md.notes.coverage=~/\S+/ + coverage=spec_char(@md.notes.coverage) end + if defined? @md.notes.relation \ + and @md.notes.relation=~/\S+/ + relation=spec_char(@md.notes.relation) + end + #type=spec_char(@md.type) if @md.type #dc + if defined? @md.notes.format \ + and @md.notes.format=~/\S+/ + format=spec_char(@md.notes.format) + end + #if defined? @md.identifier.sisupod \ + #and @md.identifier.sisupod=~/\S+/ + # identifier=spec_char(@md.identifier.sisupod) + #end if defined? @md.original.source \ and @md.original.source=~/\S+/ source=spec_char(@md.original.source) @@ -228,14 +236,6 @@ WOK and @md.title.language=~/\S+/ language=spec_char(@md.title.language) end - if defined? @md.classify.relation \ - and @md.classify.relation=~/\S+/ - relation=spec_char(@md.classify.relation) - end - if defined? @md.classify.coverage \ - and @md.classify.coverage=~/\S+/ - coverage=spec_char(@md.classify.coverage) - end if defined? @md.rights.all \ and @md.rights.all=~/\S+/ rights=spec_char(@md.rights.all) diff --git a/lib/sisu/v4/xml_format.rb b/lib/sisu/v4/xml_format.rb index 445fd45a..212a2866 100644 --- a/lib/sisu/v4/xml_format.rb +++ b/lib/sisu/v4/xml_format.rb @@ -149,21 +149,31 @@ module SiSU_XML_Format @rdf_date_modified=%{ dc.date.modified="#{@md.date.modified}"\n} @date_modified=%{\n} end - if defined? @md.type \ - and @md.type # DublinCore 8 - type (genre eg. report, convention etc) - @rdf_type=%{ dc.type="#{@md.type}"\n} - @type=%{\n} + if defined? @md.notes.coverage \ + and @md.notes.coverage=~/\S+/ # DublinCore 14 - coverage + @rdf_coverage=%{ dc.coverage="#{@md.notes.coverage}"\n} + @coverage=%{\n} end - if defined? @md.classify.format \ - and @md.classify.format=~/\S+/ # DublinCore 9 - format (use your mime type) - @rdf_format=%{ dc.format="#{@md.classify.format}"\n} - @format=%{\n} + if defined? @md.notes.relation \ + and @md.notes.relation=~/\S+/ # DublinCore 13 - relation + @rdf_relation=%{ dc.relation="#{@md.notes.relation}"\n} + @relation=%{\n} end - if defined? @md.classify.identifier \ - and @md.classify.identifier=~/\S+/ # DublinCore 10 - identifier (your identifier, could use urn which is free) - @rdf_identifier=%{ dc.identifier="#{@md.classify.identifier}"\n} - @identifier=%{\n} + if defined? @md.notes.type \ + and @md.notes.type # DublinCore 8 - type (genre eg. report, convention etc) + @rdf_type=%{ dc.type="#{@md.notes.type}"\n} + @type=%{\n} end + if defined? @md.notes.format \ + and @md.notes.format=~/\S+/ # DublinCore 9 - format (use your mime type) + @rdf_format=%{ dc.format="#{@md.notes.format}"\n} + @format=%{\n} + end + #if defined? @md.identifier.sisupod \ + #and @md.identifier.sisupod=~/\S+/ # DublinCore 10 - identifier (your identifier, could use urn which is free) + # @rdf_identifier=%{ dc.identifier="#{@md.identifier.sisupod}"\n} + # @identifier=%{\n} + #end if defined? @md.original.source \ and @md.original.source=~/\S+/ # DublinCore 11 - source (document source) @rdf_source=%{ dc.source="#{@md.original.source}"\n} @@ -174,16 +184,6 @@ module SiSU_XML_Format @rdf_language=%{ dc.language="#{@md.original.title}"\n} @language=%{\n} end - if defined? @md.classify.relation \ - and @md.classify.relation=~/\S+/ # DublinCore 13 - relation - @rdf_relation=%{ dc.relation="#{@md.classify.relation}"\n} - @relation=%{\n} - end - if defined? @md.classify.coverage \ - and @md.classify.coverage=~/\S+/ # DublinCore 14 - coverage - @rdf_coverage=%{ dc.coverage="#{@md.classify.coverage}"\n} - @coverage=%{\n} - end if defined? @md.rights.all \ and @md.rights.all=~/\S+/ # DublinCore 15 - rights @rdf_rights=%{ dc.rights="#{@md.rights.all}"\n} diff --git a/lib/sisu/v4/xml_md_oai_pmh_dc.rb b/lib/sisu/v4/xml_md_oai_pmh_dc.rb index 6abbe30e..56e19e0e 100644 --- a/lib/sisu/v4/xml_md_oai_pmh_dc.rb +++ b/lib/sisu/v4/xml_md_oai_pmh_dc.rb @@ -90,95 +90,96 @@ WOK @oai_pmh << %{ #{txt}\n} end if defined? @md.classify.subject \ - and @md.classify.subject=~/\S+/ # DublinCore 3 - subject (us library of congress, eric or udc, or schema???) + and @md.classify.subject=~/\S+/ # DublinCore 3 - subject (us library of congress, eric or udc, or schema???) txt=meta_content_clean(@md.classify.subject) @oai_pmh << %{ #{txt}\n} end - if defined? @md.notes.description \ - and @md.notes.description=~/\S+/ # DublinCore 4 - description - txt=meta_content_clean(@md.notes.description) - @oai_pmh << %{ #{txt}\n} + if defined? @md.classify.keywords \ + and @md.classify.keywords=~/\S+/ + txt=meta_content_clean(@md.classify.keywords) + @oai_pmh << %{ #{txt}\n} end - if @md.publisher # DublinCore 5 - publisher (current copy published by) + if @md.publisher # DublinCore 5 - publisher (current copy published by) txt=meta_content_clean(@md.publisher) @oai_pmh << %{ #{txt}\n} end if defined? @md.creator.contributor \ - and @md.creator.contributor=~/\S+/ # DublinCore 6 - contributor + and @md.creator.contributor=~/\S+/ # DublinCore 6 - contributor txt=meta_content_clean(@md.creator.contributor) @oai_pmh << %{ #{txt}\n} end if defined? @md.date.published \ - and @md.date.published=~/\S+/ # DublinCore 7 - date year-mm-dd + and @md.date.published=~/\S+/ # DublinCore 7 - date year-mm-dd @oai_pmh << %{ #{@md.date.published}\n} end if defined? @md.date.created \ - and @md.date.created=~/\S+/ # DublinCore 7 - date.created + and @md.date.created=~/\S+/ # DublinCore 7 - date.created @oai_pmh << %{ #{@md.date.created}\n} end if defined? @md.date.issued \ - and @md.date.issued=~/\S+/ # DublinCore 7 - date.issued + and @md.date.issued=~/\S+/ # DublinCore 7 - date.issued @oai_pmh << %{ #{@md.date.issued}\n} end if defined? @md.date.available \ - and @md.date.available=~/\S+/ # DublinCore 7 - date.available + and @md.date.available=~/\S+/ # DublinCore 7 - date.available @oai_pmh << %{ #{@md.date.available}\n} end if defined? @md.date.valid \ - and @md.date.valid=~/\S+/ # DublinCore 7 - date.valid + and @md.date.valid=~/\S+/ # DublinCore 7 - date.valid @oai_pmh << %{ #{@md.date.valid}\n} end if defined? @md.date.modified \ - and @md.date.modified=~/\S+/ # DublinCore 7 - date.modified + and @md.date.modified=~/\S+/ # DublinCore 7 - date.modified @oai_pmh << %{ #{@md.date.modified}\n} end - if @md.type # DublinCore 8 - type - txt=meta_content_clean(@md.type) + if defined? @md.notes.description \ + and @md.notes.description=~/\S+/ # DublinCore 4 - description + txt=meta_content_clean(@md.notes.description) + @oai_pmh << %{ #{txt}\n} + end + if defined? @md.notes.coverage \ + and @md.notes.coverage=~/\S+/ # DublinCore 14 - coverage + txt=meta_content_clean(@md.notes.coverage) + @oai_pmh << %{ #{txt}\n} + end + if defined? @md.notes.relation \ + and @md.notes.relation=~/\S+/ # DublinCore 13 - relation + txt=meta_content_clean(@md.notes.relation) + @oai_pmh << %{ #{txt}\n} + end + if defined? @md.notes.type \ + and @md.notes.type=~/\S+/ # DublinCore 8 - type + txt=meta_content_clean(@md.notes.type) @oai_pmh << %{ #{txt}\n} end - if defined? @md.classify.format \ - and @md.classify.format=~/\S+/ # DublinCore 9 - format - txt=meta_content_clean(@md.classify.format) + if defined? @md.notes.format \ + and @md.notes.format=~/\S+/ # DublinCore 9 - format + txt=meta_content_clean(@md.notes.format) @oai_pmh << %{ #{txt}\n} end - if defined? @md.classify.identifier \ - and @md.classify.identifier=~/\S+/ # DublinCore 10 - identifier - txt=meta_content_clean(@md.classify.identifier) - @oai_pmh << %{ #{txt}\n} - end + #if defined? @md.identifier.sisupod \ + #and @md.identifier.sisupod=~/\S+/ # DublinCore 10 - identifier + # txt=meta_content_clean(@md.identifier.sisupod) + # @oai_pmh << %{ #{txt}\n} + #end if defined? @md.original.source \ - and @md.original.source=~/\S+/ # DublinCore 11 - source + and @md.original.source=~/\S+/ # DublinCore 11 - source txt=meta_content_clean(@md.original.source) @oai_pmh << %{ #{txt}\n} end if defined? @md.title.language \ - and @md.title.language=~/\S+/ # DublinCore 12 - language (English) + and @md.title.language=~/\S+/ # DublinCore 12 - language (English) @oai_pmh << %{ #{@md.title.language}\n} end if defined? @md.original.language \ and @md.original.language=~/\S+/ @oai_pmh << %{ #{@md.original.language}\n} end - if defined? @md.classify.relation \ - and @md.classify.relation=~/\S+/ # DublinCore 13 - relation - txt=meta_content_clean(@md.relation) - @oai_pmh << %{ #{txt}\n} - end - if defined? @md.classify.coverage \ - and @md.classify.coverage=~/\S+/ # DublinCore 14 - coverage - txt=meta_content_clean(@md.classify.coverage) - @oai_pmh << %{ #{txt}\n} - end if defined? @md.rights.all \ - and @md.rights.all=~/\S+/ # DublinCore 15 - rights + and @md.rights.all=~/\S+/ # DublinCore 15 - rights txt=meta_content_clean(@md.rights.all) @oai_pmh << %{ #{txt}\n} end - if defined? @md.classify.keywords \ - and @md.classify.keywords=~/\S+/ - txt=meta_content_clean(@md.classify.keywords) - @oai_pmh << %{ #{txt}\n} - end @oai_pmh end def meta_content_clean(content='') -- cgit v1.2.3