Skip to content

Commit

Permalink
Merge pull request #93 from LD4P/loc-updates
Browse files Browse the repository at this point in the history
Add lookups for LOC hubs, works, and instances (#400)
  • Loading branch information
Baroquem authored Mar 28, 2024
2 parents 6a9e0bf + 9f9ef11 commit 3116a69
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/qa/authorities/loc.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
15 changes: 15 additions & 0 deletions lib/qa/authorities/loc_subauthority.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -147,6 +150,14 @@ def rdftypes
]
end

def resources
[
'hubs',
'instances',
'works'
]
end

private

def vocab_base_url
Expand All @@ -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
Expand Down

0 comments on commit 3116a69

Please sign in to comment.