From 9f9ef112028c3acf9e519745d92c96ccc8c4add5 Mon Sep 17 00:00:00 2001 From: Matthew Connolly Date: Wed, 27 Mar 2024 17:24:56 -0400 Subject: [PATCH] Add lookups for LOC hubs, works, and instances (#400) --- lib/qa/authorities/loc.rb | 2 +- lib/qa/authorities/loc_subauthority.rb | 15 +++++++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/lib/qa/authorities/loc.rb b/lib/qa/authorities/loc.rb index 510edd5..f9a8cc1 100644 --- a/lib/qa/authorities/loc.rb +++ b/lib/qa/authorities/loc.rb @@ -14,7 +14,7 @@ def self.subauthority_for(subauthority) extend LocSubauthority def self.subauthorities - authorities + vocabularies + datatypes + preservation + rdftypes + authorities + vocabularies + datatypes + preservation + rdftypes + resources end end end diff --git a/lib/qa/authorities/loc_subauthority.rb b/lib/qa/authorities/loc_subauthority.rb index 9d6a955..0e0cb7f 100644 --- a/lib/qa/authorities/loc_subauthority.rb +++ b/lib/qa/authorities/loc_subauthority.rb @@ -7,6 +7,9 @@ def get_url_for_authority(authority) elsif datatypes.include?(authority) then datatype_base_url elsif preservation.include?(authority) then vocab_preservation_base_url elsif geography.include?(authority) then vocab_geographic_areas_base_url + elsif resources.include?(authority) then resources_base_url + else + raise Qa::InvalidSubAuthority, "Subauthority '#{authority}' not supported by LOC" end end @@ -147,6 +150,14 @@ def rdftypes ] end + def resources + [ + 'hubs', + 'instances', + 'works' + ] + end + private def vocab_base_url @@ -161,6 +172,10 @@ def datatype_base_url "cs%3Ahttp%3A%2F%2Fid.loc.gov%2Fdatatypes%2F" end + def resources_base_url + "cs%3Ahttp%3A%2F%2Fid.loc.gov%2Fresources%2F" + end + def vocab_preservation_base_url "cs%3Ahttp%3A%2F%2Fid.loc.gov%2Fvocabulary%2Fpreservation%2F" end