digital_scriptorium 0.1.0 → 0.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
  SHA256:
3
- metadata.gz: '085e39f712849a9c7e65b62b1f9a7715830b60a87adad5d67607f42f74535304'
4
- data.tar.gz: 8739348215acc0f8df17b17155df21ed641ffff4845d4d72a6ab3c9652e9cfca
3
+ metadata.gz: 3807e9213ad2ab1c09f54bfa69bc5e10c8f75d4e83b9d51df21c6125e368825e
4
+ data.tar.gz: 0cd270031c0aef720b56194996ba2e3c8784af438c1392009d9af3fc53db0dc9
5
5
  SHA512:
6
- metadata.gz: f8d519fa3b4246f3c182738d4ad42567046dbf0d691a3f07958809669ace36b25d2f4697b1671f46bff0fae97c9692d389b108696c334252708377a68320906a
7
- data.tar.gz: 50f9861fb347aee4fc8a556ffc013009c23b84ac631c17fc705e4466852ea63a617c06aae5718431df908035d258928615b64a2bdf45cbaa16e46efc684d90d1
6
+ metadata.gz: 46c0135217a0511f4fd086984be394a32951f9894b57e331b774e4e05ac52d7446c18320581dc16862af5d0abd14c2b045a8e5369113463e7284e7fbf443dc9d
7
+ data.tar.gz: 6571a3a471d338a9a7ea2ee5db7e01d76dd57d00abe90af68fc6eeb22c178343072e5f59144a4b6665116c7079a8a19b56e16510733688b86894bec17b3572bf
data/doc/overview.md CHANGED
@@ -10,4 +10,4 @@ The conversion script [wikibase_to_solr_new.rb](../wikibase_to_solr_new.rb) proc
10
10
 
11
11
  The specific Solr fields produced for each claim are controlled by the configuration file [property_config.yml](../property_config.yml). This file also defines the prefix (representing the property name) to be attached to each field for a given property, and whether a claim based on the property might have a related authority qualifier.
12
12
 
13
- The script was written so as not to rely on the structure of the export file beyond that it will be a JSON array of Wikibase entities, with records linked to manuscripts and manuscripts linked to holdings by P3 (described manuscript) and P2 (holding) claims respectively.
13
+ The script was written so as not to rely on the structure of the export file beyond that it will be a JSON array consisting of all entities in the DS 2.0 Wikibase, with record items linked to manuscript items and manuscript items linked to holding items by P3 (described manuscript) and P2 (holding) claims respectively.
@@ -20,39 +20,49 @@ module DigitalScriptorium
20
20
  solr_props['id'] = [value] if requested_fields.include? 'id'
21
21
  solr_props["#{prefix}_meta"] = [value] if requested_fields.include? 'meta'
22
22
 
23
- display_props = { 'PV' => value }
23
+ unless authority_property_id && claim.qualifiers_by_property_id?(authority_property_id)
24
+ solr_props["#{prefix}_display"] = [{ 'PV' => value }.to_json] if requested_fields.include? 'display'
25
+ solr_props["#{prefix}_search"] = [value] if requested_fields.include? 'search'
26
+ solr_props["#{prefix}_facet"] = [value] if requested_fields.include? 'facet'
24
27
 
25
- if authority_property_id && claim.qualifiers_by_property_id?(authority_property_id)
26
- authority_id = claim.qualifier_by_property_id(authority_property_id).entity_id_value
28
+ solr_props['images_facet'] = ['Yes'] if value && claim.property_id == IIIF_MANIFEST
29
+ solr_props["#{prefix}_link"] = [value] if requested_fields.include? 'link'
30
+
31
+ return solr_props
32
+ end
33
+
34
+ display_entries = []
35
+ search_entries = [value]
36
+ facets = []
37
+
38
+ claim.qualifiers_by_property_id(authority_property_id).each do |qualifier|
39
+ display_props = { 'PV' => value }
40
+
41
+ authority_id = qualifier.entity_id_value
27
42
  authority = export_hash[authority_id]
28
43
 
29
44
  if authority
30
45
  label = authority.label('en')
46
+
31
47
  display_props['QL'] = label
48
+ search_entries << label
49
+ facets << label
32
50
 
33
51
  external_uri = authority.claim_by_property_id(EXTERNAL_URI)&.data_value
34
-
35
52
  wikidata_id = authority.claim_by_property_id(WIKIDATA_QID)&.data_value
36
53
  wikidata_uri = wikidata_id && "https://www.wikidata.org/wiki/#{wikidata_id}"
37
54
 
38
55
  # Only one or the other of these seem to exist for a given item in practice.
39
56
  display_props['QU'] = external_uri if external_uri
40
57
  display_props['QU'] = wikidata_uri if wikidata_uri
41
-
42
- solr_props["#{config['prefix']}_display"] = [display_props.to_json] if config['fields'].include? 'display'
43
- solr_props["#{config['prefix']}_search"] = [value, label].uniq if config['fields'].include? 'search'
44
- solr_props["#{config['prefix']}_facet"] = [label] if config['fields'].include? 'facet'
45
-
46
- return solr_props
47
58
  end
48
- end
49
59
 
50
- solr_props["#{config['prefix']}_display"] = [display_props.to_json] if config['fields'].include? 'display'
51
- solr_props["#{config['prefix']}_search"] = [value] if config['fields'].include? 'search'
52
- solr_props["#{config['prefix']}_facet"] = [value] if config['fields'].include? 'facet'
60
+ display_entries << display_props.to_json
61
+ end
53
62
 
54
- solr_props['images_facet'] = ['Yes'] if value && claim.property_id == IIIF_MANIFEST
55
- solr_props["#{config['prefix']}_link"] = [value] if config['fields'].include? 'link'
63
+ solr_props["#{prefix}_display"] = display_entries.uniq if requested_fields.include? 'display'
64
+ solr_props["#{prefix}_search"] = search_entries.uniq if requested_fields.include? 'search'
65
+ solr_props["#{prefix}_facet"] = facets.uniq if requested_fields.include? 'facet'
56
66
 
57
67
  solr_props
58
68
  end
@@ -29,21 +29,32 @@ module DigitalScriptorium
29
29
  }
30
30
  end
31
31
 
32
- name_entity_id = claim.qualifier_by_property_id(NAME_IN_AUTHORITY_FILE).entity_id_value
33
- name_item = export_hash[name_entity_id]
34
- name_label = name_item.label('en')
32
+ display_entries = []
33
+ facets = []
35
34
 
36
- wikidata_id = name_item.claim_by_property_id(WIKIDATA_QID).data_value
37
- wikidata_url = "https://www.wikidata.org/wiki/#{wikidata_id}"
35
+ claim.qualifiers_by_property_id(NAME_IN_AUTHORITY_FILE).each do |qualifier|
36
+ display_names_for_qualifier = { 'PV' => recorded_name }
37
+ display_names_for_qualifier['AGR'] = name_in_original_script if name_in_original_script
38
38
 
39
- search_names << name_label
40
- display_names['QL'] = name_label
41
- display_names['QU'] = wikidata_url if wikidata_url
39
+ name_entity_id = qualifier.entity_id_value
40
+ name_item = export_hash[name_entity_id]
41
+ name_label = name_item.label('en')
42
+
43
+ display_names_for_qualifier['QL'] = name_label
44
+ search_names << name_label
45
+ facets << name_label
46
+
47
+ wikidata_id = name_item.claim_by_property_id(WIKIDATA_QID).data_value
48
+ wikidata_url = "https://www.wikidata.org/wiki/#{wikidata_id}"
49
+ display_names_for_qualifier['QU'] = wikidata_url if wikidata_url
50
+
51
+ display_entries << display_names_for_qualifier.to_json
52
+ end
42
53
 
43
54
  {
44
- "#{prefix}_display" => [display_names.to_json],
45
- "#{prefix}_search" => search_names,
46
- "#{prefix}_facet" => [name_label]
55
+ "#{prefix}_display" => display_entries.uniq,
56
+ "#{prefix}_search" => search_names.uniq,
57
+ "#{prefix}_facet" => facets.uniq
47
58
  }
48
59
  end
49
60
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module DigitalScriptorium
4
- VERSION = '0.1.0'
4
+ VERSION = '0.1.1'
5
5
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: digital_scriptorium
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Holloway
8
8
  bindir: exe
9
9
  cert_chain: []
10
- date: 2025-01-06 00:00:00.000000000 Z
10
+ date: 2025-01-08 00:00:00.000000000 Z
11
11
  dependencies:
12
12
  - !ruby/object:Gem::Dependency
13
13
  name: multi_json