qa 4.1.0 → 4.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f8ae75788063293cff50f32548b9eccbd6d0c837
4
- data.tar.gz: 3aad18f6f86d31d4e8a13941407c8890d1389a21
3
+ metadata.gz: 4aa5880f67c4587fb44e2740ce97df0cecc2a119
4
+ data.tar.gz: 50e47d7b72d95bf8a3a93ecc8ab8dcd5f1c442cf
5
5
  SHA512:
6
- metadata.gz: 4c1bd3ffc5d4d6d663fa656cebc9400f390a393862c3d68c454866f42f50f803236f64cd97dc3c0a63e5e895e2ca575b2f32b5d9e5372c6fe572bf08b1484397
7
- data.tar.gz: 761ef1f50ecdfdc425a8deb49b3672508955725aa3339514c517b8bbc0cd6d1285b689adde5d35e2e3aa877e659ead79492c6ad6d82de345bd6c3cb230245f93
6
+ metadata.gz: 78b5ce231dc3fdcc74e254c5e578f5024a3ea1abb0c3696655dd4b8619a683e06d1caaa65ba2a87f683b594ecc6b8db79444ac63b6bd441d4a7821e82dc7236a
7
+ data.tar.gz: 3b02f86177cc7c5f84d232619ff0b1e024cfc1c36eb9847deca5a760632ce2059cc248d15b20539b51be1cf6d98ba7e589879cd6a60873096123ea1cccffd5e6
@@ -60,7 +60,8 @@ module Qa::Authorities
60
60
  def results_id_predicate
61
61
  Qa.deprecation_warning(
62
62
  in_msg: 'Qa::Authorities::LinkedData::SearchConfig',
63
- msg: "`results_id_predicate` is deprecated; use `results_id_ldpath` by updating linked data search config results to specify as `id_ldpath`"
63
+ msg: "`results_id_predicate` is deprecated; use `results_id_ldpath` by updating linked data search config results " \
64
+ "in authority #{authority_name} to specify as `id_ldpath`"
64
65
  )
65
66
  Config.predicate_uri(results, :id_predicate)
66
67
  end
@@ -73,11 +74,14 @@ module Qa::Authorities
73
74
 
74
75
  # Return results label_predicate
75
76
  # @return [String] the configured predicate to use to extract label values from the results
76
- def results_label_predicate
77
- Qa.deprecation_warning(
78
- in_msg: 'Qa::Authorities::LinkedData::SearchConfig',
79
- msg: "`results_label_predicate` is deprecated; use `results_label_ldpath` by updating linked data search config results to specify as `label_ldpath`"
80
- )
77
+ def results_label_predicate(suppress_deprecation_warning: false)
78
+ unless suppress_deprecation_warning
79
+ Qa.deprecation_warning(
80
+ in_msg: 'Qa::Authorities::LinkedData::SearchConfig',
81
+ msg: "`results_label_predicate` is deprecated; use `results_label_ldpath` by updating linked data search config results " \
82
+ "in authority #{authority_name} to specify as `label_ldpath`"
83
+ )
84
+ end
81
85
  Config.predicate_uri(results, :label_predicate)
82
86
  end
83
87
 
@@ -92,7 +96,8 @@ module Qa::Authorities
92
96
  def results_altlabel_predicate
93
97
  Qa.deprecation_warning(
94
98
  in_msg: 'Qa::Authorities::LinkedData::SearchConfig',
95
- msg: "`results_altlabel_predicate` is deprecated; use `results_altlabel_ldpath` by updating linked data search config results to specify as `altlabel_ldpath`"
99
+ msg: "`results_altlabel_predicate` is deprecated; use `results_altlabel_ldpath` by updating linked data " \
100
+ "search config results in authority #{authority_name} to specify as `altlabel_ldpath`"
96
101
  )
97
102
  Config.predicate_uri(results, :altlabel_predicate)
98
103
  end
@@ -115,7 +120,8 @@ module Qa::Authorities
115
120
  def results_sort_predicate
116
121
  Qa.deprecation_warning(
117
122
  in_msg: 'Qa::Authorities::LinkedData::SearchConfig',
118
- msg: "`results_sort_predicate` is deprecated; use `results_sort_ldpath` by updating linked data search config results to specify as `sort_ldpath`"
123
+ msg: "`results_sort_predicate` is deprecated; use `results_sort_ldpath` by updating linked data " \
124
+ "search config results in authority #{authority_name} to specify as `sort_ldpath`"
119
125
  )
120
126
  Config.predicate_uri(results, :sort_predicate)
121
127
  end
@@ -12,7 +12,7 @@ module Qa::Authorities
12
12
 
13
13
  # @param [Hash] config the term portion of the config
14
14
  # @param [Hash<Symbol><String>] prefixes URL map of prefixes to use with ldpaths
15
- # @param [Qa::Authorities::LinkedData::Config] full_config the full linked data configuration that the passed in search config is part of
15
+ # @param [Qa::Authorities::LinkedData::Config] full_config the full linked data configuration that the passed in term config is part of
16
16
  def initialize(config, prefixes = {}, full_config = nil)
17
17
  @term_config = config
18
18
  @prefixes = prefixes
@@ -87,7 +87,14 @@ module Qa::Authorities
87
87
 
88
88
  # Return results label_predicate
89
89
  # @return [String] the configured predicate to use to extract label values from the results
90
- def term_results_label_predicate
90
+ def term_results_label_predicate(suppress_deprecation_warning: false)
91
+ unless suppress_deprecation_warning
92
+ Qa.deprecation_warning(
93
+ in_msg: 'Qa::Authorities::LinkedData::TermConfig',
94
+ msg: "`term_results_label_predicate` is deprecated; use `term_results_label_ldpath` by updating linked data " \
95
+ "term config results in authority #{authority_name} to specify as `label_ldpath`"
96
+ )
97
+ end
91
98
  Config.predicate_uri(term_results, :label_predicate)
92
99
  end
93
100
 
@@ -100,6 +107,11 @@ module Qa::Authorities
100
107
  # Return results altlabel_predicate
101
108
  # @return [String] the configured predicate to use to extract altlabel values from the results
102
109
  def term_results_altlabel_predicate
110
+ Qa.deprecation_warning(
111
+ in_msg: 'Qa::Authorities::LinkedData::TermConfig',
112
+ msg: "`term_results_altlabel_predicate` is deprecated; use `term_results_altlabel_ldpath` by updating linked data " \
113
+ "term config results in authority #{authority_name} to specify as `altlabel_ldpath`"
114
+ )
103
115
  Config.predicate_uri(term_results, :altlabel_predicate)
104
116
  end
105
117
 
@@ -112,6 +124,11 @@ module Qa::Authorities
112
124
  # Return results broader_predicate
113
125
  # @return [String] the configured predicate to use to extract URIs for broader terms from the results
114
126
  def term_results_broader_predicate
127
+ Qa.deprecation_warning(
128
+ in_msg: 'Qa::Authorities::LinkedData::TermConfig',
129
+ msg: "`term_results_broader_predicate` is deprecated; use `term_results_broader_ldpath` by updating linked data " \
130
+ "term config results in authority #{authority_name} to specify as `broader_ldpath`"
131
+ )
115
132
  Config.predicate_uri(term_results, :broader_predicate)
116
133
  end
117
134
 
@@ -124,6 +141,11 @@ module Qa::Authorities
124
141
  # Return results narrower_predicate
125
142
  # @return [String] the configured predicate to use to extract URIs for narrower terms from the results
126
143
  def term_results_narrower_predicate
144
+ Qa.deprecation_warning(
145
+ in_msg: 'Qa::Authorities::LinkedData::TermConfig',
146
+ msg: "`term_results_narrower_predicate` is deprecated; use `term_results_narrower_ldpath` by updating linked data " \
147
+ "term config results in authority #{authority_name} to specify as `narrower_ldpath`"
148
+ )
127
149
  Config.predicate_uri(term_results, :narrower_predicate)
128
150
  end
129
151
 
@@ -136,6 +158,11 @@ module Qa::Authorities
136
158
  # Return results sameas_predicate
137
159
  # @return [String] the configured predicate to use to extract URIs for sameas terms from the results
138
160
  def term_results_sameas_predicate
161
+ Qa.deprecation_warning(
162
+ in_msg: 'Qa::Authorities::LinkedData::TermConfig',
163
+ msg: "`term_results_sameas_predicate` is deprecated; use `term_results_sameas_ldpath` by updating linked data " \
164
+ "term config results in authority #{authority_name} to specify as `sameas_ldpath`"
165
+ )
139
166
  Config.predicate_uri(term_results, :sameas_predicate)
140
167
  end
141
168
 
@@ -15,8 +15,8 @@ module Qa::Authorities
15
15
  @term_config = term_config
16
16
  end
17
17
 
18
- attr_reader :term_config, :full_graph, :filtered_graph, :language, :id, :access_time_s, :normalize_time_s
19
- private :full_graph, :filtered_graph, :language, :id, :access_time_s, :normalize_time_s
18
+ attr_reader :term_config, :full_graph, :filtered_graph, :language, :id, :uri, :access_time_s, :normalize_time_s
19
+ private :full_graph, :filtered_graph, :language, :id, :uri, :access_time_s, :normalize_time_s
20
20
 
21
21
  delegate :term_subauthority?, :prefixes, :authority_name, to: :term_config
22
22
 
@@ -80,6 +80,7 @@ module Qa::Authorities
80
80
  return full_graph.dump(:jsonld, standard_prefixes: true) if jsonld?
81
81
 
82
82
  filter_graph
83
+ extract_uri
83
84
  results = map_results
84
85
  convert_results_to_json(results)
85
86
  end
@@ -93,13 +94,13 @@ module Qa::Authorities
93
94
  predicate_map = preds_for_term
94
95
  ldpath_map = ldpaths_for_term
95
96
 
96
- raise Qa::InvalidConfiguration, "do not specify results using both predicates and ldpath in term configuration for LOD authority #{authority_name} (ldpath is preferred)" if predicate_map.present? && ldpath_map.present? # rubocop:disable Metrics/LineLength
97
- raise Qa::InvalidConfiguration, "must specify label_ldpath or label_predicate in term configuration for LOD authority #{authority_name} (label_ldpath is preferred)" unless ldpath_map.key?(:label) || predicate_map.key?(:label) # rubocop:disable Metrics/LineLength
97
+ raise Qa::InvalidConfiguration, "do not specify results using both predicates and ldpath in term configuration for linked data authority #{authority_name} (ldpath is preferred)" if predicate_map.present? && ldpath_map.present? # rubocop:disable Metrics/LineLength
98
+ raise Qa::InvalidConfiguration, "must specify label_ldpath or label_predicate in term configuration for linked data authority #{authority_name} (label_ldpath is preferred)" unless ldpath_map.key?(:label) || predicate_map.key?(:label) # rubocop:disable Metrics/LineLength
98
99
 
99
100
  if predicate_map.present?
100
101
  Qa.deprecation_warning(
101
102
  in_msg: 'Qa::Authorities::LinkedData::FindTerm',
102
- msg: 'defining results using predicates in term config is deprecated; update to define using ldpaths'
103
+ msg: "defining results using predicates in term config is deprecated; update to define using ldpaths (authority: #{authority_name})"
103
104
  )
104
105
  end
105
106
 
@@ -107,19 +108,42 @@ module Qa::Authorities
107
108
  ldpath_map: ldpaths_for_term, predicate_map: preds_for_term)
108
109
  end
109
110
 
111
+ # special processing for loc ids for backward compatibility
110
112
  def normalize_id
111
113
  return id if expects_uri?
112
- authority_name.to_s.casecmp('loc').zero? ? id.delete(' ') : id
114
+ loc? ? id.delete(' ') : id
115
+ end
116
+
117
+ # special processing for loc ids for backward compatibility
118
+ def loc_id
119
+ loc_id = URI.unescape(id)
120
+ digit_idx = loc_id.index(/\d/)
121
+ loc_id.insert(digit_idx, ' ') if loc? && loc_id.index(' ').blank? && digit_idx > 0
122
+ loc_id
123
+ end
124
+
125
+ # determine if the current authority is LOC which may require special processing of its ids for backward compatibility
126
+ def loc?
127
+ authority_name.to_s.casecmp('loc').zero?
113
128
  end
114
129
 
115
130
  def expects_uri?
116
131
  term_config.term_id_expects_uri?
117
132
  end
118
133
 
119
- def uri
120
- return @uri if @uri.present?
134
+ def extract_uri
121
135
  return @uri = RDF::URI.new(id) if expects_uri?
122
- @uri = graph_service.subjects_for_object_value(graph: @filtered_graph, predicate: RDF::URI.new(term_config.term_results_id_predicate), object_value: id.gsub('%20', ' ')).first
136
+ @uri = graph_service.subjects_for_object_value(graph: @filtered_graph, predicate: RDF::URI.new(term_config.term_results_id_predicate), object_value: URI.unescape(id)).first
137
+ return @uri unless loc? && @uri.blank?
138
+ # for backward compatibility, if an loc id as passed in fails to extract the URI, try to adding a blank to the id
139
+ @uri = graph_service.subjects_for_object_value(graph: @filtered_graph, predicate: RDF::URI.new(term_config.term_results_id_predicate), object_value: loc_id).first
140
+ if @uri.present?
141
+ Qa.deprecation_warning(
142
+ in_msg: 'Qa::Authorities::LinkedData::FindTerm',
143
+ msg: 'Special processing of LOC ids is deprecated; id should be an exact match of the id in the graph'
144
+ )
145
+ end
146
+ @uri
123
147
  end
124
148
 
125
149
  def ldpaths_for_term
@@ -148,7 +172,7 @@ module Qa::Authorities
148
172
  end
149
173
 
150
174
  def preds_for_term
151
- label_pred_uri = term_config.term_results_label_predicate
175
+ label_pred_uri = term_config.term_results_label_predicate(suppress_deprecation_warning: true)
152
176
  return {} if label_pred_uri.blank?
153
177
  preds = { label: label_pred_uri }
154
178
  preds.merge(optional_preds)
@@ -15,8 +15,8 @@ module Qa::Authorities
15
15
  @search_config = search_config
16
16
  end
17
17
 
18
- attr_reader :search_config, :graph, :language, :access_time_s, :normalize_time_s
19
- private :graph, :language, :access_time_s, :normalize_time_s
18
+ attr_reader :search_config, :full_graph, :filtered_graph, :language, :access_time_s, :normalize_time_s
19
+ private :full_graph, :filtered_graph, :language, :access_time_s, :normalize_time_s
20
20
 
21
21
  delegate :subauthority?, :supports_sort?, :prefixes, :authority_name, to: :search_config
22
22
 
@@ -48,7 +48,7 @@ module Qa::Authorities
48
48
  def load_graph(url:)
49
49
  access_start_dt = Time.now.utc
50
50
 
51
- @graph = graph_service.load_graph(url: url)
51
+ @full_graph = graph_service.load_graph(url: url)
52
52
 
53
53
  access_end_dt = Time.now.utc
54
54
  @access_time_s = access_end_dt - access_start_dt
@@ -58,7 +58,7 @@ module Qa::Authorities
58
58
  def normalize_results
59
59
  normalize_start_dt = Time.now.utc
60
60
 
61
- @graph = graph_service.filter(graph: @graph, language: language, remove_blanknode_subjects: true)
61
+ @filtered_graph = graph_service.filter(graph: @full_graph, language: language)
62
62
  results = map_results
63
63
  json = convert_results_to_json(results)
64
64
 
@@ -73,17 +73,17 @@ module Qa::Authorities
73
73
  predicate_map = preds_for_search
74
74
  ldpath_map = ldpaths_for_search
75
75
 
76
- raise Qa::InvalidConfiguration, "do not specify results using both predicates and ldpath in search configuration for LOD authority #{authority_name} (ldpath is preferred)" if predicate_map.present? && ldpath_map.present? # rubocop:disable Metrics/LineLength
77
- raise Qa::InvalidConfiguration, "must specify label_ldpath or label_predicate in search configuration for LOD authority #{authority_name} (label_ldpath is preferred)" unless ldpath_map.key?(:label) || predicate_map.key?(:label) # rubocop:disable Metrics/LineLength
76
+ raise Qa::InvalidConfiguration, "do not specify results using both predicates and ldpath in search configuration for linked data authority #{authority_name} (ldpath is preferred)" if predicate_map.present? && ldpath_map.present? # rubocop:disable Metrics/LineLength
77
+ raise Qa::InvalidConfiguration, "must specify label_ldpath or label_predicate in search configuration for linked data authority #{authority_name} (label_ldpath is preferred)" unless ldpath_map.key?(:label) || predicate_map.key?(:label) # rubocop:disable Metrics/LineLength
78
78
 
79
79
  if predicate_map.present?
80
80
  Qa.deprecation_warning(
81
81
  in_msg: 'Qa::Authorities::LinkedData::SearchQuery',
82
- msg: 'defining results using predicates in search config is deprecated; update to define using ldpaths'
82
+ msg: "defining results using predicates in search config is deprecated; update to define using ldpaths (authority: #{authority_name})"
83
83
  )
84
84
  end
85
85
 
86
- results_mapper_service.map_values(graph: @graph, prefixes: prefixes, ldpath_map: ldpath_map,
86
+ results_mapper_service.map_values(graph: filtered_graph, prefixes: prefixes, ldpath_map: ldpath_map,
87
87
  predicate_map: predicate_map, sort_key: :sort,
88
88
  preferred_language: @language, context_map: context_map)
89
89
  end
@@ -119,7 +119,7 @@ module Qa::Authorities
119
119
  end
120
120
 
121
121
  def preds_for_search
122
- label_pred_uri = search_config.results_label_predicate
122
+ label_pred_uri = search_config.results_label_predicate(suppress_deprecation_warning: true)
123
123
  return {} if label_pred_uri.blank?
124
124
  preds = { label: label_pred_uri, uri: :subject_uri }
125
125
  preds[:altlabel] = search_config.results_altlabel_predicate unless search_config.results_altlabel_predicate.nil?
@@ -1,3 +1,3 @@
1
1
  module Qa
2
- VERSION = "4.1.0".freeze
2
+ VERSION = "4.1.1".freeze
3
3
  end
@@ -0,0 +1,68 @@
1
+ <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
2
+ <madsrdf:Topic rdf:about="http://id.loc.gov/authorities/subjects/sh1234" xmlns:madsrdf="http://www.loc.gov/mads/rdf/v1#">
3
+ <rdf:type rdf:resource="http://www.loc.gov/mads/rdf/v1#Authority"/>
4
+ <madsrdf:authoritativeLabel xml:lang="en">More Science</madsrdf:authoritativeLabel>
5
+ <madsrdf:elementList rdf:parseType="Collection">
6
+ <madsrdf:TopicElement>
7
+ <madsrdf:elementValue xml:lang="en">More Science</madsrdf:elementValue>
8
+ </madsrdf:TopicElement>
9
+ </madsrdf:elementList>
10
+ <madsrdf:hasVariant>
11
+ <madsrdf:Topic>
12
+ <rdf:type rdf:resource="http://www.loc.gov/mads/rdf/v1#Variant"/>
13
+ <madsrdf:variantLabel xml:lang="en">More Natural science</madsrdf:variantLabel>
14
+ <madsrdf:elementList rdf:parseType="Collection">
15
+ <madsrdf:TopicElement>
16
+ <madsrdf:elementValue xml:lang="en">More Natural science</madsrdf:elementValue>
17
+ </madsrdf:TopicElement>
18
+ </madsrdf:elementList>
19
+ </madsrdf:Topic>
20
+ </madsrdf:hasVariant>
21
+ <madsrdf:hasVariant>
22
+ <madsrdf:Topic>
23
+ <rdf:type rdf:resource="http://www.loc.gov/mads/rdf/v1#Variant"/>
24
+ <madsrdf:variantLabel xml:lang="en">More Science of science</madsrdf:variantLabel>
25
+ <madsrdf:elementList rdf:parseType="Collection">
26
+ <madsrdf:TopicElement>
27
+ <madsrdf:elementValue xml:lang="en">More Science of science</madsrdf:elementValue>
28
+ </madsrdf:TopicElement>
29
+ </madsrdf:elementList>
30
+ </madsrdf:Topic>
31
+ </madsrdf:hasVariant>
32
+ <madsrdf:hasVariant>
33
+ <madsrdf:Topic>
34
+ <rdf:type rdf:resource="http://www.loc.gov/mads/rdf/v1#Variant"/>
35
+ <madsrdf:variantLabel xml:lang="en">More Sciences</madsrdf:variantLabel>
36
+ <madsrdf:elementList rdf:parseType="Collection">
37
+ <madsrdf:TopicElement>
38
+ <madsrdf:elementValue xml:lang="en">More Sciences</madsrdf:elementValue>
39
+ </madsrdf:TopicElement>
40
+ </madsrdf:elementList>
41
+ </madsrdf:Topic>
42
+ </madsrdf:hasVariant>
43
+ <identifiers:lccn xmlns:identifiers="http://id.loc.gov/vocabulary/identifiers/">sh 1234</identifiers:lccn>
44
+ <rdf:type rdf:resource="http://www.w3.org/2004/02/skos/core#Concept"/>
45
+ <skos:prefLabel xml:lang="en" xmlns:skos="http://www.w3.org/2004/02/skos/core#">More Science</skos:prefLabel>
46
+ <skosxl:altLabel xmlns:skosxl="http://www.w3.org/2008/05/skos-xl#">
47
+ <rdf:Description>
48
+ <rdf:type rdf:resource="http://www.w3.org/2008/05/skos-xl#Label"/>
49
+ <skosxl:literalForm xml:lang="en">More Natural science</skosxl:literalForm>
50
+ </rdf:Description>
51
+ </skosxl:altLabel>
52
+ <skosxl:altLabel xmlns:skosxl="http://www.w3.org/2008/05/skos-xl#">
53
+ <rdf:Description>
54
+ <rdf:type rdf:resource="http://www.w3.org/2008/05/skos-xl#Label"/>
55
+ <skosxl:literalForm xml:lang="en">More Science of science</skosxl:literalForm>
56
+ </rdf:Description>
57
+ </skosxl:altLabel>
58
+ <skosxl:altLabel xmlns:skosxl="http://www.w3.org/2008/05/skos-xl#">
59
+ <rdf:Description>
60
+ <rdf:type rdf:resource="http://www.w3.org/2008/05/skos-xl#Label"/>
61
+ <skosxl:literalForm xml:lang="en">More Sciences</skosxl:literalForm>
62
+ </rdf:Description>
63
+ </skosxl:altLabel>
64
+ <skos:altLabel xml:lang="en" xmlns:skos="http://www.w3.org/2004/02/skos/core#">More Natural science</skos:altLabel>
65
+ <skos:altLabel xml:lang="en" xmlns:skos="http://www.w3.org/2004/02/skos/core#">More Science of science</skos:altLabel>
66
+ <skos:altLabel xml:lang="en" xmlns:skos="http://www.w3.org/2004/02/skos/core#">More Sciences</skos:altLabel>
67
+ </madsrdf:Topic>
68
+ </rdf:RDF>
@@ -95,11 +95,17 @@ RSpec.describe Qa::Authorities::LinkedData::FindTerm do
95
95
 
96
96
  context 'in LOC authority' do
97
97
  context 'term found' do
98
- let :results do
98
+ before do
99
99
  stub_request(:get, 'http://id.loc.gov/authorities/subjects/sh85118553')
100
100
  .to_return(status: 200, body: webmock_fixture('lod_loc_term_found.rdf.xml'), headers: { 'Content-Type' => 'application/rdf+xml' })
101
- lod_loc.find('sh 85118553', subauth: 'subjects')
101
+ stub_request(:get, 'http://id.loc.gov/authorities/subjects/sh1234')
102
+ .to_return(status: 200, body: webmock_fixture('lod_loc_second_term_found.rdf.xml'), headers: { 'Content-Type' => 'application/rdf+xml' })
102
103
  end
104
+
105
+ let(:results) { lod_loc.find('sh 85118553', subauth: 'subjects') }
106
+ let(:second_results) { lod_loc.find('sh 1234', subauth: 'subjects') }
107
+ let(:results_without_blank) { lod_loc.find('sh85118553', subauth: 'subjects') }
108
+
103
109
  it 'has correct primary predicate values' do
104
110
  expect(results[:uri]).to eq 'http://id.loc.gov/authorities/subjects/sh85118553'
105
111
  expect(results[:uri]).to be_kind_of String
@@ -156,6 +162,19 @@ RSpec.describe Qa::Authorities::LinkedData::FindTerm do
156
162
  .to eq ['headings beginning with the word [Scientific;] and subdivision [Science] under ethnic groups and individual wars, e.g. [World War, 1939-1945--Science]']
157
163
  expect(results['predicates']['http://www.w3.org/2004/02/skos/core#inScheme']).to eq ['http://id.loc.gov/authorities/subjects']
158
164
  end
165
+
166
+ it 'has correct primary predicate values for second request' do
167
+ expect(results[:uri]).to eq 'http://id.loc.gov/authorities/subjects/sh85118553'
168
+ expect(second_results[:uri]).to eq 'http://id.loc.gov/authorities/subjects/sh1234'
169
+ expect(second_results[:uri]).to be_kind_of String
170
+ expect(second_results[:id]).to eq 'sh 1234'
171
+ expect(second_results[:label]).to eq ['More Science']
172
+ expect(second_results[:altlabel]).to include('More Natural science', 'More Science of science', 'More Sciences')
173
+ end
174
+
175
+ it 'extracts correct uri when loc id does not have blank' do
176
+ expect(results_without_blank[:uri]).to eq 'http://id.loc.gov/authorities/subjects/sh85118553'
177
+ end
159
178
  end
160
179
  end
161
180
 
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: 4.1.0
4
+ version: 4.1.1
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: 2019-05-06 00:00:00.000000000 Z
19
+ date: 2019-05-08 00:00:00.000000000 Z
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
22
22
  name: activerecord-import
@@ -487,6 +487,7 @@ files:
487
487
  - spec/fixtures/lod_lang_term_enfr_noalt.rdf.xml
488
488
  - spec/fixtures/lod_lang_term_enfrde.rdf.xml
489
489
  - spec/fixtures/lod_lang_term_fr.rdf.xml
490
+ - spec/fixtures/lod_loc_second_term_found.rdf.xml
490
491
  - spec/fixtures/lod_loc_term_found.rdf.xml
491
492
  - spec/fixtures/lod_oclc_all_query_3_results.rdf.xml
492
493
  - spec/fixtures/lod_oclc_personalName_query_3_results.rdf.xml
@@ -697,6 +698,7 @@ test_files:
697
698
  - spec/fixtures/lod_oclc_term_found.rdf.xml
698
699
  - spec/fixtures/lod_search_with_blanknode_subjects.nt
699
700
  - spec/fixtures/assign-fast-noheader.json
701
+ - spec/fixtures/lod_loc_second_term_found.rdf.xml
700
702
  - spec/fixtures/lod_lang_search_enfrde.rdf.xml
701
703
  - spec/fixtures/funders-result.json
702
704
  - spec/fixtures/lod_lang_search_sv.rdf.xml