krikri 0.5.4 → 0.5.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (339) hide show
  1. checksums.yaml +4 -4
  2. data/app/controllers/krikri/_qa_report_list.html.erb~ +10 -0
  3. data/app/controllers/krikri/concerns/provider_context.rb~ +7 -0
  4. data/app/controllers/krikri/qa_reports_controller.rb~ +18 -0
  5. data/app/models/krikri/harvesters/oai_harvester.rb~ +10 -0
  6. data/app/models/krikri/original_record_desc.rb~ +6 -0
  7. data/app/models/krikri/original_record_metadata.rb~ +9 -0
  8. data/app/models/krikri/parser.rb~ +5 -0
  9. data/app/models/krikri/parsers/xml_parser.rb~ +5 -0
  10. data/app/models/krikri/qa_report.rb~ +7 -0
  11. data/app/views/krikri/qa_reports/index.html.erb~ +3 -0
  12. data/app/views/krikri/qa_reports/show.html.erb~ +1 -0
  13. data/config/initializers/config.rb~ +19 -0
  14. data/config/settings/test.yml~ +3 -0
  15. data/db/migrate/20150328035550_add_qa_report.rb~ +11 -0
  16. data/lib/aggregation.rb~ +4 -0
  17. data/lib/blacklight.rb~ +8 -0
  18. data/lib/krikri/engine.rb +2 -0
  19. data/lib/krikri/enrichment.rb~ +5 -0
  20. data/lib/krikri/enrichment_agent.rb~ +11 -0
  21. data/lib/krikri/enrichment_agent_spec.rb~ +2 -0
  22. data/lib/krikri/enrichment_job.rb~ +13 -0
  23. data/lib/krikri/enrichments.rb~ +4 -0
  24. data/lib/krikri/enrichments/contvert_to_sentence_case.rb~ +13 -0
  25. data/lib/krikri/enrichments/convert_to_sentence_case.rb +20 -0
  26. data/lib/krikri/enrichments/convert_to_sentence_case.rb~ +13 -0
  27. data/lib/krikri/enrichments/dcmi_enforcer.rb +17 -0
  28. data/lib/krikri/enrichments/dcmi_enforcer.rb~ +5 -0
  29. data/lib/krikri/enrichments/dcmi_type_map.rb +128 -0
  30. data/lib/krikri/enrichments/dcmi_type_map.rb~ +8 -0
  31. data/lib/krikri/enrichments/dedup_nodes.rb +72 -0
  32. data/lib/krikri/enrichments/dedup_nodes.rb~ +10 -0
  33. data/lib/krikri/enrichments/dedup_values.rb~ +7 -0
  34. data/lib/krikri/enrichments/limit_characters.rb +18 -0
  35. data/lib/krikri/enrichments/move_non_dcmi_type.rb +17 -0
  36. data/lib/krikri/enrichments/move_non_dcmi_type.rb~ +7 -0
  37. data/lib/krikri/enrichments/split_coordinates.rb +80 -0
  38. data/lib/krikri/enrichments/strip_ending_punctuation.rb~ +18 -0
  39. data/lib/krikri/enrichments/strip_leading_colons.rb~ +15 -0
  40. data/lib/krikri/enrichments/strip_leading_punctuation.rb~ +18 -0
  41. data/lib/krikri/field_enrichment.rb~ +3 -0
  42. data/lib/krikri/harvesters/api_harvester.rb~ +44 -0
  43. data/lib/krikri/harvesters/basic_save_behavior.rb~ +1 -0
  44. data/lib/krikri/harvesters/file_harvester.rb~ +4 -0
  45. data/lib/krikri/harvesters/harvest_behavior.rb~ +14 -0
  46. data/lib/krikri/harvesters/mdl_api_harvester.rb~ +7 -0
  47. data/lib/krikri/harvesters/mdl_harvester.rb~ +4 -0
  48. data/lib/krikri/harvesters/oai_skip_deleted_behavior.rb~ +17 -0
  49. data/lib/krikri/id_minter.rb~ +8 -0
  50. data/lib/krikri/id_service.rb~ +4 -0
  51. data/lib/krikri/ldp/container.rb~ +22 -0
  52. data/lib/krikri/ldp/nr_source.rb~ +4 -0
  53. data/lib/krikri/ldp/rdf_source.rb~ +24 -0
  54. data/lib/krikri/ldp/resource.rb~ +49 -0
  55. data/lib/krikri/mapping_dsl.rb~ +4 -0
  56. data/lib/krikri/mapping_job.rb~ +13 -0
  57. data/lib/krikri/md5_minter.rb~ +8 -0
  58. data/lib/krikri/parser.rb +12 -0
  59. data/lib/krikri/parsers/json_parser.rb~ +17 -0
  60. data/lib/krikri/parsers/oai_headers.rb~ +4 -0
  61. data/lib/krikri/parsers/oai_parser.rb~ +2 -0
  62. data/lib/krikri/parsers/oai_parser_headers.rb~ +4 -0
  63. data/lib/krikri/parsers/xml_parser.rb~ +61 -0
  64. data/lib/krikri/provenance_query.rb~ +4 -0
  65. data/lib/krikri/provenance_query_client.rb~ +11 -0
  66. data/lib/krikri/util/edtf_converter.rb~ +26 -0
  67. data/lib/krikri/util/extended_date_parser.rb~ +70 -0
  68. data/lib/krikri/version.rb +1 -1
  69. data/lib/tasks/jetty.rake~ +12 -0
  70. data/lib/tasks/krikri.rake~ +20 -0
  71. data/spec/controllers/application_controller_spec.rb~ +11 -0
  72. data/spec/controllers/qa_reports_controller_spec.rb~ +15 -0
  73. data/spec/controllers/records_controller_spec.rb~ +11 -0
  74. data/spec/controllers/reports_controller_spec.rb~ +6 -0
  75. data/spec/controllers/validation_reports_controller_spec.rb~ +15 -0
  76. data/spec/factories/krikri_original_record.rb~ +5 -0
  77. data/spec/factories/krikri_provider.rb~ +7 -0
  78. data/spec/factories/krikri_provider_spec.rb~ +7 -0
  79. data/spec/factories/krikri_qa_report.rb~ +8 -0
  80. data/spec/helpers/krikri/application_helper_spec.rb~ +16 -0
  81. data/spec/internal/Gemfile +4 -3
  82. data/spec/internal/Gemfile.lock +34 -34
  83. data/spec/internal/app/assets/javascripts/application.js +1 -1
  84. data/spec/internal/config/initializers/blacklight_initializer.rb +1 -1
  85. data/spec/internal/config/initializers/devise.rb +2 -2
  86. data/spec/internal/config/secrets.yml +2 -2
  87. data/spec/internal/db/development.sqlite3 +0 -0
  88. data/spec/internal/db/migrate/{20150408190519_devise_create_users.rb → 20150404224854_devise_create_users.rb} +0 -0
  89. data/spec/internal/db/migrate/{20150408190543_create_searches.blacklight.rb → 20150404224913_create_searches.blacklight.rb} +0 -0
  90. data/spec/internal/db/migrate/{20150408190544_create_bookmarks.blacklight.rb → 20150404224914_create_bookmarks.blacklight.rb} +0 -0
  91. data/spec/internal/db/migrate/{20150408190545_add_polymorphic_type_to_bookmarks.blacklight.rb → 20150404224915_add_polymorphic_type_to_bookmarks.blacklight.rb} +0 -0
  92. data/spec/internal/db/schema.rb +1 -1
  93. data/spec/internal/db/test.sqlite3 +0 -0
  94. data/spec/internal/lib/generators/test_app_generator.rb~ +14 -0
  95. data/spec/internal/log/development.log +1275 -81
  96. data/spec/internal/log/test.log +245066 -3067
  97. data/spec/krikri_spec.rb~ +30 -0
  98. data/spec/ldp/active_triples_spec.rb~ +15 -0
  99. data/spec/ldp/at_resource_spec.rb~ +41 -0
  100. data/spec/ldp/nr_source_spec.rb~ +3 -0
  101. data/spec/ldp/rdf_source_spec.rb~ +4 -0
  102. data/spec/ldp/resource_spec.rb~ +49 -0
  103. data/spec/lib/krikri/enrichment_agent_spec.rb~ +4 -0
  104. data/spec/lib/krikri/enrichments/capitalize_spec.rb~ +24 -0
  105. data/spec/lib/krikri/enrichments/convert_to_sentence_case_spec.rb +16 -0
  106. data/spec/lib/krikri/enrichments/convert_to_sentence_case_spec.rb~ +16 -0
  107. data/spec/lib/krikri/enrichments/dcmi_enforcer_spec.rb +25 -0
  108. data/spec/lib/krikri/enrichments/dcmi_enforcer_spec.rb~ +16 -0
  109. data/spec/lib/krikri/enrichments/dcmi_type_map_spec.rb +41 -0
  110. data/spec/lib/krikri/enrichments/dedup_nodes_spec.rb +47 -0
  111. data/spec/lib/krikri/enrichments/dedup_nodes_spec.rb~ +6 -0
  112. data/spec/lib/krikri/enrichments/dedup_values_spec.rb~ +10 -0
  113. data/spec/lib/krikri/enrichments/deduplication_spec.rb~ +5 -0
  114. data/spec/lib/krikri/enrichments/genre_filter_spec.rb~ +19 -0
  115. data/spec/lib/krikri/enrichments/iso_enrich_spec.rb~ +5 -0
  116. data/spec/lib/krikri/enrichments/limit_characters_spec.rb +94 -0
  117. data/spec/lib/krikri/enrichments/move_non_dcmi_type_spec.rb +25 -0
  118. data/spec/lib/krikri/enrichments/move_non_dcmi_type_spec.rb~ +4 -0
  119. data/spec/lib/krikri/enrichments/parse_date_spec.rb~ +16 -0
  120. data/spec/lib/krikri/enrichments/split_coordinates_spec.rb +65 -0
  121. data/spec/lib/krikri/enrichments/strip_ending_punctuation_spec.rb~ +16 -0
  122. data/spec/lib/krikri/enrichments/strip_leading_colons_spec.rb~ +16 -0
  123. data/spec/lib/krikri/enrichments/strip_leading_punctuation_spec.rb~ +16 -0
  124. data/spec/lib/krikri/enrichments/timespan_spec.rb~ +10 -0
  125. data/spec/lib/krikri/enrichments/timespan_split_spec.rb~ +59 -0
  126. data/spec/lib/krikri/harvesters/api_harvester_spec.rb~ +47 -0
  127. data/spec/lib/krikri/harvesters/basic_save_behavior_spec.rb~ +12 -0
  128. data/spec/lib/krikri/harvesters/file_harvester_spec.rb~ +3 -0
  129. data/spec/lib/krikri/harvesters/harvest_behavior_spec.rb~ +5 -0
  130. data/spec/lib/krikri/harvesters/mdl_api_harvester_spec.rb~ +11 -0
  131. data/spec/lib/krikri/harvesters/mdl_harvester_spec.rb~ +8 -0
  132. data/spec/lib/krikri/harvesters/oai_skip_deleted_behavior.rb~ +7 -0
  133. data/spec/lib/krikri/harvesters/oai_skip_deleted_behavior_spec.rb~ +15 -0
  134. data/spec/lib/krikri/id_service_spec.rb~ +3 -0
  135. data/spec/lib/krikri/job_spec.rb~ +13 -0
  136. data/spec/lib/krikri/mapper_agent_spec.rb~ +64 -0
  137. data/spec/lib/krikri/mapper_spec.rb~ +5 -0
  138. data/spec/lib/krikri/mapping_dsl/parser_methods_spec.rb~ +65 -0
  139. data/spec/lib/krikri/mapping_dsl/property_declaration_spec.rb~ +87 -0
  140. data/spec/lib/krikri/mapping_dsl/rdf_subjects_spec.rb~ +16 -0
  141. data/spec/lib/krikri/mapping_dsl_spec.rb~ +10 -0
  142. data/spec/lib/krikri/mapping_job.rb~ +12 -0
  143. data/spec/lib/krikri/mapping_job_spec.rb~ +11 -0
  144. data/spec/lib/krikri/mapping_spec.rb~ +5 -0
  145. data/spec/lib/krikri/md5_minter_spec.rb~ +5 -0
  146. data/spec/lib/krikri/parser_value_array.rb~ +5 -0
  147. data/spec/lib/krikri/parser_value_array_spec.rb +23 -0
  148. data/spec/lib/krikri/parsers/json_parser_spec.rb~ +17 -0
  149. data/spec/lib/krikri/parsers/xml_parser_spec.rb~ +21 -0
  150. data/spec/lib/krikri/provenance_query_client.rb~ +5 -0
  151. data/spec/lib/krikri/provenance_query_client_spec.rb~ +8 -0
  152. data/spec/lib/krikri/qa_query_client_spec.rb~ +9 -0
  153. data/spec/lib/krikri/random_search_index_docmument_builder_spec.rb~ +6 -0
  154. data/spec/lib/krikri/util/edtf_converter_spec.rb~ +17 -0
  155. data/spec/lib/krikri/util/extended_date_parser_spec.rb~ +102 -0
  156. data/spec/models/activity_spec.rb~ +41 -0
  157. data/spec/models/dpla/map/aggregation_spec.rb~ +67 -0
  158. data/spec/models/harvesters/oai_harvester_spec.rb~ +15 -0
  159. data/spec/models/mapper_spec.rb~ +5 -0
  160. data/spec/models/original_record_metadata_spec.rb~ +5 -0
  161. data/spec/models/original_record_spec.rb~ +5 -0
  162. data/spec/models/provider_spec.rb~ +33 -0
  163. data/spec/models/qa_report_spec.rb~ +64 -0
  164. data/spec/models/validation_report_spec.rb~ +15 -0
  165. data/spec/support/shared_contexts/indexed_item.rb~ +15 -0
  166. data/spec/support/shared_contexts/mapping_dsl.rb~ +12 -0
  167. data/spec/support/shared_contexts/provenance_query_client.rb~ +6 -0
  168. data/spec/support/shared_contexts/rake.rb~ +21 -0
  169. data/spec/support/shared_examples/enrichment.rb~ +5 -0
  170. data/spec/support/shared_examples/harvest_behavior.rb~ +13 -0
  171. data/spec/support/shared_examples/job.rb~ +20 -0
  172. data/spec/support/shared_examples/ldp_resource.rb~ +4 -0
  173. data/spec/support/shared_examples/oai_parser_headers.rb~ +12 -0
  174. data/spec/support/shared_examples/rdf_source.rb~ +1 -0
  175. data/spec/support/shared_examples/software_agent.rb~ +5 -0
  176. data/spec/support/shared_examples/string_enrichment.rb~ +12 -0
  177. data/spec/test_app_templates/lib/generators/test_app_generator.rb~ +14 -0
  178. data/spec/views/krikri/providers/index.html.erb_spec.rb~ +3 -0
  179. data/spec/views/krikri/providers/show.html.erb.spec~ +12 -0
  180. data/spec/views/krikri/providers/show.html.erb_spec.rb~ +10 -0
  181. data/spec/views/krikri/qa_reports/index.html.erb_spec.rb~ +17 -0
  182. data/spec/views/krikri/qa_reports/show.html.erb_spec.rb~ +22 -0
  183. data/spec/views/krikri/records/index.html.erb_spec.rb~ +15 -0
  184. data/spec/views/krikri/records/show.html.erb_spec.rb~ +8 -0
  185. data/spec/views/krikri/reports/index.html.erb_spec.rb~ +5 -0
  186. data/spec/webmocks/oai.rb~ +13 -0
  187. metadata +420 -444
  188. data/spec/dummy/db/development.sqlite3 +0 -0
  189. data/spec/dummy/db/test.sqlite3 +0 -0
  190. data/spec/dummy/log/development.log +0 -207
  191. data/spec/internal/tmp/cache/318/301/krikri%2Fapplication_helper%2Favailable_providers +0 -0
  192. data/spec/internal/tmp/cache/assets/test/sass/6449c927c92ef1ea4378c66161e3b0efe1bf954d/_bootstrap-sprockets.scssc +0 -0
  193. data/spec/internal/tmp/cache/assets/test/sass/6449c927c92ef1ea4378c66161e3b0efe1bf954d/_bootstrap.scssc +0 -0
  194. data/spec/internal/tmp/cache/assets/test/sass/71fba6bdfa89d88fe8a72b36eafd3b91cf10a6d0/blacklight.css.scssc +0 -0
  195. data/spec/internal/tmp/cache/assets/test/sass/75eb48b5361d55a8133e0091d663a085dacee3c5/_alerts.scssc +0 -0
  196. data/spec/internal/tmp/cache/assets/test/sass/75eb48b5361d55a8133e0091d663a085dacee3c5/_background-variant.scssc +0 -0
  197. data/spec/internal/tmp/cache/assets/test/sass/75eb48b5361d55a8133e0091d663a085dacee3c5/_border-radius.scssc +0 -0
  198. data/spec/internal/tmp/cache/assets/test/sass/75eb48b5361d55a8133e0091d663a085dacee3c5/_buttons.scssc +0 -0
  199. data/spec/internal/tmp/cache/assets/test/sass/75eb48b5361d55a8133e0091d663a085dacee3c5/_center-block.scssc +0 -0
  200. data/spec/internal/tmp/cache/assets/test/sass/75eb48b5361d55a8133e0091d663a085dacee3c5/_clearfix.scssc +0 -0
  201. data/spec/internal/tmp/cache/assets/test/sass/75eb48b5361d55a8133e0091d663a085dacee3c5/_forms.scssc +0 -0
  202. data/spec/internal/tmp/cache/assets/test/sass/75eb48b5361d55a8133e0091d663a085dacee3c5/_gradients.scssc +0 -0
  203. data/spec/internal/tmp/cache/assets/test/sass/75eb48b5361d55a8133e0091d663a085dacee3c5/_grid-framework.scssc +0 -0
  204. data/spec/internal/tmp/cache/assets/test/sass/75eb48b5361d55a8133e0091d663a085dacee3c5/_grid.scssc +0 -0
  205. data/spec/internal/tmp/cache/assets/test/sass/75eb48b5361d55a8133e0091d663a085dacee3c5/_hide-text.scssc +0 -0
  206. data/spec/internal/tmp/cache/assets/test/sass/75eb48b5361d55a8133e0091d663a085dacee3c5/_image.scssc +0 -0
  207. data/spec/internal/tmp/cache/assets/test/sass/75eb48b5361d55a8133e0091d663a085dacee3c5/_labels.scssc +0 -0
  208. data/spec/internal/tmp/cache/assets/test/sass/75eb48b5361d55a8133e0091d663a085dacee3c5/_list-group.scssc +0 -0
  209. data/spec/internal/tmp/cache/assets/test/sass/75eb48b5361d55a8133e0091d663a085dacee3c5/_nav-divider.scssc +0 -0
  210. data/spec/internal/tmp/cache/assets/test/sass/75eb48b5361d55a8133e0091d663a085dacee3c5/_nav-vertical-align.scssc +0 -0
  211. data/spec/internal/tmp/cache/assets/test/sass/75eb48b5361d55a8133e0091d663a085dacee3c5/_opacity.scssc +0 -0
  212. data/spec/internal/tmp/cache/assets/test/sass/75eb48b5361d55a8133e0091d663a085dacee3c5/_pagination.scssc +0 -0
  213. data/spec/internal/tmp/cache/assets/test/sass/75eb48b5361d55a8133e0091d663a085dacee3c5/_panels.scssc +0 -0
  214. data/spec/internal/tmp/cache/assets/test/sass/75eb48b5361d55a8133e0091d663a085dacee3c5/_progress-bar.scssc +0 -0
  215. data/spec/internal/tmp/cache/assets/test/sass/75eb48b5361d55a8133e0091d663a085dacee3c5/_reset-filter.scssc +0 -0
  216. data/spec/internal/tmp/cache/assets/test/sass/75eb48b5361d55a8133e0091d663a085dacee3c5/_resize.scssc +0 -0
  217. data/spec/internal/tmp/cache/assets/test/sass/75eb48b5361d55a8133e0091d663a085dacee3c5/_responsive-visibility.scssc +0 -0
  218. data/spec/internal/tmp/cache/assets/test/sass/75eb48b5361d55a8133e0091d663a085dacee3c5/_size.scssc +0 -0
  219. data/spec/internal/tmp/cache/assets/test/sass/75eb48b5361d55a8133e0091d663a085dacee3c5/_tab-focus.scssc +0 -0
  220. data/spec/internal/tmp/cache/assets/test/sass/75eb48b5361d55a8133e0091d663a085dacee3c5/_table-row.scssc +0 -0
  221. data/spec/internal/tmp/cache/assets/test/sass/75eb48b5361d55a8133e0091d663a085dacee3c5/_text-emphasis.scssc +0 -0
  222. data/spec/internal/tmp/cache/assets/test/sass/75eb48b5361d55a8133e0091d663a085dacee3c5/_text-overflow.scssc +0 -0
  223. data/spec/internal/tmp/cache/assets/test/sass/75eb48b5361d55a8133e0091d663a085dacee3c5/_vendor-prefixes.scssc +0 -0
  224. data/spec/internal/tmp/cache/assets/test/sass/78e0580c292179fc5fdd7b74b703dad1702b4176/_blacklight_base.scssc +0 -0
  225. data/spec/internal/tmp/cache/assets/test/sass/78e0580c292179fc5fdd7b74b703dad1702b4176/_bookmark.scssc +0 -0
  226. data/spec/internal/tmp/cache/assets/test/sass/78e0580c292179fc5fdd7b74b703dad1702b4176/_catalog.scssc +0 -0
  227. data/spec/internal/tmp/cache/assets/test/sass/78e0580c292179fc5fdd7b74b703dad1702b4176/_facets.scssc +0 -0
  228. data/spec/internal/tmp/cache/assets/test/sass/78e0580c292179fc5fdd7b74b703dad1702b4176/_group.scssc +0 -0
  229. data/spec/internal/tmp/cache/assets/test/sass/78e0580c292179fc5fdd7b74b703dad1702b4176/_header.scssc +0 -0
  230. data/spec/internal/tmp/cache/assets/test/sass/78e0580c292179fc5fdd7b74b703dad1702b4176/_layout.scssc +0 -0
  231. data/spec/internal/tmp/cache/assets/test/sass/78e0580c292179fc5fdd7b74b703dad1702b4176/_modal.scssc +0 -0
  232. data/spec/internal/tmp/cache/assets/test/sass/78e0580c292179fc5fdd7b74b703dad1702b4176/_search_history.scssc +0 -0
  233. data/spec/internal/tmp/cache/assets/test/sass/78e0580c292179fc5fdd7b74b703dad1702b4176/blacklight.scssc +0 -0
  234. data/spec/internal/tmp/cache/assets/test/sass/78e0580c292179fc5fdd7b74b703dad1702b4176/blacklight_defaults.scssc +0 -0
  235. data/spec/internal/tmp/cache/assets/test/sass/f79e9f3544f6b8d5f7ca05529260dceec8dd44ed/_alerts.scssc +0 -0
  236. data/spec/internal/tmp/cache/assets/test/sass/f79e9f3544f6b8d5f7ca05529260dceec8dd44ed/_badges.scssc +0 -0
  237. data/spec/internal/tmp/cache/assets/test/sass/f79e9f3544f6b8d5f7ca05529260dceec8dd44ed/_breadcrumbs.scssc +0 -0
  238. data/spec/internal/tmp/cache/assets/test/sass/f79e9f3544f6b8d5f7ca05529260dceec8dd44ed/_button-groups.scssc +0 -0
  239. data/spec/internal/tmp/cache/assets/test/sass/f79e9f3544f6b8d5f7ca05529260dceec8dd44ed/_buttons.scssc +0 -0
  240. data/spec/internal/tmp/cache/assets/test/sass/f79e9f3544f6b8d5f7ca05529260dceec8dd44ed/_carousel.scssc +0 -0
  241. data/spec/internal/tmp/cache/assets/test/sass/f79e9f3544f6b8d5f7ca05529260dceec8dd44ed/_close.scssc +0 -0
  242. data/spec/internal/tmp/cache/assets/test/sass/f79e9f3544f6b8d5f7ca05529260dceec8dd44ed/_code.scssc +0 -0
  243. data/spec/internal/tmp/cache/assets/test/sass/f79e9f3544f6b8d5f7ca05529260dceec8dd44ed/_component-animations.scssc +0 -0
  244. data/spec/internal/tmp/cache/assets/test/sass/f79e9f3544f6b8d5f7ca05529260dceec8dd44ed/_dropdowns.scssc +0 -0
  245. data/spec/internal/tmp/cache/assets/test/sass/f79e9f3544f6b8d5f7ca05529260dceec8dd44ed/_forms.scssc +0 -0
  246. data/spec/internal/tmp/cache/assets/test/sass/f79e9f3544f6b8d5f7ca05529260dceec8dd44ed/_glyphicons.scssc +0 -0
  247. data/spec/internal/tmp/cache/assets/test/sass/f79e9f3544f6b8d5f7ca05529260dceec8dd44ed/_grid.scssc +0 -0
  248. data/spec/internal/tmp/cache/assets/test/sass/f79e9f3544f6b8d5f7ca05529260dceec8dd44ed/_input-groups.scssc +0 -0
  249. data/spec/internal/tmp/cache/assets/test/sass/f79e9f3544f6b8d5f7ca05529260dceec8dd44ed/_jumbotron.scssc +0 -0
  250. data/spec/internal/tmp/cache/assets/test/sass/f79e9f3544f6b8d5f7ca05529260dceec8dd44ed/_labels.scssc +0 -0
  251. data/spec/internal/tmp/cache/assets/test/sass/f79e9f3544f6b8d5f7ca05529260dceec8dd44ed/_list-group.scssc +0 -0
  252. data/spec/internal/tmp/cache/assets/test/sass/f79e9f3544f6b8d5f7ca05529260dceec8dd44ed/_media.scssc +0 -0
  253. data/spec/internal/tmp/cache/assets/test/sass/f79e9f3544f6b8d5f7ca05529260dceec8dd44ed/_mixins.scssc +0 -0
  254. data/spec/internal/tmp/cache/assets/test/sass/f79e9f3544f6b8d5f7ca05529260dceec8dd44ed/_modals.scssc +0 -0
  255. data/spec/internal/tmp/cache/assets/test/sass/f79e9f3544f6b8d5f7ca05529260dceec8dd44ed/_navbar.scssc +0 -0
  256. data/spec/internal/tmp/cache/assets/test/sass/f79e9f3544f6b8d5f7ca05529260dceec8dd44ed/_navs.scssc +0 -0
  257. data/spec/internal/tmp/cache/assets/test/sass/f79e9f3544f6b8d5f7ca05529260dceec8dd44ed/_normalize.scssc +0 -0
  258. data/spec/internal/tmp/cache/assets/test/sass/f79e9f3544f6b8d5f7ca05529260dceec8dd44ed/_pager.scssc +0 -0
  259. data/spec/internal/tmp/cache/assets/test/sass/f79e9f3544f6b8d5f7ca05529260dceec8dd44ed/_pagination.scssc +0 -0
  260. data/spec/internal/tmp/cache/assets/test/sass/f79e9f3544f6b8d5f7ca05529260dceec8dd44ed/_panels.scssc +0 -0
  261. data/spec/internal/tmp/cache/assets/test/sass/f79e9f3544f6b8d5f7ca05529260dceec8dd44ed/_popovers.scssc +0 -0
  262. data/spec/internal/tmp/cache/assets/test/sass/f79e9f3544f6b8d5f7ca05529260dceec8dd44ed/_print.scssc +0 -0
  263. data/spec/internal/tmp/cache/assets/test/sass/f79e9f3544f6b8d5f7ca05529260dceec8dd44ed/_progress-bars.scssc +0 -0
  264. data/spec/internal/tmp/cache/assets/test/sass/f79e9f3544f6b8d5f7ca05529260dceec8dd44ed/_responsive-embed.scssc +0 -0
  265. data/spec/internal/tmp/cache/assets/test/sass/f79e9f3544f6b8d5f7ca05529260dceec8dd44ed/_responsive-utilities.scssc +0 -0
  266. data/spec/internal/tmp/cache/assets/test/sass/f79e9f3544f6b8d5f7ca05529260dceec8dd44ed/_scaffolding.scssc +0 -0
  267. data/spec/internal/tmp/cache/assets/test/sass/f79e9f3544f6b8d5f7ca05529260dceec8dd44ed/_tables.scssc +0 -0
  268. data/spec/internal/tmp/cache/assets/test/sass/f79e9f3544f6b8d5f7ca05529260dceec8dd44ed/_thumbnails.scssc +0 -0
  269. data/spec/internal/tmp/cache/assets/test/sass/f79e9f3544f6b8d5f7ca05529260dceec8dd44ed/_tooltip.scssc +0 -0
  270. data/spec/internal/tmp/cache/assets/test/sass/f79e9f3544f6b8d5f7ca05529260dceec8dd44ed/_type.scssc +0 -0
  271. data/spec/internal/tmp/cache/assets/test/sass/f79e9f3544f6b8d5f7ca05529260dceec8dd44ed/_utilities.scssc +0 -0
  272. data/spec/internal/tmp/cache/assets/test/sass/f79e9f3544f6b8d5f7ca05529260dceec8dd44ed/_variables.scssc +0 -0
  273. data/spec/internal/tmp/cache/assets/test/sass/f79e9f3544f6b8d5f7ca05529260dceec8dd44ed/_wells.scssc +0 -0
  274. data/spec/internal/tmp/cache/assets/test/sprockets/05604ccd7329b6afb8e7cdafbaa09fe3 +0 -0
  275. data/spec/internal/tmp/cache/assets/test/sprockets/0b3850cd2568d76d8583e8e6bffa44d9 +0 -0
  276. data/spec/internal/tmp/cache/assets/test/sprockets/0dffbe192bade10cf2b568c73695e96e +0 -0
  277. data/spec/internal/tmp/cache/assets/test/sprockets/0e349883625d7536c00fac0eafde4415 +0 -0
  278. data/spec/internal/tmp/cache/assets/test/sprockets/0f05dd42159c418ddcfa12edd10d98bb +0 -0
  279. data/spec/internal/tmp/cache/assets/test/sprockets/11b7eeb5da37de1c315d886349adbc98 +0 -0
  280. data/spec/internal/tmp/cache/assets/test/sprockets/13fe41fee1fe35b49d145bcc06610705 +0 -0
  281. data/spec/internal/tmp/cache/assets/test/sprockets/16648e86ab6ef2950f3630ff0d566409 +0 -0
  282. data/spec/internal/tmp/cache/assets/test/sprockets/1877c8233ee501d08788d7324a70bd70 +0 -0
  283. data/spec/internal/tmp/cache/assets/test/sprockets/1c814c5c5dfd63768fff312c442847d6 +0 -0
  284. data/spec/internal/tmp/cache/assets/test/sprockets/1e699d4d1e439eeb1d52a210573f5053 +0 -0
  285. data/spec/internal/tmp/cache/assets/test/sprockets/2c58fb6a2406edc8067b46ee33af7262 +0 -0
  286. data/spec/internal/tmp/cache/assets/test/sprockets/2d0220441d85355dcd9ade523f95c048 +0 -0
  287. data/spec/internal/tmp/cache/assets/test/sprockets/2f5173deea6c795b8fdde723bb4b63af +0 -0
  288. data/spec/internal/tmp/cache/assets/test/sprockets/357970feca3ac29060c1e3861e2c0953 +0 -0
  289. data/spec/internal/tmp/cache/assets/test/sprockets/39329b3558b9f58b0d4e43621aeaa8c2 +0 -0
  290. data/spec/internal/tmp/cache/assets/test/sprockets/39ed74e4d194593ec48c481d0fd76007 +0 -0
  291. data/spec/internal/tmp/cache/assets/test/sprockets/40271adcb3c4654dcb20b55abc2505c9 +0 -0
  292. data/spec/internal/tmp/cache/assets/test/sprockets/402ffe46f4586abacce366e0e3f690d8 +0 -0
  293. data/spec/internal/tmp/cache/assets/test/sprockets/46ec3d34d3576e4452b0a95b87176996 +0 -0
  294. data/spec/internal/tmp/cache/assets/test/sprockets/4a9e62d054a09c7c8e486f73bd032bdc +0 -0
  295. data/spec/internal/tmp/cache/assets/test/sprockets/4c5e3966eae6a44e852dcf449c3f4cb0 +0 -0
  296. data/spec/internal/tmp/cache/assets/test/sprockets/52ce034583a746333fd7b8aa3916b8e1 +0 -0
  297. data/spec/internal/tmp/cache/assets/test/sprockets/52fe40fddbd8e73f6743866d4930bde6 +0 -0
  298. data/spec/internal/tmp/cache/assets/test/sprockets/53329c49c9b4ba25d31c73c9b98260b0 +0 -0
  299. data/spec/internal/tmp/cache/assets/test/sprockets/59b1fd64c6fc18a82465ad6fdc7094fa +0 -0
  300. data/spec/internal/tmp/cache/assets/test/sprockets/677fd27eda24da657f51d725742582f3 +0 -0
  301. data/spec/internal/tmp/cache/assets/test/sprockets/6b2c5572f9e2cd322ad7b2878673d0dd +0 -0
  302. data/spec/internal/tmp/cache/assets/test/sprockets/735621cd88de5e37980cced4fb13ded9 +0 -0
  303. data/spec/internal/tmp/cache/assets/test/sprockets/7e4f29f7a7327f10677cd047be78cf8a +0 -0
  304. data/spec/internal/tmp/cache/assets/test/sprockets/7f804c48c333d9758fa49ff9331b78e2 +0 -0
  305. data/spec/internal/tmp/cache/assets/test/sprockets/806c560c2f6e89ba0ad39561804ff79c +0 -0
  306. data/spec/internal/tmp/cache/assets/test/sprockets/82dd05a187bccd30f62fabb16491fe03 +0 -0
  307. data/spec/internal/tmp/cache/assets/test/sprockets/82de1c42365fd1cf6a2adc2f644150c1 +0 -0
  308. data/spec/internal/tmp/cache/assets/test/sprockets/853ad370adfaa0da7ec26f51b89421f1 +0 -0
  309. data/spec/internal/tmp/cache/assets/test/sprockets/857d45eb67a43a30a6d5d0370464e596 +0 -0
  310. data/spec/internal/tmp/cache/assets/test/sprockets/8da6b6aafe413b1ba635e82f71c194be +0 -0
  311. data/spec/internal/tmp/cache/assets/test/sprockets/8ea9ff17090b736331312d04c8036810 +0 -0
  312. data/spec/internal/tmp/cache/assets/test/sprockets/8fad7abbbfbb3748b36d73dfb482c2bd +0 -0
  313. data/spec/internal/tmp/cache/assets/test/sprockets/9181f512b689ddb01d6778bac83791ac +0 -0
  314. data/spec/internal/tmp/cache/assets/test/sprockets/92c82efebbff4c3a9f96e08b308e92dd +0 -0
  315. data/spec/internal/tmp/cache/assets/test/sprockets/93aaa9231a32901266b05632f3d35ecd +0 -0
  316. data/spec/internal/tmp/cache/assets/test/sprockets/93c6b8da8f3373c42510a25694457483 +0 -0
  317. data/spec/internal/tmp/cache/assets/test/sprockets/93dd91f6519f569f11fddf4df22460d9 +0 -0
  318. data/spec/internal/tmp/cache/assets/test/sprockets/9443255223294f7ad9ad6daba446afc3 +0 -0
  319. data/spec/internal/tmp/cache/assets/test/sprockets/96ff03d6a5f9604c6980874bb00c1d17 +0 -0
  320. data/spec/internal/tmp/cache/assets/test/sprockets/9ca9885875e2e0ab4e531cba60aa03e5 +0 -0
  321. data/spec/internal/tmp/cache/assets/test/sprockets/a13d3a27038cf6570d22b54c54442642 +0 -0
  322. data/spec/internal/tmp/cache/assets/test/sprockets/aa92d8a74950d2d6217a51424ce4b33b +0 -0
  323. data/spec/internal/tmp/cache/assets/test/sprockets/ad4a54c43c2a4c3874bfde1c9f08c248 +0 -0
  324. data/spec/internal/tmp/cache/assets/test/sprockets/b146aa842b38c17ed4117b2f52d4b51f +0 -0
  325. data/spec/internal/tmp/cache/assets/test/sprockets/b37776526b5809e55fbb0add6d059127 +0 -0
  326. data/spec/internal/tmp/cache/assets/test/sprockets/b6d54919d5e4a3921287a5fb178dc455 +0 -0
  327. data/spec/internal/tmp/cache/assets/test/sprockets/c514fd002d57ddf3d94669e369d45283 +0 -0
  328. data/spec/internal/tmp/cache/assets/test/sprockets/cd59839c2fc0d494ffa76ef4c4dbfa42 +0 -0
  329. data/spec/internal/tmp/cache/assets/test/sprockets/cffd775d018f68ce5dba1ee0d951a994 +0 -0
  330. data/spec/internal/tmp/cache/assets/test/sprockets/d32e733978c8eb7c7db3ec2b865ee87f +0 -0
  331. data/spec/internal/tmp/cache/assets/test/sprockets/d6995317fba3b6344c75db70b8c997e2 +0 -0
  332. data/spec/internal/tmp/cache/assets/test/sprockets/d771ace226fc8215a3572e0aa35bb0d6 +0 -0
  333. data/spec/internal/tmp/cache/assets/test/sprockets/d7bf17ad1471147b5314b4dda0bad9fe +0 -0
  334. data/spec/internal/tmp/cache/assets/test/sprockets/e6a1afebb687728d619fe27e84335d2f +0 -0
  335. data/spec/internal/tmp/cache/assets/test/sprockets/e83c10c393da1c028c7d4217ecfc9c03 +0 -0
  336. data/spec/internal/tmp/cache/assets/test/sprockets/f64fd792a429f69332c1489015953219 +0 -0
  337. data/spec/internal/tmp/cache/assets/test/sprockets/f7a87683461c3a58ee9b6e9546473c4e +0 -0
  338. data/spec/internal/tmp/cache/assets/test/sprockets/f7cbd26ba1d28d48de824f0e94586655 +0 -0
  339. data/spec/internal/tmp/cache/assets/test/sprockets/fed76e6bd857a06488c186874bbe2bb2 +0 -0
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9b2d8957a0e4e4129ae3a818d8bbd972a14bc591
4
- data.tar.gz: 79217f0cc7464b0cec61013d7b0fc10cb6c53f99
3
+ metadata.gz: f571b90beb068972a81dbbe4488941c52ff650a4
4
+ data.tar.gz: f660257e1db2d1f5eb21419963db13cfecf4cfa3
5
5
  SHA512:
6
- metadata.gz: 788f41ca87a996bc7ee6bfcec0b02f298020f73a0075df7154479b4cfc3ce065d45c38bc957d8e9c99bd10de4a1a344d512a4dae17f35cc6c3f12063d821a264
7
- data.tar.gz: 6d25298019ee75a91147d6c6f2f973311bd46e9db7c0a967486515c1b95490c90c357d0d39aa7b1b8df97778d1172b8e469e41e4bb176f7c560fa7120a34dd88
6
+ metadata.gz: d328c8375ab9596ff0fc9110a1808bd83779b531d69d19e0b9628dd50b4e5bc429e5ae9b6ea2ac019e8c4473fd70f2ce0b1c6285ca5827a2536c1b69af7c7007
7
+ data.tar.gz: 75f8dccf0cfa12d5b5e7233924264f07e93638f8377b14bbb82ee4af4ddb9c03a8f7c752e5d01ed3a20973db535c0c2bcc87d30efa6002f97fa368dc45244eb1
@@ -0,0 +1,10 @@
1
+ <h3>Validation Reports</h3>
2
+ <% if @validation_reports %>
3
+ <ul>
4
+ <% @validation_reports.each do |validation_report| %>
5
+ <li><%= render_validation_report(validation_report) %></li>
6
+ <% end %>
7
+ </ul>
8
+ <% else %>
9
+ <div>There was an error generating the QA reports.</div>
10
+ <% end %>
@@ -0,0 +1,7 @@
1
+ module Krikri::Concerns
2
+ class ProviderContext
3
+ def set_current_provider(provider_id = params[:provider])
4
+ @current_provider = Krikri::Provider.find(provider_id)
5
+ end
6
+ end
7
+ end
@@ -0,0 +1,18 @@
1
+ module Krikri
2
+ ##
3
+ # Handles HTTP requests for QA Reports
4
+ class QAReportsController < ApplicationController
5
+ include Concerns::ProviderContext
6
+
7
+ before_action :authenticate_user!, :set_current_provider
8
+
9
+ def show
10
+ require 'pry'
11
+ binding.pry
12
+ respond_to do |format|
13
+ format.html
14
+ format.csv { render csv: 'test' }
15
+ end
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,10 @@
1
+ module Krikri::Harvesters
2
+ class OAIHarvester < Krikri::Harvester
3
+
4
+ attr_accessor :client
5
+
6
+ def initialize(opts={})
7
+ @client = OAI::Client.new(opts[:endpoint])
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,6 @@
1
+ module Krikri
2
+ ##
3
+ # Descriptive Metadata for OriginalRecord
4
+ class OriginalRecordMetadata < ActiveTriples::Resource
5
+ end
6
+ end
@@ -0,0 +1,9 @@
1
+ module Krikri
2
+ ##
3
+ # Descriptive Metadata for OriginalRecord
4
+ class OriginalRecordMetadata < ActiveTriples::Resource
5
+ include Krikri::Ldp::RdfSource
6
+
7
+ property :wasGeneratedBy, predicate: RDF::PROV.wasGeneratedBy
8
+ end
9
+ end
@@ -0,0 +1,5 @@
1
+ module Krikri
2
+ class Parser
3
+
4
+ end
5
+ end
@@ -0,0 +1,5 @@
1
+ module Krikri::Parsers
2
+
3
+ class XmlParser
4
+ end
5
+ end
@@ -0,0 +1,7 @@
1
+ module Krikri
2
+ class QAReport
3
+ class << self
4
+ def all
5
+ end
6
+ end
7
+ end
@@ -0,0 +1,3 @@
1
+ <% # krikri/qa_records/index %>
2
+
3
+ <% content_for :title do %>Institutions<% end %>
@@ -0,0 +1 @@
1
+ <% # krikri/institutions/show %>
@@ -0,0 +1,19 @@
1
+ setting_files = [self.root.join('config', 'settings.yml'),
2
+ self.root.join('config', 'settings', "#{Rails.env}.yml"),
3
+ self.root.join('config', 'environments', "#{Rails.env}.yml"),
4
+ self.root.join('config', 'settings.local.yml'),
5
+ self.root.join('config', 'settings', "#{Rails.env}.local.yml"),
6
+ self.root.join('config', 'environments',
7
+ "#{Rails.env}.local.yml")
8
+ ].map { |path| path.to_s }
9
+
10
+ settings_const = Kernel.const_get(RailsConfig.const_name)
11
+
12
+ source_paths = settings_const.add_source!('nil')[0..-2].map do |source|
13
+ source.path
14
+ end
15
+
16
+ source_paths = setting_files + source_paths
17
+
18
+ RailsConfig.load_and_set_settings(source_paths)
19
+ Krikri::Settings = Kernel.const_get(RailsConfig.const_name)
@@ -0,0 +1,3 @@
1
+ ---
2
+ marmotta:
3
+ base: 'http://localhost:8080/marmotta/'
@@ -0,0 +1,11 @@
1
+ class AddQaReport < ActiveRecord::Migration
2
+ def change
3
+ create_table :qa_report do |t|
4
+ t.text :field_report, limit: nil
5
+ t.text :count_report, limit: nil
6
+ t.string :provider, primary_key: true
7
+
8
+ t.timestamps
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,4 @@
1
+ class DPLA::MAP::Aggregation
2
+ include Krikri::LDP::RdfSource
3
+ configure :base_uri => Krikri::Settings['marmotta']['item_container']
4
+ end
@@ -0,0 +1,8 @@
1
+ module Blacklight
2
+ def self.connection_config
3
+ @connection_config ||= begin
4
+ raise "The #{::Rails.env} environment settings were not found in the blacklight.yml config" unless blacklight_yml[::Rails.env]
5
+ blacklight_yml[::Rails.env].symbolize_keys
6
+ end
7
+ end
8
+ end
@@ -1,3 +1,4 @@
1
+ require 'rdf/isomorphic'
1
2
  require 'active_support'
2
3
  require 'rails_config'
3
4
  require 'krikri/ldp'
@@ -8,6 +9,7 @@ require 'rdf/marmotta'
8
9
  require 'oai/client'
9
10
  require 'rest-client'
10
11
  require 'edtf'
12
+ require 'text'
11
13
  require 'csv'
12
14
 
13
15
  require 'resque'
@@ -0,0 +1,5 @@
1
+ module Krikri
2
+ class Enrichment
3
+ extend SoftwareAgent
4
+ end
5
+ end
@@ -0,0 +1,11 @@
1
+ module Krikri
2
+ ##
3
+ # EnrichmentAgent
4
+ class EnrichmentAgent
5
+ include SoftwareAgent
6
+
7
+ def initialize(opts = {})
8
+ @generator_uri = RDF::URI(opts.fetch(:generator_uri))
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,2 @@
1
+ describe Krikri::Enrichment::Agent do
2
+ it_behaves_like 'a software agent', opts
@@ -0,0 +1,13 @@
1
+ module Krikri
2
+ ##
3
+ # MappingJob: perform enqueued Krikri::Mapper::Agent
4
+ #
5
+ # @see: Krikri::Mapper, Krikri::Mapper::Agent
6
+ class EnrichmentJob < Krikri::Job
7
+ @queue = :enrichment
8
+
9
+ def self.run(mapper, activity_uri = nil)
10
+ mapper.run(activity_uri)
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,4 @@
1
+ module Krikri
2
+ module Enrichments
3
+ end
4
+ end
@@ -0,0 +1,13 @@
1
+ module Krikri::Enrichments
2
+ ##
3
+ #
4
+ class ConvertToSentenceCase
5
+ include Krikri::FieldEnrichment
6
+
7
+ def enrich_value(value)
8
+ return value unless value.is_a? String
9
+ require 'pry'
10
+ binding.pry
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,20 @@
1
+ module Krikri::Enrichments
2
+ ##
3
+ # Converts a string to sentence case.
4
+ #
5
+ # @example
6
+ #
7
+ # string = 'this is a sentence about Moomins. this is another about Snorks.'
8
+ # Krikri::Enrichments::ConvertToSentenceCase.enrich_value(string)
9
+ # # => 'This is a sentence about moomins. This is another about snorks.'
10
+ class ConvertToSentenceCase
11
+ include Krikri::FieldEnrichment
12
+
13
+ def enrich_value(value)
14
+ return value unless value.is_a? String
15
+ value.gsub(/([a-z])((?:[^.?!]|\.(?=[a-z]))*)/i) do
16
+ $1.upcase + $2.downcase.rstrip
17
+ end
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,13 @@
1
+ module Krikri::Enrichments
2
+ ##
3
+ #
4
+ class ConvertToSentenceCase
5
+ include Krikri::FieldEnrichment
6
+
7
+ def enrich_value(value)
8
+ return value unless value.is_a? String
9
+ require 'pry'
10
+ binding.pry
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,17 @@
1
+ module Krikri::Enrichments
2
+ ##
3
+ # Removes non-DCMI Type values from a field
4
+ class DcmiEnforcer
5
+ include Krikri::FieldEnrichment
6
+
7
+ ##
8
+ # @param value [Object] the value to enrich
9
+ #
10
+ # @return [DPLA::MAP::Controlled::DCMIType, nil] the original value or `nil`
11
+ def enrich_value(value)
12
+ return nil unless value.is_a? DPLA::MAP::Controlled::DCMIType
13
+ return nil unless value.valid?
14
+ value
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,5 @@
1
+ module Krikri::Enrichments
2
+ class DcmiEnforcer
3
+
4
+ end
5
+ end
@@ -0,0 +1,128 @@
1
+ # coding: utf-8
2
+ module Krikri::Enrichments
3
+ ##
4
+ # Maps string values to DCMI Type vocabulary terms.
5
+ #
6
+ # Mapping is performed by comparing a hash of string keys to the pre-enriched
7
+ # value, using White Similarity comparisons to determine the closest match. If
8
+ # a suitable match is found, a {DLPA::MAP::Controlled::DCMIType} object is
9
+ # built from the appropriate hash value and set as the new value.
10
+ #
11
+ # This enrichment ignores strings without a DCMI Type match.
12
+ #
13
+ # @example
14
+ #
15
+ # type_mapper = DcmiTypeMap.new
16
+ # type_mapper.enrich_value('image') # finds RDF::DCMITYPE.Image
17
+ # type_mapper.enrich_value('a book') # finds RDF::DCMITYPE.Text
18
+ # type_mapper.enrich_value('a really cool book') # => 'a really cool book'
19
+ #
20
+ # @example
21
+ #
22
+ # type_mapper = DcmiTypeMap.new('poloriod' => RDF::DCMIType.Image)
23
+ # type_mapper.enrich_value('poloroid.') # finds RDF::DCMITYPE.Image
24
+ #
25
+ class DcmiTypeMap
26
+ include Krikri::FieldEnrichment
27
+
28
+ DEFAULT_MAP = { 'image' => RDF::DCMITYPE.Image,
29
+ 'photograph' => RDF::DCMITYPE.Image,
30
+ 'sample book' => RDF::DCMITYPE.Image,
31
+ 'specimen' => RDF::DCMITYPE.Image,
32
+ 'textile' => RDF::DCMITYPE.Image,
33
+ 'frame' => RDF::DCMITYPE.Image,
34
+ 'costume' => RDF::DCMITYPE.Image,
35
+ 'statue' => RDF::DCMITYPE.Image,
36
+ 'sculpture' => RDF::DCMITYPE.Image,
37
+ 'container' => RDF::DCMITYPE.Image,
38
+ 'jewelry' => RDF::DCMITYPE.Image,
39
+ 'furnishing' => RDF::DCMITYPE.Image,
40
+ 'furniture' => RDF::DCMITYPE.Image,
41
+ 'drawing' => RDF::DCMITYPE.Image,
42
+ 'print' => RDF::DCMITYPE.Image,
43
+ 'painting' => RDF::DCMITYPE.Image,
44
+ 'illumination' => RDF::DCMITYPE.Image,
45
+ 'poster' => RDF::DCMITYPE.Image,
46
+ 'appliance' => RDF::DCMITYPE.Image,
47
+ 'tool' => RDF::DCMITYPE.Image,
48
+ 'electronic component' => RDF::DCMITYPE.Image,
49
+ 'postcard' => RDF::DCMITYPE.Image,
50
+ 'equipment' => RDF::DCMITYPE.Image,
51
+ 'cartographic' => RDF::DCMITYPE.Image,
52
+ 'notated music' => RDF::DCMITYPE.Image,
53
+ 'mixed material' => RDF::DCMITYPE.Image,
54
+ 'text' => RDF::DCMITYPE.Text,
55
+ 'book' => RDF::DCMITYPE.Text,
56
+ 'publication' => RDF::DCMITYPE.Text,
57
+ 'magazine' => RDF::DCMITYPE.Text,
58
+ 'journal' => RDF::DCMITYPE.Text,
59
+ 'correspondence' => RDF::DCMITYPE.Text,
60
+ 'writing' => RDF::DCMITYPE.Text,
61
+ 'written' => RDF::DCMITYPE.Text,
62
+ 'manuscript' => RDF::DCMITYPE.Text,
63
+ 'audio' => RDF::DCMITYPE.Sound,
64
+ 'sound' => RDF::DCMITYPE.Sound,
65
+ 'oral history recording' => RDF::DCMITYPE.Sound,
66
+ 'finding aid' => RDF::DCMITYPE.Collection,
67
+ 'online collection' => RDF::DCMITYPE.Collection,
68
+ 'electronic resource' => RDF::DCMITYPE.InteractiveResource,
69
+ 'video game' => RDF::DCMITYPE.InteractiveResource,
70
+ 'online exhibit' => RDF::DCMITYPE.InteractiveResource,
71
+ 'moving image' => RDF::DCMITYPE.MovingImage,
72
+ 'movingimage' => RDF::DCMITYPE.MovingImage,
73
+ 'motion picture' => RDF::DCMITYPE.MovingImage,
74
+ 'film' => RDF::DCMITYPE.MovingImage,
75
+ 'video' => RDF::DCMITYPE.MovingImage,
76
+ 'object' => RDF::DCMITYPE.PhysicalObject
77
+ }
78
+
79
+ ##
80
+ # @param map [Hash<String, RDF::Vocabulary::Term>]
81
+ def initialize(map = nil)
82
+ @map = map || DEFAULT_MAP
83
+ end
84
+
85
+ ##
86
+ # @param value [Object] the value to enrich
87
+ #
88
+ # @return [DPLA::MAP::Controlled::DCMIType, nil] the matching DCMI Type
89
+ # term. `nil` if no matches are found.
90
+ def enrich_value(value)
91
+ return value unless value.is_a? String
92
+
93
+ match = @map.fetch(value.downcase) { most_similar(value) }
94
+ return value if match.nil?
95
+ dcmi = DPLA::MAP::Controlled::DCMIType.new(match)
96
+ dcmi.prefLabel = match.label
97
+ dcmi
98
+ end
99
+
100
+
101
+ private
102
+
103
+ ##
104
+ # Performs White Similarity comparison against the keys, and gives the
105
+ # value of the closest match.
106
+ #
107
+ # @param value [String] a string value to compare to the hash map keys.
108
+ # @param threshold [Float] the value at which a string is considered to
109
+ # be a match
110
+ #
111
+ # @return [RDF::Vocabulary::Term, nil] the closest DCMI type match, or `nil`
112
+ # if none is sufficiently close
113
+ #
114
+ # @see Text::WhiteSimilarity
115
+ # @see http://www.catalysoft.com/articles/strikeamatch.html article defining
116
+ # the White Similarity algorithm
117
+ #
118
+ # @todo consider text similarity algorithms/strategies and move text
119
+ # matching to a utility and behind a Facade interface.
120
+ def most_similar(value, threshold = 0.5)
121
+ @white ||= Text::WhiteSimilarity.new
122
+ result = @map.max_by { |str, _| @white.similarity(value, str) }
123
+
124
+ return result[1] if @white.similarity(value, result.first) > threshold
125
+ nil
126
+ end
127
+ end
128
+ end
@@ -0,0 +1,8 @@
1
+ module Krikri::Enrichments
2
+ ##
3
+ #
4
+ #
5
+ class DcmiTypeMap
6
+ include Krikri::FieldEnrichment
7
+ end
8
+ end
@@ -0,0 +1,72 @@
1
+ module Krikri::Enrichments
2
+ ##
3
+ # Enrichment to remove duplicate blank nodes from an
4
+ # {ActiveTriples::Resource}, where "duplicate" means having the same
5
+ # `providedLabel`. URIs and Literal values are retained.
6
+ #
7
+ # @example
8
+ # # given a SourceResource
9
+ # sourceResource.creator
10
+ # # => [#<DPLA::MAP::Agent:0x3fa8828e08e0(default)>,
11
+ # #<DPLA::MAP::Agent:0x3fa882910220(default)>,
12
+ # #<DPLA::MAP::Agent:0x3fa882942ce8(default)>]
13
+ #
14
+ # sourceResource.creator.map(&:rdf_subject)
15
+ # # => [#<RDF::Node:0x3fa8828e0674(_:g69992977401460)>,
16
+ # #<RDF::Node:0x3fa882913d08(_:g69992977612040)>,
17
+ # #<RDF::URI:0x3fa882942748 URI:http://example.org/moomin>]
18
+ # sourceResource.creator.map(&:providedLabel)
19
+ # # => [["moomin"], ["moomin"], ["moomin"]]
20
+ #
21
+ # enrich = Krikri::Enrichments::DedupNodes.new
22
+ # new_sr = enrich.enrich_value(sourceResource)
23
+ #
24
+ # new_sr.creator
25
+ # # => [#<DPLA::MAP::Agent:0x3fa8828e08e0(default)>,
26
+ # #<DPLA::MAP::Agent:0x3fa882942ce8(default)>]
27
+ #
28
+ # sourceResource.creator.map(&:rdf_subject)
29
+ # # => [#<RDF::Node:0x3fa8828e0674(_:g69992977401460)>,
30
+ # #<RDF::URI:0x3fa882942748 URI:http://example.org/moomin>]
31
+ #
32
+ class DedupNodes
33
+ include Krikri::FieldEnrichment
34
+
35
+ ##
36
+ # @param value [Object]
37
+ #
38
+ # @return [Object] the original value altered to remove nodes with the same
39
+ # `providedLabel`, if any
40
+ def enrich_value(value)
41
+ return value unless value.is_a? ActiveTriples::Resource
42
+ deduplicate_resource(value)
43
+ value
44
+ end
45
+
46
+ private
47
+
48
+ ##
49
+ # @param value [ActiveTriples::Resource]
50
+ #
51
+ # @return [ActiveTriples::Resource] returns the node after running `#uniq`
52
+ # against the provided labels of an nodes.
53
+ def deduplicate_resource(value)
54
+ value.class.properties.values.map(&:term).map do |property|
55
+ unique = value.send(property).uniq { |v| providedLabel_or_value(v) }
56
+ value.send("#{property}=".to_sym, unique)
57
+ end
58
+ end
59
+
60
+ ##
61
+ # @param value [Object]
62
+ #
63
+ # @return [Object] if `value` is an RDF::Node, the first result of its
64
+ # `#providedLabel`, if any; otherwise the original `value`.
65
+ def providedLabel_or_value(value)
66
+ return value unless value.respond_to? :providedLabel
67
+ return value unless value.node?
68
+ return value.providedLabel.first if value.providedLabel.any?
69
+ value
70
+ end
71
+ end
72
+ end