cul_scv_hydra 0.7.0 → 0.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- YTA1YzIzNjNjZWI5YjllODU5MGE3NzkwOGRlYjA5YWYyMDc4ZmU4NA==
4
+ YTI5YWY3ZWFjMWVhYjdjNjI4Mzc4MGRjYWNkNTg5MTk0MmNiZjY3Mg==
5
5
  data.tar.gz: !binary |-
6
- ZjUyODhkNDIwMmI0ZjA2NTllMTRiNDgxYTAwZTAzNzdiYmY5OTgzMw==
6
+ YzU5YzY4YjY3OWFjYWM5NzllOWRiNDU2ZThiYTk0ZTgwMjg4ZWE4MQ==
7
7
  !binary "U0hBNTEy":
8
8
  metadata.gz: !binary |-
9
- ZTcyNWQ0MmQ1YTgwZThhNTY0NDg5NzRhNGM0N2RiNjZlODBhNjA1MTRmZWM0
10
- NjcxNmQ1MzI5ZDc0ZTc3MmY1MWVlYTBmYThkYzY1MTc5YjUwYzg2NDZhNWVm
11
- NGRjNGVmNWVkYTUxMzU3OWZhMmI4OWIxY2VhN2MxNDkyNzViZGY=
9
+ YWU1Y2U2ZGQ5Zjg1ZDlhNmUxNzFmNDBjYTdhZjlmNDdjYjQ1MjhjYjc2YzVj
10
+ ZjBjYTcwMTY5NTViNTZiZTNhY2U3OTk1Yjc2YWFkODYxYTQyMzE4MjkwZDUz
11
+ YzBkNWM4ZTA4ZWNmNjk5NDA3M2YyY2JlNjNmNzNmZjk5NTYwNTM=
12
12
  data.tar.gz: !binary |-
13
- NDI5Y2JmODlkYWJmZjNlMWM4M2Y1M2RmYzZiMTgwMWI1NDAyNTk3YTA4NDkz
14
- MGUzMTI5Y2E2YTdmYTJmZDE0YTUxNjdlYTQ2OWFlYWQxMDRhNjE0NDU4ZDcx
15
- Yjk1OTE5N2Y0Y2E2NmU4NjFmNGEyYzVlNzczMDdjNDUxZDRlNjM=
13
+ ZTI1ZjY5ZDRmYzM0MWVhZDQ5MmVmNWQwZDVlZWVjODJmNTVjZDBmMzA3ZWQ2
14
+ YTRhODNhYTI1Yjc5MmJkNGJmN2Y2OTBjOWM2NzRiM2FhODM1NzhjZjdkZTFi
15
+ ZmNlNzA2ZWM0NTFjODRjYWYwYWViMWRlNTRlZGE3NTM0ZGJjZjA=
@@ -4,7 +4,6 @@ class BagAggregator < ::ActiveFedora::Base
4
4
  extend ActiveModel::Callbacks
5
5
  include ::ActiveFedora::Finders
6
6
  include ::ActiveFedora::DatastreamCollections
7
- include ::ActiveFedora::Relationships
8
7
  include ::Hydra::ModelMethods
9
8
  include Cul::Scv::Hydra::ActiveFedora::Model::Common
10
9
  include Cul::Scv::Hydra::ActiveFedora::Model::Aggregator
@@ -3,7 +3,6 @@ class ContentAggregator < ::ActiveFedora::Base
3
3
  extend ActiveModel::Callbacks
4
4
  include ::ActiveFedora::Finders
5
5
  include ::ActiveFedora::DatastreamCollections
6
- include ::ActiveFedora::Relationships
7
6
  include ::Hydra::ModelMethods
8
7
  include Cul::Scv::Hydra::ActiveFedora::Model::Common
9
8
  include Cul::Scv::Hydra::ActiveFedora::Model::Aggregator
@@ -1,13 +1,13 @@
1
1
  require "active-fedora"
2
2
  class DcDocument < ActiveFedora::Base
3
+ include ::ActiveFedora::Associations
3
4
  include ::ActiveFedora::Finders
4
5
  include ::ActiveFedora::DatastreamCollections
5
- include ::ActiveFedora::Relationships
6
6
  include Hydra::ModelMethods
7
7
  include Cul::Scv::Hydra::ActiveFedora::Model::Common
8
8
  alias :file_objects :resources
9
9
 
10
- has_relationship "parts", :cul_member_of, :inbound => true
10
+ has_many :parts, :property=>:cul_member_of, :class_name=>'ActiveFedora::Base'
11
11
 
12
12
  def self.load_instance_from_solr(pid,solr_doc=nil)
13
13
  if solr_doc.nil?
@@ -3,7 +3,6 @@ class GenericAggregator < ::ActiveFedora::Base
3
3
  extend ActiveModel::Callbacks
4
4
  include ::ActiveFedora::Finders
5
5
  include ::ActiveFedora::DatastreamCollections
6
- include ::ActiveFedora::Relationships
7
6
  include ::Hydra::ModelMethods
8
7
  include Cul::Scv::Hydra::ActiveFedora::Model::Common
9
8
  include Cul::Scv::Hydra::ActiveFedora::Model::Aggregator
@@ -3,7 +3,6 @@ class GenericObject < ::ActiveFedora::Base
3
3
  extend ActiveModel::Callbacks
4
4
  include ::ActiveFedora::Finders
5
5
  include ::ActiveFedora::DatastreamCollections
6
- include ::ActiveFedora::Relationships
7
6
  include ::Hydra::ModelMethods
8
7
  include Cul::Scv::Hydra::ActiveFedora::Model::Common
9
8
  include Cul::Scv::Hydra::ActiveFedora::Model::Aggregator
@@ -7,7 +7,6 @@ class GenericResource < ::ActiveFedora::Base
7
7
  extend ActiveModel::Callbacks
8
8
  include ::ActiveFedora::Finders
9
9
  include ::ActiveFedora::DatastreamCollections
10
- include ::ActiveFedora::Relationships
11
10
  include ::Hydra::ModelMethods
12
11
  include Cul::Scv::Hydra::ActiveFedora::Model::Common
13
12
  include ::ActiveFedora::RelsInt
@@ -34,8 +33,8 @@ class GenericResource < ::ActiveFedora::Base
34
33
 
35
34
  def to_solr(solr_doc = Hash.new, opts={})
36
35
  super
37
- unless solr_doc["extent_s"] || self.datastreams["content"].nil?
38
- solr_doc["extent_s"] = [self.datastreams["content"].size]
36
+ unless solr_doc["extent_ssi"] || self.datastreams["content"].nil?
37
+ solr_doc["extent_ssi"] = [self.datastreams["content"].size]
39
38
  end
40
39
  solr_doc
41
40
  end
@@ -3,7 +3,6 @@ class JP2ImageAggregator < ::ActiveFedora::Base
3
3
  extend ActiveModel::Callbacks
4
4
  include ::ActiveFedora::Finders
5
5
  include ::ActiveFedora::DatastreamCollections
6
- include ::ActiveFedora::Relationships
7
6
  include ::Hydra::ModelMethods
8
7
  include Cul::Scv::Hydra::ActiveFedora::Model::Common
9
8
  include Cul::Scv::Hydra::ActiveFedora::Model::Aggregator
@@ -25,13 +24,13 @@ class JP2ImageAggregator < ::ActiveFedora::Base
25
24
  source = self.datastreams["SOURCE"]
26
25
  source.profile
27
26
  if source.controlGroup == 'E'
28
- solr_doc["rft_id"] = source.dsLocation
27
+ solr_doc["rft_id_ss"] = source.dsLocation
29
28
  else
30
29
  rc = ActiveFedora::RubydoraConnection.instance.connection
31
30
  url = rc.config["url"]
32
31
  uri = URI::parse(url)
33
32
  url = "#{uri.scheme}://#{uri.host}:#{uri.port}/fedora/objects/#{pid}/datastreams/SOURCE/content"
34
- solr_doc["rft_id"] = url
33
+ solr_doc["rft_id_ss"] = url
35
34
  end
36
35
  solr_doc
37
36
  end
@@ -3,7 +3,6 @@ class METSStructuredAggregator < ::ActiveFedora::Base
3
3
  extend ActiveModel::Callbacks
4
4
  include ::ActiveFedora::Finders
5
5
  include ::ActiveFedora::DatastreamCollections
6
- include ::ActiveFedora::Relationships
7
6
  include ::Hydra::ModelMethods
8
7
  include Cul::Scv::Hydra::ActiveFedora::Model::Common
9
8
  include Cul::Scv::Hydra::ActiveFedora::Model::Aggregator
@@ -6,7 +6,6 @@ class Resource < ::ActiveFedora::Base
6
6
  extend ActiveModel::Callbacks
7
7
  include ::ActiveFedora::Finders
8
8
  include ::ActiveFedora::DatastreamCollections
9
- include ::ActiveFedora::Relationships
10
9
  include ::Hydra::ModelMethods
11
10
  include Cul::Scv::Hydra::ActiveFedora::Model::Common
12
11
  include Cul::Scv::Hydra::ActiveFedora::Model::Resource
@@ -28,8 +27,8 @@ class Resource < ::ActiveFedora::Base
28
27
 
29
28
  def to_solr(solr_doc = Hash.new, opts={})
30
29
  super
31
- unless solr_doc["extent_s"] || self.datastreams["CONTENT"].nil?
32
- solr_doc["extent_s"] = [self.datastreams["CONTENT"].size]
30
+ unless solr_doc["extent_ssi"] || self.datastreams["CONTENT"].nil?
31
+ solr_doc["extent_ssi"] = [self.datastreams["CONTENT"].size]
33
32
  end
34
33
  solr_doc
35
34
  end
@@ -3,7 +3,6 @@ class StaticAudioAggregator < ::ActiveFedora::Base
3
3
  extend ActiveModel::Callbacks
4
4
  include ::ActiveFedora::Finders
5
5
  include ::ActiveFedora::DatastreamCollections
6
- include ::ActiveFedora::Relationships
7
6
  include ::Hydra::ModelMethods
8
7
  include Cul::Scv::Hydra::ActiveFedora::Model::Common
9
8
  include Cul::Scv::Hydra::ActiveFedora::Model::Aggregator
@@ -3,7 +3,6 @@ class StaticImageAggregator < ::ActiveFedora::Base
3
3
  extend ActiveModel::Callbacks
4
4
  include ::ActiveFedora::Finders
5
5
  include ::ActiveFedora::DatastreamCollections
6
- include ::ActiveFedora::Relationships
7
6
  include ::Hydra::ModelMethods
8
7
  include Cul::Scv::Hydra::ActiveFedora::Model::Common
9
8
  include Cul::Scv::Hydra::ActiveFedora::Model::Aggregator
data/config/fedora.yml ADDED
@@ -0,0 +1,19 @@
1
+ development:
2
+ :url: http://127.0.0.1:8983/fedora
3
+ :user: fedoraAdmin
4
+ :password: fedoraAdmin
5
+ # :url: http://sayers.cul.columbia.edu:8080/fedora
6
+ # :user: fedoraAdmin
7
+ # :password: f+BULUS*^
8
+ test:
9
+ :url: http://127.0.0.1:8983/fedora
10
+ :user: fedoraAdmin
11
+ :password: fedoraAdmin
12
+ production:
13
+ :url: http://alcott.cul.columbia.edu:8080/fedora
14
+ :user: fedoraAdmin
15
+ :password: f+BULUS*^
16
+ default:
17
+ :url: http://127.0.0.1:8983/fedora
18
+ :user: fedoraAdmin
19
+ :password: fedoraAdmin
@@ -18,6 +18,8 @@
18
18
  :cul_has_member: hasMember
19
19
  :cul_member_of: memberOf
20
20
  :cul_metadata_for: metadataFor
21
+ http://creativecommons.org/ns#:
22
+ :cc_license: license
21
23
  info:fedora/fedora-system:def/relations-external#:
22
24
  :conforms_to: conformsTo
23
25
  :has_annotation: hasAnnotation
@@ -45,23 +47,23 @@
45
47
  info:fedora/fedora-system:def/model#:
46
48
  :has_model: hasModel
47
49
  http://purl.oclc.org/NET/CUL/RESOURCE/STILLIMAGE/BASIC/:
48
- :cul_image_width: imageWidth
49
- :cul_image_length: imageLength
50
+ :image_width: imageWidth
51
+ :image_length: imageLength
50
52
  http://purl.oclc.org/NET/CUL/RESOURCE/STILLIMAGE/ASSESSMENT/:
51
- :cul_x_resolution: xSamplingFrequency
52
- :cul_y_resolution: ySamplingFrequency
53
- :cul_resolution_unit: samplingFrequencyUnit
53
+ :x_sampling: xSamplingFrequency
54
+ :y_sampling: ySamplingFrequency
55
+ :sampling_unit: samplingFrequencyUnit
54
56
  http://purl.org/dc/terms/:
55
57
  :extent: extent
56
58
  :format: format
57
59
  :format_of: isFormatOf
58
60
  http://www.w3.org/2003/12/exif/ns#:
59
- :image_width: imageWidth
60
- :image_length: imageLength
61
+ :exif_image_width: imageWidth
62
+ :exif_image_length: imageLength
61
63
  :x_resolution: xResolution
62
64
  :y_resolution: yResolution
63
- :resolution_unti: resolutionUnit
65
+ :resolution_unit: resolutionUnit
64
66
  http://xmlns.com/foaf/0.1/:
65
67
  :foaf_thumbnail: thumbnail
66
68
  http://www.w3.org/1999/02/22-rdf-syntax-ns#:
67
- :rdf_type: type
69
+ :rdf_type: type
@@ -20,8 +20,8 @@
20
20
  'NNC-RB' : 'Rare Book and Manuscript Library'
21
21
  'NyNyCBL' : 'Burke Library at Union Theological Seminary'
22
22
  'NyNyCOH' : 'Columbia Center for Oral History Collections'
23
- :project_facet :
24
- 'Customer Order Collection' : 'Pres Orders'
23
+ :project_to_facet :
24
+ 'Customer Order Collection' : 'PRD Orders'
25
25
  "Children's Drawings of the Spanish Civil War (online exhibition)" : 'Spanish Civil War'
26
26
  "Jewels in her crown: treasures of Columbia University Libraries special collections" : 'Jewels in her Crown'
27
27
  "Russian Imperial Corps of Pages" : 'Russian Corps of Pages'
@@ -3,7 +3,7 @@ module Aggregator
3
3
  extend ActiveSupport::Concern
4
4
 
5
5
  included do
6
- has_many :parts, :property => :cul_member_of
6
+ has_many :parts, :property => :cul_member_of, :class_name=>'ActiveFedora::Base'
7
7
  after_create :aggregator!
8
8
  end
9
9
 
@@ -21,7 +21,7 @@ module Aggregator
21
21
  container = "info:fedora/#{container}"
22
22
  end
23
23
  member.add_relationship(:cul_member_of, container)
24
- member.datastreams["RELS-EXT"].dirty = true
24
+ member.datastreams["RELS-EXT"].content_will_change!
25
25
  member.save
26
26
  end
27
27
 
@@ -37,7 +37,7 @@ module Aggregator
37
37
  rel.object = container
38
38
  rel.predicate = :cul_member_of
39
39
  member.remove_relationship(rel)
40
- member.datastreams["RELS-EXT"].dirty = true
40
+ member.datastreams["RELS-EXT"].content_will_change!
41
41
  member.save
42
42
  end
43
43
  end
@@ -1,4 +1,4 @@
1
- require "active-fedora"
1
+ require 'active-fedora'
2
2
  require 'uri'
3
3
  module Cul::Scv::Hydra::ActiveFedora::Model
4
4
  module Common
@@ -7,7 +7,7 @@ module Common
7
7
  included do
8
8
  define_model_callbacks :create
9
9
 
10
- has_and_belongs_to_many :containers, :property=>:cul_member_of
10
+ has_and_belongs_to_many :containers, :property=>:cul_member_of, :class_name=>'ActiveFedora::Base'
11
11
  has_metadata :name => "DC", :type=>Cul::Scv::Hydra::Om::DCMetadata, :versionable => true
12
12
  has_metadata :name => "descMetadata", :type=>Cul::Scv::Hydra::Om::ModsDocument, :versionable => true
13
13
  has_metadata :name => "rightsMetadata", :type=>::Hydra::Datastream::RightsMetadata, :versionable => true
@@ -16,7 +16,7 @@ module Common
16
16
 
17
17
  module ClassMethods
18
18
  def pid_namespace
19
- "ldpd"
19
+ 'ldpd'
20
20
  end
21
21
  end
22
22
 
@@ -59,7 +59,7 @@ module Common
59
59
  # end
60
60
  #end
61
61
  else
62
- logger.warn "parts not defined; was this an Aggregator?"
62
+ logger.warn 'parts not defined; was this an Aggregator?'
63
63
  []
64
64
  end
65
65
  end
@@ -133,31 +133,39 @@ module Common
133
133
  def to_solr(solr_doc = Hash.new, opts={})
134
134
  super
135
135
  if has_desc?
136
- solr_doc["descriptor_s"] = ["mods"]
136
+ solr_doc["descriptor_ssi"] = ["mods"]
137
137
  else
138
- solr_doc["descriptor_s"] = ["dublin core"]
138
+ solr_doc["descriptor_ssi"] = ["dublin core"]
139
139
  end
140
140
  # if no mods, pull some values from DC
141
- if (solr_doc["title_display"].nil? or solr_doc["title_display"].length == 0)
141
+ if (solr_doc["title_ssm"].nil? or solr_doc["title_ssm"].length == 0)
142
142
  if self.dc.term_values(:dc_title).first
143
- solr_doc["title_display"] = [self.dc.term_values(:dc_title).first]
143
+ solr_doc["title_ssm"] = [self.dc.term_values(:dc_title).first]
144
144
  else
145
- solr_doc["title_display"] = [self.dc.term_values(:dc_identifier).first]
145
+ solr_doc["title_ssm"] = [self.dc.term_values(:dc_identifier).first]
146
146
  end
147
147
  if self.dc.term_values(:dc_relation).first
148
148
  self.dc.term_values(:dc_relation).each {|val|
149
149
  if val =~ /clio:/
150
- solr_doc["clio_s"] ||= []
151
- solr_doc["clio_s"] << val.split(':')[-1]
150
+ solr_doc["clio_ssim"] ||= []
151
+ solr_doc["clio_ssim"] << val.split(':')[-1]
152
152
  end
153
153
  }
154
154
  end
155
155
  end
156
- if (solr_doc["title_display"].length > 1)
157
- solr_doc["title_display"].uniq!
156
+ if (solr_doc["title_ssm"].length > 1)
157
+ solr_doc["title_ssm"].uniq!
158
158
  end
159
- solr_doc["format"] = [self.route_as]
160
- solr_doc["index_type_label_s"] = [self.index_type_label]
159
+ solr_doc["format_ssi"] = [self.route_as]
160
+ solr_doc["index_type_label_ssi"] = [self.index_type_label]
161
+
162
+ solr_doc.each_pair {|key, value|
163
+ if value.is_a? Array
164
+ value.each {|v| v.strip! unless v.nil? }
165
+ elsif value.is_a? String
166
+ value.strip!
167
+ end
168
+ }
161
169
  solr_doc
162
170
  end
163
171
 
@@ -63,6 +63,7 @@ module Resource
63
63
  end
64
64
  subject = RDF::URI(internal_uri)
65
65
  predicate = RDF::URI("#{node.namespace.href}#{node.name}")
66
+ puts "Adding a resource predicate : #{predicate}"
66
67
  query = RDF::Query.new({ :subject => {predicate => :object}})
67
68
  relationships(predicate).dup.each { |stmt|
68
69
  relationships.delete(stmt)
@@ -3,54 +3,80 @@ module Cul
3
3
  module Scv
4
4
  module Hydra
5
5
  module Om
6
- class DCMetadata < ::ActiveFedora::NokogiriDatastream
7
- include OM::XML::Document
6
+ class DCMetadata < ::ActiveFedora::OmDatastream
7
+
8
8
  after_save :action_after_save
9
9
  set_terminology do |t|
10
10
  t.root(:path=>"dc", :namespace_prefix=>"oai_dc",
11
11
  "xmlns:oai_dc"=>"http://www.openarchives.org/OAI/2.0/oai_dc/",
12
12
  "xmlns:dc"=>"http://purl.org/dc/elements/1.1/",
13
13
  :schema=>"http://www.openarchives.org/OAI/2.0/oai_dc.xsd")
14
- t.dc_contributor(:path=>"contributor", :namespace_prefix=>"dc", :index_as=>[:displayable, :searchable])
15
- t.dc_coverage(:path=>"coverage", :namespace_prefix=>"dc", :index_as=>[:displayable, :searchable])
16
- t.dc_creator(:path=>"creator", :namespace_prefix=>"dc", :index_as=>[:displayable, :searchable])
17
- t.dc_date(:path=>"date", :namespace_prefix=>"dc", :index_as=>[:displayable, :searchable])
18
- t.dc_description(:path=>"description", :namespace_prefix=>"dc", :index_as=>[:displayable, :searchable])
19
- t.dc_format(:path=>"format", :namespace_prefix=>"dc", :index_as=>[:displayable, :searchable])
20
- t.dc_identifier(:path=>"identifier", :namespace_prefix=>"dc", :index_as=>[:displayable, :searchable])
21
- t.dc_language(:path=>"language", :namespace_prefix=>"dc", :index_as=>[:displayable, :searchable])
22
- t.dc_publisher(:path=>"publisher", :namespace_prefix=>"dc", :index_as=>[:displayable, :searchable])
23
- t.dc_relation(:path=>"relation", :namespace_prefix=>"dc", :index_as=>[:displayable, :searchable])
24
- t.dc_rights(:path=>"rights", :namespace_prefix=>"dc", :index_as=>[:displayable, :searchable])
25
- t.dc_source(:path=>"source", :namespace_prefix=>"dc", :index_as=>[:displayable, :searchable])
26
- t.dc_subject(:path=>"subject", :namespace_prefix=>"dc", :index_as=>[:displayable, :searchable])
27
- t.dc_title(:path=>"title", :namespace_prefix=>"dc", :index_as=>[:displayable, :searchable])
28
- t.dc_type(:path=>"type", :namespace_prefix=>"dc", :index_as=>[:displayable, :searchable])
14
+ t.dc_contributor(:path=>"contributor",
15
+ :namespace_prefix=>"dc",
16
+ :index_as=>[:displayable, :searchable])
17
+ t.dc_coverage(:path=>"coverage",
18
+ :namespace_prefix=>"dc",
19
+ :index_as=>[:displayable, :searchable])
20
+ t.dc_creator(:path=>"creator",
21
+ :namespace_prefix=>"dc",
22
+ :index_as=>[:displayable, :searchable])
23
+ t.dc_date(:path=>"date",
24
+ :namespace_prefix=>"dc",
25
+ :index_as=>[:displayable, :searchable])
26
+ t.dc_description(:path=>"description",
27
+ :namespace_prefix=>"dc",
28
+ :index_as=>[:displayable, :searchable])
29
+ t.dc_format(:path=>"format",
30
+ :namespace_prefix=>"dc",
31
+ :index_as=>[:displayable, :searchable])
32
+ t.dc_identifier(:path=>"identifier",
33
+ :namespace_prefix=>"dc",
34
+ :index_as=>[:displayable, :searchable])
35
+ t.dc_language(:path=>"language",
36
+ :namespace_prefix=>"dc",
37
+ :index_as=>[:displayable, :searchable])
38
+ t.dc_publisher(:path=>"publisher",
39
+ :namespace_prefix=>"dc",
40
+ :index_as=>[:displayable, :searchable])
41
+ t.dc_relation(:path=>"relation",
42
+ :namespace_prefix=>"dc",
43
+ :index_as=>[:displayable, :searchable])
44
+ t.dc_rights(:path=>"rights",
45
+ :namespace_prefix=>"dc",
46
+ :index_as=>[:displayable, :searchable])
47
+ t.dc_source(:path=>"source",
48
+ :namespace_prefix=>"dc",
49
+ :index_as=>[:displayable, :searchable])
50
+ t.dc_subject(:path=>"subject",
51
+ :namespace_prefix=>"dc",
52
+ :index_as=>[:displayable, :searchable])
53
+ t.dc_title(:path=>"title",
54
+ :namespace_prefix=>"dc",
55
+ :index_as=>[:displayable, :searchable])
56
+ t.dc_type(:path=>"type",
57
+ :namespace_prefix=>"dc",
58
+ :index_as=>[:displayable, :searchable])
29
59
  end
30
60
 
31
61
  def self.xml_template
32
- builder = Nokogiri::XML::Builder.new do |xml|
33
- xml.dc(
34
- "xmlns:oai_dc"=>"http://www.openarchives.org/OAI/2.0/oai_dc/",
35
- "xmlns:dc"=>"http://purl.org/dc/elements/1.1/",
36
- "xmlns:xsi"=>"http://www.w3.org/2001/XMLSchema-instance"){
37
- xml.parent.namespace_definitions.each {|ns|
38
- xml.parent.namespace = ns if ns.prefix == 'oai_dc'
39
- }
40
- }
41
- end
42
- builder.doc.encoding = 'UTF-8'
43
- builder.doc.root["xsi:schemaLocation"] = 'http://www.openarchives.org/OAI/2.0/oai_dc/ http://www.openarchives.org/OAI/2.0/oai_dc.xsd'
44
- return builder.doc
62
+
63
+ Nokogiri::XML::Document.parse(<<-src
64
+ <oai_dc:dc
65
+ xmlns:oai_dc='http://www.openarchives.org/OAI/2.0/oai_dc/'
66
+ xmlns:dc='http://purl.org/dc/elements/1.1/'
67
+ xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'
68
+ xsi:schemaLocation='http://www.openarchives.org/OAI/2.0/oai_dc/ http://www.openarchives.org/OAI/2.0/oai_dc.xsd'></oai_dc:dc>
69
+ src
70
+ )
45
71
  end
46
72
  # Because FCRepo 3.5+ modifies DC on saves (to ensure that PID is a dc:identifier value),
47
73
  # this datastream's content must be reloaded after saves
48
74
  def action_after_save
49
- self.dirty= false
50
75
  @content = nil
51
76
  @ng_xml = nil
52
- self.xml_loaded = false
77
+ remove_instance_variable(:@ng_xml)
53
78
  end
79
+
54
80
  def method_missing method, *args
55
81
  query = false
56
82
  _mname = method.id2name
@@ -5,90 +5,102 @@ module Cul
5
5
  module Scv
6
6
  module Hydra
7
7
  module Om
8
- class ModsDocument < ::ActiveFedora::NokogiriDatastream
9
- include OM::XML::Document
8
+ class ModsDocument < ::ActiveFedora::OmDatastream
9
+ include ::OM::XML::TerminologyBasedSolrizer
10
10
  include Cul::Scv::Hydra::Solrizer::TerminologyBasedSolrizer
11
11
 
12
- after_save :action_after_save
13
-
14
12
  set_terminology do |t|
15
13
  t.root(:path=>"mods",
16
14
  :xmlns=>"http://www.loc.gov/mods/v3",
17
- :schema=>"http://www.loc.gov/standards/mods/v3/mods-3-4.xsd")
18
-
19
- t.main_title_info(:path=>'titleInfo', :index_as=>[:not_searchable], :attributes=>{:type=>:none}){
20
- t.main_title(:path=>"title", :index_as=>[:not_searchable])
15
+ :schema=>"http://www.loc.gov/standards/mods/v3/mods-3-4.xsd") {
16
+ }
17
+
18
+ t.main_title_info(:path=>'titleInfo', :index_as=>[], :attributes=>{:type=>:none}){
19
+ t.main_title(:path=>"title", :index_as=>[])
21
20
  }
22
- t.title(:proxy=>[:mods, :main_title_info, :main_title], :index_as=>[:displayable, :searchable, :sortable])
23
21
 
24
- t.search_title_info(:path=>'titleInfo', :index_as=>[:not_searchable]){
22
+ t.title(:proxy=>[:mods, :main_title_info, :main_title],
23
+ :index_as=>[:displayable, :searchable, :sortable, :textable])
24
+
25
+ t.search_title_info(:path=>'titleInfo', :index_as=>[]){
25
26
  t.search_title(:path=>'title', :index_as=>[:searchable])
26
27
  }
27
- t.project(:path=>"relatedItem", :attributes=>{:type=>"host", :displayLabel=>"Project"}, :index_as=>[:not_searchable]){
28
- t.project_title_info(:path=>'titleInfo', :index_as=>[:not_searchable]){
29
- t.lib_project(:path=>'title',:index_as=>[:displayable, :searchable])
30
- t.lib_project_facet(:path=>'title', :index_as=>[:facetable, :not_searchable],:variant_of=>{:field_base=>'lib_project',:map=>:project_facet})
28
+ t.project(:path=>"relatedItem", :attributes=>{:type=>"host", :displayLabel=>"Project"}, :index_as=>[]){
29
+ t.project_title_info(:path=>'titleInfo', :index_as=>[]){
30
+ t.lib_project(:path=>'title',:index_as=>[])
31
31
  }
32
32
  }
33
- t.collection(:path=>"relatedItem", :attributes=>{:type=>"host", :displayLabel=>"Collection"}, :index_as=>[:not_searchable]){
34
- t.collection_title_info(:path=>'titleInfo', :index_as=>[:not_searchable]){
33
+ t.collection(:path=>"relatedItem", :attributes=>{:type=>"host", :displayLabel=>"Collection"}, :index_as=>[]){
34
+ t.collection_title_info(:path=>'titleInfo', :index_as=>[]){
35
35
  t.lib_collection(:path=>'title', :index_as=>[:facetable, :displayable])
36
36
  }
37
37
  }
38
- t.lib_project(:proxy=>[:project,:project_title_info, :lib_project])
38
+ t.lib_project(:proxy=>[:project,:project_title_info, :lib_project],
39
+ :index_as=>[:displayable, :searchable, :project_facetable, :textable])
39
40
  t.lib_collection(:proxy=>[:collection,:collection_title_info, :lib_collection])
40
41
  # pattern matches
41
- t.identifier(:path=>"identifier", :attributes=>{:type=>"local"}, :data_type=>:symbol)
42
- t.identifier_text(:ref=>:identifier, :index_as=>[:not_searchable, :textable])
42
+ t.identifier(:path=>"identifier", :attributes=>{:type=>"local"}, :index_as=>[:symbol, :textable])
43
43
  t.clio(:path=>"identifier", :attributes=>{:type=>"CLIO"}, :data_type=>:symbol, :index_as=>[:searchable, :displayable])
44
44
  t.abstract
45
45
  t.subject {
46
46
  t.topic
47
47
  }
48
- t.type_of_resource(:path=>"typeOfResource", :index_as=>[:not_searchable,:displayable])
49
- t.physical_description(:path=>"physicalDescription", :index_as=>[:not_searchable]){
50
- t.form_marc(:path=>"form", :attributes=>{:authority=>"marcform"}, :index_as=>[:not_searchable,:displayable])
51
- t.form_aat(:path=>"form", :attributes=>{:authority=>"aat"}, :index_as=>[:not_searchable,:displayable])
52
- t.form(:attributes=>{:authority=>:none}, :index_as=>[:not_searchable,:displayable])
53
- t.form_nomarc(:path=>"form[@authority !='marcform']", :index_as=>[:not_searchable, :displayable, :facetable])
48
+ t.type_of_resource(:path=>"typeOfResource", :index_as=>[:displayable])
49
+ t.physical_description(:path=>"physicalDescription", :index_as=>[]){
50
+ t.form_marc(:path=>"form", :attributes=>{:authority=>"marcform"}, :index_as=>[:displayable])
51
+ t.form_aat(:path=>"form", :attributes=>{:authority=>"aat"}, :index_as=>[:displayable])
52
+ t.form(:attributes=>{:authority=>:none}, :index_as=>[:displayable])
53
+ t.form_nomarc(:path=>"form[@authority !='marcform']", :index_as=>[])
54
54
  t.extent(:path=>"extent", :index_as=>[:searchable, :displayable])
55
- t.reformatting_quality(:path=>"reformattingQuality", :index_as=>[:not_searchable,:displayable])
56
- t.internet_media_type(:path=>"internetMediaType", :index_as=>[:not_searchable,:displayable])
57
- t.digital_origin(:path=>"digitalOrigin", :index_as=>[:not_searchable,:displayable])
55
+ t.reformatting_quality(:path=>"reformattingQuality", :index_as=>[:displayable])
56
+ t.internet_media_type(:path=>"internetMediaType", :index_as=>[:displayable])
57
+ t.digital_origin(:path=>"digitalOrigin", :index_as=>[:displayable])
58
58
  }
59
- t.lib_format(:proxy=>[:physical_description, :form_nomarc])
60
- t.location(:path=>"location", :index_as=>[:not_searchable]){
61
- t.repo_text(:path=>"physicalLocation",:attributes=>{:authority=>:none}, :index_as=>[:not_searchable])
62
- t.repo_code(:path=>"physicalLocation",:attributes=>{:authority=>"marcorg"}, :index_as=>[:not_searchable])
63
- t.map_facet(:path=>"physicalLocation",:attributes=>{:authority=>"marcorg"}, :index_as=>[:facetable], :variant_of=>{:field_base=>'lib_repo',:map=>:marc_to_facet})
64
- t.map_display(:path=>"physicalLocation",:attributes=>{:authority=>"marcorg"}, :index_as=>[:displayable, :not_searchable], :variant_of=>{:field_base=>'lib_repo',:map=>:marc_to_display})
65
- t.shelf_locator(:path=>"shelfLocator", :index_as=>[:not_searchable, :textable])
59
+ t.lib_format(:proxy=>[:physical_description, :form_nomarc], :index_as=>[:displayable, :facetable])
60
+ t.location(:path=>"location", :index_as=>[]){
61
+ t.repo_text(:path=>"physicalLocation",:attributes=>{:authority=>:none}, :index_as=>[])
62
+ t.lib_repo(:path=>"physicalLocation",
63
+ :attributes=>{:authority=>"marcorg"},
64
+ :index_as=>[])
65
+ t.shelf_locator(:path=>"shelfLocator", :index_as=>[:textable])
66
66
  }
67
- t.name_personal(:path=>'name',:attributes=>{:type=>'personal'}, :index_as=>[:not_searchable]){
68
- t.name_part(:path=>'namePart', :index_as=>[:facetable, :displayable, :searchable], :variant_of=>{:field_base=>:lib_name})
67
+ t.lib_repo(:proxy=>[:location, :lib_repo],
68
+ :index_as=>[:marc_code_facetable, :marc_code_displayable,
69
+ :marc_code_textable])
70
+ t.lib_name(
71
+ :path=>'name',:attributes=>{:type=>'personal'},
72
+ :index_as=>[:facetable, :displayable, :searchable, :textable]){
73
+ t.name_part(:path=>'namePart', :index_as=>[])
69
74
  }
70
- t.name_corporate(:path=>'name',:attributes=>{:type=>'corporate'}, :index_as=>[:not_searchable]){
71
- t.name_part(:path=>'namePart', :index_as=>[:facetable, :displayable, :searchable], :variant_of=>{:field_base=>:lib_name})
75
+ t.name_corporate(
76
+ :path=>'name',:attributes=>{:type=>'corporate'},
77
+ :index_as=>[:facetable, :displayable, :searchable],
78
+ :variant_of=>{:field_base=>:lib_name}){
79
+ t.name_part(
80
+ :path=>'namePart',
81
+ :index_as=>[])
72
82
  }
73
- t.note(:path=>"note", :index_as=>[:not_searchable, :textable])
74
- t.access_condition(:path=>"accessCondition", :attributes=>{:type=>"useAndReproduction"}, :index_as => [:searchable], :data_type => :symbol)
75
- t.record_info(:path=>"recordInfo", :index_as=>[:not_searchable]) {
76
- t.record_creation_date(:path=>"recordCreationDate",:attributes=>{:encoding=>"w3cdtf"}, :index_as=>[:not_searchable])
77
- t.record_content_source(:path=>"recordContentSource",:attributes=>{:authority=>"marcorg"}, :index_as=>[:not_searchable])
78
- t.language_of_cataloging(:path=>"languageOfCataloging", :index_as=>[:not_searchable]){
79
- t.language_term(:path=>"languageTerm", :index_as=>[:not_searchable], :attributes=>{:type=>:none})
80
- t.language_code(:path=>"languageTerm",:attributes=>{:type=>'code',:authority=>"iso639-2b"}, :index_as=>[:not_searchable])
83
+ t.note(:path=>"note", :index_as=>[:textable])
84
+ t.access_condition(:path=>"accessCondition",
85
+ :attributes=>{:type=>"useAndReproduction"},
86
+ :index_as => [:searchable, :symbol])
87
+ t.record_info(:path=>"recordInfo", :index_as=>[]) {
88
+ t.record_creation_date(:path=>"recordCreationDate",:attributes=>{:encoding=>"w3cdtf"}, :index_as=>[])
89
+ t.record_content_source(:path=>"recordContentSource",:attributes=>{:authority=>"marcorg"}, :index_as=>[])
90
+ t.language_of_cataloging(:path=>"languageOfCataloging", :index_as=>[]){
91
+ t.language_term(:path=>"languageTerm", :index_as=>[], :attributes=>{:type=>:none})
92
+ t.language_code(:path=>"languageTerm",:attributes=>{:type=>'code',:authority=>"iso639-2b"}, :index_as=>[])
81
93
  }
82
- t.record_origin(:path=>"recordOrigin", :index_as=>[:not_searchable])
94
+ t.record_origin(:path=>"recordOrigin", :index_as=>[])
83
95
  }
84
96
  t.language_term(:proxy=>[:record_info, :language_of_cataloging, :language_term])
85
97
  t.language_code(:proxy=>[:record_info, :language_of_cataloging, :language_code])
86
98
 
87
- t.origin_info(:path=>"originInfo", :index_as=>[:not_searchable]){
88
- t.date(:path=>"dateIssued", :attributes=>{:encoding=>'w3cdtf'}, :index_as=>[:not_searchable])
89
- t.key_date(:path=>"dateIssued", :attributes=>{:encoding=>'w3cdtf',:keyDate=>'yes'}, :index_as=>[:not_searchable])
90
- t.start_date(:path=>"dateIssued", :attributes=>{:encoding=>'w3cdtf',:keyDate=>'yes',:point=>'start'}, :index_as=>[:not_searchable])
91
- t.end_date(:path=>"dateIssued", :attributes=>{:encoding=>'w3cdtf',:point=>'end'}, :index_as=>[:not_searchable])
99
+ t.origin_info(:path=>"originInfo", :index_as=>[]){
100
+ t.date(:path=>"dateIssued", :attributes=>{:encoding=>'w3cdtf'}, :index_as=>[])
101
+ t.key_date(:path=>"dateIssued", :attributes=>{:encoding=>'w3cdtf',:keyDate=>'yes'}, :index_as=>[])
102
+ t.start_date(:path=>"dateIssued", :attributes=>{:encoding=>'w3cdtf',:keyDate=>'yes',:point=>'start'}, :index_as=>[])
103
+ t.end_date(:path=>"dateIssued", :attributes=>{:encoding=>'w3cdtf',:point=>'end'}, :index_as=>[])
92
104
  }
93
105
  end
94
106
 
@@ -105,9 +117,7 @@ module Om
105
117
  builder.doc.root["xsi:schemaLocation"] = 'http://www.loc.gov/mods/v3 http://www.loc.gov/standards/mods/v3/mods-3-4.xsd'
106
118
  return builder.doc
107
119
  end
108
- def action_after_save
109
- self.dirty= false
110
- end
120
+
111
121
  def method_missing method, *args
112
122
  query = false
113
123
  _mname = method.id2name
@@ -5,9 +5,7 @@ module Cul
5
5
  module Scv
6
6
  module Hydra
7
7
  module Om
8
- class StandardMods
9
- include OM::XML::Document
10
- include ::Solrizer::XML::TerminologyBasedSolrizer
8
+ class StandardMods < ::ActiveFedora::OmDatastream
11
9
 
12
10
  set_terminology do |t|
13
11
  t.root(:path=>"mods",
@@ -1,30 +1,94 @@
1
1
  require 'solrizer'
2
- module Cul::Scv::Hydra::Solrizer
3
- class FieldMapper < ::Solrizer::FieldMapper::Default
4
- alias_method(:orig_solr_name_and_mappings, :solr_name_and_mappings)
2
+ module Solrizer::DefaultDescriptors
3
+ def self.textable
4
+ @textable_type ||= TextableDescriptor.new(:text, :indexed, :multivalued)
5
+ end
6
+
7
+ def self.project_facetable
8
+ @project_facet_type ||= ProjectFacetDescriptor.new(:string, :indexed, :multivalued)
9
+ end
10
+
11
+ def self.marc_code_facetable
12
+ @marc_code_facet_type ||= MarcCodeFacetDescriptor.new(:string, :indexed, :multivalued)
13
+ end
14
+
15
+ def self.marc_code_displayable
16
+ @marc_code_type ||= MarcCodeDisplayDescriptor.new(:string, :stored, :indexed, :multivalued)
17
+ end
5
18
 
6
- def self.default
7
- if defined?(Rails.root) && !Rails.root.nil?
8
- config_path = File.join(Rails.root, "config", "solr_mappings.yml")
19
+ def self.marc_code_textable
20
+ @marc_code_map_text_type ||= MarcCodeTextableDescriptor.new(:text, :indexed, :multivalued)
21
+ end
22
+
23
+ def self.load_value_maps(config_path=nil)
24
+ if config_path.nil?
25
+ if defined?(Rails.root) && !Rails.root.nil?
26
+ config_path = File.join(Rails.root, "config", "solr_value_maps.yml")
27
+ end
28
+ # Default to using the config file within the gem
29
+ if !File.exist?(config_path.to_s)
30
+ logger.warn("ValueMapper: no field value maps at #{config_path}")
31
+ config_path = File.join(File.dirname(__FILE__), "..", "..", "..", "config", "solr_value_maps.yml")
32
+ end
33
+ if !File.exist?(config_path.to_s)
34
+ logger.warn("ValueMapper: no field value maps at #{File.expand_path(config_path)}")
35
+ return {}
36
+ end
9
37
  end
10
- # Default to using the config file within the gem
11
- if !File.exist?(config_path.to_s)
12
- config_path = File.join(File.dirname(__FILE__), "..", "..", "..", "config", "solr_mappings.yml")
38
+ logger.info("ValueMapper: loading field value maps from #{File.expand_path(config_path)}")
39
+ YAML::load(File.open(config_path))
40
+ end
41
+
42
+ def self.value_maps
43
+ @@value_maps ||= load_value_maps
44
+ end
45
+
46
+
47
+ class TextableDescriptor < Solrizer::Descriptor
48
+ def name_and_converter(field_name, field_type)
49
+ ['all_text_timv']
50
+ end
51
+ end
52
+
53
+ class ProjectFacetDescriptor < Solrizer::Descriptor
54
+ def converter(field_type)
55
+ map = Solrizer::DefaultDescriptors.value_maps[:project_to_facet] || {}
56
+ lambda {|value| (map.has_key? value) ? map[value] : value}
57
+ end
58
+ end
59
+
60
+ class MarcCodeFacetDescriptor < Solrizer::Descriptor
61
+ def converter(field_type)
62
+ map = Solrizer::DefaultDescriptors.value_maps[:marc_to_facet] || {}
63
+ lambda {|value| (map.has_key? value) ? map[value] : value}
64
+ end
65
+ end
66
+
67
+ class MarcCodeDisplayDescriptor < Solrizer::Descriptor
68
+ def converter(field_type)
69
+ map = Solrizer::DefaultDescriptors.value_maps[:marc_to_display] || {}
70
+ lambda {|value| (map.has_key? value) ? map[value] : value}
71
+ end
72
+ end
73
+
74
+ class MarcCodeTextableDescriptor < Solrizer::Descriptor
75
+ def name_and_converter(field_name, field_type)
76
+ ['all_text_timv', converter(field_type)]
77
+ end
78
+ def converter(field_type)
79
+ fmap = Solrizer::DefaultDescriptors.value_maps[:marc_to_facet] || {}
80
+ dmap = Solrizer::DefaultDescriptors.value_maps[:marc_to_display] || {}
81
+ lambda do |value|
82
+ r = (fmap.has_key? value) ? [fmap[value]] : []
83
+ r << dmap[value] if (dmap.has_key? value)
84
+ r.join(' ')
85
+ end
13
86
  end
14
- self.load_mappings(config_path)
15
- logger.info("FieldMapper: loading field name mappings from #{File.expand_path(config_path)}")
16
- self.new
17
- end
18
-
19
- # This is an override of a private method in the base class, and will have to be monitored for changes
20
- def solr_name_and_mappings(field_name, field_type, index_type)
21
- if index_type == :textable
22
- result = orig_solr_name_and_mappings(field_name, field_type, :searchable)
23
- result[0] = 'text'
24
- return result
25
- else
26
- orig_solr_name_and_mappings(field_name, field_type, index_type)
87
+ end
88
+ class MarcCodeDisplayTextableDescriptor < MarcCodeDisplayDescriptor
89
+ def name_and_converter(field_name, field_type)
90
+ puts "MarcCodeDisplayTextableDescriptor"
91
+ ['all_text_timv', converter(field_type)]
27
92
  end
28
93
  end
29
- end
30
- end
94
+ end
@@ -1,108 +1,48 @@
1
1
  require 'om'
2
2
  module Cul::Scv::Hydra::Solrizer::TerminologyBasedSolrizer
3
3
  # copied from Solrizer::XML::TerminologyBasedSolrizer
4
- def self.default_field_mapper
5
- @@default_field_mapper ||= Cul::Scv::Hydra::Solrizer::FieldMapper.default
6
- end
7
4
 
8
- def self.default_value_mapper
9
- @@value_mapper ||= Cul::Scv::Hydra::Solrizer::ValueMapper.new
5
+ def self.included(klass)
6
+ klass.send(:extend, ClassMethods)
10
7
  end
11
-
12
8
 
13
9
  # Module Methods
14
-
15
- # Build a solr document from +doc+ based on its terminology
16
- # @param [OM::XML::Document] doc
17
- # @param [Hash] (optional) solr_doc (values hash) to populate
18
- def self.solrize(doc, solr_doc=Hash.new, field_mapper = nil)
19
- unless doc.class.terminology.nil?
20
- doc.class.terminology.terms.each_pair do |term_name,term|
21
- doc.solrize_term(term, solr_doc, field_mapper)
22
- # self.solrize_by_term(accessor_name, accessor_info, :solr_doc=>solr_doc)
23
- end
24
- end
25
-
26
- return solr_doc
27
- end
28
-
29
- # Populate a solr document with fields based on nodes in +xml+ corresponding to the
30
- # term identified by +term_pointer+ within +terminology+
31
- # @param [OM::XML::Document] doc xml document to extract values from
32
- # @param [OM::XML::Term] term corresponding to desired xml values
33
- # @param [Hash] (optional) solr_doc (values hash) to populate
34
- # @param [Solrizer::FieldMapper] (optional) object that maps a term and its index options to solr field names
35
- def self.solrize_term(doc, term, solr_doc = Hash.new, field_mapper = nil, opts={})
36
- terminology = doc.class.terminology
37
- parents = opts.fetch(:parents, [])
38
-
39
- term_pointer = parents+[term.name]
40
- nodeset = doc.find_by_terms(*term_pointer)
41
- nodeset.each do |node|
42
- # create solr fields
43
10
 
44
- doc.solrize_node(node, term_pointer, term, solr_doc, field_mapper)
45
- unless term.kind_of? OM::XML::NamedTermProxy
46
- term.children.each_pair do |child_term_name, child_term|
47
- doc.solrize_term(child_term, solr_doc, field_mapper, opts={:parents=>parents+[{term.name=>nodeset.index(node)}]})
11
+ module ClassMethods
12
+ # Build a solr document from +doc+ based on its terminology
13
+ # @param [OM::XML::Document] doc
14
+ # @param [Hash] solr_doc (optional) solr_doc (values hash) to populate
15
+ def solrize(doc, solr_doc=Hash.new, field_mapper = nil)
16
+ unless doc.class.terminology.nil?
17
+ doc.class.terminology.terms.each_pair do |term_name,term|
18
+ doc.solrize_term(term, solr_doc, field_mapper) unless term.is_root_term?
48
19
  end
49
20
  end
21
+
22
+ return solr_doc
50
23
  end
51
- solr_doc
52
- end
53
-
54
24
  # Populate a solr document with solr fields corresponding to the given xml node
55
25
  # Field names are generated using settings from the term in the +doc+'s terminology corresponding to +term_pointer+
56
26
  # @param [Nokogiri::XML::Node] node to solrize
57
27
  # @param [OM::XML::Document] doc document the node came from
58
28
  # @param [Array] term_pointer Array pointing to the term that should be used for solrization settings
59
29
  # @param [Hash] (optional) solr_doc (values hash) to populate
60
- def self.solrize_node(node, doc, term_pointer, term, solr_doc = Hash.new, field_mapper = nil, opts = {})
61
- terminology = doc.class.terminology
62
- # term = terminology.retrieve_term(*term_pointer)
63
- if term.path.kind_of?(Hash) && term.path.has_key?(:attribute)
64
- node_value = node.value
65
- else
66
- node_value = node.text
67
- end
68
- generic_field_name_base = OM::XML::Terminology.term_generic_name(*term_pointer)
69
-
70
- self.insert_field_value(solr_doc, term, generic_field_name_base, node_value, field_mapper)
71
-
72
- if term_pointer.length > 1
73
- hierarchical_field_name_base = OM::XML::Terminology.term_hierarchical_name(*term_pointer)
74
- self.insert_field_value(solr_doc, term, hierarchical_field_name_base, node_value, field_mapper)
75
- end
76
- if term.variant_of and term.variant_of[:field_base]
77
- self.insert_field_value(solr_doc, term, term.variant_of[:field_base], node_value, field_mapper, true)
30
+ def solrize_node(node_value, doc, term_pointer, term, solr_doc = Hash.new, field_mapper = nil, opts = {})
31
+ return solr_doc unless term.index_as && !term.index_as.empty?
32
+ generic_field_name_base = OM::XML::Terminology.term_generic_name(*term_pointer)
33
+ create_and_insert_terms(generic_field_name_base, node_value, term.index_as, solr_doc)
34
+
35
+ if term_pointer.length > 1
36
+ #hierarchical_field_name_base = OM::XML::Terminology.term_hierarchical_name(*term_pointer)
37
+ #create_and_insert_terms(hierarchical_field_name_base, node_value, term.index_as, solr_doc)
38
+ end
39
+ if term.variant_of and term.variant_of[:field_base]
40
+ #create_and_insert_terms(term.variant_of[:field_base], node_value, term.index_as, solr_doc)
41
+ create_and_insert_terms(term.variant_of[:field_base], node_value, term.index_as, solr_doc)
42
+ end
43
+ solr_doc
78
44
  end
79
- solr_doc
80
- end
81
45
 
82
- def self.insert_field_value(solr_doc, term, field_base_name, field_value, field_mapper=nil , unique=false)
83
- field_mapper = self.default_field_mapper if field_mapper.nil?
84
- field_mapper.solr_names_and_values(field_base_name, field_value, term.type, term.index_as).each { |field_name, field_value|
85
- unless field_value.join("").strip.empty?
86
- if term.variant_of and term.variant_of[:map]
87
- field_value = default_value_mapper.solr_value(term.variant_of[:map], field_value)
88
- end
89
- Cul::Scv::Hydra::Solrizer::Extractor.insert_solr_field_value(solr_doc, field_name, field_value, (unique || (field_name == 'text')))
90
- end
91
- }
92
- end
93
- # Instance Methods
94
-
95
- attr_accessor :field_mapper
96
-
97
- def to_solr(solr_doc = Hash.new, field_mapper = self.field_mapper) # :nodoc:
98
- ::Solrizer::XML::TerminologyBasedSolrizer.solrize(self, solr_doc, field_mapper)
99
- end
100
-
101
- def solrize_term(term, solr_doc = Hash.new, field_mapper = self.field_mapper, opts={})
102
- Cul::Scv::Hydra::Solrizer::TerminologyBasedSolrizer.solrize_term(self, term, solr_doc, field_mapper, opts)
103
46
  end
104
47
 
105
- def solrize_node(node, term_pointer, term, solr_doc = Hash.new, field_mapper = self.field_mapper, opts={})
106
- Cul::Scv::Hydra::Solrizer::TerminologyBasedSolrizer.solrize_node(node, self, term_pointer, term, solr_doc, field_mapper, opts)
107
- end
108
48
  end # module
@@ -1,7 +1,7 @@
1
1
  module Cul::Scv::Hydra::Solrizer
2
2
  # This class uses a yaml map to translate field values for solr
3
3
  class ValueMapper
4
- def self.load_value_maps(config_path=nil)
4
+ def self.load_value_maps(config_path=nil)
5
5
  if config_path.nil?
6
6
  if defined?(Rails.root) && !Rails.root.nil?
7
7
  config_path = File.join(Rails.root, "config", "solr_value_maps.yml")
@@ -1,7 +1,7 @@
1
1
  module Cul
2
2
  module Scv
3
3
  module Hydra
4
- VERSION = '0.7.0'
4
+ VERSION = '0.8.0'
5
5
  def self.version
6
6
  VERSION
7
7
  end
@@ -47,11 +47,21 @@ def content_for(pid)
47
47
  end
48
48
 
49
49
  def load_content(content, pid)
50
- connection.ingest(:file=>StringIO.new(content), :pid=>pid)
50
+ begin
51
+ connection.ingest(:file=>StringIO.new(content), :pid=>pid)
52
+ rescue Exception => e
53
+ puts "possible problem with ingest of #{pid}: #{e.message}"
54
+ raise e
55
+ end
51
56
  end
52
57
 
53
58
  def purge(pid)
54
- connection.purge_object :pid=>pid
59
+ begin
60
+ connection.purge_object :pid=>pid
61
+ rescue Exception => e
62
+ puts "possible problem with purge of #{pid}: #{e.message}"
63
+ end
64
+
55
65
  end
56
66
 
57
67
  def reload(pid)
@@ -86,6 +96,7 @@ namespace :cul_scv_hydra do
86
96
  task :reload_all => :environment do
87
97
  pattern = ENV["PATTERN"]
88
98
  pattern = Regexp.compile(pattern) if pattern
99
+ reload("ldpd:nullbind")
89
100
  each_cmodel do |pid|
90
101
  unless (pattern and not pid =~ pattern)
91
102
  puts "reloading #{pid}"
metadata CHANGED
@@ -1,71 +1,57 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cul_scv_hydra
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.0
4
+ version: 0.8.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Benjamin Armintor
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-04-29 00:00:00.000000000 Z
11
+ date: 2013-09-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: blacklight
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ~>
17
+ - - ! '>='
18
18
  - !ruby/object:Gem::Version
19
19
  version: 4.0.0
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - ~>
24
+ - - ! '>='
25
25
  - !ruby/object:Gem::Version
26
26
  version: 4.0.0
27
- - !ruby/object:Gem::Dependency
28
- name: rails
29
- requirement: !ruby/object:Gem::Requirement
30
- requirements:
31
- - - ~>
32
- - !ruby/object:Gem::Version
33
- version: 3.2.5
34
- type: :runtime
35
- prerelease: false
36
- version_requirements: !ruby/object:Gem::Requirement
37
- requirements:
38
- - - ~>
39
- - !ruby/object:Gem::Version
40
- version: 3.2.5
41
27
  - !ruby/object:Gem::Dependency
42
28
  name: active-fedora
43
29
  requirement: !ruby/object:Gem::Requirement
44
30
  requirements:
45
31
  - - ~>
46
32
  - !ruby/object:Gem::Version
47
- version: '5.0'
33
+ version: 6.1.1
48
34
  type: :runtime
49
35
  prerelease: false
50
36
  version_requirements: !ruby/object:Gem::Requirement
51
37
  requirements:
52
38
  - - ~>
53
39
  - !ruby/object:Gem::Version
54
- version: '5.0'
40
+ version: 6.1.1
55
41
  - !ruby/object:Gem::Dependency
56
42
  name: hydra-head
57
43
  requirement: !ruby/object:Gem::Requirement
58
44
  requirements:
59
- - - ~>
45
+ - - '='
60
46
  - !ruby/object:Gem::Version
61
- version: '5.2'
47
+ version: 6.2.2
62
48
  type: :runtime
63
49
  prerelease: false
64
50
  version_requirements: !ruby/object:Gem::Requirement
65
51
  requirements:
66
- - - ~>
52
+ - - '='
67
53
  - !ruby/object:Gem::Version
68
- version: '5.2'
54
+ version: 6.2.2
69
55
  - !ruby/object:Gem::Dependency
70
56
  name: active_fedora_finders
71
57
  requirement: !ruby/object:Gem::Requirement
@@ -114,28 +100,28 @@ dependencies:
114
100
  requirements:
115
101
  - - ~>
116
102
  - !ruby/object:Gem::Version
117
- version: '1.8'
103
+ version: 2.1.0
118
104
  type: :runtime
119
105
  prerelease: false
120
106
  version_requirements: !ruby/object:Gem::Requirement
121
107
  requirements:
122
108
  - - ~>
123
109
  - !ruby/object:Gem::Version
124
- version: '1.8'
110
+ version: 2.1.0
125
111
  - !ruby/object:Gem::Dependency
126
112
  name: solrizer
127
113
  requirement: !ruby/object:Gem::Requirement
128
114
  requirements:
129
115
  - - ~>
130
116
  - !ruby/object:Gem::Version
131
- version: 2.0.0
117
+ version: 3.0.0
132
118
  type: :runtime
133
119
  prerelease: false
134
120
  version_requirements: !ruby/object:Gem::Requirement
135
121
  requirements:
136
122
  - - ~>
137
123
  - !ruby/object:Gem::Version
138
- version: 2.0.0
124
+ version: 3.0.0
139
125
  - !ruby/object:Gem::Dependency
140
126
  name: rspec
141
127
  requirement: !ruby/object:Gem::Requirement
@@ -275,6 +261,7 @@ files:
275
261
  - app/models/resource.rb
276
262
  - app/models/static_audio_aggregator.rb
277
263
  - app/models/static_image_aggregator.rb
264
+ - config/fedora.yml
278
265
  - config/predicate_mappings.yml
279
266
  - config/solr_mappings.yml
280
267
  - config/solr_value_maps.yml
@@ -298,7 +285,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
298
285
  version: '0'
299
286
  requirements: []
300
287
  rubyforge_project:
301
- rubygems_version: 2.0.3
288
+ rubygems_version: 2.0.7
302
289
  signing_key:
303
290
  specification_version: 4
304
291
  summary: ActiveFedora, OM, and Solrizer implementations for CUL Staff Collection Viewer