active-fedora 6.7.8 → 6.8.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rspec +1 -0
- data/.rubocop.yml +1 -0
- data/.rubocop_todo.yml +938 -0
- data/.travis.yml +5 -6
- data/Gemfile +3 -1
- data/Rakefile +7 -5
- data/active-fedora.gemspec +7 -8
- data/lib/active_fedora/om_datastream.rb +1 -0
- data/lib/active_fedora/rdf_xml_writer.rb +31 -62
- data/lib/active_fedora/version.rb +1 -1
- data/spec/config_helper.rb +14 -14
- data/spec/integration/associations_spec.rb +232 -232
- data/spec/integration/attributes_spec.rb +11 -12
- data/spec/integration/auditable_spec.rb +10 -10
- data/spec/integration/base_spec.rb +163 -163
- data/spec/integration/bug_spec.rb +7 -7
- data/spec/integration/complex_rdf_datastream_spec.rb +88 -88
- data/spec/integration/datastream_collections_spec.rb +69 -69
- data/spec/integration/datastream_spec.rb +43 -43
- data/spec/integration/datastreams_spec.rb +63 -63
- data/spec/integration/delegating_spec.rb +14 -14
- data/spec/integration/delete_all_spec.rb +38 -42
- data/spec/integration/fedora_solr_sync_spec.rb +5 -5
- data/spec/integration/full_featured_model_spec.rb +101 -101
- data/spec/integration/has_many_associations_spec.rb +24 -24
- data/spec/integration/model_spec.rb +30 -30
- data/spec/integration/nested_attribute_spec.rb +41 -41
- data/spec/integration/ntriples_datastream_spec.rb +107 -107
- data/spec/integration/om_datastream_spec.rb +67 -67
- data/spec/integration/persistence_spec.rb +6 -6
- data/spec/integration/rdf_nested_attributes_spec.rb +56 -56
- data/spec/integration/relation_delegation_spec.rb +24 -26
- data/spec/integration/rels_ext_datastream_spec.rb +20 -20
- data/spec/integration/scoped_query_spec.rb +40 -41
- data/spec/integration/solr_instance_loader_spec.rb +4 -4
- data/spec/integration/solr_service_spec.rb +46 -46
- data/spec/rails3_test_app/config/application.rb +1 -1
- data/spec/rails3_test_app/config/environments/development.rb +0 -1
- data/spec/rails3_test_app/config/environments/production.rb +1 -1
- data/spec/rails3_test_app/spec/spec_helper.rb +3 -3
- data/spec/rails3_test_app/spec/unit/rails_3_init.rb +4 -4
- data/spec/samples/hydra-mods_article_datastream.rb +334 -334
- data/spec/samples/hydra-rights_metadata_datastream.rb +57 -57
- data/spec/samples/marpa-dc_datastream.rb +17 -17
- data/spec/samples/models/audio_record.rb +16 -16
- data/spec/samples/models/image.rb +2 -2
- data/spec/samples/models/mods_article.rb +5 -5
- data/spec/samples/models/oral_history.rb +18 -18
- data/spec/samples/models/seminar.rb +24 -24
- data/spec/samples/models/seminar_audio_file.rb +17 -17
- data/spec/samples/oral_history_sample_model.rb +21 -21
- data/spec/samples/special_thing.rb +14 -14
- data/spec/spec_helper.rb +7 -11
- data/spec/support/an_active_model.rb +2 -2
- data/spec/support/mock_fedora.rb +16 -17
- data/spec/unit/active_fedora_spec.rb +58 -58
- data/spec/unit/association_proxy_spec.rb +5 -7
- data/spec/unit/base_active_model_spec.rb +25 -26
- data/spec/unit/base_cma_spec.rb +5 -5
- data/spec/unit/base_datastream_management_spec.rb +27 -27
- data/spec/unit/base_delegate_spec.rb +80 -82
- data/spec/unit/base_delegate_to_spec.rb +37 -39
- data/spec/unit/base_extra_spec.rb +48 -48
- data/spec/unit/base_spec.rb +300 -300
- data/spec/unit/callback_spec.rb +19 -19
- data/spec/unit/code_configurator_spec.rb +17 -17
- data/spec/unit/config_spec.rb +16 -8
- data/spec/unit/content_model_spec.rb +60 -60
- data/spec/unit/datastream_collections_spec.rb +229 -229
- data/spec/unit/datastream_spec.rb +57 -54
- data/spec/unit/datastreams_spec.rb +77 -77
- data/spec/unit/file_configurator_spec.rb +217 -217
- data/spec/unit/has_and_belongs_to_many_collection_spec.rb +26 -26
- data/spec/unit/has_many_collection_spec.rb +9 -9
- data/spec/unit/inheritance_spec.rb +12 -13
- data/spec/unit/model_spec.rb +41 -51
- data/spec/unit/nom_datastream_spec.rb +15 -15
- data/spec/unit/ntriples_datastream_spec.rb +112 -112
- data/spec/unit/om_datastream_spec.rb +233 -227
- data/spec/unit/persistence_spec.rb +6 -6
- data/spec/unit/predicates_spec.rb +73 -73
- data/spec/unit/property_spec.rb +9 -17
- data/spec/unit/qualified_dublin_core_datastream_spec.rb +33 -33
- data/spec/unit/query_spec.rb +188 -217
- data/spec/unit/rdf_datastream_spec.rb +28 -21
- data/spec/unit/rdf_list_nested_attributes_spec.rb +34 -34
- data/spec/unit/rdf_list_spec.rb +80 -104
- data/spec/unit/rdf_node_spec.rb +7 -7
- data/spec/unit/rdf_xml_writer_spec.rb +10 -10
- data/spec/unit/rdfxml_rdf_datastream_spec.rb +27 -27
- data/spec/unit/relationship_graph_spec.rb +51 -51
- data/spec/unit/rels_ext_datastream_spec.rb +75 -69
- data/spec/unit/rspec_matchers/belong_to_associated_active_fedora_object_matcher_spec.rb +15 -15
- data/spec/unit/rspec_matchers/have_many_associated_active_fedora_objects_matcher_spec.rb +15 -15
- data/spec/unit/rspec_matchers/have_predicate_matcher_spec.rb +15 -15
- data/spec/unit/rspec_matchers/match_fedora_datastream_matcher_spec.rb +12 -12
- data/spec/unit/rubydora_connection_spec.rb +5 -5
- data/spec/unit/semantic_node_spec.rb +59 -59
- data/spec/unit/serializers_spec.rb +4 -4
- data/spec/unit/service_definitions_spec.rb +26 -26
- data/spec/unit/simple_datastream_spec.rb +17 -17
- data/spec/unit/solr_config_options_spec.rb +27 -28
- data/spec/unit/solr_digital_object_spec.rb +21 -21
- data/spec/unit/solr_service_spec.rb +81 -81
- data/spec/unit/unsaved_digital_object_spec.rb +20 -20
- data/spec/unit/validations_spec.rb +21 -21
- metadata +70 -58
- data/gemfiles/gemfile.rails3 +0 -11
- data/gemfiles/gemfile.rails4 +0 -10
@@ -34,7 +34,7 @@ module TestApp
|
|
34
34
|
# config.action_view.javascript_expansions[:defaults] = %w(jquery rails)
|
35
35
|
|
36
36
|
# Configure the default encoding used in templates for Ruby 1.9.
|
37
|
-
config.encoding =
|
37
|
+
config.encoding = 'utf-8'
|
38
38
|
|
39
39
|
# Configure sensitive parameters which will be filtered from the log file.
|
40
40
|
config.filter_parameters += [:password]
|
@@ -10,7 +10,7 @@ TestApp::Application.configure do
|
|
10
10
|
config.action_controller.perform_caching = true
|
11
11
|
|
12
12
|
# Specifies the header that your server uses for sending files
|
13
|
-
config.action_dispatch.x_sendfile_header =
|
13
|
+
config.action_dispatch.x_sendfile_header = 'X-Sendfile'
|
14
14
|
|
15
15
|
# For nginx:
|
16
16
|
# config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect'
|
@@ -1,11 +1,11 @@
|
|
1
1
|
# This file is copied to spec/ when you run 'rails generate rspec:install'
|
2
|
-
ENV[
|
3
|
-
require File.expand_path(
|
2
|
+
ENV['RAILS_ENV'] ||= 'test'
|
3
|
+
require File.expand_path('../../config/environment', __FILE__)
|
4
4
|
require 'rspec/rails'
|
5
5
|
|
6
6
|
# Requires supporting ruby files with custom matchers and macros, etc,
|
7
7
|
# in spec/support/ and its subdirectories.
|
8
|
-
Dir[Rails.root.join(
|
8
|
+
Dir[Rails.root.join('spec/support/**/*.rb')].each {|f| require f}
|
9
9
|
|
10
10
|
RSpec.configure do |config|
|
11
11
|
# == Mock Framework
|
@@ -1,7 +1,7 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
|
-
describe
|
4
|
-
it
|
3
|
+
describe 'initializing active-fedora in a rails 3 app' do
|
4
|
+
it 'should include ActiveFedora::Railtie' do
|
5
5
|
begin
|
6
6
|
ActiveFedora::Railtie
|
7
7
|
railtie_loaded = true
|
@@ -9,7 +9,7 @@ describe "initializing active-fedora in a rails 3 app" do
|
|
9
9
|
railtie_loaded = false
|
10
10
|
end
|
11
11
|
|
12
|
-
railtie_loaded.
|
13
|
-
|
12
|
+
expect(railtie_loaded).to be_truthy
|
13
|
+
|
14
14
|
end
|
15
15
|
end
|
@@ -1,6 +1,6 @@
|
|
1
|
-
require
|
1
|
+
require 'active-fedora'
|
2
2
|
module Hydra
|
3
|
-
|
3
|
+
|
4
4
|
# This is an example of a OmDatastream that defines an OM terminology for MODS xml
|
5
5
|
# It focuses on the aspects of MODS that deal with descriptive metadata for published articles
|
6
6
|
# This is not the hydra-head plugin version of this OM Terminology; See https://github.com/projecthydra/hydra-head/blob/master/lib/hydra/mods_article.rb
|
@@ -11,135 +11,135 @@ module Hydra
|
|
11
11
|
# * Defines a term lang_code that maps to "languageTerm[@type=code]"
|
12
12
|
# * Defines a variety of terms, date, last_name, first_name & terms_of_address, that all map to mods:namePart but use varying attributes to distinguish themselves
|
13
13
|
# * Uses proxy terms to define familar terms like start_page and end_page that map to non-intuitive xml structures "extent[@unit=pages]/start" and "extent[@unit=pages]/end"
|
14
|
-
# * Uses proxy terms, publication_url, peer_reviewed, and title, to allow convenient access to frequently used terms
|
14
|
+
# * Uses proxy terms, publication_url, peer_reviewed, and title, to allow convenient access to frequently used terms
|
15
15
|
#
|
16
16
|
# Things to note about the additional methods it defines:
|
17
|
-
#
|
17
|
+
#
|
18
18
|
# * Defines a series of templates, person_template, organization_template, etc. for generating a whole set of xml nodes to insert into the document (note: the new OM::TemplateRegistry provides an even better way to do this)
|
19
19
|
# * Defines a custom method, insert_contributor, that uses the Terminology to manipulate xml documents in specialized ways
|
20
20
|
# * Defines a series of relator_term Hashes that can then be used when generating views, etc. In this case, the Hashes are hard-coded into the Class. Ideally, they might be read from a configuration file or mixed into the class using a module
|
21
|
-
class ModsArticleDatastream < ActiveFedora::OmDatastream
|
21
|
+
class ModsArticleDatastream < ActiveFedora::OmDatastream
|
22
22
|
|
23
23
|
set_terminology do |t|
|
24
|
-
t.root(:path=>
|
24
|
+
t.root(:path => 'mods', :xmlns => 'http://www.loc.gov/mods/v3', :schema => 'http://www.loc.gov/standards/mods/v3/mods-3-2.xsd')
|
25
25
|
|
26
26
|
|
27
|
-
t.title_info(:path=>
|
28
|
-
t.main_title(:index_as=>[:facetable]
|
29
|
-
t.language(:index_as=>[:facetable]
|
30
|
-
}
|
27
|
+
t.title_info(:path => 'titleInfo') {
|
28
|
+
t.main_title(:index_as => [:facetable], :path => 'title', :label => 'title')
|
29
|
+
t.language(:index_as => [:facetable], :path => {:attribute => 'lang'})
|
30
|
+
}
|
31
31
|
t.language{
|
32
|
-
t.lang_code(:index_as=>[:facetable], :path=>
|
32
|
+
t.lang_code(:index_as => [:facetable], :path => 'languageTerm', :attributes => {:type => 'code'})
|
33
33
|
}
|
34
|
-
t.abstract
|
34
|
+
t.abstract
|
35
35
|
t.subject {
|
36
|
-
t.topic(:index_as=>[:facetable])
|
37
|
-
}
|
38
|
-
t.topic_tag(:proxy=>[:subject, :topic])
|
36
|
+
t.topic(:index_as => [:facetable])
|
37
|
+
}
|
38
|
+
t.topic_tag(:proxy => [:subject, :topic])
|
39
39
|
# t.topic_tag(:index_as=>[:facetable],:path=>"subject", :default_content_path=>"topic")
|
40
40
|
# This is a mods:name. The underscore is purely to avoid namespace conflicts.
|
41
|
-
t.name_(:index_as=>[:searchable]) {
|
41
|
+
t.name_(:index_as => [:searchable]) {
|
42
42
|
# this is a namepart
|
43
|
-
t.namePart(:type
|
43
|
+
t.namePart(:type => :string, :label => 'generic name')
|
44
44
|
# affiliations are great
|
45
45
|
t.affiliation
|
46
|
-
t.institution(:path=>
|
46
|
+
t.institution(:path => 'affiliation', :index_as => [:facetable], :label => 'organization')
|
47
47
|
t.displayForm
|
48
|
-
t.role(:ref=>[:role])
|
49
|
-
t.description(:index_as=>[:facetable])
|
50
|
-
t.date(:path=>
|
51
|
-
t.last_name(:path=>
|
52
|
-
t.first_name(:path=>
|
53
|
-
t.terms_of_address(:path=>
|
48
|
+
t.role(:ref => [:role])
|
49
|
+
t.description(:index_as => [:facetable])
|
50
|
+
t.date(:path => 'namePart', :attributes => {:type => 'date'})
|
51
|
+
t.last_name(:path => 'namePart', :attributes => {:type => 'family'})
|
52
|
+
t.first_name(:path => 'namePart', :attributes => {:type => 'given'}, :label => 'first name')
|
53
|
+
t.terms_of_address(:path => 'namePart', :attributes => {:type => 'termsOfAddress'})
|
54
54
|
t.computing_id
|
55
55
|
}
|
56
|
-
# lookup :person, :first_name
|
57
|
-
t.person(:ref
|
58
|
-
t.department(:proxy=>[:person
|
59
|
-
t.organization(:ref
|
60
|
-
t.conference(:ref
|
61
|
-
t.role(:index_as=>[:stored_searchable]) {
|
62
|
-
t.text(:path=>
|
63
|
-
t.code(:path=>
|
56
|
+
# lookup :person, :first_name
|
57
|
+
t.person(:ref => :name, :attributes => {:type => 'personal'}, :index_as => [:facetable, :stored_searchable])
|
58
|
+
t.department(:proxy => [:person, :description], :index_as => [:facetable])
|
59
|
+
t.organization(:ref => :name, :attributes => {:type => 'corporate'}, :index_as => [:facetable])
|
60
|
+
t.conference(:ref => :name, :attributes => {:type => 'conference'}, :index_as => [:facetable])
|
61
|
+
t.role(:index_as => [:stored_searchable]) {
|
62
|
+
t.text(:path => 'roleTerm', :attributes => {:type => 'text'}, :index_as => [:stored_searchable])
|
63
|
+
t.code(:path => 'roleTerm', :attributes => {:type => 'code'})
|
64
64
|
}
|
65
|
-
t.journal(:path=>'relatedItem', :attributes=>{:type=>
|
66
|
-
t.title_info(:index_as=>[:facetable]
|
67
|
-
t.origin_info(:path=>
|
65
|
+
t.journal(:path => 'relatedItem', :attributes => {:type => 'host'}) {
|
66
|
+
t.title_info(:index_as => [:facetable], :ref => [:title_info])
|
67
|
+
t.origin_info(:path => 'originInfo') {
|
68
68
|
t.publisher
|
69
|
-
t.date_issued(:path=>
|
70
|
-
t.issuance(:index_as=>[:facetable])
|
69
|
+
t.date_issued(:path => 'dateIssued')
|
70
|
+
t.issuance(:index_as => [:facetable])
|
71
71
|
}
|
72
|
-
t.issn(:path=>
|
73
|
-
t.issue(:path=>
|
74
|
-
t.volume(:path=>
|
75
|
-
t.level(:path=>
|
72
|
+
t.issn(:path => 'identifier', :attributes => {:type => 'issn'})
|
73
|
+
t.issue(:path => 'part') {
|
74
|
+
t.volume(:path => 'detail', :attributes => {:type => 'volume'}, :default_content_path => 'number')
|
75
|
+
t.level(:path => 'detail', :attributes => {:type => 'number'}, :default_content_path => 'number')
|
76
76
|
t.extent
|
77
|
-
t.pages(:path=>
|
77
|
+
t.pages(:path => 'extent', :attributes => {:unit => 'pages'}) {
|
78
78
|
t.start
|
79
79
|
t.end
|
80
80
|
}
|
81
|
-
t.start_page(:proxy=>[:pages, :start])
|
82
|
-
t.end_page(:proxy=>[:pages, :end])
|
83
|
-
t.publication_date(:path=>
|
81
|
+
t.start_page(:proxy => [:pages, :start])
|
82
|
+
t.end_page(:proxy => [:pages, :end])
|
83
|
+
t.publication_date(:path => 'date', :type => :date, :index_as => [:stored_searchable])
|
84
84
|
}
|
85
85
|
}
|
86
86
|
t.note
|
87
|
-
t.location(:path=>
|
88
|
-
t.url(:path=>
|
87
|
+
t.location(:path => 'location') {
|
88
|
+
t.url(:path => 'url')
|
89
89
|
}
|
90
|
-
t.publication_url(:proxy=>[:location
|
91
|
-
t.peer_reviewed(:proxy=>[:journal
|
92
|
-
t.title(:proxy=>[:title_info, :main_title])
|
93
|
-
t.journal_title(:proxy=>[:journal, :title_info, :main_title])
|
90
|
+
t.publication_url(:proxy => [:location, :url])
|
91
|
+
t.peer_reviewed(:proxy => [:journal, :origin_info, :issuance], :index_as => [:facetable])
|
92
|
+
t.title(:proxy => [:title_info, :main_title])
|
93
|
+
t.journal_title(:proxy => [:journal, :title_info, :main_title])
|
94
94
|
end
|
95
|
-
|
95
|
+
|
96
96
|
# Generates an empty Mods Article (used when you call ModsArticle.new without passing in existing xml)
|
97
97
|
def self.xml_template
|
98
98
|
builder = Nokogiri::XML::Builder.new do |xml|
|
99
|
-
xml.mods(:version=>
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
xml.titleInfo(:lang=>
|
99
|
+
xml.mods(:version => '3.3', 'xmlns:xlink' => 'http://www.w3.org/1999/xlink',
|
100
|
+
'xmlns:xsi' => 'http://www.w3.org/2001/XMLSchema-instance',
|
101
|
+
'xmlns' => 'http://www.loc.gov/mods/v3',
|
102
|
+
'xsi:schemaLocation' => 'http://www.loc.gov/mods/v3 http://www.loc.gov/standards/mods/v3/mods-3-3.xsd') {
|
103
|
+
xml.titleInfo(:lang => '') {
|
104
104
|
xml.title
|
105
105
|
}
|
106
|
-
xml.name(:type=>
|
107
|
-
xml.namePart(:type=>
|
108
|
-
xml.namePart(:type=>
|
106
|
+
xml.name(:type => 'personal') {
|
107
|
+
xml.namePart(:type => 'given')
|
108
|
+
xml.namePart(:type => 'family')
|
109
109
|
xml.affiliation
|
110
110
|
xml.computing_id
|
111
111
|
xml.description
|
112
112
|
xml.role {
|
113
|
-
xml.roleTerm(
|
113
|
+
xml.roleTerm('Author', :authority => 'marcrelator', :type => 'text')
|
114
114
|
}
|
115
115
|
}
|
116
116
|
xml.typeOfResource
|
117
|
-
xml.genre(:authority=>
|
117
|
+
xml.genre(:authority => 'marcgt')
|
118
118
|
xml.language {
|
119
|
-
xml.languageTerm(:authority=>
|
119
|
+
xml.languageTerm(:authority => 'iso639-2b', :type => 'code')
|
120
120
|
}
|
121
121
|
xml.abstract
|
122
122
|
xml.subject {
|
123
123
|
xml.topic
|
124
124
|
}
|
125
|
-
xml.relatedItem(:type=>
|
125
|
+
xml.relatedItem(:type => 'host') {
|
126
126
|
xml.titleInfo {
|
127
127
|
xml.title
|
128
128
|
}
|
129
|
-
xml.identifier(:type=>
|
129
|
+
xml.identifier(:type => 'issn')
|
130
130
|
xml.originInfo {
|
131
131
|
xml.publisher
|
132
132
|
xml.dateIssued
|
133
133
|
xml.issuance
|
134
134
|
}
|
135
135
|
xml.part {
|
136
|
-
xml.detail(:type=>
|
136
|
+
xml.detail(:type => 'volume') {
|
137
137
|
xml.number
|
138
138
|
}
|
139
|
-
xml.detail(:type=>
|
139
|
+
xml.detail(:type => 'number') {
|
140
140
|
xml.number
|
141
141
|
}
|
142
|
-
xml.extent(:unit=>
|
142
|
+
xml.extent(:unit => 'pages') {
|
143
143
|
xml.start
|
144
144
|
xml.end
|
145
145
|
}
|
@@ -153,18 +153,18 @@ module Hydra
|
|
153
153
|
end
|
154
154
|
return builder.doc
|
155
155
|
end
|
156
|
-
|
156
|
+
|
157
157
|
# Generates a new Person node
|
158
158
|
def self.person_template
|
159
159
|
builder = Nokogiri::XML::Builder.new do |xml|
|
160
|
-
xml.name(:type=>
|
161
|
-
xml.namePart(:type=>
|
162
|
-
xml.namePart(:type=>
|
160
|
+
xml.name(:type => 'personal') {
|
161
|
+
xml.namePart(:type => 'family')
|
162
|
+
xml.namePart(:type => 'given')
|
163
163
|
xml.affiliation
|
164
164
|
xml.computing_id
|
165
165
|
xml.description
|
166
166
|
xml.role {
|
167
|
-
xml.roleTerm(
|
167
|
+
xml.roleTerm('Author', :type => 'text')
|
168
168
|
}
|
169
169
|
}
|
170
170
|
end
|
@@ -173,7 +173,7 @@ module Hydra
|
|
173
173
|
|
174
174
|
def self.full_name_template
|
175
175
|
builder = Nokogiri::XML::Builder.new do |xml|
|
176
|
-
xml.full_name(:type =>
|
176
|
+
xml.full_name(:type => 'personal')
|
177
177
|
end
|
178
178
|
return builder.doc.root
|
179
179
|
end
|
@@ -182,33 +182,33 @@ module Hydra
|
|
182
182
|
# Uses mods:name[@type="corporate"]
|
183
183
|
def self.organization_template
|
184
184
|
builder = Nokogiri::XML::Builder.new do |xml|
|
185
|
-
xml.name(:type=>
|
185
|
+
xml.name(:type => 'corporate') {
|
186
186
|
xml.namePart
|
187
187
|
xml.role {
|
188
|
-
xml.roleTerm(:authority=>
|
189
|
-
}
|
188
|
+
xml.roleTerm(:authority => 'marcrelator', :type => 'text')
|
189
|
+
}
|
190
190
|
}
|
191
191
|
end
|
192
192
|
return builder.doc.root
|
193
193
|
end
|
194
|
-
|
194
|
+
|
195
195
|
# Generates a new Conference node
|
196
196
|
def self.conference_template
|
197
197
|
builder = Nokogiri::XML::Builder.new do |xml|
|
198
|
-
xml.name(:type=>
|
198
|
+
xml.name(:type => 'conference') {
|
199
199
|
xml.namePart
|
200
200
|
xml.role {
|
201
|
-
xml.roleTerm(:authority=>
|
202
|
-
}
|
201
|
+
xml.roleTerm(:authority => 'marcrelator', :type => 'text')
|
202
|
+
}
|
203
203
|
}
|
204
204
|
end
|
205
205
|
return builder.doc.root
|
206
206
|
end
|
207
|
-
|
207
|
+
|
208
208
|
# Inserts a new contributor (mods:name) into the mods document
|
209
209
|
# creates contributors of type :person, :organization, or :conference
|
210
|
-
def insert_contributor(type, opts={})
|
211
|
-
case type.to_sym
|
210
|
+
def insert_contributor(type, opts = {})
|
211
|
+
case type.to_sym
|
212
212
|
when :person
|
213
213
|
node = Hydra::ModsArticleDatastream.person_template
|
214
214
|
nodeset = self.find_by_terms(:person)
|
@@ -223,7 +223,7 @@ module Hydra
|
|
223
223
|
node = nil
|
224
224
|
index = nil
|
225
225
|
end
|
226
|
-
|
226
|
+
|
227
227
|
unless nodeset.nil?
|
228
228
|
if nodeset.empty?
|
229
229
|
self.ng_xml.root.add_child(node)
|
@@ -234,282 +234,282 @@ module Hydra
|
|
234
234
|
end
|
235
235
|
self.dirty = true
|
236
236
|
end
|
237
|
-
|
237
|
+
|
238
238
|
return node, index
|
239
239
|
end
|
240
|
-
|
240
|
+
|
241
241
|
# Remove the contributor entry identified by @contributor_type and @index
|
242
242
|
def remove_contributor(contributor_type, index)
|
243
243
|
self.find_by_terms( {contributor_type.to_sym => index.to_i} ).first.remove
|
244
244
|
self.dirty = true
|
245
245
|
end
|
246
|
-
|
246
|
+
|
247
247
|
def self.common_relator_terms
|
248
|
-
{
|
249
|
-
|
250
|
-
|
251
|
-
|
252
|
-
|
253
|
-
|
254
|
-
|
255
|
-
|
256
|
-
|
248
|
+
{'aut' => 'Author',
|
249
|
+
'clb' => 'Collaborator',
|
250
|
+
'com' => 'Compiler',
|
251
|
+
'ctb' => 'Contributor',
|
252
|
+
'cre' => 'Creator',
|
253
|
+
'edt' => 'Editor',
|
254
|
+
'ill' => 'Illustrator',
|
255
|
+
'oth' => 'Other',
|
256
|
+
'trl' => 'Translator'
|
257
257
|
}
|
258
258
|
end
|
259
|
-
|
259
|
+
|
260
260
|
def self.person_relator_terms
|
261
|
-
{
|
262
|
-
|
263
|
-
|
264
|
-
|
265
|
-
|
266
|
-
|
267
|
-
|
268
|
-
|
269
|
-
|
270
|
-
|
271
|
-
|
261
|
+
{'aut' => 'Author',
|
262
|
+
'clb' => 'Collaborator',
|
263
|
+
'com' => 'Compiler',
|
264
|
+
'cre' => 'Creator',
|
265
|
+
'ctb' => 'Contributor',
|
266
|
+
'edt' => 'Editor',
|
267
|
+
'ill' => 'Illustrator',
|
268
|
+
'res' => 'Researcher',
|
269
|
+
'rth' => 'Research team head',
|
270
|
+
'rtm' => 'Research team member',
|
271
|
+
'trl' => 'Translator'
|
272
272
|
}
|
273
273
|
end
|
274
|
-
|
274
|
+
|
275
275
|
def self.conference_relator_terms
|
276
276
|
{
|
277
|
-
|
277
|
+
'hst' => 'Host'
|
278
278
|
}
|
279
279
|
end
|
280
|
-
|
280
|
+
|
281
281
|
def self.organization_relator_terms
|
282
282
|
{
|
283
|
-
|
284
|
-
|
283
|
+
'fnd' => 'Funder',
|
284
|
+
'hst' => 'Host'
|
285
285
|
}
|
286
286
|
end
|
287
|
-
|
287
|
+
|
288
288
|
def self.dc_relator_terms
|
289
|
-
{
|
290
|
-
|
291
|
-
|
292
|
-
|
293
|
-
|
294
|
-
|
295
|
-
|
296
|
-
|
297
|
-
|
298
|
-
|
299
|
-
|
300
|
-
|
301
|
-
|
302
|
-
|
303
|
-
|
304
|
-
|
305
|
-
|
306
|
-
|
307
|
-
|
308
|
-
|
309
|
-
|
310
|
-
|
311
|
-
|
312
|
-
|
313
|
-
|
314
|
-
|
315
|
-
|
316
|
-
|
317
|
-
|
318
|
-
|
319
|
-
|
320
|
-
|
321
|
-
|
322
|
-
|
323
|
-
|
324
|
-
|
325
|
-
|
326
|
-
|
327
|
-
|
328
|
-
|
329
|
-
|
330
|
-
|
331
|
-
|
332
|
-
|
333
|
-
|
334
|
-
|
335
|
-
|
336
|
-
|
337
|
-
|
338
|
-
|
339
|
-
|
340
|
-
|
341
|
-
|
342
|
-
|
343
|
-
|
344
|
-
|
345
|
-
|
346
|
-
|
347
|
-
|
348
|
-
|
349
|
-
|
350
|
-
|
351
|
-
|
352
|
-
|
353
|
-
|
354
|
-
|
355
|
-
|
356
|
-
|
357
|
-
|
358
|
-
|
359
|
-
|
360
|
-
|
361
|
-
|
362
|
-
|
363
|
-
|
364
|
-
|
365
|
-
|
366
|
-
|
367
|
-
|
368
|
-
|
369
|
-
|
370
|
-
|
371
|
-
|
372
|
-
|
373
|
-
|
374
|
-
|
375
|
-
|
376
|
-
|
377
|
-
|
378
|
-
|
379
|
-
|
380
|
-
|
381
|
-
|
382
|
-
|
383
|
-
|
384
|
-
|
385
|
-
|
386
|
-
|
387
|
-
|
388
|
-
|
389
|
-
|
390
|
-
|
391
|
-
|
392
|
-
|
393
|
-
|
394
|
-
|
395
|
-
|
396
|
-
|
397
|
-
|
398
|
-
|
399
|
-
|
400
|
-
|
401
|
-
|
402
|
-
|
403
|
-
|
404
|
-
|
405
|
-
|
406
|
-
|
407
|
-
|
408
|
-
|
409
|
-
|
410
|
-
|
411
|
-
|
412
|
-
|
413
|
-
|
414
|
-
|
415
|
-
|
416
|
-
|
417
|
-
|
418
|
-
|
419
|
-
|
420
|
-
|
421
|
-
|
422
|
-
|
423
|
-
|
424
|
-
|
425
|
-
|
426
|
-
|
427
|
-
|
428
|
-
|
429
|
-
|
430
|
-
|
431
|
-
|
432
|
-
|
433
|
-
|
434
|
-
|
435
|
-
|
436
|
-
|
437
|
-
|
438
|
-
|
439
|
-
|
440
|
-
|
441
|
-
|
442
|
-
|
443
|
-
|
444
|
-
|
445
|
-
|
446
|
-
|
447
|
-
|
448
|
-
|
449
|
-
|
450
|
-
|
451
|
-
|
452
|
-
|
453
|
-
|
454
|
-
|
455
|
-
|
456
|
-
|
457
|
-
|
458
|
-
|
459
|
-
|
460
|
-
|
461
|
-
|
462
|
-
|
463
|
-
|
464
|
-
|
465
|
-
|
466
|
-
|
467
|
-
|
468
|
-
|
469
|
-
|
470
|
-
|
471
|
-
|
472
|
-
|
473
|
-
|
474
|
-
|
475
|
-
|
476
|
-
|
477
|
-
|
478
|
-
|
479
|
-
|
480
|
-
|
481
|
-
|
482
|
-
|
483
|
-
|
484
|
-
|
485
|
-
|
486
|
-
|
487
|
-
|
488
|
-
|
489
|
-
|
490
|
-
|
491
|
-
|
492
|
-
|
493
|
-
|
494
|
-
|
495
|
-
|
496
|
-
|
497
|
-
|
498
|
-
|
499
|
-
|
500
|
-
|
501
|
-
|
289
|
+
{'acp' => 'Art copyist',
|
290
|
+
'act' => 'Actor',
|
291
|
+
'adp' => 'Adapter',
|
292
|
+
'aft' => 'Author of afterword, colophon, etc.',
|
293
|
+
'anl' => 'Analyst',
|
294
|
+
'anm' => 'Animator',
|
295
|
+
'ann' => 'Annotator',
|
296
|
+
'ant' => 'Bibliographic antecedent',
|
297
|
+
'app' => 'Applicant',
|
298
|
+
'aqt' => 'Author in quotations or text abstracts',
|
299
|
+
'arc' => 'Architect',
|
300
|
+
'ard' => 'Artistic director ',
|
301
|
+
'arr' => 'Arranger',
|
302
|
+
'art' => 'Artist',
|
303
|
+
'asg' => 'Assignee',
|
304
|
+
'asn' => 'Associated name',
|
305
|
+
'att' => 'Attributed name',
|
306
|
+
'auc' => 'Auctioneer',
|
307
|
+
'aud' => 'Author of dialog',
|
308
|
+
'aui' => 'Author of introduction',
|
309
|
+
'aus' => 'Author of screenplay',
|
310
|
+
'aut' => 'Author',
|
311
|
+
'bdd' => 'Binding designer',
|
312
|
+
'bjd' => 'Bookjacket designer',
|
313
|
+
'bkd' => 'Book designer',
|
314
|
+
'bkp' => 'Book producer',
|
315
|
+
'bnd' => 'Binder',
|
316
|
+
'bpd' => 'Bookplate designer',
|
317
|
+
'bsl' => 'Bookseller',
|
318
|
+
'ccp' => 'Conceptor',
|
319
|
+
'chr' => 'Choreographer',
|
320
|
+
'clb' => 'Collaborator',
|
321
|
+
'cli' => 'Client',
|
322
|
+
'cll' => 'Calligrapher',
|
323
|
+
'clt' => 'Collotyper',
|
324
|
+
'cmm' => 'Commentator',
|
325
|
+
'cmp' => 'Composer',
|
326
|
+
'cmt' => 'Compositor',
|
327
|
+
'cng' => 'Cinematographer',
|
328
|
+
'cnd' => 'Conductor',
|
329
|
+
'cns' => 'Censor',
|
330
|
+
'coe' => 'Contestant -appellee',
|
331
|
+
'col' => 'Collector',
|
332
|
+
'com' => 'Compiler',
|
333
|
+
'cos' => 'Contestant',
|
334
|
+
'cot' => 'Contestant -appellant',
|
335
|
+
'cov' => 'Cover designer',
|
336
|
+
'cpc' => 'Copyright claimant',
|
337
|
+
'cpe' => 'Complainant-appellee',
|
338
|
+
'cph' => 'Copyright holder',
|
339
|
+
'cpl' => 'Complainant',
|
340
|
+
'cpt' => 'Complainant-appellant',
|
341
|
+
'cre' => 'Creator',
|
342
|
+
'crp' => 'Correspondent',
|
343
|
+
'crr' => 'Corrector',
|
344
|
+
'csl' => 'Consultant',
|
345
|
+
'csp' => 'Consultant to a project',
|
346
|
+
'cst' => 'Costume designer',
|
347
|
+
'ctb' => 'Contributor',
|
348
|
+
'cte' => 'Contestee-appellee',
|
349
|
+
'ctg' => 'Cartographer',
|
350
|
+
'ctr' => 'Contractor',
|
351
|
+
'cts' => 'Contestee',
|
352
|
+
'ctt' => 'Contestee-appellant',
|
353
|
+
'cur' => 'Curator',
|
354
|
+
'cwt' => 'Commentator for written text',
|
355
|
+
'dfd' => 'Defendant',
|
356
|
+
'dfe' => 'Defendant-appellee',
|
357
|
+
'dft' => 'Defendant-appellant',
|
358
|
+
'dgg' => 'Degree grantor',
|
359
|
+
'dis' => 'Dissertant',
|
360
|
+
'dln' => 'Delineator',
|
361
|
+
'dnc' => 'Dancer',
|
362
|
+
'dnr' => 'Donor',
|
363
|
+
'dpc' => 'Depicted',
|
364
|
+
'dpt' => 'Depositor',
|
365
|
+
'drm' => 'Draftsman',
|
366
|
+
'drt' => 'Director',
|
367
|
+
'dsr' => 'Designer',
|
368
|
+
'dst' => 'Distributor',
|
369
|
+
'dtc' => 'Data contributor ',
|
370
|
+
'dte' => 'Dedicatee',
|
371
|
+
'dtm' => 'Data manager ',
|
372
|
+
'dto' => 'Dedicator',
|
373
|
+
'dub' => 'Dubious author',
|
374
|
+
'edt' => 'Editor',
|
375
|
+
'egr' => 'Engraver',
|
376
|
+
'elg' => 'Electrician ',
|
377
|
+
'elt' => 'Electrotyper',
|
378
|
+
'eng' => 'Engineer',
|
379
|
+
'etr' => 'Etcher',
|
380
|
+
'exp' => 'Expert',
|
381
|
+
'fac' => 'Facsimilist',
|
382
|
+
'fld' => 'Field director ',
|
383
|
+
'flm' => 'Film editor',
|
384
|
+
'fmo' => 'Former owner',
|
385
|
+
'fpy' => 'First party',
|
386
|
+
'fnd' => 'Funder',
|
387
|
+
'frg' => 'Forger',
|
388
|
+
'gis' => 'Geographic information specialist ',
|
389
|
+
'grt' => 'Graphic technician',
|
390
|
+
'hnr' => 'Honoree',
|
391
|
+
'hst' => 'Host',
|
392
|
+
'ill' => 'Illustrator',
|
393
|
+
'ilu' => 'Illuminator',
|
394
|
+
'ins' => 'Inscriber',
|
395
|
+
'inv' => 'Inventor',
|
396
|
+
'itr' => 'Instrumentalist',
|
397
|
+
'ive' => 'Interviewee',
|
398
|
+
'ivr' => 'Interviewer',
|
399
|
+
'lbr' => 'Laboratory ',
|
400
|
+
'lbt' => 'Librettist',
|
401
|
+
'ldr' => 'Laboratory director ',
|
402
|
+
'led' => 'Lead',
|
403
|
+
'lee' => 'Libelee-appellee',
|
404
|
+
'lel' => 'Libelee',
|
405
|
+
'len' => 'Lender',
|
406
|
+
'let' => 'Libelee-appellant',
|
407
|
+
'lgd' => 'Lighting designer',
|
408
|
+
'lie' => 'Libelant-appellee',
|
409
|
+
'lil' => 'Libelant',
|
410
|
+
'lit' => 'Libelant-appellant',
|
411
|
+
'lsa' => 'Landscape architect',
|
412
|
+
'lse' => 'Licensee',
|
413
|
+
'lso' => 'Licensor',
|
414
|
+
'ltg' => 'Lithographer',
|
415
|
+
'lyr' => 'Lyricist',
|
416
|
+
'mcp' => 'Music copyist',
|
417
|
+
'mfr' => 'Manufacturer',
|
418
|
+
'mdc' => 'Metadata contact',
|
419
|
+
'mod' => 'Moderator',
|
420
|
+
'mon' => 'Monitor',
|
421
|
+
'mrk' => 'Markup editor',
|
422
|
+
'msd' => 'Musical director',
|
423
|
+
'mte' => 'Metal-engraver',
|
424
|
+
'mus' => 'Musician',
|
425
|
+
'nrt' => 'Narrator',
|
426
|
+
'opn' => 'Opponent',
|
427
|
+
'org' => 'Originator',
|
428
|
+
'orm' => 'Organizer of meeting',
|
429
|
+
'oth' => 'Other',
|
430
|
+
'own' => 'Owner',
|
431
|
+
'pat' => 'Patron',
|
432
|
+
'pbd' => 'Publishing director',
|
433
|
+
'pbl' => 'Publisher',
|
434
|
+
'pdr' => 'Project director',
|
435
|
+
'pfr' => 'Proofreader',
|
436
|
+
'pht' => 'Photographer',
|
437
|
+
'plt' => 'Platemaker',
|
438
|
+
'pma' => 'Permitting agency',
|
439
|
+
'pmn' => 'Production manager',
|
440
|
+
'pop' => 'Printer of plates',
|
441
|
+
'ppm' => 'Papermaker',
|
442
|
+
'ppt' => 'Puppeteer',
|
443
|
+
'prc' => 'Process contact',
|
444
|
+
'prd' => 'Production personnel',
|
445
|
+
'prf' => 'Performer',
|
446
|
+
'prg' => 'Programmer',
|
447
|
+
'prm' => 'Printmaker',
|
448
|
+
'pro' => 'Producer',
|
449
|
+
'prt' => 'Printer',
|
450
|
+
'pta' => 'Patent applicant',
|
451
|
+
'pte' => 'Plaintiff -appellee',
|
452
|
+
'ptf' => 'Plaintiff',
|
453
|
+
'pth' => 'Patent holder',
|
454
|
+
'ptt' => 'Plaintiff-appellant',
|
455
|
+
'rbr' => 'Rubricator',
|
456
|
+
'rce' => 'Recording engineer',
|
457
|
+
'rcp' => 'Recipient',
|
458
|
+
'red' => 'Redactor',
|
459
|
+
'ren' => 'Renderer',
|
460
|
+
'res' => 'Researcher',
|
461
|
+
'rev' => 'Reviewer',
|
462
|
+
'rps' => 'Repository',
|
463
|
+
'rpt' => 'Reporter',
|
464
|
+
'rpy' => 'Responsible party',
|
465
|
+
'rse' => 'Respondent-appellee',
|
466
|
+
'rsg' => 'Restager',
|
467
|
+
'rsp' => 'Respondent',
|
468
|
+
'rst' => 'Respondent-appellant',
|
469
|
+
'rth' => 'Research team head',
|
470
|
+
'rtm' => 'Research team member',
|
471
|
+
'sad' => 'Scientific advisor',
|
472
|
+
'sce' => 'Scenarist',
|
473
|
+
'scl' => 'Sculptor',
|
474
|
+
'scr' => 'Scribe',
|
475
|
+
'sds' => 'Sound designer',
|
476
|
+
'sec' => 'Secretary',
|
477
|
+
'sgn' => 'Signer',
|
478
|
+
'sht' => 'Supporting host',
|
479
|
+
'sng' => 'Singer',
|
480
|
+
'spk' => 'Speaker',
|
481
|
+
'spn' => 'Sponsor',
|
482
|
+
'spy' => 'Second party',
|
483
|
+
'srv' => 'Surveyor',
|
484
|
+
'std' => 'Set designer',
|
485
|
+
'stl' => 'Storyteller',
|
486
|
+
'stm' => 'Stage manager',
|
487
|
+
'stn' => 'Standards body',
|
488
|
+
'str' => 'Stereotyper',
|
489
|
+
'tcd' => 'Technical director',
|
490
|
+
'tch' => 'Teacher',
|
491
|
+
'ths' => 'Thesis advisor',
|
492
|
+
'trc' => 'Transcriber',
|
493
|
+
'trl' => 'Translator',
|
494
|
+
'tyd' => 'Type designer',
|
495
|
+
'tyg' => 'Typographer',
|
496
|
+
'vdg' => 'Videographer',
|
497
|
+
'voc' => 'Vocalist',
|
498
|
+
'wam' => 'Writer of accompanying material',
|
499
|
+
'wdc' => 'Woodcutter',
|
500
|
+
'wde' => 'Wood -engraver',
|
501
|
+
'wit' => 'Witness'}
|
502
502
|
end
|
503
|
-
|
503
|
+
|
504
504
|
def self.valid_child_types
|
505
|
-
[
|
505
|
+
['data', 'supporting file', 'profile', 'lorem ipsum', 'dolor']
|
506
506
|
end
|
507
507
|
|
508
|
-
def to_solr(solr_doc=
|
508
|
+
def to_solr(solr_doc = {})
|
509
509
|
super(solr_doc)
|
510
|
-
|
511
|
-
::Solrizer::Extractor.insert_solr_field_value(solr_doc, Solrizer.default_field_mapper.solr_name('object_type', :facetable),
|
512
|
-
::Solrizer::Extractor.insert_solr_field_value(solr_doc, Solrizer.default_field_mapper.solr_name('mods_journal_title_info', :facetable),
|
510
|
+
|
511
|
+
::Solrizer::Extractor.insert_solr_field_value(solr_doc, Solrizer.default_field_mapper.solr_name('object_type', :facetable), 'Article')
|
512
|
+
::Solrizer::Extractor.insert_solr_field_value(solr_doc, Solrizer.default_field_mapper.solr_name('mods_journal_title_info', :facetable), 'Unknown') if solr_doc['mods_journal_title_info_facet'].nil?
|
513
513
|
|
514
514
|
solr_doc
|
515
515
|
end
|