Module: Libis::Metadata::Mappers::Scope

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

Overview

Mixin for DublinCoreRecord to enable conversion of the Scope exported DC record.

Instance Method Summary collapse

Instance Method Details

#to_dc::Libis::Metadata::DublinCoreRecord

Main conversion method.



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

def to_dc
  assert(self.is_a? Libis::Metadata::DublinCoreRecord)

  doc = Libis::Metadata::DublinCoreRecord.new(self.to_xml)

  if doc.isPartOf

    # create new node for isReferencedBy
    new_node = doc.add_node(
        'isReferencedBy',
        doc.isPartOf.content,
        nil,
        'xsi:type' => 'dcterms:URI'
    )

    # Replace isPartOf with isReferencedBy
    doc.isPartOf.replace new_node

  end

  doc

end