Class: Hydra::Datastream::ModsDataset

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

Class Method Summary collapse

Instance Method Summary collapse

Methods included from CommonModsIndexMethods

#extract_person_full_names, #extract_person_organizations

Constructor Details

#initializeModsDataset

Returns a new instance of ModsDataset.



10
11
12
13
# File 'app/models/hydra/datastream/mods_dataset.rb', line 10

def initialize
  ActiveSupport::Deprecation.warn("Hydra:Datastream: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



144
145
146
147
148
# File 'app/models/hydra/datastream/mods_dataset.rb', line 144

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

.data_type_choicesObject



160
161
162
# File 'app/models/hydra/datastream/mods_dataset.rb', line 160

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

.interval_choicesObject



151
152
153
154
155
156
157
158
# File 'app/models/hydra/datastream/mods_dataset.rb', line 151

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

.person_relator_termsObject



123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
# File 'app/models/hydra/datastream/mods_dataset.rb', line 123

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



164
165
166
# File 'app/models/hydra/datastream/mods_dataset.rb', line 164

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)



75
76
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
# File 'app/models/hydra/datastream/mods_dataset.rb', line 75

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



167
168
169
170
171
172
173
# File 'app/models/hydra/datastream/mods_dataset.rb', line 167

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