Class: Hydra::ModsDataset

Inherits:
ActiveFedora::NokogiriDatastream
  • Object
show all
Includes:
CommonModsIndexMethods
Defined in:
lib/hydra/mods_dataset.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods included from CommonModsIndexMethods

#extract_person_full_names, #extract_person_organizations, included

Constructor Details

#initialize(digital_object, dsid, options = {}) ⇒ ModsDataset

Returns a new instance of ModsDataset.



12
13
14
15
# File 'lib/hydra/mods_dataset.rb', line 12

def initialize(digital_object, dsid, options={})
  Deprecation.warn(Hydra::ModsDataset, "ModsDataset is deprecated and will be removed in release 5 or 6.  It has been moved into wiki documentation here:  https://github.com/projecthydra/hydra-head/wiki/Models---Some-Examples")
  super
end

Class Method Details

.completed_choicesObject



146
147
148
149
150
# File 'lib/hydra/mods_dataset.rb', line 146

def self.completed_choices
  ["Time Series",
    "Snapshot / Sample"
  ]
end

.data_type_choicesObject



162
163
164
# File 'lib/hydra/mods_dataset.rb', line 162

def self.data_type_choices
  ["transect","observation","data logging","remote sensing"]
end

.interval_choicesObject



153
154
155
156
157
158
159
160
# File 'lib/hydra/mods_dataset.rb', line 153

def self.interval_choices
  ["Monthly",
    "Quarterly",
    "Semi-annually",
    "Annually",
    "Irregular"
  ]
end

.person_relator_termsObject



125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
# File 'lib/hydra/mods_dataset.rb', line 125

def self.person_relator_terms
   {"anl" => "Analyst",
    "aut" => "Author",
    "clb" => "Collaborator",
    "com" => "Compiler",
    "cre" => "Creator",
    "ctb" => "Contributor",
    "dpt" => "Depositor",
    "dtc" => "Data contributor ",
    "dtm" => "Data manager ",
    "edt" => "Editor",
    "lbr" => "Laboratory ",
    "ldr" => "Laboratory director ",
    "pdr" => "Project director",
    "prg" => "Programmer",
    "res" => "Researcher",
    "rth" => "Research team head",
    "rtm" => "Research team member"
    }
end

.valid_child_typesObject



166
167
168
# File 'lib/hydra/mods_dataset.rb', line 166

def self.valid_child_types
  ["data", "supporting file", "profile", "lorem ipsum", "dolor"]
end

.xml_templateObject

Generates an empty Mods Article (used when you call ModsArticle.new without passing in existing xml)



77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
# File 'lib/hydra/mods_dataset.rb', line 77

def self.xml_template
  builder = Nokogiri::XML::Builder.new do |xml|
    xml.mods(:version=>"3.3", "xmlns:xlink"=>"http://www.w3.org/1999/xlink",
       "xmlns:xsi"=>"http://www.w3.org/2001/XMLSchema-instance",
       "xmlns"=>"http://www.loc.gov/mods/v3",
       "xsi:schemaLocation"=>"http://www.loc.gov/mods/v3 http://www.loc.gov/standards/mods/v3/mods-3-3.xsd") {
         xml.titleInfo(:lang=>"") {
           xml.title
         }
         xml.name(:type=>"personal") {
           xml.namePart(:type=>"given")
           xml.namePart(:type=>"family")
           xml.affiliation
           xml.role {
             xml.roleTerm(:authority=>"marcrelator", :type=>"text")
           }
         }
         xml.name(:type=>"corporate") {
           xml.namePart
           xml.affiliation
           xml.role {
             xml.roleTerm("Funder", :authority=>"marcrelator", :type=>"text") 
           }
         }
         xml.typeOfResource "software, multimedia"
         xml.genre("dataset", :authority=>"dct")
         xml.language {
           xml.languageTerm("eng", :authority=>"iso639-2b", :type=>"code")
         }
         xml.abstract
         xml.subject {
           xml.topic
         }
         xml.note(:type=>"completeness")
         xml.note(:type=>"interval")
         xml.note(:type=>"datatype")
         xml.note(:type=>"timespan-start")
         xml.note(:type=>"timespan-end")
         xml.note(:type=>"location")
         xml.note(:type=>"grant")
         xml.note(:type=>"data quality")
         xml.note(:type=>"contact-name")
         xml.note(:type=>"contact-email")
    }
  end
  return builder.doc
end

Instance Method Details

#to_solr(solr_doc = Hash.new) ⇒ Object



169
170
171
172
173
174
175
# File 'lib/hydra/mods_dataset.rb', line 169

def to_solr(solr_doc=Hash.new)
  super(solr_doc)
  solr_doc.merge!(extract_person_full_names)
  solr_doc.merge!(extract_person_organizations)
  solr_doc.merge!(:object_type_facet => "Dataset")
  solr_doc
end