File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff 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 } "
You can’t perform that action at this time.
0 commit comments