Class: GeoblacklightAdmin::Schema

Inherits:
Object
  • Object
show all
Defined in:
app/models/geoblacklight_admin/schema.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.instanceObject



7
8
9
# File 'app/models/geoblacklight_admin/schema.rb', line 7

def self.instance
  @instance ||= new
end

Instance Method Details

#dct_references_import_mappingsObject



71
72
73
74
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
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
# File 'app/models/geoblacklight_admin/schema.rb', line 71

def dct_references_import_mappings
  {
    Documentation: {
      destination: solr_fields[:reference],
      delimited: false,
      transformation_method: "build_dct_references"
    },
    Download: {
      destination: solr_fields[:reference],
      delimited: false,
      transformation_method: "build_dct_references"
    },
    FeatureServer: {
      destination: solr_fields[:reference],
      delimited: false,
      transformation_method: "build_dct_references"
    },
    FGDC: {
      destination: solr_fields[:reference],
      delimited: false,
      transformation_method: "build_dct_references"
    },
    "Harvard Download": {
      destination: solr_fields[:reference],
      delimited: false,
      transformation_method: "build_dct_references"
    },
    HTML: {
      destination: solr_fields[:reference],
      delimited: false,
      transformation_method: "build_dct_references"
    },
    IIIF: {
      destination: solr_fields[:reference],
      delimited: false,
      transformation_method: "build_dct_references"
    },
    ImageServer: {
      destination: solr_fields[:reference],
      delimited: false,
      transformation_method: "build_dct_references"
    },
    Information: {
      destination: solr_fields[:reference],
      delimited: false,
      transformation_method: "build_dct_references"
    },
    ISO19139: {
      destination: solr_fields[:reference],
      delimited: false,
      transformation_method: "build_dct_references"
    },
    Manifest: {
      destination: solr_fields[:reference],
      delimited: false,
      transformation_method: "build_dct_references"
    },
    MapServer: {
      destination: solr_fields[:reference],
      delimited: false,
      transformation_method: "build_dct_references"
    },
    MODS: {
      destination: solr_fields[:reference],
      delimited: false,
      transformation_method: "build_dct_references"
    },
    oEmbed: {
      destination: solr_fields[:reference],
      delimited: false,
      transformation_method: "build_dct_references"
    },
    "Index Map": {
      destination: solr_fields[:reference],
      delimited: false,
      transformation_method: "build_dct_references"
    },
    TileServer: {
      destination: solr_fields[:reference],
      delimited: false,
      transformation_method: "build_dct_references"
    },
    WCS: {
      destination: solr_fields[:reference],
      delimited: false,
      transformation_method: "build_dct_references"
    },
    WFS: {
      destination: solr_fields[:reference],
      delimited: false,
      transformation_method: "build_dct_references"
    },
    WMS: {
      destination: solr_fields[:reference],
      delimited: false,
      transformation_method: "build_dct_references"
    }
  }
end

#dct_references_mappingsObject



171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
# File 'app/models/geoblacklight_admin/schema.rb', line 171

def dct_references_mappings
  {
    Documentation: "documentation_download",
    Download: "download",
    FeatureServer: "arcgis_feature_layer",
    FGDC: "metadata_fgdc",
    HTML: "metadata_html",
    "Harvard Download": "harvard_download",
    IIIF: "iiif_image",
    ImageServer: "arcgis_image_map_layer",
    Information: "documentation_external",
    ISO19139: "metadata_iso",
    Manifest: "iiif_manifest",
    MapServer: "arcgis_dynamic_map_layer",
    MODS: "metadata_mods",
    "Index Map": "open_index_map",
    TileServer: "arcgis_tiled_map_layer",
    WFS: "wfs",
    WMS: "wms",
    WCS: "wcs",
    oEmbed: "oembed",
    Thumbnail: "thumbnail",
    Image: "image"
  }
end

#elementsObject



11
12
13
# File 'app/models/geoblacklight_admin/schema.rb', line 11

def elements
  @elements ||= Element.all
end

#exportable_fieldsObject



40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
# File 'app/models/geoblacklight_admin/schema.rb', line 40

def exportable_fields
  @fields = {}
  Element.exportable.order(:position).each do |elm|
    # Skip References
    next if elm.solr_field == "dct_references_s"

    @fields[elm.label.to_sym] = {
      destination: elm.solr_field,
      delimited: elm.repeatable,
      transformation_method: elm.export_transformation_method
    }
  end

   = {
    "Created At": {
      destination: "created_at",
      delimited: false,
      transformation_method: nil
    },
    "Updated At": {
      destination: "updated_at",
      delimited: false,
      transformation_method: nil
    }
  }

  @fields = @fields.merge(dct_references_import_mappings)
  @fields = @fields.merge()
  @fields
end

#importable_fieldsObject Also known as: field_mappings



24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'app/models/geoblacklight_admin/schema.rb', line 24

def importable_fields
  @fields = {}
  Element.importable.order(:position).each do |elm|
    @fields[elm.label.to_sym] = {
      destination: elm.solr_field,
      delimited: elm.repeatable,
      transformation_method: elm.import_transformation_method
    }
  end

  @fields = @fields.merge(dct_references_import_mappings)
  @fields
end

#solr_fieldsObject



15
16
17
18
19
20
21
22
# File 'app/models/geoblacklight_admin/schema.rb', line 15

def solr_fields
  elements.map do |elm|
    [
      elm.label.parameterize(separator: "_").to_sym,
      elm.solr_field
    ]
  end.to_h
end