Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge LOC changes to main #97

Merged
merged 15 commits into from
Apr 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,7 @@ gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]

## Gems manually added to for qa and qa_server engines
# Required gems for QA and linked data access
# NOTE: We need to update the published RubyGems version of qa_server with the 8.0 release. Until
# then, the next entry is set to use the GitHub repo and tag instead.
gem 'qa_server', git: 'https://github.com/LD4P/qa_server.git', tag: 'v8.0.1'
gem 'qa_server', '~> 8.0'
gem 'qa', '~> 5.10'
gem 'linkeddata'
gem 'psych', '~> 5.1'
Expand Down
160 changes: 78 additions & 82 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,14 +1,3 @@
GIT
remote: https://github.com/LD4P/qa_server.git
revision: e3ca6e238ec2630a5bfdd92ddc2ff2b906f964c4
tag: v8.0.1
specs:
qa_server (8.0.1)
gruff
rails (~> 7.0)
sass-rails (~> 5.0)
useragent

GIT
remote: https://github.com/brentd/xray-rails.git
revision: f121814718c9907b20058dc9357b80a53afab821
Expand All @@ -20,69 +9,69 @@ GIT
GEM
remote: https://rubygems.org/
specs:
actioncable (7.0.8)
actionpack (= 7.0.8)
activesupport (= 7.0.8)
actioncable (7.0.8.1)
actionpack (= 7.0.8.1)
activesupport (= 7.0.8.1)
nio4r (~> 2.0)
websocket-driver (>= 0.6.1)
actionmailbox (7.0.8)
actionpack (= 7.0.8)
activejob (= 7.0.8)
activerecord (= 7.0.8)
activestorage (= 7.0.8)
activesupport (= 7.0.8)
actionmailbox (7.0.8.1)
actionpack (= 7.0.8.1)
activejob (= 7.0.8.1)
activerecord (= 7.0.8.1)
activestorage (= 7.0.8.1)
activesupport (= 7.0.8.1)
mail (>= 2.7.1)
net-imap
net-pop
net-smtp
actionmailer (7.0.8)
actionpack (= 7.0.8)
actionview (= 7.0.8)
activejob (= 7.0.8)
activesupport (= 7.0.8)
actionmailer (7.0.8.1)
actionpack (= 7.0.8.1)
actionview (= 7.0.8.1)
activejob (= 7.0.8.1)
activesupport (= 7.0.8.1)
mail (~> 2.5, >= 2.5.4)
net-imap
net-pop
net-smtp
rails-dom-testing (~> 2.0)
actionpack (7.0.8)
actionview (= 7.0.8)
activesupport (= 7.0.8)
actionpack (7.0.8.1)
actionview (= 7.0.8.1)
activesupport (= 7.0.8.1)
rack (~> 2.0, >= 2.2.4)
rack-test (>= 0.6.3)
rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.0, >= 1.2.0)
actiontext (7.0.8)
actionpack (= 7.0.8)
activerecord (= 7.0.8)
activestorage (= 7.0.8)
activesupport (= 7.0.8)
actiontext (7.0.8.1)
actionpack (= 7.0.8.1)
activerecord (= 7.0.8.1)
activestorage (= 7.0.8.1)
activesupport (= 7.0.8.1)
globalid (>= 0.6.0)
nokogiri (>= 1.8.5)
actionview (7.0.8)
activesupport (= 7.0.8)
actionview (7.0.8.1)
activesupport (= 7.0.8.1)
builder (~> 3.1)
erubi (~> 1.4)
rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.1, >= 1.2.0)
activejob (7.0.8)
activesupport (= 7.0.8)
activejob (7.0.8.1)
activesupport (= 7.0.8.1)
globalid (>= 0.3.6)
activemodel (7.0.8)
activesupport (= 7.0.8)
activerecord (7.0.8)
activemodel (= 7.0.8)
activesupport (= 7.0.8)
activemodel (7.0.8.1)
activesupport (= 7.0.8.1)
activerecord (7.0.8.1)
activemodel (= 7.0.8.1)
activesupport (= 7.0.8.1)
activerecord-import (1.5.0)
activerecord (>= 4.2)
activestorage (7.0.8)
actionpack (= 7.0.8)
activejob (= 7.0.8)
activerecord (= 7.0.8)
activesupport (= 7.0.8)
activestorage (7.0.8.1)
actionpack (= 7.0.8.1)
activejob (= 7.0.8.1)
activerecord (= 7.0.8.1)
activesupport (= 7.0.8.1)
marcel (~> 1.0)
mini_mime (>= 1.1.0)
activesupport (7.0.8)
activesupport (7.0.8.1)
concurrent-ruby (~> 1.0, >= 1.0.2)
i18n (>= 1.6, < 2)
minitest (>= 5.1)
Expand Down Expand Up @@ -133,7 +122,7 @@ GEM
coffee-script-source
execjs
coffee-script-source (1.12.2)
concurrent-ruby (1.2.2)
concurrent-ruby (1.2.3)
connection_pool (2.4.1)
coveralls (0.8.23)
json (>= 1.8, < 3)
Expand Down Expand Up @@ -178,7 +167,7 @@ GEM
geocoder (1.8.2)
globalid (1.2.1)
activesupport (>= 6.1)
gruff (0.23.0)
gruff (0.24.0)
histogram
rmagick (>= 5.3)
haml (6.2.3)
Expand All @@ -190,14 +179,14 @@ GEM
hashdiff (1.0.1)
histogram (0.2.4.1)
htmlentities (4.3.4)
i18n (1.14.1)
i18n (1.14.4)
concurrent-ruby (~> 1.0)
io-like (0.3.1)
jbuilder (2.11.5)
actionview (>= 5.0.0)
activesupport (>= 5.0.0)
json (2.6.3)
json-canonicalization (0.3.2)
json-canonicalization (0.4.0)
json-ld (3.3.0)
htmlentities (~> 4.3)
json-canonicalization (~> 0.3, >= 0.3.2)
Expand Down Expand Up @@ -259,44 +248,45 @@ GEM
activesupport (>= 4)
railties (>= 4)
request_store (~> 1.0)
loofah (2.21.4)
loofah (2.22.0)
crass (~> 1.0.2)
nokogiri (>= 1.12.0)
mail (2.8.1)
mini_mime (>= 0.1.1)
net-imap
net-pop
net-smtp
marcel (1.0.2)
marcel (1.0.4)
matrix (0.4.2)
method_source (1.0.0)
mini_mime (1.1.5)
minitest (5.20.0)
minitest (5.22.3)
msgpack (1.7.2)
multi_json (1.15.0)
mysql2 (0.5.5)
net-http-persistent (4.0.2)
connection_pool (~> 2.2)
net-imap (0.4.4)
net-imap (0.4.10)
date
net-protocol
net-pop (0.1.2)
net-protocol
net-protocol (0.2.2)
timeout
net-smtp (0.4.0)
net-smtp (0.4.0.1)
net-protocol
nio4r (2.5.9)
nokogiri (1.15.4-arm64-darwin)
nio4r (2.7.0)
nokogiri (1.16.3-arm64-darwin)
racc (~> 1.4)
nokogiri (1.15.4-x86_64-darwin)
nokogiri (1.16.3-x86_64-darwin)
racc (~> 1.4)
observer (0.1.2)
parallel (1.23.0)
parser (3.2.2.4)
ast (~> 2.4.1)
racc
parslet (2.0.0)
pkg-config (1.5.5)
pkg-config (1.5.6)
psych (5.1.0)
stringio
public_suffix (5.0.3)
Expand All @@ -311,24 +301,29 @@ GEM
nokogiri (~> 1.6)
rails (>= 5.0, < 7.1)
rdf
qa_server (8.0.1)
gruff
rails (~> 7.0)
sass-rails (~> 5.0)
useragent
racc (1.7.3)
rack (2.2.8)
rack (2.2.8.1)
rack-test (2.1.0)
rack (>= 1.3)
rails (7.0.8)
actioncable (= 7.0.8)
actionmailbox (= 7.0.8)
actionmailer (= 7.0.8)
actionpack (= 7.0.8)
actiontext (= 7.0.8)
actionview (= 7.0.8)
activejob (= 7.0.8)
activemodel (= 7.0.8)
activerecord (= 7.0.8)
activestorage (= 7.0.8)
activesupport (= 7.0.8)
rails (7.0.8.1)
actioncable (= 7.0.8.1)
actionmailbox (= 7.0.8.1)
actionmailer (= 7.0.8.1)
actionpack (= 7.0.8.1)
actiontext (= 7.0.8.1)
actionview (= 7.0.8.1)
activejob (= 7.0.8.1)
activemodel (= 7.0.8.1)
activerecord (= 7.0.8.1)
activestorage (= 7.0.8.1)
activesupport (= 7.0.8.1)
bundler (>= 1.15.0)
railties (= 7.0.8)
railties (= 7.0.8.1)
rails-controller-testing (1.0.5)
actionpack (>= 5.0.1.rc1)
actionview (>= 5.0.1.rc1)
Expand All @@ -340,9 +335,9 @@ GEM
rails-html-sanitizer (1.6.0)
loofah (~> 2.21)
nokogiri (~> 1.14)
railties (7.0.8)
actionpack (= 7.0.8)
activesupport (= 7.0.8)
railties (7.0.8.1)
actionpack (= 7.0.8.1)
activesupport (= 7.0.8.1)
method_source
rake (>= 12.2)
thor (~> 1.0)
Expand Down Expand Up @@ -420,7 +415,8 @@ GEM
request_store (1.5.1)
rack (>= 1.4)
rexml (3.2.6)
rmagick (5.3.0)
rmagick (5.4.4)
observer (~> 0.1)
pkg-config (~> 1.4)
rouge (4.1.3)
rspec-activemodel-mocks (1.1.0)
Expand Down Expand Up @@ -544,7 +540,7 @@ GEM
temple (0.10.3)
term-ansicolor (1.7.1)
tins (~> 1.0)
thor (1.3.0)
thor (1.3.1)
tilt (2.3.0)
timeout (0.4.1)
tins (1.32.1)
Expand Down Expand Up @@ -583,7 +579,7 @@ GEM
psych (>= 3.3)
rdf (~> 3.2, >= 3.2.9)
rdf-xsd (~> 3.2)
zeitwerk (2.6.12)
zeitwerk (2.6.13)

PLATFORMS
arm64-darwin-22
Expand Down Expand Up @@ -612,7 +608,7 @@ DEPENDENCIES
psych (~> 5.1)
puma (~> 6.4.0, >= 5.6.4)
qa (~> 5.10)
qa_server!
qa_server (~> 8.0)
rails (~> 7.0.8)
rails-controller-testing
rspec-activemodel-mocks (~> 1.0)
Expand Down
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 + subject_collections + geography
end
end
end
8 changes: 7 additions & 1 deletion lib/qa/authorities/loc/generic_authority.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ def build_query_url(q)
escaped_query = ERB::Util.url_encode(q)
authority = Loc.get_authority(subauthority)
rdftype = Loc.get_rdftype(subauthority)
authority_fragment = Loc.get_url_for_authority(authority) + ERB::Util.url_encode(authority)
use_authority = authority == 'agents' ? 'names' : authority
authority_fragment = Loc.get_url_for_authority(use_authority) + ERB::Util.url_encode(use_authority)
rdftype_fragment = "&q=rdftype:#{ERB::Util.url_encode(rdftype)}" if rdftype
"https://id.loc.gov/search/?q=#{escaped_query}&q=#{authority_fragment}#{rdftype_fragment}&format=json"
end
Expand Down Expand Up @@ -87,6 +88,11 @@ def loc_response_to_qa(data)

response["uri"] = (data.links.find { |l| l["type"].nil? } || data.links[0])["href"] if data.links.present?

if subauthority.include? 'agents'
response['id'].gsub!('authorities/names', 'rwo/agents')
response['uri'].gsub!('authorities/names', 'rwo/agents')
end

response
end
end
Expand Down
Loading
Loading