krikri 0.10.0 → 0.10.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (286) 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/original_record_desc.rb~ +6 -0
  6. data/app/models/krikri/original_record_metadata.rb~ +9 -0
  7. data/app/models/krikri/parser.rb~ +5 -0
  8. data/app/models/krikri/parsers/xml_parser.rb~ +5 -0
  9. data/app/models/krikri/qa_report.rb~ +7 -0
  10. data/app/views/krikri/qa_reports/index.html.erb~ +3 -0
  11. data/app/views/krikri/qa_reports/show.html.erb~ +1 -0
  12. data/config/initializers/config.rb~ +19 -0
  13. data/config/settings/test.yml~ +3 -0
  14. data/db/migrate/20150328035550_add_qa_report.rb~ +11 -0
  15. data/lib/krikri/ldp/container.rb~ +22 -0
  16. data/lib/krikri/ldp/nr_source.rb~ +4 -0
  17. data/lib/krikri/ldp/rdf_source.rb~ +24 -0
  18. data/lib/krikri/ldp/resource.rb~ +49 -0
  19. data/lib/krikri/map_crosswalk.rb +1 -1
  20. data/lib/krikri/parsers/json_parser.rb~ +17 -0
  21. data/lib/krikri/parsers/oai_headers.rb~ +4 -0
  22. data/lib/krikri/parsers/oai_parser.rb~ +2 -0
  23. data/lib/krikri/parsers/oai_parser_headers.rb~ +4 -0
  24. data/lib/krikri/parsers/xml_parser.rb~ +61 -0
  25. data/lib/krikri/util/edtf_converter.rb~ +26 -0
  26. data/lib/krikri/util/extended_date_parser.rb~ +70 -0
  27. data/lib/krikri/version.rb +1 -1
  28. data/lib/tasks/jetty.rake~ +12 -0
  29. data/lib/tasks/krikri.rake~ +20 -0
  30. data/spec/controllers/application_controller_spec.rb~ +11 -0
  31. data/spec/controllers/qa_reports_controller_spec.rb~ +15 -0
  32. data/spec/controllers/records_controller_spec.rb~ +11 -0
  33. data/spec/controllers/reports_controller_spec.rb~ +6 -0
  34. data/spec/controllers/validation_reports_controller_spec.rb~ +15 -0
  35. data/spec/factories/krikri_original_record.rb~ +5 -0
  36. data/spec/factories/krikri_provider.rb~ +7 -0
  37. data/spec/factories/krikri_provider_spec.rb~ +7 -0
  38. data/spec/factories/krikri_qa_report.rb~ +8 -0
  39. data/spec/helpers/krikri/application_helper_spec.rb~ +16 -0
  40. data/spec/internal/Gemfile +2 -3
  41. data/spec/internal/Gemfile.lock +120 -143
  42. data/spec/internal/config/initializers/blacklight_initializer.rb +1 -1
  43. data/spec/internal/config/initializers/devise.rb +2 -2
  44. data/spec/internal/config/secrets.yml +2 -2
  45. data/spec/internal/db/development.sqlite3 +0 -0
  46. data/spec/internal/db/migrate/{20150812153900_devise_create_users.rb → 20151222175607_devise_create_users.rb} +0 -0
  47. data/spec/internal/db/migrate/{20150812153941_create_searches.blacklight.rb → 20151222175629_create_searches.blacklight.rb} +0 -0
  48. data/spec/internal/db/migrate/{20150812153942_create_bookmarks.blacklight.rb → 20151222175630_create_bookmarks.blacklight.rb} +0 -0
  49. data/spec/internal/db/migrate/{20150812153943_add_polymorphic_type_to_bookmarks.blacklight.rb → 20151222175631_add_polymorphic_type_to_bookmarks.blacklight.rb} +0 -0
  50. data/spec/internal/db/schema.rb +1 -1
  51. data/spec/internal/db/test.sqlite3 +0 -0
  52. data/spec/internal/db/test.sqlite3-journal +0 -0
  53. data/spec/internal/lib/generators/test_app_generator.rb~ +14 -0
  54. data/spec/internal/log/development.log +93 -93
  55. data/spec/internal/log/test.log +4313 -6427
  56. data/spec/internal/tmp/cache/assets/test/sass/{622890f0980fe8cd9e30bdaab5a7914245d2443e → 4a3ee647961c7e45976eb2c0a94406aad3427b3d}/_alerts.scssc +0 -0
  57. data/spec/internal/tmp/cache/assets/test/sass/{622890f0980fe8cd9e30bdaab5a7914245d2443e → 4a3ee647961c7e45976eb2c0a94406aad3427b3d}/_background-variant.scssc +0 -0
  58. data/spec/internal/tmp/cache/assets/test/sass/{622890f0980fe8cd9e30bdaab5a7914245d2443e → 4a3ee647961c7e45976eb2c0a94406aad3427b3d}/_border-radius.scssc +0 -0
  59. data/spec/internal/tmp/cache/assets/test/sass/{622890f0980fe8cd9e30bdaab5a7914245d2443e → 4a3ee647961c7e45976eb2c0a94406aad3427b3d}/_buttons.scssc +0 -0
  60. data/spec/internal/tmp/cache/assets/test/sass/{622890f0980fe8cd9e30bdaab5a7914245d2443e → 4a3ee647961c7e45976eb2c0a94406aad3427b3d}/_center-block.scssc +0 -0
  61. data/spec/internal/tmp/cache/assets/test/sass/{622890f0980fe8cd9e30bdaab5a7914245d2443e → 4a3ee647961c7e45976eb2c0a94406aad3427b3d}/_clearfix.scssc +0 -0
  62. data/spec/internal/tmp/cache/assets/test/sass/{622890f0980fe8cd9e30bdaab5a7914245d2443e → 4a3ee647961c7e45976eb2c0a94406aad3427b3d}/_forms.scssc +0 -0
  63. data/spec/internal/tmp/cache/assets/test/sass/{622890f0980fe8cd9e30bdaab5a7914245d2443e → 4a3ee647961c7e45976eb2c0a94406aad3427b3d}/_gradients.scssc +0 -0
  64. data/spec/internal/tmp/cache/assets/test/sass/{622890f0980fe8cd9e30bdaab5a7914245d2443e → 4a3ee647961c7e45976eb2c0a94406aad3427b3d}/_grid-framework.scssc +0 -0
  65. data/spec/internal/tmp/cache/assets/test/sass/{622890f0980fe8cd9e30bdaab5a7914245d2443e → 4a3ee647961c7e45976eb2c0a94406aad3427b3d}/_grid.scssc +0 -0
  66. data/spec/internal/tmp/cache/assets/test/sass/{622890f0980fe8cd9e30bdaab5a7914245d2443e → 4a3ee647961c7e45976eb2c0a94406aad3427b3d}/_hide-text.scssc +0 -0
  67. data/spec/internal/tmp/cache/assets/test/sass/{622890f0980fe8cd9e30bdaab5a7914245d2443e → 4a3ee647961c7e45976eb2c0a94406aad3427b3d}/_image.scssc +0 -0
  68. data/spec/internal/tmp/cache/assets/test/sass/{622890f0980fe8cd9e30bdaab5a7914245d2443e → 4a3ee647961c7e45976eb2c0a94406aad3427b3d}/_labels.scssc +0 -0
  69. data/spec/internal/tmp/cache/assets/test/sass/{622890f0980fe8cd9e30bdaab5a7914245d2443e → 4a3ee647961c7e45976eb2c0a94406aad3427b3d}/_list-group.scssc +0 -0
  70. data/spec/internal/tmp/cache/assets/test/sass/{622890f0980fe8cd9e30bdaab5a7914245d2443e → 4a3ee647961c7e45976eb2c0a94406aad3427b3d}/_nav-divider.scssc +0 -0
  71. data/spec/internal/tmp/cache/assets/test/sass/{622890f0980fe8cd9e30bdaab5a7914245d2443e → 4a3ee647961c7e45976eb2c0a94406aad3427b3d}/_nav-vertical-align.scssc +0 -0
  72. data/spec/internal/tmp/cache/assets/test/sass/{622890f0980fe8cd9e30bdaab5a7914245d2443e → 4a3ee647961c7e45976eb2c0a94406aad3427b3d}/_opacity.scssc +0 -0
  73. data/spec/internal/tmp/cache/assets/test/sass/{622890f0980fe8cd9e30bdaab5a7914245d2443e → 4a3ee647961c7e45976eb2c0a94406aad3427b3d}/_pagination.scssc +0 -0
  74. data/spec/internal/tmp/cache/assets/test/sass/{622890f0980fe8cd9e30bdaab5a7914245d2443e → 4a3ee647961c7e45976eb2c0a94406aad3427b3d}/_panels.scssc +0 -0
  75. data/spec/internal/tmp/cache/assets/test/sass/{622890f0980fe8cd9e30bdaab5a7914245d2443e → 4a3ee647961c7e45976eb2c0a94406aad3427b3d}/_progress-bar.scssc +0 -0
  76. data/spec/internal/tmp/cache/assets/test/sass/{622890f0980fe8cd9e30bdaab5a7914245d2443e → 4a3ee647961c7e45976eb2c0a94406aad3427b3d}/_reset-filter.scssc +0 -0
  77. data/spec/internal/tmp/cache/assets/test/sass/{622890f0980fe8cd9e30bdaab5a7914245d2443e → 4a3ee647961c7e45976eb2c0a94406aad3427b3d}/_resize.scssc +0 -0
  78. data/spec/internal/tmp/cache/assets/test/sass/{622890f0980fe8cd9e30bdaab5a7914245d2443e → 4a3ee647961c7e45976eb2c0a94406aad3427b3d}/_responsive-visibility.scssc +0 -0
  79. data/spec/internal/tmp/cache/assets/test/sass/{622890f0980fe8cd9e30bdaab5a7914245d2443e → 4a3ee647961c7e45976eb2c0a94406aad3427b3d}/_size.scssc +0 -0
  80. data/spec/internal/tmp/cache/assets/test/sass/{622890f0980fe8cd9e30bdaab5a7914245d2443e → 4a3ee647961c7e45976eb2c0a94406aad3427b3d}/_tab-focus.scssc +0 -0
  81. data/spec/internal/tmp/cache/assets/test/sass/{622890f0980fe8cd9e30bdaab5a7914245d2443e → 4a3ee647961c7e45976eb2c0a94406aad3427b3d}/_table-row.scssc +0 -0
  82. data/spec/internal/tmp/cache/assets/test/sass/{622890f0980fe8cd9e30bdaab5a7914245d2443e → 4a3ee647961c7e45976eb2c0a94406aad3427b3d}/_text-emphasis.scssc +0 -0
  83. data/spec/internal/tmp/cache/assets/test/sass/{622890f0980fe8cd9e30bdaab5a7914245d2443e → 4a3ee647961c7e45976eb2c0a94406aad3427b3d}/_text-overflow.scssc +0 -0
  84. data/spec/internal/tmp/cache/assets/test/sass/{622890f0980fe8cd9e30bdaab5a7914245d2443e → 4a3ee647961c7e45976eb2c0a94406aad3427b3d}/_vendor-prefixes.scssc +0 -0
  85. data/spec/internal/tmp/cache/assets/test/sass/{0f463fae8ec59cbdc602859dac6f3131b47588e5 → 93e201cf4a11978a1f491a057a3bd569c3825210}/blacklight.css.scssc +0 -0
  86. data/spec/internal/tmp/cache/assets/test/sass/{93f97edda53560c38d0d029e30e3b3a93212c1b8 → a1ec1bb9c9cafeb054d542e861ebc8ffd5904439}/_alerts.scssc +0 -0
  87. data/spec/internal/tmp/cache/assets/test/sass/{93f97edda53560c38d0d029e30e3b3a93212c1b8 → a1ec1bb9c9cafeb054d542e861ebc8ffd5904439}/_badges.scssc +0 -0
  88. data/spec/internal/tmp/cache/assets/test/sass/{93f97edda53560c38d0d029e30e3b3a93212c1b8 → a1ec1bb9c9cafeb054d542e861ebc8ffd5904439}/_breadcrumbs.scssc +0 -0
  89. data/spec/internal/tmp/cache/assets/test/sass/{93f97edda53560c38d0d029e30e3b3a93212c1b8 → a1ec1bb9c9cafeb054d542e861ebc8ffd5904439}/_button-groups.scssc +0 -0
  90. data/spec/internal/tmp/cache/assets/test/sass/{93f97edda53560c38d0d029e30e3b3a93212c1b8 → a1ec1bb9c9cafeb054d542e861ebc8ffd5904439}/_buttons.scssc +0 -0
  91. data/spec/internal/tmp/cache/assets/test/sass/{93f97edda53560c38d0d029e30e3b3a93212c1b8 → a1ec1bb9c9cafeb054d542e861ebc8ffd5904439}/_carousel.scssc +0 -0
  92. data/spec/internal/tmp/cache/assets/test/sass/{93f97edda53560c38d0d029e30e3b3a93212c1b8 → a1ec1bb9c9cafeb054d542e861ebc8ffd5904439}/_close.scssc +0 -0
  93. data/spec/internal/tmp/cache/assets/test/sass/{93f97edda53560c38d0d029e30e3b3a93212c1b8 → a1ec1bb9c9cafeb054d542e861ebc8ffd5904439}/_code.scssc +0 -0
  94. data/spec/internal/tmp/cache/assets/test/sass/{93f97edda53560c38d0d029e30e3b3a93212c1b8 → a1ec1bb9c9cafeb054d542e861ebc8ffd5904439}/_component-animations.scssc +0 -0
  95. data/spec/internal/tmp/cache/assets/test/sass/{93f97edda53560c38d0d029e30e3b3a93212c1b8 → a1ec1bb9c9cafeb054d542e861ebc8ffd5904439}/_dropdowns.scssc +0 -0
  96. data/spec/internal/tmp/cache/assets/test/sass/{93f97edda53560c38d0d029e30e3b3a93212c1b8 → a1ec1bb9c9cafeb054d542e861ebc8ffd5904439}/_forms.scssc +0 -0
  97. data/spec/internal/tmp/cache/assets/test/sass/{93f97edda53560c38d0d029e30e3b3a93212c1b8 → a1ec1bb9c9cafeb054d542e861ebc8ffd5904439}/_glyphicons.scssc +0 -0
  98. data/spec/internal/tmp/cache/assets/test/sass/{93f97edda53560c38d0d029e30e3b3a93212c1b8 → a1ec1bb9c9cafeb054d542e861ebc8ffd5904439}/_grid.scssc +0 -0
  99. data/spec/internal/tmp/cache/assets/test/sass/{93f97edda53560c38d0d029e30e3b3a93212c1b8 → a1ec1bb9c9cafeb054d542e861ebc8ffd5904439}/_input-groups.scssc +0 -0
  100. data/spec/internal/tmp/cache/assets/test/sass/{93f97edda53560c38d0d029e30e3b3a93212c1b8 → a1ec1bb9c9cafeb054d542e861ebc8ffd5904439}/_jumbotron.scssc +0 -0
  101. data/spec/internal/tmp/cache/assets/test/sass/{93f97edda53560c38d0d029e30e3b3a93212c1b8 → a1ec1bb9c9cafeb054d542e861ebc8ffd5904439}/_labels.scssc +0 -0
  102. data/spec/internal/tmp/cache/assets/test/sass/{93f97edda53560c38d0d029e30e3b3a93212c1b8 → a1ec1bb9c9cafeb054d542e861ebc8ffd5904439}/_list-group.scssc +0 -0
  103. data/spec/internal/tmp/cache/assets/test/sass/{93f97edda53560c38d0d029e30e3b3a93212c1b8 → a1ec1bb9c9cafeb054d542e861ebc8ffd5904439}/_media.scssc +0 -0
  104. data/spec/internal/tmp/cache/assets/test/sass/{93f97edda53560c38d0d029e30e3b3a93212c1b8 → a1ec1bb9c9cafeb054d542e861ebc8ffd5904439}/_mixins.scssc +0 -0
  105. data/spec/internal/tmp/cache/assets/test/sass/{93f97edda53560c38d0d029e30e3b3a93212c1b8 → a1ec1bb9c9cafeb054d542e861ebc8ffd5904439}/_modals.scssc +0 -0
  106. data/spec/internal/tmp/cache/assets/test/sass/{93f97edda53560c38d0d029e30e3b3a93212c1b8 → a1ec1bb9c9cafeb054d542e861ebc8ffd5904439}/_navbar.scssc +0 -0
  107. data/spec/internal/tmp/cache/assets/test/sass/{93f97edda53560c38d0d029e30e3b3a93212c1b8 → a1ec1bb9c9cafeb054d542e861ebc8ffd5904439}/_navs.scssc +0 -0
  108. data/spec/internal/tmp/cache/assets/test/sass/{93f97edda53560c38d0d029e30e3b3a93212c1b8 → a1ec1bb9c9cafeb054d542e861ebc8ffd5904439}/_normalize.scssc +0 -0
  109. data/spec/internal/tmp/cache/assets/test/sass/{93f97edda53560c38d0d029e30e3b3a93212c1b8 → a1ec1bb9c9cafeb054d542e861ebc8ffd5904439}/_pager.scssc +0 -0
  110. data/spec/internal/tmp/cache/assets/test/sass/{93f97edda53560c38d0d029e30e3b3a93212c1b8 → a1ec1bb9c9cafeb054d542e861ebc8ffd5904439}/_pagination.scssc +0 -0
  111. data/spec/internal/tmp/cache/assets/test/sass/{93f97edda53560c38d0d029e30e3b3a93212c1b8 → a1ec1bb9c9cafeb054d542e861ebc8ffd5904439}/_panels.scssc +0 -0
  112. data/spec/internal/tmp/cache/assets/test/sass/{93f97edda53560c38d0d029e30e3b3a93212c1b8 → a1ec1bb9c9cafeb054d542e861ebc8ffd5904439}/_popovers.scssc +0 -0
  113. data/spec/internal/tmp/cache/assets/test/sass/{93f97edda53560c38d0d029e30e3b3a93212c1b8 → a1ec1bb9c9cafeb054d542e861ebc8ffd5904439}/_print.scssc +0 -0
  114. data/spec/internal/tmp/cache/assets/test/sass/{93f97edda53560c38d0d029e30e3b3a93212c1b8 → a1ec1bb9c9cafeb054d542e861ebc8ffd5904439}/_progress-bars.scssc +0 -0
  115. data/spec/internal/tmp/cache/assets/test/sass/{93f97edda53560c38d0d029e30e3b3a93212c1b8 → a1ec1bb9c9cafeb054d542e861ebc8ffd5904439}/_responsive-embed.scssc +0 -0
  116. data/spec/internal/tmp/cache/assets/test/sass/{93f97edda53560c38d0d029e30e3b3a93212c1b8 → a1ec1bb9c9cafeb054d542e861ebc8ffd5904439}/_responsive-utilities.scssc +0 -0
  117. data/spec/internal/tmp/cache/assets/test/sass/{93f97edda53560c38d0d029e30e3b3a93212c1b8 → a1ec1bb9c9cafeb054d542e861ebc8ffd5904439}/_scaffolding.scssc +0 -0
  118. data/spec/internal/tmp/cache/assets/test/sass/{93f97edda53560c38d0d029e30e3b3a93212c1b8 → a1ec1bb9c9cafeb054d542e861ebc8ffd5904439}/_tables.scssc +0 -0
  119. data/spec/internal/tmp/cache/assets/test/sass/{93f97edda53560c38d0d029e30e3b3a93212c1b8 → a1ec1bb9c9cafeb054d542e861ebc8ffd5904439}/_thumbnails.scssc +0 -0
  120. data/spec/internal/tmp/cache/assets/test/sass/{93f97edda53560c38d0d029e30e3b3a93212c1b8 → a1ec1bb9c9cafeb054d542e861ebc8ffd5904439}/_tooltip.scssc +0 -0
  121. data/spec/internal/tmp/cache/assets/test/sass/{93f97edda53560c38d0d029e30e3b3a93212c1b8 → a1ec1bb9c9cafeb054d542e861ebc8ffd5904439}/_type.scssc +0 -0
  122. data/spec/internal/tmp/cache/assets/test/sass/{93f97edda53560c38d0d029e30e3b3a93212c1b8 → a1ec1bb9c9cafeb054d542e861ebc8ffd5904439}/_utilities.scssc +0 -0
  123. data/spec/internal/tmp/cache/assets/test/sass/{93f97edda53560c38d0d029e30e3b3a93212c1b8 → a1ec1bb9c9cafeb054d542e861ebc8ffd5904439}/_variables.scssc +0 -0
  124. data/spec/internal/tmp/cache/assets/test/sass/{93f97edda53560c38d0d029e30e3b3a93212c1b8 → a1ec1bb9c9cafeb054d542e861ebc8ffd5904439}/_wells.scssc +0 -0
  125. data/spec/internal/tmp/cache/assets/test/sass/{c50f52d2eeadabb7c9bfad3246524fac09113575 → b28605b1c659cf09fc72f3c1fff32918869d28b8}/_bootstrap-sprockets.scssc +0 -0
  126. data/spec/internal/tmp/cache/assets/test/sass/{c50f52d2eeadabb7c9bfad3246524fac09113575 → b28605b1c659cf09fc72f3c1fff32918869d28b8}/_bootstrap.scssc +0 -0
  127. data/spec/internal/tmp/cache/assets/test/sass/{80ea3b25063dd984130d99a1c4278f3cd1b013f1 → ca8c12d03785e0d6cd4554f4d3939e7836d38282}/_blacklight_base.scssc +0 -0
  128. data/spec/internal/tmp/cache/assets/test/sass/{80ea3b25063dd984130d99a1c4278f3cd1b013f1 → ca8c12d03785e0d6cd4554f4d3939e7836d38282}/blacklight.scssc +0 -0
  129. data/spec/internal/tmp/cache/assets/test/sprockets/4052820c15af72ba690230a0f92bd75e +0 -0
  130. data/spec/internal/tmp/cache/assets/test/sprockets/496a0d7dce1ff6bf4a9c3a089ea3a635 +0 -0
  131. data/spec/internal/tmp/cache/assets/test/sprockets/50b9db0b908b421a9b941a445dbaeacc +0 -0
  132. data/spec/internal/tmp/cache/assets/test/sprockets/528c628cf107f8be6dd122e1154344be +0 -0
  133. data/spec/internal/tmp/cache/assets/test/sprockets/8edfca9082e02111be92e79000667f22 +0 -0
  134. data/spec/internal/tmp/cache/assets/test/sprockets/90b54a819800edfa41b67722d1561040 +0 -0
  135. data/spec/internal/tmp/cache/assets/test/sprockets/9c653367feff82588eb6041d783a5809 +0 -0
  136. data/spec/internal/tmp/cache/assets/test/sprockets/b35e12934e9f05662777579549e31cd7 +0 -0
  137. data/spec/internal/tmp/cache/assets/test/sprockets/bb108ef3fc4c96d1c20cc41f97d943a0 +0 -0
  138. data/spec/internal/tmp/cache/assets/test/sprockets/dbba4bbc32c17ade3d618c5d0baeb371 +0 -0
  139. data/spec/internal/tmp/cache/assets/test/sprockets/e9f7ccc553ce1a217709cc7a08cfb032 +0 -0
  140. data/spec/internal/tmp/cache/assets/test/sprockets/f274b5f22db177b6464b50691d531688 +0 -0
  141. data/spec/krikri_spec.rb~ +30 -0
  142. data/spec/ldp/active_triples_spec.rb~ +15 -0
  143. data/spec/ldp/at_resource_spec.rb~ +41 -0
  144. data/spec/ldp/nr_source_spec.rb~ +3 -0
  145. data/spec/ldp/rdf_source_spec.rb~ +4 -0
  146. data/spec/ldp/resource_spec.rb~ +49 -0
  147. data/spec/lib/krikri/enrichment_agent_spec.rb~ +4 -0
  148. data/spec/lib/krikri/harvesters/api_harvester_spec.rb~ +47 -0
  149. data/spec/lib/krikri/harvesters/basic_save_behavior_spec.rb~ +12 -0
  150. data/spec/lib/krikri/harvesters/file_harvester_spec.rb~ +3 -0
  151. data/spec/lib/krikri/harvesters/harvest_behavior_spec.rb~ +5 -0
  152. data/spec/lib/krikri/harvesters/mdl_api_harvester_spec.rb~ +11 -0
  153. data/spec/lib/krikri/harvesters/mdl_harvester_spec.rb~ +8 -0
  154. data/spec/lib/krikri/harvesters/oai_skip_deleted_behavior.rb~ +7 -0
  155. data/spec/lib/krikri/harvesters/oai_skip_deleted_behavior_spec.rb~ +15 -0
  156. data/spec/lib/krikri/id_service_spec.rb~ +3 -0
  157. data/spec/lib/krikri/job_spec.rb~ +13 -0
  158. data/spec/lib/krikri/map_crosswalk_spec.rb +23 -0
  159. data/spec/lib/krikri/map_crosswalk_spec.rb~ +5 -0
  160. data/spec/lib/krikri/mapper_agent_spec.rb~ +64 -0
  161. data/spec/lib/krikri/mapper_spec.rb~ +5 -0
  162. data/spec/lib/krikri/mapping_dsl/parser_methods_spec.rb~ +65 -0
  163. data/spec/lib/krikri/mapping_dsl/property_declaration_spec.rb~ +87 -0
  164. data/spec/lib/krikri/mapping_dsl/rdf_subjects_spec.rb~ +16 -0
  165. data/spec/lib/krikri/mapping_dsl_spec.rb~ +10 -0
  166. data/spec/lib/krikri/mapping_job.rb~ +12 -0
  167. data/spec/lib/krikri/mapping_job_spec.rb~ +11 -0
  168. data/spec/lib/krikri/mapping_spec.rb~ +5 -0
  169. data/spec/lib/krikri/md5_minter_spec.rb~ +5 -0
  170. data/spec/lib/krikri/parser_value_array.rb~ +5 -0
  171. data/spec/lib/krikri/parsers/json_parser_spec.rb~ +17 -0
  172. data/spec/lib/krikri/parsers/xml_parser_spec.rb~ +21 -0
  173. data/spec/lib/krikri/provenance_query_client.rb~ +5 -0
  174. data/spec/lib/krikri/provenance_query_client_spec.rb~ +8 -0
  175. data/spec/lib/krikri/qa_query_client_spec.rb~ +9 -0
  176. data/spec/lib/krikri/random_search_index_docmument_builder_spec.rb~ +6 -0
  177. data/spec/lib/krikri/util/edtf_converter_spec.rb~ +17 -0
  178. data/spec/lib/krikri/util/extended_date_parser_spec.rb~ +102 -0
  179. data/spec/models/activity_spec.rb~ +41 -0
  180. data/spec/models/dpla/map/aggregation_spec.rb~ +67 -0
  181. data/spec/models/harvesters/oai_harvester_spec.rb~ +15 -0
  182. data/spec/models/mapper_spec.rb~ +5 -0
  183. data/spec/models/original_record_metadata_spec.rb~ +5 -0
  184. data/spec/models/original_record_spec.rb~ +5 -0
  185. data/spec/models/provider_spec.rb~ +33 -0
  186. data/spec/models/qa_report_spec.rb~ +64 -0
  187. data/spec/models/validation_report_spec.rb~ +15 -0
  188. data/spec/support/shared_contexts/indexed_item.rb~ +15 -0
  189. data/spec/support/shared_contexts/mapping_dsl.rb~ +12 -0
  190. data/spec/support/shared_contexts/provenance_query_client.rb~ +6 -0
  191. data/spec/support/shared_contexts/rake.rb~ +21 -0
  192. data/spec/support/shared_examples/enrichment.rb~ +5 -0
  193. data/spec/support/shared_examples/harvest_behavior.rb~ +13 -0
  194. data/spec/support/shared_examples/job.rb~ +20 -0
  195. data/spec/support/shared_examples/ldp_resource.rb~ +4 -0
  196. data/spec/support/shared_examples/oai_parser_headers.rb~ +12 -0
  197. data/spec/support/shared_examples/rdf_source.rb~ +1 -0
  198. data/spec/support/shared_examples/software_agent.rb~ +5 -0
  199. data/spec/support/shared_examples/string_enrichment.rb~ +12 -0
  200. data/spec/test_app_templates/lib/generators/test_app_generator.rb~ +14 -0
  201. data/spec/views/krikri/providers/index.html.erb_spec.rb~ +3 -0
  202. data/spec/views/krikri/providers/show.html.erb.spec~ +12 -0
  203. data/spec/views/krikri/providers/show.html.erb_spec.rb~ +10 -0
  204. data/spec/views/krikri/qa_reports/index.html.erb_spec.rb~ +17 -0
  205. data/spec/views/krikri/qa_reports/show.html.erb_spec.rb~ +22 -0
  206. data/spec/views/krikri/records/index.html.erb_spec.rb~ +15 -0
  207. data/spec/views/krikri/records/show.html.erb_spec.rb~ +8 -0
  208. data/spec/views/krikri/reports/index.html.erb_spec.rb~ +5 -0
  209. data/spec/webmocks/oai.rb~ +13 -0
  210. metadata +516 -458
  211. data/spec/internal/tmp/cache/318/301/krikri%2Fapplication_helper%2Favailable_providers +0 -0
  212. data/spec/internal/tmp/cache/assets/test/sass/80ea3b25063dd984130d99a1c4278f3cd1b013f1/_bookmark.scssc +0 -0
  213. data/spec/internal/tmp/cache/assets/test/sass/80ea3b25063dd984130d99a1c4278f3cd1b013f1/_catalog.scssc +0 -0
  214. data/spec/internal/tmp/cache/assets/test/sass/80ea3b25063dd984130d99a1c4278f3cd1b013f1/_facets.scssc +0 -0
  215. data/spec/internal/tmp/cache/assets/test/sass/80ea3b25063dd984130d99a1c4278f3cd1b013f1/_group.scssc +0 -0
  216. data/spec/internal/tmp/cache/assets/test/sass/80ea3b25063dd984130d99a1c4278f3cd1b013f1/_header.scssc +0 -0
  217. data/spec/internal/tmp/cache/assets/test/sass/80ea3b25063dd984130d99a1c4278f3cd1b013f1/_layout.scssc +0 -0
  218. data/spec/internal/tmp/cache/assets/test/sass/80ea3b25063dd984130d99a1c4278f3cd1b013f1/_modal.scssc +0 -0
  219. data/spec/internal/tmp/cache/assets/test/sass/80ea3b25063dd984130d99a1c4278f3cd1b013f1/_search_history.scssc +0 -0
  220. data/spec/internal/tmp/cache/assets/test/sass/80ea3b25063dd984130d99a1c4278f3cd1b013f1/blacklight_defaults.scssc +0 -0
  221. data/spec/internal/tmp/cache/assets/test/sprockets/0a25eb99290a6b015dfe4c29d8585cec +0 -0
  222. data/spec/internal/tmp/cache/assets/test/sprockets/0b3eca32a0c1d368e88a01be94ca7f6b +0 -0
  223. data/spec/internal/tmp/cache/assets/test/sprockets/0fe9919db7899ede10068d0d9d3adfa8 +0 -0
  224. data/spec/internal/tmp/cache/assets/test/sprockets/1153a153512ddd535004623e0bbdc1c4 +0 -0
  225. data/spec/internal/tmp/cache/assets/test/sprockets/13fe41fee1fe35b49d145bcc06610705 +0 -0
  226. data/spec/internal/tmp/cache/assets/test/sprockets/142790b68ce01969e4bbdd1d2a90b18c +0 -0
  227. data/spec/internal/tmp/cache/assets/test/sprockets/154af7ce6de6c616d3c1c654904a88de +0 -0
  228. data/spec/internal/tmp/cache/assets/test/sprockets/1a6f0128e8b6cc52594e7e16506dd476 +0 -0
  229. data/spec/internal/tmp/cache/assets/test/sprockets/2f5173deea6c795b8fdde723bb4b63af +0 -0
  230. data/spec/internal/tmp/cache/assets/test/sprockets/30183a6c313ab79c8ffc2711dc633ea5 +0 -0
  231. data/spec/internal/tmp/cache/assets/test/sprockets/3290971c05649c7d11051df70b2fefbb +0 -0
  232. data/spec/internal/tmp/cache/assets/test/sprockets/357970feca3ac29060c1e3861e2c0953 +0 -0
  233. data/spec/internal/tmp/cache/assets/test/sprockets/35c0cb4e1848557e53960891cf2bbc4c +0 -0
  234. data/spec/internal/tmp/cache/assets/test/sprockets/3822d8965af2c63a9d8eb5be7d54a39e +0 -0
  235. data/spec/internal/tmp/cache/assets/test/sprockets/39191bda3ba14fb0d5671ef5320e9e01 +0 -0
  236. data/spec/internal/tmp/cache/assets/test/sprockets/3a1636e712ea5450451f140a1e11ad6b +0 -0
  237. data/spec/internal/tmp/cache/assets/test/sprockets/3af50e8108914b16e8005270444c23eb +0 -0
  238. data/spec/internal/tmp/cache/assets/test/sprockets/3be5d7c0f4c216492f0aa28be003d004 +0 -0
  239. data/spec/internal/tmp/cache/assets/test/sprockets/43549442460e63625bfa01b300845db4 +0 -0
  240. data/spec/internal/tmp/cache/assets/test/sprockets/4aca32864569722d64f0355ab5dc65bb +0 -0
  241. data/spec/internal/tmp/cache/assets/test/sprockets/4b2cab71b255f0bf4e45a6e317974ed0 +0 -0
  242. data/spec/internal/tmp/cache/assets/test/sprockets/4ffa695d373f85c9375cfeef7a7fa7b0 +0 -0
  243. data/spec/internal/tmp/cache/assets/test/sprockets/55c96cfe875a998dd83f861cec024cd8 +0 -0
  244. data/spec/internal/tmp/cache/assets/test/sprockets/5884f169a3cb492a556b12cf26d98512 +0 -0
  245. data/spec/internal/tmp/cache/assets/test/sprockets/5b4c0893fb6462116b5c893ee5067a7a +0 -0
  246. data/spec/internal/tmp/cache/assets/test/sprockets/5ed91405d3e1d9c4d64964b23e2ddad5 +0 -0
  247. data/spec/internal/tmp/cache/assets/test/sprockets/5ee4ec5587fe5e6b2489c6df8444c3a3 +0 -0
  248. data/spec/internal/tmp/cache/assets/test/sprockets/66bc87f66d912cc874b361b58b063232 +0 -0
  249. data/spec/internal/tmp/cache/assets/test/sprockets/6a7000430a188e026e888de506892486 +0 -0
  250. data/spec/internal/tmp/cache/assets/test/sprockets/6e51639f97de2a9999b40c947cc2cce4 +0 -0
  251. data/spec/internal/tmp/cache/assets/test/sprockets/70678ea30b446b6e43c58cb504a38c5e +0 -0
  252. data/spec/internal/tmp/cache/assets/test/sprockets/736b38c683d67eae78becf8bd03ccc03 +0 -0
  253. data/spec/internal/tmp/cache/assets/test/sprockets/74b2a1c32eb911fede6dbf691e2438fd +0 -0
  254. data/spec/internal/tmp/cache/assets/test/sprockets/769e239a980f02fb5f0d31f2e47661b6 +0 -0
  255. data/spec/internal/tmp/cache/assets/test/sprockets/7ed2a89adfb413f382b9844cb60e004f +0 -0
  256. data/spec/internal/tmp/cache/assets/test/sprockets/86aa4bb34763ef2ec398ce2948064feb +0 -0
  257. data/spec/internal/tmp/cache/assets/test/sprockets/8e0a985f6d848652e6e2b69502089957 +0 -0
  258. data/spec/internal/tmp/cache/assets/test/sprockets/8e24ef751a813d86a3a2953ce9f31b1b +0 -0
  259. data/spec/internal/tmp/cache/assets/test/sprockets/92440cff8e26faca6421a88212bf5cc5 +0 -0
  260. data/spec/internal/tmp/cache/assets/test/sprockets/93aaa9231a32901266b05632f3d35ecd +0 -0
  261. data/spec/internal/tmp/cache/assets/test/sprockets/9aa82f96c9760fb5b052b29dfead27ee +0 -0
  262. data/spec/internal/tmp/cache/assets/test/sprockets/9e3583b4a24bbae71c81cc89b31cf681 +0 -0
  263. data/spec/internal/tmp/cache/assets/test/sprockets/ad4a54c43c2a4c3874bfde1c9f08c248 +0 -0
  264. data/spec/internal/tmp/cache/assets/test/sprockets/addcc05c958d32994bbcc4df6b13c80a +0 -0
  265. data/spec/internal/tmp/cache/assets/test/sprockets/b6fcc8843d7d36abc9183de7f3c09fdd +0 -0
  266. data/spec/internal/tmp/cache/assets/test/sprockets/b783bb7bbb5960da9c2720974804b177 +0 -0
  267. data/spec/internal/tmp/cache/assets/test/sprockets/c94aa024045ec61aa3ce4de5c0ca7515 +0 -0
  268. data/spec/internal/tmp/cache/assets/test/sprockets/cffd775d018f68ce5dba1ee0d951a994 +0 -0
  269. data/spec/internal/tmp/cache/assets/test/sprockets/d04cedd870a36cb0ac8ad65bf032c556 +0 -0
  270. data/spec/internal/tmp/cache/assets/test/sprockets/d0ae540226d860c35ce84f64c67f40bb +0 -0
  271. data/spec/internal/tmp/cache/assets/test/sprockets/d0d4fb263d72afa8341801f74e58939e +0 -0
  272. data/spec/internal/tmp/cache/assets/test/sprockets/d54a9568f2db6442d0be17210a6d683e +0 -0
  273. data/spec/internal/tmp/cache/assets/test/sprockets/d771ace226fc8215a3572e0aa35bb0d6 +0 -0
  274. data/spec/internal/tmp/cache/assets/test/sprockets/d89eec758f13f7959ed8796e9b52469c +0 -0
  275. data/spec/internal/tmp/cache/assets/test/sprockets/da16a797f7553f717a002525bea10cbf +0 -0
  276. data/spec/internal/tmp/cache/assets/test/sprockets/da4e9efddf7d52d8de0c75b2f3ad571e +0 -0
  277. data/spec/internal/tmp/cache/assets/test/sprockets/dec30531a16449cd84734053a70b3a77 +0 -0
  278. data/spec/internal/tmp/cache/assets/test/sprockets/f429314ed6a6b2b42d3141578c4ec023 +0 -0
  279. data/spec/internal/tmp/cache/assets/test/sprockets/f5e21f9266ec8eafa27c52d109a9a498 +0 -0
  280. data/spec/internal/tmp/cache/assets/test/sprockets/f642847460097a56a55c8716c4d7a072 +0 -0
  281. data/spec/internal/tmp/cache/assets/test/sprockets/f69f1290f72a81d63fb93e81ff44f8a1 +0 -0
  282. data/spec/internal/tmp/cache/assets/test/sprockets/f6dee0958594a314ea8f9a82a48c2a45 +0 -0
  283. data/spec/internal/tmp/cache/assets/test/sprockets/f7cbd26ba1d28d48de824f0e94586655 +0 -0
  284. data/spec/internal/tmp/cache/assets/test/sprockets/f8e9e8fcc081081c00dd69903ebcf709 +0 -0
  285. data/spec/internal/tmp/cache/assets/test/sprockets/f8fd1a8d086eb31f0df8de2ac3ab4517 +0 -0
  286. data/spec/internal/tmp/cache/assets/test/sprockets/fe00102a3b27990f149d71a23f06e32a +0 -0
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 80fbd1f2ef67f47471d34408a686da1b7d71cde8
4
- data.tar.gz: acdd85ddb3ab8a4899e0662b8210240117daa349
3
+ metadata.gz: 0fc07861777f021a9d02ccb7c9be507cd7f8681d
4
+ data.tar.gz: 894be25e402c7aea81b7f82708ee8971e86bf97f
5
5
  SHA512:
6
- metadata.gz: 226b86e6cabfc8cb1dc98b92150bf98bc7462fc15bb09a31845cb908c5661b78c68bd23f362d85753c107430add95b6d9da3f7116a5319b46c0370637bee3b64
7
- data.tar.gz: 7b728e2d788bf2b0ebd5bf54f86088d26c224566bb37a8047346ccf12aa94cdda23c10729fbe5fa8d726ab57fedd3bd654ae0417cb7cc7781e7fbfd5c783dca4
6
+ metadata.gz: e9ef1dc88f88c4ac8e2ae167758549309c79b0332a29bad230d199fcc9518c03c07832900a51eed2e497b7283b1725c113c6e4080ee805303a7b1bb26370f7d5
7
+ data.tar.gz: 26b4f8a38a3bf313e8b2fce1a35474feb3fd19b6fe401817f05f98948b4ac99dae8d466134ae1c31f163facd1c7add886a5e8d67ab1d110659f5398f754efabe
@@ -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,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,22 @@
1
+ module Krikri::LDP
2
+ class Container < ActiveTriples::Resource
3
+ include Krikri::LDP::Resource
4
+
5
+ configure :type => RDF::URI('http://www.w3.org/ns/ldp#Container')
6
+
7
+ def initialize(uri, slug)
8
+ @ldp_uri = uri
9
+ @container_slug = slug
10
+ super("#{uri}/#{slug}")
11
+ end
12
+
13
+ def save(body = nil, opts = {})
14
+ opts[:Link] = "<#{type.first.to_s}>; rel='type'"
15
+ opts[:Slug] = @container_slug
16
+ opts[:method] = :post unless exists?
17
+ body ||= (dump :ttl)
18
+ opts['Content-Type'] ||= 'text/turtle'
19
+ super(body, opts)
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,4 @@
1
+ module Krikri::LDP
2
+ module NRSource
3
+ end
4
+ end
@@ -0,0 +1,24 @@
1
+ module Krikri::LDP
2
+ module RdfSource
3
+ extend ActiveSupport::Concern
4
+ include Krikri::LDP::Resource
5
+
6
+ def save(headers = {})
7
+ result = super(dump(:ttl))
8
+ get
9
+ result
10
+ end
11
+
12
+ def get(*args)
13
+ result = super
14
+ reload
15
+ result
16
+ end
17
+
18
+ def reload
19
+ return super unless !node? && exists?
20
+ clear
21
+ self << RDF::Reader.for(:ttl).new(@http_cache.body).statements
22
+ end
23
+ end
24
+ end
@@ -0,0 +1,49 @@
1
+ require 'faraday'
2
+ require 'faraday_middleware'
3
+
4
+ module Krikri::LDP
5
+ module Resource
6
+ extend ActiveSupport::Concern
7
+
8
+ attr_accessor :rdf_subject, :connection_uri
9
+
10
+ def ldp_connection
11
+ @ldp_conn ||= Faraday.new(connection_uri) do |conn|
12
+ conn.use Faraday::Response::RaiseError
13
+ conn.use FaradayMiddleware::FollowRedirects, limit: 3
14
+ conn.adapter Faraday.default_adapter
15
+ end
16
+ end
17
+
18
+ def etag
19
+ http_head.env['response_headers']['etag']
20
+ end
21
+
22
+ def http_head
23
+ raise 'No subject set for LDP resource.' if rdf_subject.nil?
24
+ @http_cache ||= ldp_connection.head { |request| request.url rdf_subject }
25
+ end
26
+
27
+ def exists?
28
+ return true if rdf_subject && http_head
29
+ false
30
+ rescue Faraday::ResourceNotFound
31
+ false
32
+ end
33
+
34
+ def save(uri, body = nil, opts = {})
35
+ require 'pry'
36
+ binding.pry
37
+ create(uri, body, opts)
38
+ end
39
+
40
+ def create(uri, body = nil, opts = {})
41
+ response = ldp_connection.post do |request|
42
+ request.url uri
43
+ request.headers = opts if opts
44
+ request.body = body
45
+ end
46
+ response
47
+ end
48
+ end
49
+ end
@@ -218,7 +218,7 @@ module Krikri
218
218
  place = {}
219
219
  place[:name] = source.label.first if source.label.any?
220
220
  place[:name] ||= source.providedLabel.first if source.providedLabel.any?
221
- place[:coordinates] = "#{source.lat}, #{source.long}" if
221
+ place[:coordinates] = "#{source.lat.first}, #{source.long.first}" if
222
222
  source.lat.any? && source.long.any?
223
223
  place.any? ? place : nil
224
224
  end
@@ -0,0 +1,17 @@
1
+ module Krikri
2
+ ##
3
+ # A parser for JSON records
4
+ # @see Krikri::Parser
5
+ class JsonParser < Krikri::Parser
6
+ def initialize(record)
7
+ @root = Value.new(JSON.parse(record.content))
8
+ super
9
+ end
10
+
11
+ class Value < Krikri::Parser::Value
12
+ def initialize(json)
13
+ @json = json
14
+ end
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,4 @@
1
+ module Krikri
2
+ module OaiHeaders
3
+ end
4
+ end
@@ -0,0 +1,2 @@
1
+ module Krikri
2
+ class XmlParser < Krikri::Parser
@@ -0,0 +1,4 @@
1
+ module Krikri
2
+ module OaiParserHeaders
3
+ end
4
+ end
@@ -0,0 +1,61 @@
1
+ module Krikri
2
+ ##
3
+ # An XmlParser
4
+ # @see Krikri::Parser
5
+ class XmlParser < Krikri::Parser
6
+ def initialize(record, root_path = '/')
7
+ xml = Nokogiri::XML(record.to_s)
8
+ ns = namespaces_from_xml(xml)
9
+ @root = Value.new(xml.at_xpath(root_path, ns), ns)
10
+ super(record)
11
+ end
12
+
13
+ private
14
+
15
+ def namespaces_from_xml(xml)
16
+ namespaces = xml.collect_namespaces.map do |k, v|
17
+ [k.gsub('xmlns:', ''), v]
18
+ end
19
+ namespaces.to_h
20
+ end
21
+
22
+ ##
23
+ # An XML Parser Value node class
24
+ # @see Krikri::Parser::Value
25
+ class Value < Krikri::Parser::Value
26
+ def initialize(node, namespaces)
27
+ node = node.root if node.xml?
28
+ @node = node
29
+ @namespaces = namespaces
30
+ end
31
+
32
+ delegate :attributes, :xpath, :at_xpath, :css, :at_css, :to => :@node
33
+
34
+ def children
35
+ @node.element_children.map do |child|
36
+ return child.name unless child.namespace
37
+ "#{@namespaces.key(child.namespace.href)}:#{child.name}"
38
+ end
39
+ end
40
+
41
+ def values
42
+ select_values.map(&:text)
43
+ end
44
+
45
+ def values?
46
+ !select_values.empty?
47
+ end
48
+
49
+ private
50
+
51
+ def get_child_nodes(name)
52
+ @node.xpath("#{@node.path}/#{name}", @namespaces)
53
+ .map { |node| self.class.new(node, @namespaces) }
54
+ end
55
+
56
+ def select_values
57
+ @node.children.select(&:text?)
58
+ end
59
+ end
60
+ end
61
+ end
@@ -0,0 +1,26 @@
1
+ module Krikri::Util
2
+ module ExtendedDateParser
3
+
4
+ ##
5
+ # e.g. 1990s or 199- or 199x
6
+ def decade(str)
7
+ decade
8
+ end
9
+
10
+ ##
11
+ # e.g. 1990s
12
+ def decade_s(str)
13
+ /^(\d{3})0s$/.match(str) do |m|
14
+ Date.edtf("#{m[1]}x")
15
+ end
16
+ end
17
+
18
+ ##
19
+ # e.g. 199-
20
+ def decade_hyphen(str)
21
+ /^(\d{3})-$/.match(str) do |m|
22
+ Date.edtf("#{m[1]}x")
23
+ end
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,70 @@
1
+ module Krikri::Util
2
+ module ExtendedDateParser
3
+ module_function
4
+
5
+ def parse(date_str)
6
+ date = Date.edtf(date_str)
7
+ date ||= partial_edtf(date_str)
8
+ date ||= decade_hyphen(date_str)
9
+ date ||= month_year(date_str)
10
+ date ||= decade_s(date_str)
11
+ date ||= hyphenated_partial_range(date_str)
12
+ date ||= begin
13
+ Date.parse(date_str)
14
+ rescue ArgumentError
15
+ nil
16
+ end
17
+ end
18
+
19
+ def range_match(str)
20
+ regexp = %r{
21
+ ([\d\-\.xu\?\~]*\d{4}[\d\-\.xu\?\~]*)
22
+ \s*[-\.]+\s*
23
+ ([\d\-\.xu\?\~]*\d{4}[\d\.\-xu\?\~]*)
24
+ }x
25
+ regexp.match(str) do |m|
26
+ [m[1], m[2]]
27
+ end
28
+ end
29
+
30
+ ##
31
+ # e.g. 01-2045
32
+ def month_year(str)
33
+ /(\d{2})-(\d{4})/.match(str) do |m|
34
+ Date.edtf("#{m[2]}-#{m[1]}")
35
+ end
36
+ end
37
+
38
+ ##
39
+ # e.g. 1990-92
40
+ def hyphenated_partial_range(str)
41
+ /^(\d{2})(\d{2})-(\d{2})$/.match(str) do |m|
42
+ Date.edtf("#{m[1]}#{m[2]}/#{m[1]}#{m[3]}")
43
+ end
44
+ end
45
+
46
+ ##
47
+ # e.g. 1970-08-01/02 or 1970-12/10
48
+ def partial_edtf(str)
49
+ /^(\d{4}(-\d{2})*)-(\d{2})\/(\d{2})$/.match(str) do |m|
50
+ Date.edtf("#{m[1]}-#{m[3]}/#{m[1]}-#{m[4]}")
51
+ end
52
+ end
53
+
54
+ ##
55
+ # e.g. 1990s
56
+ def decade_s(str)
57
+ /^(\d{3})0s$/.match(str) do |m|
58
+ Date.edtf("#{m[1]}x")
59
+ end
60
+ end
61
+
62
+ ##
63
+ # e.g. 199-
64
+ def decade_hyphen(str)
65
+ /^(\d{3})-$/.match(str) do |m|
66
+ Date.edtf("#{m[1]}x")
67
+ end
68
+ end
69
+ end
70
+ end