Class: Montague::XMLExtractor::Publisher
- Defined in:
- lib/montague/xml_extractor/publisher.rb
Overview
Publisher XML extractor
Instance Method Summary collapse
- #conditions ⇒ Array<String>
- #copyright_links ⇒ Array<Montague::Model::CopyrightLink>
-
#id ⇒ String
Allows for dummy ID string when there is no RoMEO entry with numeric ID.
-
#initialize(xml) ⇒ Publisher
constructor
A new instance of Publisher.
-
#mandates ⇒ Array<Montague::Model::Mandate>
Publisher compliance with the open access mandates of research funding agencies.
- #model ⇒ Montague::Model::Publisher
- #models ⇒ Array<Montague::Model::Publisher>
- #name ⇒ String?
- #name_alias ⇒ String
- #package_model ⇒ Montague::Model::Publisher
- #paid_access ⇒ Montague::Model::PaidAccess?
- #pdf_version ⇒ Montague::Model::Archiving?
- #post_prints ⇒ Montague::Model::Archiving?
- #pre_prints ⇒ Montague::Model::Archiving?
- #romeo_colour ⇒ String?
Constructor Details
#initialize(xml) ⇒ Publisher
7 8 9 |
# File 'lib/montague/xml_extractor/publisher.rb', line 7 def initialize(xml) super end |
Instance Method Details
#conditions ⇒ Array<String>
17 18 19 |
# File 'lib/montague/xml_extractor/publisher.rb', line 17 def conditions xpath_query_for_multi_value '/publisher/conditions/condition' end |
#copyright_links ⇒ Array<Montague::Model::CopyrightLink>
22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/montague/xml_extractor/publisher.rb', line 22 def copyright_links data = [] xpath_result = xpath_query '/publisher/copyrightlinks/copyrightlink' xpath_result.each do |i| copyright_link = Montague::Model::CopyrightLink.new copyright_link.text = i.xpath('copyrightlinktext').text.strip copyright_link.url = i.xpath('copyrightlinkurl').text.strip data << copyright_link if copyright_link.data? end data end |
#id ⇒ String
35 36 37 |
# File 'lib/montague/xml_extractor/publisher.rb', line 35 def id xpath_query_for_single_value('/publisher/@id').to_s end |
#mandates ⇒ Array<Montague::Model::Mandate>
Publisher compliance with the open access mandates of research funding agencies
41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 |
# File 'lib/montague/xml_extractor/publisher.rb', line 41 def mandates xpath_result = xpath_query '/publisher/mandates/mandate' data = [] xpath_result.each do |i| mandate = Montague::Model::Mandate.new funder = Montague::Model::Funder.new funder.name = i.xpath('funder/fundername').text.strip funder.acronym = i.xpath('funder/funderacronym').text.strip mandate.funder = funder if funder.data? mandate.publisher_complies = i.xpath('publishercomplies').text.strip mandate.compliance_type = i.xpath('compliancetype').text.strip mandate.selected_titles = i.xpath('selectedtitles').text.strip data << mandate if mandate.data? end data end |
#model ⇒ Montague::Model::Publisher
124 125 126 |
# File 'lib/montague/xml_extractor/publisher.rb', line 124 def model models.first unless models.empty? end |
#models ⇒ Array<Montague::Model::Publisher>
112 113 114 115 116 117 118 119 120 121 |
# File 'lib/montague/xml_extractor/publisher.rb', line 112 def models data = [] xpath_result = xpath_query publisher_path xpath_result.each do |i| xml_extractor = Montague::XMLExtractor::Publisher.new i.to_s # puts i.to_s data << xml_extractor.package_model end data end |
#name ⇒ String?
59 60 61 |
# File 'lib/montague/xml_extractor/publisher.rb', line 59 def name xpath_query_for_single_value '/publisher/name' end |
#name_alias ⇒ String
12 13 14 |
# File 'lib/montague/xml_extractor/publisher.rb', line 12 def name_alias xpath_query_for_single_value '/publisher/alias' end |
#package_model ⇒ Montague::Model::Publisher
129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 |
# File 'lib/montague/xml_extractor/publisher.rb', line 129 def package_model m = Montague::Model::Publisher.new m.alias = name_alias m.conditions = conditions m.copyright_links = copyright_links m.id = id m.mandates = mandates m.name = name m.paid_access = paid_access m.pdf_version = pdf_version m.pre_prints = pre_prints m.post_prints = post_prints m.romeo_colour = romeo_colour m end |
#paid_access ⇒ Montague::Model::PaidAccess?
65 66 67 68 69 70 71 72 73 74 |
# File 'lib/montague/xml_extractor/publisher.rb', line 65 def paid_access xpath_result = xpath_query '/publisher/paidaccess' if !xpath_result.empty? paid_access = Montague::Model::PaidAccess.new paid_access.url = xpath_result.xpath('paidaccessurl').text.strip paid_access.name = xpath_result.xpath('paidaccessname').text.strip paid_access.notes = xpath_result.xpath('paidaccessnotes').text.strip paid_access end end |
#pdf_version ⇒ Montague::Model::Archiving?
97 98 99 100 101 102 103 104 |
# File 'lib/montague/xml_extractor/publisher.rb', line 97 def pdf_version paths = { archiving: 'pdfversion', permission: 'pdfarchiving', restrictions: 'pdfrestrictions' } prints paths end |
#post_prints ⇒ Montague::Model::Archiving?
87 88 89 90 91 92 93 94 |
# File 'lib/montague/xml_extractor/publisher.rb', line 87 def post_prints paths = { archiving: 'postprints', permission: 'postarchiving', restrictions: 'postrestrictions' } prints paths end |
#pre_prints ⇒ Montague::Model::Archiving?
77 78 79 80 81 82 83 84 |
# File 'lib/montague/xml_extractor/publisher.rb', line 77 def pre_prints paths = { archiving: 'preprints', permission: 'prearchiving', restrictions: 'prerestrictions' } prints paths end |
#romeo_colour ⇒ String?
107 108 109 |
# File 'lib/montague/xml_extractor/publisher.rb', line 107 def romeo_colour xpath_query_for_single_value '/publisher/romeocolour' end |