Skip to content

Commit

Permalink
cops
Browse files Browse the repository at this point in the history
  • Loading branch information
mdholloway committed Jan 8, 2025
1 parent b5f12a4 commit 3a8ccfe
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 11 deletions.
10 changes: 5 additions & 5 deletions lib/digital_scriptorium/claim_transformer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@ def self.transform(claim, export_hash, config)
solr_props["#{prefix}_display"] = [{ 'PV' => value }.to_json] if requested_fields.include? 'display'
solr_props["#{prefix}_search"] = [value] if requested_fields.include? 'search'
solr_props["#{prefix}_facet"] = [value] if requested_fields.include? 'facet'

solr_props['images_facet'] = ['Yes'] if value && claim.property_id == IIIF_MANIFEST
solr_props["#{prefix}_link"] = [value] if requested_fields.include? 'link'

return solr_props
end

Expand All @@ -40,18 +40,18 @@ def self.transform(claim, export_hash, config)

authority_id = qualifier.entity_id_value
authority = export_hash[authority_id]

if authority
label = authority.label('en')

display_props['QL'] = label
search_entries << label
facets << label

external_uri = authority.claim_by_property_id(EXTERNAL_URI)&.data_value
wikidata_id = authority.claim_by_property_id(WIKIDATA_QID)&.data_value
wikidata_uri = wikidata_id && "https://www.wikidata.org/wiki/#{wikidata_id}"

# Only one or the other of these seem to exist for a given item in practice.
display_props['QU'] = external_uri if external_uri
display_props['QU'] = wikidata_uri if wikidata_uri
Expand Down
8 changes: 4 additions & 4 deletions spec/digital_scriptorium/claim_transformer_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -161,10 +161,10 @@ module DigitalScriptorium
'Provence',
'Spain'
],
'place_facet' => [
'Provence',
'Spain'
],
'place_facet' => %w[
Provence
Spain
]
}
expect(solr_item).to eq(expected)
end
Expand Down
5 changes: 3 additions & 2 deletions spec/digital_scriptorium/name_claim_transformer_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ module DigitalScriptorium
let(:schoenberg_json) { File.read(File.expand_path('../fixtures/items/schoenberg.json', __dir__)) }

let(:name_multiple_qualifier_values_json) { File.read(File.expand_path('../fixtures/claims/qualified/name_multiple_qualifier_values.json', __dir__)) }
let(:name_multiple_qualifier_values_claim) { StatementRepresenter.new(Statement.new).from_json(name_multiple_qualifier_values_json) }
let(:name_multiple_qualifier_values_claim) { StatementRepresenter.new(Statement.new).from_json(name_multiple_qualifier_values_json) }
let(:deste_json) { File.read(File.expand_path('../fixtures/items/deste.json', __dir__)) }
let(:llangattock_json) { File.read(File.expand_path('../fixtures/items/llangattock.json', __dir__)) }

Expand Down Expand Up @@ -40,7 +40,8 @@ module DigitalScriptorium
expected = {
'owner_display' => [
'{"PV":"From the codex made for Leonello d\'Este. Brought to Wales as war booty by 1813, already in a damaged state, by the Rolls family, later enobled as Barons Llangattock, of The Hendre, Monmouth (Llangattock sale, London, Christie\'s, 8 December 1958, lot 190);","QL":"Leonello d\'Este, Marquis of Ferrara","QU":"https://www.wikidata.org/wiki/Q1379797"}',
'{"PV":"From the codex made for Leonello d\'Este. Brought to Wales as war booty by 1813, already in a damaged state, by the Rolls family, later enobled as Barons Llangattock, of The Hendre, Monmouth (Llangattock sale, London, Christie\'s, 8 December 1958, lot 190);","QL":"Baron Llangattock","QU":"https://www.wikidata.org/wiki/Q4862572"}'],
'{"PV":"From the codex made for Leonello d\'Este. Brought to Wales as war booty by 1813, already in a damaged state, by the Rolls family, later enobled as Barons Llangattock, of The Hendre, Monmouth (Llangattock sale, London, Christie\'s, 8 December 1958, lot 190);","QL":"Baron Llangattock","QU":"https://www.wikidata.org/wiki/Q4862572"}'
],
'owner_search' => [
'From the codex made for Leonello d\'Este. Brought to Wales as war booty by 1813, already in a damaged state, by the Rolls family, later enobled as Barons Llangattock, of The Hendre, Monmouth (Llangattock sale, London, Christie\'s, 8 December 1958, lot 190);',
'Leonello d\'Este, Marquis of Ferrara',
Expand Down

0 comments on commit 3a8ccfe

Please sign in to comment.