From b0481de5c3a378f3e1d6cec774cd7ce36d7fcac8 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Tue, 24 Jul 2007 15:13:50 +0100 Subject: open archive initiative for metadata harvesting, initial implementation, decide use later -O --- lib/sisu/v0/xml_md_oai_pmh_dc.rb | 204 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 204 insertions(+) create mode 100644 lib/sisu/v0/xml_md_oai_pmh_dc.rb (limited to 'lib/sisu/v0/xml_md_oai_pmh_dc.rb') diff --git a/lib/sisu/v0/xml_md_oai_pmh_dc.rb b/lib/sisu/v0/xml_md_oai_pmh_dc.rb new file mode 100644 index 00000000..7ac7c3a6 --- /dev/null +++ b/lib/sisu/v0/xml_md_oai_pmh_dc.rb @@ -0,0 +1,204 @@ +=begin + + * Name: SiSU + + * Description: a framework for document structuring, publishing and search + + * Author: Ralph Amissah + + * Copyright: (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, + 2007 Ralph Amissah All Rights Reserved. + + * License: GPL 3 or later: + + SiSU, a framework for document structuring, publishing and search + + Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, + 2007 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 . + + If you have Internet connection, the latest version of the GPL should be + available at these locations: + + + + + * SiSU uses: + * Standard SiSU markup syntax, + * Standard SiSU meta-markup syntax, and the + * Standard SiSU object citation numbering and system + + * Hompages: + + + + * Download: + + + * Ralph Amissah + + + + ** Description: summary of generated outputs and metadata + +=end +module SiSU_XML_metadata + require "#{SiSU_lib}/sysenv" + include SiSU_Env + require "#{SiSU_lib}/param" + include SiSU_Param + class OAI_PMH + def initialize(opt) + @md=SiSU_Param::Parameters.new(opt).get + @oai_pmh=[] + end + def read + output + end + def pre +< + +WOK + end + def body + if @md.dc_title # DublinCore 1 - title + @oai_pmh << %{ #{@md.dc_title}\n} + #@oai_pmh << %{ #{seg_name}#{@md.dc_title}\n} + end + if @md.dc_creator # DublinCore 2 - creator/author (author) + txt=meta_content_clean(@md.dc_creator) + @oai_pmh << %{ #{txt}\n} + end + if @md.dc_subject # DublinCore 3 - subject (us library of congress, eric or udc, or schema???) + txt=meta_content_clean(@md.dc_subject) + @oai_pmh << %{ #{txt}\n} + end + if @md.dc_description # DublinCore 4 - description + txt=meta_content_clean(@md.dc_description) + @oai_pmh << %{ #{txt}\n} + end + if @md.dc_publisher # DublinCore 5 - publisher (current copy published by) + txt=meta_content_clean(@md.dc_publisher) + @oai_pmh << %{ #{txt}\n} + end + if @md.dc_contributor # DublinCore 6 - contributor + txt=meta_content_clean(@md.dc_contributor) + @oai_pmh << %{ #{txt}\n} + end + if @md.dc_date # DublinCore 7 - date year-mm-dd + @oai_pmh << %{ #{@md.dc_date}\n} + end + if @md.dc_date_created # DublinCore 7 - date.created + @oai_pmh << %{ #{@md.dc_date_created}\n} + end + if @md.dc_date_issued # DublinCore 7 - date.issued + @oai_pmh << %{ #{@md.dc_date_issued}\n} + end + if @md.dc_date_available # DublinCore 7 - date.available + @oai_pmh << %{ #{@md.dc_date_available}\n} + end + if @md.dc_date_valid # DublinCore 7 - date.valid + @oai_pmh << %{ #{@md.dc_date_valid}\n} + end + if @md.dc_date_modified # DublinCore 7 - date.modified + @oai_pmh << %{ #{@md.dc_date_modified}\n} + end + if @md.dc_type # DublinCore 8 - type + txt=meta_content_clean(@md.dc_type) + @oai_pmh << %{ #{txt}\n} + end + if @md.dc_format # DublinCore 9 - format + txt=meta_content_clean(@md.dc_format) + @oai_pmh << %{ #{txt}\n} + end + if @md.dc_identifier # DublinCore 10 - identifier + txt=meta_content_clean(@md.dc_identifier) + @oai_pmh << %{ #{txt}\n} + end + if @md.dc_source # DublinCore 11 - source + txt=meta_content_clean(@md.dc_source) + @oai_pmh << %{ #{txt}\n} + end + if @md.dc_language[:name] # DublinCore 12 - language (English) + @oai_pmh << %{ #{@md.dc_language[:name]}\n} + end + if @md.language_original[:name] + @oai_pmh << %{ #{@md.language_original[:name]}\n} + end + if @md.dc_relation # DublinCore 13 - relation + txt=meta_content_clean(@md.dc_relation) + @oai_pmh << %{ #{txt}\n} + end + if @md.dc_coverage # DublinCore 14 - coverage + txt=meta_content_clean(@md.dc_coverage) + @oai_pmh << %{ #{txt}\n} + end + if @md.dc_rights # DublinCore 15 - rights + txt=meta_content_clean(@md.dc_rights) + @oai_pmh << %{ #{txt}\n} + end + if @md.keywords + txt=meta_content_clean(@md.keywords) + @oai_pmh << %{ #{txt}\n} + end + @oai_pmh + end + def meta_content_clean(content='') + unless content.nil? + content.tr!('"',"'") + end + content + end + def post + '' + end + def output + SiSU_Env::SiSU_file.new(@md).mkdir + oai_pmh=SiSU_Env::SiSU_file.new(@md,@md.fn[:oai_pmh]).mkfile #implement in param + oai_pmh << pre + body.each do |x| + oai_pmh << x + end + oai_pmh << post + end + end +end +__END__ +#http://www.openarchives.org/OAI/2.0/openarchivesprotocol.htm#dublincore +#sample implementation, e.g. 2 + + + Grassmann's space analysis + Hyde, E. W. (Edward Wyllys) + LCSH:Ausdehnungslehre; LCCN QA205.H99 + J. Wiley & Sons + Created: 1906; Available: 1991 + text + http://resolver.library.cornell.edu/math/1796949 + + english + Public Domain + -- cgit v1.2.3