Class: GeoCombine::Migrators::V1AardvarkMigrator

Inherits:
Object
  • Object
show all
Defined in:
lib/geo_combine/migrators/v1_aardvark_migrator.rb

Overview

TODO: WARNING! This class is not fully implemented and should not be used in production. See github.com/OpenGeoMetadata/GeoCombine/issues/121 for remaining work.

migrates the v1 schema to the aardvark schema

Constant Summary collapse

SCHEMA_FIELD_MAP =
{
  'dc_title_s' => 'dct_title_s', # new namespace
  'dc_description_s' => 'dct_description_sm', # new namespace; single to multi-valued
  'dc_language_s' => 'dct_language_sm', # new namespace; single to multi-valued
  'dc_language_sm' => 'dct_language_sm', # new namespace; single to multi-valued
  'dc_creator_sm' => 'dct_creator_sm', # new namespace
  'dc_publisher_s' => 'dct_publisher_sm', # new namespace; single to multi-valued
  'dct_provenance_s' => 'schema_provider_s', # new URI name
  'dc_subject_sm' => 'dct_subject_sm', # new namespace
  'solr_year_i' => 'gbl_indexYear_im', # new URI name; single to multi-valued
  'dc_source_sm' => 'dct_source_sm', # new namespace
  'dc_rights_s' => 'dct_accessRights_s', # new URI name
  'dc_format_s' => 'dct_format_s', # new namespace
  'layer_id_s' => 'gbl_wxsIdentifier_s', # new URI name
  'layer_slug_s' => 'id', # new URI name
  'dc_identifier_s' => 'dct_identifier_sm', # new namespace; single to multi-valued
  'layer_modified_dt' => 'gbl_mdModified_dt', # new URI name
  'geoblacklight_version' => 'gbl_mdVersion_s', # new URI name
  'suppressed_b' => 'gbl_suppressed_b' # new namespace
}.freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(v1_hash:) ⇒ V1AardvarkMigrator

Returns a new instance of V1AardvarkMigrator.

Parameters:

  • v1_hash (Hash)

    parsed json in the v1 schema



14
15
16
# File 'lib/geo_combine/migrators/v1_aardvark_migrator.rb', line 14

def initialize(v1_hash:)
  @v1_hash = v1_hash
end

Instance Attribute Details

#v1_hashObject (readonly)

Returns the value of attribute v1_hash.



11
12
13
# File 'lib/geo_combine/migrators/v1_aardvark_migrator.rb', line 11

def v1_hash
  @v1_hash
end

Instance Method Details

#convert_keysObject



24
25
26
27
28
# File 'lib/geo_combine/migrators/v1_aardvark_migrator.rb', line 24

def convert_keys
  v1_hash.transform_keys do |k|
    SCHEMA_FIELD_MAP[k] || k
  end
end

#runObject



18
19
20
21
22
# File 'lib/geo_combine/migrators/v1_aardvark_migrator.rb', line 18

def run
  v2_hash = convert_keys
  v2_hash['gbl_mdVersion_s'] = 'Aardvark'
  v2_hash
end