libis-tools 1.0.16 → 1.0.17
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/libis/tools/mets_dnx.rb +3 -1
- data/lib/libis/tools/mets_objects.rb +182 -183
- data/lib/libis/tools/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: '01219a5f1fbace5f69a992675d9e67a049c1924cf7b9d9f24db18be8fdf4dc60'
|
4
|
+
data.tar.gz: 0b1ded7e545eeec542e739bfbf20a2c680a6a3a05561d95087f172932312a53a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e6e997f4405fef929aef639c6807b8b3de168777c487efb7f91ffc31eb1f588d03cf9d4210485314b44ccd074a5f7aa5ad02a1fe5e0c245a6a8524955a643e36
|
7
|
+
data.tar.gz: cc69c4dadac622c704539fb1c3357eed4c6fe6784b1870a6a4b46edc927c635c528812e9817f7769b6497ad9eba06d8faa86fce56f166d0ba3ce6cdc92a4dab8
|
data/lib/libis/tools/mets_dnx.rb
CHANGED
@@ -31,7 +31,9 @@ module Libis
|
|
31
31
|
# Specialized DNX section.
|
32
32
|
class WebHarvesting < DnxSection; end
|
33
33
|
# Specialized DNX section.
|
34
|
-
class Collection < DnxSection
|
34
|
+
class Collection < DnxSection
|
35
|
+
def tag; 'Collection'; end
|
36
|
+
end
|
35
37
|
# Specialized DNX section.
|
36
38
|
class PreservationLevel < DnxSection; end
|
37
39
|
# Specialized DNX section.
|
@@ -44,188 +44,6 @@ module Libis
|
|
44
44
|
|
45
45
|
end
|
46
46
|
|
47
|
-
# Container class for creating a representation in the METS.
|
48
|
-
class Representation
|
49
|
-
include MetsObject
|
50
|
-
|
51
|
-
# The currently allowed attributes on this class. The attributes will typically be used in {DnxSection}s.
|
52
|
-
attr_accessor :label, :preservation_type, :usage_type, :representation_code, :entity_type, :access_right_id,
|
53
|
-
:user_a, :user_b, :user_c,
|
54
|
-
:group_id, :priority, :order,
|
55
|
-
:digital_original, :content, :context, :hardware, :carrier, :original_name,
|
56
|
-
:preservation_levels, :env_dependencies, :hardware_ids, :software_ids,
|
57
|
-
:hardware_infos, :software_infos, :relationship_infos, :environments,
|
58
|
-
:dc_record, :source_metadata
|
59
|
-
|
60
|
-
# The id that will be used in the XML file to reference this representation.
|
61
|
-
def xml_id
|
62
|
-
"rep#{@id}"
|
63
|
-
end
|
64
|
-
|
65
|
-
# This method creates the appropriate {DnxSection}s based on what attributes are filled in.
|
66
|
-
def amd
|
67
|
-
dnx = {}
|
68
|
-
tech_data = []
|
69
|
-
# General characteristics
|
70
|
-
data = {
|
71
|
-
preservationType: preservation_type,
|
72
|
-
usageType: usage_type,
|
73
|
-
DigitalOriginal: digital_original,
|
74
|
-
label: label,
|
75
|
-
representationEntityType: entity_type,
|
76
|
-
contentType: content,
|
77
|
-
contextType: context,
|
78
|
-
hardwareUsed: hardware,
|
79
|
-
physicalCarrierMedia: carrier,
|
80
|
-
deliveryPriority: priority,
|
81
|
-
orderingSequence: order,
|
82
|
-
RepresentationCode: representation_code,
|
83
|
-
RepresentationOriginalName: original_name,
|
84
|
-
UserDefinedA: user_a,
|
85
|
-
UserDefinedB: user_b,
|
86
|
-
UserDefinedC: user_c,
|
87
|
-
}.cleanup
|
88
|
-
tech_data << GeneralRepCharacteristics.new(data) unless data.empty?
|
89
|
-
# Object characteristics
|
90
|
-
data = {
|
91
|
-
groupID: group_id
|
92
|
-
}.cleanup
|
93
|
-
tech_data << ObjectCharacteristics.new(data) unless data.empty?
|
94
|
-
# Preservation level
|
95
|
-
if preservation_levels
|
96
|
-
data_list = []
|
97
|
-
preservation_levels.each do |preservation_level|
|
98
|
-
data = {
|
99
|
-
preservationLevelValue: preservation_level[:value],
|
100
|
-
preservationLevelRole: preservation_level[:role],
|
101
|
-
preservationLevelRationale: preservation_level[:rationale],
|
102
|
-
preservationLevelDateAssigned: preservation_level[:date],
|
103
|
-
}.cleanup
|
104
|
-
data_list << OpenStruct.new(data) unless data.empty?
|
105
|
-
end
|
106
|
-
tech_data << PreservationLevel.new(array: data_list) unless data_list.empty?
|
107
|
-
end
|
108
|
-
# Dependencies
|
109
|
-
if env_dependencies
|
110
|
-
data_list = []
|
111
|
-
env_dependencies.each do |dependency|
|
112
|
-
data = {
|
113
|
-
dependencyName: dependency[:name],
|
114
|
-
dependencyIdentifierType1: dependency[:type1],
|
115
|
-
dependencyIdentifierValue1: dependency[:value1],
|
116
|
-
dependencyIdentifierType2: dependency[:type2],
|
117
|
-
dependencyIdentifierValue2: dependency[:value2],
|
118
|
-
dependencyIdentifierType3: dependency[:type3],
|
119
|
-
dependencyIdentifierValue3: dependency[:value3],
|
120
|
-
}.cleanup
|
121
|
-
data_list << OpenStruct.new(data) unless data.empty?
|
122
|
-
end
|
123
|
-
tech_data << EnvironmentDependencies.new(array: data_list) unless data_list.empty?
|
124
|
-
end
|
125
|
-
# Hardware registry id
|
126
|
-
if hardware_ids
|
127
|
-
data_list = []
|
128
|
-
hardware_ids.each do |id|
|
129
|
-
data = {
|
130
|
-
registryId: id
|
131
|
-
}.cleanup
|
132
|
-
data_list << OpenStruct.new(data) unless data.empty?
|
133
|
-
end
|
134
|
-
tech_data << EnvHardwareRegistry.new(array: data_list) unless data_list.empty?
|
135
|
-
end
|
136
|
-
# Software registry id
|
137
|
-
if software_ids
|
138
|
-
data_list = []
|
139
|
-
software_ids.each do |id|
|
140
|
-
data = {
|
141
|
-
registryId: id
|
142
|
-
}.cleanup
|
143
|
-
data_list << OpenStruct.new(data) unless data.empty?
|
144
|
-
end
|
145
|
-
tech_data << EnvSoftwareRegistry.new(array: data_list) unless data_list.empty?
|
146
|
-
end
|
147
|
-
# Hardware
|
148
|
-
if hardware_infos
|
149
|
-
data_list = []
|
150
|
-
hardware_infos.each do |hardware|
|
151
|
-
data = {
|
152
|
-
hardwareName: hardware[:name],
|
153
|
-
hardwareType: hardware[:type],
|
154
|
-
hardwareOtherInformation: hardware[:info],
|
155
|
-
}.cleanup
|
156
|
-
data_list << OpenStruct.new(data) unless data.empty?
|
157
|
-
end
|
158
|
-
tech_data << EnvironmentHardware.new(array: data_list) unless data_list.empty?
|
159
|
-
end
|
160
|
-
# Software
|
161
|
-
if software_infos
|
162
|
-
data_list = []
|
163
|
-
software_infos.each do |software|
|
164
|
-
data = {
|
165
|
-
softwareName: software[:name],
|
166
|
-
softwareVersion: software[:version],
|
167
|
-
softwareType: software[:type],
|
168
|
-
softwareOtherInformation: software[:info],
|
169
|
-
softwareDependancy: software[:dependency],
|
170
|
-
}.cleanup
|
171
|
-
data_list << OpenStruct.new(data) unless data.empty?
|
172
|
-
end
|
173
|
-
tech_data << EnvironmentSoftware.new(array: data_list) unless data_list.empty?
|
174
|
-
end
|
175
|
-
# Relationship
|
176
|
-
if relationship_infos
|
177
|
-
data_list = []
|
178
|
-
relationship_infos.each do |relationship|
|
179
|
-
data = {
|
180
|
-
relationshipType: relationship[:type],
|
181
|
-
relationshipSubType: relationship[:subtype],
|
182
|
-
relatedObjectIdentifierType1: relationship[:type1],
|
183
|
-
relatedObjectIdentifierValue1: relationship[:id1],
|
184
|
-
relatedObjectSequence1: relationship[:seq1],
|
185
|
-
relatedObjectIdentifierType2: relationship[:type2],
|
186
|
-
relatedObjectIdentifierValue2: relationship[:id2],
|
187
|
-
relatedObjectSequence2: relationship[:seq2],
|
188
|
-
relatedObjectIdentifierType3: relationship[:type3],
|
189
|
-
relatedObjectIdentifierValue3: relationship[:id3],
|
190
|
-
relatedObjectSequence3: relationship[:seq3],
|
191
|
-
}.cleanup
|
192
|
-
data_list << OpenStruct.new(data) unless data.empty?
|
193
|
-
end
|
194
|
-
tech_data << RelationShip.new(array: data_list) unless data_list.empty?
|
195
|
-
end
|
196
|
-
# Environment
|
197
|
-
if environments
|
198
|
-
data_list = []
|
199
|
-
environments.each do |environment|
|
200
|
-
data = {
|
201
|
-
environmentCharacteristic: environment[:characteristic],
|
202
|
-
environmentPurpose: environment[:purpose],
|
203
|
-
environmentNote: environment[:note],
|
204
|
-
}.cleanup
|
205
|
-
data_list << OpenStruct.new(data) unless data.empty?
|
206
|
-
end
|
207
|
-
tech_data << Environment.new(array: data_list) unless data_list.empty?
|
208
|
-
end
|
209
|
-
# Finally assemble technical section
|
210
|
-
dnx[:tech] = tech_data unless tech_data.empty?
|
211
|
-
# Rights section
|
212
|
-
rights_data = []
|
213
|
-
data = {
|
214
|
-
policyId: access_right_id
|
215
|
-
}.cleanup
|
216
|
-
rights_data << AccessRightsPolicy.new(data) unless data.empty?
|
217
|
-
dnx[:rights] = rights_data unless rights_data.empty?
|
218
|
-
# Source metadata
|
219
|
-
if source_metadata
|
220
|
-
source_metadata.each_with_index do |metadata, i|
|
221
|
-
dnx["source-#{metadata[:type].to_s.upcase}-#{i}"] = metadata[:data]
|
222
|
-
end
|
223
|
-
end
|
224
|
-
dnx
|
225
|
-
end
|
226
|
-
|
227
|
-
end
|
228
|
-
|
229
47
|
# Container class for creating a file in the METS.
|
230
48
|
class File
|
231
49
|
include MetsObject
|
@@ -291,7 +109,7 @@ module Libis
|
|
291
109
|
fileLocation: location,
|
292
110
|
fileOriginalName: original || target_name,
|
293
111
|
fileOriginalPath: target_path,
|
294
|
-
# fileOriginalID:
|
112
|
+
# fileOriginalID: CGI.escape(location),
|
295
113
|
# fileExtension: ::File.extname(orig_name),
|
296
114
|
fileMIMEType: mimetype,
|
297
115
|
fileSizeBytes: size,
|
@@ -524,6 +342,187 @@ module Libis
|
|
524
342
|
|
525
343
|
end
|
526
344
|
|
345
|
+
# Container class for creating a representation in the METS.
|
346
|
+
class Representation < Div
|
347
|
+
|
348
|
+
# The currently allowed attributes on this class. The attributes will typically be used in {DnxSection}s.
|
349
|
+
attr_accessor :preservation_type, :usage_type, :representation_code, :entity_type, :access_right_id,
|
350
|
+
:user_a, :user_b, :user_c,
|
351
|
+
:group_id, :priority, :order,
|
352
|
+
:digital_original, :content, :context, :hardware, :carrier, :original_name,
|
353
|
+
:preservation_levels, :env_dependencies, :hardware_ids, :software_ids,
|
354
|
+
:hardware_infos, :software_infos, :relationship_infos, :environments,
|
355
|
+
:dc_record, :source_metadata
|
356
|
+
|
357
|
+
# The id that will be used in the XML file to reference this representation.
|
358
|
+
def xml_id
|
359
|
+
"rep#{@id}"
|
360
|
+
end
|
361
|
+
|
362
|
+
# This method creates the appropriate {DnxSection}s based on what attributes are filled in.
|
363
|
+
def amd
|
364
|
+
dnx = {}
|
365
|
+
tech_data = []
|
366
|
+
# General characteristics
|
367
|
+
data = {
|
368
|
+
preservationType: preservation_type,
|
369
|
+
usageType: usage_type,
|
370
|
+
DigitalOriginal: digital_original,
|
371
|
+
label: label,
|
372
|
+
representationEntityType: entity_type,
|
373
|
+
contentType: content,
|
374
|
+
contextType: context,
|
375
|
+
hardwareUsed: hardware,
|
376
|
+
physicalCarrierMedia: carrier,
|
377
|
+
deliveryPriority: priority,
|
378
|
+
orderingSequence: order,
|
379
|
+
RepresentationCode: representation_code,
|
380
|
+
RepresentationOriginalName: original_name,
|
381
|
+
UserDefinedA: user_a,
|
382
|
+
UserDefinedB: user_b,
|
383
|
+
UserDefinedC: user_c,
|
384
|
+
}.cleanup
|
385
|
+
tech_data << GeneralRepCharacteristics.new(data) unless data.empty?
|
386
|
+
# Object characteristics
|
387
|
+
data = {
|
388
|
+
groupID: group_id
|
389
|
+
}.cleanup
|
390
|
+
tech_data << ObjectCharacteristics.new(data) unless data.empty?
|
391
|
+
# Preservation level
|
392
|
+
if preservation_levels
|
393
|
+
data_list = []
|
394
|
+
preservation_levels.each do |preservation_level|
|
395
|
+
data = {
|
396
|
+
preservationLevelValue: preservation_level[:value],
|
397
|
+
preservationLevelRole: preservation_level[:role],
|
398
|
+
preservationLevelRationale: preservation_level[:rationale],
|
399
|
+
preservationLevelDateAssigned: preservation_level[:date],
|
400
|
+
}.cleanup
|
401
|
+
data_list << OpenStruct.new(data) unless data.empty?
|
402
|
+
end
|
403
|
+
tech_data << PreservationLevel.new(array: data_list) unless data_list.empty?
|
404
|
+
end
|
405
|
+
# Dependencies
|
406
|
+
if env_dependencies
|
407
|
+
data_list = []
|
408
|
+
env_dependencies.each do |dependency|
|
409
|
+
data = {
|
410
|
+
dependencyName: dependency[:name],
|
411
|
+
dependencyIdentifierType1: dependency[:type1],
|
412
|
+
dependencyIdentifierValue1: dependency[:value1],
|
413
|
+
dependencyIdentifierType2: dependency[:type2],
|
414
|
+
dependencyIdentifierValue2: dependency[:value2],
|
415
|
+
dependencyIdentifierType3: dependency[:type3],
|
416
|
+
dependencyIdentifierValue3: dependency[:value3],
|
417
|
+
}.cleanup
|
418
|
+
data_list << OpenStruct.new(data) unless data.empty?
|
419
|
+
end
|
420
|
+
tech_data << EnvironmentDependencies.new(array: data_list) unless data_list.empty?
|
421
|
+
end
|
422
|
+
# Hardware registry id
|
423
|
+
if hardware_ids
|
424
|
+
data_list = []
|
425
|
+
hardware_ids.each do |id|
|
426
|
+
data = {
|
427
|
+
registryId: id
|
428
|
+
}.cleanup
|
429
|
+
data_list << OpenStruct.new(data) unless data.empty?
|
430
|
+
end
|
431
|
+
tech_data << EnvHardwareRegistry.new(array: data_list) unless data_list.empty?
|
432
|
+
end
|
433
|
+
# Software registry id
|
434
|
+
if software_ids
|
435
|
+
data_list = []
|
436
|
+
software_ids.each do |id|
|
437
|
+
data = {
|
438
|
+
registryId: id
|
439
|
+
}.cleanup
|
440
|
+
data_list << OpenStruct.new(data) unless data.empty?
|
441
|
+
end
|
442
|
+
tech_data << EnvSoftwareRegistry.new(array: data_list) unless data_list.empty?
|
443
|
+
end
|
444
|
+
# Hardware
|
445
|
+
if hardware_infos
|
446
|
+
data_list = []
|
447
|
+
hardware_infos.each do |hardware|
|
448
|
+
data = {
|
449
|
+
hardwareName: hardware[:name],
|
450
|
+
hardwareType: hardware[:type],
|
451
|
+
hardwareOtherInformation: hardware[:info],
|
452
|
+
}.cleanup
|
453
|
+
data_list << OpenStruct.new(data) unless data.empty?
|
454
|
+
end
|
455
|
+
tech_data << EnvironmentHardware.new(array: data_list) unless data_list.empty?
|
456
|
+
end
|
457
|
+
# Software
|
458
|
+
if software_infos
|
459
|
+
data_list = []
|
460
|
+
software_infos.each do |software|
|
461
|
+
data = {
|
462
|
+
softwareName: software[:name],
|
463
|
+
softwareVersion: software[:version],
|
464
|
+
softwareType: software[:type],
|
465
|
+
softwareOtherInformation: software[:info],
|
466
|
+
softwareDependancy: software[:dependency],
|
467
|
+
}.cleanup
|
468
|
+
data_list << OpenStruct.new(data) unless data.empty?
|
469
|
+
end
|
470
|
+
tech_data << EnvironmentSoftware.new(array: data_list) unless data_list.empty?
|
471
|
+
end
|
472
|
+
# Relationship
|
473
|
+
if relationship_infos
|
474
|
+
data_list = []
|
475
|
+
relationship_infos.each do |relationship|
|
476
|
+
data = {
|
477
|
+
relationshipType: relationship[:type],
|
478
|
+
relationshipSubType: relationship[:subtype],
|
479
|
+
relatedObjectIdentifierType1: relationship[:type1],
|
480
|
+
relatedObjectIdentifierValue1: relationship[:id1],
|
481
|
+
relatedObjectSequence1: relationship[:seq1],
|
482
|
+
relatedObjectIdentifierType2: relationship[:type2],
|
483
|
+
relatedObjectIdentifierValue2: relationship[:id2],
|
484
|
+
relatedObjectSequence2: relationship[:seq2],
|
485
|
+
relatedObjectIdentifierType3: relationship[:type3],
|
486
|
+
relatedObjectIdentifierValue3: relationship[:id3],
|
487
|
+
relatedObjectSequence3: relationship[:seq3],
|
488
|
+
}.cleanup
|
489
|
+
data_list << OpenStruct.new(data) unless data.empty?
|
490
|
+
end
|
491
|
+
tech_data << RelationShip.new(array: data_list) unless data_list.empty?
|
492
|
+
end
|
493
|
+
# Environment
|
494
|
+
if environments
|
495
|
+
data_list = []
|
496
|
+
environments.each do |environment|
|
497
|
+
data = {
|
498
|
+
environmentCharacteristic: environment[:characteristic],
|
499
|
+
environmentPurpose: environment[:purpose],
|
500
|
+
environmentNote: environment[:note],
|
501
|
+
}.cleanup
|
502
|
+
data_list << OpenStruct.new(data) unless data.empty?
|
503
|
+
end
|
504
|
+
tech_data << Environment.new(array: data_list) unless data_list.empty?
|
505
|
+
end
|
506
|
+
# Finally assemble technical section
|
507
|
+
dnx[:tech] = tech_data unless tech_data.empty?
|
508
|
+
# Rights section
|
509
|
+
rights_data = []
|
510
|
+
data = {
|
511
|
+
policyId: access_right_id
|
512
|
+
}.cleanup
|
513
|
+
rights_data << AccessRightsPolicy.new(data) unless data.empty?
|
514
|
+
dnx[:rights] = rights_data unless rights_data.empty?
|
515
|
+
# Source metadata
|
516
|
+
if source_metadata
|
517
|
+
source_metadata.each_with_index do |metadata, i|
|
518
|
+
dnx["source-#{metadata[:type].to_s.upcase}-#{i}"] = metadata[:data]
|
519
|
+
end
|
520
|
+
end
|
521
|
+
dnx
|
522
|
+
end
|
523
|
+
|
524
|
+
end
|
525
|
+
|
527
526
|
# Container class for creating a structmap in the METS.
|
528
527
|
class Map
|
529
528
|
include MetsObject
|
data/lib/libis/tools/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: libis-tools
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.17
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kris Dekeyser
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2023-08-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -386,7 +386,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
386
386
|
- !ruby/object:Gem::Version
|
387
387
|
version: '0'
|
388
388
|
requirements: []
|
389
|
-
rubygems_version: 3.
|
389
|
+
rubygems_version: 3.1.6
|
390
390
|
signing_key:
|
391
391
|
specification_version: 4
|
392
392
|
summary: LIBIS toolbox.
|