hydra-pbcore 1.0.0 → 1.1.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.
- data/.gitignore +1 -0
- data/Rakefile +6 -0
- data/lib/hydra-pbcore.rb +60 -1
- data/lib/hydra-pbcore/behaviors.rb +4 -2
- data/lib/hydra-pbcore/conversions.rb +88 -0
- data/lib/hydra-pbcore/datastream/{digital_document.rb → deprecated/digital_document.rb} +3 -2
- data/lib/hydra-pbcore/datastream/deprecated/document.rb +310 -0
- data/lib/hydra-pbcore/datastream/deprecated/instantiation.rb +261 -0
- data/lib/hydra-pbcore/datastream/document.rb +37 -139
- data/lib/hydra-pbcore/datastream/instantiation.rb +184 -223
- data/lib/hydra-pbcore/methods.rb +23 -2
- data/lib/hydra-pbcore/templates.rb +116 -0
- data/lib/hydra-pbcore/version.rb +1 -1
- data/spec/{digital_document_spec.rb → deprecated/digital_document_spec.rb} +6 -26
- data/spec/deprecated/document_spec.rb +282 -0
- data/spec/deprecated/instantiation_spec.rb +214 -0
- data/spec/document_spec.rb +71 -194
- data/spec/fixtures/converted_digital_document_rrhof_1904.xml +53 -0
- data/spec/fixtures/converted_digital_document_rrhof_2405.xml +46 -0
- data/spec/fixtures/converted_document_rrhof_2439.xml +19 -0
- data/spec/fixtures/converted_document_rrhof_524.xml +45 -0
- data/spec/fixtures/converted_instantiation_rrhof_1184.xml +39 -0
- data/spec/fixtures/converted_rrhof_524.xml +45 -0
- data/spec/fixtures/converted_rrhof_524_instantiation.xml +18 -0
- data/spec/fixtures/{pbcore_digital_document_template.xml → deprecated/pbcore_digital_document_template.xml} +0 -0
- data/spec/fixtures/{pbcore_document_template.xml → deprecated/pbcore_document_template.xml} +0 -0
- data/spec/fixtures/{pbcore_instantiation_template.xml → deprecated/pbcore_instantiation_template.xml} +0 -0
- data/spec/fixtures/{pbcore_solr_digital_document_template.xml → deprecated/pbcore_solr_digital_document_template.xml} +0 -0
- data/spec/fixtures/{pbcore_solr_document_template.xml → deprecated/pbcore_solr_document_template.xml} +0 -0
- data/spec/fixtures/{pbcore_solr_instantiation_template.xml → deprecated/pbcore_solr_instantiation_template.xml} +0 -0
- data/spec/fixtures/digital_instantiation.xml +56 -0
- data/spec/fixtures/digital_instantiation_solr.xml +1913 -0
- data/spec/fixtures/digital_instantiation_template.xml +33 -0
- data/spec/fixtures/document.xml +72 -0
- data/spec/fixtures/document_solr.xml +582 -0
- data/spec/fixtures/document_template.xml +30 -0
- data/spec/fixtures/integration/digital_document_rrhof_1904.xml +63 -0
- data/spec/fixtures/integration/digital_document_rrhof_2405.xml +62 -0
- data/spec/fixtures/integration/document_rrhof_2439.xml +54 -0
- data/spec/fixtures/integration/document_rrhof_524.xml +80 -0
- data/spec/fixtures/integration/instantiation_rrhof_1184.xml +44 -0
- data/spec/fixtures/physical_instantiation.xml +20 -0
- data/spec/fixtures/physical_instantiation_solr.xml +441 -0
- data/spec/fixtures/physical_instantiation_template.xml +18 -0
- data/spec/instantiation_spec.rb +180 -132
- data/spec/integration/conversions_spec.rb +73 -0
- data/spec/spec_helper.rb +37 -9
- data/spec/templates_spec.rb +31 -0
- metadata +68 -17
@@ -6,254 +6,215 @@ class Instantiation < ActiveFedora::NokogiriDatastream
|
|
6
6
|
|
7
7
|
# Note: this is not a complete PBCore document, just an instantiation node
|
8
8
|
set_terminology do |t|
|
9
|
-
t.root(:path=>"
|
10
|
-
|
11
|
-
t.
|
9
|
+
t.root(:path=>"pbcoreInstantiation")
|
10
|
+
|
11
|
+
t.name(
|
12
|
+
:path => "instantiationIdentifier",
|
13
|
+
:attributes=>{
|
14
|
+
:annotation=>"Filename",
|
15
|
+
:source=>"Rock and Roll Hall of Fame and Museum"
|
16
|
+
},
|
17
|
+
:index_as => [:displayable]
|
18
|
+
)
|
19
|
+
t.barcode(
|
20
|
+
:path => "instantiationIdentifier",
|
21
|
+
:attributes=>{
|
22
|
+
:annotation=>"Barcode",
|
23
|
+
:source=>"Rock and Roll Hall of Fame and Museum"
|
24
|
+
},
|
25
|
+
:index_as => [:displayable]
|
26
|
+
)
|
27
|
+
t.instantiationDate(:attributes=>{ :dateType=>"created" },
|
28
|
+
:index_as => [:not_searchable, :converted_date, :displayable]
|
29
|
+
)
|
30
|
+
t.instantiationDigital(:attributes=>{ :source=>"EBU file formats" },
|
31
|
+
:index_as => [:searchable, :facetable]
|
32
|
+
)
|
33
|
+
t.instantiationPhysical(:attributes=>{ :source=>"PBCore instantiationPhysical" },
|
34
|
+
:index_as => [:searchable, :facetable]
|
35
|
+
)
|
36
|
+
t.instantiationStandard(:index_as => [:displayable])
|
37
|
+
t.instantiationLocation(:index_as => [:displayable])
|
38
|
+
t.instantiationGenerations(:attributes=>{ :source=>"PBCore instantiationGenerations" },
|
39
|
+
:index_as => [:displayable]
|
40
|
+
)
|
41
|
+
t.instantiationFileSize(:index_as => [:displayable]) do
|
42
|
+
t.units(:path=>{:attribute=>"unitsOfMeasure"}, :index_as => [:displayable])
|
43
|
+
end
|
44
|
+
t.instantiationColors(:attributes=>{ :source=>"PBCore instantiationColors" },
|
45
|
+
:index_as => [:displayable]
|
46
|
+
)
|
47
|
+
t.instantiationMediaType(:attributes=>{ :source=>"PBCore instantiationMediaType" },
|
48
|
+
:index_as => [:facetable]
|
49
|
+
)
|
50
|
+
t.instantiationLanguage(
|
51
|
+
:attributes=>{
|
52
|
+
:source=>"ISO 639.2",
|
53
|
+
:ref=>"http://www.loc.gov/standards/iso639-2/php/code_list.php"
|
54
|
+
},
|
55
|
+
:index_as => [:searchable]
|
56
|
+
)
|
57
|
+
t.instantiationDuration(:index_as => [:displayable])
|
58
|
+
|
59
|
+
t.instantiationRights do
|
60
|
+
t.rightsSummary(:index_as => [:displayable])
|
61
|
+
end
|
12
62
|
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
:source=>"Rock and Roll Hall of Fame and Museum"
|
17
|
-
},
|
63
|
+
t.instantiationEssenceTrack do
|
64
|
+
t.essenceTrackStandard(:index_as => [:displayable])
|
65
|
+
t.essenceTrackEncoding( :attributes=>{ :source=>"PBCore essenceTrackEncoding" },
|
18
66
|
:index_as => [:displayable]
|
19
67
|
)
|
20
|
-
t.
|
21
|
-
:index_as => [:not_searchable, :converted_date, :displayable]
|
22
|
-
)
|
23
|
-
t.instantiationDigital(:attributes=>{ :source=>"EBU file formats" },
|
24
|
-
:index_as => [:searchable, :facetable]
|
25
|
-
)
|
26
|
-
t.instantiationStandard(:index_as => [:displayable])
|
27
|
-
t.instantiationLocation(:index_as => [:displayable])
|
28
|
-
t.instantiationGenerations(:attributes=>{ :source=>"PBCore instantiationGenerations" },
|
29
|
-
:index_as => [:displayable]
|
30
|
-
)
|
31
|
-
t.instantiationFileSize(:index_as => [:displayable]) do
|
68
|
+
t.essenceTrackDataRate(:index_as => [:displayable]) do
|
32
69
|
t.units(:path=>{:attribute=>"unitsOfMeasure"}, :index_as => [:displayable])
|
33
70
|
end
|
34
|
-
t.
|
71
|
+
t.essenceTrackFrameRate(:attributes=>{ :unitsOfMeasure=>"fps" }, :index_as => [:displayable])
|
72
|
+
t.essenceTrackFrameSize(:attributes=>{ :source=>"PBCore essenceTrackFrameSize" }, :index_as => [:displayable])
|
73
|
+
t.essenceTrackBitDepth(:index_as => [:displayable])
|
74
|
+
t.essenceTrackAspectRatio(:attributes=>{ :source=>"PBCore essenceTrackAspectRatio" },
|
35
75
|
:index_as => [:displayable]
|
36
76
|
)
|
37
|
-
t.
|
38
|
-
:index_as => [:
|
39
|
-
)
|
40
|
-
t.instantiationLanguage(
|
41
|
-
:attributes=>{
|
42
|
-
:source=>"ISO 639.2",
|
43
|
-
:ref=>"http://www.loc.gov/standards/iso639-2/php/code_list.php"
|
44
|
-
},
|
45
|
-
:index_as => [:searchable]
|
46
|
-
)
|
47
|
-
t.instantiationDuration(:index_as => [:displayable])
|
48
|
-
|
49
|
-
t.instantiationRights do
|
50
|
-
t.rightsSummary(:index_as => [:displayable])
|
51
|
-
end
|
52
|
-
|
53
|
-
t.instantiationEssenceTrack do
|
54
|
-
t.essenceTrackStandard(:index_as => [:displayable])
|
55
|
-
t.essenceTrackEncoding( :attributes=>{ :source=>"PBCore essenceTrackEncoding" },
|
56
|
-
:index_as => [:displayable]
|
57
|
-
)
|
58
|
-
t.essenceTrackDataRate(:index_as => [:displayable]) do
|
59
|
-
t.units(:path=>{:attribute=>"unitsOfMeasure"}, :index_as => [:displayable])
|
60
|
-
end
|
61
|
-
t.essenceTrackFrameRate(:attributes=>{ :unitsOfMeasure=>"fps" }, :index_as => [:displayable])
|
62
|
-
t.essenceTrackFrameSize(:attributes=>{ :source=>"PBCore essenceTrackFrameSize" }, :index_as => [:displayable])
|
63
|
-
t.essenceTrackBitDepth(:index_as => [:displayable])
|
64
|
-
t.essenceTrackAspectRatio(:attributes=>{ :source=>"PBCore essenceTrackAspectRatio" },
|
65
|
-
:index_as => [:displayable]
|
66
|
-
)
|
67
|
-
t.essenceTrackSamplingRate(:index_as => [:displayable]) do
|
68
|
-
t.units(:path=>{:attribute=>"unitsOfMeasure"}, :index_as => [:displayable])
|
69
|
-
end
|
70
|
-
t.essenceTrackAnnotation( :attributes=>{ :annotationType=>"Number of Audio Channels" },
|
71
|
-
:index_as => [:displayable]
|
72
|
-
)
|
73
|
-
end
|
74
|
-
t.video_essence(:ref => [:pbcoreInstantiation, :instantiationEssenceTrack],
|
75
|
-
:path=>'instantiationEssenceTrack[essenceTrackType="Video"]'
|
76
|
-
)
|
77
|
-
t.audio_essence(:ref => [:pbcoreInstantiation, :instantiationEssenceTrack],
|
78
|
-
:path=>'instantiationEssenceTrack[essenceTrackType="Audio"]'
|
79
|
-
)
|
80
|
-
|
81
|
-
t.instantiationRelation do
|
82
|
-
t.instantiationRelationIdentifier(:attributes=>{ :source=>"Rock and Roll Hall of Fame and Museum" })
|
77
|
+
t.essenceTrackSamplingRate(:index_as => [:displayable]) do
|
78
|
+
t.units(:path=>{:attribute=>"unitsOfMeasure"}, :index_as => [:displayable])
|
83
79
|
end
|
84
|
-
|
85
|
-
t.next_inst(:ref => [:pbcoreInstantiation, :instantiationRelation],
|
86
|
-
:path=>'instantiationRelation[instantiationRelationType="Precedes in Sequence"]'
|
87
|
-
)
|
88
|
-
# The file we're describing at the root of this document comes after the file marked "previous"
|
89
|
-
t.previous_inst(:ref => [:pbcoreInstantiation, :instantiationRelation],
|
90
|
-
:path=>'instantiationRelation[instantiationRelationType="Follows in Sequence"]'
|
91
|
-
)
|
92
|
-
|
93
|
-
# Instantitation annotiations
|
94
|
-
t.inst_chksum_type(:path=>"instantiationAnnotation", :attributes=>{ :annotationType=>"Checksum Type" },
|
95
|
-
:index_as => [:displayable]
|
96
|
-
)
|
97
|
-
t.inst_chksum_value(:path=>"instantiationAnnotation", :attributes=>{ :annotationType=>"Checksum Value" },
|
98
|
-
:index_as => [:displayable]
|
99
|
-
)
|
100
|
-
t.inst_device(:path=>"instantiationAnnotation", :attributes=>{ :annotationType=>"Playback Device" },
|
101
|
-
:index_as => [:displayable]
|
102
|
-
)
|
103
|
-
t.inst_capture_soft(:path=>"instantiationAnnotation", :attributes=>{ :annotationType=>"Capture Software" },
|
104
|
-
:index_as => [:displayable]
|
105
|
-
)
|
106
|
-
t.inst_trans_soft(:path=>"instantiationAnnotation", :attributes=>{ :annotationType=>"Transcoding Software" },
|
107
|
-
:index_as => [:displayable]
|
108
|
-
)
|
109
|
-
t.inst_operator(:path=>"instantiationAnnotation", :attributes=>{ :annotationType=>"Operator" },
|
110
|
-
:index_as => [:displayable]
|
111
|
-
)
|
112
|
-
t.inst_trans_note(:path=>"instantiationAnnotation", :attributes=>{ :annotationType=>"Transfer Notes" },
|
113
|
-
:index_as => [:displayable]
|
114
|
-
)
|
115
|
-
t.inst_vendor(:path=>"instantiationAnnotation", :attributes=>{ :annotationType=>"Vendor Name" },
|
116
|
-
:index_as => [:displayable]
|
117
|
-
)
|
118
|
-
t.inst_cond_note(:path=>"instantiationAnnotation", :attributes=>{ :annotationType=>"Condition Notes" },
|
119
|
-
:index_as => [:displayable]
|
120
|
-
)
|
121
|
-
t.inst_clean_note(:path=>"instantiationAnnotation", :attributes=>{ :annotationType=>"Cleaning Notes" },
|
122
|
-
:index_as => [:displayable]
|
123
|
-
)
|
124
|
-
t.inst_note(:path=>"instantiationAnnotation", :attributes=>{ :annotationType=>"Notes" },
|
125
|
-
:index_as => [:displayable]
|
126
|
-
)
|
127
|
-
t.inst_color_space(:path=>"instantiationAnnotation", :attributes=>{ :annotationType=>"Color Space" },
|
128
|
-
:index_as => [:displayable]
|
129
|
-
)
|
130
|
-
t.inst_chroma(:path=>"instantiationAnnotation", :attributes=>{ :annotationType=>"Chroma" },
|
80
|
+
t.essenceTrackAnnotation( :attributes=>{ :annotationType=>"Number of Audio Channels" },
|
131
81
|
:index_as => [:displayable]
|
132
82
|
)
|
133
|
-
|
134
83
|
end
|
84
|
+
t.video_essence(:ref => [:pbcoreInstantiation, :instantiationEssenceTrack],
|
85
|
+
:path=>'instantiationEssenceTrack[essenceTrackType="Video"]'
|
86
|
+
)
|
87
|
+
t.audio_essence(:ref => [:pbcoreInstantiation, :instantiationEssenceTrack],
|
88
|
+
:path=>'instantiationEssenceTrack[essenceTrackType="Audio"]'
|
89
|
+
)
|
90
|
+
|
91
|
+
t.instantiationRelation do
|
92
|
+
t.instantiationRelationIdentifier(:attributes=>{ :source=>"Rock and Roll Hall of Fame and Museum" })
|
93
|
+
end
|
94
|
+
# The file we're describing at the root of this document preceeds the file marked "next"
|
95
|
+
t.next_inst(:ref => [:pbcoreInstantiation, :instantiationRelation],
|
96
|
+
:path=>'instantiationRelation[instantiationRelationType="Precedes in Sequence"]'
|
97
|
+
)
|
98
|
+
# The file we're describing at the root of this document comes after the file marked "previous"
|
99
|
+
t.previous_inst(:ref => [:pbcoreInstantiation, :instantiationRelation],
|
100
|
+
:path=>'instantiationRelation[instantiationRelationType="Follows in Sequence"]'
|
101
|
+
)
|
102
|
+
|
103
|
+
# Instantitation annotiations
|
104
|
+
t.inst_chksum_type(:path=>"instantiationAnnotation", :attributes=>{ :annotationType=>"Checksum Type" },
|
105
|
+
:index_as => [:displayable]
|
106
|
+
)
|
107
|
+
t.inst_chksum_value(:path=>"instantiationAnnotation", :attributes=>{ :annotationType=>"Checksum Value" },
|
108
|
+
:index_as => [:displayable]
|
109
|
+
)
|
110
|
+
t.inst_device(:path=>"instantiationAnnotation", :attributes=>{ :annotationType=>"Playback Device" },
|
111
|
+
:index_as => [:displayable]
|
112
|
+
)
|
113
|
+
t.inst_capture_soft(:path=>"instantiationAnnotation", :attributes=>{ :annotationType=>"Capture Software" },
|
114
|
+
:index_as => [:displayable]
|
115
|
+
)
|
116
|
+
t.inst_trans_soft(:path=>"instantiationAnnotation", :attributes=>{ :annotationType=>"Transcoding Software" },
|
117
|
+
:index_as => [:displayable]
|
118
|
+
)
|
119
|
+
t.inst_operator(:path=>"instantiationAnnotation", :attributes=>{ :annotationType=>"Operator" },
|
120
|
+
:index_as => [:displayable]
|
121
|
+
)
|
122
|
+
t.inst_trans_note(:path=>"instantiationAnnotation", :attributes=>{ :annotationType=>"Transfer Notes" },
|
123
|
+
:index_as => [:displayable]
|
124
|
+
)
|
125
|
+
t.inst_vendor(:path=>"instantiationAnnotation", :attributes=>{ :annotationType=>"Vendor Name" },
|
126
|
+
:index_as => [:displayable]
|
127
|
+
)
|
128
|
+
t.inst_cond_note(:path=>"instantiationAnnotation", :attributes=>{ :annotationType=>"Condition Notes" },
|
129
|
+
:index_as => [:displayable]
|
130
|
+
)
|
131
|
+
t.inst_clean_note(:path=>"instantiationAnnotation", :attributes=>{ :annotationType=>"Cleaning Notes" },
|
132
|
+
:index_as => [:displayable]
|
133
|
+
)
|
134
|
+
t.inst_note(:path=>"instantiationAnnotation", :attributes=>{ :annotationType=>"Notes" },
|
135
|
+
:index_as => [:displayable]
|
136
|
+
)
|
137
|
+
t.inst_color_space(:path=>"instantiationAnnotation", :attributes=>{ :annotationType=>"Color Space" },
|
138
|
+
:index_as => [:displayable]
|
139
|
+
)
|
140
|
+
t.inst_chroma(:path=>"instantiationAnnotation", :attributes=>{ :annotationType=>"Chroma" },
|
141
|
+
:index_as => [:displayable]
|
142
|
+
)
|
143
|
+
|
144
|
+
t.condition_note(:path=>"instantiationAnnotation",
|
145
|
+
:attributes=>{ :annotationType=>"Condition Notes"},
|
146
|
+
:index_as => [:searchable, :displayable]
|
147
|
+
)
|
148
|
+
t.cleaning_note(:path=>"instantiationAnnotation",
|
149
|
+
:attributes=>{ :annotationType=>"Cleaning Notes" },
|
150
|
+
:index_as => [:searchable, :displayable]
|
151
|
+
)
|
135
152
|
|
136
153
|
#
|
137
|
-
#
|
154
|
+
# Proxied terms
|
138
155
|
#
|
139
|
-
t.
|
140
|
-
t.
|
141
|
-
t.
|
142
|
-
t.
|
143
|
-
t.
|
144
|
-
t.
|
145
|
-
t.size(:proxy=>[:
|
146
|
-
t.size_units(:proxy=>[:
|
147
|
-
t.colors(:proxy=>[:
|
148
|
-
t.duration(:proxy=>[:
|
149
|
-
t.rights_summary(:proxy=>[:
|
156
|
+
t.location(:proxy=>[:instantiationLocation])
|
157
|
+
t.date(:proxy=>[:instantiationDate])
|
158
|
+
t.generation(:proxy=>[:instantiationGenerations])
|
159
|
+
t.media_type(:proxy=>[:instantiationMediaType])
|
160
|
+
t.file_format(:proxy=>[:instantiationDigital])
|
161
|
+
t.format(:proxy=>[:instantiationPhysical])
|
162
|
+
t.size(:proxy=>[:instantiationFileSize])
|
163
|
+
t.size_units(:proxy=>[:instantiationFileSize, :units])
|
164
|
+
t.colors(:proxy=>[:instantiationColors])
|
165
|
+
t.duration(:proxy=>[:instantiationDuration])
|
166
|
+
t.rights_summary(:proxy=>[:instantiationRights, :rightsSummary])
|
150
167
|
|
151
168
|
# Proxies to annotation fields and other fields that are not in the template
|
152
|
-
t.note(:proxy=>[:
|
153
|
-
t.checksum_type(:proxy=>[:
|
154
|
-
t.checksum_value(:proxy=>[:
|
155
|
-
t.device(:proxy=>[:
|
156
|
-
t.capture_soft(:proxy=>[:
|
157
|
-
t.trans_soft(:proxy=>[:
|
158
|
-
t.operator(:proxy=>[:
|
159
|
-
t.trans_note(:proxy=>[:
|
160
|
-
t.vendor(:proxy=>[:
|
161
|
-
t.condition(:proxy=>[:
|
162
|
-
t.cleaning(:proxy=>[:
|
163
|
-
t.color_space(:proxy=>[:
|
164
|
-
t.chroma(:proxy=>[:
|
165
|
-
t.standard(:proxy=>[:
|
166
|
-
t.language(:proxy=>[:
|
169
|
+
t.note(:proxy=>[:inst_note])
|
170
|
+
t.checksum_type(:proxy=>[:inst_chksum_type])
|
171
|
+
t.checksum_value(:proxy=>[:inst_chksum_value])
|
172
|
+
t.device(:proxy=>[:inst_device])
|
173
|
+
t.capture_soft(:proxy=>[:inst_capture_soft])
|
174
|
+
t.trans_soft(:proxy=>[:inst_trans_soft])
|
175
|
+
t.operator(:proxy=>[:inst_operator])
|
176
|
+
t.trans_note(:proxy=>[:inst_trans_note])
|
177
|
+
t.vendor(:proxy=>[:inst_vendor])
|
178
|
+
t.condition(:proxy=>[:inst_cond_note])
|
179
|
+
t.cleaning(:proxy=>[:inst_clean_note])
|
180
|
+
t.color_space(:proxy=>[:inst_color_space])
|
181
|
+
t.chroma(:proxy=>[:inst_chroma])
|
182
|
+
t.standard(:proxy=>[:instantiationStandard])
|
183
|
+
t.language(:proxy=>[:instantiationLanguage])
|
167
184
|
|
168
185
|
# Proxies to video essence fields
|
169
|
-
t.video_standard(:proxy=>[:
|
170
|
-
t.video_encoding(:proxy=>[:
|
171
|
-
t.video_bit_rate(:proxy=>[:
|
172
|
-
t.video_bit_rate_units(:proxy=>[:
|
173
|
-
t.frame_rate(:proxy=>[:
|
174
|
-
t.frame_size(:proxy=>[:
|
175
|
-
t.video_bit_depth(:proxy=>[:
|
176
|
-
t.aspect_ratio(:proxy=>[:
|
186
|
+
t.video_standard(:proxy=>[:video_essence, :essenceTrackStandard])
|
187
|
+
t.video_encoding(:proxy=>[:video_essence, :essenceTrackEncoding])
|
188
|
+
t.video_bit_rate(:proxy=>[:video_essence, :essenceTrackDataRate])
|
189
|
+
t.video_bit_rate_units(:proxy=>[:video_essence, :essenceTrackDataRate, :units])
|
190
|
+
t.frame_rate(:proxy=>[:video_essence, :essenceTrackFrameRate])
|
191
|
+
t.frame_size(:proxy=>[:video_essence, :essenceTrackFrameSize])
|
192
|
+
t.video_bit_depth(:proxy=>[:video_essence, :essenceTrackBitDepth])
|
193
|
+
t.aspect_ratio(:proxy=>[:video_essence, :essenceTrackAspectRatio])
|
177
194
|
|
178
195
|
# Proxies to audio essence fields
|
179
|
-
t.audio_standard(:proxy=>[:
|
180
|
-
t.audio_encoding(:proxy=>[:
|
181
|
-
t.audio_bit_rate(:proxy=>[:
|
182
|
-
t.audio_bit_rate_units(:proxy=>[:
|
183
|
-
t.audio_sample_rate(:proxy=>[:
|
184
|
-
t.audio_sample_rate_units(:proxy=>[:
|
185
|
-
t.audio_bit_depth(:proxy=>[:
|
186
|
-
t.audio_channels(:proxy=>[:
|
196
|
+
t.audio_standard(:proxy=>[:audio_essence, :essenceTrackStandard])
|
197
|
+
t.audio_encoding(:proxy=>[:audio_essence, :essenceTrackEncoding])
|
198
|
+
t.audio_bit_rate(:proxy=>[:audio_essence, :essenceTrackDataRate])
|
199
|
+
t.audio_bit_rate_units(:proxy=>[:audio_essence, :essenceTrackDataRate, :units])
|
200
|
+
t.audio_sample_rate(:proxy=>[:audio_essence, :essenceTrackSamplingRate])
|
201
|
+
t.audio_sample_rate_units(:proxy=>[:audio_essence, :essenceTrackSamplingRate, :units])
|
202
|
+
t.audio_bit_depth(:proxy=>[:audio_essence, :essenceTrackBitDepth])
|
203
|
+
t.audio_channels(:proxy=>[:audio_essence, :essenceTrackAnnotation])
|
187
204
|
|
188
205
|
# Proxies to the relation fields
|
189
|
-
t.next_(:proxy=>[:
|
190
|
-
t.previous_(:proxy=>[:
|
191
|
-
|
206
|
+
t.next_(:proxy=>[:next_inst, :instantiationRelationIdentifier])
|
207
|
+
t.previous_(:proxy=>[:previous_inst, :instantiationRelationIdentifier])
|
192
208
|
end
|
193
209
|
|
194
|
-
def
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
# shouldn't be used for anything else here because they're in the parent Fedora object
|
202
|
-
xml.pbcoreIdentifier(:annotation=>"PID", :source=>"Rock and Roll Hall of Fame and Museum")
|
203
|
-
xml.pbcoreTitle
|
204
|
-
xml.pbcoreDescription
|
205
|
-
|
206
|
-
xml.pbcoreInstantiation {
|
207
|
-
|
208
|
-
xml.instantiationIdentifier(:annotation=>"Filename", :source=>"Rock and Roll Hall of Fame and Museum")
|
209
|
-
xml.instantiationDate(:dateType=>"created")
|
210
|
-
xml.instantiationDigital(:source=>"EBU file formats")
|
211
|
-
xml.instantiationLocation
|
212
|
-
xml.instantiationMediaType(:source=>"PBCore instantiationMediaType") {
|
213
|
-
xml.text "Moving image"
|
214
|
-
}
|
215
|
-
xml.instantiationGenerations(:source=>"PBCore instantiationGenerations")
|
216
|
-
xml.instantiationFileSize(:unitsOfMeasure=>"")
|
217
|
-
xml.instantiationDuration
|
218
|
-
xml.instantiationColors(:source=>"PBCore instantiationColors") {
|
219
|
-
xml.text "Color"
|
220
|
-
}
|
221
|
-
|
222
|
-
xml.instantiationEssenceTrack {
|
223
|
-
xml.essenceTrackType {
|
224
|
-
xml.text "Video"
|
225
|
-
}
|
226
|
-
xml.essenceTrackStandard
|
227
|
-
xml.essenceTrackEncoding(:source=>"PBCore essenceTrackEncoding")
|
228
|
-
xml.essenceTrackDataRate(:unitsOfMeasure=>"")
|
229
|
-
xml.essenceTrackFrameRate(:unitsOfMeasure=>"fps")
|
230
|
-
xml.essenceTrackBitDepth
|
231
|
-
xml.essenceTrackFrameSize(:source=>"PBCore essenceTrackFrameSize")
|
232
|
-
xml.essenceTrackAspectRatio(:source=>"PBCore essenceTrackAspectRatio")
|
233
|
-
}
|
234
|
-
|
235
|
-
xml.instantiationEssenceTrack {
|
236
|
-
xml.essenceTrackType {
|
237
|
-
xml.text "Audio"
|
238
|
-
}
|
239
|
-
xml.essenceTrackStandard
|
240
|
-
xml.essenceTrackEncoding(:source=>"PBCore essenceTrackEncoding")
|
241
|
-
xml.essenceTrackDataRate(:unitsOfMeasure=>"")
|
242
|
-
xml.essenceTrackSamplingRate(:unitsOfMeasure=>"")
|
243
|
-
xml.essenceTrackBitDepth
|
244
|
-
xml.essenceTrackAnnotation(:annotationType=>"Number of Audio Channels")
|
245
|
-
}
|
246
|
-
|
247
|
-
xml.instantiationRights {
|
248
|
-
xml.rightsSummary
|
249
|
-
}
|
250
|
-
|
251
|
-
}
|
252
|
-
|
253
|
-
}
|
254
|
-
|
210
|
+
def define opts
|
211
|
+
if opts == :physical
|
212
|
+
self.ng_xml = physical_instantiation
|
213
|
+
elsif opts == :digital
|
214
|
+
self.ng_xml = digital_instantiation
|
215
|
+
else
|
216
|
+
return self.ng_xml
|
255
217
|
end
|
256
|
-
return builder.doc
|
257
218
|
end
|
258
219
|
|
259
220
|
end
|
data/lib/hydra-pbcore/methods.rb
CHANGED
@@ -1,10 +1,31 @@
|
|
1
1
|
module HydraPbcore::Methods
|
2
2
|
|
3
|
-
|
4
|
-
def remove_node(type, index)
|
3
|
+
def remove_node(type, index = 0)
|
5
4
|
self.find_by_terms(type.to_sym).slice(index.to_i).remove
|
6
5
|
self.dirty = true
|
7
6
|
end
|
8
7
|
|
8
|
+
# Returns a new Nokogiri::XML object with the contents of self reordered and repackaged as a
|
9
|
+
# valid pbcore xml document.
|
10
|
+
#
|
11
|
+
# The original xml from the datastream is copied to a new Nokogiri object, then each node
|
12
|
+
# is added--in correct order--to a new blank, valid pbcore xml document.
|
13
|
+
def to_pbcore_xml
|
14
|
+
original = Nokogiri::XML(self.to_xml)
|
15
|
+
new_doc = HydraPbcore.blank
|
16
|
+
HydraPbcore::DocumentNodes.each do |node|
|
17
|
+
original.search(node).each do |n|
|
18
|
+
new_doc.root.add_child(n)
|
19
|
+
end
|
20
|
+
end
|
21
|
+
return new_doc
|
22
|
+
end
|
23
|
+
|
24
|
+
# Validates a PBCore document against an xsd
|
25
|
+
# Returns an array of errors -- an empty array means it's valid
|
26
|
+
def valid?
|
27
|
+
xsd = Nokogiri::XML::Schema(open("http://pbcore.org/xsd/pbcore-2.0.xsd"))
|
28
|
+
xsd.validate(self.to_pbcore_xml)
|
29
|
+
end
|
9
30
|
|
10
31
|
end
|