hydra-pbcore 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
data/hydra-pbcore.gemspec CHANGED
@@ -1,5 +1,6 @@
1
1
  # -*- encoding: utf-8 -*-
2
- #require File.expand_path('../lib/hydra-pbcore', __FILE__)
2
+ $:.push File.expand_path("../lib", __FILE__)
3
+ require 'hydra-pbcore/version'
3
4
 
4
5
  Gem::Specification.new do |gem|
5
6
  gem.authors = ["Adam Wead"]
@@ -13,13 +14,13 @@ Gem::Specification.new do |gem|
13
14
  gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
14
15
  gem.name = "hydra-pbcore"
15
16
  gem.require_paths = ["lib"]
16
- gem.version = "0.0.2"
17
+ gem.version = HydraPbcore::VERSION
17
18
 
18
19
  # Dependencies
19
20
  gem.add_dependency('nokogiri')
20
21
  gem.add_dependency('om')
21
22
  gem.add_dependency('active-fedora')
22
- gem.add_dependency('solrizer')
23
+ gem.add_dependency('solrizer', '~> 2.0.0.rc3' )
23
24
  gem.add_development_dependency('yard')
24
25
  gem.add_development_dependency('redcarpet')
25
26
  # For Development
@@ -0,0 +1,40 @@
1
+ class Solrizer::FieldMapper::Default
2
+
3
+ id_field 'id'
4
+ index_as :searchable, :default => true do |t|
5
+ t.default :suffix => '_t'
6
+ t.date :suffix => '_dt' do |value|
7
+ DateTime.parse(pbcore_date(value)).to_time.utc.iso8601
8
+ end
9
+ t.string :suffix => '_t'
10
+ t.text :suffix => '_t'
11
+ t.symbol :suffix => '_s'
12
+ t.integer :suffix => '_i'
13
+ t.long :suffix => '_l'
14
+ t.boolean :suffix => '_b'
15
+ t.float :suffix => '_f'
16
+ t.double :suffix => '_d'
17
+ end
18
+ index_as :displayable, :suffix => '_display'
19
+ index_as :facetable, :suffix => '_facet'
20
+ index_as :sortable, :suffix => '_sort'
21
+ index_as :unstemmed_searchable, :suffix => '_unstem_search'
22
+
23
+ # We assume that all dates are in ISO 8601 format, but sometimes users may only
24
+ # specify a year or a year and month. This method adds a -01-01 or -01 respectively
25
+ # defaulting to Jan. 1st for dates that are only a year, and the first day of the
26
+ # month for dates that are only a year and a month.
27
+ # NOTE: This only applies to the date as it is stored in solr. The original value
28
+ # as entered by the user is still maintained in the xml.
29
+ def self.pbcore_date(date, value = String.new)
30
+ if date.match(/^[0-9]{4,4}$/)
31
+ value = date + "-01-01"
32
+ elsif date.match(/^[0-9]{4,4}-[0-9]{2,2}$/)
33
+ value = date + "-01"
34
+ else
35
+ value = date
36
+ end
37
+ return value
38
+ end
39
+
40
+ end
data/lib/hydra-pbcore.rb CHANGED
@@ -5,7 +5,6 @@ require "om"
5
5
  require "active-fedora"
6
6
 
7
7
  module HydraPbcore
8
- VERSION = "0.0.2"
9
8
  def self.version
10
9
  HydraPbcore::VERSION
11
10
  end
@@ -13,6 +12,8 @@ end
13
12
 
14
13
  require "hydra-pbcore/methods"
15
14
  require "hydra-pbcore/behaviors"
15
+ require "hydra-pbcore/templates"
16
+ require "custom_mapper"
16
17
  require "hydra-pbcore/datastream/document"
17
18
  require "hydra-pbcore/datastream/instantiation"
18
19
  require "hydra-pbcore/datastream/digital_document"
@@ -2,126 +2,9 @@ module HydraPbcore::Datastream
2
2
  class DigitalDocument < ActiveFedora::NokogiriDatastream
3
3
 
4
4
  include HydraPbcore::Methods
5
+ include HydraPbcore::Templates
5
6
 
6
- set_terminology do |t|
7
- t.root(:path=>"pbcoreDescriptionDocument", :xmlns => '', :namespace_prefix=>nil)
8
-
9
- #
10
- # pbcoreDescription fields
11
- #
12
- t.pbc_id(:path=>"pbcoreIdentifier", :namespace_prefix=>nil, :namespace_prefix=>nil, :attributes=>{ :source=>"Rock and Roll Hall of Fame and Museum", :annotation=>"PID" })
13
-
14
- t.main_title(:path=>"pbcoreTitle", :namespace_prefix=>nil, :namespace_prefix=>nil, :attributes=>{ :titleType=>"Main" })
15
- t.alternative_title(:path=>"pbcoreTitle", :namespace_prefix=>nil, :namespace_prefix=>nil, :attributes=>{ :titleType=>"Alternative" })
16
- t.chapter(:path=>"pbcoreTitle", :namespace_prefix=>nil, :namespace_prefix=>nil, :attributes=>{ :titleType=>"Chapter" })
17
- t.episode(:path=>"pbcoreTitle", :namespace_prefix=>nil, :attributes=>{ :titleType=>"Episode" })
18
- t.label(:path=>"pbcoreTitle", :namespace_prefix=>nil, :attributes=>{ :titleType=>"Label" })
19
- t.segment(:path=>"pbcoreTitle", :namespace_prefix=>nil, :attributes=>{ :titleType=>"Segment" })
20
- t.subtitle(:path=>"pbcoreTitle", :namespace_prefix=>nil, :attributes=>{ :titleType=>"Subtitle" })
21
- t.track(:path=>"pbcoreTitle", :namespace_prefix=>nil, :attributes=>{ :titleType=>"Track" })
22
- t.translation(:path=>"pbcoreTitle", :namespace_prefix=>nil, :attributes=>{ :titleType=>"Translation" })
23
-
24
- # This is only to display all subjects
25
- t.subjects(:path=>"pbcoreSubject", :namespace_prefix=>nil)
26
-
27
- # Individual subject types defined for entry
28
- t.lc_subject(:path=>"pbcoreSubject", :namespace_prefix=>nil, :attributes=>{ :source=>"Library of Congress Subject Headings", :ref=>"http://id.loc.gov/authorities/subjects.html" })
29
- t.lc_name(:path=>"pbcoreSubject", :namespace_prefix=>nil, :attributes=>{ :source=>"Library of Congress Name Authority File", :ref=>"http://id.loc.gov/authorities/names" })
30
- t.rh_subject(:path=>"pbcoreSubject", :namespace_prefix=>nil, :attributes=>{ :source=>"Rock and Roll Hall of Fame and Museum" })
31
-
32
- t.summary(:path=>"pbcoreDescription", :namespace_prefix=>nil, :attributes=>{ :descriptionType=>"Description",
33
- :descriptionTypeSource=>"pbcoreDescription/descriptionType",
34
- :descriptionTypeRef=>"http://pbcore.org/vocabularies/pbcoreDescription/descriptionType#description",
35
- :annotation=>"Summary"}
36
- )
37
-
38
- t.parts_list(:path=>"pbcoreDescription", :namespace_prefix=>nil, :attributes=>{ :descriptionType=>"Table of Contents",
39
- :descriptionTypeSource=>"pbcoreDescription/descriptionType",
40
- :descriptionTypeRef=>"http://pbcore.org/vocabularies/pbcoreDescription/descriptionType#table-of-contents",
41
- :annotation=>"Parts List" }
42
- )
43
-
44
- # This is only to display all genres
45
- t.genres(:path=>"pbcoreGenre", :namespace_prefix=>nil)
46
-
47
- # Individual genre types defined for entry
48
- t.getty_genre(:path=>"pbcoreGenre", :namespace_prefix=>nil, :attributes=>{ :source=>"The Getty Research Institute Art and Architecture Thesaurus", :ref=>"http://www.getty.edu/research/tools/vocabularies/aat/index.html" })
49
- t.lc_genre(:path=>"pbcoreGenre", :namespace_prefix=>nil, :attributes=>{ :source=>"Library of Congress Genre/Form Terms", :ref=>"http://id.loc.gov/authorities/genreForms.html" })
50
- t.lc_subject_genre(:path=>"pbcoreGenre", :namespace_prefix=>nil, :attributes=>{ :source=>"Library of Congress Subject Headings", :ref=>"http://id.loc.gov/authorities/subjects.html" })
51
-
52
-
53
- # Pbcore relation fields
54
- t.pbcoreRelation(:namespace_prefix=>nil) {
55
- t.series(:path=>"pbcoreRelationIdentifier", :namespace_prefix=>nil, :attributes=>{ :annotation=>"Event Series" })
56
- t.arch_coll(:path=>"pbcoreRelationIdentifier", :namespace_prefix=>nil, :attributes=>{ :annotation=>"Archival Collection" })
57
- t.arch_ser(:path=>"pbcoreRelationIdentifier", :namespace_prefix=>nil, :attributes=>{ :annotation=>"Archival Series" })
58
- t.coll_num(:path=>"pbcoreRelationIdentifier", :namespace_prefix=>nil, :attributes=>{ :annotation=>"Collection Number" })
59
- t.acc_num(:path=>"pbcoreRelationIdentifier", :namespace_prefix=>nil, :attributes=>{ :annotation=>"Accession Number" })
60
- }
61
- t.event_series(:ref=>[:pbcoreRelation, :series])
62
- t.archival_collection(:ref=>[:pbcoreRelation, :arch_coll])
63
- t.archival_series(:ref=>[:pbcoreRelation, :arch_ser])
64
- t.collection_number(:ref=>[:pbcoreRelation, :coll_num])
65
- t.accession_number(:ref=>[:pbcoreRelation, :acc_num])
66
-
67
- # Terms for time and place
68
- t.pbcore_coverage(:path=>"pbcoreCoverage", :namespace_prefix=>nil) {
69
- t.coverage(:path=>"coverage", :namespace_prefix=>nil)
70
- }
71
- t.spatial(:ref => :pbcore_coverage,
72
- :path=>'pbcoreCoverage[coverageType="Spatial"]',
73
- :namespace_prefix=>nil
74
- )
75
- t.temporal(:ref => :pbcore_coverage,
76
- :path=>'pbcoreDescriptionDocument/pbcoreCoverage[coverageType="Temporal"]',
77
- :namespace_prefix=>nil
78
- )
79
- t.event_place(:proxy=>[:spatial, :coverage])
80
- t.event_date(:proxy=>[:temporal, :coverage])
81
-
82
- # Contributor names and roles
83
- t.contributor(:path=>"pbcoreContributor", :namespace_prefix=>nil) {
84
- t.name_(:path=>"contributor", :namespace_prefix=>nil)
85
- t.role_(:path=>"contributorRole", :namespace_prefix=>nil, :attributes=>{ :source=>"MARC relator terms" })
86
- }
87
- t.contributor_name(:proxy=>[:contributor, :name])
88
- t.contributor_role(:proxy=>[:contributor, :role])
89
-
90
- # Publisher names and roles
91
- t.publisher(:path=>"pbcorePublisher", :namespace_prefix=>nil) {
92
- t.name_(:path=>"publisher", :namespace_prefix=>nil)
93
- t.role_(:path=>"publisherRole", :namespace_prefix=>nil, :attributes=>{ :source=>"PBCore publisherRole" })
94
- }
95
- t.publisher_name(:proxy=>[:publisher, :name])
96
- t.publisher_role(:proxy=>[:publisher, :role])
97
-
98
- t.usage(:path=>"pbcoreRightsSummary", :namespace_prefix=>nil)
99
-
100
- t.note(:path=>"pbcoreAnnotation", :namespace_prefix=>nil, :atttributes=>{ :annotationType=>"Notes" })
101
-
102
- #
103
- # pbcorePart fields
104
- #
105
- t.pbcorePart(:namespace_prefix=>nil) {
106
- t.pbcoreTitle(:namespace_prefix=>nil, :attributes=>{ :titleType=>"song", :annotation=>"part title" })
107
- t.pbcoreIdentifier(:namespace_prefix=>nil, :attributes=>{ :source=>"rock hall", :annotation=>"part number" })
108
- t.pbcoreDescription(:namespace_prefix=>nil, :attributes=>{ :descriptionType=>"Description",
109
- :descriptionTypesource=>"pbcoreDescription/descriptionType",
110
- :ref=>"http://pbcore.org/vocabularies/pbcoreDescription/descriptionType#description" }
111
- )
112
- t.pbcoreContributor(:namespace_prefix=>nil) {
113
- t.contributor(:namespace_prefix=>nil, :attributes=>{ :annotation=>"part contributor" })
114
- t.contributorRole(:namespace_prefix=>nil, :attributes=>{ :source=>"MARC relator terms" })
115
- }
116
- }
117
- t.part_title(:ref=>[:pbcorePart, :pbcoreTitle])
118
- t.part_number(:ref=>[:pbcorePart, :pbcoreIdentifier])
119
- t.part_description(:ref=>[:pbcorePart, :pbcoreDescription])
120
- t.part_contributor(:ref=>[:pbcorePart, :pbcoreContributor, :contributor])
121
- t.part_role(:ref=>[:pbcorePart, :pbcoreContributor, :contributorRole])
122
-
123
- end
124
-
7
+ @terminology = HydraPbcore::Datastream::Document.terminology
125
8
 
126
9
  def self.xml_template
127
10
  builder = Nokogiri::XML::Builder.new do |xml|
@@ -191,7 +74,6 @@ class DigitalDocument < ActiveFedora::NokogiriDatastream
191
74
  end
192
75
  return builder.doc
193
76
  end
194
-
195
77
 
196
78
  end
197
79
  end
@@ -1,161 +1,212 @@
1
1
  module HydraPbcore::Datastream
2
2
  class Document < ActiveFedora::NokogiriDatastream
3
3
 
4
- include HydraPbcore::Methods
4
+ include HydraPbcore::Methods
5
+ include HydraPbcore::Templates
5
6
 
6
7
  set_terminology do |t|
7
- t.root(:path=>"pbcoreDescriptionDocument", :xmlns => '', :namespace_prefix=>nil)
8
+ t.root(:path=>"pbcoreDescriptionDocument")
8
9
 
9
10
  #
10
11
  # pbcoreDescription fields
11
12
  #
12
- t.pbc_id(:path=>"pbcoreIdentifier", :namespace_prefix=>nil, :namespace_prefix=>nil, :attributes=>{ :source=>"Rock and Roll Hall of Fame and Museum", :annotation=>"PID" })
13
+ t.pbc_id(:path=>"pbcoreIdentifier",
14
+ :attributes=>{ :source=>"Rock and Roll Hall of Fame and Museum", :annotation=>"PID" }
15
+ )
13
16
 
14
- t.main_title(:path=>"pbcoreTitle", :namespace_prefix=>nil, :namespace_prefix=>nil, :attributes=>{ :titleType=>"Main" })
15
- t.alternative_title(:path=>"pbcoreTitle", :namespace_prefix=>nil, :namespace_prefix=>nil, :attributes=>{ :titleType=>"Alternative" })
16
- t.chapter(:path=>"pbcoreTitle", :namespace_prefix=>nil, :namespace_prefix=>nil, :attributes=>{ :titleType=>"Chapter" })
17
- t.episode(:path=>"pbcoreTitle", :namespace_prefix=>nil, :attributes=>{ :titleType=>"Episode" })
18
- t.label(:path=>"pbcoreTitle", :namespace_prefix=>nil, :attributes=>{ :titleType=>"Label" })
19
- t.segment(:path=>"pbcoreTitle", :namespace_prefix=>nil, :attributes=>{ :titleType=>"Segment" })
20
- t.subtitle(:path=>"pbcoreTitle", :namespace_prefix=>nil, :attributes=>{ :titleType=>"Subtitle" })
21
- t.track(:path=>"pbcoreTitle", :namespace_prefix=>nil, :attributes=>{ :titleType=>"Track" })
22
- t.translation(:path=>"pbcoreTitle", :namespace_prefix=>nil, :attributes=>{ :titleType=>"Translation" })
17
+ t.main_title(:path=>"pbcoreTitle", :attributes=>{ :titleType=>"Main" }, :index_as => [:searchable, :displayable])
18
+ t.alternative_title(:path=>"pbcoreTitle", :attributes=>{ :titleType=>"Alternative" },
19
+ :index_as => [:searchable, :displayable]
20
+ )
21
+ t.chapter(:path=>"pbcoreTitle", :attributes=>{ :titleType=>"Chapter" }, :index_as => [:searchable, :displayable])
22
+ t.episode(:path=>"pbcoreTitle", :attributes=>{ :titleType=>"Episode" }, :index_as => [:searchable, :displayable])
23
+ t.label(:path=>"pbcoreTitle", :attributes=>{ :titleType=>"Label" }, :index_as => [:searchable, :displayable])
24
+ t.segment(:path=>"pbcoreTitle", :attributes=>{ :titleType=>"Segment" }, :index_as => [:searchable, :displayable])
25
+ t.subtitle(:path=>"pbcoreTitle", :attributes=>{ :titleType=>"Subtitle" }, :index_as => [:searchable, :displayable])
26
+ t.track(:path=>"pbcoreTitle", :attributes=>{ :titleType=>"Track" }, :index_as => [:searchable, :displayable])
27
+ t.translation(:path=>"pbcoreTitle", :attributes=>{ :titleType=>"Translation" },
28
+ :index_as => [:searchable, :displayable]
29
+ )
23
30
 
24
31
  # This is only to display all subjects
25
- t.subjects(:path=>"pbcoreSubject", :namespace_prefix=>nil)
32
+ t.subject_topic(:path=>"pbcoreSubject", :index_as => [:searchable, :facetable])
26
33
 
27
34
  # Individual subject types defined for entry
28
- t.lc_subject(:path=>"pbcoreSubject", :namespace_prefix=>nil, :attributes=>{ :source=>"Library of Congress Subject Headings", :ref=>"http://id.loc.gov/authorities/subjects.html" })
29
- t.lc_name(:path=>"pbcoreSubject", :namespace_prefix=>nil, :attributes=>{ :source=>"Library of Congress Name Authority File", :ref=>"http://id.loc.gov/authorities/names" })
30
- t.rh_subject(:path=>"pbcoreSubject", :namespace_prefix=>nil, :attributes=>{ :source=>"Rock and Roll Hall of Fame and Museum" })
35
+ t.lc_subject(:path=>"pbcoreSubject",
36
+ :attributes=>{
37
+ :source=>"Library of Congress Subject Headings",
38
+ :ref=>"http://id.loc.gov/authorities/subjects.html"
39
+ },
40
+ :index_as => [:displayable]
41
+ )
42
+ t.lc_name(:path=>"pbcoreSubject",
43
+ :attributes=>{ :source=>"Library of Congress Name Authority File", :ref=>"http://id.loc.gov/authorities/names" },
44
+ :index_as => [:displayable]
45
+ )
46
+ t.rh_subject(:path=>"pbcoreSubject",
47
+ :attributes=>{ :source=>"Rock and Roll Hall of Fame and Museum" },
48
+ :index_as => [:displayable]
49
+ )
31
50
 
32
- t.summary(:path=>"pbcoreDescription", :namespace_prefix=>nil, :attributes=>{ :descriptionType=>"Description",
33
- :descriptionTypeSource=>"pbcoreDescription/descriptionType",
34
- :descriptionTypeRef=>"http://pbcore.org/vocabularies/pbcoreDescription/descriptionType#description",
35
- :annotation=>"Summary"}
51
+ t.summary(:path=>"pbcoreDescription",
52
+ :attributes=>{
53
+ :descriptionType=>"Description",
54
+ :descriptionTypeSource=>"pbcoreDescription/descriptionType",
55
+ :descriptionTypeRef=>"http://pbcore.org/vocabularies/pbcoreDescription/descriptionType#description",
56
+ :annotation=>"Summary"
57
+ },
58
+ :index_as => [:searchable, :displayable]
36
59
  )
37
60
 
38
- t.parts_list(:path=>"pbcoreDescription", :namespace_prefix=>nil, :attributes=>{ :descriptionType=>"Table of Contents",
39
- :descriptionTypeSource=>"pbcoreDescription/descriptionType",
40
- :descriptionTypeRef=>"http://pbcore.org/vocabularies/pbcoreDescription/descriptionType#table-of-contents",
41
- :annotation=>"Parts List" }
61
+ t.parts_list(:path=>"pbcoreDescription",
62
+ :attributes=>{
63
+ :descriptionType=>"Table of Contents",
64
+ :descriptionTypeSource=>"pbcoreDescription/descriptionType",
65
+ :descriptionTypeRef=>"http://pbcore.org/vocabularies/pbcoreDescription/descriptionType#table-of-contents",
66
+ :annotation=>"Parts List"
67
+ },
68
+ :index_as => [:searchable, :displayable]
42
69
  )
43
70
 
44
71
  # This is only to display all genres
45
- t.genres(:path=>"pbcoreGenre", :namespace_prefix=>nil)
72
+ t.genres(:path=>"pbcoreGenre", :index_as => [:searchable, :facetable])
46
73
 
47
74
  # Individual genre types defined for entry
48
- t.getty_genre(:path=>"pbcoreGenre", :namespace_prefix=>nil, :attributes=>{ :source=>"The Getty Research Institute Art and Architecture Thesaurus", :ref=>"http://www.getty.edu/research/tools/vocabularies/aat/index.html" })
49
- t.lc_genre(:path=>"pbcoreGenre", :namespace_prefix=>nil, :attributes=>{ :source=>"Library of Congress Genre/Form Terms", :ref=>"http://id.loc.gov/authorities/genreForms.html" })
50
- t.lc_subject_genre(:path=>"pbcoreGenre", :namespace_prefix=>nil, :attributes=>{ :source=>"Library of Congress Subject Headings", :ref=>"http://id.loc.gov/authorities/subjects.html" })
75
+ t.getty_genre(:path=>"pbcoreGenre",
76
+ :attributes=>{
77
+ :source=>"The Getty Research Institute Art and Architecture Thesaurus",
78
+ :ref=>"http://www.getty.edu/research/tools/vocabularies/aat/index.html"
79
+ },
80
+ :index_as => [:displayable]
81
+ )
82
+ t.lc_genre(:path=>"pbcoreGenre",
83
+ :attributes=>{
84
+ :source=>"Library of Congress Genre/Form Terms",
85
+ :ref=>"http://id.loc.gov/authorities/genreForms.html"
86
+ },
87
+ :index_as => [:displayable]
88
+ )
89
+ t.lc_subject_genre(:path=>"pbcoreGenre",
90
+ :attributes=>{
91
+ :source=>"Library of Congress Subject Headings",
92
+ :ref=>"http://id.loc.gov/authorities/subjects.html"
93
+ },
94
+ :index_as => [:displayable]
95
+ )
51
96
 
52
97
 
53
98
  # Series field
54
- t.pbcoreRelation(:namespace_prefix=>nil) {
55
- t.pbcoreRelationIdentifier(:namespace_prefix=>nil, :attributes=>{ :annotation=>"Event Series" })
56
- }
57
- t.event_series(:ref=>[:pbcoreRelation, :pbcoreRelationIdentifier])
99
+ t.pbcoreRelation do
100
+ t.pbcoreRelationIdentifier(:attributes=>{ :annotation=>"Event Series" })
101
+ end
102
+ t.event_series(:ref=>[:pbcoreRelation, :pbcoreRelationIdentifier], :index_as => [:searchable, :displayable])
58
103
 
59
104
  # Terms for time and place
60
- t.pbcore_coverage(:path=>"pbcoreCoverage", :namespace_prefix=>nil) {
61
- t.coverage(:path=>"coverage", :namespace_prefix=>nil)
62
- }
63
- t.spatial(:ref => :pbcore_coverage,
64
- :path=>'pbcoreCoverage[coverageType="Spatial"]',
65
- :namespace_prefix=>nil
105
+ t.event_place(:path=>"pbcoreCoverage/coverage",
106
+ :attributes => {:annotation=>"Event Place"},
107
+ :index_as => [:searchable, :displayable]
66
108
  )
67
- t.temporal(:ref => :pbcore_coverage,
68
- :path=>'pbcoreDescriptionDocument/pbcoreCoverage[coverageType="Temporal"]',
69
- :namespace_prefix=>nil
109
+ t.event_date(:path=>"pbcoreCoverage/coverage",
110
+ :attributes => {:annotation=>"Event Date"},
111
+ :type => :date,
112
+ :index_as => [:searchable]
70
113
  )
71
- t.event_place(:proxy=>[:spatial, :coverage])
72
- t.event_date(:proxy=>[:temporal, :coverage])
73
114
 
74
115
  # Contributor names and roles
75
- t.contributor(:path=>"pbcoreContributor", :namespace_prefix=>nil) {
76
- t.name_(:path=>"contributor", :namespace_prefix=>nil)
77
- t.role_(:path=>"contributorRole", :namespace_prefix=>nil, :attributes=>{ :source=>"MARC relator terms" })
78
- }
116
+ t.contributor(:path=>"pbcoreContributor") do
117
+ t.name_(:path=>"contributor", :index_as => [:searchable, :facetable])
118
+ t.role_(:path=>"contributorRole",
119
+ :attributes=>{ :source=>"MARC relator terms" },
120
+ :index_as => [:searchable, :displayable]
121
+ )
122
+ end
79
123
  t.contributor_name(:proxy=>[:contributor, :name])
80
124
  t.contributor_role(:proxy=>[:contributor, :role])
81
125
 
82
126
  # Publisher names and roles
83
- t.publisher(:path=>"pbcorePublisher", :namespace_prefix=>nil) {
84
- t.name_(:path=>"publisher", :namespace_prefix=>nil)
85
- t.role_(:path=>"publisherRole", :namespace_prefix=>nil, :attributes=>{ :source=>"PBCore publisherRole" })
86
- }
87
- t.publisher_name(:proxy=>[:publisher, :name])
88
- t.publisher_role(:proxy=>[:publisher, :role])
127
+ t.publisher(:path=>"pbcorePublisher") do
128
+ t.name_(:path=>"publisher")
129
+ t.role_(:path=>"publisherRole", :attributes=>{ :source=>"PBCore publisherRole" })
130
+ end
131
+ t.publisher_name(:proxy=>[:publisher, :name], :index_as => [:searchable, :facetable])
132
+ t.publisher_role(:proxy=>[:publisher, :role], :index_as => [:searchable, :displayable])
89
133
 
90
- t.note(:path=>"pbcoreAnnotation", :namespace_prefix=>nil, :atttributes=>{ :annotationType=>"Notes" })
134
+ t.note(:path=>"pbcoreAnnotation", :atttributes=>{ :annotationType=>"Notes" }, :index_as => [:searchable])
91
135
 
92
136
  #
93
137
  # pbcoreInstantiation fields for the physical item
94
138
  #
95
- t.pbcoreInstantiation(:namespace_prefix=>nil) {
96
- t.instantiationIdentifier(:namespace_prefix=>nil, :attributes=>{ :annotation=>"Barcode", :source=>"Rock and Roll Hall of Fame and Museum" })
97
- t.instantiationDate(:namespace_prefix=>nil, :attributes=>{ :dateType=>"created" })
98
- t.instantiationPhysical(:namespace_prefix=>nil, :attributes=>{ :source=>"PBCore instantiationPhysical" })
99
- t.instantiationStandard(:namespace_prefix=>nil)
100
- t.instantiationLocation(:namespace_prefix=>nil)
101
- t.instantiationMediaType(:namespace_prefix=>nil, :attributes=>{ :source=>"PBCore instantiationMediaType" })
102
- t.instantiationGenerations(:namespace_prefix=>nil, :attributes=>{ :source=>"PBCore instantiationGenerations" })
103
- t.instantiationColors(:namespace_prefix=>nil)
104
- t.instantiationLanguage(:namespace_prefix=>nil, :attributes=>{ :source=>"ISO 639.2", :ref=>"http://www.loc.gov/standards/iso639-2/php/code_list.php" })
105
- t.instantiationRelation(:namespace_prefix=>nil) {
106
- t.arc_collection(:path=>"instantiationRelationIdentifier", :namespace_prefix=>nil, :attributes=>{ :annotation=>"Archival collection" })
107
- t.arc_series(:path=>"instantiationRelationIdentifier", :namespace_prefix=>nil, :attributes=>{ :annotation=>"Archival Series" })
108
- t.col_number(:path=>"instantiationRelationIdentifier", :namespace_prefix=>nil, :attributes=>{ :annotation=>"Collection Number" })
109
- t.acc_number(:path=>"instantiationRelationIdentifier", :namespace_prefix=>nil, :attributes=>{ :annotation=>"Accession Number" })
110
- }
111
- t.instantiationRights(:namespace_prefix=>nil) {
112
- t.rightsSummary(:namespace_prefix=>nil)
113
- }
114
- t.inst_cond_note(:path=>"instantiationAnnotation", :namespace_prefix=>nil, :attributes=>{ :annotationType=>"Condition Notes" })
115
- t.inst_clean_note(:path=>"instantiationAnnotation", :namespace_prefix=>nil, :attributes=>{ :annotationType=>"Cleaning Notes" })
116
- }
139
+ t.pbcoreInstantiation do
140
+ t.instantiationIdentifier(:attributes=>{
141
+ :annotation=>"Barcode",
142
+ :source=>"Rock and Roll Hall of Fame and Museum"
143
+ })
144
+ t.instantiationDate(:attributes=>{ :dateType=>"created" })
145
+ t.instantiationPhysical(:attributes=>{ :source=>"PBCore instantiationPhysical" })
146
+ t.instantiationStandard
147
+ t.instantiationLocation
148
+ t.instantiationMediaType(:attributes=>{ :source=>"PBCore instantiationMediaType" })
149
+ t.instantiationGenerations(:attributes=>{ :source=>"PBCore instantiationGenerations" })
150
+ t.instantiationColors
151
+ t.instantiationLanguage(:attributes=>{
152
+ :source=>"ISO 639.2",
153
+ :ref=>"http://www.loc.gov/standards/iso639-2/php/code_list.php"
154
+ })
155
+ t.instantiationRelation do
156
+ t.arc_collection(:path=>"instantiationRelationIdentifier",
157
+ :attributes=>{ :annotation=>"Archival collection" },
158
+ :index_as => [:searchable, :facetable]
159
+ )
160
+ t.arc_series(:path=>"instantiationRelationIdentifier", :attributes=>{ :annotation=>"Archival Series" })
161
+ t.col_number(:path=>"instantiationRelationIdentifier", :attributes=>{ :annotation=>"Collection Number" })
162
+ t.acc_number(:path=>"instantiationRelationIdentifier", :attributes=>{ :annotation=>"Accession Number" })
163
+ end
164
+ t.instantiationRights do
165
+ t.rightsSummary
166
+ end
167
+ t.inst_cond_note(:path=>"instantiationAnnotation",
168
+ :attributes=>{ :annotationType=>"Condition Notes"},
169
+ :index_as => [:searchable, :displayable]
170
+ )
171
+ t.inst_clean_note(:path=>"instantiationAnnotation",
172
+ :attributes=>{ :annotationType=>"Cleaning Notes" },
173
+ :index_as => [:searchable, :displayable]
174
+ )
175
+ end
117
176
  # Individual field names:
118
- t.creation_date(:proxy=>[:pbcoreInstantiation, :instantiationDate])
119
- t.barcode(:proxy=>[:pbcoreInstantiation, :instantiationIdentifier])
120
- t.repository(:proxy=>[:pbcoreInstantiation, :instantiationLocation])
121
- t.format(:proxy=>[:pbcoreInstantiation, :instantiationPhysical])
122
- t.standard(:proxy=>[:pbcoreInstantiation, :instantiationStandard])
123
- t.media_type(:proxy=>[:pbcoreInstantiation, :instantiationMediaType])
124
- t.generation(:proxy=>[:pbcoreInstantiation, :instantiationGenerations])
125
- t.language(:proxy=>[:pbcoreInstantiation, :instantiationLanguage])
126
- t.colors(:proxy=>[:pbcoreInstantiation, :instantiationColors])
127
- t.archival_collection(:proxy=>[:pbcoreInstantiation, :instantiationRelation, :arc_collection])
128
- t.archival_series(:proxy=>[:pbcoreInstantiation, :instantiationRelation, :arc_series])
129
- t.collection_number(:proxy=>[:pbcoreInstantiation, :instantiationRelation, :col_number])
130
- t.accession_number(:proxy=>[:pbcoreInstantiation, :instantiationRelation, :acc_number])
131
- t.usage(:proxy=>[:pbcoreInstantiation, :instantiationRights, :rightsSummary])
177
+ t.creation_date(:ref=>[:pbcoreInstantiation, :instantiationDate], :type => :date, :index_as => [:searchable])
178
+ t.barcode(:ref=>[:pbcoreInstantiation, :instantiationIdentifier], :index_as => [:searchable, :displayable])
179
+ t.repository(:ref=>[:pbcoreInstantiation, :instantiationLocation], :index_as => [:searchable, :displayable])
180
+ t.format(:ref=>[:pbcoreInstantiation, :instantiationPhysical], :index_as => [:searchable, :facetable])
181
+ t.standard(:ref=>[:pbcoreInstantiation, :instantiationStandard], :index_as => [:searchable, :facetable])
182
+ t.media_type(:ref=>[:pbcoreInstantiation, :instantiationMediaType], :index_as => [:searchable, :facetable])
183
+ t.generation(:ref=>[:pbcoreInstantiation, :instantiationGenerations], :index_as => [:searchable, :displayable])
184
+ t.language(:ref=>[:pbcoreInstantiation, :instantiationLanguage], :index_as => [:searchable, :displayable])
185
+ t.colors(:ref=>[:pbcoreInstantiation, :instantiationColors], :index_as => [:searchable, :displayable])
186
+ t.archival_collection(
187
+ :ref=>[:pbcoreInstantiation, :instantiationRelation, :arc_collection],
188
+ :index_as => [:searchable, :facetable]
189
+ )
190
+ t.archival_series(
191
+ :ref=>[:pbcoreInstantiation, :instantiationRelation, :arc_series],
192
+ :index_as => [:searchable, :displayable]
193
+ )
194
+ t.collection_number(
195
+ :ref=>[:pbcoreInstantiation, :instantiationRelation, :col_number],
196
+ :index_as => [:searchable, :displayable]
197
+ )
198
+ t.accession_number(:ref=>[:pbcoreInstantiation, :instantiationRelation, :acc_number],
199
+ :index_as => [:searchable, :displayable]
200
+ )
201
+ t.usage(:ref=>[:pbcoreInstantiation, :instantiationRights, :rightsSummary],
202
+ :index_as => [:searchable, :displayable]
203
+ )
204
+
205
+ # Inserted terms
132
206
  t.condition_note(:proxy=>[:pbcoreInstantiation, :inst_cond_note])
133
207
  t.cleaning_note(:proxy=>[:pbcoreInstantiation, :inst_clean_note])
134
-
135
- #
136
- # pbcorePart fields
137
- #
138
- t.pbcorePart(:namespace_prefix=>nil) {
139
- t.pbcoreTitle(:namespace_prefix=>nil, :attributes=>{ :titleType=>"song", :annotation=>"part title" })
140
- t.pbcoreIdentifier(:namespace_prefix=>nil, :attributes=>{ :source=>"rock hall", :annotation=>"part number" })
141
- t.pbcoreDescription(:namespace_prefix=>nil, :attributes=>{ :descriptionType=>"Description",
142
- :descriptionTypesource=>"pbcoreDescription/descriptionType",
143
- :ref=>"http://pbcore.org/vocabularies/pbcoreDescription/descriptionType#description" }
144
- )
145
- t.pbcoreContributor(:namespace_prefix=>nil, :xmlns => '') {
146
- t.contributor(:namespace_prefix=>nil, :attributes=>{ :annotation=>"part contributor" })
147
- t.contributorRole(:namespace_prefix=>nil, :attributes=>{ :source=>"MARC relator terms" })
148
- }
149
- }
150
- t.part_title(:ref=>[:pbcorePart, :pbcoreTitle])
151
- t.part_number(:ref=>[:pbcorePart, :pbcoreIdentifier])
152
- t.part_description(:ref=>[:pbcorePart, :pbcoreDescription])
153
- t.part_contributor(:ref=>[:pbcorePart, :pbcoreContributor, :contributor])
154
- t.part_role(:ref=>[:pbcorePart, :pbcoreContributor, :contributorRole])
155
-
156
208
  end
157
209
 
158
-
159
210
  def self.xml_template
160
211
  builder = Nokogiri::XML::Builder.new do |xml|
161
212
 
@@ -255,6 +306,5 @@ class Document < ActiveFedora::NokogiriDatastream
255
306
  return builder.doc
256
307
  end
257
308
 
258
-
259
- end
260
309
  end
310
+ end