dog_biscuits 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (272) hide show
  1. checksums.yaml +7 -0
  2. data/.circleci/config.yml +115 -0
  3. data/.codeclimate.yml +52 -0
  4. data/.gitignore +24 -0
  5. data/.rspec +3 -0
  6. data/.rubocop.yml +45 -0
  7. data/.rubocop_todo.yml +92 -0
  8. data/.travis.yml +18 -0
  9. data/CODE_OF_CONDUCT.md +36 -0
  10. data/CONTRIBUTING.md +161 -0
  11. data/Gemfile +40 -0
  12. data/LICENSE +14 -0
  13. data/README.md +98 -0
  14. data/Rakefile +35 -0
  15. data/SUPPORT.md +5 -0
  16. data/bin/console +15 -0
  17. data/bin/setup +7 -0
  18. data/dog_biscuits.gemspec +38 -0
  19. data/lib/dog_biscuits.rb +352 -0
  20. data/lib/dog_biscuits/actors/apply_authorities.rb +32 -0
  21. data/lib/dog_biscuits/actors/singular_attributes.rb +17 -0
  22. data/lib/dog_biscuits/blacklight/commands.rb +118 -0
  23. data/lib/dog_biscuits/configuration.rb +506 -0
  24. data/lib/dog_biscuits/importers/authority.rb +65 -0
  25. data/lib/dog_biscuits/indexers/collection_indexer.rb +10 -0
  26. data/lib/dog_biscuits/indexers/concerns/indexes_common.rb +58 -0
  27. data/lib/dog_biscuits/indexers/conference_item_indexer.rb +17 -0
  28. data/lib/dog_biscuits/indexers/dataset_indexer.rb +25 -0
  29. data/lib/dog_biscuits/indexers/digital_archival_object_indexer.rb +19 -0
  30. data/lib/dog_biscuits/indexers/exam_paper_indexer.rb +10 -0
  31. data/lib/dog_biscuits/indexers/journal_article_indexer.rb +15 -0
  32. data/lib/dog_biscuits/indexers/package_indexer.rb +19 -0
  33. data/lib/dog_biscuits/indexers/published_work_indexer.rb +16 -0
  34. data/lib/dog_biscuits/indexers/thesis_indexer.rb +16 -0
  35. data/lib/dog_biscuits/models/authorities/agent.rb +78 -0
  36. data/lib/dog_biscuits/models/authorities/agents/group.rb +59 -0
  37. data/lib/dog_biscuits/models/authorities/agents/historic_person.rb +55 -0
  38. data/lib/dog_biscuits/models/authorities/agents/organisation.rb +56 -0
  39. data/lib/dog_biscuits/models/authorities/agents/person.rb +75 -0
  40. data/lib/dog_biscuits/models/authorities/concept.rb +91 -0
  41. data/lib/dog_biscuits/models/authorities/concept_scheme.rb +65 -0
  42. data/lib/dog_biscuits/models/authorities/event.rb +74 -0
  43. data/lib/dog_biscuits/models/authorities/place.rb +86 -0
  44. data/lib/dog_biscuits/models/authorities/project.rb +60 -0
  45. data/lib/dog_biscuits/models/authority.rb +42 -0
  46. data/lib/dog_biscuits/models/collections/collection.rb +32 -0
  47. data/lib/dog_biscuits/models/concerns/behaviours/pure_specific_behaviour.rb +17 -0
  48. data/lib/dog_biscuits/models/concerns/behaviours/validate_concept_related.rb +12 -0
  49. data/lib/dog_biscuits/models/concerns/behaviours/validate_concept_scheme.rb +16 -0
  50. data/lib/dog_biscuits/models/concerns/behaviours/validate_label.rb +12 -0
  51. data/lib/dog_biscuits/models/concerns/behaviours/validate_place.rb +12 -0
  52. data/lib/dog_biscuits/models/concerns/behaviours/work_behaviour.rb +21 -0
  53. data/lib/dog_biscuits/models/concerns/extended_solr_document.rb +147 -0
  54. data/lib/dog_biscuits/models/concerns/metadata_properties/archivematica/archivematica.rb +73 -0
  55. data/lib/dog_biscuits/models/concerns/metadata_properties/archives_hub/access_provided_by.rb +14 -0
  56. data/lib/dog_biscuits/models/concerns/metadata_properties/archives_hub/country_code.rb +15 -0
  57. data/lib/dog_biscuits/models/concerns/metadata_properties/archives_hub/hub_dates.rb +17 -0
  58. data/lib/dog_biscuits/models/concerns/metadata_properties/archives_hub/maintenance_agency_code.rb +15 -0
  59. data/lib/dog_biscuits/models/concerns/metadata_properties/bibframe/awarding_institution.rb +13 -0
  60. data/lib/dog_biscuits/models/concerns/metadata_properties/bibframe/edition.rb +13 -0
  61. data/lib/dog_biscuits/models/concerns/metadata_properties/bibframe/identified_by.rb +14 -0
  62. data/lib/dog_biscuits/models/concerns/metadata_properties/bibframe/part.rb +13 -0
  63. data/lib/dog_biscuits/models/concerns/metadata_properties/bibframe/part_of.rb +14 -0
  64. data/lib/dog_biscuits/models/concerns/metadata_properties/bibframe/series.rb +13 -0
  65. data/lib/dog_biscuits/models/concerns/metadata_properties/bibframe/subtitle.rb +14 -0
  66. data/lib/dog_biscuits/models/concerns/metadata_properties/bibo/presented_at.rb +13 -0
  67. data/lib/dog_biscuits/models/concerns/metadata_properties/bibo/publication_status.rb +13 -0
  68. data/lib/dog_biscuits/models/concerns/metadata_properties/datacite/resource_type_general.rb +13 -0
  69. data/lib/dog_biscuits/models/concerns/metadata_properties/dc/abstract.rb +14 -0
  70. data/lib/dog_biscuits/models/concerns/metadata_properties/dc/access_rights.rb +14 -0
  71. data/lib/dog_biscuits/models/concerns/metadata_properties/dc/bibliographic_citation.rb +13 -0
  72. data/lib/dog_biscuits/models/concerns/metadata_properties/dc/contributor.rb +14 -0
  73. data/lib/dog_biscuits/models/concerns/metadata_properties/dc/creator.rb +14 -0
  74. data/lib/dog_biscuits/models/concerns/metadata_properties/dc/date.rb +13 -0
  75. data/lib/dog_biscuits/models/concerns/metadata_properties/dc/date_accepted.rb +13 -0
  76. data/lib/dog_biscuits/models/concerns/metadata_properties/dc/date_available.rb +14 -0
  77. data/lib/dog_biscuits/models/concerns/metadata_properties/dc/date_copyrighted.rb +14 -0
  78. data/lib/dog_biscuits/models/concerns/metadata_properties/dc/date_created.rb +13 -0
  79. data/lib/dog_biscuits/models/concerns/metadata_properties/dc/date_issued.rb +14 -0
  80. data/lib/dog_biscuits/models/concerns/metadata_properties/dc/description.rb +14 -0
  81. data/lib/dog_biscuits/models/concerns/metadata_properties/dc/extent.rb +13 -0
  82. data/lib/dog_biscuits/models/concerns/metadata_properties/dc/format.rb +13 -0
  83. data/lib/dog_biscuits/models/concerns/metadata_properties/dc/identifier.rb +13 -0
  84. data/lib/dog_biscuits/models/concerns/metadata_properties/dc/language.rb +17 -0
  85. data/lib/dog_biscuits/models/concerns/metadata_properties/dc/publisher.rb +14 -0
  86. data/lib/dog_biscuits/models/concerns/metadata_properties/dc/resource_type.rb +13 -0
  87. data/lib/dog_biscuits/models/concerns/metadata_properties/dc/rights.rb +17 -0
  88. data/lib/dog_biscuits/models/concerns/metadata_properties/dc/rights_holder.rb +14 -0
  89. data/lib/dog_biscuits/models/concerns/metadata_properties/dc/simple_versions.rb +18 -0
  90. data/lib/dog_biscuits/models/concerns/metadata_properties/dc/source.rb +13 -0
  91. data/lib/dog_biscuits/models/concerns/metadata_properties/dc/subject.rb +13 -0
  92. data/lib/dog_biscuits/models/concerns/metadata_properties/dwc/event_date.rb +14 -0
  93. data/lib/dog_biscuits/models/concerns/metadata_properties/edm/edm_rights.rb +13 -0
  94. data/lib/dog_biscuits/models/concerns/metadata_properties/fabio/date_collected.rb +15 -0
  95. data/lib/dog_biscuits/models/concerns/metadata_properties/foaf/based_near.rb +12 -0
  96. data/lib/dog_biscuits/models/concerns/metadata_properties/foaf/foaf_name.rb +16 -0
  97. data/lib/dog_biscuits/models/concerns/metadata_properties/frapo/output_of.rb +18 -0
  98. data/lib/dog_biscuits/models/concerns/metadata_properties/geo/geo.rb +27 -0
  99. data/lib/dog_biscuits/models/concerns/metadata_properties/geonames/country_code.rb +15 -0
  100. data/lib/dog_biscuits/models/concerns/metadata_properties/geonames/place_properties.rb +66 -0
  101. data/lib/dog_biscuits/models/concerns/metadata_properties/lc_identifiers/doi.rb +13 -0
  102. data/lib/dog_biscuits/models/concerns/metadata_properties/lc_identifiers/isbn.rb +13 -0
  103. data/lib/dog_biscuits/models/concerns/metadata_properties/lc_identifiers/official_url.rb +13 -0
  104. data/lib/dog_biscuits/models/concerns/metadata_properties/lc_identifiers/orcid.rb +13 -0
  105. data/lib/dog_biscuits/models/concerns/metadata_properties/local/for_indexing.rb +14 -0
  106. data/lib/dog_biscuits/models/concerns/metadata_properties/local/former_identifier.rb +13 -0
  107. data/lib/dog_biscuits/models/concerns/metadata_properties/local/generic_authority_terms.rb +22 -0
  108. data/lib/dog_biscuits/models/concerns/metadata_properties/local/generic_qualifier.rb +16 -0
  109. data/lib/dog_biscuits/models/concerns/metadata_properties/local/last_access.rb +15 -0
  110. data/lib/dog_biscuits/models/concerns/metadata_properties/local/main_file.rb +24 -0
  111. data/lib/dog_biscuits/models/concerns/metadata_properties/local/module_code.rb +13 -0
  112. data/lib/dog_biscuits/models/concerns/metadata_properties/local/number_of_downloads.rb +14 -0
  113. data/lib/dog_biscuits/models/concerns/metadata_properties/local/packaged_by.rb +13 -0
  114. data/lib/dog_biscuits/models/concerns/metadata_properties/local/readme_file.rb +26 -0
  115. data/lib/dog_biscuits/models/concerns/metadata_properties/local/requestor_email.rb +13 -0
  116. data/lib/dog_biscuits/models/concerns/metadata_properties/mads/related_authority.rb +14 -0
  117. data/lib/dog_biscuits/models/concerns/metadata_properties/marc_relators/advisor.rb +14 -0
  118. data/lib/dog_biscuits/models/concerns/metadata_properties/marc_relators/editor.rb +14 -0
  119. data/lib/dog_biscuits/models/concerns/metadata_properties/marc_relators/funder.rb +13 -0
  120. data/lib/dog_biscuits/models/concerns/metadata_properties/marc_relators/place_of_publication.rb +13 -0
  121. data/lib/dog_biscuits/models/concerns/metadata_properties/mods/date_valid.rb +14 -0
  122. data/lib/dog_biscuits/models/concerns/metadata_properties/owl/owl_same_as.rb +13 -0
  123. data/lib/dog_biscuits/models/concerns/metadata_properties/premis/has_restriction.rb +15 -0
  124. data/lib/dog_biscuits/models/concerns/metadata_properties/property_sets/person_properties.rb +92 -0
  125. data/lib/dog_biscuits/models/concerns/metadata_properties/pure/managing_organisation.rb +14 -0
  126. data/lib/dog_biscuits/models/concerns/metadata_properties/pure/pure.rb +28 -0
  127. data/lib/dog_biscuits/models/concerns/metadata_properties/rdf/rdf_type.rb +12 -0
  128. data/lib/dog_biscuits/models/concerns/metadata_properties/rdf/rdfs_label.rb +14 -0
  129. data/lib/dog_biscuits/models/concerns/metadata_properties/rdf/related_url.rb +13 -0
  130. data/lib/dog_biscuits/models/concerns/metadata_properties/schema/alternate_name.rb +13 -0
  131. data/lib/dog_biscuits/models/concerns/metadata_properties/schema/content_version.rb +13 -0
  132. data/lib/dog_biscuits/models/concerns/metadata_properties/schema/date_published.rb +13 -0
  133. data/lib/dog_biscuits/models/concerns/metadata_properties/schema/date_updated.rb +13 -0
  134. data/lib/dog_biscuits/models/concerns/metadata_properties/schema/department.rb +13 -0
  135. data/lib/dog_biscuits/models/concerns/metadata_properties/schema/end_date.rb +13 -0
  136. data/lib/dog_biscuits/models/concerns/metadata_properties/schema/issue_number.rb +13 -0
  137. data/lib/dog_biscuits/models/concerns/metadata_properties/schema/keyword.rb +13 -0
  138. data/lib/dog_biscuits/models/concerns/metadata_properties/schema/location.rb +13 -0
  139. data/lib/dog_biscuits/models/concerns/metadata_properties/schema/pagination.rb +13 -0
  140. data/lib/dog_biscuits/models/concerns/metadata_properties/schema/start_date.rb +13 -0
  141. data/lib/dog_biscuits/models/concerns/metadata_properties/schema/volume_number.rb +13 -0
  142. data/lib/dog_biscuits/models/concerns/metadata_properties/skos/skos_labels.rb +18 -0
  143. data/lib/dog_biscuits/models/concerns/metadata_properties/skos/skos_note.rb +13 -0
  144. data/lib/dog_biscuits/models/concerns/metadata_properties/skos/skos_related.rb +13 -0
  145. data/lib/dog_biscuits/models/concerns/metadata_properties/uketd/date_of_award.rb +13 -0
  146. data/lib/dog_biscuits/models/concerns/metadata_properties/uketd/qualification.rb +17 -0
  147. data/lib/dog_biscuits/models/concerns/metadata_properties/ulcc/date_submitted.rb +14 -0
  148. data/lib/dog_biscuits/models/concerns/metadata_properties/ulcc/official_url.rb +13 -0
  149. data/lib/dog_biscuits/models/concerns/metadata_properties/ulcc/refereed.rb +13 -0
  150. data/lib/dog_biscuits/models/concerns/model_property_sets/common/common_labels.rb +9 -0
  151. data/lib/dog_biscuits/models/concerns/model_property_sets/common/common_metadata.rb +64 -0
  152. data/lib/dog_biscuits/models/concerns/model_property_sets/common/common_rights.rb +10 -0
  153. data/lib/dog_biscuits/models/concerns/model_property_sets/conference_item_metadata.rb +24 -0
  154. data/lib/dog_biscuits/models/concerns/model_property_sets/dataset_metadata.rb +36 -0
  155. data/lib/dog_biscuits/models/concerns/model_property_sets/digital_archival_object_metadata.rb +13 -0
  156. data/lib/dog_biscuits/models/concerns/model_property_sets/exam_paper_metadata.rb +14 -0
  157. data/lib/dog_biscuits/models/concerns/model_property_sets/journal_article_metadata.rb +24 -0
  158. data/lib/dog_biscuits/models/concerns/model_property_sets/package_metadata.rb +13 -0
  159. data/lib/dog_biscuits/models/concerns/model_property_sets/published_work_metadata.rb +26 -0
  160. data/lib/dog_biscuits/models/concerns/model_property_sets/thesis_metadata.rb +17 -0
  161. data/lib/dog_biscuits/models/filesets/file_set.rb +30 -0
  162. data/lib/dog_biscuits/models/to_refactor_or_remove/canvas.rb +15 -0
  163. data/lib/dog_biscuits/models/to_refactor_or_remove/contained_file.rb +13 -0
  164. data/lib/dog_biscuits/models/to_refactor_or_remove/db/db_date_certainty.rb +5 -0
  165. data/lib/dog_biscuits/models/to_refactor_or_remove/db/db_editorial_note.rb +5 -0
  166. data/lib/dog_biscuits/models/to_refactor_or_remove/db/db_entry.rb +19 -0
  167. data/lib/dog_biscuits/models/to_refactor_or_remove/db/db_entry_date.rb +10 -0
  168. data/lib/dog_biscuits/models/to_refactor_or_remove/db/db_entry_type.rb +5 -0
  169. data/lib/dog_biscuits/models/to_refactor_or_remove/db/db_is_referenced_by.rb +5 -0
  170. data/lib/dog_biscuits/models/to_refactor_or_remove/db/db_language.rb +5 -0
  171. data/lib/dog_biscuits/models/to_refactor_or_remove/db/db_marginalium.rb +5 -0
  172. data/lib/dog_biscuits/models/to_refactor_or_remove/db/db_note.rb +5 -0
  173. data/lib/dog_biscuits/models/to_refactor_or_remove/db/db_person_as_written.rb +5 -0
  174. data/lib/dog_biscuits/models/to_refactor_or_remove/db/db_person_descriptor.rb +5 -0
  175. data/lib/dog_biscuits/models/to_refactor_or_remove/db/db_person_descriptor_as_written.rb +5 -0
  176. data/lib/dog_biscuits/models/to_refactor_or_remove/db/db_person_note.rb +5 -0
  177. data/lib/dog_biscuits/models/to_refactor_or_remove/db/db_person_related_person.rb +5 -0
  178. data/lib/dog_biscuits/models/to_refactor_or_remove/db/db_person_related_place.rb +5 -0
  179. data/lib/dog_biscuits/models/to_refactor_or_remove/db/db_person_role.rb +5 -0
  180. data/lib/dog_biscuits/models/to_refactor_or_remove/db/db_place_as_written.rb +5 -0
  181. data/lib/dog_biscuits/models/to_refactor_or_remove/db/db_place_note.rb +5 -0
  182. data/lib/dog_biscuits/models/to_refactor_or_remove/db/db_place_role.rb +5 -0
  183. data/lib/dog_biscuits/models/to_refactor_or_remove/db/db_place_type.rb +5 -0
  184. data/lib/dog_biscuits/models/to_refactor_or_remove/db/db_related_agent.rb +20 -0
  185. data/lib/dog_biscuits/models/to_refactor_or_remove/db/db_related_place.rb +13 -0
  186. data/lib/dog_biscuits/models/to_refactor_or_remove/db/db_section_type.rb +5 -0
  187. data/lib/dog_biscuits/models/to_refactor_or_remove/db/db_single_date.rb +10 -0
  188. data/lib/dog_biscuits/models/to_refactor_or_remove/db/db_subject.rb +5 -0
  189. data/lib/dog_biscuits/models/to_refactor_or_remove/entry.rb +59 -0
  190. data/lib/dog_biscuits/models/to_refactor_or_remove/entry/entry_date.rb +17 -0
  191. data/lib/dog_biscuits/models/to_refactor_or_remove/entry/related_agent.rb +62 -0
  192. data/lib/dog_biscuits/models/to_refactor_or_remove/entry/related_place.rb +28 -0
  193. data/lib/dog_biscuits/models/to_refactor_or_remove/entry/single_date.rb +19 -0
  194. data/lib/dog_biscuits/models/to_refactor_or_remove/folio.rb +42 -0
  195. data/lib/dog_biscuits/models/to_refactor_or_remove/image.rb +25 -0
  196. data/lib/dog_biscuits/models/to_refactor_or_remove/manifest.rb +15 -0
  197. data/lib/dog_biscuits/models/to_refactor_or_remove/register.rb +21 -0
  198. data/lib/dog_biscuits/models/work.rb +37 -0
  199. data/lib/dog_biscuits/models/works/conference_item.rb +37 -0
  200. data/lib/dog_biscuits/models/works/dataset.rb +42 -0
  201. data/lib/dog_biscuits/models/works/digital_archival_object.rb +28 -0
  202. data/lib/dog_biscuits/models/works/exam_paper.rb +33 -0
  203. data/lib/dog_biscuits/models/works/journal_article.rb +37 -0
  204. data/lib/dog_biscuits/models/works/package.rb +47 -0
  205. data/lib/dog_biscuits/models/works/published_work.rb +38 -0
  206. data/lib/dog_biscuits/models/works/thesis.rb +34 -0
  207. data/lib/dog_biscuits/property_mappings/property_mappings.rb +585 -0
  208. data/lib/dog_biscuits/railtie.rb +13 -0
  209. data/lib/dog_biscuits/services/table_based_authority_extended.rb +10 -0
  210. data/lib/dog_biscuits/services/terms.rb +57 -0
  211. data/lib/dog_biscuits/services/terms_service.rb +162 -0
  212. data/lib/dog_biscuits/solr/index_types.rb +33 -0
  213. data/lib/dog_biscuits/validators/concept_related_validator.rb +13 -0
  214. data/lib/dog_biscuits/validators/concept_scheme_member_validator.rb +10 -0
  215. data/lib/dog_biscuits/validators/label_validator.rb +55 -0
  216. data/lib/dog_biscuits/validators/place_validator.rb +10 -0
  217. data/lib/dog_biscuits/version.rb +5 -0
  218. data/lib/dog_biscuits/vocab/borthwick_registers.rb +321 -0
  219. data/lib/dog_biscuits/vocab/generic.rb +204 -0
  220. data/lib/dog_biscuits/vocab/oais_archivematica.rb +116 -0
  221. data/lib/dog_biscuits/vocab/pure_terms.rb +65 -0
  222. data/lib/dog_biscuits/vocab/uketd.rb +45 -0
  223. data/lib/dog_biscuits/vocab/ulcc_terms.rb +55 -0
  224. data/lib/generators/dog_biscuits/USAGE +50 -0
  225. data/lib/generators/dog_biscuits/authority_generator.rb +55 -0
  226. data/lib/generators/dog_biscuits/catalog_generator.rb +18 -0
  227. data/lib/generators/dog_biscuits/dates_generator.rb +98 -0
  228. data/lib/generators/dog_biscuits/generate_all_generator.rb +29 -0
  229. data/lib/generators/dog_biscuits/imagify_generator.rb +67 -0
  230. data/lib/generators/dog_biscuits/install_generator.rb +82 -0
  231. data/lib/generators/dog_biscuits/locales_generator.rb +20 -0
  232. data/lib/generators/dog_biscuits/schema_org_generator.rb +20 -0
  233. data/lib/generators/dog_biscuits/templates/_date_template.html.erb +7 -0
  234. data/lib/generators/dog_biscuits/templates/app/controllers/catalog_controller.rb +133 -0
  235. data/lib/generators/dog_biscuits/templates/app/helpers/dog_biscuits_helper.rb +43 -0
  236. data/lib/generators/dog_biscuits/templates/app/renderers/package_ids_renderer.rb +13 -0
  237. data/lib/generators/dog_biscuits/templates/app/renderers/packaged_by_ids_renderer.rb +11 -0
  238. data/lib/generators/dog_biscuits/templates/app/renderers/publication_status_renderer.rb +16 -0
  239. data/lib/generators/dog_biscuits/templates/app/services/concerns/file_authority_concern.rb +14 -0
  240. data/lib/generators/dog_biscuits/templates/app/services/concerns/local_authority_concern.rb +18 -0
  241. data/lib/generators/dog_biscuits/templates/app/services/local_form_metadata_service.rb +15 -0
  242. data/lib/generators/dog_biscuits/templates/app/views/hyrax/base/_form_metadata.html.erb +23 -0
  243. data/lib/generators/dog_biscuits/templates/app/views/records/edit_fields/_abstract.html.erb +5 -0
  244. data/lib/generators/dog_biscuits/templates/app/views/records/edit_fields/_default.html.erb +6 -0
  245. data/lib/generators/dog_biscuits/templates/app/views/records/edit_fields/_funder.html.erb +8 -0
  246. data/lib/generators/dog_biscuits/templates/app/views/records/edit_fields/_note.html.erb +5 -0
  247. data/lib/generators/dog_biscuits/templates/app/views/records/edit_fields/_part_of.html.erb +17 -0
  248. data/lib/generators/dog_biscuits/templates/app/views/records/edit_fields/_publication_status.html.erb +6 -0
  249. data/lib/generators/dog_biscuits/templates/app/views/records/edit_fields/_refereed.html.erb +5 -0
  250. data/lib/generators/dog_biscuits/templates/app/views/records/edit_fields/_resource_type_general.html.erb +2 -0
  251. data/lib/generators/dog_biscuits/templates/authority_service.rb.erb +25 -0
  252. data/lib/generators/dog_biscuits/templates/config/authorities/content_versions.yml +25 -0
  253. data/lib/generators/dog_biscuits/templates/config/authorities/publication_statuses.yml +19 -0
  254. data/lib/generators/dog_biscuits/templates/config/authorities/qualification_levels.yml +13 -0
  255. data/lib/generators/dog_biscuits/templates/config/authorities/qualification_names.yml +31 -0
  256. data/lib/generators/dog_biscuits/templates/config/authorities/resource_type_generals.yml +47 -0
  257. data/lib/generators/dog_biscuits/templates/config/dog_biscuits.yml +3 -0
  258. data/lib/generators/dog_biscuits/templates/config/initializers/catalog_search_builder_overrides.rb +18 -0
  259. data/lib/generators/dog_biscuits/templates/config/initializers/dog_biscuits.rb +144 -0
  260. data/lib/generators/dog_biscuits/templates/dog_biscuits.en.yml.erb +11 -0
  261. data/lib/generators/dog_biscuits/templates/schema_org.yml.erb +4 -0
  262. data/lib/generators/dog_biscuits/work/USAGE +35 -0
  263. data/lib/generators/dog_biscuits/work/templates/README +31 -0
  264. data/lib/generators/dog_biscuits/work/templates/_attribute_rows.html.erb +22 -0
  265. data/lib/generators/dog_biscuits/work/templates/actor.rb.erb +25 -0
  266. data/lib/generators/dog_biscuits/work/templates/form.rb.erb +18 -0
  267. data/lib/generators/dog_biscuits/work/templates/indexer.rb.erb +23 -0
  268. data/lib/generators/dog_biscuits/work/templates/model.rb.erb +16 -0
  269. data/lib/generators/dog_biscuits/work/templates/presenter.rb.erb +20 -0
  270. data/lib/generators/dog_biscuits/work/work_generator.rb +102 -0
  271. data/lib/tasks/authorities.rake +22 -0
  272. metadata +476 -0
@@ -0,0 +1,65 @@
1
+ # frozen_string_literal: true
2
+
3
+ module DogBiscuits
4
+ module Importers
5
+ class Authority
6
+ attr_reader :authority
7
+ attr_reader :authority_name
8
+
9
+ def initialize(authority_name)
10
+ @authority_name = authority_name
11
+ @authority = Qa::LocalAuthority.find_or_create_by(name: authority_name) if valid_authority?
12
+ end
13
+
14
+ def valid_authority?
15
+ true if Qa::Authorities::Local.subauthority_for(@authority_name)
16
+ rescue Qa::InvalidSubAuthority
17
+ Rails.logger.error("This sub-authority is not registered: #{@authority_name}")
18
+ false
19
+ end
20
+
21
+ # Create an authority record in the given local authority
22
+ #
23
+ # @param label [String] the label
24
+ # @param uri [String] the uri, optional
25
+ def create_record(label, uri = nil)
26
+ uri = construct_uri(label) if uri.blank?
27
+ Qa::LocalAuthorityEntry.create(local_authority: @authority,
28
+ label: cleanup_label(label),
29
+ uri: uri)
30
+ rescue ActiveRecord::RecordNotUnique
31
+ Rails.logger.warn("Duplicate record: #{label}")
32
+ end
33
+
34
+ private
35
+
36
+ # Replace & with &
37
+ #
38
+ # @param label [String] the label for cleanup
39
+ # @return [String] cleaned up label
40
+ def cleanup_label(label)
41
+ label.gsub('&', '&')
42
+ end
43
+
44
+ # Create a version of the label for use as a uri:
45
+ # replace all non-alphanumeric characters with whitespace
46
+ # trim to 50 characters and replace whitespace with a dash
47
+ #
48
+ # @param label [String] the label for uri-ification
49
+ # @return [String] uri-ified label
50
+ def uri_ifiy_label(label)
51
+ cleanup_label(label).gsub(/[^\w\s\d]/, ' ')[0..50].parameterize
52
+ end
53
+
54
+ # Create a default URI for the term
55
+ #
56
+ # @param label [String] the label for cleanup
57
+ # @return [String] cleaned up label
58
+ def construct_uri(label)
59
+ hostname = `hostname`.delete("\n")
60
+ hostname = "example.com" if hostname.include?('localhost')
61
+ "http://#{hostname}/#{@authority_name}/#{uri_ifiy_label(label)}"
62
+ end
63
+ end
64
+ end
65
+ end
@@ -0,0 +1,10 @@
1
+ # frozen_string_literal: true
2
+
3
+ module DogBiscuits
4
+ class CollectionIndexer < Hyrax::CollectionIndexer
5
+ include DogBiscuits::IndexesCommon
6
+
7
+ # Add any custom indexing into here. Method must exist, but can be empty.
8
+ def do_local_indexing(solr_doc); end
9
+ end
10
+ end
@@ -0,0 +1,58 @@
1
+ # frozen_string_literal: true
2
+
3
+ module DogBiscuits
4
+ module IndexesCommon
5
+ def generate_solr_document
6
+ super.tap do |solr_doc|
7
+ solr_doc_for_contributors(solr_doc)
8
+ solr_doc_for_dates(solr_doc)
9
+ do_local_indexing(solr_doc)
10
+ end
11
+ end
12
+
13
+ # rubocop:disable Style/GuardClause
14
+
15
+ # Index different contributor types (relators, eg. editor, advisor) into contributor
16
+ # Index the contributor type itself
17
+ def solr_doc_for_contributors(solr_doc)
18
+ if respond_to? :contributors_to_index
19
+ contributors_to_index.each do |v|
20
+ labels = object.send(v).to_a
21
+ # If there is anything in the solr_doc, add to it
22
+ if solr_doc["contributor_combined_tesim"]
23
+ solr_doc[ActiveFedora.index_field_mapper.solr_name("contributor_combined", :stored_searchable)].push(*labels).uniq!
24
+ solr_doc[ActiveFedora.index_field_mapper.solr_name("contributor_combined", :facetable)].push(*labels).uniq!
25
+ else
26
+ solr_doc[ActiveFedora.index_field_mapper.solr_name("contributor_combined", :stored_searchable)] = labels
27
+ solr_doc[ActiveFedora.index_field_mapper.solr_name("contributor_combined", :facetable)] = labels
28
+ end
29
+ labels.each do |_label|
30
+ if solr_doc['contributor_type_sim']
31
+ solr_doc[ActiveFedora.index_field_mapper.solr_name("contributor_type", :facetable)] << v
32
+ else
33
+ solr_doc[ActiveFedora.index_field_mapper.solr_name("contributor_type", :facetable)] = [v]
34
+ end
35
+ end
36
+ end
37
+ end
38
+ end
39
+
40
+ # Extract years from all date fields and index into 'date_range_sim'
41
+ def solr_doc_for_dates(solr_doc)
42
+ DogBiscuits.config.date_properties.each do |d|
43
+ next unless object.respond_to? d
44
+ object.send(d).each do |dd|
45
+ dd.to_s.scan(/\b\d{4}\b/).each do |year|
46
+ if solr_doc['date_range_sim']
47
+ solr_doc['date_range_sim'] << year.to_i
48
+ else
49
+ solr_doc['date_range_sim'] = [year.to_i]
50
+ end
51
+ end
52
+ end
53
+ end
54
+ end
55
+
56
+ # rubocop:enable Style/GuardClause
57
+ end
58
+ end
@@ -0,0 +1,17 @@
1
+ # frozen_string_literal: true
2
+
3
+ module DogBiscuits
4
+ class ConferenceItemIndexer < Hyrax::WorkIndexer
5
+ include DogBiscuits::IndexesCommon
6
+
7
+ # NB. include 'contributor' here if it is used in the form
8
+ def contributors_to_index
9
+ ['editor', 'funder']
10
+ end
11
+
12
+ # Add any custom indexing into here. Method must exist, but can be empty.
13
+ #
14
+ # @param [Hash] solr_doc
15
+ def do_local_indexing(solr_doc); end
16
+ end
17
+ end
@@ -0,0 +1,25 @@
1
+ # frozen_string_literal: true
2
+
3
+ module DogBiscuits
4
+ class DatasetIndexer < Hyrax::WorkIndexer
5
+ include DogBiscuits::IndexesCommon
6
+
7
+ def contributors_to_index
8
+ ['funder']
9
+ end
10
+
11
+ # Force the type of certain indexed fields in solr
12
+ # (inspired by
13
+ # http://projecthydra.github.io/training/deeper_into_hydra/#slide-63,
14
+ # http://projecthydra.github.io/training/deeper_into_hydra/#slide-64
15
+ # and discussed at
16
+ # https://groups.google.com/forum/#!topic/hydra-tech/rRsBwdvh5dE)
17
+ # This is to overcome limitations with solrizer and
18
+ # "index.as :stored_sortable" always defaulting to string rather
19
+ # than text type (solr sorting on string fields is case-sensitive,
20
+ # on text fields it's case-insensitive)
21
+ def do_local_indexing(solr_doc)
22
+ solr_doc['dc_access_rights_tesi'] = object.dc_access_rights.collect { |x| x }
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,19 @@
1
+ # frozen_string_literal: true
2
+
3
+ module DogBiscuits
4
+ class DigitalArchivalObjectIndexer < Hyrax::WorkIndexer
5
+ include DogBiscuits::IndexesCommon
6
+
7
+ def contributors_to_index
8
+ []
9
+ end
10
+
11
+ # Add any custom indexing into here. Method must exist, but can be empty.
12
+ #
13
+ # @param [Hash] solr_doc
14
+ def do_local_indexing(solr_doc)
15
+ solr_doc['packaged_by_ids_ssim'] = object.packaged_by.map(&:id)
16
+ solr_doc['packaged_by_titles_sim'] = object.packaged_by.map(&:first_title)
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,10 @@
1
+ # frozen_string_literal: true
2
+
3
+ module DogBiscuits
4
+ class ExamPaperIndexer < Hyrax::WorkIndexer
5
+ include DogBiscuits::IndexesCommon
6
+
7
+ # Add any custom indexing into here. Method must exist, but can be empty.
8
+ def do_local_indexing(solr_doc); end
9
+ end
10
+ end
@@ -0,0 +1,15 @@
1
+ # frozen_string_literal: true
2
+
3
+ module DogBiscuits
4
+ class JournalArticleIndexer < Hyrax::WorkIndexer
5
+ include DogBiscuits::IndexesCommon
6
+
7
+ # Add any properties to ensure they are 'mixed in' with the *_labels field in solr
8
+ def contributors_to_index
9
+ ['funder']
10
+ end
11
+
12
+ # Add any custom indexing into here. Method must exist, but can be empty.
13
+ def do_local_indexing(solr_doc); end
14
+ end
15
+ end
@@ -0,0 +1,19 @@
1
+ # frozen_string_literal: true
2
+
3
+ module DogBiscuits
4
+ class PackageIndexer < Hyrax::WorkIndexer
5
+ include DogBiscuits::IndexesCommon
6
+
7
+ # NB. include 'contributor' here if it is used in the form
8
+ def contributors_to_index
9
+ []
10
+ end
11
+
12
+ # Add any custom indexing into here. Method must exist, but can be empty.
13
+ #
14
+ # @param [Hash] solr_doc
15
+ def do_local_indexing(solr_doc)
16
+ solr_doc['package_ids_ssim'] = object.packages.map(&:id)
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,16 @@
1
+ # frozen_string_literal: true
2
+
3
+ module DogBiscuits
4
+ class PublishedWorkIndexer < Hyrax::WorkIndexer
5
+ include DogBiscuits::IndexesCommon
6
+
7
+ def contributors_to_index
8
+ ['editor', 'funder']
9
+ end
10
+
11
+ # Add any custom indexing into here. Method must exist, but can be empty.
12
+ #
13
+ # @param [Hash] solr_doc
14
+ def do_local_indexing(solr_doc); end
15
+ end
16
+ end
@@ -0,0 +1,16 @@
1
+ # frozen_string_literal: true
2
+
3
+ module DogBiscuits
4
+ class ThesisIndexer < Hyrax::WorkIndexer
5
+ include DogBiscuits::IndexesCommon
6
+
7
+ def contributors_to_index
8
+ ['advisor', 'funder']
9
+ end
10
+
11
+ # Add any custom indexing into here. Method must exist, but can be empty.
12
+ #
13
+ # @param [Hash] solr_doc
14
+ def do_local_indexing(solr_doc); end
15
+ end
16
+ end
@@ -0,0 +1,78 @@
1
+ # frozen_string_literal: true
2
+
3
+ module DogBiscuits
4
+ # People, Groups and Organisations inherit from this.
5
+ class Agent < Authority
6
+ # HyBox
7
+ include DogBiscuits::AlternateName
8
+ include DogBiscuits::Description
9
+ include DogBiscuits::FoafName
10
+ include DogBiscuits::IdentifiedBy
11
+ # Additional
12
+ include DogBiscuits::GenericAuthorityTerms
13
+ include DogBiscuits::RelatedAuthority
14
+ include DogBiscuits::OwlSameAs
15
+
16
+ type [::RDF::Vocab::FOAF.Agent]
17
+
18
+ property :email, predicate: ::RDF::Vocab::FOAF.mbox do |index|
19
+ index.as :stored_searchable
20
+ end
21
+
22
+ # value should be foaf:OnlineAccount
23
+ property :account, predicate: ::RDF::Vocab::FOAF.account do |index|
24
+ index.as :stored_searchable
25
+ end
26
+
27
+ property :homepage, predicate: ::RDF::Vocab::FOAF.homepage do |index|
28
+ index.as :stored_searchable
29
+ end
30
+
31
+ def agent?
32
+ true
33
+ end
34
+
35
+ def concept?
36
+ false
37
+ end
38
+
39
+ def concept_scheme?
40
+ false
41
+ end
42
+
43
+ def event?
44
+ false
45
+ end
46
+
47
+ def group?
48
+ false
49
+ end
50
+
51
+ def organisation?
52
+ false
53
+ end
54
+
55
+ def person?
56
+ false
57
+ end
58
+
59
+ def place?
60
+ false
61
+ end
62
+
63
+ def project?
64
+ false
65
+ end
66
+
67
+ # Generate a rdfs label from the name parts. Overwrite the existing label.
68
+ def add_label
69
+ self.rdfs_label = name if name.present?
70
+ add_preflabel
71
+ end
72
+
73
+ # Generate a preflabel from rdfs label.
74
+ def add_preflabel
75
+ self.preflabel = rdfs_label if rdfs_label.present?
76
+ end
77
+ end
78
+ end
@@ -0,0 +1,59 @@
1
+ # frozen_string_literal: true
2
+
3
+ module DogBiscuits
4
+ class Group < DogBiscuits::Agent
5
+ # Additional
6
+ include DogBiscuits::GenericQualifier
7
+ include DogBiscuits::HubDates
8
+
9
+ type [::RDF::Vocab::FOAF.Agent,
10
+ ::RDF::Vocab::FOAF.Group]
11
+
12
+ property :group_type, predicate: DogBiscuits::Vocab::Generic.groupType do |index|
13
+ index.as :stored_searchable
14
+ end
15
+
16
+ property :foaf_member, predicate: ::RDF::Vocab::FOAF.member do |index|
17
+ index.as :stored_searchable
18
+ end
19
+
20
+ def concept?
21
+ false
22
+ end
23
+
24
+ def concept_scheme?
25
+ false
26
+ end
27
+
28
+ def group?
29
+ true
30
+ end
31
+
32
+ def organisation?
33
+ false
34
+ end
35
+
36
+ def person?
37
+ false
38
+ end
39
+
40
+ def place?
41
+ false
42
+ end
43
+
44
+ def project?
45
+ false
46
+ end
47
+
48
+ # Generate a rdfs label from the name parts. Overwrite the existing label.
49
+ def add_label
50
+ label = ''
51
+ label += ", #{name}" if name.present?
52
+ label += ", #{dates}" if dates.present?
53
+ label += ", #{qualifier}" if qualifier.present?
54
+ label = label.sub(', ', '') if label.starts_with? ', '
55
+ self.rdfs_label = label if label.present?
56
+ add_preflabel
57
+ end
58
+ end
59
+ end
@@ -0,0 +1,55 @@
1
+ # frozen_string_literal: true
2
+
3
+ module DogBiscuits
4
+ class HistoricPerson < DogBiscuits::Person
5
+ before_save :add_label
6
+
7
+ type [::RDF::Vocab::FOAF.Agent,
8
+ ::RDF::Vocab::FOAF.Person,
9
+ DogBiscuits::Vocab::BorthwickRegisters.HistoricPerson]
10
+
11
+ # Eg. NCA Rules 2.5C.
12
+ property :pre_title, predicate: DogBiscuits::Vocab::Generic.preTitle,
13
+ multiple: false do |index|
14
+ index.as :stored_searchable
15
+ end
16
+
17
+ # Eg. NCA Rules 2.5B.
18
+ property :post_title,
19
+ predicate: ::RDF::URI.new('http://data.archiveshub.ac.uk/def/title'),
20
+ multiple: false do |index|
21
+ index.as :stored_searchable
22
+ end
23
+
24
+ # Eg. NCA Rules 2.5D.
25
+ property :epithet,
26
+ predicate: ::RDF::URI.new('http://data.archiveshub.ac.uk/def/epithet'),
27
+ multiple: false do |index|
28
+ index.as :stored_searchable
29
+ end
30
+
31
+ property :dates_of_office,
32
+ predicate: DogBiscuits::Vocab::Generic.datesOfOffice,
33
+ multiple: false do |index|
34
+ index.as :stored_searchable
35
+ end
36
+
37
+ def historic_person?
38
+ true
39
+ end
40
+
41
+ # Generate a rdfs label from the name parts. Overwrite the existing label.
42
+ def add_label
43
+ label = ''
44
+ label += ", #{family_name}" if family_name.present?
45
+ label += ", #{pre_title}" if pre_title.present?
46
+ label += ", #{given_name}" if given_name.present?
47
+ label += ", #{dates}" if dates.present?
48
+ label += ", #{post_title}" if post_title.present?
49
+ label += ", #{epithet}" if epithet.present?
50
+ label = label.sub(', ', '') if label.starts_with? ', '
51
+ self.rdfs_label = label
52
+ add_preflabel
53
+ end
54
+ end
55
+ end