Skip to content

Commit

Permalink
remove junii2 support (#1832)
Browse files Browse the repository at this point in the history
  • Loading branch information
nabeta authored Jan 21, 2024
1 parent 755485c commit 678b494
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 144 deletions.
22 changes: 0 additions & 22 deletions app/models/concerns/enju_oai/junii2.rb

This file was deleted.

122 changes: 0 additions & 122 deletions app/models/concerns/enju_oai/oai_model.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ module EnjuOai
module OaiModel
extend ActiveSupport::Concern
OAI::Provider::Base.register_format(EnjuOai::Jpcoar.instance)
OAI::Provider::Base.register_format(EnjuOai::Junii2.instance)
OAI::Provider::Base.register_format(EnjuOai::Dcndl.instance)

def to_oai_dc
Expand Down Expand Up @@ -263,127 +262,6 @@ def to_dcndl
xml.target!
end

def to_junii2
xml = Builder::XmlMarkup.new
xml.junii2 :version => '3.1',
"xsi:schemaLocation" => "http://irdb.nii.ac.jp/oai http://irdb.nii.ac.jp/oai/junii2-3-1.xsd",
"xmlns:xsi" => "http://www.w3.org/2001/XMLSchema-instance",
"xmlns" => "http://irdb.nii.ac.jp/oai",
"xmlns:dc" => "http://purl.org/dc/elements/1.1/" do
xml.title original_title
xml.alternative title_alternative if title_alternative.present?

creators.readable_by(nil).each do |patron|
xml.creator patron.full_name
end

subjects.each do |subject|
unless subject.subject_type.name =~ /BSH|NDLSH|MeSH|LCSH/io
xml.subject subject.term
end
end

if try(:classifications)
%w[NDC NDLC].each do |c|
classifications.each do |classification|
if classification.classification_type.name =~ /#{c}/i
xml.tag! c, classification.category
end
end
end
end

if try(:subjects)
%w[BSH NDLSH MeSH].each do |s|
subjects.each do |subject|
if subject.subject_type.name =~ /#{s}/i
xml.tag! subject, subject.term
end
end
end
end

if try(:classifications)
%w[DDC LCC UDC].each do |c|
classifications.each do |classification|
if classification.classification_type.name =~ /#{c}/i
xml.tag! c, classification.category
end
end
end
end

subjects.each do |s|
if s.subject_type.name =~ /LCSH/i
xml.tag! subject, subject.term
end
end

if description?
xml.description description
end
publishers.readable_by(nil).each do |patron|
xml.publisher patron.full_name
end
contributors.readable_by(nil).each do |patron|
xml.contributor patron.full_name
end
xml.date created_at.to_date.iso8601
xml.type manifestation_content_type&.name
if try(:nii_type)
xml.NIItype nii_type.name
else
xml.NIItype 'Others'
end
if attachment.attached?
xml.format attachment.content_type
end
if manifestation_identifier?
xml.identifier manifestation_identifier
end
identifiers.each do |identifier|
unless identifier.identifier_type.name =~ /isbn|issn|ncid|doi|naid|pmid|ichushi/io
xml.identifier identifier.body
end
end
xml.URI URI.join(ENV['ENJU_LEAF_BASE_URL'], "/manifestations/#{id}")
if attachment.attached?
xml.fulltextURL Rails.application.routes.url_helpers.rails_storage_proxy_url(fileset.attachment, host: ENV['ENJU_LEAF_BASE_URL'])
end
%w[isbn issn NCID].each do |identifier|
identifier_contents(identifier.downcase).each do |val|
xml.tag! identifier, val
end
end
if root_series_statement
xml.jtitle root_series_statement.original_title
end
xml.volume volume_number_string
xml.issue issue_number_string
xml.spage start_page
xml.epage end_page
if pub_date?
xml.dateofissued pub_date
end
# TODO: junii2: source
if language.blank? || language.name == 'unknown'
xml.language "und"
else
xml.language language.iso_639_2
end
%w[pmid doi NAID ichushi].each do |identifier|
identifier_contents(identifier.downcase).each do |val|
xml.tag! identifier, val
end
end
# TODO: junii2: isVersionOf, hasVersion, isReplaceBy, replaces, isRequiredBy, requires, isPartOf, hasPart, isReferencedBy, references, isFormatOf, hasFormat
# TODO: junii2: coverage, spatial, NIIspatial, temporal, NIItemporal
# TODO: junii2: rights
# TODO: junii2: textversion
# TODO: junii2: grantid, dateofgranted, degreename, grantor
end
end

def self.repository_url
URI.join(ENV['ENJU_LEAF_BASE_URL'], '/oai')
end
Expand Down

0 comments on commit 678b494

Please sign in to comment.