cul_scv_hydra 0.22.6 → 0.22.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (101) hide show
  1. checksums.yaml +4 -4
  2. data/app/controllers/concerns/cul/hydra/controller.rb +22 -0
  3. data/app/controllers/concerns/cul/hydra/resolver.rb +69 -0
  4. data/app/controllers/concerns/cul/hydra/thumbnails.rb +62 -0
  5. data/app/controllers/concerns/cul/scv/hydra/controller.rb +3 -19
  6. data/app/controllers/concerns/cul/scv/hydra/resolver.rb +2 -65
  7. data/app/controllers/concerns/cul/scv/hydra/thumbnails.rb +3 -59
  8. data/app/models/concept.rb +1 -1
  9. data/app/models/concerns/cul/hydra/models.rb +24 -0
  10. data/app/models/concerns/cul/hydra/models/aggregator.rb +121 -0
  11. data/app/models/concerns/cul/hydra/models/common.rb +220 -0
  12. data/app/models/concerns/cul/hydra/models/image_resource.rb +78 -0
  13. data/app/models/concerns/cul/hydra/models/linkable_resources.rb +108 -0
  14. data/app/models/concerns/cul/hydra/models/resource.rb +87 -0
  15. data/app/models/concerns/cul/scv/hydra/models.rb +1 -13
  16. data/app/models/concerns/cul/scv/hydra/models/aggregator.rb +1 -116
  17. data/app/models/concerns/cul/scv/hydra/models/common.rb +1 -213
  18. data/app/models/concerns/cul/scv/hydra/models/image_resource.rb +3 -75
  19. data/app/models/concerns/cul/scv/hydra/models/linkable_resources.rb +3 -105
  20. data/app/models/concerns/cul/scv/hydra/models/resource.rb +2 -83
  21. data/app/models/cul/hydra/datastreams/dc_metadata.rb +107 -0
  22. data/app/models/cul/hydra/datastreams/mods_document.rb +195 -0
  23. data/app/models/cul/hydra/datastreams/struct_metadata.rb +176 -0
  24. data/app/models/cul/scv/hydra/datastreams/dc_metadata.rb +5 -104
  25. data/app/models/cul/scv/hydra/datastreams/mods_document.rb +5 -178
  26. data/app/models/cul/scv/hydra/datastreams/struct_metadata.rb +5 -174
  27. data/app/models/dc_document.rb +1 -1
  28. data/app/models/generic_aggregator.rb +5 -5
  29. data/app/models/generic_object.rb +2 -2
  30. data/app/models/generic_resource.rb +4 -4
  31. data/app/models/mets_structured_aggregator.rb +2 -2
  32. data/app/models/resource.rb +3 -3
  33. data/app/models/resource_aggregator.rb +3 -3
  34. data/fixtures/spec/CUL_MODS/mods-subjects.xml +24 -0
  35. data/lib/cul_hydra.rb +18 -0
  36. data/lib/cul_hydra/access_controls_enforcement.rb +53 -0
  37. data/lib/cul_hydra/controllers.rb +13 -0
  38. data/lib/cul_hydra/controllers/aggregates.rb +93 -0
  39. data/lib/cul_hydra/controllers/aggregator_controller_helper.rb +27 -0
  40. data/lib/cul_hydra/controllers/catalog.rb +12 -0
  41. data/lib/cul_hydra/controllers/content_aggregators.rb +81 -0
  42. data/lib/cul_hydra/controllers/datastreams.rb +145 -0
  43. data/lib/cul_hydra/controllers/helpers.rb +10 -0
  44. data/lib/{cul_scv_hydra → cul_hydra}/controllers/helpers/active_fedora_helper_behavior.rb +1 -1
  45. data/lib/{cul_scv_hydra → cul_hydra}/controllers/helpers/application_helper_behavior.rb +1 -1
  46. data/lib/{cul_scv_hydra → cul_hydra}/controllers/helpers/dc_metadata_helper_behavior.rb +1 -1
  47. data/lib/{cul_scv_hydra → cul_hydra}/controllers/helpers/hydra_assets_helper_behavior.rb +1 -1
  48. data/lib/{cul_scv_hydra → cul_hydra}/controllers/helpers/hydra_autocomplete_helper_behavior.rb +1 -1
  49. data/lib/{cul_scv_hydra → cul_hydra}/controllers/helpers/hydra_uploader_helper_behavior.rb +1 -1
  50. data/lib/{cul_scv_hydra → cul_hydra}/controllers/helpers/resources_helper_behavior.rb +1 -1
  51. data/lib/cul_hydra/controllers/resources.rb +161 -0
  52. data/lib/cul_hydra/controllers/static_image_aggregators.rb +105 -0
  53. data/lib/cul_hydra/controllers/suggestions.rb +126 -0
  54. data/lib/cul_hydra/controllers/terms.rb +205 -0
  55. data/lib/cul_hydra/engine.rb +31 -0
  56. data/lib/cul_hydra/fedora.rb +41 -0
  57. data/lib/cul_hydra/fedora/dummy_object.rb +37 -0
  58. data/lib/cul_hydra/fedora/rubydora_patch.rb +16 -0
  59. data/lib/cul_hydra/fedora/url_helper_behavior.rb +32 -0
  60. data/lib/cul_hydra/indexer.rb +84 -0
  61. data/lib/cul_hydra/om.rb +7 -0
  62. data/lib/cul_hydra/om/standard_mods.rb +115 -0
  63. data/lib/cul_hydra/risearch_members.rb +92 -0
  64. data/lib/cul_hydra/solrizer.rb +10 -0
  65. data/lib/cul_hydra/solrizer/extractor.rb +27 -0
  66. data/lib/cul_hydra/solrizer/mods_fieldable.rb +435 -0
  67. data/lib/cul_hydra/solrizer/terminology_based_solrizer.rb +35 -0
  68. data/lib/cul_hydra/solrizer/value_mapper.rb +46 -0
  69. data/lib/{cul_scv_hydra/solrizer/field_mapper.rb → cul_hydra/solrizer_patch.rb} +0 -0
  70. data/lib/cul_hydra/version.rb +8 -0
  71. data/lib/cul_hydra/version.rb~ +8 -0
  72. data/lib/cul_scv_fedora/dummy_object.rb +1 -30
  73. data/lib/cul_scv_fedora/rubydora_patch.rb +3 -7
  74. data/lib/cul_scv_fedora/url_helper_behavior.rb +3 -23
  75. data/lib/cul_scv_hydra.rb +5 -32
  76. data/lib/cul_scv_hydra/access_controls_enforcement.rb +3 -50
  77. data/lib/cul_scv_hydra/controllers.rb +10 -10
  78. data/lib/cul_scv_hydra/controllers/aggregates.rb +1 -86
  79. data/lib/cul_scv_hydra/controllers/aggregator_controller_helper.rb +4 -23
  80. data/lib/cul_scv_hydra/controllers/catalog.rb +5 -9
  81. data/lib/cul_scv_hydra/controllers/content_aggregators.rb +4 -77
  82. data/lib/cul_scv_hydra/controllers/datastreams.rb +3 -140
  83. data/lib/cul_scv_hydra/controllers/helpers.rb +44 -8
  84. data/lib/cul_scv_hydra/controllers/resources.rb +4 -157
  85. data/lib/cul_scv_hydra/controllers/static_image_aggregators.rb +4 -100
  86. data/lib/cul_scv_hydra/controllers/suggestions.rb +4 -122
  87. data/lib/cul_scv_hydra/controllers/terms.rb +4 -201
  88. data/lib/cul_scv_hydra/engine.rb +1 -1
  89. data/lib/cul_scv_hydra/indexer.rb +3 -82
  90. data/lib/cul_scv_hydra/om.rb +2 -2
  91. data/lib/cul_scv_hydra/om/standard_mods.rb +1 -108
  92. data/lib/cul_scv_hydra/risearch_members.rb +4 -89
  93. data/lib/cul_scv_hydra/solrizer.rb +5 -6
  94. data/lib/cul_scv_hydra/solrizer/extractor.rb +1 -25
  95. data/lib/cul_scv_hydra/solrizer/scv_mods_fieldable.rb +4 -429
  96. data/lib/cul_scv_hydra/solrizer/terminology_based_solrizer.rb +4 -32
  97. data/lib/cul_scv_hydra/solrizer/value_mapper.rb +1 -44
  98. data/lib/cul_scv_hydra/version.rb +5 -5
  99. data/lib/tasks/index.rake +2 -2
  100. data/lib/tasks/transform.rake +23 -0
  101. metadata +55 -12
@@ -1,35 +1,7 @@
1
1
  require 'om'
2
2
  module Cul::Scv::Hydra::Solrizer::TerminologyBasedSolrizer
3
- # copied from Solrizer::XML::TerminologyBasedSolrizer
4
-
5
- def self.included(klass)
6
- klass.send(:extend, ClassMethods)
3
+ extend ActiveSupport::Concern
4
+ included do
5
+ include Cul::Hydra::Solrizer::TerminologyBasedSolrizer
7
6
  end
8
-
9
- # Module Methods
10
-
11
- module ClassMethods
12
- # Populate a solr document with solr fields corresponding to the given xml node
13
- # Field names are generated using settings from the term in the +doc+'s terminology corresponding to +term_pointer+
14
- # @param [Nokogiri::XML::Node] node to solrize
15
- # @param [OM::XML::Document] doc document the node came from
16
- # @param [Array] term_pointer Array pointing to the term that should be used for solrization settings
17
- # @param [Hash] (optional) solr_doc (values hash) to populate
18
- def solrize_node(node_value, doc, term_pointer, term, solr_doc = Hash.new, field_mapper = nil, opts = {})
19
- return solr_doc unless term.index_as && !term.index_as.empty?
20
- generic_field_name_base = OM::XML::Terminology.term_generic_name(*term_pointer)
21
- create_and_insert_terms(generic_field_name_base, node_value, term.index_as, solr_doc)
22
- if term_pointer.length > 1
23
- #hierarchical_field_name_base = OM::XML::Terminology.term_hierarchical_name(*term_pointer)
24
- #create_and_insert_terms(hierarchical_field_name_base, node_value, term.index_as, solr_doc)
25
- end
26
- if term.variant_of and term.variant_of[:field_base]
27
- #create_and_insert_terms(term.variant_of[:field_base], node_value, term.index_as, solr_doc)
28
- create_and_insert_terms(term.variant_of[:field_base], node_value, term.index_as, solr_doc)
29
- end
30
- solr_doc
31
- end
32
-
33
- end
34
-
35
- end # module
7
+ end
@@ -1,46 +1,3 @@
1
1
  module Cul::Scv::Hydra::Solrizer
2
- # This class uses a yaml map to translate field values for solr
3
- class ValueMapper
4
- def self.load_value_maps(config_path=nil)
5
- if config_path.nil?
6
- if defined?(Rails.root) && !Rails.root.nil?
7
- config_path = File.join(Rails.root, "config", "solr_value_maps.yml")
8
- end
9
- # Default to using the config file within the gem
10
- if !File.exist?(config_path.to_s)
11
- config_path = File.join(File.dirname(__FILE__), "..", "..", "..", "config", "solr_value_maps.yml")
12
- end
13
- end
14
- #logger.info("ValueMapper: loading field value maps from #{File.expand_path(config_path)}")
15
- YAML::load(File.open(config_path))
16
- end
17
-
18
- def self.default_value_maps
19
- @@value_maps ||= self.load_value_maps
20
- end
21
- # Instance methods
22
-
23
- def initialize(value_maps=nil)
24
- @value_maps = (value_maps || Cul::Scv::Hydra::Solrizer::ValueMapper.default_value_maps).with_indifferent_access
25
- @mapped_fields = {}.with_indifferent_access
26
- end
27
-
28
- def maps_field?(field_key)
29
- @mapped_fields.has_key? field_key
30
- end
31
-
32
- def map_field(field_key, map_key)
33
- @mapped_fields[field_key] = map_key
34
- end
35
-
36
- def map_value(field_key, value_key)
37
- map_key = @mapped_fields[field_key]
38
- return value_key unless @mapped_fields.has_key? field_key and @value_maps.has_key? map_key
39
- if value_key.is_a? Array
40
- value_key.collect{ |val| @value_maps[map_key].fetch(val, val) }
41
- else
42
- @value_maps[map_key].fetch(value_key, value_key)
43
- end
44
- end
45
- end
2
+ class ValueMapper < Cul::Hydra::Solrizer::ValueMapper;end
46
3
  end
@@ -1,11 +1,11 @@
1
-
1
+ require 'cul_hydra/version'
2
2
  module Cul
3
3
  module Scv
4
4
  module Hydra
5
- VERSION = '0.22.6'
6
- def self.version
7
- VERSION
8
- end
5
+ VERSION = Cul::Hydra::VERSION
6
+ def self.version
7
+ VERSION
8
+ end
9
9
  end
10
10
  end
11
11
  end
data/lib/tasks/index.rake CHANGED
@@ -28,7 +28,7 @@ namespace :cul_scv_hydra do
28
28
 
29
29
  begin
30
30
  pids.each do |pid|
31
- Cul::Scv::Hydra::Indexer.recursively_index_fedora_objects(pid, pids_to_omit, skip_generic_resources, true)
31
+ Cul::Hydra::Indexer.recursively_index_fedora_objects(pid, pids_to_omit, skip_generic_resources, true)
32
32
  end
33
33
  rescue => e
34
34
  puts 'Error: ' + e.message
@@ -59,7 +59,7 @@ namespace :cul_scv_hydra do
59
59
  counter = 0
60
60
 
61
61
  pids.each do |pid|
62
- Cul::Scv::Hydra::Indexer.index_pid(pid, false, false)
62
+ Cul::Hydra::Indexer.index_pid(pid, false, false)
63
63
  counter += 1
64
64
  puts "Indexed #{counter} of #{total} | #{Time.now - start_time} seconds"
65
65
  end
@@ -0,0 +1,23 @@
1
+ namespace :cul_scv_hydra do
2
+
3
+ namespace :transform do
4
+
5
+ task :marc => :environment do
6
+
7
+ begin
8
+ src_path = File.join(Rails.root,'fixtures','spec','MARCXML','3867996.xml')
9
+ xsl_path = File.join(Rails.root,'config','xsl','marc_to_mods.xsl')
10
+ doc = Nokogiri::XML(File.read(src_path))
11
+ xslt = Nokogiri::XSLT(File.read(xsl_path))
12
+ puts xslt.transform(doc)
13
+ rescue => e
14
+ puts 'Error: ' + e.message
15
+ puts e.backtrace
16
+ next
17
+ end
18
+
19
+ end
20
+
21
+ end
22
+
23
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cul_scv_hydra
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.22.6
4
+ version: 0.22.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Benjamin Armintor
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2015-03-02 00:00:00.000000000 Z
12
+ date: 2015-03-04 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: blacklight
@@ -235,7 +235,7 @@ dependencies:
235
235
  - - ">="
236
236
  - !ruby/object:Gem::Version
237
237
  version: '0'
238
- description: Hydra implementations for CUL Staff Collection Viewer
238
+ description: Hydra implementations for CUL repository apps
239
239
  email: armintor@gmail.com
240
240
  executables: []
241
241
  extensions: []
@@ -281,6 +281,9 @@ files:
281
281
  - app/assets/images/cul_scv_hydra/crystal/multimedia2.png
282
282
  - app/assets/images/cul_scv_hydra/crystal/video.png
283
283
  - app/controllers/concerns/cul/hydra/application_id_behavior.rb
284
+ - app/controllers/concerns/cul/hydra/controller.rb
285
+ - app/controllers/concerns/cul/hydra/resolver.rb
286
+ - app/controllers/concerns/cul/hydra/thumbnails.rb
284
287
  - app/controllers/concerns/cul/scv/hydra/controller.rb
285
288
  - app/controllers/concerns/cul/scv/hydra/resolver.rb
286
289
  - app/controllers/concerns/cul/scv/hydra/thumbnails.rb
@@ -288,6 +291,12 @@ files:
288
291
  - app/helpers/cul/hydra/struct_metadata_helper_behavior.rb
289
292
  - app/models/bag_aggregator.rb
290
293
  - app/models/concept.rb
294
+ - app/models/concerns/cul/hydra/models.rb
295
+ - app/models/concerns/cul/hydra/models/aggregator.rb
296
+ - app/models/concerns/cul/hydra/models/common.rb
297
+ - app/models/concerns/cul/hydra/models/image_resource.rb
298
+ - app/models/concerns/cul/hydra/models/linkable_resources.rb
299
+ - app/models/concerns/cul/hydra/models/resource.rb
291
300
  - app/models/concerns/cul/scv/hydra/models.rb
292
301
  - app/models/concerns/cul/scv/hydra/models/aggregator.rb
293
302
  - app/models/concerns/cul/scv/hydra/models/common.rb
@@ -310,6 +319,9 @@ files:
310
319
  - app/models/concerns/sc/canvas.rb
311
320
  - app/models/concerns/sc/sequence.rb
312
321
  - app/models/content_aggregator.rb
322
+ - app/models/cul/hydra/datastreams/dc_metadata.rb
323
+ - app/models/cul/hydra/datastreams/mods_document.rb
324
+ - app/models/cul/hydra/datastreams/struct_metadata.rb
313
325
  - app/models/cul/scv/hydra/datastreams/dc_metadata.rb
314
326
  - app/models/cul/scv/hydra/datastreams/mods_document.rb
315
327
  - app/models/cul/scv/hydra/datastreams/struct_metadata.rb
@@ -415,6 +427,43 @@ files:
415
427
  - fixtures/spec/STRUCTMAP/structmap-recto.xml
416
428
  - fixtures/spec/STRUCTMAP/structmap-seq.xml
417
429
  - fixtures/spec/STRUCTMAP/structmap-unordered-seq.xml
430
+ - lib/cul_hydra.rb
431
+ - lib/cul_hydra/access_controls_enforcement.rb
432
+ - lib/cul_hydra/controllers.rb
433
+ - lib/cul_hydra/controllers/aggregates.rb
434
+ - lib/cul_hydra/controllers/aggregator_controller_helper.rb
435
+ - lib/cul_hydra/controllers/catalog.rb
436
+ - lib/cul_hydra/controllers/content_aggregators.rb
437
+ - lib/cul_hydra/controllers/datastreams.rb
438
+ - lib/cul_hydra/controllers/helpers.rb
439
+ - lib/cul_hydra/controllers/helpers/active_fedora_helper_behavior.rb
440
+ - lib/cul_hydra/controllers/helpers/application_helper_behavior.rb
441
+ - lib/cul_hydra/controllers/helpers/dc_metadata_helper_behavior.rb
442
+ - lib/cul_hydra/controllers/helpers/hydra_assets_helper_behavior.rb
443
+ - lib/cul_hydra/controllers/helpers/hydra_autocomplete_helper_behavior.rb
444
+ - lib/cul_hydra/controllers/helpers/hydra_uploader_helper_behavior.rb
445
+ - lib/cul_hydra/controllers/helpers/resources_helper_behavior.rb
446
+ - lib/cul_hydra/controllers/resources.rb
447
+ - lib/cul_hydra/controllers/static_image_aggregators.rb
448
+ - lib/cul_hydra/controllers/suggestions.rb
449
+ - lib/cul_hydra/controllers/terms.rb
450
+ - lib/cul_hydra/engine.rb
451
+ - lib/cul_hydra/fedora.rb
452
+ - lib/cul_hydra/fedora/dummy_object.rb
453
+ - lib/cul_hydra/fedora/rubydora_patch.rb
454
+ - lib/cul_hydra/fedora/url_helper_behavior.rb
455
+ - lib/cul_hydra/indexer.rb
456
+ - lib/cul_hydra/om.rb
457
+ - lib/cul_hydra/om/standard_mods.rb
458
+ - lib/cul_hydra/risearch_members.rb
459
+ - lib/cul_hydra/solrizer.rb
460
+ - lib/cul_hydra/solrizer/extractor.rb
461
+ - lib/cul_hydra/solrizer/mods_fieldable.rb
462
+ - lib/cul_hydra/solrizer/terminology_based_solrizer.rb
463
+ - lib/cul_hydra/solrizer/value_mapper.rb
464
+ - lib/cul_hydra/solrizer_patch.rb
465
+ - lib/cul_hydra/version.rb
466
+ - lib/cul_hydra/version.rb~
418
467
  - lib/cul_scv_fedora/dummy_object.rb
419
468
  - lib/cul_scv_fedora/rubydora_patch.rb
420
469
  - lib/cul_scv_fedora/url_helper_behavior.rb
@@ -427,13 +476,6 @@ files:
427
476
  - lib/cul_scv_hydra/controllers/content_aggregators.rb
428
477
  - lib/cul_scv_hydra/controllers/datastreams.rb
429
478
  - lib/cul_scv_hydra/controllers/helpers.rb
430
- - lib/cul_scv_hydra/controllers/helpers/active_fedora_helper_behavior.rb
431
- - lib/cul_scv_hydra/controllers/helpers/application_helper_behavior.rb
432
- - lib/cul_scv_hydra/controllers/helpers/dc_metadata_helper_behavior.rb
433
- - lib/cul_scv_hydra/controllers/helpers/hydra_assets_helper_behavior.rb
434
- - lib/cul_scv_hydra/controllers/helpers/hydra_autocomplete_helper_behavior.rb
435
- - lib/cul_scv_hydra/controllers/helpers/hydra_uploader_helper_behavior.rb
436
- - lib/cul_scv_hydra/controllers/helpers/resources_helper_behavior.rb
437
479
  - lib/cul_scv_hydra/controllers/resources.rb
438
480
  - lib/cul_scv_hydra/controllers/static_image_aggregators.rb
439
481
  - lib/cul_scv_hydra/controllers/suggestions.rb
@@ -445,7 +487,6 @@ files:
445
487
  - lib/cul_scv_hydra/risearch_members.rb
446
488
  - lib/cul_scv_hydra/solrizer.rb
447
489
  - lib/cul_scv_hydra/solrizer/extractor.rb
448
- - lib/cul_scv_hydra/solrizer/field_mapper.rb
449
490
  - lib/cul_scv_hydra/solrizer/scv_mods_fieldable.rb
450
491
  - lib/cul_scv_hydra/solrizer/terminology_based_solrizer.rb
451
492
  - lib/cul_scv_hydra/solrizer/value_mapper.rb
@@ -454,6 +495,7 @@ files:
454
495
  - lib/tasks/cmodel.rake
455
496
  - lib/tasks/cul_hydra_dev.rake
456
497
  - lib/tasks/index.rake
498
+ - lib/tasks/transform.rake
457
499
  homepage: https://github.com/cul/cul_scv_hydra
458
500
  licenses: []
459
501
  metadata: {}
@@ -479,5 +521,6 @@ rubyforge_project:
479
521
  rubygems_version: 2.4.3
480
522
  signing_key:
481
523
  specification_version: 4
482
- summary: ActiveFedora, OM, and Solrizer implementations for CUL Staff Collection Viewer
524
+ summary: ActiveFedora, OM, and Solrizer implementations for CUL repository apps
483
525
  test_files: []
526
+ has_rdoc: