qa 4.0.0.rc2 → 4.0.0.rc3
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
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: de32b8faa17be4ebfa99c1bde6b357cacb1beb3f
|
4
|
+
data.tar.gz: 5b1a2952d54233aedad9d2981113ac99d3279106
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6436875ac41e2da533c468342247b85e2964176779378df25f2a8faab7426538d3ff4975d10bd392952aa68cde811ac7b6defb9564f644a35a889087d5a1a433
|
7
|
+
data.tar.gz: c5e8c5375474db838240a77507e2d08255614c26243eddb8945c70d659b3a219e3859ab312b2c9eaa836fcb133d2c15e5d7fca515ff91b97630e65d28536e004
|
@@ -68,11 +68,15 @@ module Qa::Authorities
|
|
68
68
|
preds = { label: label_pred_uri }
|
69
69
|
preds[:uri] = :subject_uri
|
70
70
|
preds[:altlabel] = search_config.results_altlabel_predicate unless search_config.results_altlabel_predicate.nil?
|
71
|
-
preds[:id] =
|
71
|
+
preds[:id] = id_predicate.present? ? id_predicate : :subject_uri
|
72
72
|
preds[:sort] = sort_predicate.present? ? sort_predicate : preds[:label]
|
73
73
|
preds
|
74
74
|
end
|
75
75
|
|
76
|
+
def id_predicate
|
77
|
+
@id_predicate ||= search_config.results_id_predicate
|
78
|
+
end
|
79
|
+
|
76
80
|
def sort_predicate
|
77
81
|
@sort_predicate ||= search_config.results_sort_predicate
|
78
82
|
end
|
@@ -86,7 +90,7 @@ module Qa::Authorities
|
|
86
90
|
def convert_result_to_json(result)
|
87
91
|
json_result = {}
|
88
92
|
json_result[:uri] = result[:uri].first.to_s
|
89
|
-
json_result[:id] = result[:id].first.to_s
|
93
|
+
json_result[:id] = result[:id].any? ? result[:id].first.to_s : ""
|
90
94
|
json_result[:label] = full_label(result[:label], result[:altlabel])
|
91
95
|
json_result[:context] = result[:context] if context?
|
92
96
|
json_result
|
data/lib/qa/version.rb
CHANGED
@@ -58,6 +58,21 @@ RSpec.describe Qa::Authorities::LinkedData::GenericAuthority do
|
|
58
58
|
end
|
59
59
|
end
|
60
60
|
|
61
|
+
context 'when id predicate is not specified' do
|
62
|
+
let(:min_authority) { described_class.new(:LOD_MIN_CONFIG) }
|
63
|
+
let :results do
|
64
|
+
stub_request(:get, 'http://localhost/test_default/search?query=peanuts')
|
65
|
+
.to_return(status: 200, body: webmock_fixture('lod_oclc_personalName_query_3_results.rdf.xml'), headers: { 'Content-Type' => 'application/rdf+xml' })
|
66
|
+
min_authority.search('peanuts')
|
67
|
+
end
|
68
|
+
it 'uses subject uri for id' do
|
69
|
+
expect(results.count).to eq(3)
|
70
|
+
expect(results.first).to eq(uri: 'http://id.worldcat.org/fast/409667', id: 'http://id.worldcat.org/fast/409667', label: 'Cornell, Ezra, 1807-1874')
|
71
|
+
expect(results.second).to eq(uri: 'http://id.worldcat.org/fast/5140', id: 'http://id.worldcat.org/fast/5140', label: 'Cornell, Joseph')
|
72
|
+
expect(results.third).to eq(uri: 'http://id.worldcat.org/fast/72456', id: 'http://id.worldcat.org/fast/72456', label: 'Cornell, Sarah Maria, 1802-1832')
|
73
|
+
end
|
74
|
+
end
|
75
|
+
|
61
76
|
# context 'in LOC authority' do
|
62
77
|
# ###################################
|
63
78
|
# ### SEARCH NOT SUPPORTED BY LOC ###
|