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
data/.gitignore
CHANGED
data/Rakefile
CHANGED
data/lib/hydra-pbcore.rb
CHANGED
@@ -5,15 +5,74 @@ require "om"
|
|
5
5
|
require "active-fedora"
|
6
6
|
|
7
7
|
module HydraPbcore
|
8
|
+
|
9
|
+
DocumentNodes = [
|
10
|
+
"pbcoreAssetType",
|
11
|
+
"pbcoreAssetDate",
|
12
|
+
"pbcoreIdentifier",
|
13
|
+
"pbcoreTitle",
|
14
|
+
"pbcoreSubject",
|
15
|
+
"pbcoreDescription",
|
16
|
+
"pbcoreGenre",
|
17
|
+
"pbcoreRelation",
|
18
|
+
"pbcoreCoverage",
|
19
|
+
"pbcoreAudienceLevel",
|
20
|
+
"pbcoreAudienceRating",
|
21
|
+
"pbcoreCreator",
|
22
|
+
"pbcoreContributor",
|
23
|
+
"pbcorePublisher",
|
24
|
+
"pbcoreRightsSummary",
|
25
|
+
"pbcoreInstantiation",
|
26
|
+
"pbcoreAnnotation",
|
27
|
+
"pbcorePart",
|
28
|
+
"pbcoreExtension",
|
29
|
+
]
|
30
|
+
|
31
|
+
InstantiationNodes = [
|
32
|
+
"instantiationIdentifier",
|
33
|
+
"instantiationDate",
|
34
|
+
"instantiationDimensions",
|
35
|
+
"instantiationPhysical",
|
36
|
+
"instantiationDigital",
|
37
|
+
"instantiationStandard",
|
38
|
+
"instantiationLocation",
|
39
|
+
"instantiationMediaType",
|
40
|
+
"instantiationGenerations",
|
41
|
+
"instantiationFileSize",
|
42
|
+
"instantiationTimeStart",
|
43
|
+
"instantiationDuration",
|
44
|
+
"instantiationDataRate",
|
45
|
+
"instantiationColors",
|
46
|
+
"instantiationTracks",
|
47
|
+
"instantiationChannelConfiguration",
|
48
|
+
"instantiationLanguage",
|
49
|
+
"instantiationAlternativeModes",
|
50
|
+
"instantiationEssenceTrack",
|
51
|
+
"instantiationRelation",
|
52
|
+
"instantiationRights",
|
53
|
+
"instantiationAnnotation",
|
54
|
+
"instantiationPart",
|
55
|
+
"instantiationExtension",
|
56
|
+
]
|
57
|
+
|
8
58
|
def self.version
|
9
59
|
HydraPbcore::VERSION
|
10
60
|
end
|
61
|
+
|
62
|
+
# Returns a blank pbccoreDocument
|
63
|
+
def self.blank
|
64
|
+
xml = '<?xml version="1.0"?><pbcoreDescriptionDocument xmlns="http://www.pbcore.org/PBCore/PBCoreNamespace.html" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.pbcore.org/PBCore/PBCoreNamespace.html" xsi:schemaLocation="http://www.pbcore.org/PBCore/PBCoreNamespace.html"></pbcoreDescriptionDocument>'
|
65
|
+
Nokogiri::XML(xml)
|
66
|
+
end
|
11
67
|
end
|
12
68
|
|
13
69
|
require "hydra-pbcore/methods"
|
70
|
+
require "hydra-pbcore/conversions"
|
14
71
|
require "hydra-pbcore/behaviors"
|
15
72
|
require "hydra-pbcore/templates"
|
16
73
|
require "custom_mapper"
|
17
74
|
require "hydra-pbcore/datastream/document"
|
18
75
|
require "hydra-pbcore/datastream/instantiation"
|
19
|
-
require "hydra-pbcore/datastream/
|
76
|
+
require "hydra-pbcore/datastream/deprecated/document"
|
77
|
+
require "hydra-pbcore/datastream/deprecated/digital_document"
|
78
|
+
require "hydra-pbcore/datastream/deprecated/instantiation"
|
@@ -1,10 +1,11 @@
|
|
1
1
|
module HydraPbcore
|
2
2
|
class Behaviors
|
3
3
|
|
4
|
-
# This module is
|
4
|
+
# This module is deprecated and will be removed in release 2.0.0
|
5
5
|
|
6
6
|
# Nokogiri's add_namespace doesn't seem to work, so we have to insert it "manually"
|
7
7
|
def self.insert_pbcore_namespace(doc)
|
8
|
+
puts "WARNING: HydraPbcore::Behaviors is deprecated and will be removed in release 2.0"
|
8
9
|
index = doc.to_s.index("xmlns:xsi")
|
9
10
|
new_s = doc.to_s.insert(index.to_i, 'xmlns="http://www.pbcore.org/PBCore/PBCoreNamespace.html" ')
|
10
11
|
new_doc = Nokogiri::XML(new_s)
|
@@ -14,6 +15,7 @@ class Behaviors
|
|
14
15
|
# Validates a PBCore document against an xsd
|
15
16
|
# Returns an array of errors -- an empty array means it's valid
|
16
17
|
def self.validate(doc)
|
18
|
+
puts "WARNING: HydraPbcore::Behaviors is deprecated and will be removed in release 2.0"
|
17
19
|
xsd = Nokogiri::XML::Schema(open("http://pbcore.org/xsd/pbcore-2.0.xsd"))
|
18
20
|
xsd.validate(doc)
|
19
21
|
end
|
@@ -21,7 +23,7 @@ class Behaviors
|
|
21
23
|
|
22
24
|
# Reorders the nodes of pbcoreDescriptionDocument to conform with the correct order
|
23
25
|
def self.reorder_document(doc)
|
24
|
-
|
26
|
+
puts "WARNING: HydraPbcore::Behaviors is deprecated and will be removed in release 2.0"
|
25
27
|
nodes = [
|
26
28
|
"pbcoreAssetType",
|
27
29
|
"pbcoreAssetDate",
|
@@ -0,0 +1,88 @@
|
|
1
|
+
# Methods for converting HydraPbcore 1.x datastreams to HydraPbcore 2.x datastreams
|
2
|
+
#
|
3
|
+
# Verion 1.x of the HydraPbcore gem uses two kinds of pbcoreDocuments, one which includes an instantation
|
4
|
+
# and one which does not. Version 2 of the gem refactors these so that there
|
5
|
+
# is only one kind of pbcoreDocument and two kinds of instatiations. This offers greater flexibility
|
6
|
+
# as any number of instantiations may be attached to a document. Instatntiations come in two types,
|
7
|
+
# one is physical, meaning it represents a tape or other
|
8
|
+
# tangible object on which the video content resides, while the other kind is
|
9
|
+
# digital, representing a video file.
|
10
|
+
#
|
11
|
+
# These methods attempt to correct invalid or inconsistent xml created using the first version of the
|
12
|
+
# gem.
|
13
|
+
|
14
|
+
module HydraPbcore::Conversions
|
15
|
+
|
16
|
+
# Converts a HydraPbcore::Datastream::Deprecated::Document to a HydraPbcore::Datastream::Document
|
17
|
+
# - the existing pbcoreInstantiation node is removed
|
18
|
+
# - any pbcoreRelation or pbcoreRelationIdentifier is removed except for terms identifying "Event Series"
|
19
|
+
def to_document
|
20
|
+
raise "only works with HydraPbcore::Datastream::Deprecated::Document" unless self.kind_of?(HydraPbcore::Datastream::Deprecated::Document)
|
21
|
+
self.remove_node(:pbcoreInstantiation)
|
22
|
+
self.dirty = true
|
23
|
+
end
|
24
|
+
|
25
|
+
# Extracts the instantation from a HydraPbcore::Datastream::Deprecated::Document and returns
|
26
|
+
# a physical HydraPbcore::Datastream::Instantion
|
27
|
+
# - removes all instantiationRelation nodes
|
28
|
+
# - adds source="PBCore instantiationColors" to instantiationColors node
|
29
|
+
# - extracts the pbcoreInstantiation node and returns new Instantiation object
|
30
|
+
def to_physical_instantiation(xml = self.ng_xml)
|
31
|
+
raise "only works with HydraPbcore::Datastream::Deprecated::Document" unless self.kind_of?(HydraPbcore::Datastream::Deprecated::Document)
|
32
|
+
xml.search("//instantiationRelation").each do |node|
|
33
|
+
node.remove
|
34
|
+
end
|
35
|
+
xml.search("//instantiationColors").first["source"] = "PBCore instantiationColors"
|
36
|
+
inst_xml = xml.xpath("//pbcoreInstantiation")
|
37
|
+
HydraPbcore::Datastream::Instantiation.from_xml(inst_xml.to_xml)
|
38
|
+
end
|
39
|
+
|
40
|
+
# Converts a HydraPbcore::Datastream::Deprecated::Instantiation to a HydraPbcore::Datastream::Instantiation
|
41
|
+
# Modifies the exiting xml to exclude any parent nodes of the pbcoreInstantiation node
|
42
|
+
def to_instantiation
|
43
|
+
raise "only works with HydraPbcore::Datastream::Deprecated::Instantiation" unless self.kind_of?(HydraPbcore::Datastream::Deprecated::Instantiation)
|
44
|
+
self.ng_xml = self.ng_xml.xpath("//pbcoreInstantiation").to_xml
|
45
|
+
end
|
46
|
+
|
47
|
+
# Corrects errors in HydraPbcore::Datastream::Deprecated::Document and HydraPbcore::Datastream::Deprecated::DigitalDocument
|
48
|
+
# - removes all pbcoreRelation nodes, except those that define event_series
|
49
|
+
# - removes orphaned pbcoreRelationIdentifier nodes
|
50
|
+
# - corrects invalid usage of event_place and event_series terms
|
51
|
+
#
|
52
|
+
# Note: Since pbcoreRelation is used to indicated archival collection and series, this information should be copied to another kind
|
53
|
+
# of datastream using an RDF relationship in Hydra.
|
54
|
+
def clean_document(xml = self.ng_xml)
|
55
|
+
xml.search("//pbcoreRelation").each do |node|
|
56
|
+
node.remove unless is_event_series?(node)
|
57
|
+
end
|
58
|
+
xml.search("/pbcoreDescriptionDocument/pbcoreRelationIdentifier").collect {|n| n.remove}
|
59
|
+
xml.search("//pbcoreCoverage").each do |node|
|
60
|
+
node.children.each do |c|
|
61
|
+
if c.attribute("annotation").nil? and c.name == "coverage"
|
62
|
+
self.send(("insert_"+coverage_type(node)), c.text)
|
63
|
+
c.remove
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
69
|
+
# Determines if the given node defines an event_series term
|
70
|
+
def is_event_series?(node)
|
71
|
+
unless node.at_xpath("pbcoreRelationIdentifier").nil?
|
72
|
+
if node.at_xpath("pbcoreRelationIdentifier").attribute("annotation").to_s == "Event Series"
|
73
|
+
return true
|
74
|
+
end
|
75
|
+
end
|
76
|
+
end
|
77
|
+
|
78
|
+
# Determines if a coverage node that has no annotation attribute should be either an event_date term or an event_date term.
|
79
|
+
# Returns the first instance of an annotation attribute, processing it so that may be sent directly to
|
80
|
+
# the datastream as a method.
|
81
|
+
def coverage_type(node)
|
82
|
+
node.children.each do |c|
|
83
|
+
return c.attribute("annotation").to_s.split.last.downcase unless c.attribute("annotation").nil?
|
84
|
+
end
|
85
|
+
end
|
86
|
+
|
87
|
+
|
88
|
+
end
|
@@ -1,10 +1,11 @@
|
|
1
|
-
module HydraPbcore::Datastream
|
1
|
+
module HydraPbcore::Datastream::Deprecated
|
2
2
|
class DigitalDocument < ActiveFedora::NokogiriDatastream
|
3
3
|
|
4
4
|
include HydraPbcore::Methods
|
5
5
|
include HydraPbcore::Templates
|
6
|
+
include HydraPbcore::Conversions
|
6
7
|
|
7
|
-
@terminology = HydraPbcore::Datastream::Document.terminology
|
8
|
+
@terminology = HydraPbcore::Datastream::Deprecated::Document.terminology
|
8
9
|
|
9
10
|
def self.xml_template
|
10
11
|
builder = Nokogiri::XML::Builder.new do |xml|
|
@@ -0,0 +1,310 @@
|
|
1
|
+
module HydraPbcore::Datastream::Deprecated
|
2
|
+
class Document < ActiveFedora::NokogiriDatastream
|
3
|
+
|
4
|
+
include HydraPbcore::Methods
|
5
|
+
include HydraPbcore::Templates
|
6
|
+
include HydraPbcore::Conversions
|
7
|
+
|
8
|
+
set_terminology do |t|
|
9
|
+
t.root(:path=>"pbcoreDescriptionDocument")
|
10
|
+
|
11
|
+
#
|
12
|
+
# pbcoreDescription fields
|
13
|
+
#
|
14
|
+
t.pbc_id(:path=>"pbcoreIdentifier",
|
15
|
+
:attributes=>{ :source=>"Rock and Roll Hall of Fame and Museum", :annotation=>"PID" }
|
16
|
+
)
|
17
|
+
|
18
|
+
t.main_title(:path=>"pbcoreTitle", :attributes=>{ :titleType=>"Main" }, :index_as => [:searchable, :displayable])
|
19
|
+
t.alternative_title(:path=>"pbcoreTitle", :attributes=>{ :titleType=>"Alternative" },
|
20
|
+
:index_as => [:searchable, :displayable]
|
21
|
+
)
|
22
|
+
t.chapter(:path=>"pbcoreTitle", :attributes=>{ :titleType=>"Chapter" }, :index_as => [:searchable, :displayable])
|
23
|
+
t.episode(:path=>"pbcoreTitle", :attributes=>{ :titleType=>"Episode" }, :index_as => [:searchable, :displayable])
|
24
|
+
t.label(:path=>"pbcoreTitle", :attributes=>{ :titleType=>"Label" }, :index_as => [:searchable, :displayable])
|
25
|
+
t.segment(:path=>"pbcoreTitle", :attributes=>{ :titleType=>"Segment" }, :index_as => [:searchable, :displayable])
|
26
|
+
t.subtitle(:path=>"pbcoreTitle", :attributes=>{ :titleType=>"Subtitle" }, :index_as => [:searchable, :displayable])
|
27
|
+
t.track(:path=>"pbcoreTitle", :attributes=>{ :titleType=>"Track" }, :index_as => [:searchable, :displayable])
|
28
|
+
t.translation(:path=>"pbcoreTitle", :attributes=>{ :titleType=>"Translation" },
|
29
|
+
:index_as => [:searchable, :displayable]
|
30
|
+
)
|
31
|
+
|
32
|
+
# This is only to display all subjects
|
33
|
+
t.subject_topic(:path=>"pbcoreSubject", :index_as => [:searchable, :facetable])
|
34
|
+
|
35
|
+
# Individual subject types defined for entry
|
36
|
+
t.lc_subject(:path=>"pbcoreSubject",
|
37
|
+
:attributes=>{
|
38
|
+
:source=>"Library of Congress Subject Headings",
|
39
|
+
:ref=>"http://id.loc.gov/authorities/subjects.html"
|
40
|
+
},
|
41
|
+
:index_as => [:displayable]
|
42
|
+
)
|
43
|
+
t.lc_name(:path=>"pbcoreSubject",
|
44
|
+
:attributes=>{ :source=>"Library of Congress Name Authority File", :ref=>"http://id.loc.gov/authorities/names" },
|
45
|
+
:index_as => [:displayable]
|
46
|
+
)
|
47
|
+
t.rh_subject(:path=>"pbcoreSubject",
|
48
|
+
:attributes=>{ :source=>"Rock and Roll Hall of Fame and Museum" },
|
49
|
+
:index_as => [:displayable]
|
50
|
+
)
|
51
|
+
|
52
|
+
t.summary(:path=>"pbcoreDescription",
|
53
|
+
:attributes=>{
|
54
|
+
:descriptionType=>"Description",
|
55
|
+
:descriptionTypeSource=>"pbcoreDescription/descriptionType",
|
56
|
+
:descriptionTypeRef=>"http://pbcore.org/vocabularies/pbcoreDescription/descriptionType#description",
|
57
|
+
:annotation=>"Summary"
|
58
|
+
},
|
59
|
+
:index_as => [:searchable, :displayable]
|
60
|
+
)
|
61
|
+
|
62
|
+
t.parts_list(:path=>"pbcoreDescription",
|
63
|
+
:attributes=>{
|
64
|
+
:descriptionType=>"Table of Contents",
|
65
|
+
:descriptionTypeSource=>"pbcoreDescription/descriptionType",
|
66
|
+
:descriptionTypeRef=>"http://pbcore.org/vocabularies/pbcoreDescription/descriptionType#table-of-contents",
|
67
|
+
:annotation=>"Parts List"
|
68
|
+
},
|
69
|
+
:index_as => [:searchable, :displayable]
|
70
|
+
)
|
71
|
+
|
72
|
+
# This is only to display all genres
|
73
|
+
t.genres(:path=>"pbcoreGenre", :index_as => [:searchable, :facetable])
|
74
|
+
|
75
|
+
# Individual genre types defined for entry
|
76
|
+
t.getty_genre(:path=>"pbcoreGenre",
|
77
|
+
:attributes=>{
|
78
|
+
:source=>"The Getty Research Institute Art and Architecture Thesaurus",
|
79
|
+
:ref=>"http://www.getty.edu/research/tools/vocabularies/aat/index.html"
|
80
|
+
},
|
81
|
+
:index_as => [:displayable]
|
82
|
+
)
|
83
|
+
t.lc_genre(:path=>"pbcoreGenre",
|
84
|
+
:attributes=>{
|
85
|
+
:source=>"Library of Congress Genre/Form Terms",
|
86
|
+
:ref=>"http://id.loc.gov/authorities/genreForms.html"
|
87
|
+
},
|
88
|
+
:index_as => [:displayable]
|
89
|
+
)
|
90
|
+
t.lc_subject_genre(:path=>"pbcoreGenre",
|
91
|
+
:attributes=>{
|
92
|
+
:source=>"Library of Congress Subject Headings",
|
93
|
+
:ref=>"http://id.loc.gov/authorities/subjects.html"
|
94
|
+
},
|
95
|
+
:index_as => [:displayable]
|
96
|
+
)
|
97
|
+
|
98
|
+
|
99
|
+
# Series field
|
100
|
+
t.pbcoreRelation do
|
101
|
+
t.pbcoreRelationIdentifier(:attributes=>{ :annotation=>"Event Series" })
|
102
|
+
end
|
103
|
+
t.event_series(:ref=>[:pbcoreRelation, :pbcoreRelationIdentifier], :index_as => [:searchable, :displayable])
|
104
|
+
|
105
|
+
# Terms for time and place
|
106
|
+
t.event_place(:path=>"pbcoreCoverage/coverage",
|
107
|
+
:attributes => {:annotation=>"Event Place"},
|
108
|
+
:index_as => [:searchable, :displayable]
|
109
|
+
)
|
110
|
+
t.event_date(:path=>"pbcoreCoverage/coverage",
|
111
|
+
:attributes => {:annotation=>"Event Date"},
|
112
|
+
:index_as => [:not_searchable, :converted_date, :displayable]
|
113
|
+
)
|
114
|
+
|
115
|
+
# Contributor names and roles
|
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
|
123
|
+
t.contributor_name(:proxy=>[:contributor, :name])
|
124
|
+
t.contributor_role(:proxy=>[:contributor, :role])
|
125
|
+
|
126
|
+
# Publisher names and roles
|
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])
|
133
|
+
|
134
|
+
t.note(:path=>"pbcoreAnnotation", :atttributes=>{ :annotationType=>"Notes" }, :index_as => [:searchable])
|
135
|
+
|
136
|
+
#
|
137
|
+
# pbcoreInstantiation fields for the physical item
|
138
|
+
#
|
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
|
176
|
+
# Individual field names:
|
177
|
+
t.creation_date(:ref=>[:pbcoreInstantiation, :instantiationDate], :index_as => [:not_searchable, :converted_date, :displayable])
|
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
|
206
|
+
t.condition_note(:proxy=>[:pbcoreInstantiation, :inst_cond_note])
|
207
|
+
t.cleaning_note(:proxy=>[:pbcoreInstantiation, :inst_clean_note])
|
208
|
+
end
|
209
|
+
|
210
|
+
def self.xml_template
|
211
|
+
builder = Nokogiri::XML::Builder.new do |xml|
|
212
|
+
|
213
|
+
xml.pbcoreDescriptionDocument("xmlns:xsi"=>"http://www.w3.org/2001/XMLSchema-instance",
|
214
|
+
"xsi:schemaLocation"=>"http://www.pbcore.org/PBCore/PBCoreNamespace.html") {
|
215
|
+
|
216
|
+
xml.pbcoreIdentifier(:source=>"Rock and Roll Hall of Fame and Museum", :annotation=>"PID")
|
217
|
+
xml.pbcoreTitle(:titleType=>"Main")
|
218
|
+
xml.pbcoreDescription(:descriptionType=>"Description",
|
219
|
+
:descriptionTypeSource=>"pbcoreDescription/descriptionType",
|
220
|
+
:descriptionTypeRef=>"http://pbcore.org/vocabularies/pbcoreDescription/descriptionType#description",
|
221
|
+
:annotation=>"Summary"
|
222
|
+
)
|
223
|
+
xml.pbcoreDescription(:descriptionType=>"Table of Contents",
|
224
|
+
:descriptionTypeSource=>"pbcoreDescription/descriptionType",
|
225
|
+
:descriptionTypeRef=>"http://pbcore.org/vocabularies/pbcoreDescription/descriptionType#table-of-contents",
|
226
|
+
:annotation=>"Parts List"
|
227
|
+
)
|
228
|
+
xml.pbcoreRelation {
|
229
|
+
xml.pbcoreRelationType(:source=>"PBCore relationType", :ref=>"http://pbcore.org/vocabularies/relationType#is-part-of") {
|
230
|
+
xml.text "Is Part Of"
|
231
|
+
}
|
232
|
+
xml.pbcoreRelationIdentifier(:annotation=>"Event Series")
|
233
|
+
}
|
234
|
+
xml.pbcoreCoverage {
|
235
|
+
xml.coverage(:annotation=>"Event Place")
|
236
|
+
xml.coverageType {
|
237
|
+
xml.text "Spatial"
|
238
|
+
}
|
239
|
+
}
|
240
|
+
xml.pbcoreCoverage {
|
241
|
+
xml.coverage(:annotation=>"Event Date")
|
242
|
+
xml.coverageType {
|
243
|
+
xml.text "Temporal"
|
244
|
+
}
|
245
|
+
}
|
246
|
+
xml.pbcoreAnnotation(:annotationType=>"Notes")
|
247
|
+
|
248
|
+
#
|
249
|
+
# Default physical item
|
250
|
+
#
|
251
|
+
xml.pbcoreInstantiation {
|
252
|
+
|
253
|
+
# Item details
|
254
|
+
xml.instantiationIdentifier(:annotation=>"Barcode", :source=>"Rock and Roll Hall of Fame and Museum")
|
255
|
+
xml.instantiationDate(:dateType=>"created")
|
256
|
+
xml.instantiationPhysical(:source=>"PBCore instantiationPhysical")
|
257
|
+
xml.instantiationStandard
|
258
|
+
xml.instantiationLocation {
|
259
|
+
xml.text "Rock and Roll Hall of Fame and Museum,\n2809 Woodland Ave.,\nCleveland, OH, 44115\n216-515-1956\nlibrary@rockhall.org"
|
260
|
+
}
|
261
|
+
xml.instantiationMediaType(:source=>"PBCore instantiationMediaType") {
|
262
|
+
xml.text "Moving image"
|
263
|
+
}
|
264
|
+
xml.instantiationGenerations(:source=>"PBCore instantiationGenerations") {
|
265
|
+
xml.text "Original"
|
266
|
+
}
|
267
|
+
xml.instantiationColors {
|
268
|
+
xml.text "Color"
|
269
|
+
}
|
270
|
+
xml.instantiationLanguage(:source=>"ISO 639.2", :ref=>"http://www.loc.gov/standards/iso639-2/php/code_list.php") {
|
271
|
+
xml.text "eng"
|
272
|
+
}
|
273
|
+
xml.instantiationRelation {
|
274
|
+
xml.instantiationRelationType(:source=>"PBCore relationType", :ref=>"http://pbcore.org/vocabularies/relationType#is-part-of") {
|
275
|
+
xml.text "Is Part Of"
|
276
|
+
}
|
277
|
+
xml.instantiationRelationIdentifier(:annotation=>"Archival Collection")
|
278
|
+
}
|
279
|
+
xml.instantiationRelation {
|
280
|
+
xml.instantiationRelationType(:source=>"PBCore relationType", :ref=>"http://pbcore.org/vocabularies/relationType#is-part-of") {
|
281
|
+
xml.text "Is Part Of"
|
282
|
+
}
|
283
|
+
xml.instantiationRelationIdentifier(:annotation=>"Archival Series")
|
284
|
+
}
|
285
|
+
xml.instantiationRelation {
|
286
|
+
xml.instantiationRelationType(:source=>"PBCore relationType", :ref=>"http://pbcore.org/vocabularies/relationType#is-part-of") {
|
287
|
+
xml.text "Is Part Of"
|
288
|
+
}
|
289
|
+
xml.instantiationRelationIdentifier(:annotation=>"Collection Number")
|
290
|
+
}
|
291
|
+
xml.instantiationRelation {
|
292
|
+
xml.instantiationRelationType(:source=>"PBCore relationType", :ref=>"http://pbcore.org/vocabularies/relationType#is-part-of") {
|
293
|
+
xml.text "Is Part Of"
|
294
|
+
}
|
295
|
+
xml.instantiationRelationIdentifier(:annotation=>"Accession Number")
|
296
|
+
}
|
297
|
+
xml.instantiationRights {
|
298
|
+
xml.rightsSummary
|
299
|
+
}
|
300
|
+
|
301
|
+
}
|
302
|
+
|
303
|
+
}
|
304
|
+
|
305
|
+
end
|
306
|
+
return builder.doc
|
307
|
+
end
|
308
|
+
|
309
|
+
end
|
310
|
+
end
|