qa 4.0.0 → 4.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (85) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +1 -1
  3. data/app/controllers/qa/linked_data_terms_controller.rb +30 -9
  4. data/app/controllers/qa/terms_controller.rb +3 -2
  5. data/app/models/qa/linked_data/config/context_property_map.rb +6 -25
  6. data/app/services/qa/iri_template_service.rb +32 -24
  7. data/app/services/qa/linked_data/authority_service.rb +8 -0
  8. data/app/services/qa/linked_data/authority_url_service.rb +27 -8
  9. data/app/services/qa/linked_data/deep_sort_service.rb +3 -2
  10. data/app/services/qa/linked_data/graph_service.rb +13 -0
  11. data/app/services/qa/linked_data/language_service.rb +12 -0
  12. data/app/services/qa/linked_data/language_sort_service.rb +7 -2
  13. data/app/services/qa/linked_data/ldpath_service.rb +40 -0
  14. data/app/services/qa/linked_data/mapper/graph_ldpath_mapper_service.rb +49 -0
  15. data/app/services/qa/linked_data/mapper/graph_mapper_service.rb +3 -11
  16. data/app/services/qa/linked_data/mapper/graph_predicate_mapper_service.rb +40 -0
  17. data/app/services/qa/linked_data/mapper/search_results_mapper_service.rb +58 -11
  18. data/app/services/qa/linked_data/mapper/term_results_mapper_service.rb +80 -0
  19. data/config/authorities/linked_data/loc.json +13 -7
  20. data/config/authorities/linked_data/oclc_fast.json +13 -8
  21. data/lib/generators/qa/discogs/USAGE +10 -0
  22. data/lib/generators/qa/discogs/discogs_generator.rb +12 -0
  23. data/lib/generators/qa/discogs/templates/config/discogs-formats.yml +346 -0
  24. data/lib/generators/qa/discogs/templates/config/discogs-genres.yml +627 -0
  25. data/lib/generators/qa/install/templates/config/initializers/qa.rb +4 -0
  26. data/lib/qa.rb +6 -0
  27. data/lib/qa/authorities.rb +2 -0
  28. data/lib/qa/authorities/discogs.rb +28 -0
  29. data/lib/qa/authorities/discogs/discogs_instance_builder.rb +145 -0
  30. data/lib/qa/authorities/discogs/discogs_translation.rb +126 -0
  31. data/lib/qa/authorities/discogs/discogs_utils.rb +89 -0
  32. data/lib/qa/authorities/discogs/discogs_works_builder.rb +153 -0
  33. data/lib/qa/authorities/discogs/generic_authority.rb +151 -0
  34. data/lib/qa/authorities/discogs_subauthority.rb +9 -0
  35. data/lib/qa/authorities/linked_data/config.rb +7 -3
  36. data/lib/qa/authorities/linked_data/config/search_config.rb +99 -11
  37. data/lib/qa/authorities/linked_data/config/term_config.rb +112 -8
  38. data/lib/qa/authorities/linked_data/find_term.rb +154 -84
  39. data/lib/qa/authorities/linked_data/search_query.rb +76 -13
  40. data/lib/qa/configuration.rb +8 -0
  41. data/lib/qa/version.rb +1 -1
  42. data/spec/controllers/linked_data_terms_controller_spec.rb +151 -30
  43. data/spec/controllers/terms_controller_spec.rb +4 -0
  44. data/spec/features/linked_data/language_spec.rb +298 -0
  45. data/spec/fixtures/authorities/linked_data/lod_full_config.json +21 -5
  46. data/spec/fixtures/authorities/linked_data/lod_lang_defaults.json +4 -4
  47. data/spec/fixtures/authorities/linked_data/lod_lang_multi_defaults.json +4 -4
  48. data/spec/fixtures/authorities/linked_data/lod_lang_no_defaults.json +4 -5
  49. data/spec/fixtures/authorities/linked_data/lod_lang_param.json +4 -4
  50. data/spec/fixtures/authorities/linked_data/lod_term_uri_param_config.json +1 -1
  51. data/spec/fixtures/discogs-find-response-json.json +1 -0
  52. data/spec/fixtures/discogs-find-response-jsonld-master.json +1 -0
  53. data/spec/fixtures/discogs-find-response-jsonld-release.json +1 -0
  54. data/spec/fixtures/discogs-id-matches-master.json +1 -0
  55. data/spec/fixtures/discogs-id-matches-release.json +1 -0
  56. data/spec/fixtures/discogs-id-not-found-master.json +1 -0
  57. data/spec/fixtures/discogs-id-not-found-release.json +1 -0
  58. data/spec/fixtures/discogs-search-response-no-auth.json +1 -0
  59. data/spec/fixtures/discogs-search-response-no-subauth.json +1 -0
  60. data/spec/fixtures/discogs-search-response-subauth.json +1 -0
  61. data/spec/fixtures/lod_lang_search_enesfrde.rdf.xml +60 -0
  62. data/spec/fixtures/lod_lang_search_sv.rdf.xml +42 -0
  63. data/spec/fixtures/lod_loc_term_found.rdf.xml +5 -0
  64. data/spec/lib/authorities/discogs/generic_authority_spec.rb +235 -0
  65. data/spec/lib/authorities/discogs_spec.rb +17 -0
  66. data/spec/lib/authorities/linked_data/config_spec.rb +68 -5
  67. data/spec/lib/authorities/linked_data/find_term_spec.rb +298 -3
  68. data/spec/lib/authorities/linked_data/generic_authority_spec.rb +46 -485
  69. data/spec/lib/authorities/linked_data/search_config_spec.rb +154 -3
  70. data/spec/lib/authorities/linked_data/search_query_spec.rb +240 -3
  71. data/spec/lib/authorities/linked_data/term_config_spec.rb +193 -5
  72. data/spec/lib/configuration_spec.rb +18 -0
  73. data/spec/models/linked_data/config/context_property_map_spec.rb +3 -31
  74. data/spec/services/iri_template_service_spec.rb +54 -12
  75. data/spec/{lib/authorities → services}/linked_data/authority_service_spec.rb +47 -0
  76. data/spec/services/linked_data/language_service_spec.rb +52 -11
  77. data/spec/services/linked_data/ldpath_service_spec.rb +61 -0
  78. data/spec/services/linked_data/mapper/graph_ldpath_mapper_service_spec.rb +118 -0
  79. data/spec/services/linked_data/mapper/graph_predicate_mapper_service_spec.rb +110 -0
  80. data/spec/services/linked_data/mapper/term_results_mapper_service_spec.rb +94 -0
  81. data/spec/spec_helper.rb +1 -1
  82. data/spec/support/matchers/include_hash.rb +5 -0
  83. data/spec/test_app_templates/lib/generators/test_app_generator.rb +4 -0
  84. metadata +73 -5
  85. data/lib/qa/authorities/linked_data/rdf_helper.rb +0 -49
@@ -27,7 +27,7 @@ require 'pry'
27
27
 
28
28
  # Requires supporting ruby files with custom matchers and macros, etc,
29
29
  # in spec/support/ and its subdirectories.
30
- Dir[Rails.root.join('spec', 'support', '**', '*.rb')].each { |f| require f }
30
+ Dir[File.join(File.dirname(__FILE__), "support/**/*.rb")].each { |f| require f }
31
31
 
32
32
  RSpec.configure do |config|
33
33
  config.fixture_path = File.expand_path("../fixtures", __FILE__)
@@ -0,0 +1,5 @@
1
+ RSpec::Matchers.define :include_hash do |expected_hash|
2
+ match do |actual_array|
3
+ actual_array.any? { |a_hash| a_hash == expected_hash }
4
+ end
5
+ end
@@ -22,6 +22,10 @@ class TestAppGenerator < Rails::Generators::Base
22
22
  directory "../spec/fixtures/authorities", "config/authorities"
23
23
  end
24
24
 
25
+ def run_discogs_installer
26
+ generate "qa:discogs"
27
+ end
28
+
25
29
  def run_migrations
26
30
  rake "qa:install:migrations"
27
31
  rake "db:migrate"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: qa
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.0.0
4
+ version: 4.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stephen Anderson
@@ -16,7 +16,7 @@ authors:
16
16
  autorequire:
17
17
  bindir: bin
18
18
  cert_chain: []
19
- date: 2019-03-11 00:00:00.000000000 Z
19
+ date: 2019-05-06 00:00:00.000000000 Z
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
22
22
  name: activerecord-import
@@ -270,6 +270,20 @@ dependencies:
270
270
  - - ">="
271
271
  - !ruby/object:Gem::Version
272
272
  version: '0'
273
+ - !ruby/object:Gem::Dependency
274
+ name: rspec_junit_formatter
275
+ requirement: !ruby/object:Gem::Requirement
276
+ requirements:
277
+ - - ">="
278
+ - !ruby/object:Gem::Version
279
+ version: '0'
280
+ type: :development
281
+ prerelease: false
282
+ version_requirements: !ruby/object:Gem::Requirement
283
+ requirements:
284
+ - - ">="
285
+ - !ruby/object:Gem::Version
286
+ version: '0'
273
287
  description: Provides a set of uniform RESTful routes to query any controlled vocabulary
274
288
  or set of authority terms.
275
289
  email:
@@ -301,9 +315,13 @@ files:
301
315
  - app/services/qa/linked_data/graph_service.rb
302
316
  - app/services/qa/linked_data/language_service.rb
303
317
  - app/services/qa/linked_data/language_sort_service.rb
318
+ - app/services/qa/linked_data/ldpath_service.rb
304
319
  - app/services/qa/linked_data/mapper/context_mapper_service.rb
320
+ - app/services/qa/linked_data/mapper/graph_ldpath_mapper_service.rb
305
321
  - app/services/qa/linked_data/mapper/graph_mapper_service.rb
322
+ - app/services/qa/linked_data/mapper/graph_predicate_mapper_service.rb
306
323
  - app/services/qa/linked_data/mapper/search_results_mapper_service.rb
324
+ - app/services/qa/linked_data/mapper/term_results_mapper_service.rb
307
325
  - app/views/layouts/qa/application.html.erb
308
326
  - config/authorities.yml
309
327
  - config/authorities/linked_data/loc.json
@@ -332,6 +350,10 @@ files:
332
350
  - lib/generators/qa/apidoc/templates/public/qa/apidoc/swagger-ui.css.map
333
351
  - lib/generators/qa/apidoc/templates/public/qa/apidoc/swagger-ui.js
334
352
  - lib/generators/qa/apidoc/templates/public/qa/apidoc/swagger-ui.js.map
353
+ - lib/generators/qa/discogs/USAGE
354
+ - lib/generators/qa/discogs/discogs_generator.rb
355
+ - lib/generators/qa/discogs/templates/config/discogs-formats.yml
356
+ - lib/generators/qa/discogs/templates/config/discogs-genres.yml
335
357
  - lib/generators/qa/install/USAGE
336
358
  - lib/generators/qa/install/install_generator.rb
337
359
  - lib/generators/qa/install/templates/config/initializers/qa.rb
@@ -353,6 +375,13 @@ files:
353
375
  - lib/qa/authorities/base.rb
354
376
  - lib/qa/authorities/crossref.rb
355
377
  - lib/qa/authorities/crossref/generic_authority.rb
378
+ - lib/qa/authorities/discogs.rb
379
+ - lib/qa/authorities/discogs/discogs_instance_builder.rb
380
+ - lib/qa/authorities/discogs/discogs_translation.rb
381
+ - lib/qa/authorities/discogs/discogs_utils.rb
382
+ - lib/qa/authorities/discogs/discogs_works_builder.rb
383
+ - lib/qa/authorities/discogs/generic_authority.rb
384
+ - lib/qa/authorities/discogs_subauthority.rb
356
385
  - lib/qa/authorities/geonames.rb
357
386
  - lib/qa/authorities/getty.rb
358
387
  - lib/qa/authorities/getty/aat.rb
@@ -364,7 +393,6 @@ files:
364
393
  - lib/qa/authorities/linked_data/config/term_config.rb
365
394
  - lib/qa/authorities/linked_data/find_term.rb
366
395
  - lib/qa/authorities/linked_data/generic_authority.rb
367
- - lib/qa/authorities/linked_data/rdf_helper.rb
368
396
  - lib/qa/authorities/linked_data/search_query.rb
369
397
  - lib/qa/authorities/loc.rb
370
398
  - lib/qa/authorities/loc/generic_authority.rb
@@ -392,6 +420,7 @@ files:
392
420
  - lib/tasks/qa_tasks.rake
393
421
  - spec/controllers/linked_data_terms_controller_spec.rb
394
422
  - spec/controllers/terms_controller_spec.rb
423
+ - spec/features/linked_data/language_spec.rb
395
424
  - spec/fixtures/aat-response.txt
396
425
  - spec/fixtures/assign-fast-noheader.json
397
426
  - spec/fixtures/assign-fast-noresults.json
@@ -414,6 +443,16 @@ files:
414
443
  - spec/fixtures/authorities/linked_data/lod_term_id_param_config.json
415
444
  - spec/fixtures/authorities/linked_data/lod_term_only_config.json
416
445
  - spec/fixtures/authorities/linked_data/lod_term_uri_param_config.json
446
+ - spec/fixtures/discogs-find-response-json.json
447
+ - spec/fixtures/discogs-find-response-jsonld-master.json
448
+ - spec/fixtures/discogs-find-response-jsonld-release.json
449
+ - spec/fixtures/discogs-id-matches-master.json
450
+ - spec/fixtures/discogs-id-matches-release.json
451
+ - spec/fixtures/discogs-id-not-found-master.json
452
+ - spec/fixtures/discogs-id-not-found-release.json
453
+ - spec/fixtures/discogs-search-response-no-auth.json
454
+ - spec/fixtures/discogs-search-response-no-subauth.json
455
+ - spec/fixtures/discogs-search-response-subauth.json
417
456
  - spec/fixtures/funders-find-response.json
418
457
  - spec/fixtures/funders-noquery.json
419
458
  - spec/fixtures/funders-noresults.json
@@ -437,10 +476,12 @@ files:
437
476
  - spec/fixtures/lod_2_ranked_2_unranked.nt
438
477
  - spec/fixtures/lod_3_ranked_varying_preds.nt
439
478
  - spec/fixtures/lod_lang_search_en.rdf.xml
479
+ - spec/fixtures/lod_lang_search_enesfrde.rdf.xml
440
480
  - spec/fixtures/lod_lang_search_enfr.rdf.xml
441
481
  - spec/fixtures/lod_lang_search_enfrde.rdf.xml
442
482
  - spec/fixtures/lod_lang_search_filtering.nt
443
483
  - spec/fixtures/lod_lang_search_fr.rdf.xml
484
+ - spec/fixtures/lod_lang_search_sv.rdf.xml
444
485
  - spec/fixtures/lod_lang_term_en.rdf.xml
445
486
  - spec/fixtures/lod_lang_term_enfr.rdf.xml
446
487
  - spec/fixtures/lod_lang_term_enfr_noalt.rdf.xml
@@ -462,13 +503,14 @@ files:
462
503
  - spec/lib/authorities/assign_fast_spec.rb
463
504
  - spec/lib/authorities/base_spec.rb
464
505
  - spec/lib/authorities/crossref_spec.rb
506
+ - spec/lib/authorities/discogs/generic_authority_spec.rb
507
+ - spec/lib/authorities/discogs_spec.rb
465
508
  - spec/lib/authorities/file_based_authority_spec.rb
466
509
  - spec/lib/authorities/geonames_spec.rb
467
510
  - spec/lib/authorities/getty/aat_spec.rb
468
511
  - spec/lib/authorities/getty/tgn_spec.rb
469
512
  - spec/lib/authorities/getty/ulan_spec.rb
470
513
  - spec/lib/authorities/getty_spec.rb
471
- - spec/lib/authorities/linked_data/authority_service_spec.rb
472
514
  - spec/lib/authorities/linked_data/config_spec.rb
473
515
  - spec/lib/authorities/linked_data/find_term_spec.rb
474
516
  - spec/lib/authorities/linked_data/generic_authority_spec.rb
@@ -497,15 +539,21 @@ files:
497
539
  - spec/routing/linked_data_route_spec.rb
498
540
  - spec/routing/route_spec.rb
499
541
  - spec/services/iri_template_service_spec.rb
542
+ - spec/services/linked_data/authority_service_spec.rb
500
543
  - spec/services/linked_data/authority_url_service_spec.rb
501
544
  - spec/services/linked_data/deep_sort_service_spec.rb
502
545
  - spec/services/linked_data/graph_service_spec.rb
503
546
  - spec/services/linked_data/language_service_spec.rb
504
547
  - spec/services/linked_data/language_sort_service_spec.rb
548
+ - spec/services/linked_data/ldpath_service_spec.rb
505
549
  - spec/services/linked_data/mapper/context_mapper_service_spec.rb
550
+ - spec/services/linked_data/mapper/graph_ldpath_mapper_service_spec.rb
506
551
  - spec/services/linked_data/mapper/graph_mapper_service_spec.rb
552
+ - spec/services/linked_data/mapper/graph_predicate_mapper_service_spec.rb
507
553
  - spec/services/linked_data/mapper/search_results_mapper_service_spec.rb
554
+ - spec/services/linked_data/mapper/term_results_mapper_service_spec.rb
508
555
  - spec/spec_helper.rb
556
+ - spec/support/matchers/include_hash.rb
509
557
  - spec/test_app_templates/Gemfile.extra
510
558
  - spec/test_app_templates/lib/generators/test_app_generator.rb
511
559
  homepage: https://github.com/projecthydra/questioning_authority
@@ -534,12 +582,14 @@ specification_version: 4
534
582
  summary: You should question your authorities.
535
583
  test_files:
536
584
  - spec/spec_helper.rb
585
+ - spec/features/linked_data/language_spec.rb
537
586
  - spec/models/linked_data/config/context_map_spec.rb
538
587
  - spec/models/linked_data/config/context_property_map_spec.rb
539
588
  - spec/models/iri_template/variable_map_spec.rb
540
589
  - spec/models/iri_template/url_config_spec.rb
541
590
  - spec/models/subject_mesh_term_spec.rb
542
591
  - spec/requests/cors_headers_spec.rb
592
+ - spec/support/matchers/include_hash.rb
543
593
  - spec/test_app_templates/lib/generators/test_app_generator.rb
544
594
  - spec/test_app_templates/Gemfile.extra
545
595
  - spec/lib/tasks/mesh.rake_spec.rb
@@ -548,7 +598,6 @@ test_files:
548
598
  - spec/lib/mesh_data_parser_spec.rb
549
599
  - spec/lib/authorities/linked_data/config_spec.rb
550
600
  - spec/lib/authorities/linked_data/search_config_spec.rb
551
- - spec/lib/authorities/linked_data/authority_service_spec.rb
552
601
  - spec/lib/authorities/linked_data/search_query_spec.rb
553
602
  - spec/lib/authorities/linked_data/term_config_spec.rb
554
603
  - spec/lib/authorities/linked_data/find_term_spec.rb
@@ -564,26 +613,33 @@ test_files:
564
613
  - spec/lib/authorities/getty/tgn_spec.rb
565
614
  - spec/lib/authorities/getty/ulan_spec.rb
566
615
  - spec/lib/authorities/getty/aat_spec.rb
616
+ - spec/lib/authorities/discogs_spec.rb
567
617
  - spec/lib/authorities/mesh_spec.rb
568
618
  - spec/lib/authorities/mysql_table_based_authority_spec.rb
569
619
  - spec/lib/authorities/local_spec.rb
620
+ - spec/lib/authorities/discogs/generic_authority_spec.rb
570
621
  - spec/lib/authorities/geonames_spec.rb
571
622
  - spec/lib/authorities/base_spec.rb
572
623
  - spec/lib/authorities/getty_spec.rb
573
624
  - spec/lib/services/rdf_authority_parser_spec.rb
625
+ - spec/fixtures/lod_lang_search_enesfrde.rdf.xml
574
626
  - spec/fixtures/oclcts-response-mesh-3.txt
575
627
  - spec/fixtures/loc-names-response.txt
576
628
  - spec/fixtures/oclcts-response-mesh-2.txt
577
629
  - spec/fixtures/aat-response.txt
578
630
  - spec/fixtures/journals-result.json
631
+ - spec/fixtures/discogs-search-response-no-subauth.json
579
632
  - spec/fixtures/lod_lang_search_fr.rdf.xml
580
633
  - spec/fixtures/oclcts-response-mesh-1.txt
581
634
  - spec/fixtures/lod_lang_term_fr.rdf.xml
635
+ - spec/fixtures/discogs-search-response-no-auth.json
582
636
  - spec/fixtures/lod_3_ranked_varying_preds.nt
583
637
  - spec/fixtures/lod_lang_search_filtering.nt
638
+ - spec/fixtures/discogs-find-response-jsonld-release.json
584
639
  - spec/fixtures/funders-noquery.json
585
640
  - spec/fixtures/lod_lang_term_enfrde.rdf.xml
586
641
  - spec/fixtures/assign-fast-oneresult.json
642
+ - spec/fixtures/discogs-id-not-found-master.json
587
643
  - spec/fixtures/getty-aat-find-response.json
588
644
  - spec/fixtures/lod_lang_term_enfr_noalt.rdf.xml
589
645
  - spec/fixtures/assign-fast-noresults.json
@@ -593,6 +649,7 @@ test_files:
593
649
  - spec/fixtures/assign-fast-topical-result.json
594
650
  - spec/fixtures/getty-ulan-find-response.json
595
651
  - spec/fixtures/loc-subjects-response.txt
652
+ - spec/fixtures/discogs-find-response-json.json
596
653
  - spec/fixtures/loc-subject-find-response.txt
597
654
  - spec/fixtures/lod_oclc_all_query_3_results.rdf.xml
598
655
  - spec/fixtures/lod_2_ranked_2_unranked.nt
@@ -601,16 +658,21 @@ test_files:
601
658
  - spec/fixtures/lod_lang_search_enfr.rdf.xml
602
659
  - spec/fixtures/journals-find-response-two-issn.json
603
660
  - spec/fixtures/mesh.txt
661
+ - spec/fixtures/discogs-search-response-subauth.json
604
662
  - spec/fixtures/lod_term_with_blanknode_objects.nt
605
663
  - spec/fixtures/geonames-find-response.json
606
664
  - spec/fixtures/lod_oclc_personalName_query_3_results.rdf.xml
607
665
  - spec/fixtures/loc-response.txt
666
+ - spec/fixtures/discogs-id-not-found-release.json
608
667
  - spec/fixtures/funders-find-response.json
609
668
  - spec/fixtures/lexvo_snippet.rdf.xml
610
669
  - spec/fixtures/journals-find-response.json
670
+ - spec/fixtures/discogs-id-matches-master.json
671
+ - spec/fixtures/discogs-find-response-jsonld-master.json
611
672
  - spec/fixtures/lod_lang_search_en.rdf.xml
612
673
  - spec/fixtures/lod_lang_term_en.rdf.xml
613
674
  - spec/fixtures/journals-noresults.json
675
+ - spec/fixtures/discogs-id-matches-release.json
614
676
  - spec/fixtures/journals-noquery.json
615
677
  - spec/fixtures/lod_oclc_query_no_results.rdf.xml
616
678
  - spec/fixtures/authorities/linked_data/lod_search_only_config.json
@@ -637,16 +699,22 @@ test_files:
637
699
  - spec/fixtures/assign-fast-noheader.json
638
700
  - spec/fixtures/lod_lang_search_enfrde.rdf.xml
639
701
  - spec/fixtures/funders-result.json
702
+ - spec/fixtures/lod_lang_search_sv.rdf.xml
640
703
  - spec/fixtures/ulan-response.txt
641
704
  - spec/routing/linked_data_route_spec.rb
642
705
  - spec/routing/route_spec.rb
643
706
  - spec/controllers/terms_controller_spec.rb
644
707
  - spec/controllers/linked_data_terms_controller_spec.rb
708
+ - spec/services/linked_data/authority_service_spec.rb
709
+ - spec/services/linked_data/ldpath_service_spec.rb
645
710
  - spec/services/linked_data/graph_service_spec.rb
646
711
  - spec/services/linked_data/language_sort_service_spec.rb
712
+ - spec/services/linked_data/mapper/graph_ldpath_mapper_service_spec.rb
713
+ - spec/services/linked_data/mapper/term_results_mapper_service_spec.rb
647
714
  - spec/services/linked_data/mapper/search_results_mapper_service_spec.rb
648
715
  - spec/services/linked_data/mapper/graph_mapper_service_spec.rb
649
716
  - spec/services/linked_data/mapper/context_mapper_service_spec.rb
717
+ - spec/services/linked_data/mapper/graph_predicate_mapper_service_spec.rb
650
718
  - spec/services/linked_data/deep_sort_service_spec.rb
651
719
  - spec/services/linked_data/language_service_spec.rb
652
720
  - spec/services/linked_data/authority_url_service_spec.rb
@@ -1,49 +0,0 @@
1
- require 'rdf'
2
-
3
- # Encapsulates processing of RDF results returned by the linked data authority. This is used exclussively by Qa::Authorities::LinkedData::GenericAuthority
4
- # @see Qa::Authorities::LinkedData::GenericAuthority
5
- module Qa::Authorities
6
- module LinkedData
7
- module RdfHelper
8
- private
9
-
10
- # TODO: elr - The bulk of the methods in this class moved to app/services/linked_data/rdf_service.rb. The remaining
11
- # methods are expected to move in a later refactor.
12
-
13
- def object_value(stmt_hash, consolidated_hash, name, as_string = true)
14
- new_object_value = stmt_hash[name]
15
- new_object_value = new_object_value.to_s if as_string
16
- all_object_values = consolidated_hash[name] || []
17
- all_object_values << new_object_value unless new_object_value.nil? || all_object_values.include?(new_object_value)
18
- all_object_values
19
- end
20
-
21
- def init_consolidated_hash(consolidated_results, uri, id)
22
- consolidated_hash = consolidated_results[uri] || {}
23
- if consolidated_hash.empty?
24
- consolidated_hash[:id] = uri
25
- consolidated_hash[:id] = id unless id.nil? || id.length <= 0
26
- end
27
- consolidated_hash
28
- end
29
-
30
- def extract_preds(graph, preds)
31
- RDF::Query.execute(graph) do
32
- preds[:required].each do |key, pred|
33
- pattern([:uri, pred, key])
34
- end
35
- preds[:optional].each do |key, pred|
36
- pattern([:uri, pred, key], optional: true)
37
- end
38
- end
39
- end
40
-
41
- def sort_string_by_language(str_literals)
42
- return str_literals if str_literals.blank?
43
- str_literals = Qa::LinkedData::LanguageSortService.new(str_literals).sort
44
- str_literals.map!(&:to_s).uniq!
45
- str_literals.delete_if { |s| s.nil? || s.length <= 0 }
46
- end
47
- end
48
- end
49
- end