Skip to content

Commit 928dd19

Browse files
committed
Improve handling of urls in OAI-PMH ingestor
1 parent c260fa0 commit 928dd19

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

lib/ingestors/oai_pmh_ingestor.rb

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,10 @@ def read_dublin_core(xml_string)
4747
doc = Nokogiri::XML(xml_string)
4848

4949
types = doc.xpath('//dc:type', ns).map(&:text)
50-
if types.include?('http://purl.org/dc/dcmitype/Event')
50+
# this event detection heuristic captures in particular
51+
# - http://purl.org/dc/dcmitype/Event (the standard way of typing an event in dublin core)
52+
# - https://schema.org/Event
53+
if types.any? { |t| t.downcase.include? 'event' }
5154
read_dublin_core_event(doc)
5255
else
5356
read_dublin_core_material(doc)
@@ -74,7 +77,7 @@ def read_dublin_core_material(xml_doc)
7477
material.date_modified = parsed_dates.last if parsed_dates.size > 1
7578

7679
identifiers = xml_doc.xpath('//dc:identifier', ns).map(&:text)
77-
doi = identifiers.find { |id| id.start_with?('10.') || id.include?('doi.org') }
80+
doi = identifiers.find { |id| id.start_with?('10.') || id.start_with?('https://doi.org/') || id.start_with?('http://doi.org/') }
7881
if doi
7982
doi = doi&.sub(%r{https?://doi\.org/}, '')
8083
material.doi = "https://doi.org/#{doi}"

0 commit comments

Comments
 (0)