Project

General

Profile

1
<?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: DataTable</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">DataTable</td>
54
        </tr>
55
        <tr class="top-aligned-row">
56
            <td><strong>In:</strong></td>
57
            <td>
58
                <a href="../files/lib/data_table_rb.html">
59
                lib/data_table.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
Each EML document can contain <a href="DataTable.html">DataTable</a>
85
elements representing(in most cases) plain text data. The attributes of
86
this data, such as column names, types, domain info, are documented in the
87
eml metadata. <a href="DataTable.html">DataTable</a> encapsulates data
88
table elements from eml documents in the instance variable @metadata.
89
</p>
90
<p>
91
The purpose of this class is to provide methods to easily access metadata
92
attributes pertaining to the data table. It can also be extended for
93
specific applications to process the data based on the metadata
94
description.
95
</p>
96
<h2>Examples</h2>
97
<h3>Get the location where this data file is stored</h3>
98
<pre>
99
  eml = metacat.find(:docid =&gt; 'somedoc.1.1')
100
  data_table = eml.data_tables[0]
101
  data_table.location
102
  =&gt; ecogrid://knb/pisco_cbs.30.3
103
</pre>
104
<h3>Write the data file to disk</h3>
105
<pre>
106
  # note we are using a block so the whole file isn't loaded to RAM
107
  file = File.new(&quot;./tmp/#{data_table.id}&quot;)
108
  data_table.read do |buffer|
109
    file.write(buffer)
110
  end
111
  file.close
112
</pre>
113

    
114
    </div>
115

    
116

    
117
   </div>
118

    
119
    <div id="method-list">
120
      <h3 class="section-bar">Methods</h3>
121

    
122
      <div class="name-list">
123
      <a href="#M000039">columns</a>&nbsp;&nbsp;
124
      <a href="#M000032">data_format</a>&nbsp;&nbsp;
125
      <a href="#M000027">docid</a>&nbsp;&nbsp;
126
      <a href="#M000040">entity_name</a>&nbsp;&nbsp;
127
      <a href="#M000033">field_delimiter</a>&nbsp;&nbsp;
128
      <a href="#M000038">field_delimiter</a>&nbsp;&nbsp;
129
      <a href="#M000028">id</a>&nbsp;&nbsp;
130
      <a href="#M000029">location</a>&nbsp;&nbsp;
131
      <a href="#M000026">new</a>&nbsp;&nbsp;
132
      <a href="#M000036">num_headers</a>&nbsp;&nbsp;
133
      <a href="#M000030">physical</a>&nbsp;&nbsp;
134
      <a href="#M000041">read</a>&nbsp;&nbsp;
135
      <a href="#M000037">record_delimiter</a>&nbsp;&nbsp;
136
      <a href="#M000035">simple_delimited</a>&nbsp;&nbsp;
137
      <a href="#M000031">size</a>&nbsp;&nbsp;
138
      <a href="#M000034">text_format</a>&nbsp;&nbsp;
139
      </div>
140
    </div>
141

    
142
  </div>
143

    
144

    
145
    <!-- if includes -->
146

    
147
    <div id="section">
148

    
149

    
150

    
151

    
152

    
153
    <div id="attribute-list">
154
      <h3 class="section-bar">Attributes</h3>
155

    
156
      <div class="name-list">
157
        <table>
158
        <tr class="top-aligned-row context-row">
159
          <td class="context-item-name">eml</td>
160
          <td class="context-item-value">&nbsp;[R]&nbsp;</td>
161
          <td class="context-item-desc"></td>
162
        </tr>
163
        <tr class="top-aligned-row context-row">
164
          <td class="context-item-name">metadata</td>
165
          <td class="context-item-value">&nbsp;[R]&nbsp;</td>
166
          <td class="context-item-desc"></td>
167
        </tr>
168
        </table>
169
      </div>
170
    </div>
171
      
172

    
173

    
174
    <!-- if method_list -->
175
    <div id="methods">
176
      <h3 class="section-bar">Public Class methods</h3>
177

    
178
      <div id="method-M000026" class="method-detail">
179
        <a name="M000026"></a>
180

    
181
        <div class="method-heading">
182
          <a href="DataTable.src/M000026.html" target="Code" class="method-signature"
183
            onclick="popupCode('DataTable.src/M000026.html');return false;">
184
          <span class="method-name">new</span><span class="method-args">(data_table_element, eml)</span>
185
          </a>
186
        </div>
187
      
188
        <div class="method-description">
189
        </div>
190
      </div>
191

    
192
      <h3 class="section-bar">Public Instance methods</h3>
193

    
194
      <div id="method-M000039" class="method-detail">
195
        <a name="M000039"></a>
196

    
197
        <div class="method-heading">
198
          <a href="DataTable.src/M000039.html" target="Code" class="method-signature"
199
            onclick="popupCode('DataTable.src/M000039.html');return false;">
200
          <span class="method-name">columns</span><span class="method-args">()</span>
201
          </a>
202
        </div>
203
      
204
        <div class="method-description">
205
        </div>
206
      </div>
207

    
208
      <div id="method-M000032" class="method-detail">
209
        <a name="M000032"></a>
210

    
211
        <div class="method-heading">
212
          <a href="DataTable.src/M000032.html" target="Code" class="method-signature"
213
            onclick="popupCode('DataTable.src/M000032.html');return false;">
214
          <span class="method-name">data_format</span><span class="method-args">()</span>
215
          </a>
216
        </div>
217
      
218
        <div class="method-description">
219
        </div>
220
      </div>
221

    
222
      <div id="method-M000027" class="method-detail">
223
        <a name="M000027"></a>
224

    
225
        <div class="method-heading">
226
          <a href="DataTable.src/M000027.html" target="Code" class="method-signature"
227
            onclick="popupCode('DataTable.src/M000027.html');return false;">
228
          <span class="method-name">docid</span><span class="method-args">()</span>
229
          </a>
230
        </div>
231
      
232
        <div class="method-description">
233
          <p>
234
pulls the docid from distribution element
235
</p>
236
        </div>
237
      </div>
238

    
239
      <div id="method-M000040" class="method-detail">
240
        <a name="M000040"></a>
241

    
242
        <div class="method-heading">
243
          <a href="DataTable.src/M000040.html" target="Code" class="method-signature"
244
            onclick="popupCode('DataTable.src/M000040.html');return false;">
245
          <span class="method-name">entity_name</span><span class="method-args">()</span>
246
          </a>
247
        </div>
248
      
249
        <div class="method-description">
250
        </div>
251
      </div>
252

    
253
      <div id="method-M000033" class="method-detail">
254
        <a name="M000033"></a>
255

    
256
        <div class="method-heading">
257
          <a href="DataTable.src/M000033.html" target="Code" class="method-signature"
258
            onclick="popupCode('DataTable.src/M000033.html');return false;">
259
          <span class="method-name">field_delimiter</span><span class="method-args">()</span>
260
          </a>
261
        </div>
262
      
263
        <div class="method-description">
264
        </div>
265
      </div>
266

    
267
      <div id="method-M000038" class="method-detail">
268
        <a name="M000038"></a>
269

    
270
        <div class="method-heading">
271
          <a href="DataTable.src/M000038.html" target="Code" class="method-signature"
272
            onclick="popupCode('DataTable.src/M000038.html');return false;">
273
          <span class="method-name">field_delimiter</span><span class="method-args">()</span>
274
          </a>
275
        </div>
276
      
277
        <div class="method-description">
278
        </div>
279
      </div>
280

    
281
      <div id="method-M000028" class="method-detail">
282
        <a name="M000028"></a>
283

    
284
        <div class="method-heading">
285
          <a href="DataTable.src/M000028.html" target="Code" class="method-signature"
286
            onclick="popupCode('DataTable.src/M000028.html');return false;">
287
          <span class="method-name">id</span><span class="method-args">()</span>
288
          </a>
289
        </div>
290
      
291
        <div class="method-description">
292
          <p>
293
refers to the docid function
294
</p>
295
        </div>
296
      </div>
297

    
298
      <div id="method-M000029" class="method-detail">
299
        <a name="M000029"></a>
300

    
301
        <div class="method-heading">
302
          <a href="DataTable.src/M000029.html" target="Code" class="method-signature"
303
            onclick="popupCode('DataTable.src/M000029.html');return false;">
304
          <span class="method-name">location</span><span class="method-args">()</span>
305
          </a>
306
        </div>
307
      
308
        <div class="method-description">
309
          <p>
310
attribute reader for online distribution
311
</p>
312
        </div>
313
      </div>
314

    
315
      <div id="method-M000036" class="method-detail">
316
        <a name="M000036"></a>
317

    
318
        <div class="method-heading">
319
          <a href="DataTable.src/M000036.html" target="Code" class="method-signature"
320
            onclick="popupCode('DataTable.src/M000036.html');return false;">
321
          <span class="method-name">num_headers</span><span class="method-args">()</span>
322
          </a>
323
        </div>
324
      
325
        <div class="method-description">
326
        </div>
327
      </div>
328

    
329
      <div id="method-M000030" class="method-detail">
330
        <a name="M000030"></a>
331

    
332
        <div class="method-heading">
333
          <a href="DataTable.src/M000030.html" target="Code" class="method-signature"
334
            onclick="popupCode('DataTable.src/M000030.html');return false;">
335
          <span class="method-name">physical</span><span class="method-args">()</span>
336
          </a>
337
        </div>
338
      
339
        <div class="method-description">
340
        </div>
341
      </div>
342

    
343
      <div id="method-M000041" class="method-detail">
344
        <a name="M000041"></a>
345

    
346
        <div class="method-heading">
347
          <a href="DataTable.src/M000041.html" target="Code" class="method-signature"
348
            onclick="popupCode('DataTable.src/M000041.html');return false;">
349
          <span class="method-name">read</span><span class="method-args">() {|f| ...}</span>
350
          </a>
351
        </div>
352
      
353
        <div class="method-description">
354
          <p>
355
reads the dataTable text from the url or docid specified by the
356
physical/distribution/online/url entity
357
</p>
358
        </div>
359
      </div>
360

    
361
      <div id="method-M000037" class="method-detail">
362
        <a name="M000037"></a>
363

    
364
        <div class="method-heading">
365
          <a href="DataTable.src/M000037.html" target="Code" class="method-signature"
366
            onclick="popupCode('DataTable.src/M000037.html');return false;">
367
          <span class="method-name">record_delimiter</span><span class="method-args">()</span>
368
          </a>
369
        </div>
370
      
371
        <div class="method-description">
372
        </div>
373
      </div>
374

    
375
      <div id="method-M000035" class="method-detail">
376
        <a name="M000035"></a>
377

    
378
        <div class="method-heading">
379
          <a href="DataTable.src/M000035.html" target="Code" class="method-signature"
380
            onclick="popupCode('DataTable.src/M000035.html');return false;">
381
          <span class="method-name">simple_delimited</span><span class="method-args">()</span>
382
          </a>
383
        </div>
384
      
385
        <div class="method-description">
386
        </div>
387
      </div>
388

    
389
      <div id="method-M000031" class="method-detail">
390
        <a name="M000031"></a>
391

    
392
        <div class="method-heading">
393
          <a href="DataTable.src/M000031.html" target="Code" class="method-signature"
394
            onclick="popupCode('DataTable.src/M000031.html');return false;">
395
          <span class="method-name">size</span><span class="method-args">()</span>
396
          </a>
397
        </div>
398
      
399
        <div class="method-description">
400
          <p>
401
only supports unit bytes
402
</p>
403
        </div>
404
      </div>
405

    
406
      <div id="method-M000034" class="method-detail">
407
        <a name="M000034"></a>
408

    
409
        <div class="method-heading">
410
          <a href="DataTable.src/M000034.html" target="Code" class="method-signature"
411
            onclick="popupCode('DataTable.src/M000034.html');return false;">
412
          <span class="method-name">text_format</span><span class="method-args">()</span>
413
          </a>
414
        </div>
415
      
416
        <div class="method-description">
417
        </div>
418
      </div>
419

    
420

    
421
    </div>
422

    
423

    
424
  </div>
425

    
426

    
427
<div id="validator-badges">
428
  <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
429
</div>
430

    
431
</body>
432
</html>
(1-1/9)