qa 5.9.0 → 5.11.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1f4e4d8c917617e8cba95cd8bc8e0f06ebb60c9b580672b3736c717ef1ce3746
4
- data.tar.gz: bd9624a47e0c513d8b7fdf7a278d2c904867b3331217faaf7951321326f7549d
3
+ metadata.gz: 0b356b770cbc77b1d67024f2a73be01b579943e75d9bda64e7f7dad04f66342b
4
+ data.tar.gz: a3f6a66764724811209c8616e00f260cab0d371f340117f335d384c1f84d1bd6
5
5
  SHA512:
6
- metadata.gz: a6f568c19f5aad67ca850bf0d666afd63f971b7bbab83e51b4299791b52c94e93fcae9e49a9ff6aec4d2e8329cf1b41ab39131fa8dc3e0eb0baec5725934499b
7
- data.tar.gz: 69d1bed451753f68ae20551aa1ac2a77e8acbfffeb2600e42d50726d113f28300c01faaf74af9b65dcfc5a168410019fb99bc84b09928b9846b466fd20fc9e63
6
+ metadata.gz: 798c03132eac1750d15b0db93e2c6009925b1ebd3773619df77cd11f3f0cd661b6645d5e54122842efdc3e86d221356fb38aca6705943c35a5dc03d0a7010d2d
7
+ data.tar.gz: f1a3e23f4f3eb3197c3f8e39e2a9663ae7329a7e1e46e100f60d91f3b01b55e46a19ded39ac4b88520ec29189adc1e3d948bbfca7422044a92dc2c26d6eb3367
data/README.md CHANGED
@@ -1,10 +1,15 @@
1
1
  # Questioning Authority
2
2
 
3
- Code: [![Gem Version](https://badge.fury.io/rb/qa.png)](http://badge.fury.io/rb/qa) [![Build Status](https://circleci.com/gh/samvera/questioning_authority.svg?style=svg)](https://circleci.com/gh/samvera/questioning_authority) [![Coverage Status](https://coveralls.io/repos/github/samvera/questioning_authority/badge.svg?branch=main)](https://coveralls.io/github/samvera/questioning_authority?branch=main)
3
+ Code:
4
+ [![Gem Version](https://badge.fury.io/rb/qa.png)](http://badge.fury.io/rb/qa)
5
+ [![Build Status](https://circleci.com/gh/samvera/questioning_authority.svg?style=svg)](https://circleci.com/gh/samvera/questioning_authority)
6
+ [![Coverage Status](https://coveralls.io/repos/github/samvera/questioning_authority/badge.svg?branch=main)](https://coveralls.io/github/samvera/questioning_authority?branch=main)
4
7
 
5
- Docs: [![Contribution Guidelines](http://img.shields.io/badge/CONTRIBUTING-Guidelines-blue.svg)](./CONTRIBUTING.md) [![Apache 2.0 License](http://img.shields.io/badge/APACHE2-license-blue.svg)](./LICENSE)
8
+ Docs:
9
+ [![Contribution Guidelines](http://img.shields.io/badge/CONTRIBUTING-Guidelines-blue.svg)](./CONTRIBUTING.md)
10
+ [![Apache 2.0 License](http://img.shields.io/badge/APACHE2-license-blue.svg)](./LICENSE)
6
11
 
7
- Jump In: [![Slack Status](http://slack.samvera.org/badge.svg)](http://slack.samvera.org/)
12
+ Community Support: [![Samvera Community Slack](https://img.shields.io/badge/samvera-slack-blueviolet)](http://slack.samvera.org/)
8
13
 
9
14
  You should question your authorities.
10
15
 
@@ -145,14 +150,14 @@ rake ci
145
150
 
146
151
  Commit your features into a new branch and submit a pull request.
147
152
 
148
- ## Contributing
153
+ ## Contributing
149
154
 
150
- If you're working on PR for this project, create a feature branch off of `main`.
155
+ If you're working on PR for this project, create a feature branch off of `main`.
151
156
 
152
157
  This repository follows the [Samvera Community Code of Conduct](https://samvera.atlassian.net/wiki/spaces/samvera/pages/405212316/Code+of+Conduct) and [language recommendations](https://github.com/samvera/maintenance/blob/main/templates/CONTRIBUTING.md#language). Please ***do not*** create a branch called `master` for this repository or as part of your pull request; the branch will either need to be removed or renamed before it can be considered for inclusion in the code base and history of this repository.
153
158
 
154
159
  ## Compatibility
155
- This gem works with Rails 5.0-6.1 and Ruby 2.5-3.1, provided the version of Rails supports the version of Ruby.
160
+ This gem works with Rails 5.0-7.0 and Ruby 2.5-3.1, provided the version of Rails supports the version of Ruby.
156
161
  - Consult `.circleci/config.yml` for a list of supported combinations.
157
162
  - The combination of Ruby 3.1 and Rails 6.0 comes with three caveats:
158
163
  - your app will not be able to use `psych 4` (which ordinarily comes with 3.1). See https://bugs.ruby-lang.org/issues/17866 and https://stackoverflow.com/questions/71191685/visit-psych-nodes-alias-unknown-alias-default-psychbadalias/71192990#71192990 for an explanation. One workaround is to modify your app's `Gemfile` to hold back `psych`: `gem 'psych', '< 4'`.
@@ -163,11 +168,13 @@ See also `.circleci/config.yml` and `spec/test_app_templates/Gemfile.extra`.
163
168
 
164
169
  ## Product Owner & Maintenance
165
170
 
166
- Questioning Authority is a Core Component of the Samvera community. The documentation for what this means can be found [here](http://samvera.github.io/core_components.html#requirements-for-a-core-component).
171
+ `qa` was a Core Component of the Samvera Community. Given a decline in available labor required for maintenance, this project no longer has a dedicated Product Owner. The documentation for what this means can be found [here](http://samvera.github.io/core_components.html#requirements-for-a-core-component).
167
172
 
168
173
  ### Product Owner
169
174
 
170
- [elrayle](https://github.com/elrayle)
175
+ **Vacant**
176
+
177
+ _Until a Product Owner has been identified, we ask that you please direct all requests for support, bug reports, and general questions to the [`#dev` Channel on the Samvera Slack](https://samvera.slack.com/app_redirect?channel=dev)._
171
178
 
172
179
  ## Releasing
173
180
 
@@ -0,0 +1,62 @@
1
+ module Qa::Authorities
2
+ class Getty::AAT2 < Base
3
+ include WebServiceBase
4
+
5
+ def search(q)
6
+ parse_authority_response(json(build_query_url(q)))
7
+ end
8
+
9
+ def build_query_url(q)
10
+ "http://vocab.getty.edu/sparql.json?query=#{ERB::Util.url_encode(sparql(q))}&_implicit=false&implicit=true&_equivalent=false&_form=%2Fsparql"
11
+ end
12
+
13
+ def sparql(q) # rubocop:disable Metrics/MethodLength
14
+ search = untaint(q)
15
+ if search.include?(' ')
16
+ clauses = search.split(' ').collect do |i|
17
+ %((regex(?name, "#{i}", "i")))
18
+ end
19
+ ex = "(#{clauses.join(' && ')})"
20
+ else
21
+ ex = %(regex(?name, "#{search}", "i"))
22
+ end
23
+ # The full text index matches on fields besides the term, so we filter to ensure the match is in the term.
24
+ %(SELECT ?s ?name {
25
+ ?s a skos:Concept; luc:term "#{search}";
26
+ skos:inScheme <http://vocab.getty.edu/aat/> ;
27
+ gvp:prefLabelGVP [skosxl:literalForm ?name].
28
+ FILTER #{ex} .
29
+ } ORDER BY ?name).gsub(/[\s\n]+/, " ")
30
+ end
31
+
32
+ def untaint(q)
33
+ q.gsub(/[^\w\s-]/, '')
34
+ end
35
+
36
+ def find(id)
37
+ json(find_url(id))
38
+ end
39
+
40
+ def find_url(id)
41
+ "http://vocab.getty.edu/download/json?uri=http://vocab.getty.edu/aat/#{id}.json"
42
+ end
43
+
44
+ def request_options
45
+ { accept: 'application/sparql-results+json' }
46
+ end
47
+
48
+ private
49
+
50
+ # Reformats the data received from the Getty service
51
+ def parse_authority_response(response)
52
+ response['results']['bindings'].map do |result|
53
+ { 'id' => result['s']['value'], 'label' => result['name']['value'] }
54
+ end
55
+ rescue StandardError => e
56
+ cause = response.fetch('error', {}).fetch('cause', 'UNKNOWN')
57
+ cause = cause.present? ? cause : 'UNKNOWN'
58
+ Rails.logger.warn " ERROR fetching Getty response: #{e.message}; cause: #{cause}"
59
+ {}
60
+ end
61
+ end
62
+ end
@@ -1,4 +1,4 @@
1
- <?xml version="1.0" encoding="US-ASCII" ?>
1
+ <?xml version="1.0" encoding="UTF-8" ?>
2
2
  <Vocabulary xmlns="http://localhost/namespace" xmlns:vp="http://localhost/namespace" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://localhost/namespace Getty_Vocab_Export_Languages.xsd" Title="Thesaurus of Geographic Names" Part="Languages" Date="2011-04-11">
3
3
  <Language>
4
4
  <Language_Code>70115</Language_Code>
data/lib/qa/engine.rb CHANGED
@@ -1,5 +1,21 @@
1
+ # used in initializer where autoload is unavailable, must be required here:
2
+ require 'qa/linked_data/authority_service'
3
+
1
4
  module Qa
2
5
  class Engine < ::Rails::Engine
3
6
  isolate_namespace Qa
7
+
8
+ config.before_configuration do
9
+ # rubocop:disable Style/IfUnlessModifier
10
+
11
+ # see https://github.com/fxn/zeitwerk#for_gem
12
+ # Blacklight puts a generator into LOCAL APP lib/generators, so tell
13
+ # zeitwerk to ignore the whole directory? If we're using zeitwerk
14
+ #
15
+ # See: https://github.com/cbeer/engine_cart/issues/117
16
+ if Rails.try(:autoloaders).try(:main).respond_to?(:ignore)
17
+ Rails.autoloaders.main.ignore(Rails.root.join('lib', 'generators'))
18
+ end
19
+ end
4
20
  end
5
21
  end
data/lib/qa/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Qa
2
- VERSION = "5.9.0".freeze
2
+ VERSION = "5.11.0".freeze
3
3
  end
@@ -212,7 +212,7 @@ describe Qa::Authorities::Discogs::GenericAuthority do
212
212
  expect(JSON.parse(results).keys).to match_array ["@context", "@graph"]
213
213
  expect(JSON.parse(results)["@context"]["bf2"]).to eq("http://id.loc.gov/ontologies/bibframe/")
214
214
  expect(results).to include("You Go To My Head")
215
- expect(results).to include("Rodgers & Hart")
215
+ expect(JSON.parse(results).inspect).to include("Rodgers & Hart")
216
216
  expect(results).to include("Ray Brown")
217
217
  expect(results).to include("1952")
218
218
  expect(results).to include("Single")
@@ -2,7 +2,7 @@
2
2
  require 'spec_helper'
3
3
 
4
4
  describe Qa::Services::RDFAuthorityParser do
5
- let(:source) { [File.join(fixture_path, 'lexvo_snippet.rdf.xml')] }
5
+ let(:source) { [Qa::Engine.root.join('spec', 'fixtures', 'lexvo_snippet.rdf.xml')] }
6
6
  let(:format) { 'rdfxml' }
7
7
  let(:predicate) { RDF::URI("http://www.w3.org/2008/05/skos#prefLabel") }
8
8
  let(:name) { 'language' }
data/spec/spec_helper.rb CHANGED
@@ -1,4 +1,10 @@
1
- require 'linkeddata'
1
+ # Not sure why these RDF-related gems are only being used in CI and not general
2
+ # dependencies... maybe meant to be optional dependencies?
3
+ require 'rdf/n3'
4
+ require 'rdf/rdfxml'
5
+ require 'json/ld'
6
+ require 'rdf/vocab'
7
+
2
8
  require 'json'
3
9
  require 'engine_cart'
4
10
  require 'byebug' unless ENV['TRAVIS']
@@ -1,13 +1,19 @@
1
1
  # Use this file to reference specific commits of gems.
2
2
 
3
+
3
4
  group :development do
4
- gem 'linkeddata'
5
- if ENV['RAILS_VERSION'] =~ /^6\.1\./ && ENV['RUBY_VERSION'] =~ /^3\.1\./
6
- # Ruby 3.0 comes with Psych 3, while Ruby 3.1 comes with Psych 4,
7
- # which has a major breaking change (diff 3.3.2 → 4.0.0).
8
- # See: https://bugs.ruby-lang.org/issues/17866
9
- # See also: https://stackoverflow.com/questions/71191685/visit-psych-nodes-alias-unknown-alias-default-psychbadalias/71192990#71192990
5
+ # Rails < 6.1 are not compatible with psych 4, although doesn't know it.
6
+ # Local apps using old Rails will have to lock locally. Latest versions
7
+ # of Rails 6.1+ has been updated to work with psych 4.
8
+ # See also:
9
+ #
10
+ # https://stackoverflow.com/questions/71191685/visit-psych-nodes-alias-unknown-alias-default-psychbadalias/71192990#71192990
11
+ #
12
+ if ENV['RAILS_VERSION'] && Gem::Version.new(ENV['RAILS_VERSION']) < Gem::Version.new("6.1")
10
13
  gem 'psych', '< 4'
14
+ end
15
+
16
+ if ENV['RAILS_VERSION'] =~ /^6\.1\./ && ENV['RUBY_VERSION'] =~ /^3\.1\./
11
17
  # opt into mail 2.8.0.rc1 so we get extra dependencies
12
18
  # Once mail 2.8.0 final is released this will not be required.
13
19
  # https://github.com/mikel/mail/pull/1472
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: qa
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.9.0
4
+ version: 5.11.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stephen Anderson
@@ -16,7 +16,7 @@ authors:
16
16
  autorequire:
17
17
  bindir: bin
18
18
  cert_chain: []
19
- date: 2022-07-27 00:00:00.000000000 Z
19
+ date: 2023-11-09 00:00:00.000000000 Z
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
22
22
  name: activerecord-import
@@ -117,7 +117,7 @@ dependencies:
117
117
  version: '5.0'
118
118
  - - "<"
119
119
  - !ruby/object:Gem::Version
120
- version: '6.2'
120
+ version: '7.2'
121
121
  type: :runtime
122
122
  prerelease: false
123
123
  version_requirements: !ruby/object:Gem::Requirement
@@ -127,7 +127,7 @@ dependencies:
127
127
  version: '5.0'
128
128
  - - "<"
129
129
  - !ruby/object:Gem::Version
130
- version: '6.2'
130
+ version: '7.2'
131
131
  - !ruby/object:Gem::Dependency
132
132
  name: rdf
133
133
  requirement: !ruby/object:Gem::Requirement
@@ -217,19 +217,61 @@ dependencies:
217
217
  - !ruby/object:Gem::Version
218
218
  version: '2.0'
219
219
  - !ruby/object:Gem::Dependency
220
- name: linkeddata
220
+ name: rdf-n3
221
221
  requirement: !ruby/object:Gem::Requirement
222
222
  requirements:
223
- - - ">="
223
+ - - "~>"
224
224
  - !ruby/object:Gem::Version
225
- version: '0'
225
+ version: '3.0'
226
226
  type: :development
227
227
  prerelease: false
228
228
  version_requirements: !ruby/object:Gem::Requirement
229
229
  requirements:
230
- - - ">="
230
+ - - "~>"
231
231
  - !ruby/object:Gem::Version
232
- version: '0'
232
+ version: '3.0'
233
+ - !ruby/object:Gem::Dependency
234
+ name: rdf-rdfxml
235
+ requirement: !ruby/object:Gem::Requirement
236
+ requirements:
237
+ - - "~>"
238
+ - !ruby/object:Gem::Version
239
+ version: '3.0'
240
+ type: :development
241
+ prerelease: false
242
+ version_requirements: !ruby/object:Gem::Requirement
243
+ requirements:
244
+ - - "~>"
245
+ - !ruby/object:Gem::Version
246
+ version: '3.0'
247
+ - !ruby/object:Gem::Dependency
248
+ name: json-ld
249
+ requirement: !ruby/object:Gem::Requirement
250
+ requirements:
251
+ - - "~>"
252
+ - !ruby/object:Gem::Version
253
+ version: '3.0'
254
+ type: :development
255
+ prerelease: false
256
+ version_requirements: !ruby/object:Gem::Requirement
257
+ requirements:
258
+ - - "~>"
259
+ - !ruby/object:Gem::Version
260
+ version: '3.0'
261
+ - !ruby/object:Gem::Dependency
262
+ name: rdf-vocab
263
+ requirement: !ruby/object:Gem::Requirement
264
+ requirements:
265
+ - - "~>"
266
+ - !ruby/object:Gem::Version
267
+ version: '3.0'
268
+ type: :development
269
+ prerelease: false
270
+ version_requirements: !ruby/object:Gem::Requirement
271
+ requirements:
272
+ - - "~>"
273
+ - !ruby/object:Gem::Version
274
+ version: '3.0'
233
275
  - !ruby/object:Gem::Dependency
234
276
  name: pry
235
277
  requirement: !ruby/object:Gem::Requirement
@@ -353,7 +395,6 @@ files:
353
395
  - app/models/qa/mesh_tree.rb
354
396
  - app/models/qa/subject_mesh_term.rb
355
397
  - app/services/qa/iri_template_service.rb
356
- - app/services/qa/linked_data/authority_service.rb
357
398
  - app/services/qa/linked_data/authority_url_service.rb
358
399
  - app/services/qa/linked_data/deep_sort_service.rb
359
400
  - app/services/qa/linked_data/graph_service.rb
@@ -434,6 +475,7 @@ files:
434
475
  - lib/qa/authorities/geonames.rb
435
476
  - lib/qa/authorities/getty.rb
436
477
  - lib/qa/authorities/getty/aat.rb
478
+ - lib/qa/authorities/getty/aat2.rb
437
479
  - lib/qa/authorities/getty/tgn.rb
438
480
  - lib/qa/authorities/getty/ulan.rb
439
481
  - lib/qa/authorities/linked_data.rb
@@ -462,6 +504,7 @@ files:
462
504
  - lib/qa/configuration.rb
463
505
  - lib/qa/data/TGN_LANGUAGES.xml
464
506
  - lib/qa/engine.rb
507
+ - lib/qa/linked_data/authority_service.rb
465
508
  - lib/qa/services.rb
466
509
  - lib/qa/services/rdf_authority_parser.rb
467
510
  - lib/qa/version.rb
@@ -618,7 +661,8 @@ files:
618
661
  homepage: https://github.com/projecthydra/questioning_authority
619
662
  licenses:
620
663
  - APACHE-2
621
- metadata: {}
664
+ metadata:
665
+ rubygems_mfa_required: 'true'
622
666
  post_install_message:
623
667
  rdoc_options: []
624
668
  require_paths:
@@ -634,7 +678,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
634
678
  - !ruby/object:Gem::Version
635
679
  version: '0'
636
680
  requirements: []
637
- rubygems_version: 3.2.33
681
+ rubygems_version: 3.4.21
638
682
  signing_key:
639
683
  specification_version: 4
640
684
  summary: You should question your authorities.