From 6ca36fefea9f3d8302d36e83d39a38f97c442b38 Mon Sep 17 00:00:00 2001 From: Kristina Spurgin Date: Wed, 19 Jan 2022 18:59:26 -0500 Subject: [PATCH 01/20] change functionality and make all tests pass - term lookup in cache and search tries case-swapping value if exact match returns nothing - hash with :refname and :csid keys is now stored in cache instead of just refname string - cache unknown values so we don't attempt to look them up in client every time they occur --- lib/collectionspace/mapper/term_handler.rb | 45 ++- lib/collectionspace/mapper/term_searchable.rb | 292 +++++++------- spec/anthro_helpers.rb | 154 ++++---- spec/bonsai_helpers.rb | 22 +- spec/botgarden_helpers.rb | 56 +-- .../mapper/data_handler_spec.rb | 337 +++++++++------- .../mapper/term_handler_spec.rb | 19 +- .../mapper/term_searchable_spec.rb | 81 +++- spec/core_helpers.rb | 366 +++++++++--------- spec/fcart_helpers.rb | 2 +- spec/lhmc_helpers.rb | 4 +- 11 files changed, 748 insertions(+), 630 deletions(-) diff --git a/lib/collectionspace/mapper/term_handler.rb b/lib/collectionspace/mapper/term_handler.rb index c75a6f23..f186ba39 100644 --- a/lib/collectionspace/mapper/term_handler.rb +++ b/lib/collectionspace/mapper/term_handler.rb @@ -59,14 +59,14 @@ def handle_term(val) } if in_cache?(val) - refname_urn = cached_term(val) + refname_urn = cached_term(val, :refname) if refname_urn add_found_term(refname_urn, term_report) added = true end else # not in cache if @config.check_terms - refname_urn = searched_term(val) + refname_urn = searched_term(val, :refname) if refname_urn add_found_term(refname_urn, term_report) added = true @@ -74,20 +74,41 @@ def handle_term(val) end end - unless added - refname_obj = CollectionSpace::Mapper::Tools::RefName.new( - source_type: source_type, - type: type, - subtype: subtype, - term: val, - cache: @cache) - @terms << term_report.merge({found: false, refname: refname_obj}) - @cache.put(type, subtype, val, refname_obj.urn) - refname_urn = refname_obj.urn + return refname_urn if added + + # this section needs to be updated when not-found terms become blocking errors instead + # of warnings. At that point, we no longer want to generate and store a refname for the + # term, since it will not be mapped. + if cached_as_unknown?(val) + refname_urn = add_known_unknown_term(val, term_report) + else + refname_urn = add_new_unknown_term(val, term_report) end + refname_urn end + def add_new_unknown_term(val, term_report) + refname_obj = CollectionSpace::Mapper::Tools::RefName.new( + source_type: source_type, + type: type, + subtype: subtype, + term: val, + cache: @cache) + + @terms << term_report.merge({found: false, refname: refname_obj}) + refname_url = refname_obj.urn + @cache.put('unknownvalue', unknown_type, val, {refname: refname_url, csid: nil}) + refname_url + end + + def add_known_unknown_term(val, term_report) + refname_url = @cache.get('unknownvalue', unknown_type, val)[:refname] + refname_obj = CollectionSpace::Mapper::Tools::RefName.new(urn: refname_url) + @terms << term_report.merge({found: false, refname: refname_obj}) + refname_url + end + def add_found_term(refname_urn, term_report) refname_obj = CollectionSpace::Mapper::Tools::RefName.new(urn: refname_urn) found = @config.check_terms ? true : false diff --git a/lib/collectionspace/mapper/term_searchable.rb b/lib/collectionspace/mapper/term_searchable.rb index 27330aca..cd53422c 100644 --- a/lib/collectionspace/mapper/term_searchable.rb +++ b/lib/collectionspace/mapper/term_searchable.rb @@ -4,88 +4,97 @@ module CollectionSpace module Mapper module TermSearchable def in_cache?(val) - @cache.exists?(type, subtype, val) - end + return true if @cache.exists?(type, subtype, val) + return true if @cache.exists?(type, subtype, case_swap(val)) - def cached_term(val) - @cache.get(type, subtype, val, search: false) + false end - def get_vocabulary_term(vocab:, term:) - result = @cache.get('vocabularies', vocab, term, search: true) - return result unless result.nil? + # returns whether value is cached as an unknownvalue + def cached_as_unknown?(val) + return true if @cache.exists?('unknownvalue', unknown_type, val) + return true if @cache.exists?('unknownvalue', unknown_type, case_swap(val)) - if has_caps?(term) - @cache.get('vocabularies', vocab, term.downcase, search: true) - else - @cache.get('vocabularies', vocab, term.capitalize, search: true) - end + false end - def has_caps?(string) - string.match?(/[A-Z]/) ? true : false + private def unknown_type + @unknown_type ||= "#{type}/#{subtype}" + end + + # returns refName of cached term + def cached_term(val, return_key = :refname) + returned = @cache.get(type, subtype, val, search: false) + return returned[return_key] if returned + + returned = @cache.get(type, subtype, case_swap(val), search: false) + return returned[return_key] if returned end - def searched_term(val) - begin - response = @client.find( - type: type, - subtype: subtype, - value: val, - field: search_field - ) - rescue StandardError => e - puts e.message - else - response_term_refname(response) - end + # returns refName of searched (term) + def searched_term(val, return_key = :refname) + response = term_search_response(val) + + rec = rec_from_response('term', val, response) + return nil unless rec + + cache_value = { refname: rec['refName'], csid: rec['csid'] } + @cache.put(type, subtype, val, cache_value) + cache_value[return_key] end + + private def case_swap(string) + string.match?(/[A-Z]/) ? string.downcase : string.capitalize + end + + + private def term_search_response(val) + as_is = get_term_response(val) + return as_is if term_response_usable?(as_is) + + get_term_response(case_swap(val)) + end + + private def get_term_response(val) + response = @client.find( + type: type, + subtype: subtype, + value: val, + field: search_field + ) + rescue StandardError => e + puts e.message + nil + else + parse_response(response) + end + + private def parse_response(response) + parsed = response.parsed['abstract_common_list'] + rescue StandardError => e + puts e.message + nil + else + parsed + end + def obj_csid(objnum, type) - csid = @cache.get(type, '', objnum) - csid ? extract_refname_csid(csid) : lookup_obj_csid(objnum, type) + cached = @cache.get(type, '', objnum, search: false) + return cached[:csid] if cached + + lookup_obj_csid(objnum, type) end - def extract_refname_csid(urn) - urn.match(/:id\((.*?)\)/)[1] - end - def lookup_obj_csid(objnum, type) response = @client.find(type: type, value: objnum) if response.result.success? - result = response.parsed['abstract_common_list'] - term_ct = result['totalItems'].to_i - case term_ct - when 0 - errors << { - category: :no_records_found_with_objnum, - field: '', - type: type, - subtype: '', - value: objnum, - message: "#{term_ct} records found." - } - csid = nil - when 1 - csid = result['list_item']['csid'] - else - rec = result['list_item'][0] - using_uri = "#{@client.config.base_uri}#{rec['uri']}" - csid = rec['csid'] - warnings << { - category: :multiple_records_found_with_objnum, - field: '', - type: type, - subtype: '', - value: objnum, - message: "#{term_ct} records found. Using #{using_uri}" - } - end - - return csid if csid.nil? - - @cache.put(type, '', objnum, csid) - return csid + rec = rec_from_response('objnum', objnum, parse_response(response)) + return nil unless rec + + csid = rec['csid'] + @cache.put(type, '', objnum, { refname: rec['refName'], csid: csid } ) + csid else errors << { category: :unsuccessful_csid_lookup_for_objnum, @@ -100,93 +109,92 @@ def lookup_obj_csid(objnum, type) end def term_csid(term) - # This is currently working though it returns the cached refname urn instead of CSID - # if a term is cached. There's a lot of stuff to clean up/fix/test better here so - # I'm leaving this for now to get the bugfix in - csid = cached_term(term) - return csid unless csid.nil? - - field = CollectionSpace::Service.get(type: type)[:term] + cached = cached_term(term, :csid) + return cached if cached - response = @client.find(type: type, subtype: subtype, field: field, value: term) - if response.result.success? - result = response.parsed['abstract_common_list'] - term_ct = result['totalItems'].to_i - case term_ct - when 0 - errors << { - category: :no_records_found_for_term, - field: '', - type: type, - subtype: subtype, - value: term, - message: "#{term_ct} records found." - } - csid = nil - when 1 - csid = result['list_item']['csid'] - else - rec = result['list_item'][0] - using_uri = "#{@client.config.base_uri}#{rec['uri']}" - csid = rec['csid'] - warnings << { - category: :multiple_records_found_for_term, - field: '', - type: type, - subtype: subtype, - value: term, - message: "#{term_ct} records found. Using #{using_uri}" - } - end - - return csid if csid.nil? - - @cache.put(type, subtype, term, csid) - return csid - else - errors << { - category: :unsuccessful_csid_lookup_for_term, - field: '', - type: type, - subtype: subtype, - value: term, - message: "Problem with search for #{term}" - } - return nil - end + searched_term(term, :csid) end - def response_term_refname(response) - term_ct = response.parsed.dig('abstract_common_list', 'totalItems') - return nil if term_ct.nil? - - if term_ct.to_i == 1 - refname = response.parsed.dig('abstract_common_list', 'list_item', 'refName') - elsif term_ct.to_i > 1 - rec = response.parsed.dig('abstract_common_list', 'list_item')[0] - using_uri = "#{@client.config.base_uri}#{rec['uri']}" - refname = rec['refName'] - warnings << { - category: :multiple_records_found_for_term, - field: column, - type: type, - subtype: subtype, - value: value, - message: "#{term_ct} records found. Using #{using_uri}" - } - end - refname - end + private def term_response_usable?(response) + ct = response_item_count(response) + return false unless ct + return false if ct == 0 + + true + end + + private def response_item_count(response) + ct = response.dig('totalItems') + return ct.to_i if ct - def search_field - begin + nil + end + + + private def rec_from_response(category, val, response) + term_ct = response_item_count(response) + + unless term_ct + errors << { + category: "unsuccessful_csid_lookup_for_#{category}".to_sym, + field: '', + type: type, + subtype: subtype, + value: val, + message: "Problem with search for #{val}" + } + return nil + end + + case term_ct + when 0 + errors << { + category: "no_records_found_for_#{category}".to_sym, + field: '', + type: type, + subtype: subtype, + value: val, + message: "#{term_ct} records found." + } + rec = nil + when 1 + rec = response['list_item'] + else + rec = response['list_item'][0] + using_uri = "#{@client.config.base_uri}#{rec['uri']}" + warnings << { + category: "multiple_records_found_for_#{category}".to_sym, + field: '', + type: type, + subtype: subtype, + value: val, + message: "#{term_ct} records found. Using #{using_uri}" + } + end + + rec + end + + private def search_field field = CollectionSpace::Service.get(type: type)[:term] rescue StandardError => e puts e.message else field + end + + # added toward refactoring that isn't done yet + def get_vocabulary_term(vocab:, term:) + result = @cache.get('vocabularies', vocab, term, search: true) + return result unless result.nil? + + if has_caps?(term) + @cache.get('vocabularies', vocab, term.downcase, search: true) + else + @cache.get('vocabularies', vocab, term.capitalize, search: true) end end + end end end diff --git a/spec/anthro_helpers.rb b/spec/anthro_helpers.rb index a4dae142..a426de04 100644 --- a/spec/anthro_helpers.rb +++ b/spec/anthro_helpers.rb @@ -27,159 +27,159 @@ def anthro_object_mapper def populate_anthro(cache) terms = [ ['conceptauthorities', 'archculture', 'Blackfoot', - "urn:cspace:anthro.collectionspace.org:conceptauthorities:name(archculture):item:name(Blackfoot1576172504869)'Blackfoot'"], + { refname: "urn:cspace:anthro.collectionspace.org:conceptauthorities:name(archculture):item:name(Blackfoot1576172504869)'Blackfoot'", csid: '1111-2222-3333-4444' }], ['conceptauthorities', 'concept', 'Birds', - "urn:cspace:anthro.collectionspace.org:conceptauthorities:name(concept):item:name(Birds918181)'Birds'"], + { refname: "urn:cspace:anthro.collectionspace.org:conceptauthorities:name(concept):item:name(Birds918181)'Birds'", csid: '1111-2222-3333-4444' }], ['conceptauthorities', 'ethculture', 'Batak', - "urn:cspace:anthro.collectionspace.org:conceptauthorities:name(ethculture):item:name(Batak1576172496916)'Batak'"], + { refname: "urn:cspace:anthro.collectionspace.org:conceptauthorities:name(ethculture):item:name(Batak1576172496916)'Batak'", csid: '1111-2222-3333-4444' }], ['conceptauthorities', 'ethculture', 'Got', - "urn:cspace:anthro.collectionspace.org:conceptauthorities:name(ethculture):item:name(Got1599824429903)'Got'"], + { refname: "urn:cspace:anthro.collectionspace.org:conceptauthorities:name(ethculture):item:name(Got1599824429903)'Got'", csid: '1111-2222-3333-4444' }], ['conceptauthorities', 'ethculture', 'Hero', - "urn:cspace:anthro.collectionspace.org:conceptauthorities:name(ethculture):item:name(Hero1599824418804)'Hero'"], + { refname: "urn:cspace:anthro.collectionspace.org:conceptauthorities:name(ethculture):item:name(Hero1599824418804)'Hero'", csid: '1111-2222-3333-4444' }], ['conceptauthorities', 'material_ca', 'Feathers', - "urn:cspace:anthro.collectionspace.org:conceptauthorities:name(material_ca):item:name(Feathers918181)'Feathers'"], + { refname: "urn:cspace:anthro.collectionspace.org:conceptauthorities:name(material_ca):item:name(Feathers918181)'Feathers'", csid: '1111-2222-3333-4444' }], ['orgauthorities', 'organization', 'Hola', - "urn:cspace:anthro.collectionspace.org:orgauthorities:name(organization):item:name(Hola1599824351945)'Hola'"], + { refname: "urn:cspace:anthro.collectionspace.org:orgauthorities:name(organization):item:name(Hola1599824351945)'Hola'", csid: '1111-2222-3333-4444' }], ['orgauthorities', 'organization', 'Organization 1', - "urn:cspace:anthro.collectionspace.org:orgauthorities:name(organization):item:name(Organization11587136583004)'Organization 1'"], + { refname: "urn:cspace:anthro.collectionspace.org:orgauthorities:name(organization):item:name(Organization11587136583004)'Organization 1'", csid: '1111-2222-3333-4444' }], ['orgauthorities', 'organization', 'chores', - "urn:cspace:anthro.collectionspace.org:orgauthorities:name(organization):item:name(chores1599824370125)'chores'"], + { refname: "urn:cspace:anthro.collectionspace.org:orgauthorities:name(organization):item:name(chores1599824370125)'chores'", csid: '1111-2222-3333-4444' }], ['personauthorities', 'person', 'Ann Analyst', - "urn:cspace:anthro.collectionspace.org:personauthorities:name(person):item:name(AnnAnalyst1594848799340)'Ann Analyst'"], + { refname: "urn:cspace:anthro.collectionspace.org:personauthorities:name(person):item:name(AnnAnalyst1594848799340)'Ann Analyst'", csid: '1111-2222-3333-4444' }], ['personauthorities', 'person', 'Gabriel Solares', - "urn:cspace:anthro.collectionspace.org:personauthorities:name(person):item:name(GabrielSolares1594848906847)'Gabriel Solares'"], + { refname: "urn:cspace:anthro.collectionspace.org:personauthorities:name(person):item:name(GabrielSolares1594848906847)'Gabriel Solares'", csid: '1111-2222-3333-4444' }], ['personauthorities', 'person', 'Tegla', - "urn:cspace:anthro.collectionspace.org:personauthorities:name(person):item:name(Tegla1599824325923)'Tegla'"], + { refname: "urn:cspace:anthro.collectionspace.org:personauthorities:name(person):item:name(Tegla1599824325923)'Tegla'", csid: '1111-2222-3333-4444' }], ['personauthorities', 'person', 'Tom', - "urn:cspace:anthro.collectionspace.org:personauthorities:name(person):item:name(Tom1599824331955)'Tom'"], + { refname: "urn:cspace:anthro.collectionspace.org:personauthorities:name(person):item:name(Tom1599824331955)'Tom'", csid: '1111-2222-3333-4444' }], ['placeauthorities', 'place', 'Early', - "urn:cspace:anthro.collectionspace.org:placeauthorities:name(place):item:name(Early1599824413345)'Early'"], + { refname: "urn:cspace:anthro.collectionspace.org:placeauthorities:name(place):item:name(Early1599824413345)'Early'", csid: '1111-2222-3333-4444' }], ['placeauthorities', 'place', 'Local', - "urn:cspace:anthro.collectionspace.org:placeauthorities:name(place):item:name(Local1599824385298)'Local'"], + { refname: "urn:cspace:anthro.collectionspace.org:placeauthorities:name(place):item:name(Local1599824385298)'Local'", csid: '1111-2222-3333-4444' }], ['placeauthorities', 'place', 'York County, Pennsylvania', - "urn:cspace:anthro.collectionspace.org:placeauthorities:name(place):item:name(YorkCountyPennsylvania)'York County, Pennsylvania'"], + { refname: "urn:cspace:anthro.collectionspace.org:placeauthorities:name(place):item:name(YorkCountyPennsylvania)'York County, Pennsylvania'", csid: '1111-2222-3333-4444' }], ['vocabularies', 'agerange', 'adolescent 26-75%', - "urn:cspace:anthro.collectionspace.org:vocabularies:name(agerange):item:name(adolescent_26_75)'adolescent 26-75%'"], + { refname: "urn:cspace:anthro.collectionspace.org:vocabularies:name(agerange):item:name(adolescent_26_75)'adolescent 26-75%'", csid: '1111-2222-3333-4444' }], ['vocabularies', 'agerange', 'adult 0-25%', - "urn:cspace:anthro.collectionspace.org:vocabularies:name(agerange):item:name(adult_0_25)'adult 0-25%'"], + { refname: "urn:cspace:anthro.collectionspace.org:vocabularies:name(agerange):item:name(adult_0_25)'adult 0-25%'", csid: '1111-2222-3333-4444' }], ['vocabularies', 'annotationtype', 'image made', - "urn:cspace:anthro.collectionspace.org:vocabularies:name(annotationtype):item:name(image_made)'image made'"], + { refname: "urn:cspace:anthro.collectionspace.org:vocabularies:name(annotationtype):item:name(image_made)'image made'", csid: '1111-2222-3333-4444' }], ['vocabularies', 'annotationtype', 'type', - "urn:cspace:anthro.collectionspace.org:vocabularies:name(annotationtype):item:name(type)'type'"], + { refname: "urn:cspace:anthro.collectionspace.org:vocabularies:name(annotationtype):item:name(type)'type'", csid: '1111-2222-3333-4444' }], ['vocabularies', 'behrensmeyer', '0 - no cracking or flaking on bone surface', - "urn:cspace:anthro.collectionspace.org:vocabularies:name(behrensmeyer):item:name(0)'0 - no cracking or flaking on bone surface'"], + { refname: "urn:cspace:anthro.collectionspace.org:vocabularies:name(behrensmeyer):item:name(0)'0 - no cracking or flaking on bone surface'", csid: '1111-2222-3333-4444' }], ['vocabularies', 'behrensmeyer', '1 - longitudinal and/or mosaic cracking present on surface', - "urn:cspace:anthro.collectionspace.org:vocabularies:name(behrensmeyer):item:name(1)'1 - longitudinal and/or mosaic cracking present on surface'"], + { refname: "urn:cspace:anthro.collectionspace.org:vocabularies:name(behrensmeyer):item:name(1)'1 - longitudinal and/or mosaic cracking present on surface'", csid: '1111-2222-3333-4444' }], ['vocabularies', 'behrensmeyer', '2 - longitudinal cracks, exfoliation on surface', - "urn:cspace:anthro.collectionspace.org:vocabularies:name(behrensmeyer):item:name(2)'2 - longitudinal cracks, exfoliation on surface'"], + { refname: "urn:cspace:anthro.collectionspace.org:vocabularies:name(behrensmeyer):item:name(2)'2 - longitudinal cracks, exfoliation on surface'", csid: '1111-2222-3333-4444' }], ['vocabularies', 'behrensmeyer', '3 - fibrous texture, extensive exfoliation', - "urn:cspace:anthro.collectionspace.org:vocabularies:name(behrensmeyer):item:name(3)'3 - fibrous texture, extensive exfoliation'"], + { refname: "urn:cspace:anthro.collectionspace.org:vocabularies:name(behrensmeyer):item:name(3)'3 - fibrous texture, extensive exfoliation'", csid: '1111-2222-3333-4444' }], ['vocabularies', 'behrensmeyer', '5 - bone crumbling in situ, large splinters', - "urn:cspace:anthro.collectionspace.org:vocabularies:name(behrensmeyer):item:name(5)'5 - bone crumbling in situ, large splinters'"], + { refname: "urn:cspace:anthro.collectionspace.org:vocabularies:name(behrensmeyer):item:name(5)'5 - bone crumbling in situ, large splinters'", csid: '1111-2222-3333-4444' }], ['vocabularies', 'bodyside', 'midline', - "urn:cspace:anthro.collectionspace.org:vocabularies:name(bodyside):item:name(midline)'midline'"], + { refname: "urn:cspace:anthro.collectionspace.org:vocabularies:name(bodyside):item:name(midline)'midline'", csid: '1111-2222-3333-4444' }], ['vocabularies', 'dateera', 'CE', - "urn:cspace:anthro.collectionspace.org:vocabularies:name(dateera):item:name(ce)'CE'"], + { refname: "urn:cspace:anthro.collectionspace.org:vocabularies:name(dateera):item:name(ce)'CE'", csid: '1111-2222-3333-4444' }], ['vocabularies', 'inventorystatus', 'accessioned', - "urn:cspace:anthro.collectionspace.org:vocabularies:name(inventorystatus):item:name(accessioned)'accessioned'"], + { refname: "urn:cspace:anthro.collectionspace.org:vocabularies:name(inventorystatus):item:name(accessioned)'accessioned'", csid: '1111-2222-3333-4444' }], ['vocabularies', 'inventorystatus', 'unknown', - "urn:cspace:anthro.collectionspace.org:vocabularies:name(inventorystatus):item:name(unknown)'unknown'"], + { refname: "urn:cspace:anthro.collectionspace.org:vocabularies:name(inventorystatus):item:name(unknown)'unknown'", csid: '1111-2222-3333-4444' }], ['vocabularies', 'languages', 'Chinese', - "urn:cspace:anthro.collectionspace.org:vocabularies:name(languages):item:name(zho)'Chinese'"], + { refname: "urn:cspace:anthro.collectionspace.org:vocabularies:name(languages):item:name(zho)'Chinese'", csid: '1111-2222-3333-4444' }], ['vocabularies', 'languages', 'English', - "urn:cspace:anthro.collectionspace.org:vocabularies:name(languages):item:name(eng)'English'"], + { refname: "urn:cspace:anthro.collectionspace.org:vocabularies:name(languages):item:name(eng)'English'", csid: '1111-2222-3333-4444' }], ['vocabularies', 'languages', 'French', - "urn:cspace:anthro.collectionspace.org:vocabularies:name(languages):item:name(fra)'French'"], + { refname: "urn:cspace:anthro.collectionspace.org:vocabularies:name(languages):item:name(fra)'French'", csid: '1111-2222-3333-4444' }], ['vocabularies', 'languages', 'German', - "urn:cspace:anthro.collectionspace.org:vocabularies:name(languages):item:name(deu)'German'"], + { refname: "urn:cspace:anthro.collectionspace.org:vocabularies:name(languages):item:name(deu)'German'", csid: '1111-2222-3333-4444' }], ['vocabularies', 'languages', 'Spanish', - "urn:cspace:anthro.collectionspace.org:vocabularies:name(languages):item:name(spa)'Spanish'"], + { refname: "urn:cspace:anthro.collectionspace.org:vocabularies:name(languages):item:name(spa)'Spanish'", csid: '1111-2222-3333-4444' }], ['vocabularies', 'limitationlevel', 'recommendation', - "urn:cspace:anthro.collectionspace.org:vocabularies:name(limitationlevel):item:name(recommendation)'recommendation'"], + { refname: "urn:cspace:anthro.collectionspace.org:vocabularies:name(limitationlevel):item:name(recommendation)'recommendation'", csid: '1111-2222-3333-4444' }], ['vocabularies', 'limitationlevel', 'restriction', - "urn:cspace:anthro.collectionspace.org:vocabularies:name(limitationlevel):item:name(restriction)'restriction'"], + { refname: "urn:cspace:anthro.collectionspace.org:vocabularies:name(limitationlevel):item:name(restriction)'restriction'", csid: '1111-2222-3333-4444' }], ['vocabularies', 'limitationtype', 'lending', - "urn:cspace:anthro.collectionspace.org:vocabularies:name(limitationtype):item:name(lending)'lending'"], + { refname: "urn:cspace:anthro.collectionspace.org:vocabularies:name(limitationtype):item:name(lending)'lending'", csid: '1111-2222-3333-4444' }], ['vocabularies', 'limitationtype', 'publication', - "urn:cspace:anthro.collectionspace.org:vocabularies:name(limitationtype):item:name(publication)'publication'"], + { refname: "urn:cspace:anthro.collectionspace.org:vocabularies:name(limitationtype):item:name(publication)'publication'", csid: '1111-2222-3333-4444' }], ['vocabularies', 'mortuarytreatment', 'burned/unburned bone mixture', - "urn:cspace:anthro.collectionspace.org:vocabularies:name(mortuarytreatment):item:name(burnedunburnedbonemixture)'burned/unburned bone mixture'"], + { refname: "urn:cspace:anthro.collectionspace.org:vocabularies:name(mortuarytreatment):item:name(burnedunburnedbonemixture)'burned/unburned bone mixture'", csid: '1111-2222-3333-4444' }], ['vocabularies', 'mortuarytreatment', 'enbalmed', - "urn:cspace:anthro.collectionspace.org:vocabularies:name(mortuarytreatment):item:name(enbalmed)'enbalmed'"], + { refname: "urn:cspace:anthro.collectionspace.org:vocabularies:name(mortuarytreatment):item:name(enbalmed)'enbalmed'", csid: '1111-2222-3333-4444' }], ['vocabularies', 'mortuarytreatment', 'excarnated', - "urn:cspace:anthro.collectionspace.org:vocabularies:name(mortuarytreatment):item:name(excarnated)'excarnated'"], + { refname: "urn:cspace:anthro.collectionspace.org:vocabularies:name(mortuarytreatment):item:name(excarnated)'excarnated'", csid: '1111-2222-3333-4444' }], ['vocabularies', 'mortuarytreatment', 'mummified', - "urn:cspace:anthro.collectionspace.org:vocabularies:name(mortuarytreatment):item:name(mummified)'mummified'"], + { refname: "urn:cspace:anthro.collectionspace.org:vocabularies:name(mortuarytreatment):item:name(mummified)'mummified'", csid: '1111-2222-3333-4444' }], ['vocabularies', 'nagpracategory', 'not subject to NAGPRA', - "urn:cspace:anthro.collectionspace.org:vocabularies:name(nagpracategory):item:name(nonNagpra)'not subject to NAGPRA'"], + { refname: "urn:cspace:anthro.collectionspace.org:vocabularies:name(nagpracategory):item:name(nonNagpra)'not subject to NAGPRA'", csid: '1111-2222-3333-4444' }], ['vocabularies', 'nagpracategory', 'subject to NAGPRA (unspec.)', - "urn:cspace:anthro.collectionspace.org:vocabularies:name(nagpracategory):item:name(subjectToNAGPRA)'subject to NAGPRA (unspec.)'"], + { refname: "urn:cspace:anthro.collectionspace.org:vocabularies:name(nagpracategory):item:name(subjectToNAGPRA)'subject to NAGPRA (unspec.)'", csid: '1111-2222-3333-4444' }], ['vocabularies', 'nagpraclaimtype', 'affiliated human skeletal remains (HSR)', - "urn:cspace:anthro.collectionspace.org:vocabularies:name(nagpraclaimtype):item:name(affiliatedHsr)'affiliated human skeletal remains (HSR)'"], + { refname: "urn:cspace:anthro.collectionspace.org:vocabularies:name(nagpraclaimtype):item:name(affiliatedHsr)'affiliated human skeletal remains (HSR)'", csid: '1111-2222-3333-4444' }], ['vocabularies', 'nagpraclaimtype', 'needs further research', - "urn:cspace:anthro.collectionspace.org:vocabularies:name(nagpraclaimtype):item:name(needsFurtherResearch)'needs further research'"], + { refname: "urn:cspace:anthro.collectionspace.org:vocabularies:name(nagpraclaimtype):item:name(needsFurtherResearch)'needs further research'", csid: '1111-2222-3333-4444' }], ['vocabularies', 'nagpraclaimtype', 'not subject to NAGPRA', - "urn:cspace:anthro.collectionspace.org:vocabularies:name(nagpraclaimtype):item:name(nonNagpra)'not subject to NAGPRA'"], + { refname: "urn:cspace:anthro.collectionspace.org:vocabularies:name(nagpraclaimtype):item:name(nonNagpra)'not subject to NAGPRA'", csid: '1111-2222-3333-4444' }], ['vocabularies', 'nagpraclaimtype', 'object of cultural patrimony', - "urn:cspace:anthro.collectionspace.org:vocabularies:name(nagpraclaimtype):item:name(objectOfCulturalPatrimony)'object of cultural patrimony'"], + { refname: "urn:cspace:anthro.collectionspace.org:vocabularies:name(nagpraclaimtype):item:name(objectOfCulturalPatrimony)'object of cultural patrimony'", csid: '1111-2222-3333-4444' }], ['vocabularies', 'nagpraclaimtype', 'unassociated funerary object (UFO)', - "urn:cspace:anthro.collectionspace.org:vocabularies:name(nagpraclaimtype):item:name(ufo)'unassociated funerary object (UFO)'"], + { refname: "urn:cspace:anthro.collectionspace.org:vocabularies:name(nagpraclaimtype):item:name(ufo)'unassociated funerary object (UFO)'", csid: '1111-2222-3333-4444' }], ['vocabularies', 'prodpeoplerole', 'designed after', - "urn:cspace:anthro.collectionspace.org:vocabularies:name(prodpeoplerole):item:name(designedAfter)'designed after'"], + { refname: "urn:cspace:anthro.collectionspace.org:vocabularies:name(prodpeoplerole):item:name(designedAfter)'designed after'", csid: '1111-2222-3333-4444' }], ['vocabularies', 'prodpeoplerole', 'traditional makers', - "urn:cspace:anthro.collectionspace.org:vocabularies:name(prodpeoplerole):item:name(traditionalMakers)'traditional makers'"], + { refname: "urn:cspace:anthro.collectionspace.org:vocabularies:name(prodpeoplerole):item:name(traditionalMakers)'traditional makers'", csid: '1111-2222-3333-4444' }], ['vocabularies', 'publishto', 'DPLA', - "urn:cspace:anthro.collectionspace.org:vocabularies:name(publishto):item:name(dpla)'DPLA'"], + { refname: "urn:cspace:anthro.collectionspace.org:vocabularies:name(publishto):item:name(dpla)'DPLA'", csid: '1111-2222-3333-4444' }], ['vocabularies', 'publishto', 'Omeka', - "urn:cspace:anthro.collectionspace.org:vocabularies:name(publishto):item:name(omeka)'Omeka'"], + { refname: "urn:cspace:anthro.collectionspace.org:vocabularies:name(publishto):item:name(omeka)'Omeka'", csid: '1111-2222-3333-4444' }], ['vocabularies', 'cranialdeformationcategory', 'other (describe)', - "urn:cspace:anthro.collectionspace.org:vocabularies:name(cranialdeformationcategory):item:name(other)'other (describe)'"], + { refname: "urn:cspace:anthro.collectionspace.org:vocabularies:name(cranialdeformationcategory):item:name(other)'other (describe)'", csid: '1111-2222-3333-4444' }], ['vocabularies', 'cranialdeformationcategory', 'tabular', - "urn:cspace:anthro.collectionspace.org:vocabularies:name(cranialdeformationcategory):item:name(tabular)'tabular'"], + { refname: "urn:cspace:anthro.collectionspace.org:vocabularies:name(cranialdeformationcategory):item:name(tabular)'tabular'", csid: '1111-2222-3333-4444' }], ['vocabularies', 'cranialdeformationcategory', 'circumferential', - "urn:cspace:anthro.collectionspace.org:vocabularies:name(cranialdeformationcategory):item:name(circumferential)'circumferential'"], + { refname: "urn:cspace:anthro.collectionspace.org:vocabularies:name(cranialdeformationcategory):item:name(circumferential)'circumferential'", csid: '1111-2222-3333-4444' }], ['vocabularies', 'trepanationcertainty', 'possible trepanation', - "urn:cspace:anthro.collectionspace.org:vocabularies:name(trepanationcertainty):item:name(possible)'possible trepanation'"], + { refname: "urn:cspace:anthro.collectionspace.org:vocabularies:name(trepanationcertainty):item:name(possible)'possible trepanation'", csid: '1111-2222-3333-4444' }], ['vocabularies', 'trepanationcertainty', 'clear evidence of trepanation', - "urn:cspace:anthro.collectionspace.org:vocabularies:name(trepanationcertainty):item:name(clear)'clear evidence of trepanation'"], + { refname: "urn:cspace:anthro.collectionspace.org:vocabularies:name(trepanationcertainty):item:name(clear)'clear evidence of trepanation'", csid: '1111-2222-3333-4444' }], ['vocabularies', 'trepanationtechnique', 'grooving', - "urn:cspace:anthro.collectionspace.org:vocabularies:name(trepanationtechnique):item:name(grooving)'grooving'"], + { refname: "urn:cspace:anthro.collectionspace.org:vocabularies:name(trepanationtechnique):item:name(grooving)'grooving'", csid: '1111-2222-3333-4444' }], ['vocabularies', 'trepanationtechnique', 'grooving', - "urn:cspace:anthro.collectionspace.org:vocabularies:name(trepanationtechnique):item:name(grooving)'grooving'"], + { refname: "urn:cspace:anthro.collectionspace.org:vocabularies:name(trepanationtechnique):item:name(grooving)'grooving'", csid: '1111-2222-3333-4444' }], ['vocabularies', 'trepanationhealing', 'possible healing', - "urn:cspace:anthro.collectionspace.org:vocabularies:name(trepanationhealing):item:name(possible)'possible healing'"], + { refname: "urn:cspace:anthro.collectionspace.org:vocabularies:name(trepanationhealing):item:name(possible)'possible healing'", csid: '1111-2222-3333-4444' }], ['vocabularies', 'trepanationhealing', 'no healing', - "urn:cspace:anthro.collectionspace.org:vocabularies:name(trepanationhealing):item:name(none)'no healing'"], + { refname: "urn:cspace:anthro.collectionspace.org:vocabularies:name(trepanationhealing):item:name(none)'no healing'", csid: '1111-2222-3333-4444' }], ['vocabularies', 'trepanationhealing', 'definite evidence for healing', - "urn:cspace:anthro.collectionspace.org:vocabularies:name(trepanationhealing):item:name(definite)'definite evidence for healing'"], + { refname: "urn:cspace:anthro.collectionspace.org:vocabularies:name(trepanationhealing):item:name(definite)'definite evidence for healing'", csid: '1111-2222-3333-4444' }], ['vocabularies', 'mortuarytreatment', 'excarnated', - "urn:cspace:anthro.collectionspace.org:vocabularies:name(mortuarytreatment):item:name(excarnated)'excarnated'"], + { refname: "urn:cspace:anthro.collectionspace.org:vocabularies:name(mortuarytreatment):item:name(excarnated)'excarnated'", csid: '1111-2222-3333-4444' }], ['vocabularies', 'behrensmeyer', '3 - fibrous texture, extensive exfoliation', - "urn:cspace:anthro.collectionspace.org:vocabularies:name(behrensmeyer):item:name(3)'3 - fibrous texture, extensive exfoliation'"], + { refname: "urn:cspace:anthro.collectionspace.org:vocabularies:name(behrensmeyer):item:name(3)'3 - fibrous texture, extensive exfoliation'", csid: '1111-2222-3333-4444' }], ['vocabularies', 'dateera', 'CE', - "urn:cspace:anthro.collectionspace.org:vocabularies:name(dateera):item:name(ce)'CE'"], + { refname: "urn:cspace:anthro.collectionspace.org:vocabularies:name(dateera):item:name(ce)'CE'", csid: '1111-2222-3333-4444' }], ['vocabularies', 'dateera', 'CE', - "urn:cspace:anthro.collectionspace.org:vocabularies:name(dateera):item:name(ce)'CE'"], + { refname: "urn:cspace:anthro.collectionspace.org:vocabularies:name(dateera):item:name(ce)'CE'", csid: '1111-2222-3333-4444' }], ['vocabularies', 'dateera', 'CE', - "urn:cspace:anthro.collectionspace.org:vocabularies:name(dateera):item:name(ce)'CE'"], + { refname: "urn:cspace:anthro.collectionspace.org:vocabularies:name(dateera):item:name(ce)'CE'", csid: '1111-2222-3333-4444' }], ['vocabularies', 'dateera', 'CE', - "urn:cspace:anthro.collectionspace.org:vocabularies:name(dateera):item:name(ce)'CE'"], + { refname: "urn:cspace:anthro.collectionspace.org:vocabularies:name(dateera):item:name(ce)'CE'", csid: '1111-2222-3333-4444' }], ['vocabularies', 'osteocompleteness', 'mandible only', - "urn:cspace:anthro.collectionspace.org:vocabularies:name(osteocompleteness):item:name(mandible)'mandible only'"], + { refname: "urn:cspace:anthro.collectionspace.org:vocabularies:name(osteocompleteness):item:name(mandible)'mandible only'", csid: '1111-2222-3333-4444' }], ['vocabularies', 'behrensmeyer', - '4 - coarsely fibrous texture, splinters of bone loose on the surface, open cracks', "urn:cspace:anthro.collectionspace.org:vocabularies:name(behrensmeyer):item:name(4)'4 - coarsely fibrous texture, splinters of bone loose on the surface, open cracks'"], + '4 - coarsely fibrous texture, splinters of bone loose on the surface, open cracks', { refname: "urn:cspace:anthro.collectionspace.org:vocabularies:name(behrensmeyer):item:name(4)'4 - coarsely fibrous texture, splinters of bone loose on the surface, open cracks'", csid: '1111-2222-3333-4444' }], ['vocabularies', 'dentitionscore', 'not applicable', - "urn:cspace:anthro.collectionspace.org:vocabularies:name(dentitionscore):item:name(notapplicable)'not applicable'"], + { refname: "urn:cspace:anthro.collectionspace.org:vocabularies:name(dentitionscore):item:name(notapplicable)'not applicable'", csid: '1111-2222-3333-4444' }], ['personauthorities', 'person', 'sniper', - "urn:cspace:anthro.collectionspace.org:personauthorities:name(person):item:name(sniper1599821165616)'sniper'"], + { refname: "urn:cspace:anthro.collectionspace.org:personauthorities:name(person):item:name(sniper1599821165616)'sniper'", csid: '1111-2222-3333-4444' }], ['personauthorities', 'person', 'fullclip', - "urn:cspace:anthro.collectionspace.org:personauthorities:name(person):item:name(fullclip1599821193344)'fullclip'"], + { refname: "urn:cspace:anthro.collectionspace.org:personauthorities:name(person):item:name(fullclip1599821193344)'fullclip'", csid: '1111-2222-3333-4444' }], ['personauthorities', 'person', 'fullclip', - "urn:cspace:anthro.collectionspace.org:personauthorities:name(person):item:name(fullclip1599821140041)'fullclip'"], + { refname: "urn:cspace:anthro.collectionspace.org:personauthorities:name(person):item:name(fullclip1599821140041)'fullclip'", csid: '1111-2222-3333-4444' }], ['personauthorities', 'person', 'praya', - "urn:cspace:anthro.collectionspace.org:personauthorities:name(person):item:name(praya1599821095120)'praya'"], + { refname: "urn:cspace:anthro.collectionspace.org:personauthorities:name(person):item:name(praya1599821095120)'praya'", csid: '1111-2222-3333-4444' }], ['personauthorities', 'person', 'jijoe', - "urn:cspace:anthro.collectionspace.org:personauthorities:name(person):item:name(jijoe1599821246989)'jijoe'"], + { refname: "urn:cspace:anthro.collectionspace.org:personauthorities:name(person):item:name(jijoe1599821246989)'jijoe'", csid: '1111-2222-3333-4444' }], ] populate(cache, terms) end diff --git a/spec/bonsai_helpers.rb b/spec/bonsai_helpers.rb index 22958b3d..dc81187a 100644 --- a/spec/bonsai_helpers.rb +++ b/spec/bonsai_helpers.rb @@ -22,27 +22,27 @@ def bonsai_cache def populate_bonsai(cache) terms = [ ['orgauthorities', 'organization', 'Bonsai Museum', - "urn:cspace:bonsai.collectionspace.org:orgauthorities:name(organization):item:name(BonsaiMuseum1598919439027)'Bonsai Museum'"], + { refname: "urn:cspace:bonsai.collectionspace.org:orgauthorities:name(organization):item:name(BonsaiMuseum1598919439027)'Bonsai Museum'", csid: '1111-2222-3333-4444' }], ['orgauthorities', 'organization', 'Bonsai Store', - "urn:cspace:bonsai.collectionspace.org:orgauthorities:name(organization):item:name(BonsaiStore1598920297843)'Bonsai Store'"], + { refname: "urn:cspace:bonsai.collectionspace.org:orgauthorities:name(organization):item:name(BonsaiStore1598920297843)'Bonsai Store'", csid: '1111-2222-3333-4444' }], ['personauthorities', 'person', 'Ann Authorizer', - "urn:cspace:bonsai.collectionspace.org:personauthorities:name(person):item:name(AnnAuthorizer1598919551068)'Ann Authorizer'"], + { refname: "urn:cspace:bonsai.collectionspace.org:personauthorities:name(person):item:name(AnnAuthorizer1598919551068)'Ann Authorizer'", csid: '1111-2222-3333-4444' }], ['personauthorities', 'person', 'Debbie Depositor', - "urn:cspace:bonsai.collectionspace.org:personauthorities:name(person):item:name(DebbieDepositor1598919493867)'Debbie Depositor'"], + { refname: "urn:cspace:bonsai.collectionspace.org:personauthorities:name(person):item:name(DebbieDepositor1598919493867)'Debbie Depositor'", csid: '1111-2222-3333-4444' }], ['personauthorities', 'person', 'Priscilla Plantsale', - "urn:cspace:bonsai.collectionspace.org:personauthorities:name(person):item:name(PriscillaPlantsale1598920259864)'Priscilla Plantsale'"], + { refname: "urn:cspace:bonsai.collectionspace.org:personauthorities:name(person):item:name(PriscillaPlantsale1598920259864)'Priscilla Plantsale'", csid: '1111-2222-3333-4444' }], ['vocabularies', 'currency', 'Canadian Dollar', - "urn:cspace:bonsai.collectionspace.org:vocabularies:name(currency):item:name(CAD)'Canadian Dollar'"], + { refname: "urn:cspace:bonsai.collectionspace.org:vocabularies:name(currency):item:name(CAD)'Canadian Dollar'", csid: '1111-2222-3333-4444' }], ['vocabularies', 'dateera', 'CE', - "urn:cspace:anthro.collectionspace.org:vocabularies:name(dateera):item:name(ce)'CE'"], + { refname: "urn:cspace:anthro.collectionspace.org:vocabularies:name(dateera):item:name(ce)'CE'", csid: '1111-2222-3333-4444' }], ['vocabularies', 'deaccessionapprovalgroup', 'collection committee', - "urn:cspace:bonsai.collectionspace.org:vocabularies:name(deaccessionapprovalgroup):item:name(collection_committee)'collection committee'"], + { refname: "urn:cspace:bonsai.collectionspace.org:vocabularies:name(deaccessionapprovalgroup):item:name(collection_committee)'collection committee'", csid: '1111-2222-3333-4444' }], ['vocabularies', 'deaccessionapprovalstatus', 'approved', - "urn:cspace:bonsai.collectionspace.org:vocabularies:name(deaccessionapprovalstatus):item:name(approved)'approved'"], + { refname: "urn:cspace:bonsai.collectionspace.org:vocabularies:name(deaccessionapprovalstatus):item:name(approved)'approved'", csid: '1111-2222-3333-4444' }], ['vocabularies', 'deaccessionapprovalstatus', 'not required', - "urn:cspace:bonsai.collectionspace.org:vocabularies:name(deaccessionapprovalstatus):item:name(not_required)'not required'"], + { refname: "urn:cspace:bonsai.collectionspace.org:vocabularies:name(deaccessionapprovalstatus):item:name(not_required)'not required'", csid: '1111-2222-3333-4444' }], ['vocabularies', 'disposalmethod', 'public auction', - "urn:cspace:bonsai.collectionspace.org:vocabularies:name(disposalmethod):item:name(public_auction)'public auction'"], + { refname: "urn:cspace:bonsai.collectionspace.org:vocabularies:name(disposalmethod):item:name(public_auction)'public auction'", csid: '1111-2222-3333-4444' }], ] populate(cache, terms) end diff --git a/spec/botgarden_helpers.rb b/spec/botgarden_helpers.rb index e02b0aed..73f901bd 100644 --- a/spec/botgarden_helpers.rb +++ b/spec/botgarden_helpers.rb @@ -22,61 +22,61 @@ def botgarden_cache def populate_botgarden(cache) terms = [ ['citationauthorities', 'citation', 'FNA Volume 19', - "urn:cspace:botgarden.collectionspace.org:citationauthorities:name(citation):item:name(FNAVolume191599238760383)'FNA Volume 19'"], + { refname: "urn:cspace:botgarden.collectionspace.org:citationauthorities:name(citation):item:name(FNAVolume191599238760383)'FNA Volume 19'", csid: '1111-2222-3333-4444' }], ['citationauthorities', 'citation', 'Sp. Pl. 2: 899. 1753', - "urn:cspace:botgarden.collectionspace.org:citationauthorities:name(citation):item:name(SpPl289917531599238184211)'Sp. Pl. 2: 899. 1753'"], + { refname: "urn:cspace:botgarden.collectionspace.org:citationauthorities:name(citation):item:name(SpPl289917531599238184211)'Sp. Pl. 2: 899. 1753'", csid: '1111-2222-3333-4444' }], ['citationauthorities', 'worldcat', 'Bull. Torrey Bot. Club', - "urn:cspace:botgarden.collectionspace.org:citationauthorities:name(worldcat):item:name(BullTorreyBotClub331599245358364)'Bull. Torrey Bot. Club 33'"], + { refname: "urn:cspace:botgarden.collectionspace.org:citationauthorities:name(worldcat):item:name(BullTorreyBotClub331599245358364)'Bull. Torrey Bot. Club 33'", csid: '1111-2222-3333-4444' }], ['conceptauthorities', 'concept', 'Official', - "urn:cspace:botgarden.collectionspace.org:conceptauthorities:name(concept):item:name(Official1599737276242)'Official'"], + { refname: "urn:cspace:botgarden.collectionspace.org:conceptauthorities:name(concept):item:name(Official1599737276242)'Official'", csid: '1111-2222-3333-4444' }], ['locationauthorities', 'location', 'Corner', - "urn:cspace:botgarden.collectionspace.org:locationauthorities:name(location):item:name(Corner1599737289184)'Corner'"], + { refname: "urn:cspace:botgarden.collectionspace.org:locationauthorities:name(location):item:name(Corner1599737289184)'Corner'", csid: '1111-2222-3333-4444' }], ['orgauthorities', 'organization', 'FVA', - "urn:cspace:botgarden.collectionspace.org:orgauthorities:name(organization):item:name(FVA1599246022216)'FVA'"], + { refname: "urn:cspace:botgarden.collectionspace.org:orgauthorities:name(organization):item:name(FVA1599246022216)'FVA'", csid: '1111-2222-3333-4444' }], ['personauthorities', 'person', 'Linnaeus, Carl', - "urn:cspace:botgarden.collectionspace.org:personauthorities:name(person):item:name(LinnaeusCarl1599238374086)'Linnaeus, Carl'"], + { refname: "urn:cspace:botgarden.collectionspace.org:personauthorities:name(person):item:name(LinnaeusCarl1599238374086)'Linnaeus, Carl'", csid: '1111-2222-3333-4444' }], ['taxonomyauthority', 'taxon', 'Domestic', - "urn:cspace:botgarden.collectionspace.org:taxonomyauthority:name(taxon):item:name(Domestic1599750187683)'Domestic'"], + { refname: "urn:cspace:botgarden.collectionspace.org:taxonomyauthority:name(taxon):item:name(Domestic1599750187683)'Domestic'", csid: '1111-2222-3333-4444' }], ['taxonomyauthority', 'taxon', 'Tropez', - "urn:cspace:botgarden.collectionspace.org:taxonomyauthority:name(taxon):item:name(Tropez1599750195530)'Tropez'"], + { refname: "urn:cspace:botgarden.collectionspace.org:taxonomyauthority:name(taxon):item:name(Tropez1599750195530)'Tropez'", csid: '1111-2222-3333-4444' }], ['vocabularies', 'cuttingtype', 'hardwood', - "urn:cspace:botgarden.collectionspace.org:vocabularies:name(cuttingtype):item:name(hardwood)'hardwood'"], + { refname: "urn:cspace:botgarden.collectionspace.org:vocabularies:name(cuttingtype):item:name(hardwood)'hardwood'", csid: '1111-2222-3333-4444' }], ['vocabularies', 'dateera', 'CE', - "urn:cspace:botgarden.collectionspace.org:vocabularies:name(dateera):item:name(ce)'CE'"], + { refname: "urn:cspace:botgarden.collectionspace.org:vocabularies:name(dateera):item:name(ce)'CE'", csid: '1111-2222-3333-4444' }], ['vocabularies', 'durationunit', 'Days', - "urn:cspace:botgarden.collectionspace.org:vocabularies:name(durationunit):item:name(days)'Days'"], + { refname: "urn:cspace:botgarden.collectionspace.org:vocabularies:name(durationunit):item:name(days)'Days'", csid: '1111-2222-3333-4444' }], ['vocabularies', 'durationunit', 'Hours', - "urn:cspace:botgarden.collectionspace.org:vocabularies:name(durationunit):item:name(hours)'Hours'"], + { refname: "urn:cspace:botgarden.collectionspace.org:vocabularies:name(durationunit):item:name(hours)'Hours'", csid: '1111-2222-3333-4444' }], ['vocabularies', 'languages', 'English', - "urn:cspace:botgarden.collectionspace.org:vocabularies:name(languages):item:name(eng)'English'"], + { refname: "urn:cspace:botgarden.collectionspace.org:vocabularies:name(languages):item:name(eng)'English'", csid: '1111-2222-3333-4444' }], ['vocabularies', 'languages', 'French', - "urn:cspace:botgarden.collectionspace.org:vocabularies:name(languages):item:name(fra)'French'"], + { refname: "urn:cspace:botgarden.collectionspace.org:vocabularies:name(languages):item:name(fra)'French'", csid: '1111-2222-3333-4444' }], ['vocabularies', 'languages', 'Latin', - "urn:cspace:botgarden.collectionspace.org:vocabularies:name(languages):item:name(lat)'Latin'"], + { refname: "urn:cspace:botgarden.collectionspace.org:vocabularies:name(languages):item:name(lat)'Latin'", csid: '1111-2222-3333-4444' }], ['vocabularies', 'potsize', '1 gal. pot', - "urn:cspace:botgarden.collectionspace.org:vocabularies:name(potsize):item:name(OneGalPot)'1 gal. pot'"], + { refname: "urn:cspace:botgarden.collectionspace.org:vocabularies:name(potsize):item:name(OneGalPot)'1 gal. pot'", csid: '1111-2222-3333-4444' }], ['vocabularies', 'propActivityType', 'benlate and captan', - "urn:cspace:botgarden.collectionspace.org:vocabularies:name(propActivityType):item:name(benlateAndCaptan)'benlate and captan'"], + { refname: "urn:cspace:botgarden.collectionspace.org:vocabularies:name(propActivityType):item:name(benlateAndCaptan)'benlate and captan'", csid: '1111-2222-3333-4444' }], ['vocabularies', 'propChemicals', 'benlate and physan', - "urn:cspace:botgarden.collectionspace.org:vocabularies:name(propChemicals):item:name(benlateAndPhysan)'benlate and physan'"], + { refname: "urn:cspace:botgarden.collectionspace.org:vocabularies:name(propChemicals):item:name(benlateAndPhysan)'benlate and physan'", csid: '1111-2222-3333-4444' }], ['vocabularies', 'propConditions', 'glass cover', - "urn:cspace:botgarden.collectionspace.org:vocabularies:name(propConditions):item:name(glassCover)'glass cover'"], + { refname: "urn:cspace:botgarden.collectionspace.org:vocabularies:name(propConditions):item:name(glassCover)'glass cover'", csid: '1111-2222-3333-4444' }], ['vocabularies', 'propHormones', 'hormone', - "urn:cspace:botgarden.collectionspace.org:vocabularies:name(propHormones):item:name(hormone)'hormone'"], + { refname: "urn:cspace:botgarden.collectionspace.org:vocabularies:name(propHormones):item:name(hormone)'hormone'", csid: '1111-2222-3333-4444' }], ['vocabularies', 'propPlantType', 'bulbs', - "urn:cspace:botgarden.collectionspace.org:vocabularies:name(propPlantType):item:name(bulbs)'bulbs'"], + { refname: "urn:cspace:botgarden.collectionspace.org:vocabularies:name(propPlantType):item:name(bulbs)'bulbs'", csid: '1111-2222-3333-4444' }], ['vocabularies', 'propreason', 'conservation', - "urn:cspace:botgarden.collectionspace.org:vocabularies:name(propreason):item:name(conservation)'conservation'"], + { refname: "urn:cspace:botgarden.collectionspace.org:vocabularies:name(propreason):item:name(conservation)'conservation'", csid: '1111-2222-3333-4444' }], ['vocabularies', 'proptype', 'Division', - "urn:cspace:botgarden.collectionspace.org:vocabularies:name(proptype):item:name(division)'Division'"], + { refname: "urn:cspace:botgarden.collectionspace.org:vocabularies:name(proptype):item:name(division)'Division'", csid: '1111-2222-3333-4444' }], ['vocabularies', 'scarstrat', 'boiling water', - "urn:cspace:botgarden.collectionspace.org:vocabularies:name(scarstrat):item:name(boilingwater)'boiling water'"], + { refname: "urn:cspace:botgarden.collectionspace.org:vocabularies:name(scarstrat):item:name(boilingwater)'boiling water'", csid: '1111-2222-3333-4444' }], ['vocabularies', 'scarstrat', 'cold strat', - "urn:cspace:botgarden.collectionspace.org:vocabularies:name(scarstrat):item:name(coldstrat)'cold strat'"], + { refname: "urn:cspace:botgarden.collectionspace.org:vocabularies:name(scarstrat):item:name(coldstrat)'cold strat'", csid: '1111-2222-3333-4444' }], ['vocabularies', 'taxontermflag', 'invalid', - "urn:cspace:botgarden.collectionspace.org:vocabularies:name(taxontermflag):item:name(invalid)'invalid'"], + { refname: "urn:cspace:botgarden.collectionspace.org:vocabularies:name(taxontermflag):item:name(invalid)'invalid'", csid: '1111-2222-3333-4444' }], ['vocabularies', 'taxontermflag', 'valid', - "urn:cspace:botgarden.collectionspace.org:vocabularies:name(taxontermflag):item:name(valid)'valid'"], + { refname: "urn:cspace:botgarden.collectionspace.org:vocabularies:name(taxontermflag):item:name(valid)'valid'", csid: '1111-2222-3333-4444' }], ] populate(cache, terms) end diff --git a/spec/collectionspace/mapper/data_handler_spec.rb b/spec/collectionspace/mapper/data_handler_spec.rb index 2e8b2248..645250d0 100644 --- a/spec/collectionspace/mapper/data_handler_spec.rb +++ b/spec/collectionspace/mapper/data_handler_spec.rb @@ -3,86 +3,87 @@ require 'spec_helper' RSpec.describe CollectionSpace::Mapper::DataHandler do - before(:all) do - @anthro_client = anthro_client - @anthro_cache = anthro_cache - @anthro_object_mapper = get_json_record_mapper('spec/fixtures/files/mappers/release_6_1/anthro/anthro_4-1-2_collectionobject.json') - @anthro_object_handler = CollectionSpace::Mapper::DataHandler.new(record_mapper: @anthro_object_mapper, - client: @anthro_client, - cache: @anthro_cache) - @anthro_place_mapper = get_json_record_mapper('spec/fixtures/files/mappers/release_6_1/anthro/anthro_4-1-2_place-local.json') - @anthro_place_handler = CollectionSpace::Mapper::DataHandler.new(record_mapper: @anthro_place_mapper, - client: @anthro_client, - cache: @anthro_cache) - - @bonsai_client = bonsai_client - @bonsai_cache = bonsai_cache - @bonsai_conservation_mapper = get_json_record_mapper('spec/fixtures/files/mappers/release_6_1/bonsai/bonsai_4-1-1_conservation.json') - @bonsai_conservation_handler = CollectionSpace::Mapper::DataHandler.new(record_mapper: @bonsai_conservation_mapper, - client: @bonsai_client, - cache: @bonsai_cache) -end - - # todo: why are these making services api calls? + let(:client) { core_client } + let(:cache) { core_cache_search } + let(:mapperpath) { 'spec/fixtures/files/mappers/release_6_1/core/core_6-1-0_collectionobject.json' } + let(:mapper) { get_json_record_mapper(mapperpath) } + let(:config) { {"delimiter": "|"} } + let(:handler) do + CollectionSpace::Mapper::DataHandler.new(record_mapper: mapper, + client: client, + cache: cache, + config: config) + end + + # these make services api calls to find terms not in cache context 'when config has check_terms = false', services_call: true do - before(:all) do - @client = core_client - @cache = core_cache_search - @mapper = get_json_record_mapper('spec/fixtures/files/mappers/release_6_1/core/core_6-1-0_collectionobject.json') - @config = '{"check_terms": false}' - @handler = CollectionSpace::Mapper::DataHandler.new(record_mapper: @mapper, - client: @client, - cache: @cache, - config: @config) - @data = {'objectNumber' => '20CS.001.0002', - 'numberOfObjects' => '1', - 'title' => 'Rainbow', - 'titleLanguage' => 'English', - 'namedCollection' => 'Test Collection', - 'collection' => 'rando'} - @data2 = {'objectNumber' => '20CS.001.0001', - 'numberOfObjects' => '1', - 'numberValue' => '123456|98765', - 'numberType' => 'lender|obsolete', - 'title' => 'A Man| A Woman', - 'titleLanguage' => 'English| Klingon', - 'namedCollection' => 'Test collection', - 'collection' => 'permanent collection'} - end - it 'returns found = false for all terms, even if they exist in client' do - res = @handler.process(@data) - not_found = res.terms.reject{ |t| t[:found] } - expect(not_found.length).to eq(2) + let(:config) { '{"check_terms": false}' } + let(:result) { handler.process(data).terms.reject{ |t| t[:found] } } + + context 'with terms in instance but not in cache' do + let(:data) do + {'objectNumber' => '20CS.001.0002', + 'titleLanguage' => 'English', # vocabulary, in instance, in cache + 'namedCollection' => 'Test Collection', # authority, not in instance, not in cache + 'collection' => 'rando'} + end + + it 'returns found = false for all terms, even if they exist in client', skip: 'deprecating check_terms' do + res = @handler.process(@data) + not_found = res.terms.reject{ |t| t[:found] } + expect(not_found.length).to eq(2) + end end - it 'returns found = false for all terms, even if they exist in client' do - res = @handler.process(@data2) - not_found = res.terms.reject{ |t| t[:found] } - expect(not_found.length).to eq(3) + + context 'with terms in instance but not in cache, and not in instance' do + let(:data) do + {'objectNumber' => '20CS.001.0001', + 'numberOfObjects' => '1', + 'numberValue' => '123456|98765', + 'numberType' => 'lender|obsolete', + 'title' => 'A Man| A Woman', + 'titleLanguage' => 'English| Klingon', + 'namedCollection' => 'Test collection', + 'collection' => 'permanent collection'} + end + + it 'returns found = false for all terms, even if they exist in client', skip: 'deprecating check_terms' do + res = @handler.process(@data2) + not_found = res.terms.reject{ |t| t[:found] } + expect(not_found.length).to eq(3) + end end end it 'tags all un-found terms as such', services_call: true do data1 = { 'objectNumber' => '1', - 'publishTo' => 'Wordpress', # vocabulary - not in cache - 'namedCollection' => 'nc', # authority - not in cache + 'publishTo' => 'All', # vocabulary - in instance, not in cache + 'namedCollection' => 'QA TARGET Work', # authority - in instance, not in cache } data2 = { 'objectNumber' => '2', - 'publishTo' => 'Wordpress', # vocabulary - now in cache - 'namedCollection' => 'nc', # authority - now in cache - 'contentConceptAssociated' => 'Birds' # authority, in cache + 'publishTo' => 'All', # vocabulary - now in cache + 'namedCollection' => 'QA TARGET Work', # authority - now in cache + 'contentConceptAssociated' => 'Birds' # authority - not in instance, not in cache } - @anthro_object_handler.process(data1) - result = @anthro_object_handler.process(data2).terms.select{ |t| t[:found] == false } - expect(result.length).to eq(2) + + + handler.process(data1) + result = handler.process(data2).terms.select{ |t| t[:found] == false } + expect(result.length).to eq(1) end describe '#is_authority' do context 'anthro profile' do + let(:client) { anthro_client } + let(:cache) { anthro_cache } + context 'place record' do + let(:mapperpath) { 'spec/fixtures/files/mappers/release_6_1/anthro/anthro_4-1-2_place-local.json' } + it 'adds a xphash entry for shortIdentifier' do - result = @anthro_place_handler.mapper.xpath['places_common'][:mappings].select do |mapping| + result = handler.mapper.xpath['places_common'][:mappings].select do |mapping| mapping.fieldname == 'shortIdentifier' end expect(result.length).to eq(1) @@ -93,9 +94,13 @@ describe '#service_type' do let(:servicetype){ handler.service_type } + context 'anthro profile' do + let(:client) { anthro_client } + let(:cache) { anthro_cache } + context 'collectionobject record' do - let(:handler){ @anthro_object_handler } + let(:mapperpath) { 'spec/fixtures/files/mappers/release_6_1/anthro/anthro_4-1-2_collectionobject.json' } it 'returns object' do expect(servicetype).to eq('object') @@ -103,7 +108,7 @@ end context 'place record' do - let(:handler){ @anthro_place_handler } + let(:mapperpath) { 'spec/fixtures/files/mappers/release_6_1/anthro/anthro_4-1-2_place-local.json' } it 'returns authority' do expect(servicetype).to eq('authority') @@ -112,8 +117,11 @@ end context 'bonsai profile' do + let(:client) { bonsai_client } + let(:cache) { bonsai_cache } + context 'conservation record' do - let(:handler){ @bonsai_conservation_handler } + let(:mapperpath) { 'spec/fixtures/files/mappers/release_6_1/bonsai/bonsai_4-1-1_conservation.json' } it 'returns procedure' do expect(servicetype).to eq('procedure') @@ -122,74 +130,95 @@ end end + # @anthro_object_mapper = get_json_record_mapper('spec/fixtures/files/mappers/release_6_1/anthro/anthro_4-1-2_collectionobject.json') + # @anthro_object_handler = CollectionSpace::Mapper::DataHandler.new(record_mapper: @anthro_object_mapper, + # client: @anthro_client, + # cache: @anthro_cache) + # @anthro_place_mapper = get_json_record_mapper('spec/fixtures/files/mappers/release_6_1/anthro/anthro_4-1-2_place-local.json') + # @anthro_place_handler = CollectionSpace::Mapper::DataHandler.new(record_mapper: @anthro_place_mapper, + # client: @anthro_client, + # cache: @anthro_cache) + + # @bonsai_client = bonsai_client + # @bonsai_cache = bonsai_cache + # @bonsai_conservation_mapper = get_json_record_mapper('spec/fixtures/files/mappers/release_6_1/bonsai/bonsai_4-1-1_conservation.json') + # @bonsai_conservation_handler = CollectionSpace::Mapper::DataHandler.new(record_mapper: @bonsai_conservation_mapper, + # client: @bonsai_client, + # cache: @bonsai_cache) + # end + describe '#xpath_hash' do + let(:result) { handler.mapper.xpath[xpath] } + context 'anthro profile' do + let(:client) { anthro_client } + let(:cache) { anthro_cache } + context 'collectionobject record' do + let(:mapperpath) { 'spec/fixtures/files/mappers/release_6_1/anthro/anthro_4-1-2_collectionobject.json' } + context 'xpath ending with commingledRemainsGroup' do - before(:all) do - xpath = 'collectionobjects_anthro/commingledRemainsGroupList/commingledRemainsGroup' - @h = @anthro_object_handler.mapper.xpath[xpath] - end + let(:xpath) { 'collectionobjects_anthro/commingledRemainsGroupList/commingledRemainsGroup' } + it 'is_group = true' do - expect(@h[:is_group]).to be true + expect(result[:is_group]).to be true end it 'is_subgroup = false' do - expect(@h[:is_subgroup]).to be false + expect(result[:is_subgroup]).to be false end it 'includes mortuaryTreatment as subgroup' do - xpath = 'collectionobjects_anthro/commingledRemainsGroupList/commingledRemainsGroup/mortuaryTreatmentGroupList/mortuaryTreatmentGroup' - expect(@h[:children]).to eq([xpath]) - end - - xit 'has mortuaryTreatment listed as only child' do + child_xpath = 'collectionobjects_anthro/commingledRemainsGroupList/commingledRemainsGroup/mortuaryTreatmentGroupList/mortuaryTreatmentGroup' + expect(result[:children]).to eq([child_xpath]) end end context 'xpath ending with mortuaryTreatmentGroup' do - before(:all) do - xpath = 'collectionobjects_anthro/commingledRemainsGroupList/commingledRemainsGroup/mortuaryTreatmentGroupList/mortuaryTreatmentGroup' - @h = @anthro_object_handler.mapper.xpath[xpath] - end + let(:xpath) { 'collectionobjects_anthro/commingledRemainsGroupList/commingledRemainsGroup/mortuaryTreatmentGroupList/mortuaryTreatmentGroup' } + it 'is_group = true' do - expect(@h[:is_group]).to be true + expect(result[:is_group]).to be true end it 'is_subgroup = true' do - expect(@h[:is_subgroup]).to be true + expect(result[:is_subgroup]).to be true end it 'parent is xpath ending with commingledRemainsGroup' do ppath = 'collectionobjects_anthro/commingledRemainsGroupList/commingledRemainsGroup' - expect(@h[:parent]).to eq(ppath) + expect(result[:parent]).to eq(ppath) end end context 'xpath ending with collectionobjects_nagpra' do - before(:all) do - @h = @anthro_object_handler.mapper.xpath['collectionobjects_nagpra'] - end + let(:xpath) { 'collectionobjects_nagpra' } + it 'has 5 children' do - expect(@h[:children].size).to eq(5) + expect(result[:children].size).to eq(5) end end end end + context 'bonsai profile' do - context 'conservation record type' do + let(:client) { bonsai_client } + let(:cache) { bonsai_cache } + + context 'conservation record' do + let(:mapperpath) { 'spec/fixtures/files/mappers/release_6_1/bonsai/bonsai_4-1-1_conservation.json' } + context 'xpath ending with fertilizersToBeUsed' do + let(:xpath) { 'conservation_livingplant/fertilizationGroupList/fertilizationGroup/fertilizersToBeUsed' } it 'is a repeating group' do - h = @bonsai_conservation_handler.mapper.xpath - res = h['conservation_livingplant/fertilizationGroupList/fertilizationGroup/fertilizersToBeUsed'][:is_group] - expect(res).to be true + expect(result[:is_group]).to be true end end + context 'xpath ending with conservators' do + let(:xpath) { 'conservation_common/conservators' } it 'is a repeating group' do - h = @bonsai_conservation_handler.mapper.xpath - res = h['conservation_common/conservators'][:is_group] - expect(res).to be false + expect(result[:is_group]).to be false end end end @@ -199,122 +228,130 @@ describe '#validate' do it 'returns CollectionSpace::Mapper::Response object' do data = {'objectNumber' => '123'} - result = @anthro_object_handler.validate(data) + result = handler.validate(data) expect(result).to be_a(CollectionSpace::Mapper::Response) end end describe '#check_fields' do - before(:all) do - @data = { - 'conservationNumber' => '123', - 'status' => 'good', - 'conservator' => 'Someone' - } - end - it 'returns expected hash' do - expect = { - known_fields: %w[conservationnumber status], - unknown_fields: %w[conservator] - } + let(:result) { handler.check_fields(data) } + context 'bonsai profile' do + let(:client) { bonsai_client } + let(:cache) { bonsai_cache } + + context 'conservation record' do + let(:mapperpath) { 'spec/fixtures/files/mappers/release_6_1/bonsai/bonsai_4-1-1_conservation.json' } + let(:data) do + { + 'conservationNumber' => '123', + 'status' => 'good', + 'conservator' => 'Someone' + } + end + + it 'returns expected hash' do + expected = { + known_fields: %w[conservationnumber status], + unknown_fields: %w[conservator] + } + expect(result).to eq(expected) + end + end end end + describe '#prep' do - before(:all) do - @data = {'objectNumber' => '123'} - end + let(:data) { {'objectNumber' => '123'} } + it 'can be called with response from validation' do - vresult = @anthro_object_handler.validate(@data) - result = @anthro_object_handler.prep(vresult).response + vresult = handler.validate(data) + result = handler.prep(vresult).response expect(result).to be_a(CollectionSpace::Mapper::Response) end + it 'can be called with just data' do - result = @anthro_object_handler.prep(@data).response + result = handler.prep(data).response expect(result).to be_a(CollectionSpace::Mapper::Response) end + context 'when response_mode = normal' do - it 'returned response to include detailed data transformation info needed for mapping' do - result = @anthro_object_handler.prep(@data).response + let(:config) { {response_mode: 'normal'} } + + it 'returned response includes detailed data transformation info needed for mapping' do + result = handler.prep(data).response + expect(result.transformed_data).not_to be_empty end end + context 'when response_mode = verbose' do + let(:config) { {response_mode: 'verbose'} } + it 'returned response includes detailed data transformation info' do - config = {response_mode: 'verbose'} - handler = CollectionSpace::Mapper::DataHandler.new(record_mapper: @anthro_object_mapper, - client: @anthro_client, - cache: @anthro_cache, - config: config) - result = handler.prep(@data).response + result = handler.prep(data).response expect(result.transformed_data).not_to be_empty end end end describe '#process', services_call: true do - before(:all) do - @data = {'objectNumber' => '123'} - end + let(:data) { {'objectNumber' => '123'} } + it 'can be called with response from validation' do - vresult = @anthro_object_handler.validate(@data) - result = @anthro_object_handler.process(vresult) + vresult = handler.validate(data) + result = handler.process(vresult) expect(result).to be_a(CollectionSpace::Mapper::Response) end + it 'can be called with just data' do - result = @anthro_object_handler.process(@data) + result = handler.process(data) expect(result).to be_a(CollectionSpace::Mapper::Response) end + context 'when response_mode = normal' do it 'returned response omits detailed data transformation info' do - result = @anthro_object_handler.process(@data) + result = handler.process(data) expect(result.transformed_data).to be_empty end end + context 'when response_mode = verbose' do + let(:config) { {response_mode: 'verbose'} } + it 'returned response includes detailed data transformation info' do - config = {response_mode: 'verbose'} - handler = CollectionSpace::Mapper::DataHandler.new(record_mapper: @anthro_object_mapper, - client: @anthro_client, - cache: @anthro_cache, - config: config) - result = handler.process(@data) + result = handler.process(data) expect(result.transformed_data).not_to be_empty end end end describe '#map', services_call: true do - before(:all) do - @data = {'objectNumber' => '123'} - prepper = CollectionSpace::Mapper::DataPrepper.new(@data, @anthro_object_handler) - prep_response = @anthro_object_handler.prep(@data).response - @result = @anthro_object_handler.map(prep_response, prepper.xphash) - end + let(:data) { {'objectNumber' => '123'} } + let(:prepper) { CollectionSpace::Mapper::DataPrepper.new(data, handler) } + let(:prepped) { handler.prep(data).response } + let(:result) { handler.map(prepped, prepper.xphash) } + it 'returns CollectionSpace::Mapper::Response object' do - expect(@result).to be_a(CollectionSpace::Mapper::Response) + expect(result).to be_a(CollectionSpace::Mapper::Response) end it 'the CollectionSpace::Mapper::Response object doc attribute is a Nokogiri XML Document' do - expect(@result.doc).to be_a(Nokogiri::XML::Document) + expect(result.doc).to be_a(Nokogiri::XML::Document) end context 'when response_mode = normal' do it 'returned response omits detailed data transformation info' do - expect(@result.transformed_data).to be_empty + expect(result.transformed_data).to be_empty end end context 'when response_mode = verbose' do + let(:config) { {'response_mode' => 'verbose'} } it 'returned response includes detailed data transformation info' do - config = {'response_mode' => 'verbose'} - handler = CollectionSpace::Mapper::DataHandler.new(record_mapper: @anthro_object_mapper, - client: @anthro_client, - cache: @anthro_cache, - config: config) - prepper = CollectionSpace::Mapper::DataPrepper.new(@data, handler) - result = handler.map(handler.prep(@data).response, prepper.xphash) expect(result.transformed_data).not_to be_empty end end end end + + diff --git a/spec/collectionspace/mapper/term_handler_spec.rb b/spec/collectionspace/mapper/term_handler_spec.rb index b71ce449..2181da86 100644 --- a/spec/collectionspace/mapper/term_handler_spec.rb +++ b/spec/collectionspace/mapper/term_handler_spec.rb @@ -107,9 +107,15 @@ end context 'when new term is subsequently encountered' do - it 'the term is treated as found' do + it 'the term is still treated as not found' do + first_handler = CS::Mapper::TermHandler.new(mapping: colmapping, + data: data, + client: client, + cache: termcache, + mapper: recmapper) + chk = terms.select{ |h| h[:found] } - expect(chk.length).to eq(3) + expect(chk.length).to eq(2) end end end @@ -123,17 +129,10 @@ found = th.terms.select{ |h| h[:found] } not_found = th.terms.select{ |h| !h[:found] } expect(terms.length).to eq(3) - expect(found.length).to eq(1) + expect(found.length).to eq(0) expect(not_found.first[:refname].display_name).to eq('Reference 3') end end - - context 'when new term is subsequently encountered' do - it 'the term is treated as found' do - chk = th.terms.select{ |h| h[:found] } - expect(chk.length).to eq(3) - end - end end end end diff --git a/spec/collectionspace/mapper/term_searchable_spec.rb b/spec/collectionspace/mapper/term_searchable_spec.rb index 65495985..a857fa2b 100644 --- a/spec/collectionspace/mapper/term_searchable_spec.rb +++ b/spec/collectionspace/mapper/term_searchable_spec.rb @@ -7,23 +7,21 @@ class TermClass attr_accessor :type, :subtype, :errors include CS::Mapper::TermSearchable - def initialize(cache, client) + def initialize(cache, client, type, subtype) @cache = cache @client = client - @type = 'conceptauthorities' - @subtype = 'concept' + @type = type + @subtype = subtype @errors = [] end end RSpec.describe CollectionSpace::Mapper::TermSearchable do - before(:context) do - @cache = core_cache - populate_core(@cache) - end - - let(:term){ TermClass.new(@cache, core_client) } + let(:cache) { core_cache } + let(:termtype) { 'conceptauthorities' } + let(:termsubtype) { 'concept' } + let(:term){ TermClass.new(cache, core_client, termtype, termsubtype) } describe '#in_cache?' do let(:result){ term.in_cache?(val) } @@ -40,8 +38,33 @@ def initialize(cache, client) expect(result).to be true end end + + context 'when captitalized form is in cache' do + let(:val){ 'test' } + it 'returns true' do + expect(result).to be true + end + end end + describe '#cached_as_unknown?' do + let(:result) { term.cached_as_unknown?(val) } + let(:val){ 'blahblahblah' } + + context 'when not cached as unknown value' do + it 'returns false' do + expect(result).to be false + end + end + + context 'when cached as unknown value' do + it 'returns true' do + cache.put('unknownvalue', "#{termtype}/#{termsubtype}", val, nil) + expect(result).to be true + end + end + end + describe '#cached_term' do let(:result){ term.cached_term(val) } context 'when not in cache' do @@ -58,12 +81,42 @@ def initialize(cache, client) expect(result).to eq(expected) end end + + context 'when capitalized form is in cache' do + let(:val){ 'test' } + it 'returns refname urn' do + expected = "urn:cspace:core.collectionspace.org:conceptauthorities:name(concept):item:name(Test1599650854716)'Test'" + expect(result).to eq(expected) + end + end + end + + describe '#searched_term' do + let(:termtype) { 'vocabularies' } + let(:termsubtype) { 'publishto' } + let(:result){ term.searched_term(val) } + + context 'when val exists in instance' do + let(:val) { 'All' } + it 'returns refname urn' do + expected = "urn:cspace:core.collectionspace.org:vocabularies:name(publishto):item:name(all)'All'" + expect(result).to eq(expected) + end + end + + context 'when case-swapped val exists in instance' do + let(:val) { 'all' } + it 'returns refname urn' do + expected = "urn:cspace:core.collectionspace.org:vocabularies:name(publishto):item:name(all)'All'" + expect(result).to eq(expected) + end + end end - # also covers extract_refname_csid and lookup_obj_csid + # also covers lookup_obj_csid describe '#obj_csid' do - let(:result){ term.obj_csid(objnum, type) } let(:type){ 'collectionobjects' } + let(:result){ term.obj_csid(objnum, type) } context 'when in cache' do let(:objnum){ 'Hierarchy Test 001' } @@ -84,9 +137,9 @@ def initialize(cache, client) let(:result){ term.term_csid(val) } context 'when in cache' do let(:val){ 'Sample Concept 1' } - - it 'returns csid', :skip => 'does not cause mapping to fail, so we live with technical incorrectness for now' do - expect(result).to eq('c119ed04-d99d-4ea2-bbda') + it 'returns csid' do + #it 'returns csid', :skip => 'does not cause mapping to fail, so we live with technical incorrectness for now' do + expect(result).to eq('1111-2222-3333-4444') end end diff --git a/spec/core_helpers.rb b/spec/core_helpers.rb index 9998db94..b9e58e09 100644 --- a/spec/core_helpers.rb +++ b/spec/core_helpers.rb @@ -39,189 +39,189 @@ def core_object_mapper def populate_core(cache) terms = [ - ['citationauthorities', 'citation', 'Arthur', "urn:cspace:core.collectionspace.org:citationauthorities:name(citation):item:name(Arthur62605812848)'Arthur'"], - ['citationauthorities', 'citation', 'Harding', "urn:cspace:core.collectionspace.org:citationauthorities:name(citation):item:name(Harding2510592089)'Harding'"], - ['citationauthorities', 'citation', 'Wanting', "urn:cspace:core.collectionspace.org:citationauthorities:name(citation):item:name(Wanting1599560009399)'Wanting'"], - ['citationauthorities', 'citation', 'makasi', "urn:cspace:core.collectionspace.org:citationauthorities:name(citation):item:name(makasi1599645537547)'makasi'"], - ['citationauthorities', 'worldcat', 'Chelse', "urn:cspace:core.collectionspace.org:citationauthorities:name(worldcat):item:name(Chelse1599645525740)'Chelse'"], - ['citationauthorities', 'worldcat', 'Patiently', "urn:cspace:core.collectionspace.org:citationauthorities:name(worldcat):item:name(Patiently1599559993332)'Patiently'"], - ['collectionobjects', '', 'Hierarchy Test 001', "urn:cspace:core.collectionspace.org:collectionobjects:id(16161bff-b01a-4b55-95aa)'Hierarchy Test 001'"], - ['conceptauthorities', 'concept', 'Test', "urn:cspace:core.collectionspace.org:conceptauthorities:name(concept):item:name(Test1599650854716)'Test'"], - ['conceptauthorities', 'concept', 'Sample Concept 1', "urn:cspace:core.collectionspace.org:conceptauthorities:name(concept):item:name(SampleConcept11581354228875)'Sample Concept 1'"], - ['conceptauthorities', 'concept', 'Uno', "urn:cspace:core.collectionspace.org:conceptauthorities:name(concept):item:name(Uno1599645111177)'Uno'"], - ['conceptauthorities', 'occasion', 'Computer', "urn:cspace:core.collectionspace.org:conceptauthorities:name(occasion):item:name(Computer1599734104251)'Computer'"], - ['locationauthorities', 'indeterminate', '~Indeterminate Location~', "urn:cspace:indeterminate:locationauthorities:name(indeterminate):item:name(indeterminate)'~Indeterminate Location~'"], - ['locationauthorities', 'location', 'Abardares', "urn:cspace:core.collectionspace.org:locationauthorities:name(location):item:name(Abardares1599557570049)'Abardares'"], - ['locationauthorities', 'location', 'Kalif', "urn:cspace:core.collectionspace.org:locationauthorities:name(location):item:name(Kalif1599734233745)'Kalif'"], - ['locationauthorities', 'location', 'Khago', "urn:cspace:core.collectionspace.org:locationauthorities:name(location):item:name(Khago1599559772718)'Khago'"], - ['locationauthorities', 'location', 'Stay', "urn:cspace:core.collectionspace.org:locationauthorities:name(offsite_sla):item:name(Stay1599559824865)'Stay'"], - ['locationauthorities', 'offsite_sla', 'Lavington', "urn:cspace:core.collectionspace.org:locationauthorities:name(offsite_sla):item:name(Lavington1599144699983)'Lavington'"], - ['locationauthorities', 'offsite_sla', 'Ngong', "urn:cspace:core.collectionspace.org:locationauthorities:name(offsite_sla):item:name(Ngong1599557586466)'Ngong'"], - ['locationauthorities', 'offsite_sla', 'Stay', "urn:cspace:core.collectionspace.org:locationauthorities:name(offsite_sla):item:name(Stay)'Stay'"], - ['orgauthorities', 'organization', '2021', "urn:cspace:core.collectionspace.org:orgauthorities:name(organization):item:name(20211599147173971)'2021'"], - ['orgauthorities', 'organization', 'Astroworld', "urn:cspace:core.collectionspace.org:orgauthorities:name(organization):item:name(Astroworld1599650794829)'Astroworld'"], - ['orgauthorities', 'organization', 'Broker', "urn:cspace:core.collectionspace.org:orgauthorities:name(organization):item:name(Broker1599221487572)'Broker'"], - ['orgauthorities', 'organization', 'But Ohh', "urn:cspace:core.collectionspace.org:orgauthorities:name(organization):item:name(ButOhh1599665031368)'But Ohh'"], - ['orgauthorities', 'organization', 'Cuckoo', "urn:cspace:core.collectionspace.org:orgauthorities:name(organization):item:name(Cuckoo1599463786824)'Cuckoo'"], - ['orgauthorities', 'organization', 'Ibiza', "urn:cspace:core.collectionspace.org:orgauthorities:name(organization):item:name(Ibiza1599650806827)'Ibiza'"], - ['orgauthorities', 'organization', 'Joseph Hills', "urn:cspace:core.collectionspace.org:orgauthorities:name(organization):item:name(JosephHills1599463935463)'Joseph Hills'"], - ['orgauthorities', 'organization', 'Kremling', "urn:cspace:core.collectionspace.org:orgauthorities:name(organization):item:name(Kremling1599464161204)'Kremling'"], - ['orgauthorities', 'organization', 'MMG', "urn:cspace:core.collectionspace.org:orgauthorities:name(organization):item:name(MMG1599569514486)'MMG'"], - ['orgauthorities', 'organization', 'Martin', "urn:cspace:core.collectionspace.org:orgauthorities:name(organization):item:name(Martin1599559712783)'Martin'"], - ['orgauthorities', 'organization', 'Ninja', "urn:cspace:core.collectionspace.org:orgauthorities:name(organization):item:name(Ninja1599147339325)'Ninja'"], - ['orgauthorities', 'organization', 'Oval', "urn:cspace:core.collectionspace.org:orgauthorities:name(organization):item:name(Oval1599650891221)'Oval'"], - ['orgauthorities', 'organization', 'Podoa', "urn:cspace:core.collectionspace.org:orgauthorities:name(organization):item:name(Podoa1599645346399)'Podoa'"], - ['orgauthorities', 'organization', 'Rock Nation', "urn:cspace:core.collectionspace.org:orgauthorities:name(organization):item:name(RockNation1599569481908)'Rock Nation'"], - ['orgauthorities', 'organization', 'Sidarec', "urn:cspace:core.collectionspace.org:orgauthorities:name(organization):item:name(Sidarec1599210955079)'Sidarec'"], - ['orgauthorities', 'organization', 'TIm Herod', "urn:cspace:core.collectionspace.org:orgauthorities:name(organization):item:name(TImHerod1599144655199)'TIm Herod'"], - ['orgauthorities', 'organization', 'Tasia', "urn:cspace:core.collectionspace.org:orgauthorities:name(organization):item:name(Tasia1599734050597)'Tasia'"], - ['orgauthorities', 'organization', 'Tesla', "urn:cspace:core.collectionspace.org:orgauthorities:name(organization):item:name(Tesla1599144565539)'Tesla'"], - ['orgauthorities', 'organization', 'Walai', "urn:cspace:core.collectionspace.org:orgauthorities:name(organization):item:name(Walai1599645181370)'Walai'"], - ['orgauthorities', 'organization', 'breakup', "urn:cspace:core.collectionspace.org:orgauthorities:name(organization):item:name(breakup1599559909048)'breakup'"], - ['orgauthorities', 'organization', 'fggf', "urn:cspace:core.collectionspace.org:orgauthorities:name(organization):item:name(fggf1599552009173)'fggf'"], - ['orgauthorities', 'organization', 'pandemic', "urn:cspace:core.collectionspace.org:orgauthorities:name(organization):item:name(pandemic1599645036126)'pandemic'"], - ['orgauthorities', 'organization', 'pop', "urn:cspace:core.collectionspace.org:orgauthorities:name(organization):item:name(pop1599664789385)'pop'"], - ['orgauthorities', 'organization', 'pupu', "urn:cspace:core.collectionspace.org:orgauthorities:name(organization):item:name(pupu1599645415676)'pupu'"], - ['orgauthorities', 'organization', 'tent', "urn:cspace:core.collectionspace.org:orgauthorities:name(organization):item:name(tent1599664807586)'tent'"], - ['orgauthorities', 'ulan_oa', 'Again', "urn:cspace:core.collectionspace.org:orgauthorities:name(ulan_oa):item:name(Again1599559881266)'Again'"], - ['orgauthorities', 'ulan_oa', 'Signal', "urn:cspace:core.collectionspace.org:orgauthorities:name(ulan_oa):item:name(Signal1599559737158)'Signal'"], - ['orgauthorities', 'ulan_oa', 'Very fats', "urn:cspace:core.collectionspace.org:orgauthorities:name(ulan_oa):item:name(Veryfats1599645188567)'Very fats'"], - ['personauthorities', 'person', 'Broooks', "urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(Broooks1599221558583)'Broooks'"], - ['personauthorities', 'person', '2020', "urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(20201599147149106)'2020'"], - ['personauthorities', 'person', '254Glock', "urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(254Glock1599569494651)'254Glock'"], - ['personauthorities', 'person', 'Abel', "urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(Abel1599464025893)'Abel'"], - ['personauthorities', 'person', 'Alexa', "urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(Alexa1599557607978)'Alexa'"], - ['personauthorities', 'person', 'Andrew Watts', "urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(AndrewWatts1599144553996)'Andrew Watts'"], - ['personauthorities', 'person', 'Busy', "urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(Busy1599559723432)'Busy'"], - ['personauthorities', 'person', 'Cardi', "urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(Cardi1599569468209)'Cardi'"], - ['personauthorities', 'person', 'Clemo', "urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(Clemo1599221473000)'Clemo'"], - ['personauthorities', 'person', 'Clon', "urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(Clon1599569543362)'Clon'"], - ['personauthorities', 'person', 'Comodore', "urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(Comodore1599463826401)'Comodore'"], - ['personauthorities', 'person', 'Comrade', "urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(Comrade1599664745661)'Comrade'"], - ['personauthorities', 'person', 'Cooper Phil', "urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(CooperPhil1599144599479)'Cooper Phil'"], - ['personauthorities', 'person', 'Disturb', "urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(Disturb1599665062738)'Disturb'"], - ['personauthorities', 'person', 'Dudu', "urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(Dudu1599645410044)'Dudu'"], - ['personauthorities', 'person', 'Erick', "urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(Erick1599734121151)'Erick'"], - ['personauthorities', 'person', 'First Layer', "urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(FirstLayer1599463905818)'First Layer'"], - ['personauthorities', 'person', 'Glock', "urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(Glock1599580905730)'Glock'"], - ['personauthorities', 'person', 'Gomongo', "urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(Gomongo1599463746195)'Gomongo'"], - ['personauthorities', 'person', 'Grace', "urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(Grace1599569599918)'Grace'"], - ['personauthorities', 'person', 'Henry', "urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(Henry1599210937770)'Henry'"], - ['personauthorities', 'person', 'Home Alone', "urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(HomeAlone1599144524188)'Home Alone'"], - ['personauthorities', 'person', 'James', "urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(James1599210943727)'James'"], - ['personauthorities', 'person', 'Jamo', "urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(Jamo1599221465693)'Jamo'"], - ['personauthorities', 'person', 'Joel', "urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(Joel1599557736045)'Joel'"], - ['personauthorities', 'person', 'John Allen', "urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(JohnAllen1599144390263)'John Allen'"], - ['personauthorities', 'person', 'John Kay', "urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(JohnKay1599210868122)'John Kay'"], - ['personauthorities', 'person', 'Kali', "urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(Kali1599221504661)'Kali'"], - ['personauthorities', 'person', 'Karanja', "urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(Karanja1599211015378)'Karanja'"], - ['personauthorities', 'person', 'Kev', "urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(Kev1599058769862)'Kev'"], - ['personauthorities', 'person', 'Kimani', "urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(Kimani1599210926973)'Kimani'"], - ['personauthorities', 'person', 'Kimonda', "urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(Kimonda1599211004900)'Kimonda'"], - ['personauthorities', 'person', 'King Kosa', "urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(KingKosa1599569726990)'King Kosa'"], - ['personauthorities', 'person', 'Kinuthia', "urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(Kinuthia1599734017515)'Kinuthia'"], - ['personauthorities', 'person', 'Lebron', "urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(Lebron1599557725925)'Lebron'"], - ['personauthorities', 'person', 'Lima', "urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(Lima1599645323459)'Lima'"], - ['personauthorities', 'person', 'Loan', "urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(Loan1599210896616)'Loan'"], - ['personauthorities', 'person', 'Mark Smith', "urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(MarkSmith)'Mark Smith'"], - ['personauthorities', 'person', 'Meghan', "urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(Meghan1599569567326)'Meghan'"], - ['personauthorities', 'person', 'Nyauma', "urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(Nyauma1599210983879)'Nyauma'"], - ['personauthorities', 'person', 'Scribe', "urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(Scribe1599645240974)'Scribe'"], - ['personauthorities', 'person', 'Shen Yeng', "urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(ShenYeng1599569685887)'Shen Yeng'"], - ['personauthorities', 'person', 'Soi', "urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(Soi1599734190999)'Soi'"], - ['personauthorities', 'person', 'Switch', "urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(Switch1599645085995)'Switch'"], - ['personauthorities', 'person', 'Tim Joes', "urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(TimJoes1599144424859)'Tim Joes'"], - ['personauthorities', 'person', 'Trepoz', "urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(Trepoz1599221497512)'Trepoz'"], - ['personauthorities', 'person', 'Trevor', "urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(Trevor1599144536281)'Trevor'"], - ['personauthorities', 'person', 'Troy', "urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(Troy1599144360617)'Troy'"], - ['personauthorities', 'person', 'afa', "urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(afa1599645004939)'afa'"], - ['personauthorities', 'person', 'cxcx', "urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(cxcx1599551790384)'cxcx'"], - ['personauthorities', 'person', 'dfdd', "urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(dfdd1599551799173)'dfdd'"], - ['personauthorities', 'person', 'dssd', "urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(dssd1599552004115)'dssd'"], - ['personauthorities', 'person', 'fgfgf', "urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(fgfgf1599551987166)'fgfgf'"], - ['personauthorities', 'person', 'giri', "urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(giri1599645613143)'giri'"], - ['personauthorities', 'person', 'high grade', "urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(highgrade1599645597889)'high grade'"], - ['personauthorities', 'person', 'malik', "urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(malik1599664876144)'malik'"], - ['personauthorities', 'person', 'marcus', "urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(marcus1599650918612)'marcus'"], - ['personauthorities', 'person', 'marley', "urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(marley1599650874712)'marley'"], - ['personauthorities', 'person', 'rights', "urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(rights1599650868011)'rights'"], - ['personauthorities', 'person', 'rudelyt', "urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(rudelyt1599664917218)'rudelyt'"], - ['personauthorities', 'person', 'sasa', "urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(sasa1599551852678)'sasa'"], - ['personauthorities', 'person', 'tint', "urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(tint1599664800144)'tint'"], - ['personauthorities', 'person', 'tonight', "urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(tonight1599664781376)'tonight'"], - ['personauthorities', 'ulan_pa', 'Chrus', "urn:cspace:core.collectionspace.org:personauthorities:name(ulan_pa):item:name(Chrus1599559702930)'Chrus'"], - ['personauthorities', 'ulan_pa', 'We go', "urn:cspace:core.collectionspace.org:personauthorities:name(ulan_pa):item:name(Wego1599559866517)'We go'"], - ['personauthorities', 'ulan_pa', 'panda nayo', "urn:cspace:core.collectionspace.org:personauthorities:name(ulan_pa):item:name(pandanayo1599645094507)'panda nayo'"], - ['placeauthorities', 'place', 'Chillspot', "urn:cspace:core.collectionspace.org:placeauthorities:name(place):item:name(Chillspot1599145441945)'Chillspot'"], - ['placeauthorities', 'tgn_place', 'mzingga', "urn:cspace:core.collectionspace.org:placeauthorities:name(tgn_place):item:name(mzingga1599645587502)'mzingga'"], - ['vocabularies', 'agequalifier', 'older than', "urn:cspace:core.collectionspace.org:vocabularies:name(agequalifier):item:name(olderthan)'older than'"], - ['vocabularies', 'collectionmethod', 'donation', "urn:cspace:core.collectionspace.org:vocabularies:name(collectionmethod):item:name(donation)'donation'"], - ['vocabularies', 'collectionmethod', 'excavation', "urn:cspace:core.collectionspace.org:vocabularies:name(collectionmethod):item:name(excavation)'excavation'"], - ['vocabularies', 'conditioncheckmethod', 'Observed', "urn:cspace:core.collectionspace.org:vocabularies:name(conditioncheckmethod):item:name(observed)'Observed'"], - ['vocabularies', 'conditioncheckreason', 'Damaged in transit', "urn:cspace:core.collectionspace.org:vocabularies:name(conditioncheckreason):item:name(damagedintransit)'Damaged in transit'"], - ['vocabularies', 'conditionfitness', 'Reasonable', "urn:cspace:core.collectionspace.org:vocabularies:name(conditionfitness):item:name(reasonable)'Reasonable'"], - ['vocabularies', 'conservationstatus', 'Analysis complete', "urn:cspace:core.collectionspace.org:vocabularies:name(conservationstatus):item:name(analysiscomplete)'Analysis complete'"], - ['vocabularies', 'conservationstatus', 'Treatment approved', "urn:cspace:core.collectionspace.org:vocabularies:name(conservationstatus):item:name(treatmentapproved)'Treatment approved'"], - ['vocabularies', 'conservationstatus', 'Treatment in progress', "urn:cspace:core.collectionspace.org:vocabularies:name(conservationstatus):item:name(treatmentinprogress)'Treatment in progress'"], - ['vocabularies', 'currency', 'Canadian Dollar', "urn:cspace:core.collectionspace.org:vocabularies:name(currency):item:name(CAD)'Canadian Dollar'"], - ['vocabularies', 'currency', 'Danish Krone', "urn:cspace:core.collectionspace.org:vocabularies:name(currency):item:name(DKK)'Danish Krone'"], - ['vocabularies', 'currency', 'Euro', "urn:cspace:core.collectionspace.org:vocabularies:name(currency):item:name(EUR)'Euro'"], - ['vocabularies', 'currency', 'Pound Sterling', "urn:cspace:core.collectionspace.org:vocabularies:name(currency):item:name(GBP)'Pound Sterling'"], - ['vocabularies', 'currency', 'Swedish Krona', "urn:cspace:core.collectionspace.org:vocabularies:name(currency):item:name(SEK)'Swedish Krona'"], - ['vocabularies', 'currency', 'Swiss Franc', "urn:cspace:core.collectionspace.org:vocabularies:name(currency):item:name(CHF)'Swiss Franc'"], - ['vocabularies', 'datecertainty', 'Circa', "urn:cspace:core.collectionspace.org:vocabularies:name(datecertainty):item:name(circa)'Circa'"], - ['vocabularies', 'dateera', 'BCE', "urn:cspace:core.collectionspace.org:vocabularies:name(dateera):item:name(bce)'BCE'"], - ['vocabularies', 'dateera', 'CE', "urn:cspace:core.collectionspace.org:vocabularies:name(dateera):item:name(ce)'CE'"], - ['vocabularies', 'datequalifier', 'Day(s)', "urn:cspace:core.collectionspace.org:vocabularies:name(datequalifier):item:name(days)'Day(s)'"], - ['vocabularies', 'datequalifier', 'Year(s)', "urn:cspace:core.collectionspace.org:vocabularies:name(datequalifier):item:name(years)'Year(s)'"], - ['vocabularies', 'deaccessionapprovalgroup', 'board of trustees', "urn:cspace:core.collectionspace.org:vocabularies:name(deaccessionapprovalgroup):item:name(board_of_trustees)'board of trustees'"], - ['vocabularies', 'deaccessionapprovalgroup', 'collection committee', "urn:cspace:core.collectionspace.org:vocabularies:name(deaccessionapprovalgroup):item:name(collection_committee)'collection committee'"], - ['vocabularies', 'deaccessionapprovalgroup', 'executive committee', "urn:cspace:core.collectionspace.org:vocabularies:name(deaccessionapprovalgroup):item:name(executive_committee)'executive committee'"], - ['vocabularies', 'deaccessionapprovalstatus', 'approved', "urn:cspace:core.collectionspace.org:vocabularies:name(deaccessionapprovalstatus):item:name(approved)'approved'"], - ['vocabularies', 'deaccessionapprovalstatus', 'not approved', "urn:cspace:core.collectionspace.org:vocabularies:name(deaccessionapprovalstatus):item:name(not_approved)'not approved'"], - ['vocabularies', 'deaccessionapprovalstatus', 'not required', "urn:cspace:core.collectionspace.org:vocabularies:name(deaccessionapprovalstatus):item:name(not_required)'not required'"], - ['vocabularies', 'disposalmethod', 'destruction', "urn:cspace:core.collectionspace.org:vocabularies:name(disposalmethod):item:name(destruction)'destruction'"], - ['vocabularies', 'entrymethod', 'Found on doorstep', "urn:cspace:core.collectionspace.org:vocabularies:name(entrymethod):item:name(foundondoorstep)'Found on doorstep'"], - ['vocabularies', 'entrymethod', 'Post', "urn:cspace:core.collectionspace.org:vocabularies:name(entrymethod):item:name(post)'Post'"], - ['vocabularies', 'examinationphase', 'before treatment', "urn:cspace:core.collectionspace.org:vocabularies:name(examinationphase):item:name(beforetreatment)'before treatment'"], - ['vocabularies', 'examinationphase', 'during treatment', "urn:cspace:core.collectionspace.org:vocabularies:name(examinationphase):item:name(duringtreatment)'during treatment'"], - ['vocabularies', 'exhibitionpersonrole', 'Educator', "urn:cspace:core.collectionspace.org:vocabularies:name(exhibitionpersonrole):item:name(educator)'Educator'"], - ['vocabularies', 'exhibitionpersonrole', 'Public programs coordinator', "urn:cspace:core.collectionspace.org:vocabularies:name(exhibitionpersonrole):item:name(publicprogramscoordinator)'Public programs coordinator'"], - ['vocabularies', 'exhibitionreferencetype', 'News article', "urn:cspace:core.collectionspace.org:vocabularies:name(exhibitionreferencetype):item:name(newsarticle)'News article'"], - ['vocabularies', 'exhibitionreferencetype', 'Press release', "urn:cspace:core.collectionspace.org:vocabularies:name(exhibitionreferencetype):item:name(pressrelease)'Press release'"], - ['vocabularies', 'exhibitionstatus', 'Preliminary object list created', "urn:cspace:core.collectionspace.org:vocabularies:name(exhibitionstatus):item:name(preliminaryobjectlistcreated)'Preliminary object list created'"], - ['vocabularies', 'exhibitiontype', 'Temporary', "urn:cspace:core.collectionspace.org:vocabularies:name(exhibitiontype):item:name(temporary)'Temporary'"], - ['vocabularies', 'inventorystatus', 'accession status unclear', "urn:cspace:core.collectionspace.org:vocabularies:name(inventorystatus):item:name(accessionstatusunclear)'accession status unclear'"], - ['vocabularies', 'inventorystatus', 'destroyed', "urn:cspace:core.collectionspace.org:vocabularies:name(inventorystatus):item:name(destroyed)'destroyed'"], - ['vocabularies', 'inventorystatus', 'unknown', "urn:cspace:core.collectionspace.org:vocabularies:name(inventorystatus):item:name(unknown)'unknown'"], - ['vocabularies', 'languages', 'Ancient Greek', "urn:cspace:core.collectionspace.org:vocabularies:name(languages):item:name(grc)'Ancient Greek'"], - ['vocabularies', 'languages', 'Armenian', "urn:cspace:core.collectionspace.org:vocabularies:name(languages):item:name(hye)'Armenian'"], - ['vocabularies', 'languages', 'English', "urn:cspace:core.collectionspace.org:vocabularies:name(languages):item:name(eng)'English'"], - ['vocabularies', 'languages', 'French', "urn:cspace:core.collectionspace.org:vocabularies:name(languages):item:name(fra)'French'"], - ['vocabularies', 'languages', 'Malaysian', "urn:cspace:core.collectionspace.org:vocabularies:name(languages):item:name(mal)'Malaysian'"], - ['vocabularies', 'languages', 'Spanish', "urn:cspace:core.collectionspace.org:vocabularies:name(languages):item:name(spa)'Spanish'"], - ['vocabularies', 'languages', 'Swahili', "urn:cspace:core.collectionspace.org:vocabularies:name(languages):item:name(swa)'Swahili'"], - ['vocabularies', 'loanoutstatus', 'Authorized', "urn:cspace:core.collectionspace.org:vocabularies:name(loanoutstatus):item:name(authorized)'Authorized'"], - ['vocabularies', 'loanoutstatus', 'Photography requested', "urn:cspace:core.collectionspace.org:vocabularies:name(loanoutstatus):item:name(photographyrequested)'Photography requested'"], - ['vocabularies', 'loanoutstatus', 'Refused', "urn:cspace:core.collectionspace.org:vocabularies:name(loanoutstatus):item:name(refused)'Refused'"], - ['vocabularies', 'loanoutstatus', 'Returned', "urn:cspace:core.collectionspace.org:vocabularies:name(loanoutstatus):item:name(returned)'Returned'"], - ['vocabularies', 'newsarticle', 'News article', "urn:cspace:core.collectionspace.org:vocabularies:name(exhibitionreferencetype):item:name(newsarticle)'News article'"], - ['vocabularies', 'otherpartyrole', 'Preparator', "urn:cspace:core.collectionspace.org:vocabularies:name(otherpartyrole):item:name(preparator)'Preparator'"], - ['vocabularies', 'otherpartyrole', 'Technician', "urn:cspace:core.collectionspace.org:vocabularies:name(otherpartyrole):item:name(technician)'Technician'"], - ['vocabularies', 'publishto', 'CollectionSpace Public Browser', "urn:cspace:core.collectionspace.org:vocabularies:name(publishto):item:name(cspacepub)'CollectionSpace Public Browser'"], - ['vocabularies', 'publishto', 'Culture Object', "urn:cspace:core.collectionspace.org:vocabularies:name(publishto):item:name(cultureobject)'Culture Object'"], - ['vocabularies', 'publishto', 'None', "urn:cspace:core.collectionspace.org:vocabularies:name(publishto):item:name(none)'None'"], - ['vocabularies', 'publishto', 'Omeka', "urn:cspace:core.collectionspace.org:vocabularies:name(publishto):item:name(omeka)'Omeka'"], - ['vocabularies', 'treatmentpurpose', 'Exhibition', "urn:cspace:core.collectionspace.org:vocabularies:name(treatmentpurpose):item:name(exhibition)'Exhibition'"], - ['vocabularies', 'uocauthorizationstatuses', 'Approved', "urn:cspace:core.collectionspace.org:vocabularies:name(uocauthorizationstatuses):item:name(approved)'Approved'"], - ['vocabularies', 'uoccollectiontypes', 'archeology', "urn:cspace:core.collectionspace.org:vocabularies:name(uoccollectiontypes):item:name(uocarcheology)'archeology'"], - ['vocabularies', 'uocmaterialtypes', 'bulb', "urn:cspace:core.collectionspace.org:vocabularies:name(uocmaterialtypes):item:name(bulb)'bulb'"], - ['vocabularies', 'uocmethods', 'class', "urn:cspace:core.collectionspace.org:vocabularies:name(uocmethods):item:name(class)'class'"], - ['vocabularies', 'uocstaffroles', 'greeter', "urn:cspace:core.collectionspace.org:vocabularies:name(uocstaffroles):item:name(greeter)'greeter'"], - ['vocabularies', 'uocsubcollections', 'Asia', "urn:cspace:core.collectionspace.org:vocabularies:name(uocsubcollections):item:name(uocsubcollection02)'Asia'"], - ['vocabularies', 'uocuserroles', 'faculty', "urn:cspace:core.collectionspace.org:vocabularies:name(uocuserroles):item:name(faculty)'faculty'"], - ['vocabularies', 'uocusertypes', 'lecturer', "urn:cspace:core.collectionspace.org:vocabularies:name(uocusertypes):item:name(lecturer)'lecturer'"], - ['workauthorities', 'work', 'Makeup', "urn:cspace:core.collectionspace.org:workauthorities:name(work):item:name(Makeup1608768998350)'Makeup'"], + ['citationauthorities', 'citation', 'Arthur', { refname: "urn:cspace:core.collectionspace.org:citationauthorities:name(citation):item:name(Arthur62605812848)'Arthur'", csid: '1111-2222-3333-4444' }], + ['citationauthorities', 'citation', 'Harding', { refname: "urn:cspace:core.collectionspace.org:citationauthorities:name(citation):item:name(Harding2510592089)'Harding'", csid: '1111-2222-3333-4444' }], + ['citationauthorities', 'citation', 'Wanting', { refname: "urn:cspace:core.collectionspace.org:citationauthorities:name(citation):item:name(Wanting1599560009399)'Wanting'", csid: '1111-2222-3333-4444' }], + ['citationauthorities', 'citation', 'makasi', { refname: "urn:cspace:core.collectionspace.org:citationauthorities:name(citation):item:name(makasi1599645537547)'makasi'", csid: '1111-2222-3333-4444' }], + ['citationauthorities', 'worldcat', 'Chelse', { refname: "urn:cspace:core.collectionspace.org:citationauthorities:name(worldcat):item:name(Chelse1599645525740)'Chelse'", csid: '1111-2222-3333-4444' }], + ['citationauthorities', 'worldcat', 'Patiently', { refname: "urn:cspace:core.collectionspace.org:citationauthorities:name(worldcat):item:name(Patiently1599559993332)'Patiently'", csid: '1111-2222-3333-4444' }], + ['collectionobjects', '', 'Hierarchy Test 001', { refname: "urn:cspace:core.collectionspace.org:collectionobjects:id(16161bff-b01a-4b55-95aa)'Hierarchy Test 001'", csid: '16161bff-b01a-4b55-95aa' }], + ['conceptauthorities', 'concept', 'Test', { refname: "urn:cspace:core.collectionspace.org:conceptauthorities:name(concept):item:name(Test1599650854716)'Test'", csid: '1111-2222-3333-4444' }], + ['conceptauthorities', 'concept', 'Sample Concept 1', { refname: "urn:cspace:core.collectionspace.org:conceptauthorities:name(concept):item:name(SampleConcept11581354228875)'Sample Concept 1'", csid: '1111-2222-3333-4444' }], + ['conceptauthorities', 'concept', 'Uno', { refname: "urn:cspace:core.collectionspace.org:conceptauthorities:name(concept):item:name(Uno1599645111177)'Uno'", csid: '1111-2222-3333-4444' }], + ['conceptauthorities', 'occasion', 'Computer', { refname: "urn:cspace:core.collectionspace.org:conceptauthorities:name(occasion):item:name(Computer1599734104251)'Computer'", csid: '1111-2222-3333-4444' }], + ['locationauthorities', 'indeterminate', '~Indeterminate Location~', { refname: "urn:cspace:indeterminate:locationauthorities:name(indeterminate):item:name(indeterminate)'~Indeterminate Location~'", csid: '1111-2222-3333-4444' }], + ['locationauthorities', 'location', 'Abardares', { refname: "urn:cspace:core.collectionspace.org:locationauthorities:name(location):item:name(Abardares1599557570049)'Abardares'", csid: '1111-2222-3333-4444' }], + ['locationauthorities', 'location', 'Kalif', { refname: "urn:cspace:core.collectionspace.org:locationauthorities:name(location):item:name(Kalif1599734233745)'Kalif'", csid: '1111-2222-3333-4444' }], + ['locationauthorities', 'location', 'Khago', { refname: "urn:cspace:core.collectionspace.org:locationauthorities:name(location):item:name(Khago1599559772718)'Khago'", csid: '1111-2222-3333-4444' }], + ['locationauthorities', 'location', 'Stay', { refname: "urn:cspace:core.collectionspace.org:locationauthorities:name(offsite_sla):item:name(Stay1599559824865)'Stay'", csid: '1111-2222-3333-4444' }], + ['locationauthorities', 'offsite_sla', 'Lavington', { refname: "urn:cspace:core.collectionspace.org:locationauthorities:name(offsite_sla):item:name(Lavington1599144699983)'Lavington'", csid: '1111-2222-3333-4444' }], + ['locationauthorities', 'offsite_sla', 'Ngong', { refname: "urn:cspace:core.collectionspace.org:locationauthorities:name(offsite_sla):item:name(Ngong1599557586466)'Ngong'", csid: '1111-2222-3333-4444' }], + ['locationauthorities', 'offsite_sla', 'Stay', { refname: "urn:cspace:core.collectionspace.org:locationauthorities:name(offsite_sla):item:name(Stay)'Stay'", csid: '1111-2222-3333-4444' }], + ['orgauthorities', 'organization', '2021', { refname: "urn:cspace:core.collectionspace.org:orgauthorities:name(organization):item:name(20211599147173971)'2021'", csid: '1111-2222-3333-4444' }], + ['orgauthorities', 'organization', 'Astroworld', { refname: "urn:cspace:core.collectionspace.org:orgauthorities:name(organization):item:name(Astroworld1599650794829)'Astroworld'", csid: '1111-2222-3333-4444' }], + ['orgauthorities', 'organization', 'Broker', { refname: "urn:cspace:core.collectionspace.org:orgauthorities:name(organization):item:name(Broker1599221487572)'Broker'", csid: '1111-2222-3333-4444' }], + ['orgauthorities', 'organization', 'But Ohh', { refname: "urn:cspace:core.collectionspace.org:orgauthorities:name(organization):item:name(ButOhh1599665031368)'But Ohh'", csid: '1111-2222-3333-4444' }], + ['orgauthorities', 'organization', 'Cuckoo', { refname: "urn:cspace:core.collectionspace.org:orgauthorities:name(organization):item:name(Cuckoo1599463786824)'Cuckoo'", csid: '1111-2222-3333-4444' }], + ['orgauthorities', 'organization', 'Ibiza', { refname: "urn:cspace:core.collectionspace.org:orgauthorities:name(organization):item:name(Ibiza1599650806827)'Ibiza'", csid: '1111-2222-3333-4444' }], + ['orgauthorities', 'organization', 'Joseph Hills', { refname: "urn:cspace:core.collectionspace.org:orgauthorities:name(organization):item:name(JosephHills1599463935463)'Joseph Hills'", csid: '1111-2222-3333-4444' }], + ['orgauthorities', 'organization', 'Kremling', { refname: "urn:cspace:core.collectionspace.org:orgauthorities:name(organization):item:name(Kremling1599464161204)'Kremling'", csid: '1111-2222-3333-4444' }], + ['orgauthorities', 'organization', 'MMG', { refname: "urn:cspace:core.collectionspace.org:orgauthorities:name(organization):item:name(MMG1599569514486)'MMG'", csid: '1111-2222-3333-4444' }], + ['orgauthorities', 'organization', 'Martin', { refname: "urn:cspace:core.collectionspace.org:orgauthorities:name(organization):item:name(Martin1599559712783)'Martin'", csid: '1111-2222-3333-4444' }], + ['orgauthorities', 'organization', 'Ninja', { refname: "urn:cspace:core.collectionspace.org:orgauthorities:name(organization):item:name(Ninja1599147339325)'Ninja'", csid: '1111-2222-3333-4444' }], + ['orgauthorities', 'organization', 'Oval', { refname: "urn:cspace:core.collectionspace.org:orgauthorities:name(organization):item:name(Oval1599650891221)'Oval'", csid: '1111-2222-3333-4444' }], + ['orgauthorities', 'organization', 'Podoa', { refname: "urn:cspace:core.collectionspace.org:orgauthorities:name(organization):item:name(Podoa1599645346399)'Podoa'", csid: '1111-2222-3333-4444' }], + ['orgauthorities', 'organization', 'Rock Nation', { refname: "urn:cspace:core.collectionspace.org:orgauthorities:name(organization):item:name(RockNation1599569481908)'Rock Nation'", csid: '1111-2222-3333-4444' }], + ['orgauthorities', 'organization', 'Sidarec', { refname: "urn:cspace:core.collectionspace.org:orgauthorities:name(organization):item:name(Sidarec1599210955079)'Sidarec'", csid: '1111-2222-3333-4444' }], + ['orgauthorities', 'organization', 'TIm Herod', { refname: "urn:cspace:core.collectionspace.org:orgauthorities:name(organization):item:name(TImHerod1599144655199)'TIm Herod'", csid: '1111-2222-3333-4444' }], + ['orgauthorities', 'organization', 'Tasia', { refname: "urn:cspace:core.collectionspace.org:orgauthorities:name(organization):item:name(Tasia1599734050597)'Tasia'", csid: '1111-2222-3333-4444' }], + ['orgauthorities', 'organization', 'Tesla', { refname: "urn:cspace:core.collectionspace.org:orgauthorities:name(organization):item:name(Tesla1599144565539)'Tesla'", csid: '1111-2222-3333-4444' }], + ['orgauthorities', 'organization', 'Walai', { refname: "urn:cspace:core.collectionspace.org:orgauthorities:name(organization):item:name(Walai1599645181370)'Walai'", csid: '1111-2222-3333-4444' }], + ['orgauthorities', 'organization', 'breakup', { refname: "urn:cspace:core.collectionspace.org:orgauthorities:name(organization):item:name(breakup1599559909048)'breakup'", csid: '1111-2222-3333-4444' }], + ['orgauthorities', 'organization', 'fggf', { refname: "urn:cspace:core.collectionspace.org:orgauthorities:name(organization):item:name(fggf1599552009173)'fggf'", csid: '1111-2222-3333-4444' }], + ['orgauthorities', 'organization', 'pandemic', { refname: "urn:cspace:core.collectionspace.org:orgauthorities:name(organization):item:name(pandemic1599645036126)'pandemic'", csid: '1111-2222-3333-4444' }], + ['orgauthorities', 'organization', 'pop', { refname: "urn:cspace:core.collectionspace.org:orgauthorities:name(organization):item:name(pop1599664789385)'pop'", csid: '1111-2222-3333-4444' }], + ['orgauthorities', 'organization', 'pupu', { refname: "urn:cspace:core.collectionspace.org:orgauthorities:name(organization):item:name(pupu1599645415676)'pupu'", csid: '1111-2222-3333-4444' }], + ['orgauthorities', 'organization', 'tent', { refname: "urn:cspace:core.collectionspace.org:orgauthorities:name(organization):item:name(tent1599664807586)'tent'", csid: '1111-2222-3333-4444' }], + ['orgauthorities', 'ulan_oa', 'Again', { refname: "urn:cspace:core.collectionspace.org:orgauthorities:name(ulan_oa):item:name(Again1599559881266)'Again'", csid: '1111-2222-3333-4444' }], + ['orgauthorities', 'ulan_oa', 'Signal', { refname: "urn:cspace:core.collectionspace.org:orgauthorities:name(ulan_oa):item:name(Signal1599559737158)'Signal'", csid: '1111-2222-3333-4444' }], + ['orgauthorities', 'ulan_oa', 'Very fats', { refname: "urn:cspace:core.collectionspace.org:orgauthorities:name(ulan_oa):item:name(Veryfats1599645188567)'Very fats'", csid: '1111-2222-3333-4444' }], + ['personauthorities', 'person', 'Broooks', { refname: "urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(Broooks1599221558583)'Broooks'", csid: '1111-2222-3333-4444' }], + ['personauthorities', 'person', '2020', { refname: "urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(20201599147149106)'2020'", csid: '1111-2222-3333-4444' }], + ['personauthorities', 'person', '254Glock', { refname: "urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(254Glock1599569494651)'254Glock'", csid: '1111-2222-3333-4444' }], + ['personauthorities', 'person', 'Abel', { refname: "urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(Abel1599464025893)'Abel'", csid: '1111-2222-3333-4444' }], + ['personauthorities', 'person', 'Alexa', { refname: "urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(Alexa1599557607978)'Alexa'", csid: '1111-2222-3333-4444' }], + ['personauthorities', 'person', 'Andrew Watts', { refname: "urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(AndrewWatts1599144553996)'Andrew Watts'", csid: '1111-2222-3333-4444' }], + ['personauthorities', 'person', 'Busy', { refname: "urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(Busy1599559723432)'Busy'", csid: '1111-2222-3333-4444' }], + ['personauthorities', 'person', 'Cardi', { refname: "urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(Cardi1599569468209)'Cardi'", csid: '1111-2222-3333-4444' }], + ['personauthorities', 'person', 'Clemo', { refname: "urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(Clemo1599221473000)'Clemo'", csid: '1111-2222-3333-4444' }], + ['personauthorities', 'person', 'Clon', { refname: "urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(Clon1599569543362)'Clon'", csid: '1111-2222-3333-4444' }], + ['personauthorities', 'person', 'Comodore', { refname: "urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(Comodore1599463826401)'Comodore'", csid: '1111-2222-3333-4444' }], + ['personauthorities', 'person', 'Comrade', { refname: "urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(Comrade1599664745661)'Comrade'", csid: '1111-2222-3333-4444' }], + ['personauthorities', 'person', 'Cooper Phil', { refname: "urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(CooperPhil1599144599479)'Cooper Phil'", csid: '1111-2222-3333-4444' }], + ['personauthorities', 'person', 'Disturb', { refname: "urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(Disturb1599665062738)'Disturb'", csid: '1111-2222-3333-4444' }], + ['personauthorities', 'person', 'Dudu', { refname: "urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(Dudu1599645410044)'Dudu'", csid: '1111-2222-3333-4444' }], + ['personauthorities', 'person', 'Erick', { refname: "urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(Erick1599734121151)'Erick'", csid: '1111-2222-3333-4444' }], + ['personauthorities', 'person', 'First Layer', { refname: "urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(FirstLayer1599463905818)'First Layer'", csid: '1111-2222-3333-4444' }], + ['personauthorities', 'person', 'Glock', { refname: "urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(Glock1599580905730)'Glock'", csid: '1111-2222-3333-4444' }], + ['personauthorities', 'person', 'Gomongo', { refname: "urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(Gomongo1599463746195)'Gomongo'", csid: '1111-2222-3333-4444' }], + ['personauthorities', 'person', 'Grace', { refname: "urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(Grace1599569599918)'Grace'", csid: '1111-2222-3333-4444' }], + ['personauthorities', 'person', 'Henry', { refname: "urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(Henry1599210937770)'Henry'", csid: '1111-2222-3333-4444' }], + ['personauthorities', 'person', 'Home Alone', { refname: "urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(HomeAlone1599144524188)'Home Alone'", csid: '1111-2222-3333-4444' }], + ['personauthorities', 'person', 'James', { refname: "urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(James1599210943727)'James'", csid: '1111-2222-3333-4444' }], + ['personauthorities', 'person', 'Jamo', { refname: "urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(Jamo1599221465693)'Jamo'", csid: '1111-2222-3333-4444' }], + ['personauthorities', 'person', 'Joel', { refname: "urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(Joel1599557736045)'Joel'", csid: '1111-2222-3333-4444' }], + ['personauthorities', 'person', 'John Allen', { refname: "urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(JohnAllen1599144390263)'John Allen'", csid: '1111-2222-3333-4444' }], + ['personauthorities', 'person', 'John Kay', { refname: "urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(JohnKay1599210868122)'John Kay'", csid: '1111-2222-3333-4444' }], + ['personauthorities', 'person', 'Kali', { refname: "urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(Kali1599221504661)'Kali'", csid: '1111-2222-3333-4444' }], + ['personauthorities', 'person', 'Karanja', { refname: "urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(Karanja1599211015378)'Karanja'", csid: '1111-2222-3333-4444' }], + ['personauthorities', 'person', 'Kev', { refname: "urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(Kev1599058769862)'Kev'", csid: '1111-2222-3333-4444' }], + ['personauthorities', 'person', 'Kimani', { refname: "urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(Kimani1599210926973)'Kimani'", csid: '1111-2222-3333-4444' }], + ['personauthorities', 'person', 'Kimonda', { refname: "urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(Kimonda1599211004900)'Kimonda'", csid: '1111-2222-3333-4444' }], + ['personauthorities', 'person', 'King Kosa', { refname: "urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(KingKosa1599569726990)'King Kosa'", csid: '1111-2222-3333-4444' }], + ['personauthorities', 'person', 'Kinuthia', { refname: "urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(Kinuthia1599734017515)'Kinuthia'", csid: '1111-2222-3333-4444' }], + ['personauthorities', 'person', 'Lebron', { refname: "urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(Lebron1599557725925)'Lebron'", csid: '1111-2222-3333-4444' }], + ['personauthorities', 'person', 'Lima', { refname: "urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(Lima1599645323459)'Lima'", csid: '1111-2222-3333-4444' }], + ['personauthorities', 'person', 'Loan', { refname: "urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(Loan1599210896616)'Loan'", csid: '1111-2222-3333-4444' }], + ['personauthorities', 'person', 'Mark Smith', { refname: "urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(MarkSmith)'Mark Smith'", csid: '1111-2222-3333-4444' }], + ['personauthorities', 'person', 'Meghan', { refname: "urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(Meghan1599569567326)'Meghan'", csid: '1111-2222-3333-4444' }], + ['personauthorities', 'person', 'Nyauma', { refname: "urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(Nyauma1599210983879)'Nyauma'", csid: '1111-2222-3333-4444' }], + ['personauthorities', 'person', 'Scribe', { refname: "urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(Scribe1599645240974)'Scribe'", csid: '1111-2222-3333-4444' }], + ['personauthorities', 'person', 'Shen Yeng', { refname: "urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(ShenYeng1599569685887)'Shen Yeng'", csid: '1111-2222-3333-4444' }], + ['personauthorities', 'person', 'Soi', { refname: "urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(Soi1599734190999)'Soi'", csid: '1111-2222-3333-4444' }], + ['personauthorities', 'person', 'Switch', { refname: "urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(Switch1599645085995)'Switch'", csid: '1111-2222-3333-4444' }], + ['personauthorities', 'person', 'Tim Joes', { refname: "urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(TimJoes1599144424859)'Tim Joes'", csid: '1111-2222-3333-4444' }], + ['personauthorities', 'person', 'Trepoz', { refname: "urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(Trepoz1599221497512)'Trepoz'", csid: '1111-2222-3333-4444' }], + ['personauthorities', 'person', 'Trevor', { refname: "urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(Trevor1599144536281)'Trevor'", csid: '1111-2222-3333-4444' }], + ['personauthorities', 'person', 'Troy', { refname: "urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(Troy1599144360617)'Troy'", csid: '1111-2222-3333-4444' }], + ['personauthorities', 'person', 'afa', { refname: "urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(afa1599645004939)'afa'", csid: '1111-2222-3333-4444' }], + ['personauthorities', 'person', 'cxcx', { refname: "urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(cxcx1599551790384)'cxcx'", csid: '1111-2222-3333-4444' }], + ['personauthorities', 'person', 'dfdd', { refname: "urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(dfdd1599551799173)'dfdd'", csid: '1111-2222-3333-4444' }], + ['personauthorities', 'person', 'dssd', { refname: "urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(dssd1599552004115)'dssd'", csid: '1111-2222-3333-4444' }], + ['personauthorities', 'person', 'fgfgf', { refname: "urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(fgfgf1599551987166)'fgfgf'", csid: '1111-2222-3333-4444' }], + ['personauthorities', 'person', 'giri', { refname: "urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(giri1599645613143)'giri'", csid: '1111-2222-3333-4444' }], + ['personauthorities', 'person', 'high grade', { refname: "urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(highgrade1599645597889)'high grade'", csid: '1111-2222-3333-4444' }], + ['personauthorities', 'person', 'malik', { refname: "urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(malik1599664876144)'malik'", csid: '1111-2222-3333-4444' }], + ['personauthorities', 'person', 'marcus', { refname: "urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(marcus1599650918612)'marcus'", csid: '1111-2222-3333-4444' }], + ['personauthorities', 'person', 'marley', { refname: "urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(marley1599650874712)'marley'", csid: '1111-2222-3333-4444' }], + ['personauthorities', 'person', 'rights', { refname: "urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(rights1599650868011)'rights'", csid: '1111-2222-3333-4444' }], + ['personauthorities', 'person', 'rudelyt', { refname: "urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(rudelyt1599664917218)'rudelyt'", csid: '1111-2222-3333-4444' }], + ['personauthorities', 'person', 'sasa', { refname: "urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(sasa1599551852678)'sasa'", csid: '1111-2222-3333-4444' }], + ['personauthorities', 'person', 'tint', { refname: "urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(tint1599664800144)'tint'", csid: '1111-2222-3333-4444' }], + ['personauthorities', 'person', 'tonight', { refname: "urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(tonight1599664781376)'tonight'", csid: '1111-2222-3333-4444' }], + ['personauthorities', 'ulan_pa', 'Chrus', { refname: "urn:cspace:core.collectionspace.org:personauthorities:name(ulan_pa):item:name(Chrus1599559702930)'Chrus'", csid: '1111-2222-3333-4444' }], + ['personauthorities', 'ulan_pa', 'We go', { refname: "urn:cspace:core.collectionspace.org:personauthorities:name(ulan_pa):item:name(Wego1599559866517)'We go'", csid: '1111-2222-3333-4444' }], + ['personauthorities', 'ulan_pa', 'panda nayo', { refname: "urn:cspace:core.collectionspace.org:personauthorities:name(ulan_pa):item:name(pandanayo1599645094507)'panda nayo'", csid: '1111-2222-3333-4444' }], + ['placeauthorities', 'place', 'Chillspot', { refname: "urn:cspace:core.collectionspace.org:placeauthorities:name(place):item:name(Chillspot1599145441945)'Chillspot'", csid: '1111-2222-3333-4444' }], + ['placeauthorities', 'tgn_place', 'mzingga', { refname: "urn:cspace:core.collectionspace.org:placeauthorities:name(tgn_place):item:name(mzingga1599645587502)'mzingga'", csid: '1111-2222-3333-4444' }], + ['vocabularies', 'agequalifier', 'older than', { refname: "urn:cspace:core.collectionspace.org:vocabularies:name(agequalifier):item:name(olderthan)'older than'", csid: '1111-2222-3333-4444' }], + ['vocabularies', 'collectionmethod', 'donation', { refname: "urn:cspace:core.collectionspace.org:vocabularies:name(collectionmethod):item:name(donation)'donation'", csid: '1111-2222-3333-4444' }], + ['vocabularies', 'collectionmethod', 'excavation', { refname: "urn:cspace:core.collectionspace.org:vocabularies:name(collectionmethod):item:name(excavation)'excavation'", csid: '1111-2222-3333-4444' }], + ['vocabularies', 'conditioncheckmethod', 'Observed', { refname: "urn:cspace:core.collectionspace.org:vocabularies:name(conditioncheckmethod):item:name(observed)'Observed'", csid: '1111-2222-3333-4444' }], + ['vocabularies', 'conditioncheckreason', 'Damaged in transit', { refname: "urn:cspace:core.collectionspace.org:vocabularies:name(conditioncheckreason):item:name(damagedintransit)'Damaged in transit'", csid: '1111-2222-3333-4444' }], + ['vocabularies', 'conditionfitness', 'Reasonable', { refname: "urn:cspace:core.collectionspace.org:vocabularies:name(conditionfitness):item:name(reasonable)'Reasonable'", csid: '1111-2222-3333-4444' }], + ['vocabularies', 'conservationstatus', 'Analysis complete', { refname: "urn:cspace:core.collectionspace.org:vocabularies:name(conservationstatus):item:name(analysiscomplete)'Analysis complete'", csid: '1111-2222-3333-4444' }], + ['vocabularies', 'conservationstatus', 'Treatment approved', { refname: "urn:cspace:core.collectionspace.org:vocabularies:name(conservationstatus):item:name(treatmentapproved)'Treatment approved'", csid: '1111-2222-3333-4444' }], + ['vocabularies', 'conservationstatus', 'Treatment in progress', { refname: "urn:cspace:core.collectionspace.org:vocabularies:name(conservationstatus):item:name(treatmentinprogress)'Treatment in progress'", csid: '1111-2222-3333-4444' }], + ['vocabularies', 'currency', 'Canadian Dollar', { refname: "urn:cspace:core.collectionspace.org:vocabularies:name(currency):item:name(CAD)'Canadian Dollar'", csid: '1111-2222-3333-4444' }], + ['vocabularies', 'currency', 'Danish Krone', { refname: "urn:cspace:core.collectionspace.org:vocabularies:name(currency):item:name(DKK)'Danish Krone'", csid: '1111-2222-3333-4444' }], + ['vocabularies', 'currency', 'Euro', { refname: "urn:cspace:core.collectionspace.org:vocabularies:name(currency):item:name(EUR)'Euro'", csid: '1111-2222-3333-4444' }], + ['vocabularies', 'currency', 'Pound Sterling', { refname: "urn:cspace:core.collectionspace.org:vocabularies:name(currency):item:name(GBP)'Pound Sterling'", csid: '1111-2222-3333-4444' }], + ['vocabularies', 'currency', 'Swedish Krona', { refname: "urn:cspace:core.collectionspace.org:vocabularies:name(currency):item:name(SEK)'Swedish Krona'", csid: '1111-2222-3333-4444' }], + ['vocabularies', 'currency', 'Swiss Franc', { refname: "urn:cspace:core.collectionspace.org:vocabularies:name(currency):item:name(CHF)'Swiss Franc'", csid: '1111-2222-3333-4444' }], + ['vocabularies', 'datecertainty', 'Circa', { refname: "urn:cspace:core.collectionspace.org:vocabularies:name(datecertainty):item:name(circa)'Circa'", csid: '1111-2222-3333-4444' }], + ['vocabularies', 'dateera', 'BCE', { refname: "urn:cspace:core.collectionspace.org:vocabularies:name(dateera):item:name(bce)'BCE'", csid: '1111-2222-3333-4444' }], + ['vocabularies', 'dateera', 'CE', { refname: "urn:cspace:core.collectionspace.org:vocabularies:name(dateera):item:name(ce)'CE'", csid: '1111-2222-3333-4444' }], + ['vocabularies', 'datequalifier', 'Day(s)', { refname: "urn:cspace:core.collectionspace.org:vocabularies:name(datequalifier):item:name(days)'Day(s)'", csid: '1111-2222-3333-4444' }], + ['vocabularies', 'datequalifier', 'Year(s)', { refname: "urn:cspace:core.collectionspace.org:vocabularies:name(datequalifier):item:name(years)'Year(s)'", csid: '1111-2222-3333-4444' }], + ['vocabularies', 'deaccessionapprovalgroup', 'board of trustees', { refname: "urn:cspace:core.collectionspace.org:vocabularies:name(deaccessionapprovalgroup):item:name(board_of_trustees)'board of trustees'", csid: '1111-2222-3333-4444' }], + ['vocabularies', 'deaccessionapprovalgroup', 'collection committee', { refname: "urn:cspace:core.collectionspace.org:vocabularies:name(deaccessionapprovalgroup):item:name(collection_committee)'collection committee'", csid: '1111-2222-3333-4444' }], + ['vocabularies', 'deaccessionapprovalgroup', 'executive committee', { refname: "urn:cspace:core.collectionspace.org:vocabularies:name(deaccessionapprovalgroup):item:name(executive_committee)'executive committee'", csid: '1111-2222-3333-4444' }], + ['vocabularies', 'deaccessionapprovalstatus', 'approved', { refname: "urn:cspace:core.collectionspace.org:vocabularies:name(deaccessionapprovalstatus):item:name(approved)'approved'", csid: '1111-2222-3333-4444' }], + ['vocabularies', 'deaccessionapprovalstatus', 'not approved', { refname: "urn:cspace:core.collectionspace.org:vocabularies:name(deaccessionapprovalstatus):item:name(not_approved)'not approved'", csid: '1111-2222-3333-4444' }], + ['vocabularies', 'deaccessionapprovalstatus', 'not required', { refname: "urn:cspace:core.collectionspace.org:vocabularies:name(deaccessionapprovalstatus):item:name(not_required)'not required'", csid: '1111-2222-3333-4444' }], + ['vocabularies', 'disposalmethod', 'destruction', { refname: "urn:cspace:core.collectionspace.org:vocabularies:name(disposalmethod):item:name(destruction)'destruction'", csid: '1111-2222-3333-4444' }], + ['vocabularies', 'entrymethod', 'Found on doorstep', { refname: "urn:cspace:core.collectionspace.org:vocabularies:name(entrymethod):item:name(foundondoorstep)'Found on doorstep'", csid: '1111-2222-3333-4444' }], + ['vocabularies', 'entrymethod', 'Post', { refname: "urn:cspace:core.collectionspace.org:vocabularies:name(entrymethod):item:name(post)'Post'", csid: '1111-2222-3333-4444' }], + ['vocabularies', 'examinationphase', 'before treatment', { refname: "urn:cspace:core.collectionspace.org:vocabularies:name(examinationphase):item:name(beforetreatment)'before treatment'", csid: '1111-2222-3333-4444' }], + ['vocabularies', 'examinationphase', 'during treatment', { refname: "urn:cspace:core.collectionspace.org:vocabularies:name(examinationphase):item:name(duringtreatment)'during treatment'", csid: '1111-2222-3333-4444' }], + ['vocabularies', 'exhibitionpersonrole', 'Educator', { refname: "urn:cspace:core.collectionspace.org:vocabularies:name(exhibitionpersonrole):item:name(educator)'Educator'", csid: '1111-2222-3333-4444' }], + ['vocabularies', 'exhibitionpersonrole', 'Public programs coordinator', { refname: "urn:cspace:core.collectionspace.org:vocabularies:name(exhibitionpersonrole):item:name(publicprogramscoordinator)'Public programs coordinator'", csid: '1111-2222-3333-4444' }], + ['vocabularies', 'exhibitionreferencetype', 'News article', { refname: "urn:cspace:core.collectionspace.org:vocabularies:name(exhibitionreferencetype):item:name(newsarticle)'News article'", csid: '1111-2222-3333-4444' }], + ['vocabularies', 'exhibitionreferencetype', 'Press release', { refname: "urn:cspace:core.collectionspace.org:vocabularies:name(exhibitionreferencetype):item:name(pressrelease)'Press release'", csid: '1111-2222-3333-4444' }], + ['vocabularies', 'exhibitionstatus', 'Preliminary object list created', { refname: "urn:cspace:core.collectionspace.org:vocabularies:name(exhibitionstatus):item:name(preliminaryobjectlistcreated)'Preliminary object list created'", csid: '1111-2222-3333-4444' }], + ['vocabularies', 'exhibitiontype', 'Temporary', { refname: "urn:cspace:core.collectionspace.org:vocabularies:name(exhibitiontype):item:name(temporary)'Temporary'", csid: '1111-2222-3333-4444' }], + ['vocabularies', 'inventorystatus', 'accession status unclear', { refname: "urn:cspace:core.collectionspace.org:vocabularies:name(inventorystatus):item:name(accessionstatusunclear)'accession status unclear'", csid: '1111-2222-3333-4444' }], + ['vocabularies', 'inventorystatus', 'destroyed', { refname: "urn:cspace:core.collectionspace.org:vocabularies:name(inventorystatus):item:name(destroyed)'destroyed'", csid: '1111-2222-3333-4444' }], + ['vocabularies', 'inventorystatus', 'unknown', { refname: "urn:cspace:core.collectionspace.org:vocabularies:name(inventorystatus):item:name(unknown)'unknown'", csid: '1111-2222-3333-4444' }], + ['vocabularies', 'languages', 'Ancient Greek', { refname: "urn:cspace:core.collectionspace.org:vocabularies:name(languages):item:name(grc)'Ancient Greek'", csid: '1111-2222-3333-4444' }], + ['vocabularies', 'languages', 'Armenian', { refname: "urn:cspace:core.collectionspace.org:vocabularies:name(languages):item:name(hye)'Armenian'", csid: '1111-2222-3333-4444' }], + ['vocabularies', 'languages', 'English', { refname: "urn:cspace:core.collectionspace.org:vocabularies:name(languages):item:name(eng)'English'", csid: '1111-2222-3333-4444' }], + ['vocabularies', 'languages', 'French', { refname: "urn:cspace:core.collectionspace.org:vocabularies:name(languages):item:name(fra)'French'", csid: '1111-2222-3333-4444' }], + ['vocabularies', 'languages', 'Malaysian', { refname: "urn:cspace:core.collectionspace.org:vocabularies:name(languages):item:name(mal)'Malaysian'", csid: '1111-2222-3333-4444' }], + ['vocabularies', 'languages', 'Spanish', { refname: "urn:cspace:core.collectionspace.org:vocabularies:name(languages):item:name(spa)'Spanish'", csid: '1111-2222-3333-4444' }], + ['vocabularies', 'languages', 'Swahili', { refname: "urn:cspace:core.collectionspace.org:vocabularies:name(languages):item:name(swa)'Swahili'", csid: '1111-2222-3333-4444' }], + ['vocabularies', 'loanoutstatus', 'Authorized', { refname: "urn:cspace:core.collectionspace.org:vocabularies:name(loanoutstatus):item:name(authorized)'Authorized'", csid: '1111-2222-3333-4444' }], + ['vocabularies', 'loanoutstatus', 'Photography requested', { refname: "urn:cspace:core.collectionspace.org:vocabularies:name(loanoutstatus):item:name(photographyrequested)'Photography requested'", csid: '1111-2222-3333-4444' }], + ['vocabularies', 'loanoutstatus', 'Refused', { refname: "urn:cspace:core.collectionspace.org:vocabularies:name(loanoutstatus):item:name(refused)'Refused'", csid: '1111-2222-3333-4444' }], + ['vocabularies', 'loanoutstatus', 'Returned', { refname: "urn:cspace:core.collectionspace.org:vocabularies:name(loanoutstatus):item:name(returned)'Returned'", csid: '1111-2222-3333-4444' }], + ['vocabularies', 'newsarticle', 'News article', { refname: "urn:cspace:core.collectionspace.org:vocabularies:name(exhibitionreferencetype):item:name(newsarticle)'News article'", csid: '1111-2222-3333-4444' }], + ['vocabularies', 'otherpartyrole', 'Preparator', { refname: "urn:cspace:core.collectionspace.org:vocabularies:name(otherpartyrole):item:name(preparator)'Preparator'", csid: '1111-2222-3333-4444' }], + ['vocabularies', 'otherpartyrole', 'Technician', { refname: "urn:cspace:core.collectionspace.org:vocabularies:name(otherpartyrole):item:name(technician)'Technician'", csid: '1111-2222-3333-4444' }], + ['vocabularies', 'publishto', 'CollectionSpace Public Browser', { refname: "urn:cspace:core.collectionspace.org:vocabularies:name(publishto):item:name(cspacepub)'CollectionSpace Public Browser'", csid: '1111-2222-3333-4444' }], + ['vocabularies', 'publishto', 'Culture Object', { refname: "urn:cspace:core.collectionspace.org:vocabularies:name(publishto):item:name(cultureobject)'Culture Object'", csid: '1111-2222-3333-4444' }], + ['vocabularies', 'publishto', 'None', { refname: "urn:cspace:core.collectionspace.org:vocabularies:name(publishto):item:name(none)'None'", csid: '1111-2222-3333-4444' }], + ['vocabularies', 'publishto', 'Omeka', { refname: "urn:cspace:core.collectionspace.org:vocabularies:name(publishto):item:name(omeka)'Omeka'", csid: '1111-2222-3333-4444' }], + ['vocabularies', 'treatmentpurpose', 'Exhibition', { refname: "urn:cspace:core.collectionspace.org:vocabularies:name(treatmentpurpose):item:name(exhibition)'Exhibition'", csid: '1111-2222-3333-4444' }], + ['vocabularies', 'uocauthorizationstatuses', 'Approved', { refname: "urn:cspace:core.collectionspace.org:vocabularies:name(uocauthorizationstatuses):item:name(approved)'Approved'", csid: '1111-2222-3333-4444' }], + ['vocabularies', 'uoccollectiontypes', 'archeology', { refname: "urn:cspace:core.collectionspace.org:vocabularies:name(uoccollectiontypes):item:name(uocarcheology)'archeology'", csid: '1111-2222-3333-4444' }], + ['vocabularies', 'uocmaterialtypes', 'bulb', { refname: "urn:cspace:core.collectionspace.org:vocabularies:name(uocmaterialtypes):item:name(bulb)'bulb'", csid: '1111-2222-3333-4444' }], + ['vocabularies', 'uocmethods', 'class', { refname: "urn:cspace:core.collectionspace.org:vocabularies:name(uocmethods):item:name(class)'class'", csid: '1111-2222-3333-4444' }], + ['vocabularies', 'uocstaffroles', 'greeter', { refname: "urn:cspace:core.collectionspace.org:vocabularies:name(uocstaffroles):item:name(greeter)'greeter'", csid: '1111-2222-3333-4444' }], + ['vocabularies', 'uocsubcollections', 'Asia', { refname: "urn:cspace:core.collectionspace.org:vocabularies:name(uocsubcollections):item:name(uocsubcollection02)'Asia'", csid: '1111-2222-3333-4444' }], + ['vocabularies', 'uocuserroles', 'faculty', { refname: "urn:cspace:core.collectionspace.org:vocabularies:name(uocuserroles):item:name(faculty)'faculty'", csid: '1111-2222-3333-4444' }], + ['vocabularies', 'uocusertypes', 'lecturer', { refname: "urn:cspace:core.collectionspace.org:vocabularies:name(uocusertypes):item:name(lecturer)'lecturer'", csid: '1111-2222-3333-4444' }], + ['workauthorities', 'work', 'Makeup', { refname: "urn:cspace:core.collectionspace.org:workauthorities:name(work):item:name(Makeup1608768998350)'Makeup'", csid: '1111-2222-3333-4444' }], ] populate(cache, terms) end diff --git a/spec/fcart_helpers.rb b/spec/fcart_helpers.rb index 13debc5b..5f897767 100644 --- a/spec/fcart_helpers.rb +++ b/spec/fcart_helpers.rb @@ -22,7 +22,7 @@ def fcart_cache def populate_fcart(cache) terms = [ ['personauthorities', 'person', 'Elizabeth', - "urn:cspace:fcart.collectionspace.org:personauthorities:name(person):item:name(Elizabeth123)'Elizabeth'"] ] + { refname: "urn:cspace:fcart.collectionspace.org:personauthorities:name(person):item:name(Elizabeth123)'Elizabeth'", csid: '1111-2222-3333-4444' }] ] populate(cache, terms) end diff --git a/spec/lhmc_helpers.rb b/spec/lhmc_helpers.rb index 176b5a7a..dcd91aee 100644 --- a/spec/lhmc_helpers.rb +++ b/spec/lhmc_helpers.rb @@ -22,9 +22,9 @@ def lhmc_cache def populate_lhmc(cache) terms = [ ['personauthorities', 'person', 'Ann Analyst', - "urn:cspace:lhmc.collectionspace.org:personauthorities:name(person):item:name(AnnAnalyst1594848799340)'Ann Analyst'"], + { refname: "urn:cspace:lhmc.collectionspace.org:personauthorities:name(person):item:name(AnnAnalyst1594848799340)'Ann Analyst'", csid: '1111-2222-3333-4444' }], ['vocabularies', 'agerange', 'adolescent 26-75%', - "urn:cspace:lhmc.collectionspace.org:vocabularies:name(agerange):item:name(adolescent_26_75)'adolescent 26-75%'"], + { refname: "urn:cspace:lhmc.collectionspace.org:vocabularies:name(agerange):item:name(adolescent_26_75)'adolescent 26-75%'", csid: '1111-2222-3333-4444' }], ] populate(cache, terms) end From 8db4efea91d2dac58dc73d6e5f5829930658b75b Mon Sep 17 00:00:00 2001 From: Kristina Spurgin Date: Wed, 19 Jan 2022 19:13:56 -0500 Subject: [PATCH 02/20] change order of term handling If term value is `cached_as_unknown?`, we don't need to search the client. --- lib/collectionspace/mapper/term_handler.rb | 31 ++++++++++------------ 1 file changed, 14 insertions(+), 17 deletions(-) diff --git a/lib/collectionspace/mapper/term_handler.rb b/lib/collectionspace/mapper/term_handler.rb index f186ba39..9f8de8cb 100644 --- a/lib/collectionspace/mapper/term_handler.rb +++ b/lib/collectionspace/mapper/term_handler.rb @@ -64,6 +64,9 @@ def handle_term(val) add_found_term(refname_urn, term_report) added = true end + elsif cached_as_unknown?(val) + refname_urn = add_known_unknown_term(val, term_report) + added = true else # not in cache if @config.check_terms refname_urn = searched_term(val, :refname) @@ -75,19 +78,19 @@ def handle_term(val) end return refname_urn if added - - # this section needs to be updated when not-found terms become blocking errors instead - # of warnings. At that point, we no longer want to generate and store a refname for the - # term, since it will not be mapped. - if cached_as_unknown?(val) - refname_urn = add_known_unknown_term(val, term_report) - else - refname_urn = add_new_unknown_term(val, term_report) - end - - refname_urn + + add_new_unknown_term(val, term_report) end + def add_found_term(refname_urn, term_report) + refname_obj = CollectionSpace::Mapper::Tools::RefName.new(urn: refname_urn) + found = @config.check_terms ? true : false + @terms << term_report.merge({found: found, refname: refname_obj}) + end + + # the next two methods need to be updated when not-found terms become blocking errors instead + # of warnings. At that point, we no longer want to generate and store a refname for the + # term, since it will not be mapped. def add_new_unknown_term(val, term_report) refname_obj = CollectionSpace::Mapper::Tools::RefName.new( source_type: source_type, @@ -108,12 +111,6 @@ def add_known_unknown_term(val, term_report) @terms << term_report.merge({found: false, refname: refname_obj}) refname_url end - - def add_found_term(refname_urn, term_report) - refname_obj = CollectionSpace::Mapper::Tools::RefName.new(urn: refname_urn) - found = @config.check_terms ? true : false - @terms << term_report.merge({found: found, refname: refname_obj}) - end end end end From 88092f62e714991683adb0c70af742986b844685 Mon Sep 17 00:00:00 2001 From: Kristina Spurgin Date: Wed, 19 Jan 2022 19:36:16 -0500 Subject: [PATCH 03/20] testing importer --- lib/collectionspace/mapper/term_searchable.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/collectionspace/mapper/term_searchable.rb b/lib/collectionspace/mapper/term_searchable.rb index cd53422c..05b70d51 100644 --- a/lib/collectionspace/mapper/term_searchable.rb +++ b/lib/collectionspace/mapper/term_searchable.rb @@ -24,6 +24,7 @@ def cached_as_unknown?(val) # returns refName of cached term def cached_term(val, return_key = :refname) + binding.pry returned = @cache.get(type, subtype, val, search: false) return returned[return_key] if returned From 30e930a45208ea241b0b7f918b84215e85671fe6 Mon Sep 17 00:00:00 2001 From: Kristina Spurgin Date: Thu, 20 Jan 2022 10:11:11 -0500 Subject: [PATCH 04/20] add ruby_jard --- Gemfile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Gemfile b/Gemfile index 48bd19a5..61c246db 100644 --- a/Gemfile +++ b/Gemfile @@ -10,4 +10,6 @@ gem 'facets', require: false # Specify your gem's dependencies in collectionspace-mapper.gemspec gem 'collectionspace-client', tag: 'v0.10.0', git: 'https://github.com/collectionspace/collectionspace-client.git' gem 'collectionspace-refcache', tag: 'v0.7.7', git: 'https://github.com/collectionspace/collectionspace-refcache.git' + +gem 'ruby_jard' gemspec From 488864040e26bbcaa03696d5bfdede6796b63fd4 Mon Sep 17 00:00:00 2001 From: Kristina Spurgin Date: Thu, 20 Jan 2022 10:24:25 -0500 Subject: [PATCH 05/20] disable pry-byebug --- collectionspace-mapper.gemspec | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/collectionspace-mapper.gemspec b/collectionspace-mapper.gemspec index 5a357960..afb518d9 100644 --- a/collectionspace-mapper.gemspec +++ b/collectionspace-mapper.gemspec @@ -45,7 +45,8 @@ Gem::Specification.new do |spec| spec.add_dependency 'xxhash', '>= 0.4.0' spec.add_development_dependency 'bundler', '>= 2.1.2' - spec.add_development_dependency 'pry-byebug' + spec.add_development_dependency 'ruby_jard' +# spec.add_development_dependency 'pry-byebug' spec.add_development_dependency 'rake', '>= 13.0.1' spec.add_development_dependency 'rspec', '~> 3.0' spec.add_development_dependency 'rubocop', '~> 1.18.3' From dd1965da59f7d66f134c10d97b93f47906eb500d Mon Sep 17 00:00:00 2001 From: Kristina Spurgin Date: Thu, 20 Jan 2022 10:31:20 -0500 Subject: [PATCH 06/20] enable byebug --- collectionspace-mapper.gemspec | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/collectionspace-mapper.gemspec b/collectionspace-mapper.gemspec index afb518d9..c8da29f0 100644 --- a/collectionspace-mapper.gemspec +++ b/collectionspace-mapper.gemspec @@ -45,8 +45,10 @@ Gem::Specification.new do |spec| spec.add_dependency 'xxhash', '>= 0.4.0' spec.add_development_dependency 'bundler', '>= 2.1.2' + spec.add_development_dependency 'byebug' + spec.add_development_dependency 'pry' spec.add_development_dependency 'ruby_jard' -# spec.add_development_dependency 'pry-byebug' + #spec.add_development_dependency 'pry-byebug' spec.add_development_dependency 'rake', '>= 13.0.1' spec.add_development_dependency 'rspec', '~> 3.0' spec.add_development_dependency 'rubocop', '~> 1.18.3' From d41c82ff7452e3fcc0034f95279f0da8c9bbbcaa Mon Sep 17 00:00:00 2001 From: Kristina Spurgin Date: Thu, 20 Jan 2022 11:00:01 -0500 Subject: [PATCH 07/20] remove jard --- Gemfile | 1 - collectionspace-mapper.gemspec | 3 +-- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/Gemfile b/Gemfile index 61c246db..3ac88b98 100644 --- a/Gemfile +++ b/Gemfile @@ -11,5 +11,4 @@ gem 'facets', require: false gem 'collectionspace-client', tag: 'v0.10.0', git: 'https://github.com/collectionspace/collectionspace-client.git' gem 'collectionspace-refcache', tag: 'v0.7.7', git: 'https://github.com/collectionspace/collectionspace-refcache.git' -gem 'ruby_jard' gemspec diff --git a/collectionspace-mapper.gemspec b/collectionspace-mapper.gemspec index c8da29f0..f400dac4 100644 --- a/collectionspace-mapper.gemspec +++ b/collectionspace-mapper.gemspec @@ -47,8 +47,7 @@ Gem::Specification.new do |spec| spec.add_development_dependency 'bundler', '>= 2.1.2' spec.add_development_dependency 'byebug' spec.add_development_dependency 'pry' - spec.add_development_dependency 'ruby_jard' - #spec.add_development_dependency 'pry-byebug' + spec.add_development_dependency 'pry-byebug' spec.add_development_dependency 'rake', '>= 13.0.1' spec.add_development_dependency 'rspec', '~> 3.0' spec.add_development_dependency 'rubocop', '~> 1.18.3' From 00850f7079f924a92b8510b4889d1cefa665d8fa Mon Sep 17 00:00:00 2001 From: Kristina Spurgin Date: Thu, 20 Jan 2022 11:03:30 -0500 Subject: [PATCH 08/20] move pry --- lib/collectionspace/mapper/term_handler.rb | 2 ++ lib/collectionspace/mapper/term_searchable.rb | 1 - 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/collectionspace/mapper/term_handler.rb b/lib/collectionspace/mapper/term_handler.rb index 9f8de8cb..f817e73b 100644 --- a/lib/collectionspace/mapper/term_handler.rb +++ b/lib/collectionspace/mapper/term_handler.rb @@ -58,6 +58,8 @@ def handle_term(val) field: column } + binding.pry + if in_cache?(val) refname_urn = cached_term(val, :refname) if refname_urn diff --git a/lib/collectionspace/mapper/term_searchable.rb b/lib/collectionspace/mapper/term_searchable.rb index 05b70d51..cd53422c 100644 --- a/lib/collectionspace/mapper/term_searchable.rb +++ b/lib/collectionspace/mapper/term_searchable.rb @@ -24,7 +24,6 @@ def cached_as_unknown?(val) # returns refName of cached term def cached_term(val, return_key = :refname) - binding.pry returned = @cache.get(type, subtype, val, search: false) return returned[return_key] if returned From cefe6e91d35e68d55957541e8e174203dce7a234 Mon Sep 17 00:00:00 2001 From: Kristina Spurgin Date: Thu, 20 Jan 2022 11:36:14 -0500 Subject: [PATCH 09/20] use cached term to retrieve unknownvalue terms --- lib/collectionspace/mapper/term_handler.rb | 6 ++++-- lib/collectionspace/mapper/term_searchable.rb | 17 +++++++++++------ 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/lib/collectionspace/mapper/term_handler.rb b/lib/collectionspace/mapper/term_handler.rb index f817e73b..cd5be3a1 100644 --- a/lib/collectionspace/mapper/term_handler.rb +++ b/lib/collectionspace/mapper/term_handler.rb @@ -58,7 +58,6 @@ def handle_term(val) field: column } - binding.pry if in_cache?(val) refname_urn = cached_term(val, :refname) @@ -93,6 +92,8 @@ def add_found_term(refname_urn, term_report) # the next two methods need to be updated when not-found terms become blocking errors instead # of warnings. At that point, we no longer want to generate and store a refname for the # term, since it will not be mapped. + # at the point of switching error, the termtype and termsubtype parameters can be removed from + # cached_term def add_new_unknown_term(val, term_report) refname_obj = CollectionSpace::Mapper::Tools::RefName.new( source_type: source_type, @@ -108,7 +109,8 @@ def add_new_unknown_term(val, term_report) end def add_known_unknown_term(val, term_report) - refname_url = @cache.get('unknownvalue', unknown_type, val)[:refname] + refname_url = cached_term(val, :refname, 'unknownvalue', "#{type}/#{subtype}") + #refname_url = @cache.get('unknownvalue', unknown_type, val)[:refname] refname_obj = CollectionSpace::Mapper::Tools::RefName.new(urn: refname_url) @terms << term_report.merge({found: false, refname: refname_obj}) refname_url diff --git a/lib/collectionspace/mapper/term_searchable.rb b/lib/collectionspace/mapper/term_searchable.rb index cd53422c..a43c4d75 100644 --- a/lib/collectionspace/mapper/term_searchable.rb +++ b/lib/collectionspace/mapper/term_searchable.rb @@ -23,14 +23,20 @@ def cached_as_unknown?(val) end # returns refName of cached term - def cached_term(val, return_key = :refname) - returned = @cache.get(type, subtype, val, search: false) - return returned[return_key] if returned + def cached_term(val, return_key = :refname, termtype = type, termsubtype = subtype) + returned = @cache.get(termtype, termsubtype, val, search: false) + return convert_cached_value(returned)[return_key] if returned - returned = @cache.get(type, subtype, case_swap(val), search: false) - return returned[return_key] if returned + returned = @cache.get(termtype, termsubtype, case_swap(val), search: false) + return convert_cached_value(returned)[return_key] if returned end + private def convert_cached_value(cache_response) + return cache_response if cache_response.is_a?(Hash) + + instance_eval(cache_response) + end + # returns refName of searched (term) def searched_term(val, return_key = :refname) response = term_search_response(val) @@ -43,7 +49,6 @@ def searched_term(val, return_key = :refname) cache_value[return_key] end - private def case_swap(string) string.match?(/[A-Z]/) ? string.downcase : string.capitalize end From 5e1acb139007f190daa6d1d1e1ebefa7b8e8b722 Mon Sep 17 00:00:00 2001 From: Kristina Spurgin Date: Thu, 20 Jan 2022 12:48:32 -0500 Subject: [PATCH 10/20] rename `unknown_type` method to `type_subtype` --- lib/collectionspace/mapper/term_handler.rb | 4 ++-- lib/collectionspace/mapper/term_searchable.rb | 13 ++++++------- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/lib/collectionspace/mapper/term_handler.rb b/lib/collectionspace/mapper/term_handler.rb index cd5be3a1..85bfdc6b 100644 --- a/lib/collectionspace/mapper/term_handler.rb +++ b/lib/collectionspace/mapper/term_handler.rb @@ -104,13 +104,13 @@ def add_new_unknown_term(val, term_report) @terms << term_report.merge({found: false, refname: refname_obj}) refname_url = refname_obj.urn - @cache.put('unknownvalue', unknown_type, val, {refname: refname_url, csid: nil}) + @cache.put('unknownvalue', type_subtype, val, {refname: refname_url, csid: nil}) refname_url end def add_known_unknown_term(val, term_report) refname_url = cached_term(val, :refname, 'unknownvalue', "#{type}/#{subtype}") - #refname_url = @cache.get('unknownvalue', unknown_type, val)[:refname] + #refname_url = @cache.get('unknownvalue', type_subtype, val)[:refname] refname_obj = CollectionSpace::Mapper::Tools::RefName.new(urn: refname_url) @terms << term_report.merge({found: false, refname: refname_obj}) refname_url diff --git a/lib/collectionspace/mapper/term_searchable.rb b/lib/collectionspace/mapper/term_searchable.rb index a43c4d75..7af0771a 100644 --- a/lib/collectionspace/mapper/term_searchable.rb +++ b/lib/collectionspace/mapper/term_searchable.rb @@ -12,14 +12,14 @@ def in_cache?(val) # returns whether value is cached as an unknownvalue def cached_as_unknown?(val) - return true if @cache.exists?('unknownvalue', unknown_type, val) - return true if @cache.exists?('unknownvalue', unknown_type, case_swap(val)) + return true if @cache.exists?('unknownvalue', type_subtype, val) + return true if @cache.exists?('unknownvalue', type_subtype, case_swap(val)) false end - private def unknown_type - @unknown_type ||= "#{type}/#{subtype}" + private def type_subtype + @type_subtype ||= "#{type}/#{subtype}" end # returns refName of cached term @@ -134,7 +134,6 @@ def term_csid(term) nil end - private def rec_from_response(category, val, response) term_ct = response_item_count(response) @@ -155,11 +154,11 @@ def term_csid(term) when 0 errors << { category: "no_records_found_for_#{category}".to_sym, - field: '', + field: column, type: type, subtype: subtype, value: val, - message: "#{term_ct} records found." + message: "#{val} (#{type_subtype} in #{column} column)" } rec = nil when 1 From 896b0533ea73827841205e6b4a72d00f941bc794 Mon Sep 17 00:00:00 2001 From: Kristina Spurgin Date: Thu, 20 Jan 2022 13:06:14 -0500 Subject: [PATCH 11/20] both newly discovered and known unknown terms attach error to response --- lib/collectionspace/mapper/term_handler.rb | 1 + lib/collectionspace/mapper/term_searchable.rb | 20 +++++++++++-------- 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/lib/collectionspace/mapper/term_handler.rb b/lib/collectionspace/mapper/term_handler.rb index 85bfdc6b..8e970e3a 100644 --- a/lib/collectionspace/mapper/term_handler.rb +++ b/lib/collectionspace/mapper/term_handler.rb @@ -113,6 +113,7 @@ def add_known_unknown_term(val, term_report) #refname_url = @cache.get('unknownvalue', type_subtype, val)[:refname] refname_obj = CollectionSpace::Mapper::Tools::RefName.new(urn: refname_url) @terms << term_report.merge({found: false, refname: refname_obj}) + add_missing_record_error('term', val) refname_url end end diff --git a/lib/collectionspace/mapper/term_searchable.rb b/lib/collectionspace/mapper/term_searchable.rb index 7af0771a..a837d594 100644 --- a/lib/collectionspace/mapper/term_searchable.rb +++ b/lib/collectionspace/mapper/term_searchable.rb @@ -134,6 +134,17 @@ def term_csid(term) nil end + + private def add_missing_record_error(category, val) + errors << { + category: "no_records_found_for_#{category}".to_sym, + field: column, + type: type, + subtype: subtype, + value: val, + message: "#{val} (#{type_subtype} in #{column} column)" + } + end private def rec_from_response(category, val, response) term_ct = response_item_count(response) @@ -152,14 +163,7 @@ def term_csid(term) case term_ct when 0 - errors << { - category: "no_records_found_for_#{category}".to_sym, - field: column, - type: type, - subtype: subtype, - value: val, - message: "#{val} (#{type_subtype} in #{column} column)" - } + add_missing_record_error(category, val) rec = nil when 1 rec = response['list_item'] From 4d009624becd382672c69a3d3f9201d0424301f5 Mon Sep 17 00:00:00 2001 From: Kristina Spurgin Date: Thu, 20 Jan 2022 14:50:37 -0500 Subject: [PATCH 12/20] convert cached result returned by `obj_csid` --- lib/collectionspace/mapper/term_searchable.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/collectionspace/mapper/term_searchable.rb b/lib/collectionspace/mapper/term_searchable.rb index a837d594..a8cc3f43 100644 --- a/lib/collectionspace/mapper/term_searchable.rb +++ b/lib/collectionspace/mapper/term_searchable.rb @@ -86,7 +86,7 @@ def searched_term(val, return_key = :refname) def obj_csid(objnum, type) cached = @cache.get(type, '', objnum, search: false) - return cached[:csid] if cached + return convert_cached_value(cached)[:csid] if cached lookup_obj_csid(objnum, type) end From da31adba9d8f561a331cf46175b3556031b9f08c Mon Sep 17 00:00:00 2001 From: Kristina Spurgin Date: Thu, 20 Jan 2022 15:24:56 -0500 Subject: [PATCH 13/20] do not depend on having datacolumn value when adding missing term error --- lib/collectionspace/mapper/term_searchable.rb | 10 ++++---- .../mapper/data_mapper_core_spec.rb | 23 ++++++++++++++++++- .../datahashes/core/authorityHierarchy2.json | 6 +++++ .../files/xml/core/authorityHierarchy2.xml | 8 +++++++ 4 files changed, 42 insertions(+), 5 deletions(-) create mode 100644 spec/fixtures/files/datahashes/core/authorityHierarchy2.json create mode 100644 spec/fixtures/files/xml/core/authorityHierarchy2.xml diff --git a/lib/collectionspace/mapper/term_searchable.rb b/lib/collectionspace/mapper/term_searchable.rb index a8cc3f43..1e130eba 100644 --- a/lib/collectionspace/mapper/term_searchable.rb +++ b/lib/collectionspace/mapper/term_searchable.rb @@ -136,13 +136,15 @@ def term_csid(term) end private def add_missing_record_error(category, val) + datacolumn = column ||= 'data' + errors << { category: "no_records_found_for_#{category}".to_sym, - field: column, - type: type, - subtype: subtype, + field: '', + type: '', + subtype: '', value: val, - message: "#{val} (#{type_subtype} in #{column} column)" + message: "#{val} (#{type_subtype} in #{datacolumn} column)" } end diff --git a/spec/collectionspace/mapper/data_mapper_core_spec.rb b/spec/collectionspace/mapper/data_mapper_core_spec.rb index f7c8b562..d10cdd74 100644 --- a/spec/collectionspace/mapper/data_mapper_core_spec.rb +++ b/spec/collectionspace/mapper/data_mapper_core_spec.rb @@ -84,7 +84,7 @@ let(:mapper){ get_json_record_mapper('spec/fixtures/files/mappers/release_6_1/core/core_6-1-0_authorityhierarchy.json') } - context 'record 1' do + context 'with existing terms' do let(:hashpath){ 'spec/fixtures/files/datahashes/core/authorityHierarchy1.json' } let(:fixturepath){ 'core/authorityHierarchy1.xml' } @@ -104,6 +104,27 @@ end end end + + context 'with a missing term' do + let(:hashpath){ 'spec/fixtures/files/datahashes/core/authorityHierarchy2.json' } + let(:fixturepath){ 'core/authorityHierarchy2.xml' } + + it 'sets response id field as expected' do + expect(response.identifier).to eq('Cats > Tuxedo cats') + end + + it 'does not map unexpected fields' do + expect(diff).to eq([]) + end + + it 'maps as expected' do + fixture_xpaths.each do |xpath| + fixture_node = standardize_value(fixture_doc.xpath(xpath).text) + mapped_node = standardize_value(mapped_doc.xpath(xpath).text) + expect(mapped_node).to eq(fixture_node) + end + end + end end context 'object hierarchy record', services_call: true do diff --git a/spec/fixtures/files/datahashes/core/authorityHierarchy2.json b/spec/fixtures/files/datahashes/core/authorityHierarchy2.json new file mode 100644 index 00000000..be6d9d51 --- /dev/null +++ b/spec/fixtures/files/datahashes/core/authorityHierarchy2.json @@ -0,0 +1,6 @@ +{ + "term_type": "conceptauthorities", + "term_subtype": "concept", + "narrower_term": "Tuxedo cats", + "broader_term": "Cats" +} diff --git a/spec/fixtures/files/xml/core/authorityHierarchy2.xml b/spec/fixtures/files/xml/core/authorityHierarchy2.xml new file mode 100644 index 00000000..54d286fd --- /dev/null +++ b/spec/fixtures/files/xml/core/authorityHierarchy2.xml @@ -0,0 +1,8 @@ + + + + + hasBroader + fba204d0-004b-49a3-8676 + + From bf7e5918917182a301f58a04cb4b5aac08cc76b9 Mon Sep 17 00:00:00 2001 From: Kristina Spurgin Date: Thu, 20 Jan 2022 15:34:35 -0500 Subject: [PATCH 14/20] add subtype attribute to object_hierarchy_data_prepper --- lib/collectionspace/mapper/object_hierarchy_data_prepper.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/collectionspace/mapper/object_hierarchy_data_prepper.rb b/lib/collectionspace/mapper/object_hierarchy_data_prepper.rb index 59198d0e..cd9c59d6 100644 --- a/lib/collectionspace/mapper/object_hierarchy_data_prepper.rb +++ b/lib/collectionspace/mapper/object_hierarchy_data_prepper.rb @@ -7,12 +7,13 @@ module CollectionSpace module Mapper class ObjectHierarchyPrepper < CollectionSpace::Mapper::DataPrepper include CollectionSpace::Mapper::TermSearchable - attr_reader :errors, :warnings, :type + attr_reader :errors, :warnings, :type, :subtype def initialize(data, handler) super @cache = @handler.mapper.termcache @type = @response.merged_data['subjectdocumenttype'] + @subtype = '' @errors = [] @warnings = [] end From 625b7568ece91b54e8fcba098c2765b5663f91fd Mon Sep 17 00:00:00 2001 From: Kristina Spurgin Date: Thu, 20 Jan 2022 16:08:53 -0500 Subject: [PATCH 15/20] set type and subtype instance variables per side of nonhier rel --- .../non_hierarchical_relationship_prepper.rb | 10 +++- lib/collectionspace/mapper/term_searchable.rb | 2 +- .../mapper/data_mapper_core_spec.rb | 52 ++++++++++++++++++- .../core/nonHierarchicalRelationship2.json | 6 +++ .../core/nonHierarchicalRelationship2A.xml | 8 +++ .../core/nonHierarchicalRelationship2B.xml | 8 +++ 6 files changed, 82 insertions(+), 4 deletions(-) create mode 100644 spec/fixtures/files/datahashes/core/nonHierarchicalRelationship2.json create mode 100644 spec/fixtures/files/xml/core/nonHierarchicalRelationship2A.xml create mode 100644 spec/fixtures/files/xml/core/nonHierarchicalRelationship2B.xml diff --git a/lib/collectionspace/mapper/non_hierarchical_relationship_prepper.rb b/lib/collectionspace/mapper/non_hierarchical_relationship_prepper.rb index 748ce314..88ac98ea 100644 --- a/lib/collectionspace/mapper/non_hierarchical_relationship_prepper.rb +++ b/lib/collectionspace/mapper/non_hierarchical_relationship_prepper.rb @@ -7,12 +7,13 @@ module CollectionSpace module Mapper class NonHierarchicalRelationshipPrepper < CollectionSpace::Mapper::DataPrepper include CollectionSpace::Mapper::TermSearchable - attr_reader :errors, :warnings, :responses + attr_reader :errors, :warnings, :responses, :type, :subtype def initialize(data, handler) super @cache = @handler.mapper.termcache @types = [@response.merged_data['item1_type'], @response.merged_data['item2_type']] + @subtype = '' @errors = [] @warnings = [] @responses = [] @@ -65,9 +66,14 @@ def clear_unmapped_mappings @handler.mapper.mappings.reject!{ |mapping| to_clear.include?(mapping.fieldname) } end + def get_rec_csid(id, type) + instance_variable_set(:@type, type) + obj_csid(id, type) + end + def transform_terms %w[item1_id item2_id].each_with_index do |field, i| - transformed = @response.split_data[field].map{ |id| obj_csid(id, @types[i]) } + transformed = @response.split_data[field].map{ |id| get_rec_csid(id, @types[i]) } @response.transformed_data[field] = transformed end diff --git a/lib/collectionspace/mapper/term_searchable.rb b/lib/collectionspace/mapper/term_searchable.rb index 1e130eba..cd2f0f11 100644 --- a/lib/collectionspace/mapper/term_searchable.rb +++ b/lib/collectionspace/mapper/term_searchable.rb @@ -19,7 +19,7 @@ def cached_as_unknown?(val) end private def type_subtype - @type_subtype ||= "#{type}/#{subtype}" + "#{type}/#{subtype}" end # returns refName of cached term diff --git a/spec/collectionspace/mapper/data_mapper_core_spec.rb b/spec/collectionspace/mapper/data_mapper_core_spec.rb index d10cdd74..a3c67736 100644 --- a/spec/collectionspace/mapper/data_mapper_core_spec.rb +++ b/spec/collectionspace/mapper/data_mapper_core_spec.rb @@ -29,7 +29,7 @@ 'spec/fixtures/files/mappers/release_6_1/core/core_6-1-0_nonhierarchicalrelationship.json' ) } - context 'record 1' do + context 'when all IDs found' do let(:hashpath){ 'spec/fixtures/files/datahashes/core/nonHierarchicalRelationship1.json' } let(:mapped_doc1){ remove_namespaces(response[0].doc) } let(:mapped_doc2){ remove_namespaces(response[1].doc) } @@ -78,6 +78,56 @@ end end end + + context 'when ID not found' do + let(:hashpath){ 'spec/fixtures/files/datahashes/core/nonHierarchicalRelationship2.json' } + let(:mapped_doc1){ remove_namespaces(response[0].doc) } + let(:mapped_doc2){ remove_namespaces(response[1].doc) } + let(:mapped_xpaths1){ list_xpaths(mapped_doc1) } + let(:mapped_xpaths2){ list_xpaths(mapped_doc2) } + let(:fixture_doc1){ get_xml_fixture('core/nonHierarchicalRelationship2A.xml') } + let(:fixture_xpaths1){ test_xpaths(fixture_doc1, handler.mapper.mappings) } + let(:fixture_doc2){ get_xml_fixture('core/nonHierarchicalRelationship2B.xml') } + let(:fixture_xpaths2){ test_xpaths(fixture_doc2, handler.mapper.mappings) } + + context 'with original data' do + it 'sets response id field as expected' do + expect(response[0].identifier).to eq('2020.1.107 TEST (collectionobjects) -> LOC MISSING (movements)') + end + + it 'does not map unexpected fields' do + thisdiff = mapped_xpaths1 - fixture_xpaths1 + expect(thisdiff).to eq([]) + end + + it 'maps as expected' do + fixture_xpaths1.each do |xpath| + fixture_node = standardize_value(fixture_doc1.xpath(xpath).text) + mapped_node = standardize_value(mapped_doc1.xpath(xpath).text) + expect(mapped_node).to eq(fixture_node) + end + end + end + + context 'with flipped data' do + it 'sets response id field as expected' do + expect(response[1].identifier).to eq('LOC MISSING (movements) -> 2020.1.107 TEST (collectionobjects)') + end + + it 'does not map unexpected fields' do + thisdiff = mapped_xpaths2 - fixture_xpaths2 + expect(thisdiff).to eq([]) + end + + it 'maps as expected' do + fixture_xpaths2.each do |xpath| + fixture_node = standardize_value(fixture_doc2.xpath(xpath).text) + mapped_node = standardize_value(mapped_doc2.xpath(xpath).text) + expect(mapped_node).to eq(fixture_node) + end + end + end + end end context 'authority hierarchy record', services_call: true do diff --git a/spec/fixtures/files/datahashes/core/nonHierarchicalRelationship2.json b/spec/fixtures/files/datahashes/core/nonHierarchicalRelationship2.json new file mode 100644 index 00000000..ff697bdc --- /dev/null +++ b/spec/fixtures/files/datahashes/core/nonHierarchicalRelationship2.json @@ -0,0 +1,6 @@ +{ + "item1_type": "collectionobjects", + "item1_id": "2020.1.107 TEST", + "item2_type": "movements", + "item2_id": "LOC MISSING" +} diff --git a/spec/fixtures/files/xml/core/nonHierarchicalRelationship2A.xml b/spec/fixtures/files/xml/core/nonHierarchicalRelationship2A.xml new file mode 100644 index 00000000..ba6b97e4 --- /dev/null +++ b/spec/fixtures/files/xml/core/nonHierarchicalRelationship2A.xml @@ -0,0 +1,8 @@ + + + + 22706401-8328-4778-86fa + affects + + + diff --git a/spec/fixtures/files/xml/core/nonHierarchicalRelationship2B.xml b/spec/fixtures/files/xml/core/nonHierarchicalRelationship2B.xml new file mode 100644 index 00000000..cf6b5036 --- /dev/null +++ b/spec/fixtures/files/xml/core/nonHierarchicalRelationship2B.xml @@ -0,0 +1,8 @@ + + + + + affects + 22706401-8328-4778-86fa + + From d383158b41e415900e0dec48faa8f32a7f203c2c Mon Sep 17 00:00:00 2001 From: Kristina Spurgin Date: Thu, 20 Jan 2022 16:17:19 -0500 Subject: [PATCH 16/20] improve error category value --- lib/collectionspace/mapper/term_searchable.rb | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/lib/collectionspace/mapper/term_searchable.rb b/lib/collectionspace/mapper/term_searchable.rb index cd2f0f11..424c914d 100644 --- a/lib/collectionspace/mapper/term_searchable.rb +++ b/lib/collectionspace/mapper/term_searchable.rb @@ -88,13 +88,14 @@ def obj_csid(objnum, type) cached = @cache.get(type, '', objnum, search: false) return convert_cached_value(cached)[:csid] if cached - lookup_obj_csid(objnum, type) + lookup_obj_or_procedure_csid(objnum, type) end - def lookup_obj_csid(objnum, type) + def lookup_obj_or_procedure_csid(objnum, type) + category = 'object_or_procedure' response = @client.find(type: type, value: objnum) if response.result.success? - rec = rec_from_response('objnum', objnum, parse_response(response)) + rec = rec_from_response(category, objnum, parse_response(response)) return nil unless rec csid = rec['csid'] @@ -102,7 +103,7 @@ def lookup_obj_csid(objnum, type) csid else errors << { - category: :unsuccessful_csid_lookup_for_objnum, + category: "unsuccessful_csid_lookup_for_#{category}".to_sym, field: '', subtype: '', type: type, From 32bd7d19134b794f9c5df709b97a68fb451eed13 Mon Sep 17 00:00:00 2001 From: Kristina Spurgin Date: Thu, 20 Jan 2022 16:28:02 -0500 Subject: [PATCH 17/20] add test for object hierarchy with unknown object --- .../mapper/data_mapper_core_spec.rb | 52 ++++++++++++++----- .../datahashes/core/objectHierarchy2.json | 5 ++ .../files/xml/core/objectHierarchy2.xml | 11 ++++ 3 files changed, 54 insertions(+), 14 deletions(-) create mode 100644 spec/fixtures/files/datahashes/core/objectHierarchy2.json create mode 100644 spec/fixtures/files/xml/core/objectHierarchy2.xml diff --git a/spec/collectionspace/mapper/data_mapper_core_spec.rb b/spec/collectionspace/mapper/data_mapper_core_spec.rb index a3c67736..44d2ccc1 100644 --- a/spec/collectionspace/mapper/data_mapper_core_spec.rb +++ b/spec/collectionspace/mapper/data_mapper_core_spec.rb @@ -132,7 +132,7 @@ context 'authority hierarchy record', services_call: true do let(:mapper){ - get_json_record_mapper('spec/fixtures/files/mappers/release_6_1/core/core_6-1-0_authorityhierarchy.json') } + get_json_record_mapper('spec/fixtures/files/mappers/release_6_1/core/core_6-1-0_authorityhierarchy.json') } context 'with existing terms' do let(:hashpath){ 'spec/fixtures/files/datahashes/core/authorityHierarchy1.json' } @@ -181,22 +181,46 @@ let(:mapper) do get_json_record_mapper('spec/fixtures/files/mappers/release_6_1/core/core_6-1-0_objecthierarchy.json') end - let(:hashpath) { 'spec/fixtures/files/datahashes/core/objectHierarchy1.json' } - let(:fixturepath) { 'core/objectHierarchy1.xml' } - it 'sets response id field as expected' do - expect(response.identifier).to eq('2020.1.105 > 2020.1.1055') - end - - it 'does not map unexpected fields' do - expect(diff).to eq([]) + context 'with existing records' do + let(:hashpath) { 'spec/fixtures/files/datahashes/core/objectHierarchy1.json' } + let(:fixturepath) { 'core/objectHierarchy1.xml' } + + it 'sets response id field as expected' do + expect(response.identifier).to eq('2020.1.105 > 2020.1.1055') + end + + it 'does not map unexpected fields' do + expect(diff).to eq([]) + end + + it 'maps as expected' do + fixture_xpaths.each do |xpath| + fixture_node = standardize_value(fixture_doc.xpath(xpath).text) + mapped_node = standardize_value(mapped_doc.xpath(xpath).text) + expect(mapped_node).to eq(fixture_node) + end + end end - it 'maps as expected' do - fixture_xpaths.each do |xpath| - fixture_node = standardize_value(fixture_doc.xpath(xpath).text) - mapped_node = standardize_value(mapped_doc.xpath(xpath).text) - expect(mapped_node).to eq(fixture_node) + context 'with missing record' do + let(:hashpath) { 'spec/fixtures/files/datahashes/core/objectHierarchy2.json' } + let(:fixturepath) { 'core/objectHierarchy2.xml' } + + it 'sets response id field as expected' do + expect(response.identifier).to eq('2020.1.105 > MISSING') + end + + it 'does not map unexpected fields' do + expect(diff).to eq([]) + end + + it 'maps as expected' do + fixture_xpaths.each do |xpath| + fixture_node = standardize_value(fixture_doc.xpath(xpath).text) + mapped_node = standardize_value(mapped_doc.xpath(xpath).text) + expect(mapped_node).to eq(fixture_node) + end end end end diff --git a/spec/fixtures/files/datahashes/core/objectHierarchy2.json b/spec/fixtures/files/datahashes/core/objectHierarchy2.json new file mode 100644 index 00000000..1bcd55d8 --- /dev/null +++ b/spec/fixtures/files/datahashes/core/objectHierarchy2.json @@ -0,0 +1,5 @@ +{ + "narrower_object_number": "MISSING", + "relationship_type": "separable-part", + "broader_object_number": "2020.1.105" +} diff --git a/spec/fixtures/files/xml/core/objectHierarchy2.xml b/spec/fixtures/files/xml/core/objectHierarchy2.xml new file mode 100644 index 00000000..2d0a870e --- /dev/null +++ b/spec/fixtures/files/xml/core/objectHierarchy2.xml @@ -0,0 +1,11 @@ + + + + + collectionobjects + hasBroader + separable-part + e37949e9-6402-4ad2-b899 + collectionobjects + + From dddd277083ee6398e71ab9a8c0be9d6a49b6ee37 Mon Sep 17 00:00:00 2001 From: Kristina Spurgin Date: Thu, 20 Jan 2022 16:52:35 -0500 Subject: [PATCH 18/20] rubocop autocorrects --- collectionspace-mapper.gemspec | 6 +- lib/collectionspace/mapper/config.rb | 4 +- lib/collectionspace/mapper/data_handler.rb | 2 +- lib/collectionspace/mapper/data_prepper.rb | 20 +- .../non_hierarchical_relationship_prepper.rb | 2 +- lib/collectionspace/mapper/term_handler.rb | 3 +- lib/collectionspace/mapper/term_searchable.rb | 179 +++--- .../mapper/tools/record_status_service.rb | 8 +- .../mapper/value_transformer.rb | 6 +- lib/collectionspace/mapper/xml_template.rb | 4 +- spec/anthro_helpers.rb | 154 ++--- spec/bonsai_helpers.rb | 22 +- spec/botgarden_helpers.rb | 56 +- .../mapper/column_mapping_spec.rb | 4 +- .../mapper/column_mappings_spec.rb | 12 +- .../mapper/column_value_spec.rb | 16 +- spec/collectionspace/mapper/config_spec.rb | 22 +- .../mapper/data_handler_spec.rb | 122 ++-- .../mapper/data_mapper_core_spec.rb | 40 +- .../mapper/data_mapper_spec.rb | 4 +- .../mapper/data_prepper_spec.rb | 68 +-- .../mapper/data_quality_checker_spec.rb | 32 +- .../mapper/find_replace_transformer_spec.rb | 4 +- .../mapper/group_column_value_spec.rb | 14 +- .../group_multival_column_value_spec.rb | 14 +- .../mapper/multival_column_value_spec.rb | 14 +- .../mapper/record_mapper_config_spec.rb | 4 +- spec/collectionspace/mapper/row_data_spec.rb | 4 +- .../mapper/subgroup_column_value_spec.rb | 14 +- .../mapper/term_handler_spec.rb | 16 +- .../mapper/term_searchable_spec.rb | 24 +- .../tools/record_status_service_spec.rb | 31 +- .../mapper/tools/refname_spec.rb | 8 +- .../mapper/tools/symbolizable_spec.rb | 10 +- .../mapper/transformer_spec.rb | 12 +- .../mapper/transformers_spec.rb | 12 +- spec/collectionspace/mapper_spec.rb | 6 +- spec/core_helpers.rb | 549 ++++++++++++------ spec/fcart_helpers.rb | 2 +- spec/lhmc_helpers.rb | 4 +- utils/csv-to-datahashes.rb | 12 +- utils/datahash_to_csv.rb | 12 +- 42 files changed, 867 insertions(+), 685 deletions(-) diff --git a/collectionspace-mapper.gemspec b/collectionspace-mapper.gemspec index f400dac4..1c143924 100644 --- a/collectionspace-mapper.gemspec +++ b/collectionspace-mapper.gemspec @@ -15,7 +15,7 @@ Gem::Specification.new do |spec| spec.license = 'MIT' spec.required_ruby_version = '>= 2.7.4' - + # Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host' # to allow pushing to a single host or delete this section to allow pushing to any host. if spec.respond_to?(:metadata) @@ -53,6 +53,6 @@ Gem::Specification.new do |spec| spec.add_development_dependency 'rubocop', '~> 1.18.3' # Uncomment these if you need to use the scripts in utils/benchmarking - #spec.add_development_dependency 'ruby-prof', '~> 1.4.3' - #spec.add_development_dependency 'time_up', '~> 0.0.7' + # spec.add_development_dependency 'ruby-prof', '~> 1.4.3' + # spec.add_development_dependency 'time_up', '~> 0.0.7' end diff --git a/lib/collectionspace/mapper/config.rb b/lib/collectionspace/mapper/config.rb index 361de03d..2c49dee0 100644 --- a/lib/collectionspace/mapper/config.rb +++ b/lib/collectionspace/mapper/config.rb @@ -10,8 +10,8 @@ module Mapper # :reek:InstanceVariableAssumption - instance variables are set during initialization class Config attr_reader :delimiter, :subgroup_delimiter, :response_mode, :strip_id_values, :multiple_recs_found, :force_defaults, - :check_record_status, :check_terms, :date_format, :two_digit_year_handling, :transforms, :default_values, - :record_type + :check_record_status, :check_terms, :date_format, :two_digit_year_handling, :transforms, :default_values, + :record_type # todo: move default config in here include Tools::Symbolizable diff --git a/lib/collectionspace/mapper/data_handler.rb b/lib/collectionspace/mapper/data_handler.rb index 6b3eecc6..d4ee80ad 100644 --- a/lib/collectionspace/mapper/data_handler.rb +++ b/lib/collectionspace/mapper/data_handler.rb @@ -186,7 +186,7 @@ def set_record_status(response) status = searchresult[:status] response.record_status = status return if status == :new - + response.csid = searchresult[:csid] response.uri = searchresult[:uri] response.refname = searchresult[:refname] diff --git a/lib/collectionspace/mapper/data_prepper.rb b/lib/collectionspace/mapper/data_prepper.rb index e5f986d3..cf2ab421 100644 --- a/lib/collectionspace/mapper/data_prepper.rb +++ b/lib/collectionspace/mapper/data_prepper.rb @@ -117,7 +117,7 @@ def do_non_group_splits(xphash) next if data.nil? || data.empty? @response.split_data[column] = non_group_splitter(mapping, data) - #mapping.repeats == 'y' ? CollectionSpace::Mapper::SimpleSplitter.new(data, config).result : [data.strip] + # mapping.repeats == 'y' ? CollectionSpace::Mapper::SimpleSplitter.new(data, config).result : [data.strip] end end @@ -153,7 +153,7 @@ def do_subgroup_splits(xphash) @response.split_data[column] = CollectionSpace::Mapper::SubgroupSplitter.new(data, config).result end end - + def do_transforms(xphash) splitdata = @response.split_data targetdata = @response.transformed_data @@ -255,10 +255,10 @@ def structured_date_transform(data) @cache, @handler.mapper.batchconfig).mappable else - d.map{ |v| CollectionSpace::Mapper::Tools::Dates::CspaceDate.new(v, - @client, - @cache, - @handler.mapper.batchconfig).mappable } + d.map do |v| CollectionSpace::Mapper::Tools::Dates::CspaceDate.new(v, + @client, + @cache, + @handler.mapper.batchconfig).mappable end end end end @@ -271,10 +271,10 @@ def unstructured_date_transform(data) @cache, @handler.mapper.batchconfig).stamp else - d.map{ |v| CollectionSpace::Mapper::Tools::Dates::CspaceDate.new(v, - @client, - @cache, - @handler.mapper.batchconfig).stamp } + d.map do |v| CollectionSpace::Mapper::Tools::Dates::CspaceDate.new(v, + @client, + @cache, + @handler.mapper.batchconfig).stamp end end end end diff --git a/lib/collectionspace/mapper/non_hierarchical_relationship_prepper.rb b/lib/collectionspace/mapper/non_hierarchical_relationship_prepper.rb index 88ac98ea..72925f0f 100644 --- a/lib/collectionspace/mapper/non_hierarchical_relationship_prepper.rb +++ b/lib/collectionspace/mapper/non_hierarchical_relationship_prepper.rb @@ -70,7 +70,7 @@ def get_rec_csid(id, type) instance_variable_set(:@type, type) obj_csid(id, type) end - + def transform_terms %w[item1_id item2_id].each_with_index do |field, i| transformed = @response.split_data[field].map{ |id| get_rec_csid(id, @types[i]) } diff --git a/lib/collectionspace/mapper/term_handler.rb b/lib/collectionspace/mapper/term_handler.rb index 8e970e3a..78477d80 100644 --- a/lib/collectionspace/mapper/term_handler.rb +++ b/lib/collectionspace/mapper/term_handler.rb @@ -58,7 +58,6 @@ def handle_term(val) field: column } - if in_cache?(val) refname_urn = cached_term(val, :refname) if refname_urn @@ -110,7 +109,7 @@ def add_new_unknown_term(val, term_report) def add_known_unknown_term(val, term_report) refname_url = cached_term(val, :refname, 'unknownvalue', "#{type}/#{subtype}") - #refname_url = @cache.get('unknownvalue', type_subtype, val)[:refname] + # refname_url = @cache.get('unknownvalue', type_subtype, val)[:refname] refname_obj = CollectionSpace::Mapper::Tools::RefName.new(urn: refname_url) @terms << term_report.merge({found: false, refname: refname_obj}) add_missing_record_error('term', val) diff --git a/lib/collectionspace/mapper/term_searchable.rb b/lib/collectionspace/mapper/term_searchable.rb index 424c914d..beb9f969 100644 --- a/lib/collectionspace/mapper/term_searchable.rb +++ b/lib/collectionspace/mapper/term_searchable.rb @@ -19,7 +19,7 @@ def cached_as_unknown?(val) end private def type_subtype - "#{type}/#{subtype}" + "#{type}/#{subtype}" end # returns refName of cached term @@ -32,11 +32,11 @@ def cached_term(val, return_key = :refname, termtype = type, termsubtype = subty end private def convert_cached_value(cache_response) - return cache_response if cache_response.is_a?(Hash) + return cache_response if cache_response.is_a?(Hash) - instance_eval(cache_response) + instance_eval(cache_response) end - + # returns refName of searched (term) def searched_term(val, return_key = :refname) response = term_search_response(val) @@ -44,50 +44,49 @@ def searched_term(val, return_key = :refname) rec = rec_from_response('term', val, response) return nil unless rec - cache_value = { refname: rec['refName'], csid: rec['csid'] } + cache_value = {refname: rec['refName'], csid: rec['csid']} @cache.put(type, subtype, val, cache_value) cache_value[return_key] end private def case_swap(string) - string.match?(/[A-Z]/) ? string.downcase : string.capitalize + string.match?(/[A-Z]/) ? string.downcase : string.capitalize end - private def term_search_response(val) - as_is = get_term_response(val) - return as_is if term_response_usable?(as_is) + as_is = get_term_response(val) + return as_is if term_response_usable?(as_is) - get_term_response(case_swap(val)) + get_term_response(case_swap(val)) end - + private def get_term_response(val) - response = @client.find( - type: type, - subtype: subtype, - value: val, - field: search_field - ) - rescue StandardError => e - puts e.message - nil - else - parse_response(response) + response = @client.find( + type: type, + subtype: subtype, + value: val, + field: search_field + ) + rescue StandardError => e + puts e.message + nil + else + parse_response(response) end private def parse_response(response) - parsed = response.parsed['abstract_common_list'] - rescue StandardError => e - puts e.message - nil - else - parsed + parsed = response.parsed['abstract_common_list'] + rescue StandardError => e + puts e.message + nil + else + parsed end - + def obj_csid(objnum, type) cached = @cache.get(type, '', objnum, search: false) return convert_cached_value(cached)[:csid] if cached - + lookup_obj_or_procedure_csid(objnum, type) end @@ -99,7 +98,7 @@ def lookup_obj_or_procedure_csid(objnum, type) return nil unless rec csid = rec['csid'] - @cache.put(type, '', objnum, { refname: rec['refName'], csid: csid } ) + @cache.put(type, '', objnum, {refname: rec['refName'], csid: csid} ) csid else errors << { @@ -122,76 +121,76 @@ def term_csid(term) end private def term_response_usable?(response) - ct = response_item_count(response) - return false unless ct - return false if ct == 0 + ct = response_item_count(response) + return false unless ct + return false if ct == 0 - true + true end - + private def response_item_count(response) - ct = response.dig('totalItems') - return ct.to_i if ct + ct = response.dig('totalItems') + return ct.to_i if ct - nil + nil end private def add_missing_record_error(category, val) - datacolumn = column ||= 'data' - - errors << { - category: "no_records_found_for_#{category}".to_sym, - field: '', - type: '', - subtype: '', - value: val, - message: "#{val} (#{type_subtype} in #{datacolumn} column)" - } + datacolumn = column ||= 'data' + + errors << { + category: "no_records_found_for_#{category}".to_sym, + field: '', + type: '', + subtype: '', + value: val, + message: "#{val} (#{type_subtype} in #{datacolumn} column)" + } end - + private def rec_from_response(category, val, response) - term_ct = response_item_count(response) - - unless term_ct - errors << { - category: "unsuccessful_csid_lookup_for_#{category}".to_sym, - field: '', - type: type, - subtype: subtype, - value: val, - message: "Problem with search for #{val}" - } - return nil - end - - case term_ct - when 0 - add_missing_record_error(category, val) - rec = nil - when 1 - rec = response['list_item'] - else - rec = response['list_item'][0] - using_uri = "#{@client.config.base_uri}#{rec['uri']}" - warnings << { - category: "multiple_records_found_for_#{category}".to_sym, - field: '', - type: type, - subtype: subtype, - value: val, - message: "#{term_ct} records found. Using #{using_uri}" - } - end - - rec + term_ct = response_item_count(response) + + unless term_ct + errors << { + category: "unsuccessful_csid_lookup_for_#{category}".to_sym, + field: '', + type: type, + subtype: subtype, + value: val, + message: "Problem with search for #{val}" + } + return nil + end + + case term_ct + when 0 + add_missing_record_error(category, val) + rec = nil + when 1 + rec = response['list_item'] + else + rec = response['list_item'][0] + using_uri = "#{@client.config.base_uri}#{rec['uri']}" + warnings << { + category: "multiple_records_found_for_#{category}".to_sym, + field: '', + type: type, + subtype: subtype, + value: val, + message: "#{term_ct} records found. Using #{using_uri}" + } + end + + rec end - + private def search_field - field = CollectionSpace::Service.get(type: type)[:term] - rescue StandardError => e - puts e.message - else - field + field = CollectionSpace::Service.get(type: type)[:term] + rescue StandardError => e + puts e.message + else + field end # added toward refactoring that isn't done yet diff --git a/lib/collectionspace/mapper/tools/record_status_service.rb b/lib/collectionspace/mapper/tools/record_status_service.rb index 07158f51..581b9d8b 100644 --- a/lib/collectionspace/mapper/tools/record_status_service.rb +++ b/lib/collectionspace/mapper/tools/record_status_service.rb @@ -46,14 +46,14 @@ def lookup(value) item = response.parsed[@response_top][@response_nested].first num_found = response.parsed[@response_top][@response_nested].length - reportable_result(item).merge({ multiple_recs_found: num_found}) + reportable_result(item).merge({multiple_recs_found: num_found}) end end private def reportable_result(item = nil) - return { status: :new } unless item + return {status: :new} unless item { status: :existing, @@ -62,7 +62,7 @@ def reportable_result(item = nil) refname: item['refName'] } end - + def lookup_non_relationship(value) @client.find( type: @mapper.config.service_path, @@ -77,7 +77,7 @@ def use_first? false end - + def count_results(response) unless response.result.success? raise CollectionSpace::RequestError, response.result.body diff --git a/lib/collectionspace/mapper/value_transformer.rb b/lib/collectionspace/mapper/value_transformer.rb index 01994d61..c2ed8216 100644 --- a/lib/collectionspace/mapper/value_transformer.rb +++ b/lib/collectionspace/mapper/value_transformer.rb @@ -31,14 +31,14 @@ def initialize(value, transforms, prepper) 't' => 'true', 'f' => 'false' } - + def process_replacements return if @value.empty? @transforms[:replacements].each do |rule| find = rule[:find] replace = rule[:replace] - + case rule[:type] when :plain @value = @value.gsub(find, replace) @@ -69,7 +69,7 @@ def process_boolean @value = BOOLEAN_LOOKUP[chkval] return end - + @value = 'false' @warnings << { category: :boolean_value_transform, diff --git a/lib/collectionspace/mapper/xml_template.rb b/lib/collectionspace/mapper/xml_template.rb index 18fbf616..132a1736 100644 --- a/lib/collectionspace/mapper/xml_template.rb +++ b/lib/collectionspace/mapper/xml_template.rb @@ -36,9 +36,9 @@ def create_record_namespace_nodes(xml) def process_group(xml, grouppath) @docstructure.dig(*grouppath).keys.each do |key| thispath = grouppath.clone.append(key) - xml.send(key){ + xml.send(key) do process_group(xml, thispath) - } + end end end end diff --git a/spec/anthro_helpers.rb b/spec/anthro_helpers.rb index a426de04..698158ad 100644 --- a/spec/anthro_helpers.rb +++ b/spec/anthro_helpers.rb @@ -27,159 +27,159 @@ def anthro_object_mapper def populate_anthro(cache) terms = [ ['conceptauthorities', 'archculture', 'Blackfoot', - { refname: "urn:cspace:anthro.collectionspace.org:conceptauthorities:name(archculture):item:name(Blackfoot1576172504869)'Blackfoot'", csid: '1111-2222-3333-4444' }], + {refname: "urn:cspace:anthro.collectionspace.org:conceptauthorities:name(archculture):item:name(Blackfoot1576172504869)'Blackfoot'", csid: '1111-2222-3333-4444'}], ['conceptauthorities', 'concept', 'Birds', - { refname: "urn:cspace:anthro.collectionspace.org:conceptauthorities:name(concept):item:name(Birds918181)'Birds'", csid: '1111-2222-3333-4444' }], + {refname: "urn:cspace:anthro.collectionspace.org:conceptauthorities:name(concept):item:name(Birds918181)'Birds'", csid: '1111-2222-3333-4444'}], ['conceptauthorities', 'ethculture', 'Batak', - { refname: "urn:cspace:anthro.collectionspace.org:conceptauthorities:name(ethculture):item:name(Batak1576172496916)'Batak'", csid: '1111-2222-3333-4444' }], + {refname: "urn:cspace:anthro.collectionspace.org:conceptauthorities:name(ethculture):item:name(Batak1576172496916)'Batak'", csid: '1111-2222-3333-4444'}], ['conceptauthorities', 'ethculture', 'Got', - { refname: "urn:cspace:anthro.collectionspace.org:conceptauthorities:name(ethculture):item:name(Got1599824429903)'Got'", csid: '1111-2222-3333-4444' }], + {refname: "urn:cspace:anthro.collectionspace.org:conceptauthorities:name(ethculture):item:name(Got1599824429903)'Got'", csid: '1111-2222-3333-4444'}], ['conceptauthorities', 'ethculture', 'Hero', - { refname: "urn:cspace:anthro.collectionspace.org:conceptauthorities:name(ethculture):item:name(Hero1599824418804)'Hero'", csid: '1111-2222-3333-4444' }], + {refname: "urn:cspace:anthro.collectionspace.org:conceptauthorities:name(ethculture):item:name(Hero1599824418804)'Hero'", csid: '1111-2222-3333-4444'}], ['conceptauthorities', 'material_ca', 'Feathers', - { refname: "urn:cspace:anthro.collectionspace.org:conceptauthorities:name(material_ca):item:name(Feathers918181)'Feathers'", csid: '1111-2222-3333-4444' }], + {refname: "urn:cspace:anthro.collectionspace.org:conceptauthorities:name(material_ca):item:name(Feathers918181)'Feathers'", csid: '1111-2222-3333-4444'}], ['orgauthorities', 'organization', 'Hola', - { refname: "urn:cspace:anthro.collectionspace.org:orgauthorities:name(organization):item:name(Hola1599824351945)'Hola'", csid: '1111-2222-3333-4444' }], + {refname: "urn:cspace:anthro.collectionspace.org:orgauthorities:name(organization):item:name(Hola1599824351945)'Hola'", csid: '1111-2222-3333-4444'}], ['orgauthorities', 'organization', 'Organization 1', - { refname: "urn:cspace:anthro.collectionspace.org:orgauthorities:name(organization):item:name(Organization11587136583004)'Organization 1'", csid: '1111-2222-3333-4444' }], + {refname: "urn:cspace:anthro.collectionspace.org:orgauthorities:name(organization):item:name(Organization11587136583004)'Organization 1'", csid: '1111-2222-3333-4444'}], ['orgauthorities', 'organization', 'chores', - { refname: "urn:cspace:anthro.collectionspace.org:orgauthorities:name(organization):item:name(chores1599824370125)'chores'", csid: '1111-2222-3333-4444' }], + {refname: "urn:cspace:anthro.collectionspace.org:orgauthorities:name(organization):item:name(chores1599824370125)'chores'", csid: '1111-2222-3333-4444'}], ['personauthorities', 'person', 'Ann Analyst', - { refname: "urn:cspace:anthro.collectionspace.org:personauthorities:name(person):item:name(AnnAnalyst1594848799340)'Ann Analyst'", csid: '1111-2222-3333-4444' }], + {refname: "urn:cspace:anthro.collectionspace.org:personauthorities:name(person):item:name(AnnAnalyst1594848799340)'Ann Analyst'", csid: '1111-2222-3333-4444'}], ['personauthorities', 'person', 'Gabriel Solares', - { refname: "urn:cspace:anthro.collectionspace.org:personauthorities:name(person):item:name(GabrielSolares1594848906847)'Gabriel Solares'", csid: '1111-2222-3333-4444' }], + {refname: "urn:cspace:anthro.collectionspace.org:personauthorities:name(person):item:name(GabrielSolares1594848906847)'Gabriel Solares'", csid: '1111-2222-3333-4444'}], ['personauthorities', 'person', 'Tegla', - { refname: "urn:cspace:anthro.collectionspace.org:personauthorities:name(person):item:name(Tegla1599824325923)'Tegla'", csid: '1111-2222-3333-4444' }], + {refname: "urn:cspace:anthro.collectionspace.org:personauthorities:name(person):item:name(Tegla1599824325923)'Tegla'", csid: '1111-2222-3333-4444'}], ['personauthorities', 'person', 'Tom', - { refname: "urn:cspace:anthro.collectionspace.org:personauthorities:name(person):item:name(Tom1599824331955)'Tom'", csid: '1111-2222-3333-4444' }], + {refname: "urn:cspace:anthro.collectionspace.org:personauthorities:name(person):item:name(Tom1599824331955)'Tom'", csid: '1111-2222-3333-4444'}], ['placeauthorities', 'place', 'Early', - { refname: "urn:cspace:anthro.collectionspace.org:placeauthorities:name(place):item:name(Early1599824413345)'Early'", csid: '1111-2222-3333-4444' }], + {refname: "urn:cspace:anthro.collectionspace.org:placeauthorities:name(place):item:name(Early1599824413345)'Early'", csid: '1111-2222-3333-4444'}], ['placeauthorities', 'place', 'Local', - { refname: "urn:cspace:anthro.collectionspace.org:placeauthorities:name(place):item:name(Local1599824385298)'Local'", csid: '1111-2222-3333-4444' }], + {refname: "urn:cspace:anthro.collectionspace.org:placeauthorities:name(place):item:name(Local1599824385298)'Local'", csid: '1111-2222-3333-4444'}], ['placeauthorities', 'place', 'York County, Pennsylvania', - { refname: "urn:cspace:anthro.collectionspace.org:placeauthorities:name(place):item:name(YorkCountyPennsylvania)'York County, Pennsylvania'", csid: '1111-2222-3333-4444' }], + {refname: "urn:cspace:anthro.collectionspace.org:placeauthorities:name(place):item:name(YorkCountyPennsylvania)'York County, Pennsylvania'", csid: '1111-2222-3333-4444'}], ['vocabularies', 'agerange', 'adolescent 26-75%', - { refname: "urn:cspace:anthro.collectionspace.org:vocabularies:name(agerange):item:name(adolescent_26_75)'adolescent 26-75%'", csid: '1111-2222-3333-4444' }], + {refname: "urn:cspace:anthro.collectionspace.org:vocabularies:name(agerange):item:name(adolescent_26_75)'adolescent 26-75%'", csid: '1111-2222-3333-4444'}], ['vocabularies', 'agerange', 'adult 0-25%', - { refname: "urn:cspace:anthro.collectionspace.org:vocabularies:name(agerange):item:name(adult_0_25)'adult 0-25%'", csid: '1111-2222-3333-4444' }], + {refname: "urn:cspace:anthro.collectionspace.org:vocabularies:name(agerange):item:name(adult_0_25)'adult 0-25%'", csid: '1111-2222-3333-4444'}], ['vocabularies', 'annotationtype', 'image made', - { refname: "urn:cspace:anthro.collectionspace.org:vocabularies:name(annotationtype):item:name(image_made)'image made'", csid: '1111-2222-3333-4444' }], + {refname: "urn:cspace:anthro.collectionspace.org:vocabularies:name(annotationtype):item:name(image_made)'image made'", csid: '1111-2222-3333-4444'}], ['vocabularies', 'annotationtype', 'type', - { refname: "urn:cspace:anthro.collectionspace.org:vocabularies:name(annotationtype):item:name(type)'type'", csid: '1111-2222-3333-4444' }], + {refname: "urn:cspace:anthro.collectionspace.org:vocabularies:name(annotationtype):item:name(type)'type'", csid: '1111-2222-3333-4444'}], ['vocabularies', 'behrensmeyer', '0 - no cracking or flaking on bone surface', - { refname: "urn:cspace:anthro.collectionspace.org:vocabularies:name(behrensmeyer):item:name(0)'0 - no cracking or flaking on bone surface'", csid: '1111-2222-3333-4444' }], + {refname: "urn:cspace:anthro.collectionspace.org:vocabularies:name(behrensmeyer):item:name(0)'0 - no cracking or flaking on bone surface'", csid: '1111-2222-3333-4444'}], ['vocabularies', 'behrensmeyer', '1 - longitudinal and/or mosaic cracking present on surface', - { refname: "urn:cspace:anthro.collectionspace.org:vocabularies:name(behrensmeyer):item:name(1)'1 - longitudinal and/or mosaic cracking present on surface'", csid: '1111-2222-3333-4444' }], + {refname: "urn:cspace:anthro.collectionspace.org:vocabularies:name(behrensmeyer):item:name(1)'1 - longitudinal and/or mosaic cracking present on surface'", csid: '1111-2222-3333-4444'}], ['vocabularies', 'behrensmeyer', '2 - longitudinal cracks, exfoliation on surface', - { refname: "urn:cspace:anthro.collectionspace.org:vocabularies:name(behrensmeyer):item:name(2)'2 - longitudinal cracks, exfoliation on surface'", csid: '1111-2222-3333-4444' }], + {refname: "urn:cspace:anthro.collectionspace.org:vocabularies:name(behrensmeyer):item:name(2)'2 - longitudinal cracks, exfoliation on surface'", csid: '1111-2222-3333-4444'}], ['vocabularies', 'behrensmeyer', '3 - fibrous texture, extensive exfoliation', - { refname: "urn:cspace:anthro.collectionspace.org:vocabularies:name(behrensmeyer):item:name(3)'3 - fibrous texture, extensive exfoliation'", csid: '1111-2222-3333-4444' }], + {refname: "urn:cspace:anthro.collectionspace.org:vocabularies:name(behrensmeyer):item:name(3)'3 - fibrous texture, extensive exfoliation'", csid: '1111-2222-3333-4444'}], ['vocabularies', 'behrensmeyer', '5 - bone crumbling in situ, large splinters', - { refname: "urn:cspace:anthro.collectionspace.org:vocabularies:name(behrensmeyer):item:name(5)'5 - bone crumbling in situ, large splinters'", csid: '1111-2222-3333-4444' }], + {refname: "urn:cspace:anthro.collectionspace.org:vocabularies:name(behrensmeyer):item:name(5)'5 - bone crumbling in situ, large splinters'", csid: '1111-2222-3333-4444'}], ['vocabularies', 'bodyside', 'midline', - { refname: "urn:cspace:anthro.collectionspace.org:vocabularies:name(bodyside):item:name(midline)'midline'", csid: '1111-2222-3333-4444' }], + {refname: "urn:cspace:anthro.collectionspace.org:vocabularies:name(bodyside):item:name(midline)'midline'", csid: '1111-2222-3333-4444'}], ['vocabularies', 'dateera', 'CE', - { refname: "urn:cspace:anthro.collectionspace.org:vocabularies:name(dateera):item:name(ce)'CE'", csid: '1111-2222-3333-4444' }], + {refname: "urn:cspace:anthro.collectionspace.org:vocabularies:name(dateera):item:name(ce)'CE'", csid: '1111-2222-3333-4444'}], ['vocabularies', 'inventorystatus', 'accessioned', - { refname: "urn:cspace:anthro.collectionspace.org:vocabularies:name(inventorystatus):item:name(accessioned)'accessioned'", csid: '1111-2222-3333-4444' }], + {refname: "urn:cspace:anthro.collectionspace.org:vocabularies:name(inventorystatus):item:name(accessioned)'accessioned'", csid: '1111-2222-3333-4444'}], ['vocabularies', 'inventorystatus', 'unknown', - { refname: "urn:cspace:anthro.collectionspace.org:vocabularies:name(inventorystatus):item:name(unknown)'unknown'", csid: '1111-2222-3333-4444' }], + {refname: "urn:cspace:anthro.collectionspace.org:vocabularies:name(inventorystatus):item:name(unknown)'unknown'", csid: '1111-2222-3333-4444'}], ['vocabularies', 'languages', 'Chinese', - { refname: "urn:cspace:anthro.collectionspace.org:vocabularies:name(languages):item:name(zho)'Chinese'", csid: '1111-2222-3333-4444' }], + {refname: "urn:cspace:anthro.collectionspace.org:vocabularies:name(languages):item:name(zho)'Chinese'", csid: '1111-2222-3333-4444'}], ['vocabularies', 'languages', 'English', - { refname: "urn:cspace:anthro.collectionspace.org:vocabularies:name(languages):item:name(eng)'English'", csid: '1111-2222-3333-4444' }], + {refname: "urn:cspace:anthro.collectionspace.org:vocabularies:name(languages):item:name(eng)'English'", csid: '1111-2222-3333-4444'}], ['vocabularies', 'languages', 'French', - { refname: "urn:cspace:anthro.collectionspace.org:vocabularies:name(languages):item:name(fra)'French'", csid: '1111-2222-3333-4444' }], + {refname: "urn:cspace:anthro.collectionspace.org:vocabularies:name(languages):item:name(fra)'French'", csid: '1111-2222-3333-4444'}], ['vocabularies', 'languages', 'German', - { refname: "urn:cspace:anthro.collectionspace.org:vocabularies:name(languages):item:name(deu)'German'", csid: '1111-2222-3333-4444' }], + {refname: "urn:cspace:anthro.collectionspace.org:vocabularies:name(languages):item:name(deu)'German'", csid: '1111-2222-3333-4444'}], ['vocabularies', 'languages', 'Spanish', - { refname: "urn:cspace:anthro.collectionspace.org:vocabularies:name(languages):item:name(spa)'Spanish'", csid: '1111-2222-3333-4444' }], + {refname: "urn:cspace:anthro.collectionspace.org:vocabularies:name(languages):item:name(spa)'Spanish'", csid: '1111-2222-3333-4444'}], ['vocabularies', 'limitationlevel', 'recommendation', - { refname: "urn:cspace:anthro.collectionspace.org:vocabularies:name(limitationlevel):item:name(recommendation)'recommendation'", csid: '1111-2222-3333-4444' }], + {refname: "urn:cspace:anthro.collectionspace.org:vocabularies:name(limitationlevel):item:name(recommendation)'recommendation'", csid: '1111-2222-3333-4444'}], ['vocabularies', 'limitationlevel', 'restriction', - { refname: "urn:cspace:anthro.collectionspace.org:vocabularies:name(limitationlevel):item:name(restriction)'restriction'", csid: '1111-2222-3333-4444' }], + {refname: "urn:cspace:anthro.collectionspace.org:vocabularies:name(limitationlevel):item:name(restriction)'restriction'", csid: '1111-2222-3333-4444'}], ['vocabularies', 'limitationtype', 'lending', - { refname: "urn:cspace:anthro.collectionspace.org:vocabularies:name(limitationtype):item:name(lending)'lending'", csid: '1111-2222-3333-4444' }], + {refname: "urn:cspace:anthro.collectionspace.org:vocabularies:name(limitationtype):item:name(lending)'lending'", csid: '1111-2222-3333-4444'}], ['vocabularies', 'limitationtype', 'publication', - { refname: "urn:cspace:anthro.collectionspace.org:vocabularies:name(limitationtype):item:name(publication)'publication'", csid: '1111-2222-3333-4444' }], + {refname: "urn:cspace:anthro.collectionspace.org:vocabularies:name(limitationtype):item:name(publication)'publication'", csid: '1111-2222-3333-4444'}], ['vocabularies', 'mortuarytreatment', 'burned/unburned bone mixture', - { refname: "urn:cspace:anthro.collectionspace.org:vocabularies:name(mortuarytreatment):item:name(burnedunburnedbonemixture)'burned/unburned bone mixture'", csid: '1111-2222-3333-4444' }], + {refname: "urn:cspace:anthro.collectionspace.org:vocabularies:name(mortuarytreatment):item:name(burnedunburnedbonemixture)'burned/unburned bone mixture'", csid: '1111-2222-3333-4444'}], ['vocabularies', 'mortuarytreatment', 'enbalmed', - { refname: "urn:cspace:anthro.collectionspace.org:vocabularies:name(mortuarytreatment):item:name(enbalmed)'enbalmed'", csid: '1111-2222-3333-4444' }], + {refname: "urn:cspace:anthro.collectionspace.org:vocabularies:name(mortuarytreatment):item:name(enbalmed)'enbalmed'", csid: '1111-2222-3333-4444'}], ['vocabularies', 'mortuarytreatment', 'excarnated', - { refname: "urn:cspace:anthro.collectionspace.org:vocabularies:name(mortuarytreatment):item:name(excarnated)'excarnated'", csid: '1111-2222-3333-4444' }], + {refname: "urn:cspace:anthro.collectionspace.org:vocabularies:name(mortuarytreatment):item:name(excarnated)'excarnated'", csid: '1111-2222-3333-4444'}], ['vocabularies', 'mortuarytreatment', 'mummified', - { refname: "urn:cspace:anthro.collectionspace.org:vocabularies:name(mortuarytreatment):item:name(mummified)'mummified'", csid: '1111-2222-3333-4444' }], + {refname: "urn:cspace:anthro.collectionspace.org:vocabularies:name(mortuarytreatment):item:name(mummified)'mummified'", csid: '1111-2222-3333-4444'}], ['vocabularies', 'nagpracategory', 'not subject to NAGPRA', - { refname: "urn:cspace:anthro.collectionspace.org:vocabularies:name(nagpracategory):item:name(nonNagpra)'not subject to NAGPRA'", csid: '1111-2222-3333-4444' }], + {refname: "urn:cspace:anthro.collectionspace.org:vocabularies:name(nagpracategory):item:name(nonNagpra)'not subject to NAGPRA'", csid: '1111-2222-3333-4444'}], ['vocabularies', 'nagpracategory', 'subject to NAGPRA (unspec.)', - { refname: "urn:cspace:anthro.collectionspace.org:vocabularies:name(nagpracategory):item:name(subjectToNAGPRA)'subject to NAGPRA (unspec.)'", csid: '1111-2222-3333-4444' }], + {refname: "urn:cspace:anthro.collectionspace.org:vocabularies:name(nagpracategory):item:name(subjectToNAGPRA)'subject to NAGPRA (unspec.)'", csid: '1111-2222-3333-4444'}], ['vocabularies', 'nagpraclaimtype', 'affiliated human skeletal remains (HSR)', - { refname: "urn:cspace:anthro.collectionspace.org:vocabularies:name(nagpraclaimtype):item:name(affiliatedHsr)'affiliated human skeletal remains (HSR)'", csid: '1111-2222-3333-4444' }], + {refname: "urn:cspace:anthro.collectionspace.org:vocabularies:name(nagpraclaimtype):item:name(affiliatedHsr)'affiliated human skeletal remains (HSR)'", csid: '1111-2222-3333-4444'}], ['vocabularies', 'nagpraclaimtype', 'needs further research', - { refname: "urn:cspace:anthro.collectionspace.org:vocabularies:name(nagpraclaimtype):item:name(needsFurtherResearch)'needs further research'", csid: '1111-2222-3333-4444' }], + {refname: "urn:cspace:anthro.collectionspace.org:vocabularies:name(nagpraclaimtype):item:name(needsFurtherResearch)'needs further research'", csid: '1111-2222-3333-4444'}], ['vocabularies', 'nagpraclaimtype', 'not subject to NAGPRA', - { refname: "urn:cspace:anthro.collectionspace.org:vocabularies:name(nagpraclaimtype):item:name(nonNagpra)'not subject to NAGPRA'", csid: '1111-2222-3333-4444' }], + {refname: "urn:cspace:anthro.collectionspace.org:vocabularies:name(nagpraclaimtype):item:name(nonNagpra)'not subject to NAGPRA'", csid: '1111-2222-3333-4444'}], ['vocabularies', 'nagpraclaimtype', 'object of cultural patrimony', - { refname: "urn:cspace:anthro.collectionspace.org:vocabularies:name(nagpraclaimtype):item:name(objectOfCulturalPatrimony)'object of cultural patrimony'", csid: '1111-2222-3333-4444' }], + {refname: "urn:cspace:anthro.collectionspace.org:vocabularies:name(nagpraclaimtype):item:name(objectOfCulturalPatrimony)'object of cultural patrimony'", csid: '1111-2222-3333-4444'}], ['vocabularies', 'nagpraclaimtype', 'unassociated funerary object (UFO)', - { refname: "urn:cspace:anthro.collectionspace.org:vocabularies:name(nagpraclaimtype):item:name(ufo)'unassociated funerary object (UFO)'", csid: '1111-2222-3333-4444' }], + {refname: "urn:cspace:anthro.collectionspace.org:vocabularies:name(nagpraclaimtype):item:name(ufo)'unassociated funerary object (UFO)'", csid: '1111-2222-3333-4444'}], ['vocabularies', 'prodpeoplerole', 'designed after', - { refname: "urn:cspace:anthro.collectionspace.org:vocabularies:name(prodpeoplerole):item:name(designedAfter)'designed after'", csid: '1111-2222-3333-4444' }], + {refname: "urn:cspace:anthro.collectionspace.org:vocabularies:name(prodpeoplerole):item:name(designedAfter)'designed after'", csid: '1111-2222-3333-4444'}], ['vocabularies', 'prodpeoplerole', 'traditional makers', - { refname: "urn:cspace:anthro.collectionspace.org:vocabularies:name(prodpeoplerole):item:name(traditionalMakers)'traditional makers'", csid: '1111-2222-3333-4444' }], + {refname: "urn:cspace:anthro.collectionspace.org:vocabularies:name(prodpeoplerole):item:name(traditionalMakers)'traditional makers'", csid: '1111-2222-3333-4444'}], ['vocabularies', 'publishto', 'DPLA', - { refname: "urn:cspace:anthro.collectionspace.org:vocabularies:name(publishto):item:name(dpla)'DPLA'", csid: '1111-2222-3333-4444' }], + {refname: "urn:cspace:anthro.collectionspace.org:vocabularies:name(publishto):item:name(dpla)'DPLA'", csid: '1111-2222-3333-4444'}], ['vocabularies', 'publishto', 'Omeka', - { refname: "urn:cspace:anthro.collectionspace.org:vocabularies:name(publishto):item:name(omeka)'Omeka'", csid: '1111-2222-3333-4444' }], + {refname: "urn:cspace:anthro.collectionspace.org:vocabularies:name(publishto):item:name(omeka)'Omeka'", csid: '1111-2222-3333-4444'}], ['vocabularies', 'cranialdeformationcategory', 'other (describe)', - { refname: "urn:cspace:anthro.collectionspace.org:vocabularies:name(cranialdeformationcategory):item:name(other)'other (describe)'", csid: '1111-2222-3333-4444' }], + {refname: "urn:cspace:anthro.collectionspace.org:vocabularies:name(cranialdeformationcategory):item:name(other)'other (describe)'", csid: '1111-2222-3333-4444'}], ['vocabularies', 'cranialdeformationcategory', 'tabular', - { refname: "urn:cspace:anthro.collectionspace.org:vocabularies:name(cranialdeformationcategory):item:name(tabular)'tabular'", csid: '1111-2222-3333-4444' }], + {refname: "urn:cspace:anthro.collectionspace.org:vocabularies:name(cranialdeformationcategory):item:name(tabular)'tabular'", csid: '1111-2222-3333-4444'}], ['vocabularies', 'cranialdeformationcategory', 'circumferential', - { refname: "urn:cspace:anthro.collectionspace.org:vocabularies:name(cranialdeformationcategory):item:name(circumferential)'circumferential'", csid: '1111-2222-3333-4444' }], + {refname: "urn:cspace:anthro.collectionspace.org:vocabularies:name(cranialdeformationcategory):item:name(circumferential)'circumferential'", csid: '1111-2222-3333-4444'}], ['vocabularies', 'trepanationcertainty', 'possible trepanation', - { refname: "urn:cspace:anthro.collectionspace.org:vocabularies:name(trepanationcertainty):item:name(possible)'possible trepanation'", csid: '1111-2222-3333-4444' }], + {refname: "urn:cspace:anthro.collectionspace.org:vocabularies:name(trepanationcertainty):item:name(possible)'possible trepanation'", csid: '1111-2222-3333-4444'}], ['vocabularies', 'trepanationcertainty', 'clear evidence of trepanation', - { refname: "urn:cspace:anthro.collectionspace.org:vocabularies:name(trepanationcertainty):item:name(clear)'clear evidence of trepanation'", csid: '1111-2222-3333-4444' }], + {refname: "urn:cspace:anthro.collectionspace.org:vocabularies:name(trepanationcertainty):item:name(clear)'clear evidence of trepanation'", csid: '1111-2222-3333-4444'}], ['vocabularies', 'trepanationtechnique', 'grooving', - { refname: "urn:cspace:anthro.collectionspace.org:vocabularies:name(trepanationtechnique):item:name(grooving)'grooving'", csid: '1111-2222-3333-4444' }], + {refname: "urn:cspace:anthro.collectionspace.org:vocabularies:name(trepanationtechnique):item:name(grooving)'grooving'", csid: '1111-2222-3333-4444'}], ['vocabularies', 'trepanationtechnique', 'grooving', - { refname: "urn:cspace:anthro.collectionspace.org:vocabularies:name(trepanationtechnique):item:name(grooving)'grooving'", csid: '1111-2222-3333-4444' }], + {refname: "urn:cspace:anthro.collectionspace.org:vocabularies:name(trepanationtechnique):item:name(grooving)'grooving'", csid: '1111-2222-3333-4444'}], ['vocabularies', 'trepanationhealing', 'possible healing', - { refname: "urn:cspace:anthro.collectionspace.org:vocabularies:name(trepanationhealing):item:name(possible)'possible healing'", csid: '1111-2222-3333-4444' }], + {refname: "urn:cspace:anthro.collectionspace.org:vocabularies:name(trepanationhealing):item:name(possible)'possible healing'", csid: '1111-2222-3333-4444'}], ['vocabularies', 'trepanationhealing', 'no healing', - { refname: "urn:cspace:anthro.collectionspace.org:vocabularies:name(trepanationhealing):item:name(none)'no healing'", csid: '1111-2222-3333-4444' }], + {refname: "urn:cspace:anthro.collectionspace.org:vocabularies:name(trepanationhealing):item:name(none)'no healing'", csid: '1111-2222-3333-4444'}], ['vocabularies', 'trepanationhealing', 'definite evidence for healing', - { refname: "urn:cspace:anthro.collectionspace.org:vocabularies:name(trepanationhealing):item:name(definite)'definite evidence for healing'", csid: '1111-2222-3333-4444' }], + {refname: "urn:cspace:anthro.collectionspace.org:vocabularies:name(trepanationhealing):item:name(definite)'definite evidence for healing'", csid: '1111-2222-3333-4444'}], ['vocabularies', 'mortuarytreatment', 'excarnated', - { refname: "urn:cspace:anthro.collectionspace.org:vocabularies:name(mortuarytreatment):item:name(excarnated)'excarnated'", csid: '1111-2222-3333-4444' }], + {refname: "urn:cspace:anthro.collectionspace.org:vocabularies:name(mortuarytreatment):item:name(excarnated)'excarnated'", csid: '1111-2222-3333-4444'}], ['vocabularies', 'behrensmeyer', '3 - fibrous texture, extensive exfoliation', - { refname: "urn:cspace:anthro.collectionspace.org:vocabularies:name(behrensmeyer):item:name(3)'3 - fibrous texture, extensive exfoliation'", csid: '1111-2222-3333-4444' }], + {refname: "urn:cspace:anthro.collectionspace.org:vocabularies:name(behrensmeyer):item:name(3)'3 - fibrous texture, extensive exfoliation'", csid: '1111-2222-3333-4444'}], ['vocabularies', 'dateera', 'CE', - { refname: "urn:cspace:anthro.collectionspace.org:vocabularies:name(dateera):item:name(ce)'CE'", csid: '1111-2222-3333-4444' }], + {refname: "urn:cspace:anthro.collectionspace.org:vocabularies:name(dateera):item:name(ce)'CE'", csid: '1111-2222-3333-4444'}], ['vocabularies', 'dateera', 'CE', - { refname: "urn:cspace:anthro.collectionspace.org:vocabularies:name(dateera):item:name(ce)'CE'", csid: '1111-2222-3333-4444' }], + {refname: "urn:cspace:anthro.collectionspace.org:vocabularies:name(dateera):item:name(ce)'CE'", csid: '1111-2222-3333-4444'}], ['vocabularies', 'dateera', 'CE', - { refname: "urn:cspace:anthro.collectionspace.org:vocabularies:name(dateera):item:name(ce)'CE'", csid: '1111-2222-3333-4444' }], + {refname: "urn:cspace:anthro.collectionspace.org:vocabularies:name(dateera):item:name(ce)'CE'", csid: '1111-2222-3333-4444'}], ['vocabularies', 'dateera', 'CE', - { refname: "urn:cspace:anthro.collectionspace.org:vocabularies:name(dateera):item:name(ce)'CE'", csid: '1111-2222-3333-4444' }], + {refname: "urn:cspace:anthro.collectionspace.org:vocabularies:name(dateera):item:name(ce)'CE'", csid: '1111-2222-3333-4444'}], ['vocabularies', 'osteocompleteness', 'mandible only', - { refname: "urn:cspace:anthro.collectionspace.org:vocabularies:name(osteocompleteness):item:name(mandible)'mandible only'", csid: '1111-2222-3333-4444' }], + {refname: "urn:cspace:anthro.collectionspace.org:vocabularies:name(osteocompleteness):item:name(mandible)'mandible only'", csid: '1111-2222-3333-4444'}], ['vocabularies', 'behrensmeyer', - '4 - coarsely fibrous texture, splinters of bone loose on the surface, open cracks', { refname: "urn:cspace:anthro.collectionspace.org:vocabularies:name(behrensmeyer):item:name(4)'4 - coarsely fibrous texture, splinters of bone loose on the surface, open cracks'", csid: '1111-2222-3333-4444' }], + '4 - coarsely fibrous texture, splinters of bone loose on the surface, open cracks', {refname: "urn:cspace:anthro.collectionspace.org:vocabularies:name(behrensmeyer):item:name(4)'4 - coarsely fibrous texture, splinters of bone loose on the surface, open cracks'", csid: '1111-2222-3333-4444'}], ['vocabularies', 'dentitionscore', 'not applicable', - { refname: "urn:cspace:anthro.collectionspace.org:vocabularies:name(dentitionscore):item:name(notapplicable)'not applicable'", csid: '1111-2222-3333-4444' }], + {refname: "urn:cspace:anthro.collectionspace.org:vocabularies:name(dentitionscore):item:name(notapplicable)'not applicable'", csid: '1111-2222-3333-4444'}], ['personauthorities', 'person', 'sniper', - { refname: "urn:cspace:anthro.collectionspace.org:personauthorities:name(person):item:name(sniper1599821165616)'sniper'", csid: '1111-2222-3333-4444' }], + {refname: "urn:cspace:anthro.collectionspace.org:personauthorities:name(person):item:name(sniper1599821165616)'sniper'", csid: '1111-2222-3333-4444'}], ['personauthorities', 'person', 'fullclip', - { refname: "urn:cspace:anthro.collectionspace.org:personauthorities:name(person):item:name(fullclip1599821193344)'fullclip'", csid: '1111-2222-3333-4444' }], + {refname: "urn:cspace:anthro.collectionspace.org:personauthorities:name(person):item:name(fullclip1599821193344)'fullclip'", csid: '1111-2222-3333-4444'}], ['personauthorities', 'person', 'fullclip', - { refname: "urn:cspace:anthro.collectionspace.org:personauthorities:name(person):item:name(fullclip1599821140041)'fullclip'", csid: '1111-2222-3333-4444' }], + {refname: "urn:cspace:anthro.collectionspace.org:personauthorities:name(person):item:name(fullclip1599821140041)'fullclip'", csid: '1111-2222-3333-4444'}], ['personauthorities', 'person', 'praya', - { refname: "urn:cspace:anthro.collectionspace.org:personauthorities:name(person):item:name(praya1599821095120)'praya'", csid: '1111-2222-3333-4444' }], + {refname: "urn:cspace:anthro.collectionspace.org:personauthorities:name(person):item:name(praya1599821095120)'praya'", csid: '1111-2222-3333-4444'}], ['personauthorities', 'person', 'jijoe', - { refname: "urn:cspace:anthro.collectionspace.org:personauthorities:name(person):item:name(jijoe1599821246989)'jijoe'", csid: '1111-2222-3333-4444' }], + {refname: "urn:cspace:anthro.collectionspace.org:personauthorities:name(person):item:name(jijoe1599821246989)'jijoe'", csid: '1111-2222-3333-4444'}], ] populate(cache, terms) end diff --git a/spec/bonsai_helpers.rb b/spec/bonsai_helpers.rb index dc81187a..0a836d98 100644 --- a/spec/bonsai_helpers.rb +++ b/spec/bonsai_helpers.rb @@ -22,27 +22,27 @@ def bonsai_cache def populate_bonsai(cache) terms = [ ['orgauthorities', 'organization', 'Bonsai Museum', - { refname: "urn:cspace:bonsai.collectionspace.org:orgauthorities:name(organization):item:name(BonsaiMuseum1598919439027)'Bonsai Museum'", csid: '1111-2222-3333-4444' }], + {refname: "urn:cspace:bonsai.collectionspace.org:orgauthorities:name(organization):item:name(BonsaiMuseum1598919439027)'Bonsai Museum'", csid: '1111-2222-3333-4444'}], ['orgauthorities', 'organization', 'Bonsai Store', - { refname: "urn:cspace:bonsai.collectionspace.org:orgauthorities:name(organization):item:name(BonsaiStore1598920297843)'Bonsai Store'", csid: '1111-2222-3333-4444' }], + {refname: "urn:cspace:bonsai.collectionspace.org:orgauthorities:name(organization):item:name(BonsaiStore1598920297843)'Bonsai Store'", csid: '1111-2222-3333-4444'}], ['personauthorities', 'person', 'Ann Authorizer', - { refname: "urn:cspace:bonsai.collectionspace.org:personauthorities:name(person):item:name(AnnAuthorizer1598919551068)'Ann Authorizer'", csid: '1111-2222-3333-4444' }], + {refname: "urn:cspace:bonsai.collectionspace.org:personauthorities:name(person):item:name(AnnAuthorizer1598919551068)'Ann Authorizer'", csid: '1111-2222-3333-4444'}], ['personauthorities', 'person', 'Debbie Depositor', - { refname: "urn:cspace:bonsai.collectionspace.org:personauthorities:name(person):item:name(DebbieDepositor1598919493867)'Debbie Depositor'", csid: '1111-2222-3333-4444' }], + {refname: "urn:cspace:bonsai.collectionspace.org:personauthorities:name(person):item:name(DebbieDepositor1598919493867)'Debbie Depositor'", csid: '1111-2222-3333-4444'}], ['personauthorities', 'person', 'Priscilla Plantsale', - { refname: "urn:cspace:bonsai.collectionspace.org:personauthorities:name(person):item:name(PriscillaPlantsale1598920259864)'Priscilla Plantsale'", csid: '1111-2222-3333-4444' }], + {refname: "urn:cspace:bonsai.collectionspace.org:personauthorities:name(person):item:name(PriscillaPlantsale1598920259864)'Priscilla Plantsale'", csid: '1111-2222-3333-4444'}], ['vocabularies', 'currency', 'Canadian Dollar', - { refname: "urn:cspace:bonsai.collectionspace.org:vocabularies:name(currency):item:name(CAD)'Canadian Dollar'", csid: '1111-2222-3333-4444' }], + {refname: "urn:cspace:bonsai.collectionspace.org:vocabularies:name(currency):item:name(CAD)'Canadian Dollar'", csid: '1111-2222-3333-4444'}], ['vocabularies', 'dateera', 'CE', - { refname: "urn:cspace:anthro.collectionspace.org:vocabularies:name(dateera):item:name(ce)'CE'", csid: '1111-2222-3333-4444' }], + {refname: "urn:cspace:anthro.collectionspace.org:vocabularies:name(dateera):item:name(ce)'CE'", csid: '1111-2222-3333-4444'}], ['vocabularies', 'deaccessionapprovalgroup', 'collection committee', - { refname: "urn:cspace:bonsai.collectionspace.org:vocabularies:name(deaccessionapprovalgroup):item:name(collection_committee)'collection committee'", csid: '1111-2222-3333-4444' }], + {refname: "urn:cspace:bonsai.collectionspace.org:vocabularies:name(deaccessionapprovalgroup):item:name(collection_committee)'collection committee'", csid: '1111-2222-3333-4444'}], ['vocabularies', 'deaccessionapprovalstatus', 'approved', - { refname: "urn:cspace:bonsai.collectionspace.org:vocabularies:name(deaccessionapprovalstatus):item:name(approved)'approved'", csid: '1111-2222-3333-4444' }], + {refname: "urn:cspace:bonsai.collectionspace.org:vocabularies:name(deaccessionapprovalstatus):item:name(approved)'approved'", csid: '1111-2222-3333-4444'}], ['vocabularies', 'deaccessionapprovalstatus', 'not required', - { refname: "urn:cspace:bonsai.collectionspace.org:vocabularies:name(deaccessionapprovalstatus):item:name(not_required)'not required'", csid: '1111-2222-3333-4444' }], + {refname: "urn:cspace:bonsai.collectionspace.org:vocabularies:name(deaccessionapprovalstatus):item:name(not_required)'not required'", csid: '1111-2222-3333-4444'}], ['vocabularies', 'disposalmethod', 'public auction', - { refname: "urn:cspace:bonsai.collectionspace.org:vocabularies:name(disposalmethod):item:name(public_auction)'public auction'", csid: '1111-2222-3333-4444' }], + {refname: "urn:cspace:bonsai.collectionspace.org:vocabularies:name(disposalmethod):item:name(public_auction)'public auction'", csid: '1111-2222-3333-4444'}], ] populate(cache, terms) end diff --git a/spec/botgarden_helpers.rb b/spec/botgarden_helpers.rb index 73f901bd..f7aef6e8 100644 --- a/spec/botgarden_helpers.rb +++ b/spec/botgarden_helpers.rb @@ -22,61 +22,61 @@ def botgarden_cache def populate_botgarden(cache) terms = [ ['citationauthorities', 'citation', 'FNA Volume 19', - { refname: "urn:cspace:botgarden.collectionspace.org:citationauthorities:name(citation):item:name(FNAVolume191599238760383)'FNA Volume 19'", csid: '1111-2222-3333-4444' }], + {refname: "urn:cspace:botgarden.collectionspace.org:citationauthorities:name(citation):item:name(FNAVolume191599238760383)'FNA Volume 19'", csid: '1111-2222-3333-4444'}], ['citationauthorities', 'citation', 'Sp. Pl. 2: 899. 1753', - { refname: "urn:cspace:botgarden.collectionspace.org:citationauthorities:name(citation):item:name(SpPl289917531599238184211)'Sp. Pl. 2: 899. 1753'", csid: '1111-2222-3333-4444' }], + {refname: "urn:cspace:botgarden.collectionspace.org:citationauthorities:name(citation):item:name(SpPl289917531599238184211)'Sp. Pl. 2: 899. 1753'", csid: '1111-2222-3333-4444'}], ['citationauthorities', 'worldcat', 'Bull. Torrey Bot. Club', - { refname: "urn:cspace:botgarden.collectionspace.org:citationauthorities:name(worldcat):item:name(BullTorreyBotClub331599245358364)'Bull. Torrey Bot. Club 33'", csid: '1111-2222-3333-4444' }], + {refname: "urn:cspace:botgarden.collectionspace.org:citationauthorities:name(worldcat):item:name(BullTorreyBotClub331599245358364)'Bull. Torrey Bot. Club 33'", csid: '1111-2222-3333-4444'}], ['conceptauthorities', 'concept', 'Official', - { refname: "urn:cspace:botgarden.collectionspace.org:conceptauthorities:name(concept):item:name(Official1599737276242)'Official'", csid: '1111-2222-3333-4444' }], + {refname: "urn:cspace:botgarden.collectionspace.org:conceptauthorities:name(concept):item:name(Official1599737276242)'Official'", csid: '1111-2222-3333-4444'}], ['locationauthorities', 'location', 'Corner', - { refname: "urn:cspace:botgarden.collectionspace.org:locationauthorities:name(location):item:name(Corner1599737289184)'Corner'", csid: '1111-2222-3333-4444' }], + {refname: "urn:cspace:botgarden.collectionspace.org:locationauthorities:name(location):item:name(Corner1599737289184)'Corner'", csid: '1111-2222-3333-4444'}], ['orgauthorities', 'organization', 'FVA', - { refname: "urn:cspace:botgarden.collectionspace.org:orgauthorities:name(organization):item:name(FVA1599246022216)'FVA'", csid: '1111-2222-3333-4444' }], + {refname: "urn:cspace:botgarden.collectionspace.org:orgauthorities:name(organization):item:name(FVA1599246022216)'FVA'", csid: '1111-2222-3333-4444'}], ['personauthorities', 'person', 'Linnaeus, Carl', - { refname: "urn:cspace:botgarden.collectionspace.org:personauthorities:name(person):item:name(LinnaeusCarl1599238374086)'Linnaeus, Carl'", csid: '1111-2222-3333-4444' }], + {refname: "urn:cspace:botgarden.collectionspace.org:personauthorities:name(person):item:name(LinnaeusCarl1599238374086)'Linnaeus, Carl'", csid: '1111-2222-3333-4444'}], ['taxonomyauthority', 'taxon', 'Domestic', - { refname: "urn:cspace:botgarden.collectionspace.org:taxonomyauthority:name(taxon):item:name(Domestic1599750187683)'Domestic'", csid: '1111-2222-3333-4444' }], + {refname: "urn:cspace:botgarden.collectionspace.org:taxonomyauthority:name(taxon):item:name(Domestic1599750187683)'Domestic'", csid: '1111-2222-3333-4444'}], ['taxonomyauthority', 'taxon', 'Tropez', - { refname: "urn:cspace:botgarden.collectionspace.org:taxonomyauthority:name(taxon):item:name(Tropez1599750195530)'Tropez'", csid: '1111-2222-3333-4444' }], + {refname: "urn:cspace:botgarden.collectionspace.org:taxonomyauthority:name(taxon):item:name(Tropez1599750195530)'Tropez'", csid: '1111-2222-3333-4444'}], ['vocabularies', 'cuttingtype', 'hardwood', - { refname: "urn:cspace:botgarden.collectionspace.org:vocabularies:name(cuttingtype):item:name(hardwood)'hardwood'", csid: '1111-2222-3333-4444' }], + {refname: "urn:cspace:botgarden.collectionspace.org:vocabularies:name(cuttingtype):item:name(hardwood)'hardwood'", csid: '1111-2222-3333-4444'}], ['vocabularies', 'dateera', 'CE', - { refname: "urn:cspace:botgarden.collectionspace.org:vocabularies:name(dateera):item:name(ce)'CE'", csid: '1111-2222-3333-4444' }], + {refname: "urn:cspace:botgarden.collectionspace.org:vocabularies:name(dateera):item:name(ce)'CE'", csid: '1111-2222-3333-4444'}], ['vocabularies', 'durationunit', 'Days', - { refname: "urn:cspace:botgarden.collectionspace.org:vocabularies:name(durationunit):item:name(days)'Days'", csid: '1111-2222-3333-4444' }], + {refname: "urn:cspace:botgarden.collectionspace.org:vocabularies:name(durationunit):item:name(days)'Days'", csid: '1111-2222-3333-4444'}], ['vocabularies', 'durationunit', 'Hours', - { refname: "urn:cspace:botgarden.collectionspace.org:vocabularies:name(durationunit):item:name(hours)'Hours'", csid: '1111-2222-3333-4444' }], + {refname: "urn:cspace:botgarden.collectionspace.org:vocabularies:name(durationunit):item:name(hours)'Hours'", csid: '1111-2222-3333-4444'}], ['vocabularies', 'languages', 'English', - { refname: "urn:cspace:botgarden.collectionspace.org:vocabularies:name(languages):item:name(eng)'English'", csid: '1111-2222-3333-4444' }], + {refname: "urn:cspace:botgarden.collectionspace.org:vocabularies:name(languages):item:name(eng)'English'", csid: '1111-2222-3333-4444'}], ['vocabularies', 'languages', 'French', - { refname: "urn:cspace:botgarden.collectionspace.org:vocabularies:name(languages):item:name(fra)'French'", csid: '1111-2222-3333-4444' }], + {refname: "urn:cspace:botgarden.collectionspace.org:vocabularies:name(languages):item:name(fra)'French'", csid: '1111-2222-3333-4444'}], ['vocabularies', 'languages', 'Latin', - { refname: "urn:cspace:botgarden.collectionspace.org:vocabularies:name(languages):item:name(lat)'Latin'", csid: '1111-2222-3333-4444' }], + {refname: "urn:cspace:botgarden.collectionspace.org:vocabularies:name(languages):item:name(lat)'Latin'", csid: '1111-2222-3333-4444'}], ['vocabularies', 'potsize', '1 gal. pot', - { refname: "urn:cspace:botgarden.collectionspace.org:vocabularies:name(potsize):item:name(OneGalPot)'1 gal. pot'", csid: '1111-2222-3333-4444' }], + {refname: "urn:cspace:botgarden.collectionspace.org:vocabularies:name(potsize):item:name(OneGalPot)'1 gal. pot'", csid: '1111-2222-3333-4444'}], ['vocabularies', 'propActivityType', 'benlate and captan', - { refname: "urn:cspace:botgarden.collectionspace.org:vocabularies:name(propActivityType):item:name(benlateAndCaptan)'benlate and captan'", csid: '1111-2222-3333-4444' }], + {refname: "urn:cspace:botgarden.collectionspace.org:vocabularies:name(propActivityType):item:name(benlateAndCaptan)'benlate and captan'", csid: '1111-2222-3333-4444'}], ['vocabularies', 'propChemicals', 'benlate and physan', - { refname: "urn:cspace:botgarden.collectionspace.org:vocabularies:name(propChemicals):item:name(benlateAndPhysan)'benlate and physan'", csid: '1111-2222-3333-4444' }], + {refname: "urn:cspace:botgarden.collectionspace.org:vocabularies:name(propChemicals):item:name(benlateAndPhysan)'benlate and physan'", csid: '1111-2222-3333-4444'}], ['vocabularies', 'propConditions', 'glass cover', - { refname: "urn:cspace:botgarden.collectionspace.org:vocabularies:name(propConditions):item:name(glassCover)'glass cover'", csid: '1111-2222-3333-4444' }], + {refname: "urn:cspace:botgarden.collectionspace.org:vocabularies:name(propConditions):item:name(glassCover)'glass cover'", csid: '1111-2222-3333-4444'}], ['vocabularies', 'propHormones', 'hormone', - { refname: "urn:cspace:botgarden.collectionspace.org:vocabularies:name(propHormones):item:name(hormone)'hormone'", csid: '1111-2222-3333-4444' }], + {refname: "urn:cspace:botgarden.collectionspace.org:vocabularies:name(propHormones):item:name(hormone)'hormone'", csid: '1111-2222-3333-4444'}], ['vocabularies', 'propPlantType', 'bulbs', - { refname: "urn:cspace:botgarden.collectionspace.org:vocabularies:name(propPlantType):item:name(bulbs)'bulbs'", csid: '1111-2222-3333-4444' }], + {refname: "urn:cspace:botgarden.collectionspace.org:vocabularies:name(propPlantType):item:name(bulbs)'bulbs'", csid: '1111-2222-3333-4444'}], ['vocabularies', 'propreason', 'conservation', - { refname: "urn:cspace:botgarden.collectionspace.org:vocabularies:name(propreason):item:name(conservation)'conservation'", csid: '1111-2222-3333-4444' }], + {refname: "urn:cspace:botgarden.collectionspace.org:vocabularies:name(propreason):item:name(conservation)'conservation'", csid: '1111-2222-3333-4444'}], ['vocabularies', 'proptype', 'Division', - { refname: "urn:cspace:botgarden.collectionspace.org:vocabularies:name(proptype):item:name(division)'Division'", csid: '1111-2222-3333-4444' }], + {refname: "urn:cspace:botgarden.collectionspace.org:vocabularies:name(proptype):item:name(division)'Division'", csid: '1111-2222-3333-4444'}], ['vocabularies', 'scarstrat', 'boiling water', - { refname: "urn:cspace:botgarden.collectionspace.org:vocabularies:name(scarstrat):item:name(boilingwater)'boiling water'", csid: '1111-2222-3333-4444' }], + {refname: "urn:cspace:botgarden.collectionspace.org:vocabularies:name(scarstrat):item:name(boilingwater)'boiling water'", csid: '1111-2222-3333-4444'}], ['vocabularies', 'scarstrat', 'cold strat', - { refname: "urn:cspace:botgarden.collectionspace.org:vocabularies:name(scarstrat):item:name(coldstrat)'cold strat'", csid: '1111-2222-3333-4444' }], + {refname: "urn:cspace:botgarden.collectionspace.org:vocabularies:name(scarstrat):item:name(coldstrat)'cold strat'", csid: '1111-2222-3333-4444'}], ['vocabularies', 'taxontermflag', 'invalid', - { refname: "urn:cspace:botgarden.collectionspace.org:vocabularies:name(taxontermflag):item:name(invalid)'invalid'", csid: '1111-2222-3333-4444' }], + {refname: "urn:cspace:botgarden.collectionspace.org:vocabularies:name(taxontermflag):item:name(invalid)'invalid'", csid: '1111-2222-3333-4444'}], ['vocabularies', 'taxontermflag', 'valid', - { refname: "urn:cspace:botgarden.collectionspace.org:vocabularies:name(taxontermflag):item:name(valid)'valid'", csid: '1111-2222-3333-4444' }], + {refname: "urn:cspace:botgarden.collectionspace.org:vocabularies:name(taxontermflag):item:name(valid)'valid'", csid: '1111-2222-3333-4444'}], ] populate(cache, terms) end diff --git a/spec/collectionspace/mapper/column_mapping_spec.rb b/spec/collectionspace/mapper/column_mapping_spec.rb index ad9cec41..05785faa 100644 --- a/spec/collectionspace/mapper/column_mapping_spec.rb +++ b/spec/collectionspace/mapper/column_mapping_spec.rb @@ -27,10 +27,10 @@ end describe '#fullpath' do - let(:hash) { { + let(:hash) do { namespace: 'collectionobjects_common', xpath: ['otherNumberList', 'otherNumber'], - } } + } end it 'returns full xpath to target CollectionSpace field' do expected = 'collectionobjects_common/otherNumberList/otherNumber' expect(mapping.fullpath).to eq(expected) diff --git a/spec/collectionspace/mapper/column_mappings_spec.rb b/spec/collectionspace/mapper/column_mappings_spec.rb index cbe63da9..b981d742 100644 --- a/spec/collectionspace/mapper/column_mappings_spec.rb +++ b/spec/collectionspace/mapper/column_mappings_spec.rb @@ -3,7 +3,7 @@ require 'spec_helper' RSpec.describe CollectionSpace::Mapper::ColumnMappings do - let(:mappings) { [ + let(:mappings) do [ {fieldname: 'objectNumber', transforms: {}, source_type: 'na', @@ -54,14 +54,14 @@ required: 'n'}, {datacolumn: 'otherRequired', required: 'y'} - ] } + ] end let(:recordmapper){ instance_double('CS::Mapper::RecordMapper') } let(:mapperconfig){ instance_double('CS::Mapper::RecordMapperConfig') } let(:mappingsobj){ dc = described_class.new(mappings: mappings, mapper: recordmapper) } - let(:added_field) { { + let(:added_field) do { fieldname: 'addedField', namespace: 'persons_common', data_type: 'string', @@ -70,7 +70,7 @@ repeats: 'n', in_repeating_group: 'n/a', datacolumn: 'addedfield' - } } + } end before do allow(recordmapper).to receive(:config).and_return(mapperconfig) @@ -94,7 +94,7 @@ end context 'when initialized from media RecordMapper' do - let(:mappings) { [ + let(:mappings) do [ {fieldname: 'identificationNumber', transforms: {}, source_type: 'na', @@ -119,7 +119,7 @@ opt_list_values: [], datacolumn: 'title', required: 'n'} - ] } + ] end it 'adds mediaFileURI to mappings' do allow(mapperconfig).to receive(:common_namespace).and_return('media_common') diff --git a/spec/collectionspace/mapper/column_value_spec.rb b/spec/collectionspace/mapper/column_value_spec.rb index bfe2d90a..f92760f2 100644 --- a/spec/collectionspace/mapper/column_value_spec.rb +++ b/spec/collectionspace/mapper/column_value_spec.rb @@ -6,16 +6,16 @@ let(:mapperpath){ 'spec/fixtures/files/mappers/release_6_1/core/core_6-1-0_collectionobject.json'} let(:recmapper){ get_record_mapper_object(mapperpath, core_cache) } let(:mapping){ recmapper.mappings.lookup(colname) } - let(:colval) { described_class.new(column: colname, - value: colvalue, - recmapper: recmapper, - mapping: mapping) } + let(:colval) do described_class.new(column: colname, + value: colvalue, + recmapper: recmapper, + mapping: mapping) end describe '.create' do - let(:creator) { described_class.create(column: colname, - value: colvalue, - recmapper: recmapper, - mapping: mapping) } + let(:creator) do described_class.create(column: colname, + value: colvalue, + recmapper: recmapper, + mapping: mapping) end context 'given core collectionobject collection value' do let(:colname){ 'collection' } diff --git a/spec/collectionspace/mapper/config_spec.rb b/spec/collectionspace/mapper/config_spec.rb index 2ccfc1a0..d38b07bc 100644 --- a/spec/collectionspace/mapper/config_spec.rb +++ b/spec/collectionspace/mapper/config_spec.rb @@ -3,7 +3,7 @@ require 'spec_helper' RSpec.describe CollectionSpace::Mapper::Config do - let(:configstr) { '{ + let(:configstr) do '{ "delimiter": ";", "subgroup_delimiter": "^^", "response_mode": "verbose", @@ -29,15 +29,17 @@ "collection": "library-collection" } }' - } - let(:with_string) { described_class.new(config: configstr) } - let(:confighash) { JSON.parse(configstr) } - let(:with_hash) { described_class.new(config: confighash) } - let(:with_nothing) { described_class.new } - let(:with_array) { described_class.new(config: [2, 3]) } - let(:expected_hash) { {:delimiter=>";", :subgroup_delimiter=>"^^", :response_mode=>"verbose", :strip_id_values=>true, :multiple_recs_found=>'fail', :force_defaults=>false, :check_record_status=>true, :check_terms=>true, :date_format=>"month day year", :two_digit_year_handling=>"convert to four digit", :transforms=>{"collection"=>{:special=>["downcase_value"], :replacements=>[{:find=>" ", :replace=>"-", :type=>"plain"}]}}, :default_values=>{"publishto"=>"DPLA;Omeka", "collection"=>"library-collection"}} } - let(:invalid_response) { {response_mode: 'mouthy'} } - let(:with_invalid_response) { described_class.new(config: invalid_response) } + end + let(:with_string){ described_class.new(config: configstr) } + let(:confighash){ JSON.parse(configstr) } + let(:with_hash){ described_class.new(config: confighash) } + let(:with_nothing){ described_class.new } + let(:with_array){ described_class.new(config: [2, 3]) } + let(:expected_hash) do + {delimiter: ';', subgroup_delimiter: '^^', response_mode: 'verbose', strip_id_values: true, + multiple_recs_found: 'fail', force_defaults: false, check_record_status: true, check_terms: true, date_format: 'month day year', two_digit_year_handling: 'convert to four digit', transforms: {'collection' => {special: ['downcase_value'], replacements: [{find: ' ', replace: '-', type: 'plain'}]}}, default_values: {'publishto' => 'DPLA;Omeka', 'collection' => 'library-collection'}} end + let(:invalid_response){ {response_mode: 'mouthy'} } + let(:with_invalid_response){ described_class.new(config: invalid_response) } context 'when initialized with JSON string' do it 'is created' do diff --git a/spec/collectionspace/mapper/data_handler_spec.rb b/spec/collectionspace/mapper/data_handler_spec.rb index 645250d0..880a91a3 100644 --- a/spec/collectionspace/mapper/data_handler_spec.rb +++ b/spec/collectionspace/mapper/data_handler_spec.rb @@ -3,22 +3,22 @@ require 'spec_helper' RSpec.describe CollectionSpace::Mapper::DataHandler do - let(:client) { core_client } - let(:cache) { core_cache_search } - let(:mapperpath) { 'spec/fixtures/files/mappers/release_6_1/core/core_6-1-0_collectionobject.json' } - let(:mapper) { get_json_record_mapper(mapperpath) } - let(:config) { {"delimiter": "|"} } + let(:client){ core_client } + let(:cache){ core_cache_search } + let(:mapperpath){ 'spec/fixtures/files/mappers/release_6_1/core/core_6-1-0_collectionobject.json' } + let(:mapper){ get_json_record_mapper(mapperpath) } + let(:config){ {"delimiter": '|'} } let(:handler) do CollectionSpace::Mapper::DataHandler.new(record_mapper: mapper, client: client, cache: cache, config: config) end - + # these make services api calls to find terms not in cache context 'when config has check_terms = false', services_call: true do - let(:config) { '{"check_terms": false}' } - let(:result) { handler.process(data).terms.reject{ |t| t[:found] } } + let(:config){ '{"check_terms": false}' } + let(:result){ handler.process(data).terms.reject{ |t| t[:found] } } context 'with terms in instance but not in cache' do let(:data) do @@ -68,7 +68,6 @@ 'contentConceptAssociated' => 'Birds' # authority - not in instance, not in cache } - handler.process(data1) result = handler.process(data2).terms.select{ |t| t[:found] == false } expect(result.length).to eq(1) @@ -76,12 +75,12 @@ describe '#is_authority' do context 'anthro profile' do - let(:client) { anthro_client } - let(:cache) { anthro_cache } + let(:client){ anthro_client } + let(:cache){ anthro_cache } context 'place record' do - let(:mapperpath) { 'spec/fixtures/files/mappers/release_6_1/anthro/anthro_4-1-2_place-local.json' } - + let(:mapperpath){ 'spec/fixtures/files/mappers/release_6_1/anthro/anthro_4-1-2_place-local.json' } + it 'adds a xphash entry for shortIdentifier' do result = handler.mapper.xpath['places_common'][:mappings].select do |mapping| mapping.fieldname == 'shortIdentifier' @@ -94,13 +93,13 @@ describe '#service_type' do let(:servicetype){ handler.service_type } - + context 'anthro profile' do - let(:client) { anthro_client } - let(:cache) { anthro_cache } + let(:client){ anthro_client } + let(:cache){ anthro_cache } context 'collectionobject record' do - let(:mapperpath) { 'spec/fixtures/files/mappers/release_6_1/anthro/anthro_4-1-2_collectionobject.json' } + let(:mapperpath){ 'spec/fixtures/files/mappers/release_6_1/anthro/anthro_4-1-2_collectionobject.json' } it 'returns object' do expect(servicetype).to eq('object') @@ -108,7 +107,7 @@ end context 'place record' do - let(:mapperpath) { 'spec/fixtures/files/mappers/release_6_1/anthro/anthro_4-1-2_place-local.json' } + let(:mapperpath){ 'spec/fixtures/files/mappers/release_6_1/anthro/anthro_4-1-2_place-local.json' } it 'returns authority' do expect(servicetype).to eq('authority') @@ -117,11 +116,11 @@ end context 'bonsai profile' do - let(:client) { bonsai_client } - let(:cache) { bonsai_cache } + let(:client){ bonsai_client } + let(:cache){ bonsai_cache } context 'conservation record' do - let(:mapperpath) { 'spec/fixtures/files/mappers/release_6_1/bonsai/bonsai_4-1-1_conservation.json' } + let(:mapperpath){ 'spec/fixtures/files/mappers/release_6_1/bonsai/bonsai_4-1-1_conservation.json' } it 'returns procedure' do expect(servicetype).to eq('procedure') @@ -148,17 +147,17 @@ # end describe '#xpath_hash' do - let(:result) { handler.mapper.xpath[xpath] } - + let(:result){ handler.mapper.xpath[xpath] } + context 'anthro profile' do - let(:client) { anthro_client } - let(:cache) { anthro_cache } + let(:client){ anthro_client } + let(:cache){ anthro_cache } context 'collectionobject record' do - let(:mapperpath) { 'spec/fixtures/files/mappers/release_6_1/anthro/anthro_4-1-2_collectionobject.json' } + let(:mapperpath){ 'spec/fixtures/files/mappers/release_6_1/anthro/anthro_4-1-2_collectionobject.json' } context 'xpath ending with commingledRemainsGroup' do - let(:xpath) { 'collectionobjects_anthro/commingledRemainsGroupList/commingledRemainsGroup' } + let(:xpath){ 'collectionobjects_anthro/commingledRemainsGroupList/commingledRemainsGroup' } it 'is_group = true' do expect(result[:is_group]).to be true @@ -175,7 +174,8 @@ end context 'xpath ending with mortuaryTreatmentGroup' do - let(:xpath) { 'collectionobjects_anthro/commingledRemainsGroupList/commingledRemainsGroup/mortuaryTreatmentGroupList/mortuaryTreatmentGroup' } + let(:xpath) do + 'collectionobjects_anthro/commingledRemainsGroupList/commingledRemainsGroup/mortuaryTreatmentGroupList/mortuaryTreatmentGroup' end it 'is_group = true' do expect(result[:is_group]).to be true @@ -192,7 +192,7 @@ end context 'xpath ending with collectionobjects_nagpra' do - let(:xpath) { 'collectionobjects_nagpra' } + let(:xpath){ 'collectionobjects_nagpra' } it 'has 5 children' do expect(result[:children].size).to eq(5) @@ -200,23 +200,23 @@ end end end - + context 'bonsai profile' do - let(:client) { bonsai_client } - let(:cache) { bonsai_cache } + let(:client){ bonsai_client } + let(:cache){ bonsai_cache } context 'conservation record' do - let(:mapperpath) { 'spec/fixtures/files/mappers/release_6_1/bonsai/bonsai_4-1-1_conservation.json' } + let(:mapperpath){ 'spec/fixtures/files/mappers/release_6_1/bonsai/bonsai_4-1-1_conservation.json' } context 'xpath ending with fertilizersToBeUsed' do - let(:xpath) { 'conservation_livingplant/fertilizationGroupList/fertilizationGroup/fertilizersToBeUsed' } + let(:xpath){ 'conservation_livingplant/fertilizationGroupList/fertilizationGroup/fertilizersToBeUsed' } it 'is a repeating group' do expect(result[:is_group]).to be true end end - + context 'xpath ending with conservators' do - let(:xpath) { 'conservation_common/conservators' } + let(:xpath){ 'conservation_common/conservators' } it 'is a repeating group' do expect(result[:is_group]).to be false end @@ -234,13 +234,13 @@ end describe '#check_fields' do - let(:result) { handler.check_fields(data) } + let(:result){ handler.check_fields(data) } context 'bonsai profile' do - let(:client) { bonsai_client } - let(:cache) { bonsai_cache } + let(:client){ bonsai_client } + let(:cache){ bonsai_cache } context 'conservation record' do - let(:mapperpath) { 'spec/fixtures/files/mappers/release_6_1/bonsai/bonsai_4-1-1_conservation.json' } + let(:mapperpath){ 'spec/fixtures/files/mappers/release_6_1/bonsai/bonsai_4-1-1_conservation.json' } let(:data) do { 'conservationNumber' => '123', @@ -260,34 +260,33 @@ end end - describe '#prep' do - let(:data) { {'objectNumber' => '123'} } - + let(:data){ {'objectNumber' => '123'} } + it 'can be called with response from validation' do vresult = handler.validate(data) result = handler.prep(vresult).response expect(result).to be_a(CollectionSpace::Mapper::Response) end - + it 'can be called with just data' do result = handler.prep(data).response expect(result).to be_a(CollectionSpace::Mapper::Response) end - + context 'when response_mode = normal' do - let(:config) { {response_mode: 'normal'} } - + let(:config){ {response_mode: 'normal'} } + it 'returned response includes detailed data transformation info needed for mapping' do result = handler.prep(data).response expect(result.transformed_data).not_to be_empty end end - + context 'when response_mode = verbose' do - let(:config) { {response_mode: 'verbose'} } - + let(:config){ {response_mode: 'verbose'} } + it 'returned response includes detailed data transformation info' do result = handler.prep(data).response expect(result.transformed_data).not_to be_empty @@ -296,29 +295,29 @@ end describe '#process', services_call: true do - let(:data) { {'objectNumber' => '123'} } + let(:data){ {'objectNumber' => '123'} } it 'can be called with response from validation' do vresult = handler.validate(data) result = handler.process(vresult) expect(result).to be_a(CollectionSpace::Mapper::Response) end - + it 'can be called with just data' do result = handler.process(data) expect(result).to be_a(CollectionSpace::Mapper::Response) end - + context 'when response_mode = normal' do it 'returned response omits detailed data transformation info' do result = handler.process(data) expect(result.transformed_data).to be_empty end end - + context 'when response_mode = verbose' do - let(:config) { {response_mode: 'verbose'} } - + let(:config){ {response_mode: 'verbose'} } + it 'returned response includes detailed data transformation info' do result = handler.process(data) expect(result.transformed_data).not_to be_empty @@ -327,11 +326,10 @@ end describe '#map', services_call: true do - let(:data) { {'objectNumber' => '123'} } - let(:prepper) { CollectionSpace::Mapper::DataPrepper.new(data, handler) } - let(:prepped) { handler.prep(data).response } - let(:result) { handler.map(prepped, prepper.xphash) } - + let(:data){ {'objectNumber' => '123'} } + let(:prepper){ CollectionSpace::Mapper::DataPrepper.new(data, handler) } + let(:prepped){ handler.prep(data).response } + let(:result){ handler.map(prepped, prepper.xphash) } it 'returns CollectionSpace::Mapper::Response object' do expect(result).to be_a(CollectionSpace::Mapper::Response) @@ -346,7 +344,7 @@ end end context 'when response_mode = verbose' do - let(:config) { {'response_mode' => 'verbose'} } + let(:config){ {'response_mode' => 'verbose'} } it 'returned response includes detailed data transformation info' do expect(result.transformed_data).not_to be_empty end diff --git a/spec/collectionspace/mapper/data_mapper_core_spec.rb b/spec/collectionspace/mapper/data_mapper_core_spec.rb index 44d2ccc1..9d9789e2 100644 --- a/spec/collectionspace/mapper/data_mapper_core_spec.rb +++ b/spec/collectionspace/mapper/data_mapper_core_spec.rb @@ -8,10 +8,10 @@ context 'core profile' do let(:client){ core_client } let(:cache){ core_cache } - let(:handler) { CollectionSpace::Mapper::DataHandler.new(record_mapper: mapper, - client: client, - cache: cache, - config: config) } + let(:handler) do CollectionSpace::Mapper::DataHandler.new(record_mapper: mapper, + client: client, + cache: cache, + config: config) end let(:datahash){ get_datahash(path: hashpath) } let(:response){ handler.process(datahash) } let(:mapped_doc){ remove_namespaces(response.doc) } @@ -25,9 +25,9 @@ # These tests are prone to failing if one of the records used in the test in core.dev is deleted # If a UUID is expected but you get blank, recreate the record in core.dev, rerun the test to # get the UUID for the new record, and replace the old UUID in both fixture XML files used. - let(:mapper) { get_json_record_mapper( + let(:mapper) do get_json_record_mapper( 'spec/fixtures/files/mappers/release_6_1/core/core_6-1-0_nonhierarchicalrelationship.json' - ) } + ) end context 'when all IDs found' do let(:hashpath){ 'spec/fixtures/files/datahashes/core/nonHierarchicalRelationship1.json' } @@ -131,8 +131,8 @@ end context 'authority hierarchy record', services_call: true do - let(:mapper){ - get_json_record_mapper('spec/fixtures/files/mappers/release_6_1/core/core_6-1-0_authorityhierarchy.json') } + let(:mapper) do + get_json_record_mapper('spec/fixtures/files/mappers/release_6_1/core/core_6-1-0_authorityhierarchy.json') end context 'with existing terms' do let(:hashpath){ 'spec/fixtures/files/datahashes/core/authorityHierarchy1.json' } @@ -183,13 +183,13 @@ end context 'with existing records' do - let(:hashpath) { 'spec/fixtures/files/datahashes/core/objectHierarchy1.json' } - let(:fixturepath) { 'core/objectHierarchy1.xml' } + let(:hashpath){ 'spec/fixtures/files/datahashes/core/objectHierarchy1.json' } + let(:fixturepath){ 'core/objectHierarchy1.xml' } it 'sets response id field as expected' do expect(response.identifier).to eq('2020.1.105 > 2020.1.1055') end - + it 'does not map unexpected fields' do expect(diff).to eq([]) end @@ -204,13 +204,13 @@ end context 'with missing record' do - let(:hashpath) { 'spec/fixtures/files/datahashes/core/objectHierarchy2.json' } - let(:fixturepath) { 'core/objectHierarchy2.xml' } + let(:hashpath){ 'spec/fixtures/files/datahashes/core/objectHierarchy2.json' } + let(:fixturepath){ 'core/objectHierarchy2.xml' } it 'sets response id field as expected' do expect(response.identifier).to eq('2020.1.105 > MISSING') end - + it 'does not map unexpected fields' do expect(diff).to eq([]) end @@ -247,8 +247,8 @@ end context 'collectionobject record' do - let(:mapper){ - get_json_record_mapper('spec/fixtures/files/mappers/release_6_1/core/core_6-1-0_collectionobject.json') } + let(:mapper) do + get_json_record_mapper('spec/fixtures/files/mappers/release_6_1/core/core_6-1-0_collectionobject.json') end context 'record 1' do let(:hashpath){ 'spec/fixtures/files/datahashes/core/collectionobject1.json' } @@ -304,8 +304,8 @@ end context 'conditioncheck record', services_call: true do - let(:mapper){ - get_json_record_mapper('spec/fixtures/files/mappers/release_6_1/core/core_6-1-0_conditioncheck.json') } + let(:mapper) do + get_json_record_mapper('spec/fixtures/files/mappers/release_6_1/core/core_6-1-0_conditioncheck.json') end context 'record 1' do let(:hashpath){ 'spec/fixtures/files/datahashes/core/conditioncheck1.json' } @@ -326,8 +326,8 @@ end context 'conservation record', services_call: true do - let(:mapper){ - get_json_record_mapper('spec/fixtures/files/mappers/release_6_1/core/core_6-1-0_conservation.json') } + let(:mapper) do + get_json_record_mapper('spec/fixtures/files/mappers/release_6_1/core/core_6-1-0_conservation.json') end context 'record 1' do let(:hashpath){ 'spec/fixtures/files/datahashes/core/conservation1.json' } diff --git a/spec/collectionspace/mapper/data_mapper_spec.rb b/spec/collectionspace/mapper/data_mapper_spec.rb index 69c15ebe..a09ddb77 100644 --- a/spec/collectionspace/mapper/data_mapper_spec.rb +++ b/spec/collectionspace/mapper/data_mapper_spec.rb @@ -26,8 +26,8 @@ data3 = JSON.parse('{"creditline":"Gift of Elizabeth, 1985","accessiondategroup":"1985","acquisitionmethod":"gift","acquisitionreferencenumber":"ACC208 (migrated accession)","acquisitionsourceperson":"Elizabeth","acquisitionsourceorganization":"","acquisitionauthorizer":"","acquisitionnote":"Acquisition source role(s): Donor"}') data = [data1, data2, data3] preppers = data.map{ |d| CollectionSpace::Mapper::DataPrepper.new(d, @handler) } - mappers = preppers.map{ |prepper| - CollectionSpace::Mapper::DataMapper.new(prepper.prep.response, @handler, prepper.xphash) } + mappers = preppers.map do |prepper| + CollectionSpace::Mapper::DataMapper.new(prepper.prep.response, @handler, prepper.xphash) end docs = mappers.map{ |mapper| remove_namespaces(mapper.response.doc) } docxpaths = docs.map{ |doc| list_xpaths(doc) } diff --git a/spec/collectionspace/mapper/data_prepper_spec.rb b/spec/collectionspace/mapper/data_prepper_spec.rb index 619a0b9b..4a2e8861 100644 --- a/spec/collectionspace/mapper/data_prepper_spec.rb +++ b/spec/collectionspace/mapper/data_prepper_spec.rb @@ -3,11 +3,11 @@ require 'spec_helper' RSpec.describe CollectionSpace::Mapper::DataPrepper do - let(:delimiter) { ';' } - let(:client) { anthro_client } - let(:cache) { anthro_cache } - let(:mapperpath) { 'spec/fixtures/files/mappers/release_6_1/anthro/anthro_4-1-2_collectionobject.json' } - let(:mapper) { get_json_record_mapper(mapperpath) } + let(:delimiter){ ';' } + let(:client){ anthro_client } + let(:cache){ anthro_cache } + let(:mapperpath){ 'spec/fixtures/files/mappers/release_6_1/anthro/anthro_4-1-2_collectionobject.json' } + let(:mapper){ get_json_record_mapper(mapperpath) } let(:config) do { delimiter: delimiter, @@ -19,8 +19,8 @@ cache: cache, config: config) end - let(:prepper) { CollectionSpace::Mapper::DataPrepper.new(datahash, handler) } - let(:datahash) { { 'objectNumber' => '123' } } + let(:prepper){ CollectionSpace::Mapper::DataPrepper.new(datahash, handler) } + let(:datahash){ {'objectNumber' => '123'} } describe '#merge_default_values' do let(:datahash) do @@ -69,7 +69,7 @@ expect(res).to eq(ex) end end - + context 'and :force_defaults = true' do let(:config) do { @@ -92,10 +92,10 @@ describe '#process_xpaths' do context 'when authority record' do - let(:client) { core_client } - let(:cache) { core_cache } - let(:mapperpath) { 'spec/fixtures/files/mappers/release_6_1/core/core_6-1-0_place-local.json' } - let(:datahash) { {'termdisplayname'=>'Silk Hope' } } + let(:client){ core_client } + let(:cache){ core_cache } + let(:mapperpath){ 'spec/fixtures/files/mappers/release_6_1/core/core_6-1-0_place-local.json' } + let(:datahash){ {'termdisplayname' => 'Silk Hope'} } it 'keeps mapping for shortIdentifier in xphash' do result = prepper.prep.xphash['places_common'][:mappings].select do |mapping| @@ -109,7 +109,7 @@ describe '#handle_term_fields' do let(:datahash) do { - 'objectnumber'=>'123', + 'objectnumber' => '123', 'title' => 'A "Man";A Woman', 'titleLanguage' => 'English;English', 'titleTranslation' => 'Un Homme^^Hombre; Une Femme^^Fraulein', @@ -125,7 +125,7 @@ "urn:cspace:anthro.collectionspace.org:vocabularies:name(languages):item:name(deu)'German'"]] expect(res).to eq(expected) end - + it 'adds expected term Hashes to response.terms' do chk = prepper.prep.response.terms.select{ |t| t[:field] == 'titletranslationlanguage' } expect(chk.length).to eq(4) @@ -135,7 +135,7 @@ describe '#transform_date_fields' do let(:datahash) do { - 'objectnumber'=>'123', + 'objectnumber' => '123', 'annotationdate' => '12/19/2019;12/10/2019', 'identdategroup' => '2019-09-30;4/5/2020', } @@ -159,7 +159,7 @@ describe '#combine_data_values' do let(:datahash) do { - 'objectnumber'=>'123', + 'objectnumber' => '123', 'fieldCollectorPerson' => 'Ann Analyst;Gabriel Solares', 'fieldCollectorOrganization' => 'Organization 1', 'objectProductionPeopleArchculture' => 'Blackfoot', @@ -191,9 +191,9 @@ end context 'and one or more combined field values is blank' do - let(:client) { core_client } - let(:cache) { core_cache } - let(:mapperpath) { 'spec/fixtures/files/mappers/release_6_1/core/core_6-1-0_conservation.json' } + let(:client){ core_client } + let(:cache){ core_cache } + let(:mapperpath){ 'spec/fixtures/files/mappers/release_6_1/core/core_6-1-0_conservation.json' } let(:datahash) do { 'conservationNumber' => 'CT2020.7', @@ -201,25 +201,25 @@ 'statusDate' => '' } end - let(:xpath) { 'conservation_common/conservationStatusGroupList/conservationStatusGroup' } + let(:xpath){ 'conservation_common/conservationStatusGroupList/conservationStatusGroup' } it 'removes empty fields from combined data response' do result = prepper.prep.response.combined_data[xpath].keys expect(result).to_not include('statusDate') end - + it 'removes empty fields from fieldmapping list passed on for mapping' do result = prepper.prep.xphash[xpath][:mappings] expect(result.length).to eq(1) end end end - + context 'when multi-authority field is part of repeating field subgroup' do - let(:client) { core_client } - let(:cache) { core_cache } - let(:mapperpath) { 'spec/fixtures/files/mappers/release_6_1/core/core_6-1-0_media.json' } - let(:xpath) { 'media_common/measuredPartGroupList/measuredPartGroup/dimensionSubGroupList/dimensionSubGroup' } + let(:client){ core_client } + let(:cache){ core_cache } + let(:mapperpath){ 'spec/fixtures/files/mappers/release_6_1/core/core_6-1-0_media.json' } + let(:xpath){ 'media_common/measuredPartGroupList/measuredPartGroup/dimensionSubGroupList/dimensionSubGroup' } context 'when there is more than one group' do let(:datahash) do @@ -237,7 +237,7 @@ 'valueDate' => '2020-09-23^^2020-09-28^^2020-09-25^^2020-09-30;2020-07-21^^^2020-07-21' } end - + # todo: why does this call services api? it 'combines values properly', services_call: true do result = prepper.prep.response.combined_data[xpath]['measuredBy'] @@ -255,7 +255,7 @@ expect(result).to eq(expected) end end - + context 'when there is only one group' do let(:datahash) do { @@ -272,7 +272,7 @@ 'valueDate' => '2020-09-23^^2020-09-28^^2020-09-25^^2020-09-30' } end - + it 'combines values properly' do result = prepper.prep.response.combined_data[xpath]['measuredBy'] expected = [ @@ -289,7 +289,7 @@ end describe '#prep' do - let(:res) { prepper.prep } + let(:res){ prepper.prep } it 'returns self' do expect(res).to be_a(CollectionSpace::Mapper::DataPrepper) end @@ -317,9 +317,9 @@ end describe 'leading/trailing space stripping' do - let(:datahash) { { 'objectNumber' => '123 ' } } - let(:result) { prepper.prep.response.transformed_data['objectnumber'] } - + let(:datahash){ {'objectNumber' => '123 '} } + let(:result){ prepper.prep.response.transformed_data['objectnumber'] } + context 'with strip_id_values = true (the default)' do it 'strips leading/trailing spaces from id field(s)' do expect(result).to eq(['123']) @@ -332,7 +332,7 @@ strip_id_values: false } end - + it 'does not strip leading/trailing spaces from id field(s)' do expect(result).to eq(['123 ']) end diff --git a/spec/collectionspace/mapper/data_quality_checker_spec.rb b/spec/collectionspace/mapper/data_quality_checker_spec.rb index 5b62779d..560aa333 100644 --- a/spec/collectionspace/mapper/data_quality_checker_spec.rb +++ b/spec/collectionspace/mapper/data_quality_checker_spec.rb @@ -7,18 +7,18 @@ let(:mapping){ CollectionSpace::Mapper::ColumnMapping.new(maphash, recordmapper) } context 'when source_type = optionlist' do - let(:maphash) { { - fieldname: 'collection', - datacolumn: 'collection', - transforms: {}, - source_type: 'optionlist', - opt_list_values: [ - 'library-collection', - 'permanent-collection', - 'study-collection', - 'teaching-collection' - ] - } } + let(:maphash) do { + fieldname: 'collection', + datacolumn: 'collection', + transforms: {}, + source_type: 'optionlist', + opt_list_values: [ + 'library-collection', + 'permanent-collection', + 'study-collection', + 'teaching-collection' + ] + } end it 'returns expected warnings' do data = [ 'Permanent Collection', # not a valid option, should return warning @@ -33,13 +33,13 @@ context 'when datacolumn contains `refname`' do context 'and source_type = vocabulary' do - let(:maphash) { { + let(:maphash) do { fieldname: 'nagprainventoryname', datacolumn: 'nagprainventorynamerefname', transforms: {}, source_type: 'vocabulary', opt_list_values: [] - } } + } end context 'and value is not well-formed refname' do it 'returns warning' do data = ["urn:pahma.cspace.berkeley.edu:vocabularies:name(nagpraPahmaInventoryNames):item:name(nagpraPahmaInventoryNames01)'AK-Alaska'"] @@ -57,13 +57,13 @@ end context 'and source_type = authority' do - let(:maphash) { { + let(:maphash) do { fieldname: 'nagpradetermculture', datacolumn: 'nagpradetermculturerefname', transforms: {}, source_type: 'authority', opt_list_values: [] - } } + } end context 'and value is not well-formed refname' do it 'returns warning' do data = ["urn:cspace:pahma.cspace.berkeley.edu:orgauthorities:name(organization):item:name(Chumash1607458832492)'Chumash"] diff --git a/spec/collectionspace/mapper/find_replace_transformer_spec.rb b/spec/collectionspace/mapper/find_replace_transformer_spec.rb index 9b015b73..f15f2fc4 100644 --- a/spec/collectionspace/mapper/find_replace_transformer_spec.rb +++ b/spec/collectionspace/mapper/find_replace_transformer_spec.rb @@ -3,10 +3,10 @@ require 'spec_helper' RSpec.describe CollectionSpace::Mapper::FindReplaceTransformer do - let(:transform) { [ + let(:transform) do [ {find: ' ', replace:'-', type: 'plain'}, {find: '(\d)-A', replace: '\1 A', type: 'regex'} - ] } + ] end let(:transformer){ described_class.new(transform: transform) } describe '#precedence' do diff --git a/spec/collectionspace/mapper/group_column_value_spec.rb b/spec/collectionspace/mapper/group_column_value_spec.rb index a6833fc0..503432d5 100644 --- a/spec/collectionspace/mapper/group_column_value_spec.rb +++ b/spec/collectionspace/mapper/group_column_value_spec.rb @@ -5,14 +5,14 @@ RSpec.describe CollectionSpace::Mapper::GroupColumnValue do let(:mapperpath){ 'spec/fixtures/files/mappers/release_6_1/core/core_6-1-0_collectionobject.json' } let(:config){ {delimiter: '|', subgroup_delimiter: '^^'} } - let(:recmapper) { CS::Mapper::RecordMapper.new(mapper: get_json_record_mapper(mapperpath), - batchconfig: config, - termcache: core_cache) } + let(:recmapper) do CS::Mapper::RecordMapper.new(mapper: get_json_record_mapper(mapperpath), + batchconfig: config, + termcache: core_cache) end let(:mapping){ recmapper.mappings.lookup(colname) } - let(:colval) { described_class.new(column: colname, - value: colvalue, - recmapper: recmapper, - mapping: mapping) } + let(:colval) do described_class.new(column: colname, + value: colvalue, + recmapper: recmapper, + mapping: mapping) end describe '#split' do let(:colname){ 'title' } diff --git a/spec/collectionspace/mapper/group_multival_column_value_spec.rb b/spec/collectionspace/mapper/group_multival_column_value_spec.rb index cfcb807a..b13d21ea 100644 --- a/spec/collectionspace/mapper/group_multival_column_value_spec.rb +++ b/spec/collectionspace/mapper/group_multival_column_value_spec.rb @@ -5,14 +5,14 @@ RSpec.describe CollectionSpace::Mapper::GroupMultivalColumnValue do let(:mapperpath){ 'spec/fixtures/files/mappers/release_6_1/bonsai/bonsai_4-1-1_conservation.json' } let(:config){ {delimiter: '|', subgroup_delimiter: '^^'} } - let(:recmapper) { CS::Mapper::RecordMapper.new(mapper: get_json_record_mapper(mapperpath), - batchconfig: config, - termcache: bonsai_cache) } + let(:recmapper) do CS::Mapper::RecordMapper.new(mapper: get_json_record_mapper(mapperpath), + batchconfig: config, + termcache: bonsai_cache) end let(:mapping){ recmapper.mappings.lookup(colname) } - let(:colval) { described_class.new(column: colname, - value: colvalue, - recmapper: recmapper, - mapping: mapping) } + let(:colval) do described_class.new(column: colname, + value: colvalue, + recmapper: recmapper, + mapping: mapping) end describe '#split' do let(:colname){ 'fertilizerToBeUsed' } diff --git a/spec/collectionspace/mapper/multival_column_value_spec.rb b/spec/collectionspace/mapper/multival_column_value_spec.rb index 215d7377..ec9e7f16 100644 --- a/spec/collectionspace/mapper/multival_column_value_spec.rb +++ b/spec/collectionspace/mapper/multival_column_value_spec.rb @@ -5,14 +5,14 @@ RSpec.describe CollectionSpace::Mapper::MultivalColumnValue do let(:mapperpath){ 'spec/fixtures/files/mappers/release_6_1/core/core_6-1-0_collectionobject.json' } let(:config){ {delimiter: '|', subgroup_delimiter: '^^'} } - let(:recmapper) { CS::Mapper::RecordMapper.new(mapper: get_json_record_mapper(mapperpath), - batchconfig: config, - termcache: core_cache) } + let(:recmapper) do CS::Mapper::RecordMapper.new(mapper: get_json_record_mapper(mapperpath), + batchconfig: config, + termcache: core_cache) end let(:mapping){ recmapper.mappings.lookup(colname) } - let(:colval) { described_class.new(column: colname, - value: colvalue, - recmapper: recmapper, - mapping: mapping) } + let(:colval) do described_class.new(column: colname, + value: colvalue, + recmapper: recmapper, + mapping: mapping) end describe '#split' do let(:colname){ 'collection' } diff --git a/spec/collectionspace/mapper/record_mapper_config_spec.rb b/spec/collectionspace/mapper/record_mapper_config_spec.rb index 5011d1cf..ca4a2f28 100644 --- a/spec/collectionspace/mapper/record_mapper_config_spec.rb +++ b/spec/collectionspace/mapper/record_mapper_config_spec.rb @@ -3,7 +3,7 @@ require 'spec_helper' RSpec.describe CollectionSpace::Mapper::RecordMapperConfig do - let(:hash) { {'ns_uri' => { + let(:hash) do {'ns_uri' => { 'collectionobjects_common' => 'http://collectionspace.org/services/collectionobject', 'collectionobjects_anthro' => 'http://collectionspace.org/services/collectionobject/domain/anthro', 'collectionobjects_annotation' => 'http://collectionspace.org/services/collectionobject/domain/annotation', @@ -11,7 +11,7 @@ 'collectionobjects_nagpra' => 'http://collectionspace.org/services/collectionobject/domain/nagpra', 'collectionobjects_naturalhistory_extension' => 'http://collectionspace.org/services/collectionobject/domain/naturalhistory_extension', 'somethingelse_common' => 'http://collectionspace.org/services/collectionobject/domain/nagpra' - }} } + }} end let(:config){ described_class.new(hash) } describe '#namespaces' do it 'returns Array of namespace names' do diff --git a/spec/collectionspace/mapper/row_data_spec.rb b/spec/collectionspace/mapper/row_data_spec.rb index ffb8f521..5c034a8d 100644 --- a/spec/collectionspace/mapper/row_data_spec.rb +++ b/spec/collectionspace/mapper/row_data_spec.rb @@ -4,12 +4,12 @@ RSpec.describe CollectionSpace::Mapper::RowData do let(:recmapper){ core_object_mapper} - let(:data_hash) { { + let(:data_hash) do { 'objectNumber' => '123', 'comment' => 'blah', 'title' => 'The title', 'titleTranslation' => 'La title' - } } + } end let(:row){ CollectionSpace::Mapper::RowData.new(data_hash, recmapper) } diff --git a/spec/collectionspace/mapper/subgroup_column_value_spec.rb b/spec/collectionspace/mapper/subgroup_column_value_spec.rb index 6da9b59e..1643c0b7 100644 --- a/spec/collectionspace/mapper/subgroup_column_value_spec.rb +++ b/spec/collectionspace/mapper/subgroup_column_value_spec.rb @@ -5,14 +5,14 @@ RSpec.describe CollectionSpace::Mapper::SubgroupColumnValue do let(:mapperpath){ 'spec/fixtures/files/mappers/release_6_1/core/core_6-1-0_collectionobject.json' } let(:config){ {delimiter: '|', subgroup_delimiter: '^^'} } - let(:recmapper) { CS::Mapper::RecordMapper.new(mapper: get_json_record_mapper(mapperpath), - batchconfig: config, - termcache: core_cache) } + let(:recmapper) do CS::Mapper::RecordMapper.new(mapper: get_json_record_mapper(mapperpath), + batchconfig: config, + termcache: core_cache) end let(:mapping){ recmapper.mappings.lookup(colname) } - let(:colval) { described_class.new(column: colname, - value: colvalue, - recmapper: recmapper, - mapping: mapping) } + let(:colval) do described_class.new(column: colname, + value: colvalue, + recmapper: recmapper, + mapping: mapping) end describe '#split' do let(:colname){ 'titleTranslation' } diff --git a/spec/collectionspace/mapper/term_handler_spec.rb b/spec/collectionspace/mapper/term_handler_spec.rb index 2181da86..cc11aec8 100644 --- a/spec/collectionspace/mapper/term_handler_spec.rb +++ b/spec/collectionspace/mapper/term_handler_spec.rb @@ -6,15 +6,15 @@ let(:client){ core_client } let(:termcache){ core_cache } let(:mapperpath){ 'spec/fixtures/files/mappers/release_6_1/core/core_6-1-0_collectionobject.json' } - let(:recmapper) { CS::Mapper::RecordMapper.new(mapper: File.read(mapperpath), - csclient: client, - termcache: termcache) } + let(:recmapper) do CS::Mapper::RecordMapper.new(mapper: File.read(mapperpath), + csclient: client, + termcache: termcache) end let(:colmapping){ recmapper.mappings.lookup(colname) } - let(:th) { CS::Mapper::TermHandler.new(mapping: colmapping, - data: data, - client: client, - cache: termcache, - mapper: recmapper) } + let(:th) do CS::Mapper::TermHandler.new(mapping: colmapping, + data: data, + client: client, + cache: termcache, + mapper: recmapper) end # before(:all) do # @config = @handler.mapper.batchconfig # @ref_mapping = CollectionSpace::Mapper::ColumnMapping.new({ diff --git a/spec/collectionspace/mapper/term_searchable_spec.rb b/spec/collectionspace/mapper/term_searchable_spec.rb index a857fa2b..d78a2239 100644 --- a/spec/collectionspace/mapper/term_searchable_spec.rb +++ b/spec/collectionspace/mapper/term_searchable_spec.rb @@ -14,13 +14,13 @@ def initialize(cache, client, type, subtype) @subtype = subtype @errors = [] end - + end RSpec.describe CollectionSpace::Mapper::TermSearchable do - let(:cache) { core_cache } - let(:termtype) { 'conceptauthorities' } - let(:termsubtype) { 'concept' } + let(:cache){ core_cache } + let(:termtype){ 'conceptauthorities' } + let(:termsubtype){ 'concept' } let(:term){ TermClass.new(cache, core_client, termtype, termsubtype) } describe '#in_cache?' do @@ -48,7 +48,7 @@ def initialize(cache, client, type, subtype) end describe '#cached_as_unknown?' do - let(:result) { term.cached_as_unknown?(val) } + let(:result){ term.cached_as_unknown?(val) } let(:val){ 'blahblahblah' } context 'when not cached as unknown value' do @@ -64,7 +64,7 @@ def initialize(cache, client, type, subtype) end end end - + describe '#cached_term' do let(:result){ term.cached_term(val) } context 'when not in cache' do @@ -92,12 +92,12 @@ def initialize(cache, client, type, subtype) end describe '#searched_term' do - let(:termtype) { 'vocabularies' } - let(:termsubtype) { 'publishto' } + let(:termtype){ 'vocabularies' } + let(:termsubtype){ 'publishto' } let(:result){ term.searched_term(val) } context 'when val exists in instance' do - let(:val) { 'All' } + let(:val){ 'All' } it 'returns refname urn' do expected = "urn:cspace:core.collectionspace.org:vocabularies:name(publishto):item:name(all)'All'" expect(result).to eq(expected) @@ -105,7 +105,7 @@ def initialize(cache, client, type, subtype) end context 'when case-swapped val exists in instance' do - let(:val) { 'all' } + let(:val){ 'all' } it 'returns refname urn' do expected = "urn:cspace:core.collectionspace.org:vocabularies:name(publishto):item:name(all)'All'" expect(result).to eq(expected) @@ -119,7 +119,7 @@ def initialize(cache, client, type, subtype) let(:result){ term.obj_csid(objnum, type) } context 'when in cache' do let(:objnum){ 'Hierarchy Test 001' } - + it 'returns csid' do expect(result).to eq('16161bff-b01a-4b55-95aa') end @@ -138,7 +138,7 @@ def initialize(cache, client, type, subtype) context 'when in cache' do let(:val){ 'Sample Concept 1' } it 'returns csid' do - #it 'returns csid', :skip => 'does not cause mapping to fail, so we live with technical incorrectness for now' do + # it 'returns csid', :skip => 'does not cause mapping to fail, so we live with technical incorrectness for now' do expect(result).to eq('1111-2222-3333-4444') end end diff --git a/spec/collectionspace/mapper/tools/record_status_service_spec.rb b/spec/collectionspace/mapper/tools/record_status_service_spec.rb index 26866eb5..d526e9b6 100644 --- a/spec/collectionspace/mapper/tools/record_status_service_spec.rb +++ b/spec/collectionspace/mapper/tools/record_status_service_spec.rb @@ -7,21 +7,21 @@ let(:service){ CollectionSpace::Mapper::Tools::RecordStatusService.new(client, mapper) } context 'when mapper service_path not handled by collectionspace-client' do - let(:mapper) { CS::Mapper::RecordMapper.new(mapper: get_json_record_mapper( + let(:mapper) do CS::Mapper::RecordMapper.new(mapper: get_json_record_mapper( 'spec/fixtures/files/mappers/core_6-1-0_aardvark.json' - ), termcache: core_cache) } + ), termcache: core_cache) end it 'raises NoClientServiceError' do - expect{ - CS::Mapper::Tools::RecordStatusService.new(client, mapper) }.to raise_error(CS::Mapper::NoClientServiceError) + expect do + CS::Mapper::Tools::RecordStatusService.new(client, mapper) end.to raise_error(CS::Mapper::NoClientServiceError) end end describe '#lookup' do context 'when mapper is for an authority' do - let(:mapper) { CollectionSpace::Mapper::RecordMapper.new(mapper: get_json_record_mapper( + let(:mapper) do CollectionSpace::Mapper::RecordMapper.new(mapper: get_json_record_mapper( 'spec/fixtures/files/mappers/release_6_1/core/core_6-1-0_person-local.json' - ), termcache: core_cache) } + ), termcache: core_cache) end context 'and one result is found' do let(:report){ service.lookup('John Doe') } @@ -54,7 +54,8 @@ # you may need to re-create them if they have been removed context 'with default config' do it 'raises error because we cannot know what to do with imported record' do - expect{ service.lookup('Inkpot Guineafowl') }.to raise_error(CollectionSpace::Mapper::MultipleCsRecordsFoundError) + expect do + service.lookup('Inkpot Guineafowl') end.to raise_error(CollectionSpace::Mapper::MultipleCsRecordsFoundError) end end @@ -66,10 +67,10 @@ let(:mapper) do CollectionSpace::Mapper::RecordMapper.new( mapper: json, - batchconfig: { multiple_recs_found: 'use_first' } + batchconfig: {multiple_recs_found: 'use_first'} ) end - let(:result) { service.lookup('Inkpot Guineafowl').keys.any?(:multiple_recs_found) } + let(:result){ service.lookup('Inkpot Guineafowl').keys.any?(:multiple_recs_found) } it 'returns result with count of records found' do expect(result).to be true end @@ -78,9 +79,9 @@ end context 'when mapper is for an object' do - let(:mapper) { CollectionSpace::Mapper::RecordMapper.new(mapper: get_json_record_mapper( + let(:mapper) do CollectionSpace::Mapper::RecordMapper.new(mapper: get_json_record_mapper( 'spec/fixtures/files/mappers/release_6_1/core/core_6-1-0_collectionobject.json' - ), termcache: core_cache) } + ), termcache: core_cache) end it 'works the same' do res = service.lookup('2000.1') @@ -89,9 +90,9 @@ end context 'when mapper is for a procedure' do - let(:mapper) { CollectionSpace::Mapper::RecordMapper.new(mapper: get_json_record_mapper( + let(:mapper) do CollectionSpace::Mapper::RecordMapper.new(mapper: get_json_record_mapper( 'spec/fixtures/files/mappers/release_6_1/core/core_6-1-0_acquisition.json' - ), termcache: core_cache) } + ), termcache: core_cache) end it 'works the same' do res = service.lookup('2000.001') @@ -100,9 +101,9 @@ end context 'when mapper is for a relationship' do - let(:mapper) { CollectionSpace::Mapper::RecordMapper.new(mapper: get_json_record_mapper( + let(:mapper) do CollectionSpace::Mapper::RecordMapper.new(mapper: get_json_record_mapper( 'spec/fixtures/files/mappers/release_6_1/core/core_6-1-0_objecthierarchy.json' - )) } + )) end it 'works the same' do res = service.lookup({sub: '56c04f5f-32b9-4f1d-8a4b', obj: '6f0ce7b3-0130-444d-8633'}) diff --git a/spec/collectionspace/mapper/tools/refname_spec.rb b/spec/collectionspace/mapper/tools/refname_spec.rb index 30c9e378..da906255 100644 --- a/spec/collectionspace/mapper/tools/refname_spec.rb +++ b/spec/collectionspace/mapper/tools/refname_spec.rb @@ -79,8 +79,8 @@ args = { urn: 'urn:cspace:core.collectionspace.org:weird' } - expect{ - CollectionSpace::Mapper::Tools::RefName.new(args) }.to raise_error(CollectionSpace::Mapper::Tools::UnparseableUrnError) + expect do + CollectionSpace::Mapper::Tools::RefName.new(args) end.to raise_error(CollectionSpace::Mapper::Tools::UnparseableUrnError) end end end @@ -91,8 +91,8 @@ urn: "urn:cspace:anthro.collectionspace.org:personauthorities:name(person):item:name(MaryPoole1796320156)'Mary Poole'", cache: @cache } - expect{ - CollectionSpace::Mapper::Tools::RefName.new(args) }.to raise_error(CollectionSpace::Mapper::Tools::RefNameArgumentError) + expect do + CollectionSpace::Mapper::Tools::RefName.new(args) end.to raise_error(CollectionSpace::Mapper::Tools::RefNameArgumentError) end end end diff --git a/spec/collectionspace/mapper/tools/symbolizable_spec.rb b/spec/collectionspace/mapper/tools/symbolizable_spec.rb index 96c1d734..e29ee50c 100644 --- a/spec/collectionspace/mapper/tools/symbolizable_spec.rb +++ b/spec/collectionspace/mapper/tools/symbolizable_spec.rb @@ -3,7 +3,7 @@ require 'spec_helper' RSpec.describe CS::Mapper::Tools::Symbolizable do - let(:config) { JSON.parse('{ + let(:config) do JSON.parse('{ "delimiter": ";", "subgroup_delimiter": "^^", "response_mode": "verbose", @@ -29,7 +29,7 @@ "collection": "library-collection" } }') - } + end let(:symconfig){ CS::Mapper::Tools::Symbolizable.symbolize(config) } describe '#symbolize' do @@ -42,10 +42,10 @@ describe '#symbolize_transforms' do let(:transforms){ symconfig[:transforms] } - let(:expected) { {'collection' => {special: ['downcase_value'], - replacements: [{find: ' ', replace: '-', type: 'plain'}] + let(:expected) do {'collection' => {special: ['downcase_value'], + replacements: [{find: ' ', replace: '-', type: 'plain'}] }} - } + end it 'transforms as expected' do expect(CS::Mapper::Tools::Symbolizable.symbolize_transforms(transforms)).to eq(expected) end diff --git a/spec/collectionspace/mapper/transformer_spec.rb b/spec/collectionspace/mapper/transformer_spec.rb index aeadd034..57f6bd26 100644 --- a/spec/collectionspace/mapper/transformer_spec.rb +++ b/spec/collectionspace/mapper/transformer_spec.rb @@ -6,14 +6,14 @@ let(:client){ anthro_client } let(:cache){ anthro_cache } let(:mapperpath){ 'spec/fixtures/files/mappers/release_6_1/anthro/anthro_4-1-2_collectionobject_transforms.json'} - let(:recmapper) { CS::Mapper::RecordMapper.new(mapper: File.read(mapperpath), - csclient: client, - termcache: cache) } + let(:recmapper) do CS::Mapper::RecordMapper.new(mapper: File.read(mapperpath), + csclient: client, + termcache: cache) end describe '.create' do - let(:creator) { described_class.create(recmapper: recmapper, - type: type, - transform: transform) } + let(:creator) do described_class.create(recmapper: recmapper, + type: type, + transform: transform) end context 'given an authority transform' do let(:type){ :authority } diff --git a/spec/collectionspace/mapper/transformers_spec.rb b/spec/collectionspace/mapper/transformers_spec.rb index 229dec1d..6d9804af 100644 --- a/spec/collectionspace/mapper/transformers_spec.rb +++ b/spec/collectionspace/mapper/transformers_spec.rb @@ -6,13 +6,13 @@ let(:client){ anthro_client } let(:cache){ anthro_cache } let(:mapperpath){ 'spec/fixtures/files/mappers/release_6_1/anthro/anthro_4-1-2_collectionobject_transforms.json'} - let(:recmapper) { CS::Mapper::RecordMapper.new(mapper: File.read(mapperpath), - csclient: client, - termcache: cache) } + let(:recmapper) do CS::Mapper::RecordMapper.new(mapper: File.read(mapperpath), + csclient: client, + termcache: cache) end let(:mapping){ recmapper.mappings.lookup(colname) } - let(:xforms) { described_class.new(colmapping: mapping, - transforms: mapping.transforms, - recmapper: recmapper) } + let(:xforms) do described_class.new(colmapping: mapping, + transforms: mapping.transforms, + recmapper: recmapper) end describe '#queue' do context 'when measuredByPerson column' do diff --git a/spec/collectionspace/mapper_spec.rb b/spec/collectionspace/mapper_spec.rb index c5a3e091..99fadf5e 100644 --- a/spec/collectionspace/mapper_spec.rb +++ b/spec/collectionspace/mapper_spec.rb @@ -27,9 +27,9 @@ context 'when passed other class of object' do it 'returns a CollectionSpace::Mapper::Response' do data = ['objectNumber', '123'] - expect{ - CollectionSpace::Mapper::setup_data(data) }.to raise_error(CollectionSpace::Mapper::Errors::UnprocessableDataError, - 'Cannot process a Array. Need a Hash or Mapper::Response') + expect do + CollectionSpace::Mapper::setup_data(data) end.to raise_error(CollectionSpace::Mapper::Errors::UnprocessableDataError, + 'Cannot process a Array. Need a Hash or Mapper::Response') end end end diff --git a/spec/core_helpers.rb b/spec/core_helpers.rb index b9e58e09..6df0e4a2 100644 --- a/spec/core_helpers.rb +++ b/spec/core_helpers.rb @@ -39,189 +39,372 @@ def core_object_mapper def populate_core(cache) terms = [ - ['citationauthorities', 'citation', 'Arthur', { refname: "urn:cspace:core.collectionspace.org:citationauthorities:name(citation):item:name(Arthur62605812848)'Arthur'", csid: '1111-2222-3333-4444' }], - ['citationauthorities', 'citation', 'Harding', { refname: "urn:cspace:core.collectionspace.org:citationauthorities:name(citation):item:name(Harding2510592089)'Harding'", csid: '1111-2222-3333-4444' }], - ['citationauthorities', 'citation', 'Wanting', { refname: "urn:cspace:core.collectionspace.org:citationauthorities:name(citation):item:name(Wanting1599560009399)'Wanting'", csid: '1111-2222-3333-4444' }], - ['citationauthorities', 'citation', 'makasi', { refname: "urn:cspace:core.collectionspace.org:citationauthorities:name(citation):item:name(makasi1599645537547)'makasi'", csid: '1111-2222-3333-4444' }], - ['citationauthorities', 'worldcat', 'Chelse', { refname: "urn:cspace:core.collectionspace.org:citationauthorities:name(worldcat):item:name(Chelse1599645525740)'Chelse'", csid: '1111-2222-3333-4444' }], - ['citationauthorities', 'worldcat', 'Patiently', { refname: "urn:cspace:core.collectionspace.org:citationauthorities:name(worldcat):item:name(Patiently1599559993332)'Patiently'", csid: '1111-2222-3333-4444' }], - ['collectionobjects', '', 'Hierarchy Test 001', { refname: "urn:cspace:core.collectionspace.org:collectionobjects:id(16161bff-b01a-4b55-95aa)'Hierarchy Test 001'", csid: '16161bff-b01a-4b55-95aa' }], - ['conceptauthorities', 'concept', 'Test', { refname: "urn:cspace:core.collectionspace.org:conceptauthorities:name(concept):item:name(Test1599650854716)'Test'", csid: '1111-2222-3333-4444' }], - ['conceptauthorities', 'concept', 'Sample Concept 1', { refname: "urn:cspace:core.collectionspace.org:conceptauthorities:name(concept):item:name(SampleConcept11581354228875)'Sample Concept 1'", csid: '1111-2222-3333-4444' }], - ['conceptauthorities', 'concept', 'Uno', { refname: "urn:cspace:core.collectionspace.org:conceptauthorities:name(concept):item:name(Uno1599645111177)'Uno'", csid: '1111-2222-3333-4444' }], - ['conceptauthorities', 'occasion', 'Computer', { refname: "urn:cspace:core.collectionspace.org:conceptauthorities:name(occasion):item:name(Computer1599734104251)'Computer'", csid: '1111-2222-3333-4444' }], - ['locationauthorities', 'indeterminate', '~Indeterminate Location~', { refname: "urn:cspace:indeterminate:locationauthorities:name(indeterminate):item:name(indeterminate)'~Indeterminate Location~'", csid: '1111-2222-3333-4444' }], - ['locationauthorities', 'location', 'Abardares', { refname: "urn:cspace:core.collectionspace.org:locationauthorities:name(location):item:name(Abardares1599557570049)'Abardares'", csid: '1111-2222-3333-4444' }], - ['locationauthorities', 'location', 'Kalif', { refname: "urn:cspace:core.collectionspace.org:locationauthorities:name(location):item:name(Kalif1599734233745)'Kalif'", csid: '1111-2222-3333-4444' }], - ['locationauthorities', 'location', 'Khago', { refname: "urn:cspace:core.collectionspace.org:locationauthorities:name(location):item:name(Khago1599559772718)'Khago'", csid: '1111-2222-3333-4444' }], - ['locationauthorities', 'location', 'Stay', { refname: "urn:cspace:core.collectionspace.org:locationauthorities:name(offsite_sla):item:name(Stay1599559824865)'Stay'", csid: '1111-2222-3333-4444' }], - ['locationauthorities', 'offsite_sla', 'Lavington', { refname: "urn:cspace:core.collectionspace.org:locationauthorities:name(offsite_sla):item:name(Lavington1599144699983)'Lavington'", csid: '1111-2222-3333-4444' }], - ['locationauthorities', 'offsite_sla', 'Ngong', { refname: "urn:cspace:core.collectionspace.org:locationauthorities:name(offsite_sla):item:name(Ngong1599557586466)'Ngong'", csid: '1111-2222-3333-4444' }], - ['locationauthorities', 'offsite_sla', 'Stay', { refname: "urn:cspace:core.collectionspace.org:locationauthorities:name(offsite_sla):item:name(Stay)'Stay'", csid: '1111-2222-3333-4444' }], - ['orgauthorities', 'organization', '2021', { refname: "urn:cspace:core.collectionspace.org:orgauthorities:name(organization):item:name(20211599147173971)'2021'", csid: '1111-2222-3333-4444' }], - ['orgauthorities', 'organization', 'Astroworld', { refname: "urn:cspace:core.collectionspace.org:orgauthorities:name(organization):item:name(Astroworld1599650794829)'Astroworld'", csid: '1111-2222-3333-4444' }], - ['orgauthorities', 'organization', 'Broker', { refname: "urn:cspace:core.collectionspace.org:orgauthorities:name(organization):item:name(Broker1599221487572)'Broker'", csid: '1111-2222-3333-4444' }], - ['orgauthorities', 'organization', 'But Ohh', { refname: "urn:cspace:core.collectionspace.org:orgauthorities:name(organization):item:name(ButOhh1599665031368)'But Ohh'", csid: '1111-2222-3333-4444' }], - ['orgauthorities', 'organization', 'Cuckoo', { refname: "urn:cspace:core.collectionspace.org:orgauthorities:name(organization):item:name(Cuckoo1599463786824)'Cuckoo'", csid: '1111-2222-3333-4444' }], - ['orgauthorities', 'organization', 'Ibiza', { refname: "urn:cspace:core.collectionspace.org:orgauthorities:name(organization):item:name(Ibiza1599650806827)'Ibiza'", csid: '1111-2222-3333-4444' }], - ['orgauthorities', 'organization', 'Joseph Hills', { refname: "urn:cspace:core.collectionspace.org:orgauthorities:name(organization):item:name(JosephHills1599463935463)'Joseph Hills'", csid: '1111-2222-3333-4444' }], - ['orgauthorities', 'organization', 'Kremling', { refname: "urn:cspace:core.collectionspace.org:orgauthorities:name(organization):item:name(Kremling1599464161204)'Kremling'", csid: '1111-2222-3333-4444' }], - ['orgauthorities', 'organization', 'MMG', { refname: "urn:cspace:core.collectionspace.org:orgauthorities:name(organization):item:name(MMG1599569514486)'MMG'", csid: '1111-2222-3333-4444' }], - ['orgauthorities', 'organization', 'Martin', { refname: "urn:cspace:core.collectionspace.org:orgauthorities:name(organization):item:name(Martin1599559712783)'Martin'", csid: '1111-2222-3333-4444' }], - ['orgauthorities', 'organization', 'Ninja', { refname: "urn:cspace:core.collectionspace.org:orgauthorities:name(organization):item:name(Ninja1599147339325)'Ninja'", csid: '1111-2222-3333-4444' }], - ['orgauthorities', 'organization', 'Oval', { refname: "urn:cspace:core.collectionspace.org:orgauthorities:name(organization):item:name(Oval1599650891221)'Oval'", csid: '1111-2222-3333-4444' }], - ['orgauthorities', 'organization', 'Podoa', { refname: "urn:cspace:core.collectionspace.org:orgauthorities:name(organization):item:name(Podoa1599645346399)'Podoa'", csid: '1111-2222-3333-4444' }], - ['orgauthorities', 'organization', 'Rock Nation', { refname: "urn:cspace:core.collectionspace.org:orgauthorities:name(organization):item:name(RockNation1599569481908)'Rock Nation'", csid: '1111-2222-3333-4444' }], - ['orgauthorities', 'organization', 'Sidarec', { refname: "urn:cspace:core.collectionspace.org:orgauthorities:name(organization):item:name(Sidarec1599210955079)'Sidarec'", csid: '1111-2222-3333-4444' }], - ['orgauthorities', 'organization', 'TIm Herod', { refname: "urn:cspace:core.collectionspace.org:orgauthorities:name(organization):item:name(TImHerod1599144655199)'TIm Herod'", csid: '1111-2222-3333-4444' }], - ['orgauthorities', 'organization', 'Tasia', { refname: "urn:cspace:core.collectionspace.org:orgauthorities:name(organization):item:name(Tasia1599734050597)'Tasia'", csid: '1111-2222-3333-4444' }], - ['orgauthorities', 'organization', 'Tesla', { refname: "urn:cspace:core.collectionspace.org:orgauthorities:name(organization):item:name(Tesla1599144565539)'Tesla'", csid: '1111-2222-3333-4444' }], - ['orgauthorities', 'organization', 'Walai', { refname: "urn:cspace:core.collectionspace.org:orgauthorities:name(organization):item:name(Walai1599645181370)'Walai'", csid: '1111-2222-3333-4444' }], - ['orgauthorities', 'organization', 'breakup', { refname: "urn:cspace:core.collectionspace.org:orgauthorities:name(organization):item:name(breakup1599559909048)'breakup'", csid: '1111-2222-3333-4444' }], - ['orgauthorities', 'organization', 'fggf', { refname: "urn:cspace:core.collectionspace.org:orgauthorities:name(organization):item:name(fggf1599552009173)'fggf'", csid: '1111-2222-3333-4444' }], - ['orgauthorities', 'organization', 'pandemic', { refname: "urn:cspace:core.collectionspace.org:orgauthorities:name(organization):item:name(pandemic1599645036126)'pandemic'", csid: '1111-2222-3333-4444' }], - ['orgauthorities', 'organization', 'pop', { refname: "urn:cspace:core.collectionspace.org:orgauthorities:name(organization):item:name(pop1599664789385)'pop'", csid: '1111-2222-3333-4444' }], - ['orgauthorities', 'organization', 'pupu', { refname: "urn:cspace:core.collectionspace.org:orgauthorities:name(organization):item:name(pupu1599645415676)'pupu'", csid: '1111-2222-3333-4444' }], - ['orgauthorities', 'organization', 'tent', { refname: "urn:cspace:core.collectionspace.org:orgauthorities:name(organization):item:name(tent1599664807586)'tent'", csid: '1111-2222-3333-4444' }], - ['orgauthorities', 'ulan_oa', 'Again', { refname: "urn:cspace:core.collectionspace.org:orgauthorities:name(ulan_oa):item:name(Again1599559881266)'Again'", csid: '1111-2222-3333-4444' }], - ['orgauthorities', 'ulan_oa', 'Signal', { refname: "urn:cspace:core.collectionspace.org:orgauthorities:name(ulan_oa):item:name(Signal1599559737158)'Signal'", csid: '1111-2222-3333-4444' }], - ['orgauthorities', 'ulan_oa', 'Very fats', { refname: "urn:cspace:core.collectionspace.org:orgauthorities:name(ulan_oa):item:name(Veryfats1599645188567)'Very fats'", csid: '1111-2222-3333-4444' }], - ['personauthorities', 'person', 'Broooks', { refname: "urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(Broooks1599221558583)'Broooks'", csid: '1111-2222-3333-4444' }], - ['personauthorities', 'person', '2020', { refname: "urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(20201599147149106)'2020'", csid: '1111-2222-3333-4444' }], - ['personauthorities', 'person', '254Glock', { refname: "urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(254Glock1599569494651)'254Glock'", csid: '1111-2222-3333-4444' }], - ['personauthorities', 'person', 'Abel', { refname: "urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(Abel1599464025893)'Abel'", csid: '1111-2222-3333-4444' }], - ['personauthorities', 'person', 'Alexa', { refname: "urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(Alexa1599557607978)'Alexa'", csid: '1111-2222-3333-4444' }], - ['personauthorities', 'person', 'Andrew Watts', { refname: "urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(AndrewWatts1599144553996)'Andrew Watts'", csid: '1111-2222-3333-4444' }], - ['personauthorities', 'person', 'Busy', { refname: "urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(Busy1599559723432)'Busy'", csid: '1111-2222-3333-4444' }], - ['personauthorities', 'person', 'Cardi', { refname: "urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(Cardi1599569468209)'Cardi'", csid: '1111-2222-3333-4444' }], - ['personauthorities', 'person', 'Clemo', { refname: "urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(Clemo1599221473000)'Clemo'", csid: '1111-2222-3333-4444' }], - ['personauthorities', 'person', 'Clon', { refname: "urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(Clon1599569543362)'Clon'", csid: '1111-2222-3333-4444' }], - ['personauthorities', 'person', 'Comodore', { refname: "urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(Comodore1599463826401)'Comodore'", csid: '1111-2222-3333-4444' }], - ['personauthorities', 'person', 'Comrade', { refname: "urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(Comrade1599664745661)'Comrade'", csid: '1111-2222-3333-4444' }], - ['personauthorities', 'person', 'Cooper Phil', { refname: "urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(CooperPhil1599144599479)'Cooper Phil'", csid: '1111-2222-3333-4444' }], - ['personauthorities', 'person', 'Disturb', { refname: "urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(Disturb1599665062738)'Disturb'", csid: '1111-2222-3333-4444' }], - ['personauthorities', 'person', 'Dudu', { refname: "urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(Dudu1599645410044)'Dudu'", csid: '1111-2222-3333-4444' }], - ['personauthorities', 'person', 'Erick', { refname: "urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(Erick1599734121151)'Erick'", csid: '1111-2222-3333-4444' }], - ['personauthorities', 'person', 'First Layer', { refname: "urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(FirstLayer1599463905818)'First Layer'", csid: '1111-2222-3333-4444' }], - ['personauthorities', 'person', 'Glock', { refname: "urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(Glock1599580905730)'Glock'", csid: '1111-2222-3333-4444' }], - ['personauthorities', 'person', 'Gomongo', { refname: "urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(Gomongo1599463746195)'Gomongo'", csid: '1111-2222-3333-4444' }], - ['personauthorities', 'person', 'Grace', { refname: "urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(Grace1599569599918)'Grace'", csid: '1111-2222-3333-4444' }], - ['personauthorities', 'person', 'Henry', { refname: "urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(Henry1599210937770)'Henry'", csid: '1111-2222-3333-4444' }], - ['personauthorities', 'person', 'Home Alone', { refname: "urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(HomeAlone1599144524188)'Home Alone'", csid: '1111-2222-3333-4444' }], - ['personauthorities', 'person', 'James', { refname: "urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(James1599210943727)'James'", csid: '1111-2222-3333-4444' }], - ['personauthorities', 'person', 'Jamo', { refname: "urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(Jamo1599221465693)'Jamo'", csid: '1111-2222-3333-4444' }], - ['personauthorities', 'person', 'Joel', { refname: "urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(Joel1599557736045)'Joel'", csid: '1111-2222-3333-4444' }], - ['personauthorities', 'person', 'John Allen', { refname: "urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(JohnAllen1599144390263)'John Allen'", csid: '1111-2222-3333-4444' }], - ['personauthorities', 'person', 'John Kay', { refname: "urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(JohnKay1599210868122)'John Kay'", csid: '1111-2222-3333-4444' }], - ['personauthorities', 'person', 'Kali', { refname: "urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(Kali1599221504661)'Kali'", csid: '1111-2222-3333-4444' }], - ['personauthorities', 'person', 'Karanja', { refname: "urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(Karanja1599211015378)'Karanja'", csid: '1111-2222-3333-4444' }], - ['personauthorities', 'person', 'Kev', { refname: "urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(Kev1599058769862)'Kev'", csid: '1111-2222-3333-4444' }], - ['personauthorities', 'person', 'Kimani', { refname: "urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(Kimani1599210926973)'Kimani'", csid: '1111-2222-3333-4444' }], - ['personauthorities', 'person', 'Kimonda', { refname: "urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(Kimonda1599211004900)'Kimonda'", csid: '1111-2222-3333-4444' }], - ['personauthorities', 'person', 'King Kosa', { refname: "urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(KingKosa1599569726990)'King Kosa'", csid: '1111-2222-3333-4444' }], - ['personauthorities', 'person', 'Kinuthia', { refname: "urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(Kinuthia1599734017515)'Kinuthia'", csid: '1111-2222-3333-4444' }], - ['personauthorities', 'person', 'Lebron', { refname: "urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(Lebron1599557725925)'Lebron'", csid: '1111-2222-3333-4444' }], - ['personauthorities', 'person', 'Lima', { refname: "urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(Lima1599645323459)'Lima'", csid: '1111-2222-3333-4444' }], - ['personauthorities', 'person', 'Loan', { refname: "urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(Loan1599210896616)'Loan'", csid: '1111-2222-3333-4444' }], - ['personauthorities', 'person', 'Mark Smith', { refname: "urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(MarkSmith)'Mark Smith'", csid: '1111-2222-3333-4444' }], - ['personauthorities', 'person', 'Meghan', { refname: "urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(Meghan1599569567326)'Meghan'", csid: '1111-2222-3333-4444' }], - ['personauthorities', 'person', 'Nyauma', { refname: "urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(Nyauma1599210983879)'Nyauma'", csid: '1111-2222-3333-4444' }], - ['personauthorities', 'person', 'Scribe', { refname: "urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(Scribe1599645240974)'Scribe'", csid: '1111-2222-3333-4444' }], - ['personauthorities', 'person', 'Shen Yeng', { refname: "urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(ShenYeng1599569685887)'Shen Yeng'", csid: '1111-2222-3333-4444' }], - ['personauthorities', 'person', 'Soi', { refname: "urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(Soi1599734190999)'Soi'", csid: '1111-2222-3333-4444' }], - ['personauthorities', 'person', 'Switch', { refname: "urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(Switch1599645085995)'Switch'", csid: '1111-2222-3333-4444' }], - ['personauthorities', 'person', 'Tim Joes', { refname: "urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(TimJoes1599144424859)'Tim Joes'", csid: '1111-2222-3333-4444' }], - ['personauthorities', 'person', 'Trepoz', { refname: "urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(Trepoz1599221497512)'Trepoz'", csid: '1111-2222-3333-4444' }], - ['personauthorities', 'person', 'Trevor', { refname: "urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(Trevor1599144536281)'Trevor'", csid: '1111-2222-3333-4444' }], - ['personauthorities', 'person', 'Troy', { refname: "urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(Troy1599144360617)'Troy'", csid: '1111-2222-3333-4444' }], - ['personauthorities', 'person', 'afa', { refname: "urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(afa1599645004939)'afa'", csid: '1111-2222-3333-4444' }], - ['personauthorities', 'person', 'cxcx', { refname: "urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(cxcx1599551790384)'cxcx'", csid: '1111-2222-3333-4444' }], - ['personauthorities', 'person', 'dfdd', { refname: "urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(dfdd1599551799173)'dfdd'", csid: '1111-2222-3333-4444' }], - ['personauthorities', 'person', 'dssd', { refname: "urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(dssd1599552004115)'dssd'", csid: '1111-2222-3333-4444' }], - ['personauthorities', 'person', 'fgfgf', { refname: "urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(fgfgf1599551987166)'fgfgf'", csid: '1111-2222-3333-4444' }], - ['personauthorities', 'person', 'giri', { refname: "urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(giri1599645613143)'giri'", csid: '1111-2222-3333-4444' }], - ['personauthorities', 'person', 'high grade', { refname: "urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(highgrade1599645597889)'high grade'", csid: '1111-2222-3333-4444' }], - ['personauthorities', 'person', 'malik', { refname: "urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(malik1599664876144)'malik'", csid: '1111-2222-3333-4444' }], - ['personauthorities', 'person', 'marcus', { refname: "urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(marcus1599650918612)'marcus'", csid: '1111-2222-3333-4444' }], - ['personauthorities', 'person', 'marley', { refname: "urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(marley1599650874712)'marley'", csid: '1111-2222-3333-4444' }], - ['personauthorities', 'person', 'rights', { refname: "urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(rights1599650868011)'rights'", csid: '1111-2222-3333-4444' }], - ['personauthorities', 'person', 'rudelyt', { refname: "urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(rudelyt1599664917218)'rudelyt'", csid: '1111-2222-3333-4444' }], - ['personauthorities', 'person', 'sasa', { refname: "urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(sasa1599551852678)'sasa'", csid: '1111-2222-3333-4444' }], - ['personauthorities', 'person', 'tint', { refname: "urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(tint1599664800144)'tint'", csid: '1111-2222-3333-4444' }], - ['personauthorities', 'person', 'tonight', { refname: "urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(tonight1599664781376)'tonight'", csid: '1111-2222-3333-4444' }], - ['personauthorities', 'ulan_pa', 'Chrus', { refname: "urn:cspace:core.collectionspace.org:personauthorities:name(ulan_pa):item:name(Chrus1599559702930)'Chrus'", csid: '1111-2222-3333-4444' }], - ['personauthorities', 'ulan_pa', 'We go', { refname: "urn:cspace:core.collectionspace.org:personauthorities:name(ulan_pa):item:name(Wego1599559866517)'We go'", csid: '1111-2222-3333-4444' }], - ['personauthorities', 'ulan_pa', 'panda nayo', { refname: "urn:cspace:core.collectionspace.org:personauthorities:name(ulan_pa):item:name(pandanayo1599645094507)'panda nayo'", csid: '1111-2222-3333-4444' }], - ['placeauthorities', 'place', 'Chillspot', { refname: "urn:cspace:core.collectionspace.org:placeauthorities:name(place):item:name(Chillspot1599145441945)'Chillspot'", csid: '1111-2222-3333-4444' }], - ['placeauthorities', 'tgn_place', 'mzingga', { refname: "urn:cspace:core.collectionspace.org:placeauthorities:name(tgn_place):item:name(mzingga1599645587502)'mzingga'", csid: '1111-2222-3333-4444' }], - ['vocabularies', 'agequalifier', 'older than', { refname: "urn:cspace:core.collectionspace.org:vocabularies:name(agequalifier):item:name(olderthan)'older than'", csid: '1111-2222-3333-4444' }], - ['vocabularies', 'collectionmethod', 'donation', { refname: "urn:cspace:core.collectionspace.org:vocabularies:name(collectionmethod):item:name(donation)'donation'", csid: '1111-2222-3333-4444' }], - ['vocabularies', 'collectionmethod', 'excavation', { refname: "urn:cspace:core.collectionspace.org:vocabularies:name(collectionmethod):item:name(excavation)'excavation'", csid: '1111-2222-3333-4444' }], - ['vocabularies', 'conditioncheckmethod', 'Observed', { refname: "urn:cspace:core.collectionspace.org:vocabularies:name(conditioncheckmethod):item:name(observed)'Observed'", csid: '1111-2222-3333-4444' }], - ['vocabularies', 'conditioncheckreason', 'Damaged in transit', { refname: "urn:cspace:core.collectionspace.org:vocabularies:name(conditioncheckreason):item:name(damagedintransit)'Damaged in transit'", csid: '1111-2222-3333-4444' }], - ['vocabularies', 'conditionfitness', 'Reasonable', { refname: "urn:cspace:core.collectionspace.org:vocabularies:name(conditionfitness):item:name(reasonable)'Reasonable'", csid: '1111-2222-3333-4444' }], - ['vocabularies', 'conservationstatus', 'Analysis complete', { refname: "urn:cspace:core.collectionspace.org:vocabularies:name(conservationstatus):item:name(analysiscomplete)'Analysis complete'", csid: '1111-2222-3333-4444' }], - ['vocabularies', 'conservationstatus', 'Treatment approved', { refname: "urn:cspace:core.collectionspace.org:vocabularies:name(conservationstatus):item:name(treatmentapproved)'Treatment approved'", csid: '1111-2222-3333-4444' }], - ['vocabularies', 'conservationstatus', 'Treatment in progress', { refname: "urn:cspace:core.collectionspace.org:vocabularies:name(conservationstatus):item:name(treatmentinprogress)'Treatment in progress'", csid: '1111-2222-3333-4444' }], - ['vocabularies', 'currency', 'Canadian Dollar', { refname: "urn:cspace:core.collectionspace.org:vocabularies:name(currency):item:name(CAD)'Canadian Dollar'", csid: '1111-2222-3333-4444' }], - ['vocabularies', 'currency', 'Danish Krone', { refname: "urn:cspace:core.collectionspace.org:vocabularies:name(currency):item:name(DKK)'Danish Krone'", csid: '1111-2222-3333-4444' }], - ['vocabularies', 'currency', 'Euro', { refname: "urn:cspace:core.collectionspace.org:vocabularies:name(currency):item:name(EUR)'Euro'", csid: '1111-2222-3333-4444' }], - ['vocabularies', 'currency', 'Pound Sterling', { refname: "urn:cspace:core.collectionspace.org:vocabularies:name(currency):item:name(GBP)'Pound Sterling'", csid: '1111-2222-3333-4444' }], - ['vocabularies', 'currency', 'Swedish Krona', { refname: "urn:cspace:core.collectionspace.org:vocabularies:name(currency):item:name(SEK)'Swedish Krona'", csid: '1111-2222-3333-4444' }], - ['vocabularies', 'currency', 'Swiss Franc', { refname: "urn:cspace:core.collectionspace.org:vocabularies:name(currency):item:name(CHF)'Swiss Franc'", csid: '1111-2222-3333-4444' }], - ['vocabularies', 'datecertainty', 'Circa', { refname: "urn:cspace:core.collectionspace.org:vocabularies:name(datecertainty):item:name(circa)'Circa'", csid: '1111-2222-3333-4444' }], - ['vocabularies', 'dateera', 'BCE', { refname: "urn:cspace:core.collectionspace.org:vocabularies:name(dateera):item:name(bce)'BCE'", csid: '1111-2222-3333-4444' }], - ['vocabularies', 'dateera', 'CE', { refname: "urn:cspace:core.collectionspace.org:vocabularies:name(dateera):item:name(ce)'CE'", csid: '1111-2222-3333-4444' }], - ['vocabularies', 'datequalifier', 'Day(s)', { refname: "urn:cspace:core.collectionspace.org:vocabularies:name(datequalifier):item:name(days)'Day(s)'", csid: '1111-2222-3333-4444' }], - ['vocabularies', 'datequalifier', 'Year(s)', { refname: "urn:cspace:core.collectionspace.org:vocabularies:name(datequalifier):item:name(years)'Year(s)'", csid: '1111-2222-3333-4444' }], - ['vocabularies', 'deaccessionapprovalgroup', 'board of trustees', { refname: "urn:cspace:core.collectionspace.org:vocabularies:name(deaccessionapprovalgroup):item:name(board_of_trustees)'board of trustees'", csid: '1111-2222-3333-4444' }], - ['vocabularies', 'deaccessionapprovalgroup', 'collection committee', { refname: "urn:cspace:core.collectionspace.org:vocabularies:name(deaccessionapprovalgroup):item:name(collection_committee)'collection committee'", csid: '1111-2222-3333-4444' }], - ['vocabularies', 'deaccessionapprovalgroup', 'executive committee', { refname: "urn:cspace:core.collectionspace.org:vocabularies:name(deaccessionapprovalgroup):item:name(executive_committee)'executive committee'", csid: '1111-2222-3333-4444' }], - ['vocabularies', 'deaccessionapprovalstatus', 'approved', { refname: "urn:cspace:core.collectionspace.org:vocabularies:name(deaccessionapprovalstatus):item:name(approved)'approved'", csid: '1111-2222-3333-4444' }], - ['vocabularies', 'deaccessionapprovalstatus', 'not approved', { refname: "urn:cspace:core.collectionspace.org:vocabularies:name(deaccessionapprovalstatus):item:name(not_approved)'not approved'", csid: '1111-2222-3333-4444' }], - ['vocabularies', 'deaccessionapprovalstatus', 'not required', { refname: "urn:cspace:core.collectionspace.org:vocabularies:name(deaccessionapprovalstatus):item:name(not_required)'not required'", csid: '1111-2222-3333-4444' }], - ['vocabularies', 'disposalmethod', 'destruction', { refname: "urn:cspace:core.collectionspace.org:vocabularies:name(disposalmethod):item:name(destruction)'destruction'", csid: '1111-2222-3333-4444' }], - ['vocabularies', 'entrymethod', 'Found on doorstep', { refname: "urn:cspace:core.collectionspace.org:vocabularies:name(entrymethod):item:name(foundondoorstep)'Found on doorstep'", csid: '1111-2222-3333-4444' }], - ['vocabularies', 'entrymethod', 'Post', { refname: "urn:cspace:core.collectionspace.org:vocabularies:name(entrymethod):item:name(post)'Post'", csid: '1111-2222-3333-4444' }], - ['vocabularies', 'examinationphase', 'before treatment', { refname: "urn:cspace:core.collectionspace.org:vocabularies:name(examinationphase):item:name(beforetreatment)'before treatment'", csid: '1111-2222-3333-4444' }], - ['vocabularies', 'examinationphase', 'during treatment', { refname: "urn:cspace:core.collectionspace.org:vocabularies:name(examinationphase):item:name(duringtreatment)'during treatment'", csid: '1111-2222-3333-4444' }], - ['vocabularies', 'exhibitionpersonrole', 'Educator', { refname: "urn:cspace:core.collectionspace.org:vocabularies:name(exhibitionpersonrole):item:name(educator)'Educator'", csid: '1111-2222-3333-4444' }], - ['vocabularies', 'exhibitionpersonrole', 'Public programs coordinator', { refname: "urn:cspace:core.collectionspace.org:vocabularies:name(exhibitionpersonrole):item:name(publicprogramscoordinator)'Public programs coordinator'", csid: '1111-2222-3333-4444' }], - ['vocabularies', 'exhibitionreferencetype', 'News article', { refname: "urn:cspace:core.collectionspace.org:vocabularies:name(exhibitionreferencetype):item:name(newsarticle)'News article'", csid: '1111-2222-3333-4444' }], - ['vocabularies', 'exhibitionreferencetype', 'Press release', { refname: "urn:cspace:core.collectionspace.org:vocabularies:name(exhibitionreferencetype):item:name(pressrelease)'Press release'", csid: '1111-2222-3333-4444' }], - ['vocabularies', 'exhibitionstatus', 'Preliminary object list created', { refname: "urn:cspace:core.collectionspace.org:vocabularies:name(exhibitionstatus):item:name(preliminaryobjectlistcreated)'Preliminary object list created'", csid: '1111-2222-3333-4444' }], - ['vocabularies', 'exhibitiontype', 'Temporary', { refname: "urn:cspace:core.collectionspace.org:vocabularies:name(exhibitiontype):item:name(temporary)'Temporary'", csid: '1111-2222-3333-4444' }], - ['vocabularies', 'inventorystatus', 'accession status unclear', { refname: "urn:cspace:core.collectionspace.org:vocabularies:name(inventorystatus):item:name(accessionstatusunclear)'accession status unclear'", csid: '1111-2222-3333-4444' }], - ['vocabularies', 'inventorystatus', 'destroyed', { refname: "urn:cspace:core.collectionspace.org:vocabularies:name(inventorystatus):item:name(destroyed)'destroyed'", csid: '1111-2222-3333-4444' }], - ['vocabularies', 'inventorystatus', 'unknown', { refname: "urn:cspace:core.collectionspace.org:vocabularies:name(inventorystatus):item:name(unknown)'unknown'", csid: '1111-2222-3333-4444' }], - ['vocabularies', 'languages', 'Ancient Greek', { refname: "urn:cspace:core.collectionspace.org:vocabularies:name(languages):item:name(grc)'Ancient Greek'", csid: '1111-2222-3333-4444' }], - ['vocabularies', 'languages', 'Armenian', { refname: "urn:cspace:core.collectionspace.org:vocabularies:name(languages):item:name(hye)'Armenian'", csid: '1111-2222-3333-4444' }], - ['vocabularies', 'languages', 'English', { refname: "urn:cspace:core.collectionspace.org:vocabularies:name(languages):item:name(eng)'English'", csid: '1111-2222-3333-4444' }], - ['vocabularies', 'languages', 'French', { refname: "urn:cspace:core.collectionspace.org:vocabularies:name(languages):item:name(fra)'French'", csid: '1111-2222-3333-4444' }], - ['vocabularies', 'languages', 'Malaysian', { refname: "urn:cspace:core.collectionspace.org:vocabularies:name(languages):item:name(mal)'Malaysian'", csid: '1111-2222-3333-4444' }], - ['vocabularies', 'languages', 'Spanish', { refname: "urn:cspace:core.collectionspace.org:vocabularies:name(languages):item:name(spa)'Spanish'", csid: '1111-2222-3333-4444' }], - ['vocabularies', 'languages', 'Swahili', { refname: "urn:cspace:core.collectionspace.org:vocabularies:name(languages):item:name(swa)'Swahili'", csid: '1111-2222-3333-4444' }], - ['vocabularies', 'loanoutstatus', 'Authorized', { refname: "urn:cspace:core.collectionspace.org:vocabularies:name(loanoutstatus):item:name(authorized)'Authorized'", csid: '1111-2222-3333-4444' }], - ['vocabularies', 'loanoutstatus', 'Photography requested', { refname: "urn:cspace:core.collectionspace.org:vocabularies:name(loanoutstatus):item:name(photographyrequested)'Photography requested'", csid: '1111-2222-3333-4444' }], - ['vocabularies', 'loanoutstatus', 'Refused', { refname: "urn:cspace:core.collectionspace.org:vocabularies:name(loanoutstatus):item:name(refused)'Refused'", csid: '1111-2222-3333-4444' }], - ['vocabularies', 'loanoutstatus', 'Returned', { refname: "urn:cspace:core.collectionspace.org:vocabularies:name(loanoutstatus):item:name(returned)'Returned'", csid: '1111-2222-3333-4444' }], - ['vocabularies', 'newsarticle', 'News article', { refname: "urn:cspace:core.collectionspace.org:vocabularies:name(exhibitionreferencetype):item:name(newsarticle)'News article'", csid: '1111-2222-3333-4444' }], - ['vocabularies', 'otherpartyrole', 'Preparator', { refname: "urn:cspace:core.collectionspace.org:vocabularies:name(otherpartyrole):item:name(preparator)'Preparator'", csid: '1111-2222-3333-4444' }], - ['vocabularies', 'otherpartyrole', 'Technician', { refname: "urn:cspace:core.collectionspace.org:vocabularies:name(otherpartyrole):item:name(technician)'Technician'", csid: '1111-2222-3333-4444' }], - ['vocabularies', 'publishto', 'CollectionSpace Public Browser', { refname: "urn:cspace:core.collectionspace.org:vocabularies:name(publishto):item:name(cspacepub)'CollectionSpace Public Browser'", csid: '1111-2222-3333-4444' }], - ['vocabularies', 'publishto', 'Culture Object', { refname: "urn:cspace:core.collectionspace.org:vocabularies:name(publishto):item:name(cultureobject)'Culture Object'", csid: '1111-2222-3333-4444' }], - ['vocabularies', 'publishto', 'None', { refname: "urn:cspace:core.collectionspace.org:vocabularies:name(publishto):item:name(none)'None'", csid: '1111-2222-3333-4444' }], - ['vocabularies', 'publishto', 'Omeka', { refname: "urn:cspace:core.collectionspace.org:vocabularies:name(publishto):item:name(omeka)'Omeka'", csid: '1111-2222-3333-4444' }], - ['vocabularies', 'treatmentpurpose', 'Exhibition', { refname: "urn:cspace:core.collectionspace.org:vocabularies:name(treatmentpurpose):item:name(exhibition)'Exhibition'", csid: '1111-2222-3333-4444' }], - ['vocabularies', 'uocauthorizationstatuses', 'Approved', { refname: "urn:cspace:core.collectionspace.org:vocabularies:name(uocauthorizationstatuses):item:name(approved)'Approved'", csid: '1111-2222-3333-4444' }], - ['vocabularies', 'uoccollectiontypes', 'archeology', { refname: "urn:cspace:core.collectionspace.org:vocabularies:name(uoccollectiontypes):item:name(uocarcheology)'archeology'", csid: '1111-2222-3333-4444' }], - ['vocabularies', 'uocmaterialtypes', 'bulb', { refname: "urn:cspace:core.collectionspace.org:vocabularies:name(uocmaterialtypes):item:name(bulb)'bulb'", csid: '1111-2222-3333-4444' }], - ['vocabularies', 'uocmethods', 'class', { refname: "urn:cspace:core.collectionspace.org:vocabularies:name(uocmethods):item:name(class)'class'", csid: '1111-2222-3333-4444' }], - ['vocabularies', 'uocstaffroles', 'greeter', { refname: "urn:cspace:core.collectionspace.org:vocabularies:name(uocstaffroles):item:name(greeter)'greeter'", csid: '1111-2222-3333-4444' }], - ['vocabularies', 'uocsubcollections', 'Asia', { refname: "urn:cspace:core.collectionspace.org:vocabularies:name(uocsubcollections):item:name(uocsubcollection02)'Asia'", csid: '1111-2222-3333-4444' }], - ['vocabularies', 'uocuserroles', 'faculty', { refname: "urn:cspace:core.collectionspace.org:vocabularies:name(uocuserroles):item:name(faculty)'faculty'", csid: '1111-2222-3333-4444' }], - ['vocabularies', 'uocusertypes', 'lecturer', { refname: "urn:cspace:core.collectionspace.org:vocabularies:name(uocusertypes):item:name(lecturer)'lecturer'", csid: '1111-2222-3333-4444' }], - ['workauthorities', 'work', 'Makeup', { refname: "urn:cspace:core.collectionspace.org:workauthorities:name(work):item:name(Makeup1608768998350)'Makeup'", csid: '1111-2222-3333-4444' }], + ['citationauthorities', 'citation', 'Arthur', + {refname: "urn:cspace:core.collectionspace.org:citationauthorities:name(citation):item:name(Arthur62605812848)'Arthur'", csid: '1111-2222-3333-4444'}], + ['citationauthorities', 'citation', 'Harding', + {refname: "urn:cspace:core.collectionspace.org:citationauthorities:name(citation):item:name(Harding2510592089)'Harding'", csid: '1111-2222-3333-4444'}], + ['citationauthorities', 'citation', 'Wanting', + {refname: "urn:cspace:core.collectionspace.org:citationauthorities:name(citation):item:name(Wanting1599560009399)'Wanting'", csid: '1111-2222-3333-4444'}], + ['citationauthorities', 'citation', 'makasi', + {refname: "urn:cspace:core.collectionspace.org:citationauthorities:name(citation):item:name(makasi1599645537547)'makasi'", csid: '1111-2222-3333-4444'}], + ['citationauthorities', 'worldcat', 'Chelse', + {refname: "urn:cspace:core.collectionspace.org:citationauthorities:name(worldcat):item:name(Chelse1599645525740)'Chelse'", csid: '1111-2222-3333-4444'}], + ['citationauthorities', 'worldcat', 'Patiently', + {refname: "urn:cspace:core.collectionspace.org:citationauthorities:name(worldcat):item:name(Patiently1599559993332)'Patiently'", csid: '1111-2222-3333-4444'}], + ['collectionobjects', '', 'Hierarchy Test 001', + {refname: "urn:cspace:core.collectionspace.org:collectionobjects:id(16161bff-b01a-4b55-95aa)'Hierarchy Test 001'", csid: '16161bff-b01a-4b55-95aa'}], + ['conceptauthorities', 'concept', 'Test', + {refname: "urn:cspace:core.collectionspace.org:conceptauthorities:name(concept):item:name(Test1599650854716)'Test'", csid: '1111-2222-3333-4444'}], + ['conceptauthorities', 'concept', 'Sample Concept 1', + {refname: "urn:cspace:core.collectionspace.org:conceptauthorities:name(concept):item:name(SampleConcept11581354228875)'Sample Concept 1'", csid: '1111-2222-3333-4444'}], + ['conceptauthorities', 'concept', 'Uno', + {refname: "urn:cspace:core.collectionspace.org:conceptauthorities:name(concept):item:name(Uno1599645111177)'Uno'", csid: '1111-2222-3333-4444'}], + ['conceptauthorities', 'occasion', 'Computer', + {refname: "urn:cspace:core.collectionspace.org:conceptauthorities:name(occasion):item:name(Computer1599734104251)'Computer'", csid: '1111-2222-3333-4444'}], + ['locationauthorities', 'indeterminate', '~Indeterminate Location~', + {refname: "urn:cspace:indeterminate:locationauthorities:name(indeterminate):item:name(indeterminate)'~Indeterminate Location~'", csid: '1111-2222-3333-4444'}], + ['locationauthorities', 'location', 'Abardares', + {refname: "urn:cspace:core.collectionspace.org:locationauthorities:name(location):item:name(Abardares1599557570049)'Abardares'", csid: '1111-2222-3333-4444'}], + ['locationauthorities', 'location', 'Kalif', + {refname: "urn:cspace:core.collectionspace.org:locationauthorities:name(location):item:name(Kalif1599734233745)'Kalif'", csid: '1111-2222-3333-4444'}], + ['locationauthorities', 'location', 'Khago', + {refname: "urn:cspace:core.collectionspace.org:locationauthorities:name(location):item:name(Khago1599559772718)'Khago'", csid: '1111-2222-3333-4444'}], + ['locationauthorities', 'location', 'Stay', + {refname: "urn:cspace:core.collectionspace.org:locationauthorities:name(offsite_sla):item:name(Stay1599559824865)'Stay'", csid: '1111-2222-3333-4444'}], + ['locationauthorities', 'offsite_sla', 'Lavington', + {refname: "urn:cspace:core.collectionspace.org:locationauthorities:name(offsite_sla):item:name(Lavington1599144699983)'Lavington'", csid: '1111-2222-3333-4444'}], + ['locationauthorities', 'offsite_sla', 'Ngong', + {refname: "urn:cspace:core.collectionspace.org:locationauthorities:name(offsite_sla):item:name(Ngong1599557586466)'Ngong'", csid: '1111-2222-3333-4444'}], + ['locationauthorities', 'offsite_sla', 'Stay', + {refname: "urn:cspace:core.collectionspace.org:locationauthorities:name(offsite_sla):item:name(Stay)'Stay'", csid: '1111-2222-3333-4444'}], + ['orgauthorities', 'organization', '2021', + {refname: "urn:cspace:core.collectionspace.org:orgauthorities:name(organization):item:name(20211599147173971)'2021'", csid: '1111-2222-3333-4444'}], + ['orgauthorities', 'organization', 'Astroworld', + {refname: "urn:cspace:core.collectionspace.org:orgauthorities:name(organization):item:name(Astroworld1599650794829)'Astroworld'", csid: '1111-2222-3333-4444'}], + ['orgauthorities', 'organization', 'Broker', + {refname: "urn:cspace:core.collectionspace.org:orgauthorities:name(organization):item:name(Broker1599221487572)'Broker'", csid: '1111-2222-3333-4444'}], + ['orgauthorities', 'organization', 'But Ohh', + {refname: "urn:cspace:core.collectionspace.org:orgauthorities:name(organization):item:name(ButOhh1599665031368)'But Ohh'", csid: '1111-2222-3333-4444'}], + ['orgauthorities', 'organization', 'Cuckoo', + {refname: "urn:cspace:core.collectionspace.org:orgauthorities:name(organization):item:name(Cuckoo1599463786824)'Cuckoo'", csid: '1111-2222-3333-4444'}], + ['orgauthorities', 'organization', 'Ibiza', + {refname: "urn:cspace:core.collectionspace.org:orgauthorities:name(organization):item:name(Ibiza1599650806827)'Ibiza'", csid: '1111-2222-3333-4444'}], + ['orgauthorities', 'organization', 'Joseph Hills', + {refname: "urn:cspace:core.collectionspace.org:orgauthorities:name(organization):item:name(JosephHills1599463935463)'Joseph Hills'", csid: '1111-2222-3333-4444'}], + ['orgauthorities', 'organization', 'Kremling', + {refname: "urn:cspace:core.collectionspace.org:orgauthorities:name(organization):item:name(Kremling1599464161204)'Kremling'", csid: '1111-2222-3333-4444'}], + ['orgauthorities', 'organization', 'MMG', + {refname: "urn:cspace:core.collectionspace.org:orgauthorities:name(organization):item:name(MMG1599569514486)'MMG'", csid: '1111-2222-3333-4444'}], + ['orgauthorities', 'organization', 'Martin', + {refname: "urn:cspace:core.collectionspace.org:orgauthorities:name(organization):item:name(Martin1599559712783)'Martin'", csid: '1111-2222-3333-4444'}], + ['orgauthorities', 'organization', 'Ninja', + {refname: "urn:cspace:core.collectionspace.org:orgauthorities:name(organization):item:name(Ninja1599147339325)'Ninja'", csid: '1111-2222-3333-4444'}], + ['orgauthorities', 'organization', 'Oval', + {refname: "urn:cspace:core.collectionspace.org:orgauthorities:name(organization):item:name(Oval1599650891221)'Oval'", csid: '1111-2222-3333-4444'}], + ['orgauthorities', 'organization', 'Podoa', + {refname: "urn:cspace:core.collectionspace.org:orgauthorities:name(organization):item:name(Podoa1599645346399)'Podoa'", csid: '1111-2222-3333-4444'}], + ['orgauthorities', 'organization', 'Rock Nation', + {refname: "urn:cspace:core.collectionspace.org:orgauthorities:name(organization):item:name(RockNation1599569481908)'Rock Nation'", csid: '1111-2222-3333-4444'}], + ['orgauthorities', 'organization', 'Sidarec', + {refname: "urn:cspace:core.collectionspace.org:orgauthorities:name(organization):item:name(Sidarec1599210955079)'Sidarec'", csid: '1111-2222-3333-4444'}], + ['orgauthorities', 'organization', 'TIm Herod', + {refname: "urn:cspace:core.collectionspace.org:orgauthorities:name(organization):item:name(TImHerod1599144655199)'TIm Herod'", csid: '1111-2222-3333-4444'}], + ['orgauthorities', 'organization', 'Tasia', + {refname: "urn:cspace:core.collectionspace.org:orgauthorities:name(organization):item:name(Tasia1599734050597)'Tasia'", csid: '1111-2222-3333-4444'}], + ['orgauthorities', 'organization', 'Tesla', + {refname: "urn:cspace:core.collectionspace.org:orgauthorities:name(organization):item:name(Tesla1599144565539)'Tesla'", csid: '1111-2222-3333-4444'}], + ['orgauthorities', 'organization', 'Walai', + {refname: "urn:cspace:core.collectionspace.org:orgauthorities:name(organization):item:name(Walai1599645181370)'Walai'", csid: '1111-2222-3333-4444'}], + ['orgauthorities', 'organization', 'breakup', + {refname: "urn:cspace:core.collectionspace.org:orgauthorities:name(organization):item:name(breakup1599559909048)'breakup'", csid: '1111-2222-3333-4444'}], + ['orgauthorities', 'organization', 'fggf', + {refname: "urn:cspace:core.collectionspace.org:orgauthorities:name(organization):item:name(fggf1599552009173)'fggf'", csid: '1111-2222-3333-4444'}], + ['orgauthorities', 'organization', 'pandemic', + {refname: "urn:cspace:core.collectionspace.org:orgauthorities:name(organization):item:name(pandemic1599645036126)'pandemic'", csid: '1111-2222-3333-4444'}], + ['orgauthorities', 'organization', 'pop', + {refname: "urn:cspace:core.collectionspace.org:orgauthorities:name(organization):item:name(pop1599664789385)'pop'", csid: '1111-2222-3333-4444'}], + ['orgauthorities', 'organization', 'pupu', + {refname: "urn:cspace:core.collectionspace.org:orgauthorities:name(organization):item:name(pupu1599645415676)'pupu'", csid: '1111-2222-3333-4444'}], + ['orgauthorities', 'organization', 'tent', + {refname: "urn:cspace:core.collectionspace.org:orgauthorities:name(organization):item:name(tent1599664807586)'tent'", csid: '1111-2222-3333-4444'}], + ['orgauthorities', 'ulan_oa', 'Again', + {refname: "urn:cspace:core.collectionspace.org:orgauthorities:name(ulan_oa):item:name(Again1599559881266)'Again'", csid: '1111-2222-3333-4444'}], + ['orgauthorities', 'ulan_oa', 'Signal', + {refname: "urn:cspace:core.collectionspace.org:orgauthorities:name(ulan_oa):item:name(Signal1599559737158)'Signal'", csid: '1111-2222-3333-4444'}], + ['orgauthorities', 'ulan_oa', 'Very fats', + {refname: "urn:cspace:core.collectionspace.org:orgauthorities:name(ulan_oa):item:name(Veryfats1599645188567)'Very fats'", csid: '1111-2222-3333-4444'}], + ['personauthorities', 'person', 'Broooks', + {refname: "urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(Broooks1599221558583)'Broooks'", csid: '1111-2222-3333-4444'}], + ['personauthorities', 'person', '2020', + {refname: "urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(20201599147149106)'2020'", csid: '1111-2222-3333-4444'}], + ['personauthorities', 'person', '254Glock', + {refname: "urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(254Glock1599569494651)'254Glock'", csid: '1111-2222-3333-4444'}], + ['personauthorities', 'person', 'Abel', + {refname: "urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(Abel1599464025893)'Abel'", csid: '1111-2222-3333-4444'}], + ['personauthorities', 'person', 'Alexa', + {refname: "urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(Alexa1599557607978)'Alexa'", csid: '1111-2222-3333-4444'}], + ['personauthorities', 'person', 'Andrew Watts', + {refname: "urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(AndrewWatts1599144553996)'Andrew Watts'", csid: '1111-2222-3333-4444'}], + ['personauthorities', 'person', 'Busy', + {refname: "urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(Busy1599559723432)'Busy'", csid: '1111-2222-3333-4444'}], + ['personauthorities', 'person', 'Cardi', + {refname: "urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(Cardi1599569468209)'Cardi'", csid: '1111-2222-3333-4444'}], + ['personauthorities', 'person', 'Clemo', + {refname: "urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(Clemo1599221473000)'Clemo'", csid: '1111-2222-3333-4444'}], + ['personauthorities', 'person', 'Clon', + {refname: "urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(Clon1599569543362)'Clon'", csid: '1111-2222-3333-4444'}], + ['personauthorities', 'person', 'Comodore', + {refname: "urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(Comodore1599463826401)'Comodore'", csid: '1111-2222-3333-4444'}], + ['personauthorities', 'person', 'Comrade', + {refname: "urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(Comrade1599664745661)'Comrade'", csid: '1111-2222-3333-4444'}], + ['personauthorities', 'person', 'Cooper Phil', + {refname: "urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(CooperPhil1599144599479)'Cooper Phil'", csid: '1111-2222-3333-4444'}], + ['personauthorities', 'person', 'Disturb', + {refname: "urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(Disturb1599665062738)'Disturb'", csid: '1111-2222-3333-4444'}], + ['personauthorities', 'person', 'Dudu', + {refname: "urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(Dudu1599645410044)'Dudu'", csid: '1111-2222-3333-4444'}], + ['personauthorities', 'person', 'Erick', + {refname: "urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(Erick1599734121151)'Erick'", csid: '1111-2222-3333-4444'}], + ['personauthorities', 'person', 'First Layer', + {refname: "urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(FirstLayer1599463905818)'First Layer'", csid: '1111-2222-3333-4444'}], + ['personauthorities', 'person', 'Glock', + {refname: "urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(Glock1599580905730)'Glock'", csid: '1111-2222-3333-4444'}], + ['personauthorities', 'person', 'Gomongo', + {refname: "urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(Gomongo1599463746195)'Gomongo'", csid: '1111-2222-3333-4444'}], + ['personauthorities', 'person', 'Grace', + {refname: "urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(Grace1599569599918)'Grace'", csid: '1111-2222-3333-4444'}], + ['personauthorities', 'person', 'Henry', + {refname: "urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(Henry1599210937770)'Henry'", csid: '1111-2222-3333-4444'}], + ['personauthorities', 'person', 'Home Alone', + {refname: "urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(HomeAlone1599144524188)'Home Alone'", csid: '1111-2222-3333-4444'}], + ['personauthorities', 'person', 'James', + {refname: "urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(James1599210943727)'James'", csid: '1111-2222-3333-4444'}], + ['personauthorities', 'person', 'Jamo', + {refname: "urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(Jamo1599221465693)'Jamo'", csid: '1111-2222-3333-4444'}], + ['personauthorities', 'person', 'Joel', + {refname: "urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(Joel1599557736045)'Joel'", csid: '1111-2222-3333-4444'}], + ['personauthorities', 'person', 'John Allen', + {refname: "urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(JohnAllen1599144390263)'John Allen'", csid: '1111-2222-3333-4444'}], + ['personauthorities', 'person', 'John Kay', + {refname: "urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(JohnKay1599210868122)'John Kay'", csid: '1111-2222-3333-4444'}], + ['personauthorities', 'person', 'Kali', + {refname: "urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(Kali1599221504661)'Kali'", csid: '1111-2222-3333-4444'}], + ['personauthorities', 'person', 'Karanja', + {refname: "urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(Karanja1599211015378)'Karanja'", csid: '1111-2222-3333-4444'}], + ['personauthorities', 'person', 'Kev', + {refname: "urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(Kev1599058769862)'Kev'", csid: '1111-2222-3333-4444'}], + ['personauthorities', 'person', 'Kimani', + {refname: "urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(Kimani1599210926973)'Kimani'", csid: '1111-2222-3333-4444'}], + ['personauthorities', 'person', 'Kimonda', + {refname: "urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(Kimonda1599211004900)'Kimonda'", csid: '1111-2222-3333-4444'}], + ['personauthorities', 'person', 'King Kosa', + {refname: "urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(KingKosa1599569726990)'King Kosa'", csid: '1111-2222-3333-4444'}], + ['personauthorities', 'person', 'Kinuthia', + {refname: "urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(Kinuthia1599734017515)'Kinuthia'", csid: '1111-2222-3333-4444'}], + ['personauthorities', 'person', 'Lebron', + {refname: "urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(Lebron1599557725925)'Lebron'", csid: '1111-2222-3333-4444'}], + ['personauthorities', 'person', 'Lima', + {refname: "urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(Lima1599645323459)'Lima'", csid: '1111-2222-3333-4444'}], + ['personauthorities', 'person', 'Loan', + {refname: "urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(Loan1599210896616)'Loan'", csid: '1111-2222-3333-4444'}], + ['personauthorities', 'person', 'Mark Smith', + {refname: "urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(MarkSmith)'Mark Smith'", csid: '1111-2222-3333-4444'}], + ['personauthorities', 'person', 'Meghan', + {refname: "urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(Meghan1599569567326)'Meghan'", csid: '1111-2222-3333-4444'}], + ['personauthorities', 'person', 'Nyauma', + {refname: "urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(Nyauma1599210983879)'Nyauma'", csid: '1111-2222-3333-4444'}], + ['personauthorities', 'person', 'Scribe', + {refname: "urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(Scribe1599645240974)'Scribe'", csid: '1111-2222-3333-4444'}], + ['personauthorities', 'person', 'Shen Yeng', + {refname: "urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(ShenYeng1599569685887)'Shen Yeng'", csid: '1111-2222-3333-4444'}], + ['personauthorities', 'person', 'Soi', + {refname: "urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(Soi1599734190999)'Soi'", csid: '1111-2222-3333-4444'}], + ['personauthorities', 'person', 'Switch', + {refname: "urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(Switch1599645085995)'Switch'", csid: '1111-2222-3333-4444'}], + ['personauthorities', 'person', 'Tim Joes', + {refname: "urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(TimJoes1599144424859)'Tim Joes'", csid: '1111-2222-3333-4444'}], + ['personauthorities', 'person', 'Trepoz', + {refname: "urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(Trepoz1599221497512)'Trepoz'", csid: '1111-2222-3333-4444'}], + ['personauthorities', 'person', 'Trevor', + {refname: "urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(Trevor1599144536281)'Trevor'", csid: '1111-2222-3333-4444'}], + ['personauthorities', 'person', 'Troy', + {refname: "urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(Troy1599144360617)'Troy'", csid: '1111-2222-3333-4444'}], + ['personauthorities', 'person', 'afa', + {refname: "urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(afa1599645004939)'afa'", csid: '1111-2222-3333-4444'}], + ['personauthorities', 'person', 'cxcx', + {refname: "urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(cxcx1599551790384)'cxcx'", csid: '1111-2222-3333-4444'}], + ['personauthorities', 'person', 'dfdd', + {refname: "urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(dfdd1599551799173)'dfdd'", csid: '1111-2222-3333-4444'}], + ['personauthorities', 'person', 'dssd', + {refname: "urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(dssd1599552004115)'dssd'", csid: '1111-2222-3333-4444'}], + ['personauthorities', 'person', 'fgfgf', + {refname: "urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(fgfgf1599551987166)'fgfgf'", csid: '1111-2222-3333-4444'}], + ['personauthorities', 'person', 'giri', + {refname: "urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(giri1599645613143)'giri'", csid: '1111-2222-3333-4444'}], + ['personauthorities', 'person', 'high grade', + {refname: "urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(highgrade1599645597889)'high grade'", csid: '1111-2222-3333-4444'}], + ['personauthorities', 'person', 'malik', + {refname: "urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(malik1599664876144)'malik'", csid: '1111-2222-3333-4444'}], + ['personauthorities', 'person', 'marcus', + {refname: "urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(marcus1599650918612)'marcus'", csid: '1111-2222-3333-4444'}], + ['personauthorities', 'person', 'marley', + {refname: "urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(marley1599650874712)'marley'", csid: '1111-2222-3333-4444'}], + ['personauthorities', 'person', 'rights', + {refname: "urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(rights1599650868011)'rights'", csid: '1111-2222-3333-4444'}], + ['personauthorities', 'person', 'rudelyt', + {refname: "urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(rudelyt1599664917218)'rudelyt'", csid: '1111-2222-3333-4444'}], + ['personauthorities', 'person', 'sasa', + {refname: "urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(sasa1599551852678)'sasa'", csid: '1111-2222-3333-4444'}], + ['personauthorities', 'person', 'tint', + {refname: "urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(tint1599664800144)'tint'", csid: '1111-2222-3333-4444'}], + ['personauthorities', 'person', 'tonight', + {refname: "urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(tonight1599664781376)'tonight'", csid: '1111-2222-3333-4444'}], + ['personauthorities', 'ulan_pa', 'Chrus', + {refname: "urn:cspace:core.collectionspace.org:personauthorities:name(ulan_pa):item:name(Chrus1599559702930)'Chrus'", csid: '1111-2222-3333-4444'}], + ['personauthorities', 'ulan_pa', 'We go', + {refname: "urn:cspace:core.collectionspace.org:personauthorities:name(ulan_pa):item:name(Wego1599559866517)'We go'", csid: '1111-2222-3333-4444'}], + ['personauthorities', 'ulan_pa', 'panda nayo', + {refname: "urn:cspace:core.collectionspace.org:personauthorities:name(ulan_pa):item:name(pandanayo1599645094507)'panda nayo'", csid: '1111-2222-3333-4444'}], + ['placeauthorities', 'place', 'Chillspot', + {refname: "urn:cspace:core.collectionspace.org:placeauthorities:name(place):item:name(Chillspot1599145441945)'Chillspot'", csid: '1111-2222-3333-4444'}], + ['placeauthorities', 'tgn_place', 'mzingga', + {refname: "urn:cspace:core.collectionspace.org:placeauthorities:name(tgn_place):item:name(mzingga1599645587502)'mzingga'", csid: '1111-2222-3333-4444'}], + ['vocabularies', 'agequalifier', 'older than', + {refname: "urn:cspace:core.collectionspace.org:vocabularies:name(agequalifier):item:name(olderthan)'older than'", csid: '1111-2222-3333-4444'}], + ['vocabularies', 'collectionmethod', 'donation', + {refname: "urn:cspace:core.collectionspace.org:vocabularies:name(collectionmethod):item:name(donation)'donation'", csid: '1111-2222-3333-4444'}], + ['vocabularies', 'collectionmethod', 'excavation', + {refname: "urn:cspace:core.collectionspace.org:vocabularies:name(collectionmethod):item:name(excavation)'excavation'", csid: '1111-2222-3333-4444'}], + ['vocabularies', 'conditioncheckmethod', 'Observed', + {refname: "urn:cspace:core.collectionspace.org:vocabularies:name(conditioncheckmethod):item:name(observed)'Observed'", csid: '1111-2222-3333-4444'}], + ['vocabularies', 'conditioncheckreason', 'Damaged in transit', + {refname: "urn:cspace:core.collectionspace.org:vocabularies:name(conditioncheckreason):item:name(damagedintransit)'Damaged in transit'", csid: '1111-2222-3333-4444'}], + ['vocabularies', 'conditionfitness', 'Reasonable', + {refname: "urn:cspace:core.collectionspace.org:vocabularies:name(conditionfitness):item:name(reasonable)'Reasonable'", csid: '1111-2222-3333-4444'}], + ['vocabularies', 'conservationstatus', 'Analysis complete', + {refname: "urn:cspace:core.collectionspace.org:vocabularies:name(conservationstatus):item:name(analysiscomplete)'Analysis complete'", csid: '1111-2222-3333-4444'}], + ['vocabularies', 'conservationstatus', 'Treatment approved', + {refname: "urn:cspace:core.collectionspace.org:vocabularies:name(conservationstatus):item:name(treatmentapproved)'Treatment approved'", csid: '1111-2222-3333-4444'}], + ['vocabularies', 'conservationstatus', 'Treatment in progress', + {refname: "urn:cspace:core.collectionspace.org:vocabularies:name(conservationstatus):item:name(treatmentinprogress)'Treatment in progress'", csid: '1111-2222-3333-4444'}], + ['vocabularies', 'currency', 'Canadian Dollar', + {refname: "urn:cspace:core.collectionspace.org:vocabularies:name(currency):item:name(CAD)'Canadian Dollar'", csid: '1111-2222-3333-4444'}], + ['vocabularies', 'currency', 'Danish Krone', + {refname: "urn:cspace:core.collectionspace.org:vocabularies:name(currency):item:name(DKK)'Danish Krone'", csid: '1111-2222-3333-4444'}], + ['vocabularies', 'currency', 'Euro', + {refname: "urn:cspace:core.collectionspace.org:vocabularies:name(currency):item:name(EUR)'Euro'", csid: '1111-2222-3333-4444'}], + ['vocabularies', 'currency', 'Pound Sterling', + {refname: "urn:cspace:core.collectionspace.org:vocabularies:name(currency):item:name(GBP)'Pound Sterling'", csid: '1111-2222-3333-4444'}], + ['vocabularies', 'currency', 'Swedish Krona', + {refname: "urn:cspace:core.collectionspace.org:vocabularies:name(currency):item:name(SEK)'Swedish Krona'", csid: '1111-2222-3333-4444'}], + ['vocabularies', 'currency', 'Swiss Franc', + {refname: "urn:cspace:core.collectionspace.org:vocabularies:name(currency):item:name(CHF)'Swiss Franc'", csid: '1111-2222-3333-4444'}], + ['vocabularies', 'datecertainty', 'Circa', + {refname: "urn:cspace:core.collectionspace.org:vocabularies:name(datecertainty):item:name(circa)'Circa'", csid: '1111-2222-3333-4444'}], + ['vocabularies', 'dateera', 'BCE', + {refname: "urn:cspace:core.collectionspace.org:vocabularies:name(dateera):item:name(bce)'BCE'", csid: '1111-2222-3333-4444'}], + ['vocabularies', 'dateera', 'CE', + {refname: "urn:cspace:core.collectionspace.org:vocabularies:name(dateera):item:name(ce)'CE'", csid: '1111-2222-3333-4444'}], + ['vocabularies', 'datequalifier', 'Day(s)', + {refname: "urn:cspace:core.collectionspace.org:vocabularies:name(datequalifier):item:name(days)'Day(s)'", csid: '1111-2222-3333-4444'}], + ['vocabularies', 'datequalifier', 'Year(s)', + {refname: "urn:cspace:core.collectionspace.org:vocabularies:name(datequalifier):item:name(years)'Year(s)'", csid: '1111-2222-3333-4444'}], + ['vocabularies', 'deaccessionapprovalgroup', 'board of trustees', + {refname: "urn:cspace:core.collectionspace.org:vocabularies:name(deaccessionapprovalgroup):item:name(board_of_trustees)'board of trustees'", csid: '1111-2222-3333-4444'}], + ['vocabularies', 'deaccessionapprovalgroup', 'collection committee', + {refname: "urn:cspace:core.collectionspace.org:vocabularies:name(deaccessionapprovalgroup):item:name(collection_committee)'collection committee'", csid: '1111-2222-3333-4444'}], + ['vocabularies', 'deaccessionapprovalgroup', 'executive committee', + {refname: "urn:cspace:core.collectionspace.org:vocabularies:name(deaccessionapprovalgroup):item:name(executive_committee)'executive committee'", csid: '1111-2222-3333-4444'}], + ['vocabularies', 'deaccessionapprovalstatus', 'approved', + {refname: "urn:cspace:core.collectionspace.org:vocabularies:name(deaccessionapprovalstatus):item:name(approved)'approved'", csid: '1111-2222-3333-4444'}], + ['vocabularies', 'deaccessionapprovalstatus', 'not approved', + {refname: "urn:cspace:core.collectionspace.org:vocabularies:name(deaccessionapprovalstatus):item:name(not_approved)'not approved'", csid: '1111-2222-3333-4444'}], + ['vocabularies', 'deaccessionapprovalstatus', 'not required', + {refname: "urn:cspace:core.collectionspace.org:vocabularies:name(deaccessionapprovalstatus):item:name(not_required)'not required'", csid: '1111-2222-3333-4444'}], + ['vocabularies', 'disposalmethod', 'destruction', + {refname: "urn:cspace:core.collectionspace.org:vocabularies:name(disposalmethod):item:name(destruction)'destruction'", csid: '1111-2222-3333-4444'}], + ['vocabularies', 'entrymethod', 'Found on doorstep', + {refname: "urn:cspace:core.collectionspace.org:vocabularies:name(entrymethod):item:name(foundondoorstep)'Found on doorstep'", csid: '1111-2222-3333-4444'}], + ['vocabularies', 'entrymethod', 'Post', + {refname: "urn:cspace:core.collectionspace.org:vocabularies:name(entrymethod):item:name(post)'Post'", csid: '1111-2222-3333-4444'}], + ['vocabularies', 'examinationphase', 'before treatment', + {refname: "urn:cspace:core.collectionspace.org:vocabularies:name(examinationphase):item:name(beforetreatment)'before treatment'", csid: '1111-2222-3333-4444'}], + ['vocabularies', 'examinationphase', 'during treatment', + {refname: "urn:cspace:core.collectionspace.org:vocabularies:name(examinationphase):item:name(duringtreatment)'during treatment'", csid: '1111-2222-3333-4444'}], + ['vocabularies', 'exhibitionpersonrole', 'Educator', + {refname: "urn:cspace:core.collectionspace.org:vocabularies:name(exhibitionpersonrole):item:name(educator)'Educator'", csid: '1111-2222-3333-4444'}], + ['vocabularies', 'exhibitionpersonrole', 'Public programs coordinator', + {refname: "urn:cspace:core.collectionspace.org:vocabularies:name(exhibitionpersonrole):item:name(publicprogramscoordinator)'Public programs coordinator'", csid: '1111-2222-3333-4444'}], + ['vocabularies', 'exhibitionreferencetype', 'News article', + {refname: "urn:cspace:core.collectionspace.org:vocabularies:name(exhibitionreferencetype):item:name(newsarticle)'News article'", csid: '1111-2222-3333-4444'}], + ['vocabularies', 'exhibitionreferencetype', 'Press release', + {refname: "urn:cspace:core.collectionspace.org:vocabularies:name(exhibitionreferencetype):item:name(pressrelease)'Press release'", csid: '1111-2222-3333-4444'}], + ['vocabularies', 'exhibitionstatus', 'Preliminary object list created', + {refname: "urn:cspace:core.collectionspace.org:vocabularies:name(exhibitionstatus):item:name(preliminaryobjectlistcreated)'Preliminary object list created'", csid: '1111-2222-3333-4444'}], + ['vocabularies', 'exhibitiontype', 'Temporary', + {refname: "urn:cspace:core.collectionspace.org:vocabularies:name(exhibitiontype):item:name(temporary)'Temporary'", csid: '1111-2222-3333-4444'}], + ['vocabularies', 'inventorystatus', 'accession status unclear', + {refname: "urn:cspace:core.collectionspace.org:vocabularies:name(inventorystatus):item:name(accessionstatusunclear)'accession status unclear'", csid: '1111-2222-3333-4444'}], + ['vocabularies', 'inventorystatus', 'destroyed', + {refname: "urn:cspace:core.collectionspace.org:vocabularies:name(inventorystatus):item:name(destroyed)'destroyed'", csid: '1111-2222-3333-4444'}], + ['vocabularies', 'inventorystatus', 'unknown', + {refname: "urn:cspace:core.collectionspace.org:vocabularies:name(inventorystatus):item:name(unknown)'unknown'", csid: '1111-2222-3333-4444'}], + ['vocabularies', 'languages', 'Ancient Greek', + {refname: "urn:cspace:core.collectionspace.org:vocabularies:name(languages):item:name(grc)'Ancient Greek'", csid: '1111-2222-3333-4444'}], + ['vocabularies', 'languages', 'Armenian', + {refname: "urn:cspace:core.collectionspace.org:vocabularies:name(languages):item:name(hye)'Armenian'", csid: '1111-2222-3333-4444'}], + ['vocabularies', 'languages', 'English', + {refname: "urn:cspace:core.collectionspace.org:vocabularies:name(languages):item:name(eng)'English'", csid: '1111-2222-3333-4444'}], + ['vocabularies', 'languages', 'French', + {refname: "urn:cspace:core.collectionspace.org:vocabularies:name(languages):item:name(fra)'French'", csid: '1111-2222-3333-4444'}], + ['vocabularies', 'languages', 'Malaysian', + {refname: "urn:cspace:core.collectionspace.org:vocabularies:name(languages):item:name(mal)'Malaysian'", csid: '1111-2222-3333-4444'}], + ['vocabularies', 'languages', 'Spanish', + {refname: "urn:cspace:core.collectionspace.org:vocabularies:name(languages):item:name(spa)'Spanish'", csid: '1111-2222-3333-4444'}], + ['vocabularies', 'languages', 'Swahili', + {refname: "urn:cspace:core.collectionspace.org:vocabularies:name(languages):item:name(swa)'Swahili'", csid: '1111-2222-3333-4444'}], + ['vocabularies', 'loanoutstatus', 'Authorized', + {refname: "urn:cspace:core.collectionspace.org:vocabularies:name(loanoutstatus):item:name(authorized)'Authorized'", csid: '1111-2222-3333-4444'}], + ['vocabularies', 'loanoutstatus', 'Photography requested', + {refname: "urn:cspace:core.collectionspace.org:vocabularies:name(loanoutstatus):item:name(photographyrequested)'Photography requested'", csid: '1111-2222-3333-4444'}], + ['vocabularies', 'loanoutstatus', 'Refused', + {refname: "urn:cspace:core.collectionspace.org:vocabularies:name(loanoutstatus):item:name(refused)'Refused'", csid: '1111-2222-3333-4444'}], + ['vocabularies', 'loanoutstatus', 'Returned', + {refname: "urn:cspace:core.collectionspace.org:vocabularies:name(loanoutstatus):item:name(returned)'Returned'", csid: '1111-2222-3333-4444'}], + ['vocabularies', 'newsarticle', 'News article', + {refname: "urn:cspace:core.collectionspace.org:vocabularies:name(exhibitionreferencetype):item:name(newsarticle)'News article'", csid: '1111-2222-3333-4444'}], + ['vocabularies', 'otherpartyrole', 'Preparator', + {refname: "urn:cspace:core.collectionspace.org:vocabularies:name(otherpartyrole):item:name(preparator)'Preparator'", csid: '1111-2222-3333-4444'}], + ['vocabularies', 'otherpartyrole', 'Technician', + {refname: "urn:cspace:core.collectionspace.org:vocabularies:name(otherpartyrole):item:name(technician)'Technician'", csid: '1111-2222-3333-4444'}], + ['vocabularies', 'publishto', 'CollectionSpace Public Browser', + {refname: "urn:cspace:core.collectionspace.org:vocabularies:name(publishto):item:name(cspacepub)'CollectionSpace Public Browser'", csid: '1111-2222-3333-4444'}], + ['vocabularies', 'publishto', 'Culture Object', + {refname: "urn:cspace:core.collectionspace.org:vocabularies:name(publishto):item:name(cultureobject)'Culture Object'", csid: '1111-2222-3333-4444'}], + ['vocabularies', 'publishto', 'None', + {refname: "urn:cspace:core.collectionspace.org:vocabularies:name(publishto):item:name(none)'None'", csid: '1111-2222-3333-4444'}], + ['vocabularies', 'publishto', 'Omeka', + {refname: "urn:cspace:core.collectionspace.org:vocabularies:name(publishto):item:name(omeka)'Omeka'", csid: '1111-2222-3333-4444'}], + ['vocabularies', 'treatmentpurpose', 'Exhibition', + {refname: "urn:cspace:core.collectionspace.org:vocabularies:name(treatmentpurpose):item:name(exhibition)'Exhibition'", csid: '1111-2222-3333-4444'}], + ['vocabularies', 'uocauthorizationstatuses', 'Approved', + {refname: "urn:cspace:core.collectionspace.org:vocabularies:name(uocauthorizationstatuses):item:name(approved)'Approved'", csid: '1111-2222-3333-4444'}], + ['vocabularies', 'uoccollectiontypes', 'archeology', + {refname: "urn:cspace:core.collectionspace.org:vocabularies:name(uoccollectiontypes):item:name(uocarcheology)'archeology'", csid: '1111-2222-3333-4444'}], + ['vocabularies', 'uocmaterialtypes', 'bulb', + {refname: "urn:cspace:core.collectionspace.org:vocabularies:name(uocmaterialtypes):item:name(bulb)'bulb'", csid: '1111-2222-3333-4444'}], + ['vocabularies', 'uocmethods', 'class', + {refname: "urn:cspace:core.collectionspace.org:vocabularies:name(uocmethods):item:name(class)'class'", csid: '1111-2222-3333-4444'}], + ['vocabularies', 'uocstaffroles', 'greeter', + {refname: "urn:cspace:core.collectionspace.org:vocabularies:name(uocstaffroles):item:name(greeter)'greeter'", csid: '1111-2222-3333-4444'}], + ['vocabularies', 'uocsubcollections', 'Asia', + {refname: "urn:cspace:core.collectionspace.org:vocabularies:name(uocsubcollections):item:name(uocsubcollection02)'Asia'", csid: '1111-2222-3333-4444'}], + ['vocabularies', 'uocuserroles', 'faculty', + {refname: "urn:cspace:core.collectionspace.org:vocabularies:name(uocuserroles):item:name(faculty)'faculty'", csid: '1111-2222-3333-4444'}], + ['vocabularies', 'uocusertypes', 'lecturer', + {refname: "urn:cspace:core.collectionspace.org:vocabularies:name(uocusertypes):item:name(lecturer)'lecturer'", csid: '1111-2222-3333-4444'}], + ['workauthorities', 'work', 'Makeup', + {refname: "urn:cspace:core.collectionspace.org:workauthorities:name(work):item:name(Makeup1608768998350)'Makeup'", csid: '1111-2222-3333-4444'}], ] populate(cache, terms) end diff --git a/spec/fcart_helpers.rb b/spec/fcart_helpers.rb index 5f897767..549d4152 100644 --- a/spec/fcart_helpers.rb +++ b/spec/fcart_helpers.rb @@ -22,7 +22,7 @@ def fcart_cache def populate_fcart(cache) terms = [ ['personauthorities', 'person', 'Elizabeth', - { refname: "urn:cspace:fcart.collectionspace.org:personauthorities:name(person):item:name(Elizabeth123)'Elizabeth'", csid: '1111-2222-3333-4444' }] ] + {refname: "urn:cspace:fcart.collectionspace.org:personauthorities:name(person):item:name(Elizabeth123)'Elizabeth'", csid: '1111-2222-3333-4444'}] ] populate(cache, terms) end diff --git a/spec/lhmc_helpers.rb b/spec/lhmc_helpers.rb index dcd91aee..0855f2e4 100644 --- a/spec/lhmc_helpers.rb +++ b/spec/lhmc_helpers.rb @@ -22,9 +22,9 @@ def lhmc_cache def populate_lhmc(cache) terms = [ ['personauthorities', 'person', 'Ann Analyst', - { refname: "urn:cspace:lhmc.collectionspace.org:personauthorities:name(person):item:name(AnnAnalyst1594848799340)'Ann Analyst'", csid: '1111-2222-3333-4444' }], + {refname: "urn:cspace:lhmc.collectionspace.org:personauthorities:name(person):item:name(AnnAnalyst1594848799340)'Ann Analyst'", csid: '1111-2222-3333-4444'}], ['vocabularies', 'agerange', 'adolescent 26-75%', - { refname: "urn:cspace:lhmc.collectionspace.org:vocabularies:name(agerange):item:name(adolescent_26_75)'adolescent 26-75%'", csid: '1111-2222-3333-4444' }], + {refname: "urn:cspace:lhmc.collectionspace.org:vocabularies:name(agerange):item:name(adolescent_26_75)'adolescent 26-75%'", csid: '1111-2222-3333-4444'}], ] populate(cache, terms) end diff --git a/utils/csv-to-datahashes.rb b/utils/csv-to-datahashes.rb index 90b1496e..fe05ffbc 100644 --- a/utils/csv-to-datahashes.rb +++ b/utils/csv-to-datahashes.rb @@ -15,11 +15,11 @@ end options = {} -OptionParser.new{ |opts| +OptionParser.new do |opts| opts.banner = 'Usage: ruby csv-to-datahashes.rb -i PATH_TO_CSV' opts.on('-i', '--input PATH_TO_CSV', - 'Path to CSV file. One JSON file will be created per row in the same directory.'){ |i| + 'Path to CSV file. One JSON file will be created per row in the same directory.') do |i| options[:input] = i unless File.file?(i) puts "File #{i} does not exist" @@ -29,12 +29,12 @@ puts "File #{i} does not have '.csv' suffix" exit end - } - opts.on('-h', '--help', 'Prints this help'){ + end + opts.on('-h', '--help', 'Prints this help') do puts opts exit - } -}.parse! + end +end.parse! datahashes = [] diff --git a/utils/datahash_to_csv.rb b/utils/datahash_to_csv.rb index 70186775..347d3bdc 100644 --- a/utils/datahash_to_csv.rb +++ b/utils/datahash_to_csv.rb @@ -16,10 +16,10 @@ end options = {} -OptionParser.new{ |opts| +OptionParser.new do |opts| opts.banner = 'Usage: ruby datahash-to-csv.rb -i PATH_TO_JSON' - opts.on('-i', '--input PATH_TO_JSON', 'Path to JSON datahash file.'){ |i| + opts.on('-i', '--input PATH_TO_JSON', 'Path to JSON datahash file.') do |i| options[:input] = i unless File.file?(i) puts "File #{i} does not exist" @@ -29,12 +29,12 @@ puts "File #{i} does not have '.json' suffix" exit end - } - opts.on('-h', '--help', 'Prints this help'){ + end + opts.on('-h', '--help', 'Prints this help') do puts opts exit - } -}.parse! + end +end.parse! dir = options[:input]['/'] ? options[:input].sub(/\/[^\/]+$/, '/') : '' filename_stub = options[:input].sub(/^.*\//, '').sub('.json', '') From fab88330fd2f5f8cc6a5dda5de4043444a557280 Mon Sep 17 00:00:00 2001 From: Kristina Spurgin Date: Thu, 20 Jan 2022 17:55:37 -0500 Subject: [PATCH 19/20] rubocopping --- Gemfile | 2 +- collectionspace-mapper.gemspec | 8 +- doc/batch_configuration.adoc | 17 -- lib/collectionspace/mapper.rb | 2 +- .../mapper/authority_hierarchy_prepper.rb | 4 +- .../mapper/authority_transformer.rb | 5 +- .../mapper/behrensmeyer_transformer.rb | 4 +- .../mapper/boolean_transformer.rb | 1 - lib/collectionspace/mapper/column_mapping.rb | 1 + lib/collectionspace/mapper/column_mappings.rb | 1 + lib/collectionspace/mapper/column_value.rb | 1 - lib/collectionspace/mapper/config.rb | 28 ++- lib/collectionspace/mapper/data_handler.rb | 29 +-- lib/collectionspace/mapper/data_mapper.rb | 42 ++-- lib/collectionspace/mapper/data_prepper.rb | 71 +++---- .../mapper/data_quality_checker.rb | 2 +- lib/collectionspace/mapper/data_splitter.rb | 1 + lib/collectionspace/mapper/data_validator.rb | 8 +- .../mapper/date_stamp_transformer.rb | 4 +- .../mapper/downcase_transformer.rb | 4 +- .../mapper/find_replace_operation.rb | 3 +- .../mapper/find_replace_transformer.rb | 1 - .../mapper/group_column_value.rb | 1 - .../mapper/group_multival_column_value.rb | 1 - .../identifiers/authority_short_identifier.rb | 2 - .../mapper/identifiers/short_identifier.rb | 2 - .../mapper/multival_column_value.rb | 1 - .../non_hierarchical_relationship_prepper.rb | 4 +- .../mapper/object_hierarchy_data_prepper.rb | 4 +- lib/collectionspace/mapper/record_mapper.rb | 1 - .../mapper/regex_find_replace_operation.rb | 1 - lib/collectionspace/mapper/response.rb | 2 +- lib/collectionspace/mapper/row_data.rb | 2 +- lib/collectionspace/mapper/row_fields.rb | 3 +- .../mapper/structured_date_transformer.rb | 4 +- .../mapper/subgroup_column_value.rb | 1 - lib/collectionspace/mapper/term_handler.rb | 27 ++- lib/collectionspace/mapper/term_searchable.rb | 25 ++- lib/collectionspace/mapper/tools/dates.rb | 46 +++-- .../mapper/tools/record_status_service.rb | 19 +- lib/collectionspace/mapper/tools/refname.rb | 13 +- .../mapper/tools/symbolizable.rb | 3 +- lib/collectionspace/mapper/transformer.rb | 8 +- lib/collectionspace/mapper/transformers.rb | 1 - .../mapper/value_transformer.rb | 2 +- .../mapper/vocabulary_transformer.rb | 5 +- lib/collectionspace/mapper/xml_template.rb | 1 - spec/anthro_helpers.rb | 2 +- spec/bonsai_helpers.rb | 2 +- spec/botgarden_helpers.rb | 2 +- .../mapper/column_mapping_spec.rb | 8 +- .../mapper/column_mappings_spec.rb | 183 +++++++++--------- .../mapper/column_value_spec.rb | 23 ++- spec/collectionspace/mapper/config_spec.rb | 10 +- .../mapper/data_handler_spec.rb | 46 ++--- .../mapper/data_mapper_core_spec.rb | 34 ++-- .../mapper/data_mapper_spec.rb | 5 +- .../mapper/data_prepper_spec.rb | 18 +- .../mapper/data_quality_checker_spec.rb | 68 ++++--- .../mapper/data_splitter_spec.rb | 54 +++--- .../mapper/data_validator_spec.rb | 14 +- .../mapper/find_replace_operation_spec.rb | 5 +- .../mapper/find_replace_transformer_spec.rb | 11 +- .../mapper/group_column_value_spec.rb | 21 +- .../group_multival_column_value_spec.rb | 21 +- .../identifiers/short_identifier_spec.rb | 1 - .../mapper/multival_column_value_spec.rb | 21 +- .../mapper/record_mapper_config_spec.rb | 20 +- .../regex_find_replace_operation_spec.rb | 3 +- spec/collectionspace/mapper/row_data_spec.rb | 18 +- .../mapper/subgroup_column_value_spec.rb | 21 +- .../mapper/term_handler_spec.rb | 86 ++++---- .../mapper/term_searchable_spec.rb | 4 +- .../tools/record_status_service_spec.rb | 46 +++-- .../mapper/tools/refname_spec.rb | 7 +- .../mapper/tools/symbolizable_spec.rb | 13 +- .../mapper/transformer_spec.rb | 22 ++- .../mapper/transformers_spec.rb | 18 +- .../mapper/value_transformer_spec.rb | 24 +-- spec/collectionspace/mapper_spec.rb | 11 +- spec/core_helpers.rb | 4 +- spec/fcart_helpers.rb | 4 +- spec/helpers.rb | 15 +- spec/lhmc_helpers.rb | 2 +- utils/benchmarking/profile.rb | 4 +- utils/csv-to-datahashes.rb | 4 +- utils/datahash_to_csv.rb | 4 +- 87 files changed, 649 insertions(+), 648 deletions(-) diff --git a/Gemfile b/Gemfile index 3ac88b98..30e6525f 100644 --- a/Gemfile +++ b/Gemfile @@ -1,7 +1,7 @@ # frozen_string_literal: true source 'https://rubygems.org' -git_source(:github){|repo_name| "https://github.com/#{repo_name}" } +git_source(:github){ |repo_name| "https://github.com/#{repo_name}" } ruby '2.7.4' diff --git a/collectionspace-mapper.gemspec b/collectionspace-mapper.gemspec index 1c143924..6d0eed94 100644 --- a/collectionspace-mapper.gemspec +++ b/collectionspace-mapper.gemspec @@ -1,6 +1,6 @@ # frozen_string_literal: true -lib = File.expand_path('../lib', __FILE__) +lib = File.expand_path('lib', __dir__) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) require 'collectionspace/mapper/version' @@ -10,7 +10,7 @@ Gem::Specification.new do |spec| spec.authors = ['Kristina Spurgin'] spec.email = ['kristina.spurgin@lyrasis.org'] - spec.summary = %q{Generic mapper turns hash of data into CollectionSpace XML} + spec.summary = 'Generic mapper turns hash of data into CollectionSpace XML' spec.homepage = 'https://github.com/lyrasis/collectionspace-mapper' spec.license = 'MIT' @@ -26,12 +26,12 @@ Gem::Specification.new do |spec| spec.metadata['changelog_uri'] = 'https://github.com/lyrasis/collectionspace-mapper' else raise 'RubyGems 2.0 or newer is required to protect against ' \ - 'public gem pushes.' + 'public gem pushes.' end # Specify which files should be added to the gem when it is released. # The `git ls-files -z` loads the files in the RubyGem that have been added into git. - spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do + spec.files = Dir.chdir(File.expand_path(__dir__)) do `git ls-files -z`.split("\x0").reject{ |f| f.match(%r{^(test|spec|features)/}) } end spec.bindir = 'exe' diff --git a/doc/batch_configuration.adoc b/doc/batch_configuration.adoc index 283ba3d9..f9acdbf3 100644 --- a/doc/batch_configuration.adoc +++ b/doc/batch_configuration.adoc @@ -24,7 +24,6 @@ A JSON config hash may be passed to a new `Mapper::DataHandler` to control vario "response_mode": "verbose", "strip_id_values": true, "multiple_recs_found": "fail", - "check_terms" : true, "check_record_status" : true, "force_defaults": false, "date_format": "month day year", @@ -118,22 +117,6 @@ While it is possible to use this setting to batch update existing records that d - *Data type*: string - *Allowed values*: `fail`, `use_first` -== check_terms - -If `true`, looks up each term via `collectionspace-refcache`. If found, uses existing refname. If not found, searches for term via cspace-services API and uses existing refname if found. If term not found in refcache or services API, builds a new refname, uses that in the record, adds it to refcache, and returns the term with `found=false` in `Response::Terms`. - -If `false`, never searches services API for the term. Uses refcache refname if it exists, otherwise builds a new refname and adds it to refcache. Returns all terms with `found=false` in `Response::Terms`. - -[NOTE] -==== -Set this to false only if you are certain no terms from your data exist in CollectionSpace, and all of the terms need to be created as new. Otherwise, you may end up with duplicate terms being added to CollectionSpace, due to the fact that `collectionspace-mapper` does not generate exactly the same hashed short identifier value for use in the refname as the CollectionSpace application does. -==== - -- *Required?:* yes -- *Defaults to:* true -- *Data type*: boolean -- *Allowed values*: `true`, `false` - == check_record_status If `true`, looks up each record via cspace-services API and sets `Response.record_status` to `:exists` if the record is found, or `:new` if it is not. diff --git a/lib/collectionspace/mapper.rb b/lib/collectionspace/mapper.rb index 98a9077a..befe90d4 100644 --- a/lib/collectionspace/mapper.rb +++ b/lib/collectionspace/mapper.rb @@ -36,6 +36,7 @@ module Errors class UnprocessableDataError < StandardError UnprocessableDataError = CollectionSpace::Mapper::Errors::UnprocessableDataError attr_reader :input + def initialize(message, input) super(message) @input = input @@ -76,6 +77,5 @@ def merge_default_values(data, batchconfig) def term_key(term) "#{term[:refname].type}-#{term[:refname].subtype}-#{term[:refname].display_name}" end - end end diff --git a/lib/collectionspace/mapper/authority_hierarchy_prepper.rb b/lib/collectionspace/mapper/authority_hierarchy_prepper.rb index a52218ed..9086ffa0 100644 --- a/lib/collectionspace/mapper/authority_hierarchy_prepper.rb +++ b/lib/collectionspace/mapper/authority_hierarchy_prepper.rb @@ -54,9 +54,7 @@ def transform_terms end @response.split_data.each do |field, value| - unless @response.transformed_data.key?(field) - @response.transformed_data[field] = value - end + @response.transformed_data[field] = value unless @response.transformed_data.key?(field) end end diff --git a/lib/collectionspace/mapper/authority_transformer.rb b/lib/collectionspace/mapper/authority_transformer.rb index c8587d46..82572423 100644 --- a/lib/collectionspace/mapper/authority_transformer.rb +++ b/lib/collectionspace/mapper/authority_transformer.rb @@ -4,10 +4,8 @@ module CollectionSpace module Mapper - # transforms authority display name into RefName class AuthorityTransformer < Transformer - def initialize(opts) super @type = opts[:transform][0] @@ -16,8 +14,7 @@ def initialize(opts) @csclient = opts[:recmapper].csclient end - def transform(value) - end + def transform(value); end end end end diff --git a/lib/collectionspace/mapper/behrensmeyer_transformer.rb b/lib/collectionspace/mapper/behrensmeyer_transformer.rb index 7c9e026a..ac3b4257 100644 --- a/lib/collectionspace/mapper/behrensmeyer_transformer.rb +++ b/lib/collectionspace/mapper/behrensmeyer_transformer.rb @@ -4,11 +4,9 @@ module CollectionSpace module Mapper - # transforms digit into full Behrensmeyer scale vocabulary term class BehrensmeyerTransformer < Transformer - def transform(value) - end + def transform(value); end end end end diff --git a/lib/collectionspace/mapper/boolean_transformer.rb b/lib/collectionspace/mapper/boolean_transformer.rb index 6623b5fb..ad407162 100644 --- a/lib/collectionspace/mapper/boolean_transformer.rb +++ b/lib/collectionspace/mapper/boolean_transformer.rb @@ -4,7 +4,6 @@ module CollectionSpace module Mapper - # transforms a variety of binary values into Boolean string values for CS class BooleanTransformer < Transformer def transform(value) diff --git a/lib/collectionspace/mapper/column_mapping.rb b/lib/collectionspace/mapper/column_mapping.rb index 55066239..3c5768de 100644 --- a/lib/collectionspace/mapper/column_mapping.rb +++ b/lib/collectionspace/mapper/column_mapping.rb @@ -10,6 +10,7 @@ module Mapper class ColumnMapping attr_reader :recmapper, :data_type, :fieldname, :in_repeating_group, :is_group, :namespace, :opt_list_values, :repeats, :source_type, :transforms, :xpath + def initialize(mapping_hash, recmapper) @recmapper = recmapper mapping_hash.each do |key, value| diff --git a/lib/collectionspace/mapper/column_mappings.rb b/lib/collectionspace/mapper/column_mappings.rb index 7b6f4ce2..d44f1a4c 100644 --- a/lib/collectionspace/mapper/column_mappings.rb +++ b/lib/collectionspace/mapper/column_mappings.rb @@ -10,6 +10,7 @@ class ColumnMappings extend Forwardable attr_reader :config + def_delegators :@all, :each, :length, :map, :reject!, :select def initialize(opts = {}) diff --git a/lib/collectionspace/mapper/column_value.rb b/lib/collectionspace/mapper/column_value.rb index 013cba6a..f14794fa 100644 --- a/lib/collectionspace/mapper/column_value.rb +++ b/lib/collectionspace/mapper/column_value.rb @@ -2,7 +2,6 @@ module CollectionSpace module Mapper - # represents a row of data from a CSV. class ColumnValue def initialize(column:, value:, recmapper:, mapping:) diff --git a/lib/collectionspace/mapper/config.rb b/lib/collectionspace/mapper/config.rb index 2c49dee0..15a95934 100644 --- a/lib/collectionspace/mapper/config.rb +++ b/lib/collectionspace/mapper/config.rb @@ -4,15 +4,15 @@ module CollectionSpace module Mapper - # This is the default config, which is modified for object or authority hierarchy, # or non-hierarchichal relationships via module extension # :reek:InstanceVariableAssumption - instance variables are set during initialization class Config attr_reader :delimiter, :subgroup_delimiter, :response_mode, :strip_id_values, :multiple_recs_found, :force_defaults, - :check_record_status, :check_terms, :date_format, :two_digit_year_handling, :transforms, :default_values, + :check_record_status, :date_format, :two_digit_year_handling, :transforms, :default_values, :record_type - # todo: move default config in here + + # TODO: move default config in here include Tools::Symbolizable DEFAULT_CONFIG = {delimiter: '|', @@ -20,21 +20,22 @@ class Config response_mode: 'normal', strip_id_values: true, multiple_recs_found: 'fail', - check_terms: true, check_record_status: true, force_defaults: false, date_format: 'month day year', - two_digit_year_handling: 'coerce' - } + two_digit_year_handling: 'coerce'} class ConfigKeyMissingError < StandardError attr_reader :keys + def initialize(message, keys) super(message) @keys = keys end end + class ConfigResponseModeError < StandardError; end + class UnhandledConfigFormatError < StandardError; end def initialize(opts = {}) @@ -57,7 +58,7 @@ def initialize(opts = {}) end def hash - config = self.to_h + config = to_h config = symbolize(config) transforms = config[:transforms] return config unless transforms @@ -97,13 +98,13 @@ def set_instance_variables(hash) def validate begin has_required_attributes - rescue ConfigKeyMissingError => err - err.keys.each{ |key| instance_variable_set("@#{key}", DEFAULT_CONFIG[key]) } + rescue ConfigKeyMissingError => e + e.keys.each{ |key| instance_variable_set("@#{key}", DEFAULT_CONFIG[key]) } end begin valid_response_mode - rescue ConfigResponseModeError => err + rescue ConfigResponseModeError => e replacement_value = DEFAULT_CONFIG[:response_mode] @response_mode = replacement_value end @@ -112,16 +113,14 @@ def validate def valid_response_mode valid = %w[normal verbose] unless valid.any?(@response_mode) - raise ConfigResponseModeError.new("Invalid response_mode value in config: #{@response_mode}") + raise ConfigResponseModeError, "Invalid response_mode value in config: #{@response_mode}" end end def has_required_attributes required_keys = DEFAULT_CONFIG.keys remaining_keys = required_keys - hash.keys - unless remaining_keys.empty? - raise ConfigKeyMissingError.new('Config missing key', remaining_keys) - end + raise ConfigKeyMissingError.new('Config missing key', remaining_keys) unless remaining_keys.empty? end def special_defaults @@ -130,4 +129,3 @@ def special_defaults end end end - diff --git a/lib/collectionspace/mapper/data_handler.rb b/lib/collectionspace/mapper/data_handler.rb index d4ee80ad..fbede43f 100644 --- a/lib/collectionspace/mapper/data_handler.rb +++ b/lib/collectionspace/mapper/data_handler.rb @@ -5,7 +5,6 @@ module CollectionSpace module Mapper - # given a RecordMapper hash and a data hash, returns CollectionSpace XML document class DataHandler # this is an accessor rather than a reader until I refactor away the hideous @@ -32,7 +31,7 @@ def process(data) end def prep(data) - response = CollectionSpace::Mapper::setup_data(data, @mapper.batchconfig) + response = CollectionSpace::Mapper.setup_data(data, @mapper.batchconfig) if response.valid? case @mapper.record_type when 'authorityhierarchy' @@ -74,7 +73,7 @@ def service_type end def validate(data) - response = CollectionSpace::Mapper::setup_data(data, @mapper.batchconfig) + response = CollectionSpace::Mapper.setup_data(data, @mapper.batchconfig) validator.validate(response) end @@ -116,12 +115,12 @@ def xpath_hash # populate parent of all non-top xpaths h.each do |xpath, ph| - if xpath['/'] - keys = h.keys - [xpath] - keys = keys.select{ |k| xpath[k] } - keys = keys.sort{ |a, b| b.length <=> a.length } - ph[:parent] = keys[0] unless keys.empty? - end + next unless xpath['/'] + + keys = h.keys - [xpath] + keys = keys.select{ |k| xpath[k] } + keys = keys.sort{ |a, b| b.length <=> a.length } + ph[:parent] = keys[0] unless keys.empty? end # populate children @@ -145,13 +144,15 @@ def xpath_hash if v.size > 1 puts "WARNING: #{xpath} has fields with different :in_repeating_group values (#{v}). Defaulting to treating NOT as a group" end - ph[:is_group] = -true if ct == 1 && v == ['as part of larger repeating group'] && ph[:mappings][0].repeats == 'y' + if ct == 1 && v == ['as part of larger repeating group'] && ph[:mappings][0].repeats == 'y' + ph[:is_group] = + true + end end # populate is_subgroup subgroups = [] - h.each{ |k, v| subgroups << v[:subgroups] } + h.each{ |_k, v| subgroups << v[:subgroups] } subgroups = subgroups.flatten.uniq h.keys.each{ |k| h[k][:is_subgroup] = true if subgroups.include?(k) } h @@ -202,10 +203,10 @@ def tag_terms(result) return if terms.empty? terms.select{ |t| !t[:found] }.each do |term| - @new_terms[CollectionSpace::Mapper::term_key(term)] = nil + @new_terms[CollectionSpace::Mapper.term_key(term)] = nil end terms.select{ |t| t[:found] }.each do |term| - term[:found] = false if @new_terms.key?(CollectionSpace::Mapper::term_key(term)) + term[:found] = false if @new_terms.key?(CollectionSpace::Mapper.term_key(term)) end result.terms = terms diff --git a/lib/collectionspace/mapper/data_mapper.rb b/lib/collectionspace/mapper/data_mapper.rb index bdd81af9..f504b56d 100644 --- a/lib/collectionspace/mapper/data_mapper.rb +++ b/lib/collectionspace/mapper/data_mapper.rb @@ -5,6 +5,7 @@ module Mapper class DataMapper attr_reader :handler, :xphash attr_accessor :doc, :response + def initialize(response, handler, xphash) @response = response @handler = handler @@ -122,15 +123,16 @@ def populate_simple_field_data(field_name, data, parent) def populate_group_field_data(index, data, parent) data.each do |field, values| - if values[index] - child = Nokogiri::XML::Node.new(field, @doc) - if values[index].is_a?(Hash) - map_structured_date(child, values[index]) - else values[index] - child.content = values[index] - end - parent.add_child(child) + next unless values[index] + + child = Nokogiri::XML::Node.new(field, @doc) + if values[index].is_a?(Hash) + map_structured_date(child, values[index]) + else + values[index] + child.content = values[index] end + parent.add_child(child) end end @@ -177,7 +179,7 @@ def map_group(xpath, targetnode, thisdata) end def even_subgroup_field_values?(data) - data.values.map(&:flatten).map(&:length).uniq.length == 1 ? true : false + data.values.map(&:flatten).map(&:length).uniq.length == 1 end def add_uneven_subgroup_warning(parent_path:, intervening_path:, subgroup:) @@ -204,7 +206,7 @@ def add_too_many_subgroups_warning(parent_path:, intervening_path:, subgroup:) def group_accommodates_subgroup?(groupdata, subgroupdata) sg_max_length = subgroupdata.values.map(&:length).max - sg_max_length <= groupdata.length ? true : false + sg_max_length <= groupdata.length end # EXAMPLE: creates empty titleTranslationSubGroupList as a child of titleGroup @@ -222,7 +224,7 @@ def create_intermediate_subgroup_hierarchy(grp, subgroup_path) # returns the count of field values for the subgroup field with the mosty values # we need to know this in order to create enough empty subgroup elements to hold the data def maximum_subgroup_values(data) - data.map{ |field, values| subgroup_value_count(values) }.flatten.max + data.map{ |_field, values| subgroup_value_count(values) }.flatten.max end def subgroup_value_count(values) @@ -250,12 +252,16 @@ def map_subgroup(xphash, thisdata) groups[i] = {parent: p, data: {}} end - add_uneven_subgroup_warning(parent_path: parent_path, - intervening_path: subgroup_path, - subgroup: subgroup) unless even_subgroup_field_values?(thisdata) - add_too_many_subgroups_warning(parent_path: parent_path, - intervening_path: subgroup_path, - subgroup: subgroup) unless group_accommodates_subgroup?(groups, thisdata) + unless even_subgroup_field_values?(thisdata) + add_uneven_subgroup_warning(parent_path: parent_path, + intervening_path: subgroup_path, + subgroup: subgroup) + end + unless group_accommodates_subgroup?(groups, thisdata) + add_too_many_subgroups_warning(parent_path: parent_path, + intervening_path: subgroup_path, + subgroup: subgroup) + end thisdata.each{ |field, subgroups| assign_subgroup_values_to_group_hash_data(groups, field, subgroups) } @@ -263,7 +269,7 @@ def map_subgroup(xphash, thisdata) max_ct = maximum_subgroup_values(thisdata) - groups.each do |i, data| + groups.each do |i, _data| max_ct.times do target = @doc.xpath("//#{parent_path}/#{subgroup_path.join('/')}") target[i].add_child(Nokogiri::XML::Node.new(subgroup, @doc)) diff --git a/lib/collectionspace/mapper/data_prepper.rb b/lib/collectionspace/mapper/data_prepper.rb index cf2ab421..5cc3d7de 100644 --- a/lib/collectionspace/mapper/data_prepper.rb +++ b/lib/collectionspace/mapper/data_prepper.rb @@ -5,16 +5,15 @@ module Mapper class DataPrepper attr_reader :data, :handler, :config, :cache, :client attr_accessor :response, :xphash + def initialize(data, handler) @handler = handler @config = @handler.mapper.batchconfig @cache = @handler.mapper.termcache @client = @handler.mapper.csclient - @response = CollectionSpace::Mapper::setup_data(data, @config) + @response = CollectionSpace::Mapper.setup_data(data, @config) drop_empty_fields - if @response.valid? - process_xpaths - end + process_xpaths if @response.valid? end def prep @@ -29,12 +28,12 @@ def prep end def split_data - @xphash.each{ |xpath, hash| do_splits(hash) } + @xphash.each{ |_xpath, hash| do_splits(hash) } @response.split_data end def transform_data - @xphash.each{ |xpath, hash| do_transforms(hash) } + @xphash.each{ |_xpath, hash| do_transforms(hash) } @response.transformed_data end @@ -44,14 +43,14 @@ def transform_date_fields end def handle_term_fields - @xphash.each{ |xpath, hash| do_term_handling(hash) } + @xphash.each{ |_xpath, hash| do_term_handling(hash) } @response.warnings.flatten! @response.errors.flatten! @response.transformed_data end def check_data - @xphash.each{ |xpath, hash| check_data_quality(hash) } + @xphash.each{ |_xpath, hash| check_data_quality(hash) } @response.warnings.flatten! @response.warnings end @@ -76,7 +75,7 @@ def push_errors_and_warnings end def drop_empty_fields - @response.merged_data = @response.merged_data.delete_if{ |k, v| v.blank? } + @response.merged_data = @response.merged_data.delete_if{ |_k, v| v.blank? } end def process_xpaths @@ -89,7 +88,7 @@ def process_xpaths @xphash = mappings.map{ |mapper| mapper.fullpath }.uniq # hash with xpath as key and xpath info hash from DataHandler as value @xphash = @xphash.map{ |xpath| [xpath, @handler.mapper.xpath[xpath].clone] }.to_h - @xphash.each do |xpath, hash| + @xphash.each do |_xpath, hash| hash[:mappings] = hash[:mappings].select do |mapping| mapping.fieldname == 'shortIdentifier' || @response.merged_data.key?(mapping.datacolumn) end @@ -117,7 +116,7 @@ def do_non_group_splits(xphash) next if data.nil? || data.empty? @response.split_data[column] = non_group_splitter(mapping, data) - # mapping.repeats == 'y' ? CollectionSpace::Mapper::SimpleSplitter.new(data, config).result : [data.strip] + # mapping.repeats == 'y' ? CollectionSpace::Mapper::SimpleSplitter.new(data, config).result : [data.strip] end end @@ -162,17 +161,17 @@ def do_transforms(xphash) data = splitdata.fetch(column, nil) next if data.blank? - if mapping.transforms.blank? - targetdata[column] = data - else - targetdata[column] = data.map do |d| - if d.is_a?(String) - transform_value(d, mapping.transforms, column) - else - d.map{ |val| transform_value(val, mapping.transforms, column) } - end - end - end + targetdata[column] = if mapping.transforms.blank? + data + else + data.map do |d| + if d.is_a?(String) + transform_value(d, mapping.transforms, column) + else + d.map{ |val| transform_value(val, mapping.transforms, column) } + end + end + end end end @@ -189,7 +188,7 @@ def transform_value(value, transforms, column) vt.result end - def do_date_transforms(xpath, xphash) + def do_date_transforms(_xpath, xphash) sourcedata = @response.transformed_data xphash[:mappings].each do |mapping| @@ -242,8 +241,6 @@ def get_source_type(source_type_string) source_type_string.to_sym when 'vocabulary' source_type_string.to_sym - else - nil end end @@ -255,10 +252,12 @@ def structured_date_transform(data) @cache, @handler.mapper.batchconfig).mappable else - d.map do |v| CollectionSpace::Mapper::Tools::Dates::CspaceDate.new(v, - @client, - @cache, - @handler.mapper.batchconfig).mappable end + d.map do |v| + CollectionSpace::Mapper::Tools::Dates::CspaceDate.new(v, + @client, + @cache, + @handler.mapper.batchconfig).mappable + end end end end @@ -271,10 +270,12 @@ def unstructured_date_transform(data) @cache, @handler.mapper.batchconfig).stamp else - d.map do |v| CollectionSpace::Mapper::Tools::Dates::CspaceDate.new(v, - @client, - @cache, - @handler.mapper.batchconfig).stamp end + d.map do |v| + CollectionSpace::Mapper::Tools::Dates::CspaceDate.new(v, + @client, + @cache, + @handler.mapper.batchconfig).stamp + end end end end @@ -322,12 +323,12 @@ def combine_data_values(xpath, xphash) elsif chk.empty? next else - raise StandardError.new('Mixed class types in multi-authority field set') + raise StandardError, 'Mixed class types in multi-authority field set' end end end - @response.combined_data[xpath].select{ |fieldname, val| val.blank? }.keys.each do |fieldname| + @response.combined_data[xpath].select{ |_fieldname, val| val.blank? }.keys.each do |fieldname| @response.combined_data[xpath].delete(fieldname) unless fieldname == 'shortIdentifier' @xphash[xpath][:mappings].delete_if{ |mapping| mapping.fieldname == fieldname } diff --git a/lib/collectionspace/mapper/data_quality_checker.rb b/lib/collectionspace/mapper/data_quality_checker.rb index 43466a28..8e9dd0cc 100644 --- a/lib/collectionspace/mapper/data_quality_checker.rb +++ b/lib/collectionspace/mapper/data_quality_checker.rb @@ -4,6 +4,7 @@ module CollectionSpace module Mapper class DataQualityChecker attr_reader :mapping, :data, :warnings, :terms + def initialize(mapping, data) @mapping = mapping @column = mapping.datacolumn @@ -77,4 +78,3 @@ def check_opt_list_val(val) end end end - diff --git a/lib/collectionspace/mapper/data_splitter.rb b/lib/collectionspace/mapper/data_splitter.rb index 76dceac9..72477277 100644 --- a/lib/collectionspace/mapper/data_splitter.rb +++ b/lib/collectionspace/mapper/data_splitter.rb @@ -4,6 +4,7 @@ module CollectionSpace module Mapper class DataSplitter attr_reader :data, :result + def initialize(data, config) @data = data.strip @config = config diff --git a/lib/collectionspace/mapper/data_validator.rb b/lib/collectionspace/mapper/data_validator.rb index f6e46e76..869669f0 100644 --- a/lib/collectionspace/mapper/data_validator.rb +++ b/lib/collectionspace/mapper/data_validator.rb @@ -69,6 +69,7 @@ class DataValidator class IdFieldNotInMapperError < StandardError; end attr_reader :mapper, :cache, :required_fields + def initialize(record_mapper, cache) @mapper = record_mapper @cache = cache @@ -82,7 +83,7 @@ def initialize(record_mapper, cache) end def validate(data) - response = CollectionSpace::Mapper::setup_data(data) + response = CollectionSpace::Mapper.setup_data(data) if response.valid? data = response.merged_data.transform_keys!(&:downcase) res = check_required_fields(data) unless @required_fields.empty? @@ -118,11 +119,11 @@ def check_required_fields(data) @required_fields.each do |field, columns| if columns.length == 1 checkfield = SingleColumnRequiredField.new(field, columns) - errs << checkfield.missing_message if !checkfield.present_in?(data) + errs << checkfield.missing_message unless checkfield.present_in?(data) errs << checkfield.empty_message if checkfield.present_in?(data) && !checkfield.populated_in?(data) elsif columns.length > 1 checkfield = MultiColumnRequiredField.new(field, columns) - errs << checkfield.missing_message if !checkfield.present_in?(data) + errs << checkfield.missing_message unless checkfield.present_in?(data) errs << checkfield.empty_message if checkfield.present_in?(data) && !checkfield.populated_in?(data) end end @@ -131,4 +132,3 @@ def check_required_fields(data) end end end - diff --git a/lib/collectionspace/mapper/date_stamp_transformer.rb b/lib/collectionspace/mapper/date_stamp_transformer.rb index 39699d15..2a28def9 100644 --- a/lib/collectionspace/mapper/date_stamp_transformer.rb +++ b/lib/collectionspace/mapper/date_stamp_transformer.rb @@ -4,11 +4,9 @@ module CollectionSpace module Mapper - # converts date string to CS date stamp class DateStampTransformer < Transformer - def transform(value) - end + def transform(value); end end end end diff --git a/lib/collectionspace/mapper/downcase_transformer.rb b/lib/collectionspace/mapper/downcase_transformer.rb index c87aea3b..66238074 100644 --- a/lib/collectionspace/mapper/downcase_transformer.rb +++ b/lib/collectionspace/mapper/downcase_transformer.rb @@ -4,11 +4,9 @@ module CollectionSpace module Mapper - # downcases field values class DowncaseTransformer < Transformer - def transform(value) - end + def transform(value); end end end end diff --git a/lib/collectionspace/mapper/find_replace_operation.rb b/lib/collectionspace/mapper/find_replace_operation.rb index 1e3e828c..4962059c 100644 --- a/lib/collectionspace/mapper/find_replace_operation.rb +++ b/lib/collectionspace/mapper/find_replace_operation.rb @@ -2,7 +2,6 @@ module CollectionSpace module Mapper - # a single find/replace operation -- one step in a FindReplaceTransformer class FindReplaceOperation def initialize(opts) @@ -19,7 +18,7 @@ def perform(value) def self.create(opts) case opts[:type] when 'plain' - self.new(opts) + new(opts) when 'regex' RegexFindReplaceOperation.new(opts) end diff --git a/lib/collectionspace/mapper/find_replace_transformer.rb b/lib/collectionspace/mapper/find_replace_transformer.rb index 88ab1c56..95dec545 100644 --- a/lib/collectionspace/mapper/find_replace_transformer.rb +++ b/lib/collectionspace/mapper/find_replace_transformer.rb @@ -5,7 +5,6 @@ module CollectionSpace module Mapper - # carries out a find/replace operation on a given value class FindReplaceTransformer < Transformer def initialize(transform:) diff --git a/lib/collectionspace/mapper/group_column_value.rb b/lib/collectionspace/mapper/group_column_value.rb index 155f4a8a..212edca6 100644 --- a/lib/collectionspace/mapper/group_column_value.rb +++ b/lib/collectionspace/mapper/group_column_value.rb @@ -5,7 +5,6 @@ module CollectionSpace module Mapper - # a column value destined for a field in a repeating field group class GroupColumnValue < ColumnValue include Repeatable diff --git a/lib/collectionspace/mapper/group_multival_column_value.rb b/lib/collectionspace/mapper/group_multival_column_value.rb index a48ad894..b52ca070 100644 --- a/lib/collectionspace/mapper/group_multival_column_value.rb +++ b/lib/collectionspace/mapper/group_multival_column_value.rb @@ -5,7 +5,6 @@ module CollectionSpace module Mapper - # a column value destined for a single/non-subgrouped repeating field within a repeating field group class GroupMultivalColumnValue < ColumnValue include Subgroupable diff --git a/lib/collectionspace/mapper/identifiers/authority_short_identifier.rb b/lib/collectionspace/mapper/identifiers/authority_short_identifier.rb index 85e19f4f..116dd98d 100644 --- a/lib/collectionspace/mapper/identifiers/authority_short_identifier.rb +++ b/lib/collectionspace/mapper/identifiers/authority_short_identifier.rb @@ -5,7 +5,6 @@ module CollectionSpace module Mapper module Identifiers - class AuthorityShortIdentifier < ShortIdentifier def initialize(**opts) super @@ -24,4 +23,3 @@ def hashed_term end end end - diff --git a/lib/collectionspace/mapper/identifiers/short_identifier.rb b/lib/collectionspace/mapper/identifiers/short_identifier.rb index e3147f22..16ba145d 100644 --- a/lib/collectionspace/mapper/identifiers/short_identifier.rb +++ b/lib/collectionspace/mapper/identifiers/short_identifier.rb @@ -3,7 +3,6 @@ module CollectionSpace module Mapper module Identifiers - class ShortIdentifier def initialize(term:) @term = term @@ -22,4 +21,3 @@ def prepped_term end end end - diff --git a/lib/collectionspace/mapper/multival_column_value.rb b/lib/collectionspace/mapper/multival_column_value.rb index 64457ed0..4ff738fc 100644 --- a/lib/collectionspace/mapper/multival_column_value.rb +++ b/lib/collectionspace/mapper/multival_column_value.rb @@ -5,7 +5,6 @@ module CollectionSpace module Mapper - # a column value destined for a multivalue field nested directly under a namespace element class MultivalColumnValue < ColumnValue include Repeatable diff --git a/lib/collectionspace/mapper/non_hierarchical_relationship_prepper.rb b/lib/collectionspace/mapper/non_hierarchical_relationship_prepper.rb index 72925f0f..fa9227a4 100644 --- a/lib/collectionspace/mapper/non_hierarchical_relationship_prepper.rb +++ b/lib/collectionspace/mapper/non_hierarchical_relationship_prepper.rb @@ -78,9 +78,7 @@ def transform_terms end @response.split_data.each do |field, value| - unless @response.transformed_data.key?(field) - @response.transformed_data[field] = value - end + @response.transformed_data[field] = value unless @response.transformed_data.key?(field) end end end diff --git a/lib/collectionspace/mapper/object_hierarchy_data_prepper.rb b/lib/collectionspace/mapper/object_hierarchy_data_prepper.rb index cd9c59d6..22044cea 100644 --- a/lib/collectionspace/mapper/object_hierarchy_data_prepper.rb +++ b/lib/collectionspace/mapper/object_hierarchy_data_prepper.rb @@ -54,9 +54,7 @@ def transform_terms end @response.split_data.each do |field, value| - unless @response.transformed_data.key?(field) - @response.transformed_data[field] = value - end + @response.transformed_data[field] = value unless @response.transformed_data.key?(field) end end diff --git a/lib/collectionspace/mapper/record_mapper.rb b/lib/collectionspace/mapper/record_mapper.rb index bf9cc6d6..e5ef66bc 100644 --- a/lib/collectionspace/mapper/record_mapper.rb +++ b/lib/collectionspace/mapper/record_mapper.rb @@ -4,7 +4,6 @@ module CollectionSpace module Mapper - # Represents a JSON RecordMapper containing the config, field mappings, and template # for transforming a hash of data into CollectionSpace XML # The RecordMapper bundles up all the info needed by various other classes in order diff --git a/lib/collectionspace/mapper/regex_find_replace_operation.rb b/lib/collectionspace/mapper/regex_find_replace_operation.rb index f9fe5204..1656a6e2 100644 --- a/lib/collectionspace/mapper/regex_find_replace_operation.rb +++ b/lib/collectionspace/mapper/regex_find_replace_operation.rb @@ -2,7 +2,6 @@ module CollectionSpace module Mapper - # a single find/replace operation -- one step in a FindReplaceTransformer class RegexFindReplaceOperation < FindReplaceOperation def perform(value) diff --git a/lib/collectionspace/mapper/response.rb b/lib/collectionspace/mapper/response.rb index 97ee071a..3eb615fc 100644 --- a/lib/collectionspace/mapper/response.rb +++ b/lib/collectionspace/mapper/response.rb @@ -6,6 +6,7 @@ class Response attr_reader :orig_data attr_accessor :split_data, :merged_data, :transformed_data, :combined_data, :doc, :errors, :warnings, :identifier, :terms, :record_status, :csid, :uri, :refname + def initialize(data_hash) @orig_data = data_hash @merged_data = {} @@ -48,4 +49,3 @@ def add_multi_rec_found_warning(num_found) end end end - diff --git a/lib/collectionspace/mapper/row_data.rb b/lib/collectionspace/mapper/row_data.rb index c874e0f2..f1a45567 100644 --- a/lib/collectionspace/mapper/row_data.rb +++ b/lib/collectionspace/mapper/row_data.rb @@ -2,11 +2,11 @@ module CollectionSpace module Mapper - # represents a row of data from a CSV. # ends up having some responsibility for coordinating the processing of the row class RowData attr_reader :columns + def initialize(datahash, recmapper) @recmapper = recmapper @columns = datahash.map do |column, value| diff --git a/lib/collectionspace/mapper/row_fields.rb b/lib/collectionspace/mapper/row_fields.rb index 86fb7a17..4ad01e31 100644 --- a/lib/collectionspace/mapper/row_fields.rb +++ b/lib/collectionspace/mapper/row_fields.rb @@ -5,8 +5,7 @@ module Mapper # aggregate class to work with all of a RecordMapper's CollectionSpace fields in an # Arrayish-fashion class RowFields - def initialize() - end + def initialize; end end end end diff --git a/lib/collectionspace/mapper/structured_date_transformer.rb b/lib/collectionspace/mapper/structured_date_transformer.rb index da6505c8..6c134d4c 100644 --- a/lib/collectionspace/mapper/structured_date_transformer.rb +++ b/lib/collectionspace/mapper/structured_date_transformer.rb @@ -4,11 +4,9 @@ module CollectionSpace module Mapper - # converts date string to CS structured date XML snippet class StructuredDateTransformer < Transformer - def transform(value) - end + def transform(value); end end end end diff --git a/lib/collectionspace/mapper/subgroup_column_value.rb b/lib/collectionspace/mapper/subgroup_column_value.rb index d22c4aff..4113387c 100644 --- a/lib/collectionspace/mapper/subgroup_column_value.rb +++ b/lib/collectionspace/mapper/subgroup_column_value.rb @@ -5,7 +5,6 @@ module CollectionSpace module Mapper - # a column value destined for repeating subgroups of fields within a repeating field group class SubgroupColumnValue < ColumnValue include Subgroupable diff --git a/lib/collectionspace/mapper/term_handler.rb b/lib/collectionspace/mapper/term_handler.rb index 78477d80..d7a207ce 100644 --- a/lib/collectionspace/mapper/term_handler.rb +++ b/lib/collectionspace/mapper/term_handler.rb @@ -10,6 +10,7 @@ class TermHandler attr_reader :result, :terms, :warnings, :errors, :column, :source_type, :type, :subtype attr_accessor :value + def initialize(mapping:, data:, client:, cache:, mapper:) @mapping = mapping @data = data @@ -39,11 +40,11 @@ def initialize(mapping:, data:, client:, cache:, mapper:) private def handle_terms - if @data.first.is_a?(String) - @result = @data.map{ |val| handle_term(val) } - else - @result = @data.map{ |arr| arr.map{ |val| handle_term(val)} } - end + @result = if @data.first.is_a?(String) + @data.map{ |val| handle_term(val) } + else + @data.map{ |arr| arr.map{ |val| handle_term(val) } } + end end def handle_term(val) @@ -68,12 +69,10 @@ def handle_term(val) refname_urn = add_known_unknown_term(val, term_report) added = true else # not in cache - if @config.check_terms - refname_urn = searched_term(val, :refname) - if refname_urn - add_found_term(refname_urn, term_report) - added = true - end + refname_urn = searched_term(val, :refname) + if refname_urn + add_found_term(refname_urn, term_report) + added = true end end @@ -84,7 +83,7 @@ def handle_term(val) def add_found_term(refname_urn, term_report) refname_obj = CollectionSpace::Mapper::Tools::RefName.new(urn: refname_urn) - found = @config.check_terms ? true : false + found = true @terms << term_report.merge({found: found, refname: refname_obj}) end @@ -99,7 +98,8 @@ def add_new_unknown_term(val, term_report) type: type, subtype: subtype, term: val, - cache: @cache) + cache: @cache + ) @terms << term_report.merge({found: false, refname: refname_obj}) refname_url = refname_obj.urn @@ -118,4 +118,3 @@ def add_known_unknown_term(val, term_report) end end end - diff --git a/lib/collectionspace/mapper/term_searchable.rb b/lib/collectionspace/mapper/term_searchable.rb index beb9f969..9d7552f1 100644 --- a/lib/collectionspace/mapper/term_searchable.rb +++ b/lib/collectionspace/mapper/term_searchable.rb @@ -20,7 +20,7 @@ def cached_as_unknown?(val) private def type_subtype "#{type}/#{subtype}" - end + end # returns refName of cached term def cached_term(val, return_key = :refname, termtype = type, termsubtype = subtype) @@ -35,7 +35,7 @@ def cached_term(val, return_key = :refname, termtype = type, termsubtype = subty return cache_response if cache_response.is_a?(Hash) instance_eval(cache_response) - end + end # returns refName of searched (term) def searched_term(val, return_key = :refname) @@ -51,14 +51,14 @@ def searched_term(val, return_key = :refname) private def case_swap(string) string.match?(/[A-Z]/) ? string.downcase : string.capitalize - end + end private def term_search_response(val) as_is = get_term_response(val) return as_is if term_response_usable?(as_is) get_term_response(case_swap(val)) - end + end private def get_term_response(val) response = @client.find( @@ -72,7 +72,7 @@ def searched_term(val, return_key = :refname) nil else parse_response(response) - end + end private def parse_response(response) parsed = response.parsed['abstract_common_list'] @@ -81,7 +81,7 @@ def searched_term(val, return_key = :refname) nil else parsed - end + end def obj_csid(objnum, type) cached = @cache.get(type, '', objnum, search: false) @@ -98,7 +98,7 @@ def lookup_obj_or_procedure_csid(objnum, type) return nil unless rec csid = rec['csid'] - @cache.put(type, '', objnum, {refname: rec['refName'], csid: csid} ) + @cache.put(type, '', objnum, {refname: rec['refName'], csid: csid}) csid else errors << { @@ -109,7 +109,7 @@ def lookup_obj_or_procedure_csid(objnum, type) value: objnum, message: "Problem with search for #{objnum}." } - return nil + nil end end @@ -126,14 +126,14 @@ def term_csid(term) return false if ct == 0 true - end + end private def response_item_count(response) ct = response.dig('totalItems') return ct.to_i if ct nil - end + end private def add_missing_record_error(category, val) datacolumn = column ||= 'data' @@ -146,7 +146,7 @@ def term_csid(term) value: val, message: "#{val} (#{type_subtype} in #{datacolumn} column)" } - end + end private def rec_from_response(category, val, response) term_ct = response_item_count(response) @@ -183,7 +183,7 @@ def term_csid(term) end rec - end + end private def search_field field = CollectionSpace::Service.get(type: type)[:term] @@ -204,7 +204,6 @@ def get_vocabulary_term(vocab:, term:) @cache.get('vocabularies', vocab, term.capitalize, search: true) end end - end end end diff --git a/lib/collectionspace/mapper/tools/dates.rb b/lib/collectionspace/mapper/tools/dates.rb index 6de3caba..3c1c5fe7 100644 --- a/lib/collectionspace/mapper/tools/dates.rb +++ b/lib/collectionspace/mapper/tools/dates.rb @@ -36,7 +36,7 @@ def initialize(date_string, client, cache, config) service_parseable_month_formats = [ '^\w+ \d{4}$', - '^\d{4} \w+$', + '^\d{4} \w+$' ].map{ |f| Regexp.new(f) } other_month_formats = [ @@ -49,8 +49,7 @@ def initialize(date_string, client, cache, config) elsif date_string == THE_BOMB @timestamp = date_string blow_up_date - elsif - date_formats.any?{ |re| @date_string.match?(re) } + elsif date_formats.any?{ |re| @date_string.match?(re) } try_chronic_parse(@date_string) @timestamp ? create_mappable_date : try_services_query elsif two_digit_year_date_formats.any?{ |re| @date_string.match?(re) } @@ -78,23 +77,23 @@ def coerced_year_date val = @date_string.gsub('/', '-').split('-') yr = val.pop this_year = Time.now.year.to_s - this_year_century = this_year[0,2] - this_year_last_two = this_year[2,2].to_i - - if yr.to_i > this_year_last_two - val << "#{this_year_century.to_i - 1}#{yr}" - else - val << "#{this_year_century}#{yr}" - end + this_year_century = this_year[0, 2] + this_year_last_two = this_year[2, 2].to_i + + val << if yr.to_i > this_year_last_two + "#{this_year_century.to_i - 1}#{yr}" + else + "#{this_year_century}#{yr}" + end val.join('-') end def try_chronic_parse(string) - if @config.date_format == 'day month year' - @timestamp = Chronic.parse(string, endian_precedence: :little) - else - @timestamp = Chronic.parse(string) - end + @timestamp = if @config.date_format == 'day month year' + Chronic.parse(string, endian_precedence: :little) + else + Chronic.parse(string) + end end def create_mappable_passthrough @@ -172,24 +171,23 @@ def try_services_query @mappable = fix_services_scalars(result) else @mappable = {'dateDisplayDate' => date_string, - 'scalarValuesComputed' => 'false' - } + 'scalarValuesComputed' => 'false'} end end def fix_services_scalars(services_result) new_hash = {} services_result.each do |k, v| - if k.end_with?('ScalarValue') - new_hash[k] = "#{v}#{@timestamp_suffix}" - else - new_hash[k] = v - end + new_hash[k] = if k.end_with?('ScalarValue') + "#{v}#{@timestamp_suffix}" + else + v + end end new_hash end - def map(doc, parentnode, groupname) + def map(_doc, _parentnode, _groupname) @parser_result.each do |datefield, value| value = DateTime.parse(value).iso8601(3).sub('+00:00', 'Z') if datefield['ScalarValue'] end diff --git a/lib/collectionspace/mapper/tools/record_status_service.rb b/lib/collectionspace/mapper/tools/record_status_service.rb index 581b9d8b..a0c77b50 100644 --- a/lib/collectionspace/mapper/tools/record_status_service.rb +++ b/lib/collectionspace/mapper/tools/record_status_service.rb @@ -4,6 +4,7 @@ module CollectionSpace module Mapper class MultipleCsRecordsFoundError < StandardError attr_reader :message + def initialize(count) @message = "#{count} matching records found in CollectionSpace. Cannot determine which to update." end @@ -16,7 +17,7 @@ class RecordStatusService def initialize(client, mapper) @client = client @mapper = mapper - @is_authority = @mapper.config.service_type == 'authority' ? true : false + @is_authority = @mapper.config.service_type == 'authority' service = get_service @search_field = @is_authority ? service[:term] : service[:field] @ns_prefix = service[:ns_prefix] @@ -30,11 +31,11 @@ def initialize(client, mapper) # collectionspace-client code. # Tests in examples/search.rb def lookup(value) - if @ns_prefix == 'relations' - response = @client.find_relation(subject_csid: value[:sub], object_csid: value[:obj]) - else - response = lookup_non_relationship(value) - end + response = if @ns_prefix == 'relations' + @client.find_relation(subject_csid: value[:sub], object_csid: value[:obj]) + else + lookup_non_relationship(value) + end ct = count_results(response) if ct == 0 @@ -42,7 +43,7 @@ def lookup(value) elsif ct == 1 reportable_result(response.parsed[@response_top][@response_nested]) elsif ct > 1 - raise CollectionSpace::Mapper::MultipleCsRecordsFoundError.new(ct) unless use_first? + raise CollectionSpace::Mapper::MultipleCsRecordsFoundError, ct unless use_first? item = response.parsed[@response_top][@response_nested].first num_found = response.parsed[@response_top][@response_nested].length @@ -79,9 +80,7 @@ def use_first? end def count_results(response) - unless response.result.success? - raise CollectionSpace::RequestError, response.result.body - end + raise CollectionSpace::RequestError, response.result.body unless response.result.success? response.parsed[@response_top]['totalItems'].to_i end diff --git a/lib/collectionspace/mapper/tools/refname.rb b/lib/collectionspace/mapper/tools/refname.rb index fc6fbe71..80708eed 100644 --- a/lib/collectionspace/mapper/tools/refname.rb +++ b/lib/collectionspace/mapper/tools/refname.rb @@ -4,7 +4,7 @@ module CollectionSpace module Mapper module Tools class RefNameArgumentError < ArgumentError - def initialize(msg='Arguments requires either :urn OR :source_type, :type, :subtype, :term, :cache values') + def initialize(msg = 'Arguments requires either :urn OR :source_type, :type, :subtype, :term, :cache values') super end end @@ -24,7 +24,7 @@ def initialize(args) new_from_urn elsif args_given == term_args cache = args[:cache] - @domain = cache.domain.sub(/https?:\/\//, '').sub('/cspace-services', '') + @domain = cache.domain.sub(%r{https?://}, '').sub('/cspace-services', '') @type = args[:type] @subtype = args[:subtype] @display_name = args[:term] @@ -43,7 +43,6 @@ def build_urn end def new_from_term - @identifier = CollectionSpace::Mapper::Identifiers::ShortIdentifier.new(term: @display_name).value end @@ -52,9 +51,9 @@ def new_from_authority_term end def new_from_urn - if /^urn:cspace:([^:]+):([^:]+):name\(([^\)]+)\):item:name\(([^\)]+)\)'/.match?(@urn) + if /^urn:cspace:([^:]+):([^:]+):name\(([^)]+)\):item:name\(([^)]+)\)'/.match?(@urn) term_parts_from_urn - elsif /^urn:cspace:([^:]+):([^:]+):id\(([^\)]+)\)(.*)/.match?(@urn) + elsif /^urn:cspace:([^:]+):([^:]+):id\(([^)]+)\)(.*)/.match?(@urn) non_term_parts_from_urn else raise CS::Mapper::Tools::UnparseableUrnError @@ -62,7 +61,7 @@ def new_from_urn end def term_parts_from_urn - parts = @urn.match(/^urn:cspace:([^:]+):([^:]+):name\(([^\)]+)\):item:name\(([^\)]+)\)'/) + parts = @urn.match(/^urn:cspace:([^:]+):([^:]+):name\(([^)]+)\):item:name\(([^)]+)\)'/) @domain = parts[1] @type = parts[2] @subtype = parts[3] @@ -71,7 +70,7 @@ def term_parts_from_urn end def non_term_parts_from_urn - parts = @urn.match(/^urn:cspace:([^:]+):([^:]+):id\(([^\)]+)\)(.*)/) + parts = @urn.match(/^urn:cspace:([^:]+):([^:]+):id\(([^)]+)\)(.*)/) @domain = parts[1] @type = parts[2] @subtype = nil diff --git a/lib/collectionspace/mapper/tools/symbolizable.rb b/lib/collectionspace/mapper/tools/symbolizable.rb index 44228739..955fea88 100644 --- a/lib/collectionspace/mapper/tools/symbolizable.rb +++ b/lib/collectionspace/mapper/tools/symbolizable.rb @@ -11,7 +11,7 @@ def symbolize(hash) end def symbolize_transforms(transforms) - transforms.each do |field, fieldtransform| + transforms.each do |_field, fieldtransform| fieldtransform.transform_keys!(&:to_sym) next unless replacements?(fieldtransform) @@ -30,4 +30,3 @@ def replacements?(fieldtransform) end end end - diff --git a/lib/collectionspace/mapper/transformer.rb b/lib/collectionspace/mapper/transformer.rb index f6a30e8c..2313e0c2 100644 --- a/lib/collectionspace/mapper/transformer.rb +++ b/lib/collectionspace/mapper/transformer.rb @@ -2,18 +2,16 @@ module CollectionSpace module Mapper - # parent class of the data value Transformer class hierarchy class Transformer attr_reader :precedence, :warnings - def initialize(opts = {}) + def initialize(_opts = {}) @precedence = lookup_precedence @warnings = [] end - def transform(value) - end + def transform(value); end def <=>(other) @precedence <=> other.precedence @@ -35,7 +33,7 @@ def lookup_precedence ].find_index(self.class) end - def self.create(type:, transform: {}, recmapper:) + def self.create(type:, recmapper:, transform: {}) case type.to_sym when :authority AuthorityTransformer.new(transform: transform, recmapper: recmapper) diff --git a/lib/collectionspace/mapper/transformers.rb b/lib/collectionspace/mapper/transformers.rb index 5d972058..ce98f9c8 100644 --- a/lib/collectionspace/mapper/transformers.rb +++ b/lib/collectionspace/mapper/transformers.rb @@ -2,7 +2,6 @@ module CollectionSpace module Mapper - # aggregate representation of transformers associated with a ColumnMapping (queue) # Performs a factory function by creating the appropriate individual Transformers for a given # ColumnMapping based on data_type diff --git a/lib/collectionspace/mapper/value_transformer.rb b/lib/collectionspace/mapper/value_transformer.rb index c2ed8216..f68d1072 100644 --- a/lib/collectionspace/mapper/value_transformer.rb +++ b/lib/collectionspace/mapper/value_transformer.rb @@ -5,6 +5,7 @@ module Mapper class ValueTransformer include TermSearchable attr_reader :orig, :result, :warnings, :errors + def initialize(value, transforms, prepper) @value = value @orig = @value.clone @@ -99,4 +100,3 @@ def process_behrensmeyer end end end - diff --git a/lib/collectionspace/mapper/vocabulary_transformer.rb b/lib/collectionspace/mapper/vocabulary_transformer.rb index d438236c..0416fba8 100644 --- a/lib/collectionspace/mapper/vocabulary_transformer.rb +++ b/lib/collectionspace/mapper/vocabulary_transformer.rb @@ -4,10 +4,8 @@ module CollectionSpace module Mapper - # transforms vocabulary term into RefName class VocabularyTransformer < Transformer - def initialize(opts) super @type = 'vocabularies' @@ -17,8 +15,7 @@ def initialize(opts) @csclient = mapper.csclient end - def transform(value) - end + def transform(value); end end end end diff --git a/lib/collectionspace/mapper/xml_template.rb b/lib/collectionspace/mapper/xml_template.rb index 132a1736..783d3f7e 100644 --- a/lib/collectionspace/mapper/xml_template.rb +++ b/lib/collectionspace/mapper/xml_template.rb @@ -2,7 +2,6 @@ module CollectionSpace module Mapper - # The XML document structure for a given record type. # Knows the structure as a Hash provided by initial JSON record mapper # Provides a blank XML document with all namespace and field group elements diff --git a/spec/anthro_helpers.rb b/spec/anthro_helpers.rb index 698158ad..fcbf8d58 100644 --- a/spec/anthro_helpers.rb +++ b/spec/anthro_helpers.rb @@ -179,7 +179,7 @@ def populate_anthro(cache) ['personauthorities', 'person', 'praya', {refname: "urn:cspace:anthro.collectionspace.org:personauthorities:name(person):item:name(praya1599821095120)'praya'", csid: '1111-2222-3333-4444'}], ['personauthorities', 'person', 'jijoe', - {refname: "urn:cspace:anthro.collectionspace.org:personauthorities:name(person):item:name(jijoe1599821246989)'jijoe'", csid: '1111-2222-3333-4444'}], + {refname: "urn:cspace:anthro.collectionspace.org:personauthorities:name(person):item:name(jijoe1599821246989)'jijoe'", csid: '1111-2222-3333-4444'}] ] populate(cache, terms) end diff --git a/spec/bonsai_helpers.rb b/spec/bonsai_helpers.rb index 0a836d98..3a705217 100644 --- a/spec/bonsai_helpers.rb +++ b/spec/bonsai_helpers.rb @@ -42,7 +42,7 @@ def populate_bonsai(cache) ['vocabularies', 'deaccessionapprovalstatus', 'not required', {refname: "urn:cspace:bonsai.collectionspace.org:vocabularies:name(deaccessionapprovalstatus):item:name(not_required)'not required'", csid: '1111-2222-3333-4444'}], ['vocabularies', 'disposalmethod', 'public auction', - {refname: "urn:cspace:bonsai.collectionspace.org:vocabularies:name(disposalmethod):item:name(public_auction)'public auction'", csid: '1111-2222-3333-4444'}], + {refname: "urn:cspace:bonsai.collectionspace.org:vocabularies:name(disposalmethod):item:name(public_auction)'public auction'", csid: '1111-2222-3333-4444'}] ] populate(cache, terms) end diff --git a/spec/botgarden_helpers.rb b/spec/botgarden_helpers.rb index f7aef6e8..3acc6ac2 100644 --- a/spec/botgarden_helpers.rb +++ b/spec/botgarden_helpers.rb @@ -76,7 +76,7 @@ def populate_botgarden(cache) ['vocabularies', 'taxontermflag', 'invalid', {refname: "urn:cspace:botgarden.collectionspace.org:vocabularies:name(taxontermflag):item:name(invalid)'invalid'", csid: '1111-2222-3333-4444'}], ['vocabularies', 'taxontermflag', 'valid', - {refname: "urn:cspace:botgarden.collectionspace.org:vocabularies:name(taxontermflag):item:name(valid)'valid'", csid: '1111-2222-3333-4444'}], + {refname: "urn:cspace:botgarden.collectionspace.org:vocabularies:name(taxontermflag):item:name(valid)'valid'", csid: '1111-2222-3333-4444'}] ] populate(cache, terms) end diff --git a/spec/collectionspace/mapper/column_mapping_spec.rb b/spec/collectionspace/mapper/column_mapping_spec.rb index 05785faa..6c3bf914 100644 --- a/spec/collectionspace/mapper/column_mapping_spec.rb +++ b/spec/collectionspace/mapper/column_mapping_spec.rb @@ -27,10 +27,12 @@ end describe '#fullpath' do - let(:hash) do { + let(:hash) do + { namespace: 'collectionobjects_common', - xpath: ['otherNumberList', 'otherNumber'], - } end + xpath: %w[otherNumberList otherNumber] + } + end it 'returns full xpath to target CollectionSpace field' do expected = 'collectionobjects_common/otherNumberList/otherNumber' expect(mapping.fullpath).to eq(expected) diff --git a/spec/collectionspace/mapper/column_mappings_spec.rb b/spec/collectionspace/mapper/column_mappings_spec.rb index b981d742..bb314631 100644 --- a/spec/collectionspace/mapper/column_mappings_spec.rb +++ b/spec/collectionspace/mapper/column_mappings_spec.rb @@ -3,74 +3,78 @@ require 'spec_helper' RSpec.describe CollectionSpace::Mapper::ColumnMappings do - let(:mappings) do [ - {fieldname: 'objectNumber', - transforms: {}, - source_type: 'na', - source_name: nil, - namespace: 'collectionobjects_common', - xpath: [], - data_type: 'string', - repeats: 'n', - in_repeating_group: 'n/a', - opt_list_values: [], - datacolumn: 'objectNumber', - required: 'y'}, - {fieldname: 'numberOfObjects', - transforms: {}, - source_type: 'na', - source_name: nil, - namespace: 'collectionobjects_common', - xpath: [], - data_type: 'integer', - repeats: 'n', - in_repeating_group: 'n/a', - opt_list_values: [], - datacolumn: 'numberOfObjects', - required: 'n'}, - {fieldname: 'numberValue', - transforms: {}, - source_type: 'na', - source_name: nil, - namespace: 'collectionobjects_common', - xpath: ['otherNumberList', 'otherNumber'], - data_type: 'string', - repeats: 'n', - in_repeating_group: 'y', - opt_list_values: [], - datacolumn: 'numberValue', - required: 'n'}, - {fieldname: 'numberType', - transforms: {}, - source_type: 'optionlist', - source_name: 'numberTypes', - namespace: 'collectionobjects_common', - xpath: ['otherNumberList', 'otherNumber'], - data_type: 'string', - repeats: 'n', - in_repeating_group: 'y', - opt_list_values: ['lender', 'obsolete', 'previous', 'serial', 'unknown'], - datacolumn: 'numberType', - required: 'n'}, - {datacolumn: 'otherRequired', - required: 'y'} - ] end + let(:mappings) do + [ + {fieldname: 'objectNumber', + transforms: {}, + source_type: 'na', + source_name: nil, + namespace: 'collectionobjects_common', + xpath: [], + data_type: 'string', + repeats: 'n', + in_repeating_group: 'n/a', + opt_list_values: [], + datacolumn: 'objectNumber', + required: 'y'}, + {fieldname: 'numberOfObjects', + transforms: {}, + source_type: 'na', + source_name: nil, + namespace: 'collectionobjects_common', + xpath: [], + data_type: 'integer', + repeats: 'n', + in_repeating_group: 'n/a', + opt_list_values: [], + datacolumn: 'numberOfObjects', + required: 'n'}, + {fieldname: 'numberValue', + transforms: {}, + source_type: 'na', + source_name: nil, + namespace: 'collectionobjects_common', + xpath: %w[otherNumberList otherNumber], + data_type: 'string', + repeats: 'n', + in_repeating_group: 'y', + opt_list_values: [], + datacolumn: 'numberValue', + required: 'n'}, + {fieldname: 'numberType', + transforms: {}, + source_type: 'optionlist', + source_name: 'numberTypes', + namespace: 'collectionobjects_common', + xpath: %w[otherNumberList otherNumber], + data_type: 'string', + repeats: 'n', + in_repeating_group: 'y', + opt_list_values: %w[lender obsolete previous serial unknown], + datacolumn: 'numberType', + required: 'n'}, + {datacolumn: 'otherRequired', + required: 'y'} + ] + end let(:recordmapper){ instance_double('CS::Mapper::RecordMapper') } let(:mapperconfig){ instance_double('CS::Mapper::RecordMapperConfig') } let(:mappingsobj){ dc = described_class.new(mappings: mappings, mapper: recordmapper) } - let(:added_field) do { - fieldname: 'addedField', - namespace: 'persons_common', - data_type: 'string', - xpath: [], - required: 'not in input data', - repeats: 'n', - in_repeating_group: 'n/a', - datacolumn: 'addedfield' - } end + let(:added_field) do + { + fieldname: 'addedField', + namespace: 'persons_common', + data_type: 'string', + xpath: [], + required: 'not in input data', + repeats: 'n', + in_repeating_group: 'n/a', + datacolumn: 'addedfield' + } + end before do allow(recordmapper).to receive(:config).and_return(mapperconfig) @@ -94,32 +98,34 @@ end context 'when initialized from media RecordMapper' do - let(:mappings) do [ - {fieldname: 'identificationNumber', - transforms: {}, - source_type: 'na', - source_name: nil, - namespace: 'media_common', - xpath: [], - data_type: 'string', - repeats: 'n', - in_repeating_group: 'n/a', - opt_list_values: [], - datacolumn: 'identificationNumber', - required: 'y'}, - {fieldname: 'title', - transforms: {}, - source_type: 'na', - source_name: nil, - namespace: 'media_common', - xpath: [], - data_type: 'string', - repeats: 'n', - in_repeating_group: 'n/a', - opt_list_values: [], - datacolumn: 'title', - required: 'n'} - ] end + let(:mappings) do + [ + {fieldname: 'identificationNumber', + transforms: {}, + source_type: 'na', + source_name: nil, + namespace: 'media_common', + xpath: [], + data_type: 'string', + repeats: 'n', + in_repeating_group: 'n/a', + opt_list_values: [], + datacolumn: 'identificationNumber', + required: 'y'}, + {fieldname: 'title', + transforms: {}, + source_type: 'na', + source_name: nil, + namespace: 'media_common', + xpath: [], + data_type: 'string', + repeats: 'n', + in_repeating_group: 'n/a', + opt_list_values: [], + datacolumn: 'title', + required: 'n'} + ] + end it 'adds mediaFileURI to mappings' do allow(mapperconfig).to receive(:common_namespace).and_return('media_common') @@ -158,4 +164,3 @@ end end end - diff --git a/spec/collectionspace/mapper/column_value_spec.rb b/spec/collectionspace/mapper/column_value_spec.rb index f92760f2..8a8c5830 100644 --- a/spec/collectionspace/mapper/column_value_spec.rb +++ b/spec/collectionspace/mapper/column_value_spec.rb @@ -3,19 +3,23 @@ require 'spec_helper' RSpec.describe CollectionSpace::Mapper::ColumnValue do - let(:mapperpath){ 'spec/fixtures/files/mappers/release_6_1/core/core_6-1-0_collectionobject.json'} + let(:mapperpath){ 'spec/fixtures/files/mappers/release_6_1/core/core_6-1-0_collectionobject.json' } let(:recmapper){ get_record_mapper_object(mapperpath, core_cache) } let(:mapping){ recmapper.mappings.lookup(colname) } - let(:colval) do described_class.new(column: colname, - value: colvalue, - recmapper: recmapper, - mapping: mapping) end + let(:colval) do + described_class.new(column: colname, + value: colvalue, + recmapper: recmapper, + mapping: mapping) + end describe '.create' do - let(:creator) do described_class.create(column: colname, - value: colvalue, - recmapper: recmapper, - mapping: mapping) end + let(:creator) do + described_class.create(column: colname, + value: colvalue, + recmapper: recmapper, + mapping: mapping) + end context 'given core collectionobject collection value' do let(:colname){ 'collection' } @@ -67,4 +71,3 @@ end end end - diff --git a/spec/collectionspace/mapper/config_spec.rb b/spec/collectionspace/mapper/config_spec.rb index d38b07bc..a64644a0 100644 --- a/spec/collectionspace/mapper/config_spec.rb +++ b/spec/collectionspace/mapper/config_spec.rb @@ -3,7 +3,8 @@ require 'spec_helper' RSpec.describe CollectionSpace::Mapper::Config do - let(:configstr) do '{ + let(:configstr) do + '{ "delimiter": ";", "subgroup_delimiter": "^^", "response_mode": "verbose", @@ -36,8 +37,9 @@ let(:with_nothing){ described_class.new } let(:with_array){ described_class.new(config: [2, 3]) } let(:expected_hash) do - {delimiter: ';', subgroup_delimiter: '^^', response_mode: 'verbose', strip_id_values: true, - multiple_recs_found: 'fail', force_defaults: false, check_record_status: true, check_terms: true, date_format: 'month day year', two_digit_year_handling: 'convert to four digit', transforms: {'collection' => {special: ['downcase_value'], replacements: [{find: ' ', replace: '-', type: 'plain'}]}}, default_values: {'publishto' => 'DPLA;Omeka', 'collection' => 'library-collection'}} end + {delimiter: ';', subgroup_delimiter: '^^', response_mode: 'verbose', strip_id_values: true, + multiple_recs_found: 'fail', force_defaults: false, check_record_status: true, check_terms: true, date_format: 'month day year', two_digit_year_handling: 'convert to four digit', transforms: {'collection' => {special: ['downcase_value'], replacements: [{find: ' ', replace: '-', type: 'plain'}]}}, default_values: {'publishto' => 'DPLA;Omeka', 'collection' => 'library-collection'}} + end let(:invalid_response){ {response_mode: 'mouthy'} } let(:with_invalid_response){ described_class.new(config: invalid_response) } @@ -149,5 +151,3 @@ # end # end end - - diff --git a/spec/collectionspace/mapper/data_handler_spec.rb b/spec/collectionspace/mapper/data_handler_spec.rb index 880a91a3..922590b1 100644 --- a/spec/collectionspace/mapper/data_handler_spec.rb +++ b/spec/collectionspace/mapper/data_handler_spec.rb @@ -7,7 +7,7 @@ let(:cache){ core_cache_search } let(:mapperpath){ 'spec/fixtures/files/mappers/release_6_1/core/core_6-1-0_collectionobject.json' } let(:mapper){ get_json_record_mapper(mapperpath) } - let(:config){ {"delimiter": '|'} } + let(:config){ {delimiter: '|'} } let(:handler) do CollectionSpace::Mapper::DataHandler.new(record_mapper: mapper, client: client, @@ -16,41 +16,38 @@ end # these make services api calls to find terms not in cache - context 'when config has check_terms = false', services_call: true do - let(:config){ '{"check_terms": false}' } + context 'with some terms found and some terms not found', services_call: true do let(:result){ handler.process(data).terms.reject{ |t| t[:found] } } context 'with terms in instance but not in cache' do let(:data) do - {'objectNumber' => '20CS.001.0002', - 'titleLanguage' => 'English', # vocabulary, in instance, in cache - 'namedCollection' => 'Test Collection', # authority, not in instance, not in cache - 'collection' => 'rando'} + { + 'objectNumber' => '20CS.001.0002', + 'titleLanguage' => 'English', # vocabulary, in instance, in cache + 'namedCollection' => 'Test Collection' # authority, in instance (caseswapped), not in cache + } end - it 'returns found = false for all terms, even if they exist in client', skip: 'deprecating check_terms' do - res = @handler.process(@data) + it 'returns expected found values' do + res = handler.process(data) not_found = res.terms.reject{ |t| t[:found] } - expect(not_found.length).to eq(2) + expect(not_found.length).to eq(0) end end context 'with terms in instance but not in cache, and not in instance' do let(:data) do - {'objectNumber' => '20CS.001.0001', - 'numberOfObjects' => '1', - 'numberValue' => '123456|98765', - 'numberType' => 'lender|obsolete', - 'title' => 'A Man| A Woman', - 'titleLanguage' => 'English| Klingon', - 'namedCollection' => 'Test collection', - 'collection' => 'permanent collection'} + { + 'objectNumber' => '20CS.001.0001', + 'titleLanguage' => 'English| Klingon', # English is in cache; Klingon is not in instance or cache + 'namedCollection' => 'Test collection' # In instance (caseswapped) + } end - it 'returns found = false for all terms, even if they exist in client', skip: 'deprecating check_terms' do - res = @handler.process(@data2) + it 'returns expected found values' do + res = handler.process(data) not_found = res.terms.reject{ |t| t[:found] } - expect(not_found.length).to eq(3) + expect(not_found.length).to eq(1) end end end @@ -59,7 +56,7 @@ data1 = { 'objectNumber' => '1', 'publishTo' => 'All', # vocabulary - in instance, not in cache - 'namedCollection' => 'QA TARGET Work', # authority - in instance, not in cache + 'namedCollection' => 'QA TARGET Work' # authority - in instance, not in cache } data2 = { 'objectNumber' => '2', @@ -175,7 +172,8 @@ context 'xpath ending with mortuaryTreatmentGroup' do let(:xpath) do - 'collectionobjects_anthro/commingledRemainsGroupList/commingledRemainsGroup/mortuaryTreatmentGroupList/mortuaryTreatmentGroup' end + 'collectionobjects_anthro/commingledRemainsGroupList/commingledRemainsGroup/mortuaryTreatmentGroupList/mortuaryTreatmentGroup' + end it 'is_group = true' do expect(result[:is_group]).to be true @@ -351,5 +349,3 @@ end end end - - diff --git a/spec/collectionspace/mapper/data_mapper_core_spec.rb b/spec/collectionspace/mapper/data_mapper_core_spec.rb index 9d9789e2..2f060213 100644 --- a/spec/collectionspace/mapper/data_mapper_core_spec.rb +++ b/spec/collectionspace/mapper/data_mapper_core_spec.rb @@ -8,10 +8,12 @@ context 'core profile' do let(:client){ core_client } let(:cache){ core_cache } - let(:handler) do CollectionSpace::Mapper::DataHandler.new(record_mapper: mapper, - client: client, - cache: cache, - config: config) end + let(:handler) do + CollectionSpace::Mapper::DataHandler.new(record_mapper: mapper, + client: client, + cache: cache, + config: config) + end let(:datahash){ get_datahash(path: hashpath) } let(:response){ handler.process(datahash) } let(:mapped_doc){ remove_namespaces(response.doc) } @@ -25,9 +27,11 @@ # These tests are prone to failing if one of the records used in the test in core.dev is deleted # If a UUID is expected but you get blank, recreate the record in core.dev, rerun the test to # get the UUID for the new record, and replace the old UUID in both fixture XML files used. - let(:mapper) do get_json_record_mapper( - 'spec/fixtures/files/mappers/release_6_1/core/core_6-1-0_nonhierarchicalrelationship.json' - ) end + let(:mapper) do + get_json_record_mapper( + 'spec/fixtures/files/mappers/release_6_1/core/core_6-1-0_nonhierarchicalrelationship.json' + ) + end context 'when all IDs found' do let(:hashpath){ 'spec/fixtures/files/datahashes/core/nonHierarchicalRelationship1.json' } @@ -132,7 +136,8 @@ context 'authority hierarchy record', services_call: true do let(:mapper) do - get_json_record_mapper('spec/fixtures/files/mappers/release_6_1/core/core_6-1-0_authorityhierarchy.json') end + get_json_record_mapper('spec/fixtures/files/mappers/release_6_1/core/core_6-1-0_authorityhierarchy.json') + end context 'with existing terms' do let(:hashpath){ 'spec/fixtures/files/datahashes/core/authorityHierarchy1.json' } @@ -248,7 +253,8 @@ context 'collectionobject record' do let(:mapper) do - get_json_record_mapper('spec/fixtures/files/mappers/release_6_1/core/core_6-1-0_collectionobject.json') end + get_json_record_mapper('spec/fixtures/files/mappers/release_6_1/core/core_6-1-0_collectionobject.json') + end context 'record 1' do let(:hashpath){ 'spec/fixtures/files/datahashes/core/collectionobject1.json' } @@ -305,7 +311,8 @@ context 'conditioncheck record', services_call: true do let(:mapper) do - get_json_record_mapper('spec/fixtures/files/mappers/release_6_1/core/core_6-1-0_conditioncheck.json') end + get_json_record_mapper('spec/fixtures/files/mappers/release_6_1/core/core_6-1-0_conditioncheck.json') + end context 'record 1' do let(:hashpath){ 'spec/fixtures/files/datahashes/core/conditioncheck1.json' } @@ -327,7 +334,8 @@ context 'conservation record', services_call: true do let(:mapper) do - get_json_record_mapper('spec/fixtures/files/mappers/release_6_1/core/core_6-1-0_conservation.json') end + get_json_record_mapper('spec/fixtures/files/mappers/release_6_1/core/core_6-1-0_conservation.json') + end context 'record 1' do let(:hashpath){ 'spec/fixtures/files/datahashes/core/conservation1.json' } @@ -372,7 +380,7 @@ let(:mapper){ get_json_record_mapper('spec/fixtures/files/mappers/release_6_1/core/core_6-1-0_group.json') } context 'record 1' do - let(:hashpath){ 'spec/fixtures/files/datahashes/core/group1.json'} + let(:hashpath){ 'spec/fixtures/files/datahashes/core/group1.json' } let(:fixturepath){ 'core/group1.xml' } it 'does not map unexpected fields' do @@ -507,7 +515,7 @@ it 'maps as expected' do fixture_xpaths.each do |xpath| - # todo - why is this next clause here? + # TODO: - why is this next clause here? next if xpath.start_with?('/document/objectexit_common/exitDateGroup') fixture_node = standardize_value(fixture_doc.xpath(xpath).text) diff --git a/spec/collectionspace/mapper/data_mapper_spec.rb b/spec/collectionspace/mapper/data_mapper_spec.rb index a09ddb77..1825fd07 100644 --- a/spec/collectionspace/mapper/data_mapper_spec.rb +++ b/spec/collectionspace/mapper/data_mapper_spec.rb @@ -27,7 +27,8 @@ data = [data1, data2, data3] preppers = data.map{ |d| CollectionSpace::Mapper::DataPrepper.new(d, @handler) } mappers = preppers.map do |prepper| - CollectionSpace::Mapper::DataMapper.new(prepper.prep.response, @handler, prepper.xphash) end + CollectionSpace::Mapper::DataMapper.new(prepper.prep.response, @handler, prepper.xphash) + end docs = mappers.map{ |mapper| remove_namespaces(mapper.response.doc) } docxpaths = docs.map{ |doc| list_xpaths(doc) } @@ -219,7 +220,7 @@ default_values: { 'publishTo' => 'DPLA;Omeka', 'collection' => 'library-collection' - }, + } } @recmapper = get_json_record_mapper('spec/fixtures/files/mappers/release_6_1/anthro/anthro_4-1-2_collectionobject.json') diff --git a/spec/collectionspace/mapper/data_prepper_spec.rb b/spec/collectionspace/mapper/data_prepper_spec.rb index 4a2e8861..0d9d6cea 100644 --- a/spec/collectionspace/mapper/data_prepper_spec.rb +++ b/spec/collectionspace/mapper/data_prepper_spec.rb @@ -10,7 +10,7 @@ let(:mapper){ get_json_record_mapper(mapperpath) } let(:config) do { - delimiter: delimiter, + delimiter: delimiter } end let(:handler) do @@ -43,7 +43,7 @@ { delimiter: ';', default_values: { - 'publishTo' => 'DPLA;Omeka', + 'publishTo' => 'DPLA;Omeka' } } end @@ -75,7 +75,7 @@ { delimiter: ';', default_values: { - 'publishTo' => 'DPLA;Omeka', + 'publishTo' => 'DPLA;Omeka' }, force_defaults: true } @@ -137,7 +137,7 @@ { 'objectnumber' => '123', 'annotationdate' => '12/19/2019;12/10/2019', - 'identdategroup' => '2019-09-30;4/5/2020', + 'identdategroup' => '2019-09-30;4/5/2020' } end context 'when field is a structured date' do @@ -238,7 +238,7 @@ } end - # todo: why does this call services api? + # TODO: why does this call services api? it 'combines values properly', services_call: true do result = prepper.prep.response.combined_data[xpath]['measuredBy'] expected = [ @@ -246,10 +246,11 @@ "urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(Gomongo1599463746195)'Gomongo'", "urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(Comodore1599463826401)'Comodore'", "urn:cspace:core.collectionspace.org:orgauthorities:name(organization):item:name(Cuckoo1599463786824)'Cuckoo'", - ''], + '' + ], [ "urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(Gomongo1599463746195)'Gomongo'", - "urn:cspace:core.collectionspace.org:orgauthorities:name(organization):item:name(Cuckoo1599463786824)'Cuckoo'", + "urn:cspace:core.collectionspace.org:orgauthorities:name(organization):item:name(Cuckoo1599463786824)'Cuckoo'" ] ] expect(result).to eq(expected) @@ -280,7 +281,8 @@ "urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(Gomongo1599463746195)'Gomongo'", "urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(Comodore1599463826401)'Comodore'", "urn:cspace:core.collectionspace.org:orgauthorities:name(organization):item:name(Cuckoo1599463786824)'Cuckoo'", - ''], + '' + ] ] expect(result).to eq(expected) end diff --git a/spec/collectionspace/mapper/data_quality_checker_spec.rb b/spec/collectionspace/mapper/data_quality_checker_spec.rb index 560aa333..403f43ac 100644 --- a/spec/collectionspace/mapper/data_quality_checker_spec.rb +++ b/spec/collectionspace/mapper/data_quality_checker_spec.rb @@ -7,39 +7,43 @@ let(:mapping){ CollectionSpace::Mapper::ColumnMapping.new(maphash, recordmapper) } context 'when source_type = optionlist' do - let(:maphash) do { + let(:maphash) do + { fieldname: 'collection', datacolumn: 'collection', transforms: {}, source_type: 'optionlist', - opt_list_values: [ - 'library-collection', - 'permanent-collection', - 'study-collection', - 'teaching-collection' + opt_list_values: %w[ + library-collection + permanent-collection + study-collection + teaching-collection ] - } end - it 'returns expected warnings' do - data = [ - 'Permanent Collection', # not a valid option, should return warning - '%NULLVALUE%', # indicates placeholder blank value, should be skipped - 'permanent-collection', # valid option - '' # non-placeholder blank value, should be skipped - ] - res = CollectionSpace::Mapper::DataQualityChecker.new(mapping, data).warnings - expect(res.size).to eq(1) - end + } end + it 'returns expected warnings' do + data = [ + 'Permanent Collection', # not a valid option, should return warning + '%NULLVALUE%', # indicates placeholder blank value, should be skipped + 'permanent-collection', # valid option + '' # non-placeholder blank value, should be skipped + ] + res = CollectionSpace::Mapper::DataQualityChecker.new(mapping, data).warnings + expect(res.size).to eq(1) + end + end context 'when datacolumn contains `refname`' do context 'and source_type = vocabulary' do - let(:maphash) do { - fieldname: 'nagprainventoryname', - datacolumn: 'nagprainventorynamerefname', - transforms: {}, - source_type: 'vocabulary', - opt_list_values: [] - } end + let(:maphash) do + { + fieldname: 'nagprainventoryname', + datacolumn: 'nagprainventorynamerefname', + transforms: {}, + source_type: 'vocabulary', + opt_list_values: [] + } + end context 'and value is not well-formed refname' do it 'returns warning' do data = ["urn:pahma.cspace.berkeley.edu:vocabularies:name(nagpraPahmaInventoryNames):item:name(nagpraPahmaInventoryNames01)'AK-Alaska'"] @@ -57,13 +61,15 @@ end context 'and source_type = authority' do - let(:maphash) do { - fieldname: 'nagpradetermculture', - datacolumn: 'nagpradetermculturerefname', - transforms: {}, - source_type: 'authority', - opt_list_values: [] - } end + let(:maphash) do + { + fieldname: 'nagpradetermculture', + datacolumn: 'nagpradetermculturerefname', + transforms: {}, + source_type: 'authority', + opt_list_values: [] + } + end context 'and value is not well-formed refname' do it 'returns warning' do data = ["urn:cspace:pahma.cspace.berkeley.edu:orgauthorities:name(organization):item:name(Chumash1607458832492)'Chumash"] diff --git a/spec/collectionspace/mapper/data_splitter_spec.rb b/spec/collectionspace/mapper/data_splitter_spec.rb index 0ff7d64d..e9829753 100644 --- a/spec/collectionspace/mapper/data_splitter_spec.rb +++ b/spec/collectionspace/mapper/data_splitter_spec.rb @@ -49,33 +49,33 @@ RSpec.describe CollectionSpace::Mapper::SubgroupSplitter do before(:all) do - @config = CS::Mapper::Config.new(config: {delimiter: ';', subgroup_delimiter: '^^'}) - end + @config = CS::Mapper::Config.new(config: {delimiter: ';', subgroup_delimiter: '^^'}) + end describe '#result' do - context 'when "a^^b;c^^d"' do - it 'returns [["a", "b"], ["c", "d"]]' do - s = CollectionSpace::Mapper::SubgroupSplitter.new('a^^b;c^^d', @config) - expect(s.result).to eq([%w[a b], %w[c d]]) - end - end - context 'when "a;c"' do - it 'returns [["a"], ["c"]]' do - s = CollectionSpace::Mapper::SubgroupSplitter.new('a;c', @config) - expect(s.result).to eq([%w[a], %w[c]]) - end - end - context 'when "a;c^^d"' do - it 'returns [["a"], ["c", "d"]]' do - s = CollectionSpace::Mapper::SubgroupSplitter.new('a;c^^d', @config) - expect(s.result).to eq([%w[a], %w[c d]]) - end - end - context 'when "a^^;c^^d"' do - it 'returns [["a", ""], ["c", "d"]]' do - s = CollectionSpace::Mapper::SubgroupSplitter.new('a^^;c^^d', @config) - expect(s.result).to eq([['a', ''], %w[c d]]) - end - end - end + context 'when "a^^b;c^^d"' do + it 'returns [["a", "b"], ["c", "d"]]' do + s = CollectionSpace::Mapper::SubgroupSplitter.new('a^^b;c^^d', @config) + expect(s.result).to eq([%w[a b], %w[c d]]) + end + end + context 'when "a;c"' do + it 'returns [["a"], ["c"]]' do + s = CollectionSpace::Mapper::SubgroupSplitter.new('a;c', @config) + expect(s.result).to eq([%w[a], %w[c]]) + end + end + context 'when "a;c^^d"' do + it 'returns [["a"], ["c", "d"]]' do + s = CollectionSpace::Mapper::SubgroupSplitter.new('a;c^^d', @config) + expect(s.result).to eq([%w[a], %w[c d]]) + end + end + context 'when "a^^;c^^d"' do + it 'returns [["a", ""], ["c", "d"]]' do + s = CollectionSpace::Mapper::SubgroupSplitter.new('a^^;c^^d', @config) + expect(s.result).to eq([['a', ''], %w[c d]]) + end + end + end end diff --git a/spec/collectionspace/mapper/data_validator_spec.rb b/spec/collectionspace/mapper/data_validator_spec.rb index 9f1b96f1..49bd4755 100644 --- a/spec/collectionspace/mapper/data_validator_spec.rb +++ b/spec/collectionspace/mapper/data_validator_spec.rb @@ -94,14 +94,17 @@ before(:all) do @anthro_object_mapper = get_json_record_mapper('spec/fixtures/files/mappers/release_6_1/anthro/anthro_4-1-2_collectionobject.json') @anthro_dv = CollectionSpace::Mapper::DataValidator.new( -CollectionSpace::Mapper::RecordMapper.new(mapper: @anthro_object_mapper, termcache: anthro_cache), anthro_cache) + CollectionSpace::Mapper::RecordMapper.new(mapper: @anthro_object_mapper, termcache: anthro_cache), anthro_cache + ) @botgarden_loanout_mapper = get_json_record_mapper('spec/fixtures/files/mappers/release_6_1/botgarden/botgarden_2-0-1_loanout.json') @botgarden_dv = CollectionSpace::Mapper::DataValidator.new( -CollectionSpace::Mapper::RecordMapper.new(mapper: @botgarden_loanout_mapper, - termcache: botgarden_cache), botgarden_cache) + CollectionSpace::Mapper::RecordMapper.new(mapper: @botgarden_loanout_mapper, + termcache: botgarden_cache), botgarden_cache + ) @core_authhier_mapper = get_json_record_mapper('spec/fixtures/files/mappers/release_6_1/core/core_6-1-0_authorityhierarchy.json') @core_authhier_dv = CollectionSpace::Mapper::DataValidator.new( -CollectionSpace::Mapper::RecordMapper.new(mapper: @core_authhier_mapper, termcache: core_cache), core_cache) + CollectionSpace::Mapper::RecordMapper.new(mapper: @core_authhier_mapper, termcache: core_cache), core_cache + ) end describe '#validate' do @@ -114,7 +117,8 @@ before(:all) do @mapper = get_json_record_mapper('spec/fixtures/files/mappers/release_6_1/core/core_6-1-0_movement.json') @validator = CollectionSpace::Mapper::DataValidator.new( -CollectionSpace::Mapper::RecordMapper.new(mapper: @mapper, termcache: core_cache), core_cache) + CollectionSpace::Mapper::RecordMapper.new(mapper: @mapper, termcache: core_cache), core_cache + ) end it 'validates' do data = {'movementReferenceNumber' => '1', 'currentLocationLocationLocal' => 'Loc'} diff --git a/spec/collectionspace/mapper/find_replace_operation_spec.rb b/spec/collectionspace/mapper/find_replace_operation_spec.rb index bc0c4579..c0f0995b 100644 --- a/spec/collectionspace/mapper/find_replace_operation_spec.rb +++ b/spec/collectionspace/mapper/find_replace_operation_spec.rb @@ -9,7 +9,7 @@ let(:creator){ described_class.create(opspec) } context 'given a plain operation' do - let(:opspec){ {find: ' ', replace:'-', type: 'plain'} } + let(:opspec){ {find: ' ', replace: '-', type: 'plain'} } it 'returns a FindReplaceOperation' do expect(creator).to be_a(CS::Mapper::FindReplaceOperation) end @@ -24,7 +24,7 @@ end describe '#perform' do - let(:opspec){ {find: ' ', replace:'-', type: 'plain'} } + let(:opspec){ {find: ' ', replace: '-', type: 'plain'} } let(:result){ operation.perform(value) } context 'given blank value' do let(:value){ '' } @@ -41,4 +41,3 @@ end end end - diff --git a/spec/collectionspace/mapper/find_replace_transformer_spec.rb b/spec/collectionspace/mapper/find_replace_transformer_spec.rb index f15f2fc4..0bef2818 100644 --- a/spec/collectionspace/mapper/find_replace_transformer_spec.rb +++ b/spec/collectionspace/mapper/find_replace_transformer_spec.rb @@ -3,10 +3,12 @@ require 'spec_helper' RSpec.describe CollectionSpace::Mapper::FindReplaceTransformer do - let(:transform) do [ - {find: ' ', replace:'-', type: 'plain'}, - {find: '(\d)-A', replace: '\1 A', type: 'regex'} - ] end + let(:transform) do + [ + {find: ' ', replace: '-', type: 'plain'}, + {find: '(\d)-A', replace: '\1 A', type: 'regex'} + ] + end let(:transformer){ described_class.new(transform: transform) } describe '#precedence' do @@ -33,4 +35,3 @@ end end end - diff --git a/spec/collectionspace/mapper/group_column_value_spec.rb b/spec/collectionspace/mapper/group_column_value_spec.rb index 503432d5..54888525 100644 --- a/spec/collectionspace/mapper/group_column_value_spec.rb +++ b/spec/collectionspace/mapper/group_column_value_spec.rb @@ -5,21 +5,24 @@ RSpec.describe CollectionSpace::Mapper::GroupColumnValue do let(:mapperpath){ 'spec/fixtures/files/mappers/release_6_1/core/core_6-1-0_collectionobject.json' } let(:config){ {delimiter: '|', subgroup_delimiter: '^^'} } - let(:recmapper) do CS::Mapper::RecordMapper.new(mapper: get_json_record_mapper(mapperpath), - batchconfig: config, - termcache: core_cache) end + let(:recmapper) do + CS::Mapper::RecordMapper.new(mapper: get_json_record_mapper(mapperpath), + batchconfig: config, + termcache: core_cache) + end let(:mapping){ recmapper.mappings.lookup(colname) } - let(:colval) do described_class.new(column: colname, - value: colvalue, - recmapper: recmapper, - mapping: mapping) end + let(:colval) do + described_class.new(column: colname, + value: colvalue, + recmapper: recmapper, + mapping: mapping) + end describe '#split' do let(:colname){ 'title' } let(:colvalue){ 'blah| blah' } it 'returns value as stripped element(s) in Array' do - expect(colval.split).to eq(['blah', 'blah']) + expect(colval.split).to eq(%w[blah blah]) end end end - diff --git a/spec/collectionspace/mapper/group_multival_column_value_spec.rb b/spec/collectionspace/mapper/group_multival_column_value_spec.rb index b13d21ea..93b41894 100644 --- a/spec/collectionspace/mapper/group_multival_column_value_spec.rb +++ b/spec/collectionspace/mapper/group_multival_column_value_spec.rb @@ -5,23 +5,26 @@ RSpec.describe CollectionSpace::Mapper::GroupMultivalColumnValue do let(:mapperpath){ 'spec/fixtures/files/mappers/release_6_1/bonsai/bonsai_4-1-1_conservation.json' } let(:config){ {delimiter: '|', subgroup_delimiter: '^^'} } - let(:recmapper) do CS::Mapper::RecordMapper.new(mapper: get_json_record_mapper(mapperpath), - batchconfig: config, - termcache: bonsai_cache) end + let(:recmapper) do + CS::Mapper::RecordMapper.new(mapper: get_json_record_mapper(mapperpath), + batchconfig: config, + termcache: bonsai_cache) + end let(:mapping){ recmapper.mappings.lookup(colname) } - let(:colval) do described_class.new(column: colname, - value: colvalue, - recmapper: recmapper, - mapping: mapping) end + let(:colval) do + described_class.new(column: colname, + value: colvalue, + recmapper: recmapper, + mapping: mapping) + end describe '#split' do let(:colname){ 'fertilizerToBeUsed' } let(:colvalue){ 'a|b^^c' } it 'returns value(s) as Hash where group occurrences are the keys' do expected = {1 => ['a'], - 2 => ['b', 'c']} + 2 => %w[b c]} expect(colval.split).to eq(expected) end end end - diff --git a/spec/collectionspace/mapper/identifiers/short_identifier_spec.rb b/spec/collectionspace/mapper/identifiers/short_identifier_spec.rb index b9a3aab0..97b2d980 100644 --- a/spec/collectionspace/mapper/identifiers/short_identifier_spec.rb +++ b/spec/collectionspace/mapper/identifiers/short_identifier_spec.rb @@ -16,4 +16,3 @@ end end end - diff --git a/spec/collectionspace/mapper/multival_column_value_spec.rb b/spec/collectionspace/mapper/multival_column_value_spec.rb index ec9e7f16..5eb6e631 100644 --- a/spec/collectionspace/mapper/multival_column_value_spec.rb +++ b/spec/collectionspace/mapper/multival_column_value_spec.rb @@ -5,21 +5,24 @@ RSpec.describe CollectionSpace::Mapper::MultivalColumnValue do let(:mapperpath){ 'spec/fixtures/files/mappers/release_6_1/core/core_6-1-0_collectionobject.json' } let(:config){ {delimiter: '|', subgroup_delimiter: '^^'} } - let(:recmapper) do CS::Mapper::RecordMapper.new(mapper: get_json_record_mapper(mapperpath), - batchconfig: config, - termcache: core_cache) end + let(:recmapper) do + CS::Mapper::RecordMapper.new(mapper: get_json_record_mapper(mapperpath), + batchconfig: config, + termcache: core_cache) + end let(:mapping){ recmapper.mappings.lookup(colname) } - let(:colval) do described_class.new(column: colname, - value: colvalue, - recmapper: recmapper, - mapping: mapping) end + let(:colval) do + described_class.new(column: colname, + value: colvalue, + recmapper: recmapper, + mapping: mapping) + end describe '#split' do let(:colname){ 'collection' } let(:colvalue){ 'blah| blah' } it 'returns value as stripped element(s) in Array' do - expect(colval.split).to eq(['blah', 'blah']) + expect(colval.split).to eq(%w[blah blah]) end end end - diff --git a/spec/collectionspace/mapper/record_mapper_config_spec.rb b/spec/collectionspace/mapper/record_mapper_config_spec.rb index ca4a2f28..7fc4ad63 100644 --- a/spec/collectionspace/mapper/record_mapper_config_spec.rb +++ b/spec/collectionspace/mapper/record_mapper_config_spec.rb @@ -3,15 +3,17 @@ require 'spec_helper' RSpec.describe CollectionSpace::Mapper::RecordMapperConfig do - let(:hash) do {'ns_uri' => { - 'collectionobjects_common' => 'http://collectionspace.org/services/collectionobject', - 'collectionobjects_anthro' => 'http://collectionspace.org/services/collectionobject/domain/anthro', - 'collectionobjects_annotation' => 'http://collectionspace.org/services/collectionobject/domain/annotation', - 'collectionobjects_culturalcare' => 'http://collectionspace.org/services/collectionobject/domain/collectionobject', - 'collectionobjects_nagpra' => 'http://collectionspace.org/services/collectionobject/domain/nagpra', - 'collectionobjects_naturalhistory_extension' => 'http://collectionspace.org/services/collectionobject/domain/naturalhistory_extension', - 'somethingelse_common' => 'http://collectionspace.org/services/collectionobject/domain/nagpra' - }} end + let(:hash) do + {'ns_uri' => { + 'collectionobjects_common' => 'http://collectionspace.org/services/collectionobject', + 'collectionobjects_anthro' => 'http://collectionspace.org/services/collectionobject/domain/anthro', + 'collectionobjects_annotation' => 'http://collectionspace.org/services/collectionobject/domain/annotation', + 'collectionobjects_culturalcare' => 'http://collectionspace.org/services/collectionobject/domain/collectionobject', + 'collectionobjects_nagpra' => 'http://collectionspace.org/services/collectionobject/domain/nagpra', + 'collectionobjects_naturalhistory_extension' => 'http://collectionspace.org/services/collectionobject/domain/naturalhistory_extension', + 'somethingelse_common' => 'http://collectionspace.org/services/collectionobject/domain/nagpra' + }} + end let(:config){ described_class.new(hash) } describe '#namespaces' do it 'returns Array of namespace names' do diff --git a/spec/collectionspace/mapper/regex_find_replace_operation_spec.rb b/spec/collectionspace/mapper/regex_find_replace_operation_spec.rb index faca1d79..ce395e76 100644 --- a/spec/collectionspace/mapper/regex_find_replace_operation_spec.rb +++ b/spec/collectionspace/mapper/regex_find_replace_operation_spec.rb @@ -6,7 +6,7 @@ let(:operation){ described_class.new(opspec) } describe '#perform' do - let(:opspec){ {find: '(az|oo) ', replace:'\1-', type: 'regexp'} } + let(:opspec){ {find: '(az|oo) ', replace: '\1-', type: 'regexp'} } let(:result){ operation.perform(value) } context 'given blank value' do let(:value){ '' } @@ -38,4 +38,3 @@ end end end - diff --git a/spec/collectionspace/mapper/row_data_spec.rb b/spec/collectionspace/mapper/row_data_spec.rb index 5c034a8d..8e931f0b 100644 --- a/spec/collectionspace/mapper/row_data_spec.rb +++ b/spec/collectionspace/mapper/row_data_spec.rb @@ -3,13 +3,15 @@ require 'spec_helper' RSpec.describe CollectionSpace::Mapper::RowData do - let(:recmapper){ core_object_mapper} - let(:data_hash) do { - 'objectNumber' => '123', - 'comment' => 'blah', - 'title' => 'The title', - 'titleTranslation' => 'La title' - } end + let(:recmapper){ core_object_mapper } + let(:data_hash) do + { + 'objectNumber' => '123', + 'comment' => 'blah', + 'title' => 'The title', + 'titleTranslation' => 'La title' + } + end let(:row){ CollectionSpace::Mapper::RowData.new(data_hash, recmapper) } @@ -19,7 +21,7 @@ expect(row.columns).to be_a(Array) end it 'of ColumnValues' do - expect(row.columns.any?{ |col| !col.kind_of?(CS::Mapper::ColumnValue)}).to be false + expect(row.columns.any?{ |col| !col.is_a?(CS::Mapper::ColumnValue) }).to be false end it '2 elements long' do expect(row.columns.length).to eq(4) diff --git a/spec/collectionspace/mapper/subgroup_column_value_spec.rb b/spec/collectionspace/mapper/subgroup_column_value_spec.rb index 1643c0b7..d0efb81e 100644 --- a/spec/collectionspace/mapper/subgroup_column_value_spec.rb +++ b/spec/collectionspace/mapper/subgroup_column_value_spec.rb @@ -5,23 +5,26 @@ RSpec.describe CollectionSpace::Mapper::SubgroupColumnValue do let(:mapperpath){ 'spec/fixtures/files/mappers/release_6_1/core/core_6-1-0_collectionobject.json' } let(:config){ {delimiter: '|', subgroup_delimiter: '^^'} } - let(:recmapper) do CS::Mapper::RecordMapper.new(mapper: get_json_record_mapper(mapperpath), - batchconfig: config, - termcache: core_cache) end + let(:recmapper) do + CS::Mapper::RecordMapper.new(mapper: get_json_record_mapper(mapperpath), + batchconfig: config, + termcache: core_cache) + end let(:mapping){ recmapper.mappings.lookup(colname) } - let(:colval) do described_class.new(column: colname, - value: colvalue, - recmapper: recmapper, - mapping: mapping) end + let(:colval) do + described_class.new(column: colname, + value: colvalue, + recmapper: recmapper, + mapping: mapping) + end describe '#split' do let(:colname){ 'titleTranslation' } let(:colvalue){ 'a|b^^c' } it 'returns value(s) as Hash where group occurrences are the keys' do expected = {1 => ['a'], - 2 => ['b', 'c']} + 2 => %w[b c]} expect(colval.split).to eq(expected) end end end - diff --git a/spec/collectionspace/mapper/term_handler_spec.rb b/spec/collectionspace/mapper/term_handler_spec.rb index cc11aec8..94ef01a1 100644 --- a/spec/collectionspace/mapper/term_handler_spec.rb +++ b/spec/collectionspace/mapper/term_handler_spec.rb @@ -6,17 +6,21 @@ let(:client){ core_client } let(:termcache){ core_cache } let(:mapperpath){ 'spec/fixtures/files/mappers/release_6_1/core/core_6-1-0_collectionobject.json' } - let(:recmapper) do CS::Mapper::RecordMapper.new(mapper: File.read(mapperpath), - csclient: client, - termcache: termcache) end + let(:recmapper) do + CS::Mapper::RecordMapper.new(mapper: File.read(mapperpath), + csclient: client, + termcache: termcache) + end let(:colmapping){ recmapper.mappings.lookup(colname) } - let(:th) do CS::Mapper::TermHandler.new(mapping: colmapping, - data: data, - client: client, - cache: termcache, - mapper: recmapper) end - # before(:all) do -# @config = @handler.mapper.batchconfig + let(:th) do + CS::Mapper::TermHandler.new(mapping: colmapping, + data: data, + client: client, + cache: termcache, + mapper: recmapper) + end + # before(:all) do + # @config = @handler.mapper.batchconfig # @ref_mapping = CollectionSpace::Mapper::ColumnMapping.new({ # :fieldname=>"reference", # :transforms=>{:authority=>["citationauthorities", "citation"]}, @@ -53,48 +57,48 @@ # end describe '#result' do - context 'titletranslationlanguage (vocabulary, field subgroup)' do - let(:colname){ 'titleTranslationLanguage' } - let(:data){ [['%NULLVALUE%', 'Swahili'], ['Klingon', 'Spanish'], [CS::Mapper::THE_BOMB]] } + context 'titletranslationlanguage (vocabulary, field subgroup)' do + let(:colname){ 'titleTranslationLanguage' } + let(:data){ [['%NULLVALUE%', 'Swahili'], %w[Klingon Spanish], [CS::Mapper::THE_BOMB]] } - it 'result is the transformed value for mapping' do - expected = [['', - "urn:cspace:core.collectionspace.org:vocabularies:name(languages):item:name(swa)'Swahili'"], - ["urn:cspace:core.collectionspace.org:vocabularies:name(languages):item:name(Klingon)'Klingon'", - "urn:cspace:core.collectionspace.org:vocabularies:name(languages):item:name(spa)'Spanish'"], - [CS::Mapper::THE_BOMB]] - expect(th.result).to eq(expected) - end - it 'all values are refnames, blanks, or the bomb' do - chk = th.result.flatten.select{ |v| v.start_with?('urn:') || v.empty? || v = CS::Mapper::THE_BOMB } - expect(chk.length).to eq(5) - end + it 'result is the transformed value for mapping' do + expected = [['', + "urn:cspace:core.collectionspace.org:vocabularies:name(languages):item:name(swa)'Swahili'"], + ["urn:cspace:core.collectionspace.org:vocabularies:name(languages):item:name(Klingon)'Klingon'", + "urn:cspace:core.collectionspace.org:vocabularies:name(languages):item:name(spa)'Spanish'"], + [CS::Mapper::THE_BOMB]] + expect(th.result).to eq(expected) end + it 'all values are refnames, blanks, or the bomb' do + chk = th.result.flatten.select{ |v| v.start_with?('urn:') || v.empty? || v = CS::Mapper::THE_BOMB } + expect(chk.length).to eq(5) + end + end - context 'reference (authority, field group)' do - let(:colname){ 'referenceLocal' } - let(:data){ ['Reference 1', 'Reference 2', '%NULLVALUE%'] } + context 'reference (authority, field group)' do + let(:colname){ 'referenceLocal' } + let(:data){ ['Reference 1', 'Reference 2', '%NULLVALUE%'] } - it 'result is the transformed value for mapping' do - expected = [ - "urn:cspace:core.collectionspace.org:citationauthorities:name(citation):item:name(Reference11143445083)'Reference 1'", - "urn:cspace:core.collectionspace.org:citationauthorities:name(citation):item:name(Reference22573957271)'Reference 2'", - '' - ] - expect(th.result).to eq(expected) - end - it 'all values are refnames' do - chk = th.result.flatten.select{ |v| v.start_with?('urn:') } - expect(chk.length).to eq(2) - end + it 'result is the transformed value for mapping' do + expected = [ + "urn:cspace:core.collectionspace.org:citationauthorities:name(citation):item:name(Reference11143445083)'Reference 1'", + "urn:cspace:core.collectionspace.org:citationauthorities:name(citation):item:name(Reference22573957271)'Reference 2'", + '' + ] + expect(th.result).to eq(expected) + end + it 'all values are refnames' do + chk = th.result.flatten.select{ |v| v.start_with?('urn:') } + expect(chk.length).to eq(2) end end + end describe '#terms' do let(:terms){ th.terms } context 'titletranslationlanguage (vocabulary, field subgroup)' do let(:colname){ 'titleTranslationLanguage' } - let(:data){ [['%NULLVALUE%', 'Swahili'], ['Sanza', 'Spanish'], [CS::Mapper::THE_BOMB]] } + let(:data){ [['%NULLVALUE%', 'Swahili'], %w[Sanza Spanish], [CS::Mapper::THE_BOMB]] } context 'when new term (Sanza) is initially encountered' do it 'returns terms as expected' do diff --git a/spec/collectionspace/mapper/term_searchable_spec.rb b/spec/collectionspace/mapper/term_searchable_spec.rb index d78a2239..3401708b 100644 --- a/spec/collectionspace/mapper/term_searchable_spec.rb +++ b/spec/collectionspace/mapper/term_searchable_spec.rb @@ -5,6 +5,7 @@ class TermClass attr_reader :cache, :client attr_accessor :type, :subtype, :errors + include CS::Mapper::TermSearchable def initialize(cache, client, type, subtype) @@ -14,7 +15,6 @@ def initialize(cache, client, type, subtype) @subtype = subtype @errors = [] end - end RSpec.describe CollectionSpace::Mapper::TermSearchable do @@ -138,7 +138,7 @@ def initialize(cache, client, type, subtype) context 'when in cache' do let(:val){ 'Sample Concept 1' } it 'returns csid' do - # it 'returns csid', :skip => 'does not cause mapping to fail, so we live with technical incorrectness for now' do + # it 'returns csid', :skip => 'does not cause mapping to fail, so we live with technical incorrectness for now' do expect(result).to eq('1111-2222-3333-4444') end end diff --git a/spec/collectionspace/mapper/tools/record_status_service_spec.rb b/spec/collectionspace/mapper/tools/record_status_service_spec.rb index d526e9b6..dfc1eeb8 100644 --- a/spec/collectionspace/mapper/tools/record_status_service_spec.rb +++ b/spec/collectionspace/mapper/tools/record_status_service_spec.rb @@ -7,21 +7,26 @@ let(:service){ CollectionSpace::Mapper::Tools::RecordStatusService.new(client, mapper) } context 'when mapper service_path not handled by collectionspace-client' do - let(:mapper) do CS::Mapper::RecordMapper.new(mapper: get_json_record_mapper( - 'spec/fixtures/files/mappers/core_6-1-0_aardvark.json' - ), termcache: core_cache) end + let(:mapper) do + CS::Mapper::RecordMapper.new(mapper: get_json_record_mapper( + 'spec/fixtures/files/mappers/core_6-1-0_aardvark.json' + ), termcache: core_cache) + end it 'raises NoClientServiceError' do expect do - CS::Mapper::Tools::RecordStatusService.new(client, mapper) end.to raise_error(CS::Mapper::NoClientServiceError) + CS::Mapper::Tools::RecordStatusService.new(client, mapper) + end.to raise_error(CS::Mapper::NoClientServiceError) end end describe '#lookup' do context 'when mapper is for an authority' do - let(:mapper) do CollectionSpace::Mapper::RecordMapper.new(mapper: get_json_record_mapper( - 'spec/fixtures/files/mappers/release_6_1/core/core_6-1-0_person-local.json' - ), termcache: core_cache) end + let(:mapper) do + CollectionSpace::Mapper::RecordMapper.new(mapper: get_json_record_mapper( + 'spec/fixtures/files/mappers/release_6_1/core/core_6-1-0_person-local.json' + ), termcache: core_cache) + end context 'and one result is found' do let(:report){ service.lookup('John Doe') } @@ -55,7 +60,8 @@ context 'with default config' do it 'raises error because we cannot know what to do with imported record' do expect do - service.lookup('Inkpot Guineafowl') end.to raise_error(CollectionSpace::Mapper::MultipleCsRecordsFoundError) + service.lookup('Inkpot Guineafowl') + end.to raise_error(CollectionSpace::Mapper::MultipleCsRecordsFoundError) end end @@ -79,9 +85,11 @@ end context 'when mapper is for an object' do - let(:mapper) do CollectionSpace::Mapper::RecordMapper.new(mapper: get_json_record_mapper( - 'spec/fixtures/files/mappers/release_6_1/core/core_6-1-0_collectionobject.json' - ), termcache: core_cache) end + let(:mapper) do + CollectionSpace::Mapper::RecordMapper.new(mapper: get_json_record_mapper( + 'spec/fixtures/files/mappers/release_6_1/core/core_6-1-0_collectionobject.json' + ), termcache: core_cache) + end it 'works the same' do res = service.lookup('2000.1') @@ -90,9 +98,11 @@ end context 'when mapper is for a procedure' do - let(:mapper) do CollectionSpace::Mapper::RecordMapper.new(mapper: get_json_record_mapper( - 'spec/fixtures/files/mappers/release_6_1/core/core_6-1-0_acquisition.json' - ), termcache: core_cache) end + let(:mapper) do + CollectionSpace::Mapper::RecordMapper.new(mapper: get_json_record_mapper( + 'spec/fixtures/files/mappers/release_6_1/core/core_6-1-0_acquisition.json' + ), termcache: core_cache) + end it 'works the same' do res = service.lookup('2000.001') @@ -101,9 +111,11 @@ end context 'when mapper is for a relationship' do - let(:mapper) do CollectionSpace::Mapper::RecordMapper.new(mapper: get_json_record_mapper( - 'spec/fixtures/files/mappers/release_6_1/core/core_6-1-0_objecthierarchy.json' - )) end + let(:mapper) do + CollectionSpace::Mapper::RecordMapper.new(mapper: get_json_record_mapper( + 'spec/fixtures/files/mappers/release_6_1/core/core_6-1-0_objecthierarchy.json' + )) + end it 'works the same' do res = service.lookup({sub: '56c04f5f-32b9-4f1d-8a4b', obj: '6f0ce7b3-0130-444d-8633'}) diff --git a/spec/collectionspace/mapper/tools/refname_spec.rb b/spec/collectionspace/mapper/tools/refname_spec.rb index da906255..5e4ce16e 100644 --- a/spec/collectionspace/mapper/tools/refname_spec.rb +++ b/spec/collectionspace/mapper/tools/refname_spec.rb @@ -80,7 +80,8 @@ urn: 'urn:cspace:core.collectionspace.org:weird' } expect do - CollectionSpace::Mapper::Tools::RefName.new(args) end.to raise_error(CollectionSpace::Mapper::Tools::UnparseableUrnError) + CollectionSpace::Mapper::Tools::RefName.new(args) + end.to raise_error(CollectionSpace::Mapper::Tools::UnparseableUrnError) end end end @@ -92,8 +93,8 @@ cache: @cache } expect do - CollectionSpace::Mapper::Tools::RefName.new(args) end.to raise_error(CollectionSpace::Mapper::Tools::RefNameArgumentError) + CollectionSpace::Mapper::Tools::RefName.new(args) + end.to raise_error(CollectionSpace::Mapper::Tools::RefNameArgumentError) end end end - diff --git a/spec/collectionspace/mapper/tools/symbolizable_spec.rb b/spec/collectionspace/mapper/tools/symbolizable_spec.rb index e29ee50c..47b5154d 100644 --- a/spec/collectionspace/mapper/tools/symbolizable_spec.rb +++ b/spec/collectionspace/mapper/tools/symbolizable_spec.rb @@ -3,13 +3,13 @@ require 'spec_helper' RSpec.describe CS::Mapper::Tools::Symbolizable do - let(:config) do JSON.parse('{ + let(:config) do + JSON.parse('{ "delimiter": ";", "subgroup_delimiter": "^^", "response_mode": "verbose", "force_defaults": false, "check_record_status": true, - "check_terms": true, "date_format": "month day year", "two_digit_year_handling": "convert to four digit", "transforms": { @@ -35,20 +35,19 @@ describe '#symbolize' do it 'turns hash keys into symbols' do expected = %i[delimiter subgroup_delimiter response_mode force_defaults check_record_status - check_terms date_format two_digit_year_handling transforms default_values] + date_format two_digit_year_handling transforms default_values] expect(symconfig.keys).to eq(expected) end end describe '#symbolize_transforms' do let(:transforms){ symconfig[:transforms] } - let(:expected) do {'collection' => {special: ['downcase_value'], - replacements: [{find: ' ', replace: '-', type: 'plain'}] - }} + let(:expected) do + {'collection' => {special: ['downcase_value'], + replacements: [{find: ' ', replace: '-', type: 'plain'}]}} end it 'transforms as expected' do expect(CS::Mapper::Tools::Symbolizable.symbolize_transforms(transforms)).to eq(expected) end end end - diff --git a/spec/collectionspace/mapper/transformer_spec.rb b/spec/collectionspace/mapper/transformer_spec.rb index 57f6bd26..37fc25a8 100644 --- a/spec/collectionspace/mapper/transformer_spec.rb +++ b/spec/collectionspace/mapper/transformer_spec.rb @@ -5,19 +5,23 @@ RSpec.describe CollectionSpace::Mapper::Transformer do let(:client){ anthro_client } let(:cache){ anthro_cache } - let(:mapperpath){ 'spec/fixtures/files/mappers/release_6_1/anthro/anthro_4-1-2_collectionobject_transforms.json'} - let(:recmapper) do CS::Mapper::RecordMapper.new(mapper: File.read(mapperpath), - csclient: client, - termcache: cache) end + let(:mapperpath){ 'spec/fixtures/files/mappers/release_6_1/anthro/anthro_4-1-2_collectionobject_transforms.json' } + let(:recmapper) do + CS::Mapper::RecordMapper.new(mapper: File.read(mapperpath), + csclient: client, + termcache: cache) + end describe '.create' do - let(:creator) do described_class.create(recmapper: recmapper, - type: type, - transform: transform) end + let(:creator) do + described_class.create(recmapper: recmapper, + type: type, + transform: transform) + end context 'given an authority transform' do let(:type){ :authority } - let(:transform){ ['personauthorities', 'person'] } + let(:transform){ %w[personauthorities person] } it 'returns an AuthorityTransformer' do expect(creator).to be_a(CS::Mapper::AuthorityTransformer) @@ -34,7 +38,7 @@ context 'given special transforms' do let(:type){ :special } - let(:transform){ ['downcase_value', 'boolean', 'behrensmeyer_translate'] } + let(:transform){ %w[downcase_value boolean behrensmeyer_translate] } it 'returns array of expected transformers' do expected = [CS::Mapper::DowncaseTransformer, CS::Mapper::BooleanTransformer, CS::Mapper::BehrensmeyerTransformer] diff --git a/spec/collectionspace/mapper/transformers_spec.rb b/spec/collectionspace/mapper/transformers_spec.rb index 6d9804af..c89ecc43 100644 --- a/spec/collectionspace/mapper/transformers_spec.rb +++ b/spec/collectionspace/mapper/transformers_spec.rb @@ -5,14 +5,18 @@ RSpec.describe CollectionSpace::Mapper::Transformers do let(:client){ anthro_client } let(:cache){ anthro_cache } - let(:mapperpath){ 'spec/fixtures/files/mappers/release_6_1/anthro/anthro_4-1-2_collectionobject_transforms.json'} - let(:recmapper) do CS::Mapper::RecordMapper.new(mapper: File.read(mapperpath), - csclient: client, - termcache: cache) end + let(:mapperpath){ 'spec/fixtures/files/mappers/release_6_1/anthro/anthro_4-1-2_collectionobject_transforms.json' } + let(:recmapper) do + CS::Mapper::RecordMapper.new(mapper: File.read(mapperpath), + csclient: client, + termcache: cache) + end let(:mapping){ recmapper.mappings.lookup(colname) } - let(:xforms) do described_class.new(colmapping: mapping, - transforms: mapping.transforms, - recmapper: recmapper) end + let(:xforms) do + described_class.new(colmapping: mapping, + transforms: mapping.transforms, + recmapper: recmapper) + end describe '#queue' do context 'when measuredByPerson column' do diff --git a/spec/collectionspace/mapper/value_transformer_spec.rb b/spec/collectionspace/mapper/value_transformer_spec.rb index 9c85d7a5..ae00bd6f 100644 --- a/spec/collectionspace/mapper/value_transformer_spec.rb +++ b/spec/collectionspace/mapper/value_transformer_spec.rb @@ -4,15 +4,15 @@ RSpec.describe CollectionSpace::Mapper::ValueTransformer do before(:all) do - client = anthro_client - cache = anthro_cache - mapper = get_json_record_mapper('spec/fixtures/files/mappers/release_6_1/anthro/anthro_4-1-2_collectionobject.json') - handler = CollectionSpace::Mapper::DataHandler.new(record_mapper: mapper, - client: client, - cache: cache, - config: {}) - @prepper = CollectionSpace::Mapper::DataPrepper.new({}, handler) - end + client = anthro_client + cache = anthro_cache + mapper = get_json_record_mapper('spec/fixtures/files/mappers/release_6_1/anthro/anthro_4-1-2_collectionobject.json') + handler = CollectionSpace::Mapper::DataHandler.new(record_mapper: mapper, + client: client, + cache: cache, + config: {}) + @prepper = CollectionSpace::Mapper::DataPrepper.new({}, handler) + end context 'when vocabulary' do context 'and vocabulary is behrensmeyer number' do @@ -32,8 +32,7 @@ transforms = {vocabulary: 'agerange', special: %w[downcase_value], replacements: [ {find: ' - ', replace: '-', type: :plain} - ] - } + ]} res = CollectionSpace::Mapper::ValueTransformer.new(value, transforms, @prepper).result ex = 'adolescent 26-75%' expect(res).to eq(ex) @@ -57,6 +56,3 @@ end end end - - - diff --git a/spec/collectionspace/mapper_spec.rb b/spec/collectionspace/mapper_spec.rb index 99fadf5e..e2d5ab31 100644 --- a/spec/collectionspace/mapper_spec.rb +++ b/spec/collectionspace/mapper_spec.rb @@ -11,13 +11,13 @@ context 'when passed a CollectionSpace::Mapper::Response' do it 'returns that Response' do response = CollectionSpace::Mapper::Response.new({'objectNumber' => '123'}) - expect(CollectionSpace::Mapper::setup_data(response)).to eq(response) + expect(CollectionSpace::Mapper.setup_data(response)).to eq(response) end end context 'when passed a Hash' do before(:all) do @data = {'objectNumber' => '123'} - @response = CollectionSpace::Mapper::setup_data(@data) + @response = CollectionSpace::Mapper.setup_data(@data) end it 'returns a CollectionSpace::Mapper::Response with expected orig_data' do expect(@response).to be_a(CollectionSpace::Mapper::Response) @@ -26,10 +26,11 @@ end context 'when passed other class of object' do it 'returns a CollectionSpace::Mapper::Response' do - data = ['objectNumber', '123'] + data = %w[objectNumber 123] expect do - CollectionSpace::Mapper::setup_data(data) end.to raise_error(CollectionSpace::Mapper::Errors::UnprocessableDataError, - 'Cannot process a Array. Need a Hash or Mapper::Response') + CollectionSpace::Mapper.setup_data(data) + end.to raise_error(CollectionSpace::Mapper::Errors::UnprocessableDataError, + 'Cannot process a Array. Need a Hash or Mapper::Response') end end end diff --git a/spec/core_helpers.rb b/spec/core_helpers.rb index 6df0e4a2..f9379a39 100644 --- a/spec/core_helpers.rb +++ b/spec/core_helpers.rb @@ -133,7 +133,7 @@ def populate_core(cache) {refname: "urn:cspace:core.collectionspace.org:orgauthorities:name(ulan_oa):item:name(Signal1599559737158)'Signal'", csid: '1111-2222-3333-4444'}], ['orgauthorities', 'ulan_oa', 'Very fats', {refname: "urn:cspace:core.collectionspace.org:orgauthorities:name(ulan_oa):item:name(Veryfats1599645188567)'Very fats'", csid: '1111-2222-3333-4444'}], - ['personauthorities', 'person', 'Broooks', + ['personauthorities', 'person', 'Broooks', {refname: "urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(Broooks1599221558583)'Broooks'", csid: '1111-2222-3333-4444'}], ['personauthorities', 'person', '2020', {refname: "urn:cspace:core.collectionspace.org:personauthorities:name(person):item:name(20201599147149106)'2020'", csid: '1111-2222-3333-4444'}], @@ -404,7 +404,7 @@ def populate_core(cache) ['vocabularies', 'uocusertypes', 'lecturer', {refname: "urn:cspace:core.collectionspace.org:vocabularies:name(uocusertypes):item:name(lecturer)'lecturer'", csid: '1111-2222-3333-4444'}], ['workauthorities', 'work', 'Makeup', - {refname: "urn:cspace:core.collectionspace.org:workauthorities:name(work):item:name(Makeup1608768998350)'Makeup'", csid: '1111-2222-3333-4444'}], + {refname: "urn:cspace:core.collectionspace.org:workauthorities:name(work):item:name(Makeup1608768998350)'Makeup'", csid: '1111-2222-3333-4444'}] ] populate(cache, terms) end diff --git a/spec/fcart_helpers.rb b/spec/fcart_helpers.rb index 549d4152..90ec898d 100644 --- a/spec/fcart_helpers.rb +++ b/spec/fcart_helpers.rb @@ -22,8 +22,8 @@ def fcart_cache def populate_fcart(cache) terms = [ ['personauthorities', 'person', 'Elizabeth', - {refname: "urn:cspace:fcart.collectionspace.org:personauthorities:name(person):item:name(Elizabeth123)'Elizabeth'", csid: '1111-2222-3333-4444'}] ] + {refname: "urn:cspace:fcart.collectionspace.org:personauthorities:name(person):item:name(Elizabeth123)'Elizabeth'", csid: '1111-2222-3333-4444'}] + ] populate(cache, terms) end - end diff --git a/spec/helpers.rb b/spec/helpers.rb index 01764788..968ae08e 100644 --- a/spec/helpers.rb +++ b/spec/helpers.rb @@ -66,9 +66,7 @@ def get_xml_fixture(filename, remove_blanks = true) rejectfields = %w[computedCurrentLocation].sort doc.traverse do |node| # Drop empty nodes - if remove_blanks - node.remove unless node.text.match?(/\S/m) - end + node.remove if remove_blanks && !node.text.match?(/\S/m) # Drop sections of the document we don't write with the mapper node.remove if node.name == 'collectionspace_core' || node.name == 'account_permission' # Drop fields created by CS application @@ -107,22 +105,20 @@ def mapper_defined_paths(xpaths, mappings) end def remove_xpath_occurrence_indicators(path) - path.match(/^(.*)\//)[1].gsub(/\[\d+\]/, '') + path.match(%r{^(.*)/})[1].gsub(/\[\d+\]/, '') end def list_xpaths(doc) xpaths = get_xpaths(doc) - xpaths = field_value_xpaths(xpaths) - xpaths + field_value_xpaths(xpaths) end def standardize_value(string) if string.start_with?('urn:cspace') - val = string.sub(/(item:name\([a-zA-Z]+)\d+(\)')/, '\1\2') + string.sub(/(item:name\([a-zA-Z]+)\d+(\)')/, '\1\2') else - val = string + string end - val end def populate(cache, terms) @@ -131,5 +127,4 @@ def populate(cache, terms) end cache end - end diff --git a/spec/lhmc_helpers.rb b/spec/lhmc_helpers.rb index 0855f2e4..4163ffaf 100644 --- a/spec/lhmc_helpers.rb +++ b/spec/lhmc_helpers.rb @@ -24,7 +24,7 @@ def populate_lhmc(cache) ['personauthorities', 'person', 'Ann Analyst', {refname: "urn:cspace:lhmc.collectionspace.org:personauthorities:name(person):item:name(AnnAnalyst1594848799340)'Ann Analyst'", csid: '1111-2222-3333-4444'}], ['vocabularies', 'agerange', 'adolescent 26-75%', - {refname: "urn:cspace:lhmc.collectionspace.org:vocabularies:name(agerange):item:name(adolescent_26_75)'adolescent 26-75%'", csid: '1111-2222-3333-4444'}], + {refname: "urn:cspace:lhmc.collectionspace.org:vocabularies:name(agerange):item:name(adolescent_26_75)'adolescent 26-75%'", csid: '1111-2222-3333-4444'}] ] populate(cache, terms) end diff --git a/utils/benchmarking/profile.rb b/utils/benchmarking/profile.rb index c6864da2..26d12602 100644 --- a/utils/benchmarking/profile.rb +++ b/utils/benchmarking/profile.rb @@ -23,9 +23,7 @@ def mapping_workflow v_result = handler.validate(datahash) - if v_result.valid? - result = handler.process(datahash) - end + result = handler.process(datahash) if v_result.valid? result end diff --git a/utils/csv-to-datahashes.rb b/utils/csv-to-datahashes.rb index fe05ffbc..2648ea9f 100644 --- a/utils/csv-to-datahashes.rb +++ b/utils/csv-to-datahashes.rb @@ -38,8 +38,8 @@ datahashes = [] -filename_stub = options[:input].sub(/^.*\//, '').sub('.csv', '') -dir = options[:input]['/'] ? options[:input].sub(/\/[^\/]+$/, '/') : '' +filename_stub = options[:input].sub(%r{^.*/}, '').sub('.csv', '') +dir = options[:input]['/'] ? options[:input].sub(%r{/[^/]+$}, '/') : '' CSV.foreach(options[:input], headers: true) do |row| datahashes << row.to_h diff --git a/utils/datahash_to_csv.rb b/utils/datahash_to_csv.rb index 347d3bdc..04e780cd 100644 --- a/utils/datahash_to_csv.rb +++ b/utils/datahash_to_csv.rb @@ -36,8 +36,8 @@ end end.parse! -dir = options[:input]['/'] ? options[:input].sub(/\/[^\/]+$/, '/') : '' -filename_stub = options[:input].sub(/^.*\//, '').sub('.json', '') +dir = options[:input]['/'] ? options[:input].sub(%r{/[^/]+$}, '/') : '' +filename_stub = options[:input].sub(%r{^.*/}, '').sub('.json', '') csv_file = "#{dir}#{filename_stub}.csv" data = JSON.parse(File.read(options[:input])) From 232becca6283988cada4071f5443be7d13eda66c Mon Sep 17 00:00:00 2001 From: Kristina Spurgin Date: Thu, 20 Jan 2022 19:01:33 -0500 Subject: [PATCH 20/20] bump version --- lib/collectionspace/mapper/version.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/collectionspace/mapper/version.rb b/lib/collectionspace/mapper/version.rb index 8bcbd0b2..95e22855 100644 --- a/lib/collectionspace/mapper/version.rb +++ b/lib/collectionspace/mapper/version.rb @@ -2,6 +2,6 @@ module CollectionSpace module Mapper - VERSION = '2.5.2' + VERSION = '3.0.0' end end