Project

General

Profile

1 3132 perry
<?xml version="1.0" encoding="iso-8859-1"?>
2
<!DOCTYPE html
3
     PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
4
     "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
5
6
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
7
<head>
8
  <title>Class: Eml</title>
9
  <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
10
  <meta http-equiv="Content-Script-Type" content="text/javascript" />
11
  <link rel="stylesheet" href=".././rdoc-style.css" type="text/css" media="screen" />
12
  <script type="text/javascript">
13
  // <![CDATA[
14
15
  function popupCode( url ) {
16
    window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
17
  }
18
19
  function toggleCode( id ) {
20
    if ( document.getElementById )
21
      elem = document.getElementById( id );
22
    else if ( document.all )
23
      elem = eval( "document.all." + id );
24
    else
25
      return false;
26
27
    elemStyle = elem.style;
28
29
    if ( elemStyle.display != "block" ) {
30
      elemStyle.display = "block"
31
    } else {
32
      elemStyle.display = "none"
33
    }
34
35
    return true;
36
  }
37
38
  // Make codeblocks hidden by default
39
  document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
40
41
  // ]]>
42
  </script>
43
44
</head>
45
<body>
46
47
48
49
    <div id="classHeader">
50
        <table class="header-table">
51
        <tr class="top-aligned-row">
52
          <td><strong>Class</strong></td>
53
          <td class="class-name-in-header">Eml</td>
54
        </tr>
55
        <tr class="top-aligned-row">
56
            <td><strong>In:</strong></td>
57
            <td>
58
                <a href="../files/lib/eml_rb.html">
59
                lib/eml.rb
60
                </a>
61
        <br />
62
            </td>
63
        </tr>
64
65
        <tr class="top-aligned-row">
66
            <td><strong>Parent:</strong></td>
67
            <td>
68
                Object
69
            </td>
70
        </tr>
71
        </table>
72
    </div>
73
  <!-- banner header -->
74
75
  <div id="bodyContent">
76
77
78
79
  <div id="contextContent">
80
81
    <div id="description">
82
      <h2>What is it</h2>
83
<p>
84
The goal of this object is to encapsulate a dom representation of an EML(<a
85
href="http://knb.ecoinformatics.org/software/eml">knb.ecoinformatics.org/software/eml</a>)
86
document and provide quick helper methods to access commonly needed
87
attributes. These methods will return a more &quot;ruby friendly&quot;
88
representation of this metadata.
89
</p>
90
<p>
91
At their core <a href="Eml.html">Eml</a> objects contain a REXML::Document
92
in the instance variable @doc. Until this object is feature-complete, this
93
dom document can be used when this object is returned from this
94
module&#8217;s <a href="Metacat.html">Metacat</a> client.
95
</p>
96
<h2>Examples</h2>
97
<h3>Get temporal coverage</h3>
98
<pre>
99
  metacat = Metacat.new('http://data.piscoweb.org/catalog/metacat')
100
  eml_object = metacat.find(:docid =&gt; 'HMS001_020ADCP019R00_20060612.50.1')
101
  geographic_coverage = eml_object.geographic_coverage
102
  =&gt; [{ &quot;latitude&quot;=&gt;-121.8996,
103
        &quot;longitude&quot;=&gt;36.6214,
104
        &quot;id&quot;=&gt;&quot;HMS001&quot;,
105
        &quot;description&quot;=&gt;
106
        &quot;Hopkins Marine Station: HMS001: This inner-shelf mooring is located offshore
107
        of the city of Monterey, California, USA, near Hopkins Marine Station.  The
108
        mooring is located in an overall water depth of 020 meters (referenced to Mean
109
        Sea Level, MSL).  The altitudeMinimum and altitudeMaximum tags in this initial
110
        coverage section refer to the ADCP measurement range and are also referenced to
111
        MSL.  They do not represent the overall water depth.  Note the nominal range of
112
        the ADCP may extend from near-bottom (a depth expressed as a negative altitude)
113
        to slightly above MSL (a height expressed as a positive altitude).&quot;}]
114
</pre>
115
<h3>Get associated data table(<a href="DataTable.html">DataTable</a>) and write it to disk</h3>
116
<pre>
117
  eml_object.data_tables.each do |data_table|
118
    file = File.new(&quot;./store/#{data_table.id}&quot;)
119
    # data_table is an object, with method read
120
    data_table.read do |buffer|
121
      file.write(buffer)
122
    end
123
    file.close()
124
  end
125
</pre>
126
127
    </div>
128
129
130
   </div>
131
132
    <div id="method-list">
133
      <h3 class="section-bar">Methods</h3>
134
135
      <div class="name-list">
136
      <a href="#M000048">coverage</a>&nbsp;&nbsp;
137
      <a href="#M000044">data_tables</a>&nbsp;&nbsp;
138
      <a href="#M000047">geographic_coverage</a>&nbsp;&nbsp;
139
      <a href="#M000045">largest_data_table</a>&nbsp;&nbsp;
140
      <a href="#M000042">new</a>&nbsp;&nbsp;
141
      <a href="#M000050">short_name</a>&nbsp;&nbsp;
142
      <a href="#M000046">temporal_coverage</a>&nbsp;&nbsp;
143
      <a href="#M000049">title</a>&nbsp;&nbsp;
144
      <a href="#M000043">to_s</a>&nbsp;&nbsp;
145
      </div>
146
    </div>
147
148
  </div>
149
150
151
    <!-- if includes -->
152
153
    <div id="section">
154
155
156
157
158
159
    <div id="attribute-list">
160
      <h3 class="section-bar">Attributes</h3>
161
162
      <div class="name-list">
163
        <table>
164
        <tr class="top-aligned-row context-row">
165
          <td class="context-item-name">doc</td>
166
          <td class="context-item-value">&nbsp;[R]&nbsp;</td>
167
          <td class="context-item-desc"></td>
168
        </tr>
169
        <tr class="top-aligned-row context-row">
170
          <td class="context-item-name">docid</td>
171
          <td class="context-item-value">&nbsp;[R]&nbsp;</td>
172
          <td class="context-item-desc"></td>
173
        </tr>
174
        </table>
175
      </div>
176
    </div>
177
178
179
180
    <!-- if method_list -->
181
    <div id="methods">
182
      <h3 class="section-bar">Public Class methods</h3>
183
184
      <div id="method-M000042" class="method-detail">
185
        <a name="M000042"></a>
186
187
        <div class="method-heading">
188
          <a href="Eml.src/M000042.html" target="Code" class="method-signature"
189
            onclick="popupCode('Eml.src/M000042.html');return false;">
190
          <span class="method-name">new</span><span class="method-args">(metadata)</span>
191
          </a>
192
        </div>
193
194
        <div class="method-description">
195
          <p>
196
Accepts an EML REXML::Document
197
</p>
198
        </div>
199
      </div>
200
201
      <h3 class="section-bar">Public Instance methods</h3>
202
203
      <div id="method-M000048" class="method-detail">
204
        <a name="M000048"></a>
205
206
        <div class="method-heading">
207
          <a href="Eml.src/M000048.html" target="Code" class="method-signature"
208
            onclick="popupCode('Eml.src/M000048.html');return false;">
209
          <span class="method-name">coverage</span><span class="method-args">()</span>
210
          </a>
211
        </div>
212
213
        <div class="method-description">
214
        </div>
215
      </div>
216
217
      <div id="method-M000044" class="method-detail">
218
        <a name="M000044"></a>
219
220
        <div class="method-heading">
221
          <a href="Eml.src/M000044.html" target="Code" class="method-signature"
222
            onclick="popupCode('Eml.src/M000044.html');return false;">
223
          <span class="method-name">data_tables</span><span class="method-args">()</span>
224
          </a>
225
        </div>
226
227
        <div class="method-description">
228
        </div>
229
      </div>
230
231
      <div id="method-M000047" class="method-detail">
232
        <a name="M000047"></a>
233
234
        <div class="method-heading">
235
          <a href="Eml.src/M000047.html" target="Code" class="method-signature"
236
            onclick="popupCode('Eml.src/M000047.html');return false;">
237
          <span class="method-name">geographic_coverage</span><span class="method-args">()</span>
238
          </a>
239
        </div>
240
241
        <div class="method-description">
242
        </div>
243
      </div>
244
245
      <div id="method-M000045" class="method-detail">
246
        <a name="M000045"></a>
247
248
        <div class="method-heading">
249
          <a href="Eml.src/M000045.html" target="Code" class="method-signature"
250
            onclick="popupCode('Eml.src/M000045.html');return false;">
251
          <span class="method-name">largest_data_table</span><span class="method-args">()</span>
252
          </a>
253
        </div>
254
255
        <div class="method-description">
256
        </div>
257
      </div>
258
259
      <div id="method-M000050" class="method-detail">
260
        <a name="M000050"></a>
261
262
        <div class="method-heading">
263
          <a href="Eml.src/M000050.html" target="Code" class="method-signature"
264
            onclick="popupCode('Eml.src/M000050.html');return false;">
265
          <span class="method-name">short_name</span><span class="method-args">()</span>
266
          </a>
267
        </div>
268
269
        <div class="method-description">
270
        </div>
271
      </div>
272
273
      <div id="method-M000046" class="method-detail">
274
        <a name="M000046"></a>
275
276
        <div class="method-heading">
277
          <a href="Eml.src/M000046.html" target="Code" class="method-signature"
278
            onclick="popupCode('Eml.src/M000046.html');return false;">
279
          <span class="method-name">temporal_coverage</span><span class="method-args">()</span>
280
          </a>
281
        </div>
282
283
        <div class="method-description">
284
          <p>
285
Pulls a date range from the temporalCoverage element
286
</p>
287
<p>
288
Note : EML supports multiple date ranges to account for gaps this code just
289
lumps them into one Also, it does not support cases of singleDateTime
290
</p>
291
        </div>
292
      </div>
293
294
      <div id="method-M000049" class="method-detail">
295
        <a name="M000049"></a>
296
297
        <div class="method-heading">
298
          <a href="Eml.src/M000049.html" target="Code" class="method-signature"
299
            onclick="popupCode('Eml.src/M000049.html');return false;">
300
          <span class="method-name">title</span><span class="method-args">()</span>
301
          </a>
302
        </div>
303
304
        <div class="method-description">
305
        </div>
306
      </div>
307
308
      <div id="method-M000043" class="method-detail">
309
        <a name="M000043"></a>
310
311
        <div class="method-heading">
312
          <a href="Eml.src/M000043.html" target="Code" class="method-signature"
313
            onclick="popupCode('Eml.src/M000043.html');return false;">
314
          <span class="method-name">to_s</span><span class="method-args">()</span>
315
          </a>
316
        </div>
317
318
        <div class="method-description">
319
        </div>
320
      </div>
321
322
323
    </div>
324
325
326
  </div>
327
328
329
<div id="validator-badges">
330
  <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
331
</div>
332
333
</body>
334
</html>