hydra-pbcore 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +17 -0
- data/.rvmrc +48 -0
- data/Gemfile +4 -0
- data/LICENSE +22 -0
- data/README.md +31 -0
- data/Rakefile +2 -0
- data/hydra-pbcore.gemspec +30 -0
- data/lib/hydra-pbcore.rb +18 -0
- data/lib/hydra-pbcore/behaviors.rb +60 -0
- data/lib/hydra-pbcore/datastream/digital_document.rb +269 -0
- data/lib/hydra-pbcore/datastream/document.rb +325 -0
- data/lib/hydra-pbcore/datastream/instantiation.rb +210 -0
- data/lib/hydra-pbcore/methods.rb +96 -0
- data/spec/digital_document_spec.rb +169 -0
- data/spec/document_spec.rb +189 -0
- data/spec/fixtures/pbcore_digital_document_template.xml +67 -0
- data/spec/fixtures/pbcore_document_template.xml +86 -0
- data/spec/fixtures/pbcore_instantiation_template.xml +62 -0
- data/spec/instantiation_spec.rb +134 -0
- data/spec/methods_spec.rb +63 -0
- data/spec/spec_helper.rb +21 -0
- metadata +235 -0
@@ -0,0 +1,67 @@
|
|
1
|
+
<?xml version="1.0"?>
|
2
|
+
<pbcoreDescriptionDocument xmlns="http://www.pbcore.org/PBCore/PBCoreNamespace.html" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.pbcore.org/PBCore/PBCoreNamespace.html">
|
3
|
+
<pbcoreIdentifier annotation="PID" source="Rock and Roll Hall of Fame and Museum"/>
|
4
|
+
<pbcoreTitle titleType="Main"/>
|
5
|
+
<pbcoreTitle titleType="Alternative">inserted</pbcoreTitle>
|
6
|
+
<pbcoreTitle titleType="Chapter">inserted</pbcoreTitle>
|
7
|
+
<pbcoreTitle titleType="Episode">inserted</pbcoreTitle>
|
8
|
+
<pbcoreTitle titleType="Label">inserted</pbcoreTitle>
|
9
|
+
<pbcoreTitle titleType="Segment">inserted</pbcoreTitle>
|
10
|
+
<pbcoreTitle titleType="Subtitle">inserted</pbcoreTitle>
|
11
|
+
<pbcoreTitle titleType="Track">inserted</pbcoreTitle>
|
12
|
+
<pbcoreTitle titleType="Translation">inserted</pbcoreTitle>
|
13
|
+
<pbcoreSubject source="Library of Congress Subject Headings" ref="http://id.loc.gov/authorities/subjects.html">inserted</pbcoreSubject>
|
14
|
+
<pbcoreSubject source="Library of Congress Name Authority File" ref="http://id.loc.gov/authorities/names">inserted</pbcoreSubject>
|
15
|
+
<pbcoreSubject source="Rock and Roll Hall of Fame and Museum">inserted</pbcoreSubject>
|
16
|
+
<pbcoreDescription descriptionType="Description" annotation="Summary" descriptionTypeSource="pbcoreDescription/descriptionType" descriptionTypeRef="http://pbcore.org/vocabularies/pbcoreDescription/descriptionType#description"/>
|
17
|
+
<pbcoreDescription descriptionType="Table of Contents" annotation="Parts List" descriptionTypeSource="pbcoreDescription/descriptionType" descriptionTypeRef="http://pbcore.org/vocabularies/pbcoreDescription/descriptionType#table-of-contents"/>
|
18
|
+
<pbcoreGenre source="The Getty Research Institute Art and Architecture Thesaurus" ref="http://www.getty.edu/research/tools/vocabularies/aat/index.html">inserted</pbcoreGenre>
|
19
|
+
<pbcoreGenre source="Library of Congress Genre/Form Terms" ref="http://id.loc.gov/authorities/genreForms.html">inserted</pbcoreGenre>
|
20
|
+
<pbcoreGenre source="Library of Congress Subject Headings" ref="http://id.loc.gov/authorities/subjects.html">inserted</pbcoreGenre>
|
21
|
+
<pbcoreRelation>
|
22
|
+
<pbcoreRelationType ref="http://pbcore.org/vocabularies/relationType#is-part-of" source="PBCore relationType">Is Part Of</pbcoreRelationType>
|
23
|
+
<pbcoreRelationIdentifier annotation="Event Series"/>
|
24
|
+
</pbcoreRelation>
|
25
|
+
<pbcoreRelation>
|
26
|
+
<pbcoreRelationType ref="http://pbcore.org/vocabularies/relationType#is-part-of" source="PBCore relationType">Is Part Of</pbcoreRelationType>
|
27
|
+
<pbcoreRelationIdentifier annotation="Archival Collection"/>
|
28
|
+
</pbcoreRelation>
|
29
|
+
<pbcoreRelation>
|
30
|
+
<pbcoreRelationType ref="http://pbcore.org/vocabularies/relationType#is-part-of" source="PBCore relationType">Is Part Of</pbcoreRelationType>
|
31
|
+
<pbcoreRelationIdentifier annotation="Archival Series"/>
|
32
|
+
</pbcoreRelation>
|
33
|
+
<pbcoreRelation>
|
34
|
+
<pbcoreRelationType ref="http://pbcore.org/vocabularies/relationType#is-part-of" source="PBCore relationType">Is Part Of</pbcoreRelationType>
|
35
|
+
<pbcoreRelationIdentifier annotation="Collection Number"/>
|
36
|
+
</pbcoreRelation>
|
37
|
+
<pbcoreRelation>
|
38
|
+
<pbcoreRelationType ref="http://pbcore.org/vocabularies/relationType#is-part-of" source="PBCore relationType">Is Part Of</pbcoreRelationType>
|
39
|
+
<pbcoreRelationIdentifier annotation="Accession Number"/>
|
40
|
+
</pbcoreRelation>
|
41
|
+
<pbcoreCoverage>
|
42
|
+
<coverage annotation="Event Place"/>
|
43
|
+
<coverageType>Spatial</coverageType>
|
44
|
+
</pbcoreCoverage>
|
45
|
+
<pbcoreCoverage>
|
46
|
+
<coverage annotation="Event Date"/>
|
47
|
+
<coverageType>Temporal</coverageType>
|
48
|
+
</pbcoreCoverage>
|
49
|
+
<pbcoreContributor>
|
50
|
+
<contributor/>
|
51
|
+
<contributorRole source="MARC relator terms"/>
|
52
|
+
</pbcoreContributor>
|
53
|
+
<pbcoreContributor>
|
54
|
+
<contributor/>
|
55
|
+
<contributorRole source="MARC relator terms"/>
|
56
|
+
</pbcoreContributor>
|
57
|
+
<pbcorePublisher>
|
58
|
+
<publisher/>
|
59
|
+
<publisherRole source="PBCore publisherRole"/>
|
60
|
+
</pbcorePublisher>
|
61
|
+
<pbcorePublisher>
|
62
|
+
<publisher/>
|
63
|
+
<publisherRole source="PBCore publisherRole"/>
|
64
|
+
</pbcorePublisher>
|
65
|
+
<pbcoreRightsSummary/>
|
66
|
+
<pbcoreAnnotation annotationType="Notes"/>
|
67
|
+
</pbcoreDescriptionDocument>
|
@@ -0,0 +1,86 @@
|
|
1
|
+
<?xml version="1.0"?>
|
2
|
+
<pbcoreDescriptionDocument xmlns="http://www.pbcore.org/PBCore/PBCoreNamespace.html" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.pbcore.org/PBCore/PBCoreNamespace.html">
|
3
|
+
<pbcoreIdentifier annotation="PID" source="Rock and Roll Hall of Fame and Museum"/>
|
4
|
+
<pbcoreTitle titleType="Main"/>
|
5
|
+
<pbcoreTitle titleType="Alternative">inserted</pbcoreTitle>
|
6
|
+
<pbcoreTitle titleType="Chapter">inserted</pbcoreTitle>
|
7
|
+
<pbcoreTitle titleType="Episode">inserted</pbcoreTitle>
|
8
|
+
<pbcoreTitle titleType="Label">inserted</pbcoreTitle>
|
9
|
+
<pbcoreTitle titleType="Segment">inserted</pbcoreTitle>
|
10
|
+
<pbcoreTitle titleType="Subtitle">inserted</pbcoreTitle>
|
11
|
+
<pbcoreTitle titleType="Track">inserted</pbcoreTitle>
|
12
|
+
<pbcoreTitle titleType="Translation">inserted</pbcoreTitle>
|
13
|
+
<pbcoreSubject source="Library of Congress Subject Headings" ref="http://id.loc.gov/authorities/subjects.html">inserted</pbcoreSubject>
|
14
|
+
<pbcoreSubject source="Library of Congress Name Authority File" ref="http://id.loc.gov/authorities/names">inserted</pbcoreSubject>
|
15
|
+
<pbcoreSubject source="Rock and Roll Hall of Fame and Museum">inserted</pbcoreSubject>
|
16
|
+
<pbcoreDescription descriptionType="Description" annotation="Summary" descriptionTypeSource="pbcoreDescription/descriptionType" descriptionTypeRef="http://pbcore.org/vocabularies/pbcoreDescription/descriptionType#description"/>
|
17
|
+
<pbcoreDescription descriptionType="Table of Contents" annotation="Parts List" descriptionTypeSource="pbcoreDescription/descriptionType" descriptionTypeRef="http://pbcore.org/vocabularies/pbcoreDescription/descriptionType#table-of-contents"/>
|
18
|
+
<pbcoreGenre source="The Getty Research Institute Art and Architecture Thesaurus" ref="http://www.getty.edu/research/tools/vocabularies/aat/index.html">inserted</pbcoreGenre>
|
19
|
+
<pbcoreGenre source="Library of Congress Genre/Form Terms" ref="http://id.loc.gov/authorities/genreForms.html">inserted</pbcoreGenre>
|
20
|
+
<pbcoreGenre source="Library of Congress Subject Headings" ref="http://id.loc.gov/authorities/subjects.html">inserted</pbcoreGenre>
|
21
|
+
<pbcoreRelation>
|
22
|
+
<pbcoreRelationType ref="http://pbcore.org/vocabularies/relationType#is-part-of" source="PBCore relationType">Is Part Of</pbcoreRelationType>
|
23
|
+
<pbcoreRelationIdentifier annotation="Event Series"/>
|
24
|
+
</pbcoreRelation>
|
25
|
+
<pbcoreCoverage>
|
26
|
+
<coverage annotation="Event Place"/>
|
27
|
+
<coverageType>Spatial</coverageType>
|
28
|
+
</pbcoreCoverage>
|
29
|
+
<pbcoreCoverage>
|
30
|
+
<coverage annotation="Event Date"/>
|
31
|
+
<coverageType>Temporal</coverageType>
|
32
|
+
</pbcoreCoverage>
|
33
|
+
<pbcoreContributor>
|
34
|
+
<contributor/>
|
35
|
+
<contributorRole source="MARC relator terms"/>
|
36
|
+
</pbcoreContributor>
|
37
|
+
<pbcoreContributor>
|
38
|
+
<contributor/>
|
39
|
+
<contributorRole source="MARC relator terms"/>
|
40
|
+
</pbcoreContributor>
|
41
|
+
<pbcorePublisher>
|
42
|
+
<publisher/>
|
43
|
+
<publisherRole source="PBCore publisherRole"/>
|
44
|
+
</pbcorePublisher>
|
45
|
+
<pbcorePublisher>
|
46
|
+
<publisher/>
|
47
|
+
<publisherRole source="PBCore publisherRole"/>
|
48
|
+
</pbcorePublisher>
|
49
|
+
<pbcoreInstantiation>
|
50
|
+
<instantiationIdentifier annotation="Barcode" source="Rock and Roll Hall of Fame and Museum"/>
|
51
|
+
<instantiationDate dateType="created"/>
|
52
|
+
<instantiationPhysical source="PBCore instantiationPhysical"/>
|
53
|
+
<instantiationStandard/>
|
54
|
+
<instantiationLocation>Rock and Roll Hall of Fame and Museum,
|
55
|
+
2809 Woodland Ave.,
|
56
|
+
Cleveland, OH, 44115
|
57
|
+
216-515-1956
|
58
|
+
library@rockhall.org</instantiationLocation>
|
59
|
+
<instantiationMediaType source="PBCore instantiationMediaType">Moving image</instantiationMediaType>
|
60
|
+
<instantiationGenerations source="PBCore instantiationGenerations">Original</instantiationGenerations>
|
61
|
+
<instantiationColors>Color</instantiationColors>
|
62
|
+
<instantiationLanguage source="ISO 639.2" ref="http://www.loc.gov/standards/iso639-2/php/code_list.php">eng</instantiationLanguage>
|
63
|
+
<instantiationRelation>
|
64
|
+
<instantiationRelationType ref="http://pbcore.org/vocabularies/relationType#is-part-of" source="PBCore relationType">Is Part Of</instantiationRelationType>
|
65
|
+
<instantiationRelationIdentifier annotation="Archival Collection"/>
|
66
|
+
</instantiationRelation>
|
67
|
+
<instantiationRelation>
|
68
|
+
<instantiationRelationType ref="http://pbcore.org/vocabularies/relationType#is-part-of" source="PBCore relationType">Is Part Of</instantiationRelationType>
|
69
|
+
<instantiationRelationIdentifier annotation="Archival Series"/>
|
70
|
+
</instantiationRelation>
|
71
|
+
<instantiationRelation>
|
72
|
+
<instantiationRelationType ref="http://pbcore.org/vocabularies/relationType#is-part-of" source="PBCore relationType">Is Part Of</instantiationRelationType>
|
73
|
+
<instantiationRelationIdentifier annotation="Collection Number"/>
|
74
|
+
</instantiationRelation>
|
75
|
+
<instantiationRelation>
|
76
|
+
<instantiationRelationType ref="http://pbcore.org/vocabularies/relationType#is-part-of" source="PBCore relationType">Is Part Of</instantiationRelationType>
|
77
|
+
<instantiationRelationIdentifier annotation="Accession Number"/>
|
78
|
+
</instantiationRelation>
|
79
|
+
<instantiationRights>
|
80
|
+
<rightsSummary/>
|
81
|
+
</instantiationRights>
|
82
|
+
<instantiationAnnotation annotationType="Condition Notes">inserted</instantiationAnnotation>
|
83
|
+
<instantiationAnnotation annotationType="Cleaning Notes">inserted</instantiationAnnotation>
|
84
|
+
</pbcoreInstantiation>
|
85
|
+
<pbcoreAnnotation annotationType="Notes"/>
|
86
|
+
</pbcoreDescriptionDocument>
|
@@ -0,0 +1,62 @@
|
|
1
|
+
<?xml version="1.0"?>
|
2
|
+
<pbcoreDescriptionDocument xmlns="http://www.pbcore.org/PBCore/PBCoreNamespace.html" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.pbcore.org/PBCore/PBCoreNamespace.html">
|
3
|
+
<pbcoreIdentifier annotation="PID" source="Rock and Roll Hall of Fame and Museum"/>
|
4
|
+
<pbcoreTitle/>
|
5
|
+
<pbcoreDescription/>
|
6
|
+
<pbcoreInstantiation>
|
7
|
+
<instantiationIdentifier annotation="Filename" source="Rock and Roll Hall of Fame and Museum"/>
|
8
|
+
<instantiationDate dateType="created"/>
|
9
|
+
<instantiationDigital source="EBU file formats"/>
|
10
|
+
<instantiationStandard>inserted</instantiationStandard>
|
11
|
+
<instantiationLocation/>
|
12
|
+
<instantiationMediaType source="PBCore instantiationMediaType">Moving image</instantiationMediaType>
|
13
|
+
<instantiationGenerations source="PBCore instantiationGenerations"/>
|
14
|
+
<instantiationFileSize unitsOfMeasure=""/>
|
15
|
+
<instantiationDuration/>
|
16
|
+
<instantiationColors source="PBCore instantiationColors">Color</instantiationColors>
|
17
|
+
<instantiationLanguage source="ISO 639.2" ref="http://www.loc.gov/standards/iso639-2/php/code_list.php">inserted</instantiationLanguage>
|
18
|
+
<instantiationEssenceTrack>
|
19
|
+
<essenceTrackType>Video</essenceTrackType>
|
20
|
+
<essenceTrackStandard/>
|
21
|
+
<essenceTrackEncoding source="PBCore essenceTrackEncoding"/>
|
22
|
+
<essenceTrackDataRate unitsOfMeasure=""/>
|
23
|
+
<essenceTrackFrameRate unitsOfMeasure="fps"/>
|
24
|
+
<essenceTrackBitDepth/>
|
25
|
+
<essenceTrackFrameSize source="PBCore essenceTrackFrameSize"/>
|
26
|
+
<essenceTrackAspectRatio source="PBCore essenceTrackAspectRatio"/>
|
27
|
+
</instantiationEssenceTrack>
|
28
|
+
<instantiationEssenceTrack>
|
29
|
+
<essenceTrackType>Audio</essenceTrackType>
|
30
|
+
<essenceTrackStandard/>
|
31
|
+
<essenceTrackEncoding source="PBCore essenceTrackEncoding"/>
|
32
|
+
<essenceTrackDataRate unitsOfMeasure=""/>
|
33
|
+
<essenceTrackSamplingRate unitsOfMeasure=""/>
|
34
|
+
<essenceTrackBitDepth/>
|
35
|
+
<essenceTrackAnnotation annotationType="Number of Audio Channels"/>
|
36
|
+
</instantiationEssenceTrack>
|
37
|
+
<instantiationRelation>
|
38
|
+
<instantiationRelationType annotation="One of a multi-part instantiation">Follows in Sequence</instantiationRelationType>
|
39
|
+
<instantiationRelationIdentifier source="Rock and Roll Hall of Fame and Museum">inserted</instantiationRelationIdentifier>
|
40
|
+
</instantiationRelation>
|
41
|
+
<instantiationRelation>
|
42
|
+
<instantiationRelationType annotation="One of a multi-part instantiation">Precedes in Sequence</instantiationRelationType>
|
43
|
+
<instantiationRelationIdentifier source="Rock and Roll Hall of Fame and Museum">inserted</instantiationRelationIdentifier>
|
44
|
+
</instantiationRelation>
|
45
|
+
<instantiationRights>
|
46
|
+
<rightsSummary/>
|
47
|
+
</instantiationRights>
|
48
|
+
<instantiationAnnotation annotationType="Checksum Type">inserted</instantiationAnnotation>
|
49
|
+
<instantiationAnnotation annotationType="Checksum Value">inserted</instantiationAnnotation>
|
50
|
+
<instantiationAnnotation annotationType="Playback Device">inserted</instantiationAnnotation>
|
51
|
+
<instantiationAnnotation annotationType="Capture Software">inserted</instantiationAnnotation>
|
52
|
+
<instantiationAnnotation annotationType="Transcoding Software">inserted</instantiationAnnotation>
|
53
|
+
<instantiationAnnotation annotationType="Operator">inserted</instantiationAnnotation>
|
54
|
+
<instantiationAnnotation annotationType="Transfer Notes">inserted</instantiationAnnotation>
|
55
|
+
<instantiationAnnotation annotationType="Vendor Name">inserted</instantiationAnnotation>
|
56
|
+
<instantiationAnnotation annotationType="Condition Notes">inserted</instantiationAnnotation>
|
57
|
+
<instantiationAnnotation annotationType="Cleaning Notes">inserted</instantiationAnnotation>
|
58
|
+
<instantiationAnnotation annotationType="Notes">inserted</instantiationAnnotation>
|
59
|
+
<instantiationAnnotation annotationType="Color Space">inserted</instantiationAnnotation>
|
60
|
+
<instantiationAnnotation annotationType="Chroma">inserted</instantiationAnnotation>
|
61
|
+
</pbcoreInstantiation>
|
62
|
+
</pbcoreDescriptionDocument>
|
@@ -0,0 +1,134 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe HydraPbcore::Datastream::Instantiation do
|
4
|
+
|
5
|
+
before(:each) do
|
6
|
+
@object_ds = HydraPbcore::Datastream::Instantiation.new(nil, nil)
|
7
|
+
end
|
8
|
+
|
9
|
+
describe ".update_indexed_attributes" do
|
10
|
+
it "should update all of the fields in #xml_template and fields not requiring additional inserted nodes" do
|
11
|
+
[
|
12
|
+
[:name],
|
13
|
+
[:location],
|
14
|
+
[:date],
|
15
|
+
[:generation],
|
16
|
+
[:media_type],
|
17
|
+
[:file_format],
|
18
|
+
[:size],
|
19
|
+
[:size_units],
|
20
|
+
[:colors],
|
21
|
+
[:duration],
|
22
|
+
[:rights_summary],
|
23
|
+
[:note],
|
24
|
+
[:checksum_type],
|
25
|
+
[:checksum_value],
|
26
|
+
[:device],
|
27
|
+
[:capture_soft],
|
28
|
+
[:trans_soft],
|
29
|
+
[:operator],
|
30
|
+
[:trans_note],
|
31
|
+
[:vendor],
|
32
|
+
[:condition],
|
33
|
+
[:cleaning],
|
34
|
+
[:color_space],
|
35
|
+
[:chroma],
|
36
|
+
[:video_standard],
|
37
|
+
[:video_encoding],
|
38
|
+
[:video_bit_rate],
|
39
|
+
[:video_bit_rate_units],
|
40
|
+
[:frame_rate],
|
41
|
+
[:frame_size],
|
42
|
+
[:video_bit_depth],
|
43
|
+
[:aspect_ratio],
|
44
|
+
[:audio_standard],
|
45
|
+
[:audio_encoding],
|
46
|
+
[:audio_bit_rate],
|
47
|
+
[:audio_bit_rate_units],
|
48
|
+
[:audio_sample_rate],
|
49
|
+
[:audio_sample_rate_units],
|
50
|
+
[:audio_bit_depth],
|
51
|
+
[:audio_channels],
|
52
|
+
].each do |pointer|
|
53
|
+
test_val = "#{pointer.last.to_s} value"
|
54
|
+
@object_ds.update_indexed_attributes( {pointer=>{"0"=>test_val}} )
|
55
|
+
@object_ds.get_values(pointer).first.should == test_val
|
56
|
+
@object_ds.get_values(pointer).length.should == 1
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
describe "default fields" do
|
62
|
+
|
63
|
+
it "like media type should be 'Moving image'" do
|
64
|
+
@object_ds.get_values([:media_type]).first.should == "Moving image"
|
65
|
+
end
|
66
|
+
|
67
|
+
it "like colors should be 'Color'" do
|
68
|
+
@object_ds.get_values([:colors]).first.should == "Color"
|
69
|
+
end
|
70
|
+
|
71
|
+
end
|
72
|
+
|
73
|
+
describe "#xml_template" do
|
74
|
+
it "should return an empty xml document matching an exmplar" do
|
75
|
+
|
76
|
+
# insert optional fields
|
77
|
+
@object_ds.update_indexed_attributes({ [:checksum_type] => { 0 => "inserted" }} )
|
78
|
+
@object_ds.update_indexed_attributes({ [:note] => { 0 => "inserted" }} )
|
79
|
+
@object_ds.update_indexed_attributes({ [:checksum_value] => { 0 => "inserted" }} )
|
80
|
+
@object_ds.update_indexed_attributes({ [:device] => { 0 => "inserted" }} )
|
81
|
+
@object_ds.update_indexed_attributes({ [:capture_soft] => { 0 => "inserted" }} )
|
82
|
+
@object_ds.update_indexed_attributes({ [:trans_soft] => { 0 => "inserted" }} )
|
83
|
+
@object_ds.update_indexed_attributes({ [:operator] => { 0 => "inserted" }} )
|
84
|
+
@object_ds.update_indexed_attributes({ [:trans_note] => { 0 => "inserted" }} )
|
85
|
+
@object_ds.update_indexed_attributes({ [:vendor] => { 0 => "inserted" }} )
|
86
|
+
@object_ds.update_indexed_attributes({ [:condition] => { 0 => "inserted" }} )
|
87
|
+
@object_ds.update_indexed_attributes({ [:cleaning] => { 0 => "inserted" }} )
|
88
|
+
@object_ds.update_indexed_attributes({ [:color_space] => { 0 => "inserted" }} )
|
89
|
+
@object_ds.update_indexed_attributes({ [:chroma] => { 0 => "inserted" }} )
|
90
|
+
@object_ds.update_indexed_attributes({ [:standard] => { 0 => "inserted" }} )
|
91
|
+
@object_ds.update_indexed_attributes({ [:language] => { 0 => "inserted" }} )
|
92
|
+
|
93
|
+
# insert optional nodes and set to sample values
|
94
|
+
@object_ds.insert_node("next", {:root => "pbcoreInstantiation"})
|
95
|
+
@object_ds.insert_node("previous", {:root => "pbcoreInstantiation"})
|
96
|
+
@object_ds.update_indexed_attributes({ [:next] => { 0 => "inserted" }} )
|
97
|
+
@object_ds.update_indexed_attributes({ [:previous] => { 0 => "inserted" }} )
|
98
|
+
|
99
|
+
# Load example fixture
|
100
|
+
f = fixture "pbcore_instantiation_template.xml"
|
101
|
+
ref_node = Nokogiri::XML(f)
|
102
|
+
f.close
|
103
|
+
|
104
|
+
# Nokogiri-fy our sample document and add in namespace
|
105
|
+
sample_node = Nokogiri::XML(@object_ds.to_xml)
|
106
|
+
with_namespace = HydraPbcore::Behaviors.insert_pbcore_namespace(sample_node)
|
107
|
+
|
108
|
+
# Save this for later...
|
109
|
+
out = File.new("tmp/pbcore_instantiation_sample.xml", "w")
|
110
|
+
out.write(with_namespace.to_s)
|
111
|
+
out.close
|
112
|
+
|
113
|
+
EquivalentXml.equivalent?(ref_node, with_namespace, opts = { :element_order => false, :normalize_whitespace => true }).should be_true
|
114
|
+
|
115
|
+
# TODO: reorder nodes on the instantiaion
|
116
|
+
#Rockhall::Pbcore.validate(with_namespace).should be_empty
|
117
|
+
end
|
118
|
+
end
|
119
|
+
|
120
|
+
describe "essence fields" do
|
121
|
+
|
122
|
+
it "shoud have different essenceTrackStandard nodes" do
|
123
|
+
|
124
|
+
# Standard
|
125
|
+
@object_ds.update_indexed_attributes({ [:video_standard] => { 0 => "video standard" }} )
|
126
|
+
@object_ds.update_indexed_attributes({ [:audio_standard] => { 0 => "audio standard" }} )
|
127
|
+
@object_ds.get_values([{:pbcoreInstantiation=>0}, {:instantiationEssenceTrack=>0}, :essenceTrackStandard]).first.should == "video standard"
|
128
|
+
@object_ds.get_values([{:pbcoreInstantiation=>0}, {:instantiationEssenceTrack=>1}, :essenceTrackStandard]).first.should == "audio standard"
|
129
|
+
|
130
|
+
end
|
131
|
+
|
132
|
+
end
|
133
|
+
|
134
|
+
end
|
@@ -0,0 +1,63 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe HydraPbcore::Methods do
|
4
|
+
|
5
|
+
before(:all) do
|
6
|
+
class MethodTest < ActiveFedora::NokogiriDatastream
|
7
|
+
include HydraPbcore::Methods
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
11
|
+
describe "#contributor_template" do
|
12
|
+
it "should insert a contributor xml template" do
|
13
|
+
xml = '
|
14
|
+
<pbcoreContributor>
|
15
|
+
<contributor/>
|
16
|
+
<contributorRole source="MARC relator terms"/>
|
17
|
+
</pbcoreContributor>
|
18
|
+
'
|
19
|
+
node = MethodTest.contributor_template
|
20
|
+
EquivalentXml.equivalent?(xml, node.to_xml, opts = { :element_order => false, :normalize_whitespace => true }).should be_true
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
describe "#publisher_template" do
|
25
|
+
it "should insert a publisher xml template" do
|
26
|
+
xml = '
|
27
|
+
<pbcorePublisher>
|
28
|
+
<publisher/>
|
29
|
+
<publisherRole source="PBCore publisherRole"/>
|
30
|
+
</pbcorePublisher>
|
31
|
+
'
|
32
|
+
node = MethodTest.publisher_template
|
33
|
+
EquivalentXml.equivalent?(xml, node.to_xml, opts = { :element_order => false, :normalize_whitespace => true }).should be_true
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
describe "#previous_template" do
|
38
|
+
it "should insert a instantiation relationship xml template" do
|
39
|
+
xml = '
|
40
|
+
<instantiationRelation>
|
41
|
+
<instantiationRelationType annotation="One of a multi-part instantiation">Follows in Sequence</instantiationRelationType>
|
42
|
+
<instantiationRelationIdentifier source="Rock and Roll Hall of Fame and Museum"/>
|
43
|
+
</instantiationRelation>
|
44
|
+
'
|
45
|
+
node = MethodTest.previous_template
|
46
|
+
EquivalentXml.equivalent?(xml, node.to_xml, opts = { :element_order => false, :normalize_whitespace => true }).should be_true
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
describe "#next_template" do
|
51
|
+
it "should insert a instantiation relationship xml template" do
|
52
|
+
xml = '
|
53
|
+
<instantiationRelation>
|
54
|
+
<instantiationRelationType annotation="One of a multi-part instantiation">Precedes in Sequence</instantiationRelationType>
|
55
|
+
<instantiationRelationIdentifier source="Rock and Roll Hall of Fame and Museum"/>
|
56
|
+
</instantiationRelation>
|
57
|
+
'
|
58
|
+
node = MethodTest.next_template
|
59
|
+
EquivalentXml.equivalent?(xml, node.to_xml, opts = { :element_order => false, :normalize_whitespace => true }).should be_true
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
# :nodoc
|
2
|
+
require "hydra-pbcore"
|
3
|
+
require "debugger"
|
4
|
+
require "equivalent-xml"
|
5
|
+
|
6
|
+
RSpec.configure do |config|
|
7
|
+
|
8
|
+
# == Mock Framework
|
9
|
+
# Note: we're not mocking... yet.
|
10
|
+
# config.mock_with :mocha
|
11
|
+
# config.mock_with :flexmock
|
12
|
+
# config.mock_with :rr
|
13
|
+
#config.mock_with :rspec
|
14
|
+
|
15
|
+
config.color = true
|
16
|
+
|
17
|
+
end
|
18
|
+
|
19
|
+
def fixture(file) #:nodoc
|
20
|
+
File.new(File.join(File.dirname(__FILE__), 'fixtures', file))
|
21
|
+
end
|
metadata
ADDED
@@ -0,0 +1,235 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: hydra-pbcore
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Adam Wead
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2012-10-18 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: nokogiri
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '0'
|
22
|
+
type: :runtime
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ! '>='
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '0'
|
30
|
+
- !ruby/object:Gem::Dependency
|
31
|
+
name: om
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
33
|
+
none: false
|
34
|
+
requirements:
|
35
|
+
- - ! '>='
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: '0'
|
38
|
+
type: :runtime
|
39
|
+
prerelease: false
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ! '>='
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: '0'
|
46
|
+
- !ruby/object:Gem::Dependency
|
47
|
+
name: active-fedora
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
49
|
+
none: false
|
50
|
+
requirements:
|
51
|
+
- - ! '>='
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: '0'
|
54
|
+
type: :runtime
|
55
|
+
prerelease: false
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
58
|
+
requirements:
|
59
|
+
- - ! '>='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
- !ruby/object:Gem::Dependency
|
63
|
+
name: solrizer
|
64
|
+
requirement: !ruby/object:Gem::Requirement
|
65
|
+
none: false
|
66
|
+
requirements:
|
67
|
+
- - ! '>='
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: '0'
|
70
|
+
type: :runtime
|
71
|
+
prerelease: false
|
72
|
+
version_requirements: !ruby/object:Gem::Requirement
|
73
|
+
none: false
|
74
|
+
requirements:
|
75
|
+
- - ! '>='
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: '0'
|
78
|
+
- !ruby/object:Gem::Dependency
|
79
|
+
name: yard
|
80
|
+
requirement: !ruby/object:Gem::Requirement
|
81
|
+
none: false
|
82
|
+
requirements:
|
83
|
+
- - ! '>='
|
84
|
+
- !ruby/object:Gem::Version
|
85
|
+
version: '0'
|
86
|
+
type: :development
|
87
|
+
prerelease: false
|
88
|
+
version_requirements: !ruby/object:Gem::Requirement
|
89
|
+
none: false
|
90
|
+
requirements:
|
91
|
+
- - ! '>='
|
92
|
+
- !ruby/object:Gem::Version
|
93
|
+
version: '0'
|
94
|
+
- !ruby/object:Gem::Dependency
|
95
|
+
name: redcarpet
|
96
|
+
requirement: !ruby/object:Gem::Requirement
|
97
|
+
none: false
|
98
|
+
requirements:
|
99
|
+
- - ! '>='
|
100
|
+
- !ruby/object:Gem::Version
|
101
|
+
version: '0'
|
102
|
+
type: :development
|
103
|
+
prerelease: false
|
104
|
+
version_requirements: !ruby/object:Gem::Requirement
|
105
|
+
none: false
|
106
|
+
requirements:
|
107
|
+
- - ! '>='
|
108
|
+
- !ruby/object:Gem::Version
|
109
|
+
version: '0'
|
110
|
+
- !ruby/object:Gem::Dependency
|
111
|
+
name: rspec
|
112
|
+
requirement: !ruby/object:Gem::Requirement
|
113
|
+
none: false
|
114
|
+
requirements:
|
115
|
+
- - ! '>='
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '0'
|
118
|
+
type: :development
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
none: false
|
122
|
+
requirements:
|
123
|
+
- - ! '>='
|
124
|
+
- !ruby/object:Gem::Version
|
125
|
+
version: '0'
|
126
|
+
- !ruby/object:Gem::Dependency
|
127
|
+
name: debugger
|
128
|
+
requirement: !ruby/object:Gem::Requirement
|
129
|
+
none: false
|
130
|
+
requirements:
|
131
|
+
- - ! '>='
|
132
|
+
- !ruby/object:Gem::Version
|
133
|
+
version: '0'
|
134
|
+
type: :development
|
135
|
+
prerelease: false
|
136
|
+
version_requirements: !ruby/object:Gem::Requirement
|
137
|
+
none: false
|
138
|
+
requirements:
|
139
|
+
- - ! '>='
|
140
|
+
- !ruby/object:Gem::Version
|
141
|
+
version: '0'
|
142
|
+
- !ruby/object:Gem::Dependency
|
143
|
+
name: rdoc
|
144
|
+
requirement: !ruby/object:Gem::Requirement
|
145
|
+
none: false
|
146
|
+
requirements:
|
147
|
+
- - ! '>='
|
148
|
+
- !ruby/object:Gem::Version
|
149
|
+
version: '0'
|
150
|
+
type: :development
|
151
|
+
prerelease: false
|
152
|
+
version_requirements: !ruby/object:Gem::Requirement
|
153
|
+
none: false
|
154
|
+
requirements:
|
155
|
+
- - ! '>='
|
156
|
+
- !ruby/object:Gem::Version
|
157
|
+
version: '0'
|
158
|
+
- !ruby/object:Gem::Dependency
|
159
|
+
name: equivalent-xml
|
160
|
+
requirement: !ruby/object:Gem::Requirement
|
161
|
+
none: false
|
162
|
+
requirements:
|
163
|
+
- - ! '>='
|
164
|
+
- !ruby/object:Gem::Version
|
165
|
+
version: '0'
|
166
|
+
type: :development
|
167
|
+
prerelease: false
|
168
|
+
version_requirements: !ruby/object:Gem::Requirement
|
169
|
+
none: false
|
170
|
+
requirements:
|
171
|
+
- - ! '>='
|
172
|
+
- !ruby/object:Gem::Version
|
173
|
+
version: '0'
|
174
|
+
description: A Hydra gem that offers PBCore datastream definitions using OM
|
175
|
+
email:
|
176
|
+
- amsterdamos@gmail.com
|
177
|
+
executables: []
|
178
|
+
extensions: []
|
179
|
+
extra_rdoc_files: []
|
180
|
+
files:
|
181
|
+
- .gitignore
|
182
|
+
- .rvmrc
|
183
|
+
- Gemfile
|
184
|
+
- LICENSE
|
185
|
+
- README.md
|
186
|
+
- Rakefile
|
187
|
+
- hydra-pbcore.gemspec
|
188
|
+
- lib/hydra-pbcore.rb
|
189
|
+
- lib/hydra-pbcore/behaviors.rb
|
190
|
+
- lib/hydra-pbcore/datastream/digital_document.rb
|
191
|
+
- lib/hydra-pbcore/datastream/document.rb
|
192
|
+
- lib/hydra-pbcore/datastream/instantiation.rb
|
193
|
+
- lib/hydra-pbcore/methods.rb
|
194
|
+
- spec/digital_document_spec.rb
|
195
|
+
- spec/document_spec.rb
|
196
|
+
- spec/fixtures/pbcore_digital_document_template.xml
|
197
|
+
- spec/fixtures/pbcore_document_template.xml
|
198
|
+
- spec/fixtures/pbcore_instantiation_template.xml
|
199
|
+
- spec/instantiation_spec.rb
|
200
|
+
- spec/methods_spec.rb
|
201
|
+
- spec/spec_helper.rb
|
202
|
+
homepage: ''
|
203
|
+
licenses: []
|
204
|
+
post_install_message:
|
205
|
+
rdoc_options: []
|
206
|
+
require_paths:
|
207
|
+
- lib
|
208
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
209
|
+
none: false
|
210
|
+
requirements:
|
211
|
+
- - ! '>='
|
212
|
+
- !ruby/object:Gem::Version
|
213
|
+
version: '0'
|
214
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
215
|
+
none: false
|
216
|
+
requirements:
|
217
|
+
- - ! '>='
|
218
|
+
- !ruby/object:Gem::Version
|
219
|
+
version: '0'
|
220
|
+
requirements: []
|
221
|
+
rubyforge_project:
|
222
|
+
rubygems_version: 1.8.24
|
223
|
+
signing_key:
|
224
|
+
specification_version: 3
|
225
|
+
summary: A Hydra gem that offers PBCore datastream definitions using OM
|
226
|
+
test_files:
|
227
|
+
- spec/digital_document_spec.rb
|
228
|
+
- spec/document_spec.rb
|
229
|
+
- spec/fixtures/pbcore_digital_document_template.xml
|
230
|
+
- spec/fixtures/pbcore_document_template.xml
|
231
|
+
- spec/fixtures/pbcore_instantiation_template.xml
|
232
|
+
- spec/instantiation_spec.rb
|
233
|
+
- spec/methods_spec.rb
|
234
|
+
- spec/spec_helper.rb
|
235
|
+
has_rdoc:
|