krikri 0.5.4 → 0.5.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/controllers/krikri/_qa_report_list.html.erb~ +10 -0
- data/app/controllers/krikri/concerns/provider_context.rb~ +7 -0
- data/app/controllers/krikri/qa_reports_controller.rb~ +18 -0
- data/app/models/krikri/harvesters/oai_harvester.rb~ +10 -0
- data/app/models/krikri/original_record_desc.rb~ +6 -0
- data/app/models/krikri/original_record_metadata.rb~ +9 -0
- data/app/models/krikri/parser.rb~ +5 -0
- data/app/models/krikri/parsers/xml_parser.rb~ +5 -0
- data/app/models/krikri/qa_report.rb~ +7 -0
- data/app/views/krikri/qa_reports/index.html.erb~ +3 -0
- data/app/views/krikri/qa_reports/show.html.erb~ +1 -0
- data/config/initializers/config.rb~ +19 -0
- data/config/settings/test.yml~ +3 -0
- data/db/migrate/20150328035550_add_qa_report.rb~ +11 -0
- data/lib/aggregation.rb~ +4 -0
- data/lib/blacklight.rb~ +8 -0
- data/lib/krikri/engine.rb +2 -0
- data/lib/krikri/enrichment.rb~ +5 -0
- data/lib/krikri/enrichment_agent.rb~ +11 -0
- data/lib/krikri/enrichment_agent_spec.rb~ +2 -0
- data/lib/krikri/enrichment_job.rb~ +13 -0
- data/lib/krikri/enrichments.rb~ +4 -0
- data/lib/krikri/enrichments/contvert_to_sentence_case.rb~ +13 -0
- data/lib/krikri/enrichments/convert_to_sentence_case.rb +20 -0
- data/lib/krikri/enrichments/convert_to_sentence_case.rb~ +13 -0
- data/lib/krikri/enrichments/dcmi_enforcer.rb +17 -0
- data/lib/krikri/enrichments/dcmi_enforcer.rb~ +5 -0
- data/lib/krikri/enrichments/dcmi_type_map.rb +128 -0
- data/lib/krikri/enrichments/dcmi_type_map.rb~ +8 -0
- data/lib/krikri/enrichments/dedup_nodes.rb +72 -0
- data/lib/krikri/enrichments/dedup_nodes.rb~ +10 -0
- data/lib/krikri/enrichments/dedup_values.rb~ +7 -0
- data/lib/krikri/enrichments/limit_characters.rb +18 -0
- data/lib/krikri/enrichments/move_non_dcmi_type.rb +17 -0
- data/lib/krikri/enrichments/move_non_dcmi_type.rb~ +7 -0
- data/lib/krikri/enrichments/split_coordinates.rb +80 -0
- data/lib/krikri/enrichments/strip_ending_punctuation.rb~ +18 -0
- data/lib/krikri/enrichments/strip_leading_colons.rb~ +15 -0
- data/lib/krikri/enrichments/strip_leading_punctuation.rb~ +18 -0
- data/lib/krikri/field_enrichment.rb~ +3 -0
- data/lib/krikri/harvesters/api_harvester.rb~ +44 -0
- data/lib/krikri/harvesters/basic_save_behavior.rb~ +1 -0
- data/lib/krikri/harvesters/file_harvester.rb~ +4 -0
- data/lib/krikri/harvesters/harvest_behavior.rb~ +14 -0
- data/lib/krikri/harvesters/mdl_api_harvester.rb~ +7 -0
- data/lib/krikri/harvesters/mdl_harvester.rb~ +4 -0
- data/lib/krikri/harvesters/oai_skip_deleted_behavior.rb~ +17 -0
- data/lib/krikri/id_minter.rb~ +8 -0
- data/lib/krikri/id_service.rb~ +4 -0
- data/lib/krikri/ldp/container.rb~ +22 -0
- data/lib/krikri/ldp/nr_source.rb~ +4 -0
- data/lib/krikri/ldp/rdf_source.rb~ +24 -0
- data/lib/krikri/ldp/resource.rb~ +49 -0
- data/lib/krikri/mapping_dsl.rb~ +4 -0
- data/lib/krikri/mapping_job.rb~ +13 -0
- data/lib/krikri/md5_minter.rb~ +8 -0
- data/lib/krikri/parser.rb +12 -0
- data/lib/krikri/parsers/json_parser.rb~ +17 -0
- data/lib/krikri/parsers/oai_headers.rb~ +4 -0
- data/lib/krikri/parsers/oai_parser.rb~ +2 -0
- data/lib/krikri/parsers/oai_parser_headers.rb~ +4 -0
- data/lib/krikri/parsers/xml_parser.rb~ +61 -0
- data/lib/krikri/provenance_query.rb~ +4 -0
- data/lib/krikri/provenance_query_client.rb~ +11 -0
- data/lib/krikri/util/edtf_converter.rb~ +26 -0
- data/lib/krikri/util/extended_date_parser.rb~ +70 -0
- data/lib/krikri/version.rb +1 -1
- data/lib/tasks/jetty.rake~ +12 -0
- data/lib/tasks/krikri.rake~ +20 -0
- data/spec/controllers/application_controller_spec.rb~ +11 -0
- data/spec/controllers/qa_reports_controller_spec.rb~ +15 -0
- data/spec/controllers/records_controller_spec.rb~ +11 -0
- data/spec/controllers/reports_controller_spec.rb~ +6 -0
- data/spec/controllers/validation_reports_controller_spec.rb~ +15 -0
- data/spec/factories/krikri_original_record.rb~ +5 -0
- data/spec/factories/krikri_provider.rb~ +7 -0
- data/spec/factories/krikri_provider_spec.rb~ +7 -0
- data/spec/factories/krikri_qa_report.rb~ +8 -0
- data/spec/helpers/krikri/application_helper_spec.rb~ +16 -0
- data/spec/internal/Gemfile +4 -3
- data/spec/internal/Gemfile.lock +34 -34
- data/spec/internal/app/assets/javascripts/application.js +1 -1
- data/spec/internal/config/initializers/blacklight_initializer.rb +1 -1
- data/spec/internal/config/initializers/devise.rb +2 -2
- data/spec/internal/config/secrets.yml +2 -2
- data/spec/internal/db/development.sqlite3 +0 -0
- data/spec/internal/db/migrate/{20150408190519_devise_create_users.rb → 20150404224854_devise_create_users.rb} +0 -0
- data/spec/internal/db/migrate/{20150408190543_create_searches.blacklight.rb → 20150404224913_create_searches.blacklight.rb} +0 -0
- data/spec/internal/db/migrate/{20150408190544_create_bookmarks.blacklight.rb → 20150404224914_create_bookmarks.blacklight.rb} +0 -0
- data/spec/internal/db/migrate/{20150408190545_add_polymorphic_type_to_bookmarks.blacklight.rb → 20150404224915_add_polymorphic_type_to_bookmarks.blacklight.rb} +0 -0
- data/spec/internal/db/schema.rb +1 -1
- data/spec/internal/db/test.sqlite3 +0 -0
- data/spec/internal/lib/generators/test_app_generator.rb~ +14 -0
- data/spec/internal/log/development.log +1275 -81
- data/spec/internal/log/test.log +245066 -3067
- data/spec/krikri_spec.rb~ +30 -0
- data/spec/ldp/active_triples_spec.rb~ +15 -0
- data/spec/ldp/at_resource_spec.rb~ +41 -0
- data/spec/ldp/nr_source_spec.rb~ +3 -0
- data/spec/ldp/rdf_source_spec.rb~ +4 -0
- data/spec/ldp/resource_spec.rb~ +49 -0
- data/spec/lib/krikri/enrichment_agent_spec.rb~ +4 -0
- data/spec/lib/krikri/enrichments/capitalize_spec.rb~ +24 -0
- data/spec/lib/krikri/enrichments/convert_to_sentence_case_spec.rb +16 -0
- data/spec/lib/krikri/enrichments/convert_to_sentence_case_spec.rb~ +16 -0
- data/spec/lib/krikri/enrichments/dcmi_enforcer_spec.rb +25 -0
- data/spec/lib/krikri/enrichments/dcmi_enforcer_spec.rb~ +16 -0
- data/spec/lib/krikri/enrichments/dcmi_type_map_spec.rb +41 -0
- data/spec/lib/krikri/enrichments/dedup_nodes_spec.rb +47 -0
- data/spec/lib/krikri/enrichments/dedup_nodes_spec.rb~ +6 -0
- data/spec/lib/krikri/enrichments/dedup_values_spec.rb~ +10 -0
- data/spec/lib/krikri/enrichments/deduplication_spec.rb~ +5 -0
- data/spec/lib/krikri/enrichments/genre_filter_spec.rb~ +19 -0
- data/spec/lib/krikri/enrichments/iso_enrich_spec.rb~ +5 -0
- data/spec/lib/krikri/enrichments/limit_characters_spec.rb +94 -0
- data/spec/lib/krikri/enrichments/move_non_dcmi_type_spec.rb +25 -0
- data/spec/lib/krikri/enrichments/move_non_dcmi_type_spec.rb~ +4 -0
- data/spec/lib/krikri/enrichments/parse_date_spec.rb~ +16 -0
- data/spec/lib/krikri/enrichments/split_coordinates_spec.rb +65 -0
- data/spec/lib/krikri/enrichments/strip_ending_punctuation_spec.rb~ +16 -0
- data/spec/lib/krikri/enrichments/strip_leading_colons_spec.rb~ +16 -0
- data/spec/lib/krikri/enrichments/strip_leading_punctuation_spec.rb~ +16 -0
- data/spec/lib/krikri/enrichments/timespan_spec.rb~ +10 -0
- data/spec/lib/krikri/enrichments/timespan_split_spec.rb~ +59 -0
- data/spec/lib/krikri/harvesters/api_harvester_spec.rb~ +47 -0
- data/spec/lib/krikri/harvesters/basic_save_behavior_spec.rb~ +12 -0
- data/spec/lib/krikri/harvesters/file_harvester_spec.rb~ +3 -0
- data/spec/lib/krikri/harvesters/harvest_behavior_spec.rb~ +5 -0
- data/spec/lib/krikri/harvesters/mdl_api_harvester_spec.rb~ +11 -0
- data/spec/lib/krikri/harvesters/mdl_harvester_spec.rb~ +8 -0
- data/spec/lib/krikri/harvesters/oai_skip_deleted_behavior.rb~ +7 -0
- data/spec/lib/krikri/harvesters/oai_skip_deleted_behavior_spec.rb~ +15 -0
- data/spec/lib/krikri/id_service_spec.rb~ +3 -0
- data/spec/lib/krikri/job_spec.rb~ +13 -0
- data/spec/lib/krikri/mapper_agent_spec.rb~ +64 -0
- data/spec/lib/krikri/mapper_spec.rb~ +5 -0
- data/spec/lib/krikri/mapping_dsl/parser_methods_spec.rb~ +65 -0
- data/spec/lib/krikri/mapping_dsl/property_declaration_spec.rb~ +87 -0
- data/spec/lib/krikri/mapping_dsl/rdf_subjects_spec.rb~ +16 -0
- data/spec/lib/krikri/mapping_dsl_spec.rb~ +10 -0
- data/spec/lib/krikri/mapping_job.rb~ +12 -0
- data/spec/lib/krikri/mapping_job_spec.rb~ +11 -0
- data/spec/lib/krikri/mapping_spec.rb~ +5 -0
- data/spec/lib/krikri/md5_minter_spec.rb~ +5 -0
- data/spec/lib/krikri/parser_value_array.rb~ +5 -0
- data/spec/lib/krikri/parser_value_array_spec.rb +23 -0
- data/spec/lib/krikri/parsers/json_parser_spec.rb~ +17 -0
- data/spec/lib/krikri/parsers/xml_parser_spec.rb~ +21 -0
- data/spec/lib/krikri/provenance_query_client.rb~ +5 -0
- data/spec/lib/krikri/provenance_query_client_spec.rb~ +8 -0
- data/spec/lib/krikri/qa_query_client_spec.rb~ +9 -0
- data/spec/lib/krikri/random_search_index_docmument_builder_spec.rb~ +6 -0
- data/spec/lib/krikri/util/edtf_converter_spec.rb~ +17 -0
- data/spec/lib/krikri/util/extended_date_parser_spec.rb~ +102 -0
- data/spec/models/activity_spec.rb~ +41 -0
- data/spec/models/dpla/map/aggregation_spec.rb~ +67 -0
- data/spec/models/harvesters/oai_harvester_spec.rb~ +15 -0
- data/spec/models/mapper_spec.rb~ +5 -0
- data/spec/models/original_record_metadata_spec.rb~ +5 -0
- data/spec/models/original_record_spec.rb~ +5 -0
- data/spec/models/provider_spec.rb~ +33 -0
- data/spec/models/qa_report_spec.rb~ +64 -0
- data/spec/models/validation_report_spec.rb~ +15 -0
- data/spec/support/shared_contexts/indexed_item.rb~ +15 -0
- data/spec/support/shared_contexts/mapping_dsl.rb~ +12 -0
- data/spec/support/shared_contexts/provenance_query_client.rb~ +6 -0
- data/spec/support/shared_contexts/rake.rb~ +21 -0
- data/spec/support/shared_examples/enrichment.rb~ +5 -0
- data/spec/support/shared_examples/harvest_behavior.rb~ +13 -0
- data/spec/support/shared_examples/job.rb~ +20 -0
- data/spec/support/shared_examples/ldp_resource.rb~ +4 -0
- data/spec/support/shared_examples/oai_parser_headers.rb~ +12 -0
- data/spec/support/shared_examples/rdf_source.rb~ +1 -0
- data/spec/support/shared_examples/software_agent.rb~ +5 -0
- data/spec/support/shared_examples/string_enrichment.rb~ +12 -0
- data/spec/test_app_templates/lib/generators/test_app_generator.rb~ +14 -0
- data/spec/views/krikri/providers/index.html.erb_spec.rb~ +3 -0
- data/spec/views/krikri/providers/show.html.erb.spec~ +12 -0
- data/spec/views/krikri/providers/show.html.erb_spec.rb~ +10 -0
- data/spec/views/krikri/qa_reports/index.html.erb_spec.rb~ +17 -0
- data/spec/views/krikri/qa_reports/show.html.erb_spec.rb~ +22 -0
- data/spec/views/krikri/records/index.html.erb_spec.rb~ +15 -0
- data/spec/views/krikri/records/show.html.erb_spec.rb~ +8 -0
- data/spec/views/krikri/reports/index.html.erb_spec.rb~ +5 -0
- data/spec/webmocks/oai.rb~ +13 -0
- metadata +420 -444
- data/spec/dummy/db/development.sqlite3 +0 -0
- data/spec/dummy/db/test.sqlite3 +0 -0
- data/spec/dummy/log/development.log +0 -207
- data/spec/internal/tmp/cache/318/301/krikri%2Fapplication_helper%2Favailable_providers +0 -0
- data/spec/internal/tmp/cache/assets/test/sass/6449c927c92ef1ea4378c66161e3b0efe1bf954d/_bootstrap-sprockets.scssc +0 -0
- data/spec/internal/tmp/cache/assets/test/sass/6449c927c92ef1ea4378c66161e3b0efe1bf954d/_bootstrap.scssc +0 -0
- data/spec/internal/tmp/cache/assets/test/sass/71fba6bdfa89d88fe8a72b36eafd3b91cf10a6d0/blacklight.css.scssc +0 -0
- data/spec/internal/tmp/cache/assets/test/sass/75eb48b5361d55a8133e0091d663a085dacee3c5/_alerts.scssc +0 -0
- data/spec/internal/tmp/cache/assets/test/sass/75eb48b5361d55a8133e0091d663a085dacee3c5/_background-variant.scssc +0 -0
- data/spec/internal/tmp/cache/assets/test/sass/75eb48b5361d55a8133e0091d663a085dacee3c5/_border-radius.scssc +0 -0
- data/spec/internal/tmp/cache/assets/test/sass/75eb48b5361d55a8133e0091d663a085dacee3c5/_buttons.scssc +0 -0
- data/spec/internal/tmp/cache/assets/test/sass/75eb48b5361d55a8133e0091d663a085dacee3c5/_center-block.scssc +0 -0
- data/spec/internal/tmp/cache/assets/test/sass/75eb48b5361d55a8133e0091d663a085dacee3c5/_clearfix.scssc +0 -0
- data/spec/internal/tmp/cache/assets/test/sass/75eb48b5361d55a8133e0091d663a085dacee3c5/_forms.scssc +0 -0
- data/spec/internal/tmp/cache/assets/test/sass/75eb48b5361d55a8133e0091d663a085dacee3c5/_gradients.scssc +0 -0
- data/spec/internal/tmp/cache/assets/test/sass/75eb48b5361d55a8133e0091d663a085dacee3c5/_grid-framework.scssc +0 -0
- data/spec/internal/tmp/cache/assets/test/sass/75eb48b5361d55a8133e0091d663a085dacee3c5/_grid.scssc +0 -0
- data/spec/internal/tmp/cache/assets/test/sass/75eb48b5361d55a8133e0091d663a085dacee3c5/_hide-text.scssc +0 -0
- data/spec/internal/tmp/cache/assets/test/sass/75eb48b5361d55a8133e0091d663a085dacee3c5/_image.scssc +0 -0
- data/spec/internal/tmp/cache/assets/test/sass/75eb48b5361d55a8133e0091d663a085dacee3c5/_labels.scssc +0 -0
- data/spec/internal/tmp/cache/assets/test/sass/75eb48b5361d55a8133e0091d663a085dacee3c5/_list-group.scssc +0 -0
- data/spec/internal/tmp/cache/assets/test/sass/75eb48b5361d55a8133e0091d663a085dacee3c5/_nav-divider.scssc +0 -0
- data/spec/internal/tmp/cache/assets/test/sass/75eb48b5361d55a8133e0091d663a085dacee3c5/_nav-vertical-align.scssc +0 -0
- data/spec/internal/tmp/cache/assets/test/sass/75eb48b5361d55a8133e0091d663a085dacee3c5/_opacity.scssc +0 -0
- data/spec/internal/tmp/cache/assets/test/sass/75eb48b5361d55a8133e0091d663a085dacee3c5/_pagination.scssc +0 -0
- data/spec/internal/tmp/cache/assets/test/sass/75eb48b5361d55a8133e0091d663a085dacee3c5/_panels.scssc +0 -0
- data/spec/internal/tmp/cache/assets/test/sass/75eb48b5361d55a8133e0091d663a085dacee3c5/_progress-bar.scssc +0 -0
- data/spec/internal/tmp/cache/assets/test/sass/75eb48b5361d55a8133e0091d663a085dacee3c5/_reset-filter.scssc +0 -0
- data/spec/internal/tmp/cache/assets/test/sass/75eb48b5361d55a8133e0091d663a085dacee3c5/_resize.scssc +0 -0
- data/spec/internal/tmp/cache/assets/test/sass/75eb48b5361d55a8133e0091d663a085dacee3c5/_responsive-visibility.scssc +0 -0
- data/spec/internal/tmp/cache/assets/test/sass/75eb48b5361d55a8133e0091d663a085dacee3c5/_size.scssc +0 -0
- data/spec/internal/tmp/cache/assets/test/sass/75eb48b5361d55a8133e0091d663a085dacee3c5/_tab-focus.scssc +0 -0
- data/spec/internal/tmp/cache/assets/test/sass/75eb48b5361d55a8133e0091d663a085dacee3c5/_table-row.scssc +0 -0
- data/spec/internal/tmp/cache/assets/test/sass/75eb48b5361d55a8133e0091d663a085dacee3c5/_text-emphasis.scssc +0 -0
- data/spec/internal/tmp/cache/assets/test/sass/75eb48b5361d55a8133e0091d663a085dacee3c5/_text-overflow.scssc +0 -0
- data/spec/internal/tmp/cache/assets/test/sass/75eb48b5361d55a8133e0091d663a085dacee3c5/_vendor-prefixes.scssc +0 -0
- data/spec/internal/tmp/cache/assets/test/sass/78e0580c292179fc5fdd7b74b703dad1702b4176/_blacklight_base.scssc +0 -0
- data/spec/internal/tmp/cache/assets/test/sass/78e0580c292179fc5fdd7b74b703dad1702b4176/_bookmark.scssc +0 -0
- data/spec/internal/tmp/cache/assets/test/sass/78e0580c292179fc5fdd7b74b703dad1702b4176/_catalog.scssc +0 -0
- data/spec/internal/tmp/cache/assets/test/sass/78e0580c292179fc5fdd7b74b703dad1702b4176/_facets.scssc +0 -0
- data/spec/internal/tmp/cache/assets/test/sass/78e0580c292179fc5fdd7b74b703dad1702b4176/_group.scssc +0 -0
- data/spec/internal/tmp/cache/assets/test/sass/78e0580c292179fc5fdd7b74b703dad1702b4176/_header.scssc +0 -0
- data/spec/internal/tmp/cache/assets/test/sass/78e0580c292179fc5fdd7b74b703dad1702b4176/_layout.scssc +0 -0
- data/spec/internal/tmp/cache/assets/test/sass/78e0580c292179fc5fdd7b74b703dad1702b4176/_modal.scssc +0 -0
- data/spec/internal/tmp/cache/assets/test/sass/78e0580c292179fc5fdd7b74b703dad1702b4176/_search_history.scssc +0 -0
- data/spec/internal/tmp/cache/assets/test/sass/78e0580c292179fc5fdd7b74b703dad1702b4176/blacklight.scssc +0 -0
- data/spec/internal/tmp/cache/assets/test/sass/78e0580c292179fc5fdd7b74b703dad1702b4176/blacklight_defaults.scssc +0 -0
- data/spec/internal/tmp/cache/assets/test/sass/f79e9f3544f6b8d5f7ca05529260dceec8dd44ed/_alerts.scssc +0 -0
- data/spec/internal/tmp/cache/assets/test/sass/f79e9f3544f6b8d5f7ca05529260dceec8dd44ed/_badges.scssc +0 -0
- data/spec/internal/tmp/cache/assets/test/sass/f79e9f3544f6b8d5f7ca05529260dceec8dd44ed/_breadcrumbs.scssc +0 -0
- data/spec/internal/tmp/cache/assets/test/sass/f79e9f3544f6b8d5f7ca05529260dceec8dd44ed/_button-groups.scssc +0 -0
- data/spec/internal/tmp/cache/assets/test/sass/f79e9f3544f6b8d5f7ca05529260dceec8dd44ed/_buttons.scssc +0 -0
- data/spec/internal/tmp/cache/assets/test/sass/f79e9f3544f6b8d5f7ca05529260dceec8dd44ed/_carousel.scssc +0 -0
- data/spec/internal/tmp/cache/assets/test/sass/f79e9f3544f6b8d5f7ca05529260dceec8dd44ed/_close.scssc +0 -0
- data/spec/internal/tmp/cache/assets/test/sass/f79e9f3544f6b8d5f7ca05529260dceec8dd44ed/_code.scssc +0 -0
- data/spec/internal/tmp/cache/assets/test/sass/f79e9f3544f6b8d5f7ca05529260dceec8dd44ed/_component-animations.scssc +0 -0
- data/spec/internal/tmp/cache/assets/test/sass/f79e9f3544f6b8d5f7ca05529260dceec8dd44ed/_dropdowns.scssc +0 -0
- data/spec/internal/tmp/cache/assets/test/sass/f79e9f3544f6b8d5f7ca05529260dceec8dd44ed/_forms.scssc +0 -0
- data/spec/internal/tmp/cache/assets/test/sass/f79e9f3544f6b8d5f7ca05529260dceec8dd44ed/_glyphicons.scssc +0 -0
- data/spec/internal/tmp/cache/assets/test/sass/f79e9f3544f6b8d5f7ca05529260dceec8dd44ed/_grid.scssc +0 -0
- data/spec/internal/tmp/cache/assets/test/sass/f79e9f3544f6b8d5f7ca05529260dceec8dd44ed/_input-groups.scssc +0 -0
- data/spec/internal/tmp/cache/assets/test/sass/f79e9f3544f6b8d5f7ca05529260dceec8dd44ed/_jumbotron.scssc +0 -0
- data/spec/internal/tmp/cache/assets/test/sass/f79e9f3544f6b8d5f7ca05529260dceec8dd44ed/_labels.scssc +0 -0
- data/spec/internal/tmp/cache/assets/test/sass/f79e9f3544f6b8d5f7ca05529260dceec8dd44ed/_list-group.scssc +0 -0
- data/spec/internal/tmp/cache/assets/test/sass/f79e9f3544f6b8d5f7ca05529260dceec8dd44ed/_media.scssc +0 -0
- data/spec/internal/tmp/cache/assets/test/sass/f79e9f3544f6b8d5f7ca05529260dceec8dd44ed/_mixins.scssc +0 -0
- data/spec/internal/tmp/cache/assets/test/sass/f79e9f3544f6b8d5f7ca05529260dceec8dd44ed/_modals.scssc +0 -0
- data/spec/internal/tmp/cache/assets/test/sass/f79e9f3544f6b8d5f7ca05529260dceec8dd44ed/_navbar.scssc +0 -0
- data/spec/internal/tmp/cache/assets/test/sass/f79e9f3544f6b8d5f7ca05529260dceec8dd44ed/_navs.scssc +0 -0
- data/spec/internal/tmp/cache/assets/test/sass/f79e9f3544f6b8d5f7ca05529260dceec8dd44ed/_normalize.scssc +0 -0
- data/spec/internal/tmp/cache/assets/test/sass/f79e9f3544f6b8d5f7ca05529260dceec8dd44ed/_pager.scssc +0 -0
- data/spec/internal/tmp/cache/assets/test/sass/f79e9f3544f6b8d5f7ca05529260dceec8dd44ed/_pagination.scssc +0 -0
- data/spec/internal/tmp/cache/assets/test/sass/f79e9f3544f6b8d5f7ca05529260dceec8dd44ed/_panels.scssc +0 -0
- data/spec/internal/tmp/cache/assets/test/sass/f79e9f3544f6b8d5f7ca05529260dceec8dd44ed/_popovers.scssc +0 -0
- data/spec/internal/tmp/cache/assets/test/sass/f79e9f3544f6b8d5f7ca05529260dceec8dd44ed/_print.scssc +0 -0
- data/spec/internal/tmp/cache/assets/test/sass/f79e9f3544f6b8d5f7ca05529260dceec8dd44ed/_progress-bars.scssc +0 -0
- data/spec/internal/tmp/cache/assets/test/sass/f79e9f3544f6b8d5f7ca05529260dceec8dd44ed/_responsive-embed.scssc +0 -0
- data/spec/internal/tmp/cache/assets/test/sass/f79e9f3544f6b8d5f7ca05529260dceec8dd44ed/_responsive-utilities.scssc +0 -0
- data/spec/internal/tmp/cache/assets/test/sass/f79e9f3544f6b8d5f7ca05529260dceec8dd44ed/_scaffolding.scssc +0 -0
- data/spec/internal/tmp/cache/assets/test/sass/f79e9f3544f6b8d5f7ca05529260dceec8dd44ed/_tables.scssc +0 -0
- data/spec/internal/tmp/cache/assets/test/sass/f79e9f3544f6b8d5f7ca05529260dceec8dd44ed/_thumbnails.scssc +0 -0
- data/spec/internal/tmp/cache/assets/test/sass/f79e9f3544f6b8d5f7ca05529260dceec8dd44ed/_tooltip.scssc +0 -0
- data/spec/internal/tmp/cache/assets/test/sass/f79e9f3544f6b8d5f7ca05529260dceec8dd44ed/_type.scssc +0 -0
- data/spec/internal/tmp/cache/assets/test/sass/f79e9f3544f6b8d5f7ca05529260dceec8dd44ed/_utilities.scssc +0 -0
- data/spec/internal/tmp/cache/assets/test/sass/f79e9f3544f6b8d5f7ca05529260dceec8dd44ed/_variables.scssc +0 -0
- data/spec/internal/tmp/cache/assets/test/sass/f79e9f3544f6b8d5f7ca05529260dceec8dd44ed/_wells.scssc +0 -0
- data/spec/internal/tmp/cache/assets/test/sprockets/05604ccd7329b6afb8e7cdafbaa09fe3 +0 -0
- data/spec/internal/tmp/cache/assets/test/sprockets/0b3850cd2568d76d8583e8e6bffa44d9 +0 -0
- data/spec/internal/tmp/cache/assets/test/sprockets/0dffbe192bade10cf2b568c73695e96e +0 -0
- data/spec/internal/tmp/cache/assets/test/sprockets/0e349883625d7536c00fac0eafde4415 +0 -0
- data/spec/internal/tmp/cache/assets/test/sprockets/0f05dd42159c418ddcfa12edd10d98bb +0 -0
- data/spec/internal/tmp/cache/assets/test/sprockets/11b7eeb5da37de1c315d886349adbc98 +0 -0
- data/spec/internal/tmp/cache/assets/test/sprockets/13fe41fee1fe35b49d145bcc06610705 +0 -0
- data/spec/internal/tmp/cache/assets/test/sprockets/16648e86ab6ef2950f3630ff0d566409 +0 -0
- data/spec/internal/tmp/cache/assets/test/sprockets/1877c8233ee501d08788d7324a70bd70 +0 -0
- data/spec/internal/tmp/cache/assets/test/sprockets/1c814c5c5dfd63768fff312c442847d6 +0 -0
- data/spec/internal/tmp/cache/assets/test/sprockets/1e699d4d1e439eeb1d52a210573f5053 +0 -0
- data/spec/internal/tmp/cache/assets/test/sprockets/2c58fb6a2406edc8067b46ee33af7262 +0 -0
- data/spec/internal/tmp/cache/assets/test/sprockets/2d0220441d85355dcd9ade523f95c048 +0 -0
- data/spec/internal/tmp/cache/assets/test/sprockets/2f5173deea6c795b8fdde723bb4b63af +0 -0
- data/spec/internal/tmp/cache/assets/test/sprockets/357970feca3ac29060c1e3861e2c0953 +0 -0
- data/spec/internal/tmp/cache/assets/test/sprockets/39329b3558b9f58b0d4e43621aeaa8c2 +0 -0
- data/spec/internal/tmp/cache/assets/test/sprockets/39ed74e4d194593ec48c481d0fd76007 +0 -0
- data/spec/internal/tmp/cache/assets/test/sprockets/40271adcb3c4654dcb20b55abc2505c9 +0 -0
- data/spec/internal/tmp/cache/assets/test/sprockets/402ffe46f4586abacce366e0e3f690d8 +0 -0
- data/spec/internal/tmp/cache/assets/test/sprockets/46ec3d34d3576e4452b0a95b87176996 +0 -0
- data/spec/internal/tmp/cache/assets/test/sprockets/4a9e62d054a09c7c8e486f73bd032bdc +0 -0
- data/spec/internal/tmp/cache/assets/test/sprockets/4c5e3966eae6a44e852dcf449c3f4cb0 +0 -0
- data/spec/internal/tmp/cache/assets/test/sprockets/52ce034583a746333fd7b8aa3916b8e1 +0 -0
- data/spec/internal/tmp/cache/assets/test/sprockets/52fe40fddbd8e73f6743866d4930bde6 +0 -0
- data/spec/internal/tmp/cache/assets/test/sprockets/53329c49c9b4ba25d31c73c9b98260b0 +0 -0
- data/spec/internal/tmp/cache/assets/test/sprockets/59b1fd64c6fc18a82465ad6fdc7094fa +0 -0
- data/spec/internal/tmp/cache/assets/test/sprockets/677fd27eda24da657f51d725742582f3 +0 -0
- data/spec/internal/tmp/cache/assets/test/sprockets/6b2c5572f9e2cd322ad7b2878673d0dd +0 -0
- data/spec/internal/tmp/cache/assets/test/sprockets/735621cd88de5e37980cced4fb13ded9 +0 -0
- data/spec/internal/tmp/cache/assets/test/sprockets/7e4f29f7a7327f10677cd047be78cf8a +0 -0
- data/spec/internal/tmp/cache/assets/test/sprockets/7f804c48c333d9758fa49ff9331b78e2 +0 -0
- data/spec/internal/tmp/cache/assets/test/sprockets/806c560c2f6e89ba0ad39561804ff79c +0 -0
- data/spec/internal/tmp/cache/assets/test/sprockets/82dd05a187bccd30f62fabb16491fe03 +0 -0
- data/spec/internal/tmp/cache/assets/test/sprockets/82de1c42365fd1cf6a2adc2f644150c1 +0 -0
- data/spec/internal/tmp/cache/assets/test/sprockets/853ad370adfaa0da7ec26f51b89421f1 +0 -0
- data/spec/internal/tmp/cache/assets/test/sprockets/857d45eb67a43a30a6d5d0370464e596 +0 -0
- data/spec/internal/tmp/cache/assets/test/sprockets/8da6b6aafe413b1ba635e82f71c194be +0 -0
- data/spec/internal/tmp/cache/assets/test/sprockets/8ea9ff17090b736331312d04c8036810 +0 -0
- data/spec/internal/tmp/cache/assets/test/sprockets/8fad7abbbfbb3748b36d73dfb482c2bd +0 -0
- data/spec/internal/tmp/cache/assets/test/sprockets/9181f512b689ddb01d6778bac83791ac +0 -0
- data/spec/internal/tmp/cache/assets/test/sprockets/92c82efebbff4c3a9f96e08b308e92dd +0 -0
- data/spec/internal/tmp/cache/assets/test/sprockets/93aaa9231a32901266b05632f3d35ecd +0 -0
- data/spec/internal/tmp/cache/assets/test/sprockets/93c6b8da8f3373c42510a25694457483 +0 -0
- data/spec/internal/tmp/cache/assets/test/sprockets/93dd91f6519f569f11fddf4df22460d9 +0 -0
- data/spec/internal/tmp/cache/assets/test/sprockets/9443255223294f7ad9ad6daba446afc3 +0 -0
- data/spec/internal/tmp/cache/assets/test/sprockets/96ff03d6a5f9604c6980874bb00c1d17 +0 -0
- data/spec/internal/tmp/cache/assets/test/sprockets/9ca9885875e2e0ab4e531cba60aa03e5 +0 -0
- data/spec/internal/tmp/cache/assets/test/sprockets/a13d3a27038cf6570d22b54c54442642 +0 -0
- data/spec/internal/tmp/cache/assets/test/sprockets/aa92d8a74950d2d6217a51424ce4b33b +0 -0
- data/spec/internal/tmp/cache/assets/test/sprockets/ad4a54c43c2a4c3874bfde1c9f08c248 +0 -0
- data/spec/internal/tmp/cache/assets/test/sprockets/b146aa842b38c17ed4117b2f52d4b51f +0 -0
- data/spec/internal/tmp/cache/assets/test/sprockets/b37776526b5809e55fbb0add6d059127 +0 -0
- data/spec/internal/tmp/cache/assets/test/sprockets/b6d54919d5e4a3921287a5fb178dc455 +0 -0
- data/spec/internal/tmp/cache/assets/test/sprockets/c514fd002d57ddf3d94669e369d45283 +0 -0
- data/spec/internal/tmp/cache/assets/test/sprockets/cd59839c2fc0d494ffa76ef4c4dbfa42 +0 -0
- data/spec/internal/tmp/cache/assets/test/sprockets/cffd775d018f68ce5dba1ee0d951a994 +0 -0
- data/spec/internal/tmp/cache/assets/test/sprockets/d32e733978c8eb7c7db3ec2b865ee87f +0 -0
- data/spec/internal/tmp/cache/assets/test/sprockets/d6995317fba3b6344c75db70b8c997e2 +0 -0
- data/spec/internal/tmp/cache/assets/test/sprockets/d771ace226fc8215a3572e0aa35bb0d6 +0 -0
- data/spec/internal/tmp/cache/assets/test/sprockets/d7bf17ad1471147b5314b4dda0bad9fe +0 -0
- data/spec/internal/tmp/cache/assets/test/sprockets/e6a1afebb687728d619fe27e84335d2f +0 -0
- data/spec/internal/tmp/cache/assets/test/sprockets/e83c10c393da1c028c7d4217ecfc9c03 +0 -0
- data/spec/internal/tmp/cache/assets/test/sprockets/f64fd792a429f69332c1489015953219 +0 -0
- data/spec/internal/tmp/cache/assets/test/sprockets/f7a87683461c3a58ee9b6e9546473c4e +0 -0
- data/spec/internal/tmp/cache/assets/test/sprockets/f7cbd26ba1d28d48de824f0e94586655 +0 -0
- 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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f571b90beb068972a81dbbe4488941c52ff650a4
|
4
|
+
data.tar.gz: f660257e1db2d1f5eb21419963db13cfecf4cfa3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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,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 @@
|
|
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)
|
data/lib/aggregation.rb~
ADDED
data/lib/blacklight.rb~
ADDED
@@ -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
|
data/lib/krikri/engine.rb
CHANGED
@@ -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,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,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,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,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,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
|