Module: Libis::Metadata::Mappers::Standard

Defined in:
lib/libis/metadata/mappers/standard.rb

Overview

Mixin for Libis::Metadata::MarcRecord to enable conversion into DublinCoreRecord. This module implements the standard mapping for KU Leuven.

Instance Method Summary collapse

Instance Method Details

#to_dc(label = nil) ⇒ ::Libis::Metadata::DublinCoreRecord

Main conversion method.

Parameters:

  • label (String) (defaults to: nil)

    optional extra identified to add to the DC record.

Returns:



19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/libis/metadata/mappers/standard.rb', line 19

def to_dc(label = nil)
  assert(self.is_a? Libis::Metadata::MarcRecord)

  doc = Libis::Metadata::DublinCoreRecord.new do |xml|
    marc2dc_identifier(xml, label)
    marc2dc_title(xml)
    marc2dc_medium(xml)
    marc2dc_rights(xml)
    marc2dc_type(xml)
    marc2dc_source(xml)
  end

  # deduplicate the XML
  found = Set.new
  doc.root.children.each {|node| node.unlink unless found.add?(node.to_xml)}

  doc

end