Skip to content

Commit

Permalink
Merge pull request #94 from LD4P/loc-updates
Browse files Browse the repository at this point in the history
Add direct lookups for LC subject subauthorities (#369)
  • Loading branch information
Baroquem authored Mar 29, 2024
2 parents 3116a69 + a709abd commit ced712f
Show file tree
Hide file tree
Showing 2 changed files with 17 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 + resources
authorities + vocabularies + datatypes + preservation + rdftypes + resources + subject_collections + geography
end
end
end
16 changes: 16 additions & 0 deletions lib/qa/authorities/loc_subauthority.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ def get_url_for_authority(authority)
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
elsif subject_collections.include?(authority) then subject_collection_base_url
else
raise Qa::InvalidSubAuthority, "Subauthority '#{authority}' not supported by LOC"
end
Expand Down Expand Up @@ -158,6 +159,17 @@ def resources
]
end

def subject_collections
[
'collection_LCSHAuthorizedHeadings',
'collection_LCSHSubdivisions',
'collection_LCSHTopicSubdivisions',
'collection_LCSHGeographicSubdivisions',
'collection_LCSHGenreFormSubdivisions',
'collection_LCSHTemporalSubdivisions'
]
end

private

def vocab_base_url
Expand All @@ -176,6 +188,10 @@ def resources_base_url
"cs%3Ahttp%3A%2F%2Fid.loc.gov%2Fresources%2F"
end

def subject_collection_base_url
"memberOf%3Ahttp%3A%2F%2Fid.loc.gov%2Fauthorities%2Fsubjects%2F"
end

def vocab_preservation_base_url
"cs%3Ahttp%3A%2F%2Fid.loc.gov%2Fvocabulary%2Fpreservation%2F"
end
Expand Down

0 comments on commit ced712f

Please sign in to comment.